#ifndef __SCC_X86_ENCODE_H__ #define __SCC_X86_ENCODE_H__ #include "../scc_mcode.h" #include "scc_x86_iform.h" #include "scc_x86_reg.h" typedef struct { scc_x86_reg_t base; scc_x86_reg_t index; u8 scale; /* 1,2,4,8 */ i32 disp; } scc_x86_mem_t; typedef struct { scc_x86_operand_kind_t kind; union { scc_x86_reg_t reg; i64 imm; scc_x86_mem_t mem; }; } scc_x86_operand_value_t; /* 按 iform 发射一条指令,ops 数组长度需与 iform 定义的操作数数目一致 */ int scc_x86_encode_inst(scc_mcode_t *mcode, scc_x86_iform_t iform, const scc_x86_operand_value_t *ops); #endif /* __SCC_X86_ENCODE_H__ */