40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
#ifndef __SPL_IR2VM_H__
|
||
#define __SPL_IR2VM_H__
|
||
|
||
#include "spl_diag.h"
|
||
#include "spl_ir.h"
|
||
#include "spl_layout.h"
|
||
#include "spl_type.h"
|
||
|
||
#include "../stage0/spl_mcode.h"
|
||
|
||
typedef struct {
|
||
spl_ir_func_ref_t fid;
|
||
VEC(usize) node_first_ip;
|
||
} spl_ir2vm_fdbg_t;
|
||
typedef VEC(spl_ir2vm_fdbg_t) spl_ir2vm_fdbg_vec_t;
|
||
|
||
typedef MAP(spl_ir_func_ref_t, isize) spl_extern_idx_map_t;
|
||
|
||
typedef struct {
|
||
const spl_ir_t *ir;
|
||
const spl_type_t *type;
|
||
const spl_attr_t *attr;
|
||
spl_extern_idx_map_t extern_native;
|
||
spl_prog_t prog;
|
||
spl_layout_t *layout; /* 借用 splc0 的 layout(size/align/offset 唯一来源) */
|
||
|
||
spl_diag_t *diag;
|
||
int opt; /* 非 0:块内操作数栈化(表达式临时值留栈,块边界溢出回槽) */
|
||
} spl_ir2vm_t;
|
||
|
||
void spl_ir2vm_init(spl_ir2vm_t *ctx, const spl_ir_t *ir, const spl_type_t *type,
|
||
spl_layout_t *layout, const spl_attr_t *attr, int opt);
|
||
void spl_ir2vm_drop(spl_ir2vm_t *ctx);
|
||
|
||
int spl_ir2vm_run_func(spl_ir2vm_t *ctx, spl_ir_func_ref_t ref);
|
||
int spl_ir2vm_run(spl_ir2vm_t *ctx);
|
||
void spl_ir2vm_dump(spl_ir2vm_t *ctx);
|
||
|
||
#endif /* __SPL_IR2VM_H__ */
|