It's needed to implement efficient access to indirection table Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- arch/x86/emit-code.c | 8 ++++++++ arch/x86/include/arch/instruction.h | 1 + arch/x86/lir-printer.c | 15 +++++++++++++++ arch/x86/use-def.c | 1 + 4 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 8bb1f44..499bff4 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -543,6 +543,13 @@ static void emit_mov_thread_local_memdisp_reg(struct buffer *buf, __emit_memdisp_reg(buf, 0x8b, src->imm, mach_reg(&dest->reg)); } +static void emit_mov_memdisp_reg(struct buffer *buf, + struct operand *src, + struct operand *dest) +{ + __emit_memdisp_reg(buf, 0x8b, src->imm, mach_reg(&dest->reg)); +} + static void emit_mov_memindex_reg(struct buffer *buf, struct operand *src, struct operand *dest) { @@ -1036,6 +1043,7 @@ struct emitter emitters[] = { DECL_EMITTER(INSN_MOV_IMM_REG, emit_mov_imm_reg, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_MEMLOCAL_REG, emit_mov_memlocal_reg, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_MEMBASE_REG, emit_mov_membase_reg, TWO_OPERANDS), + DECL_EMITTER(INSN_MOV_MEMDISP_REG, emit_mov_memdisp_reg, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_THREAD_LOCAL_MEMDISP_REG, emit_mov_thread_local_memdisp_reg, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_MEMINDEX_REG, emit_mov_memindex_reg, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_REG_MEMBASE, emit_mov_reg_membase, TWO_OPERANDS), diff --git a/arch/x86/include/arch/instruction.h b/arch/x86/include/arch/instruction.h index cb8128c..2af92c7 100644 --- a/arch/x86/include/arch/instruction.h +++ b/arch/x86/include/arch/instruction.h @@ -81,6 +81,7 @@ enum insn_type { INSN_MOV_IMM_REG, INSN_MOV_MEMLOCAL_REG, INSN_MOV_MEMBASE_REG, + INSN_MOV_MEMDISP_REG, INSN_MOV_THREAD_LOCAL_MEMDISP_REG, INSN_MOV_MEMINDEX_REG, INSN_MOV_REG_MEMBASE, diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c index 28d76a0..d0871fd 100644 --- a/arch/x86/lir-printer.c +++ b/arch/x86/lir-printer.c @@ -102,6 +102,14 @@ static int print_membase_reg(struct string *str, struct insn *insn) return print_reg(str, &insn->dest); } +static int print_memdisp_reg(struct string *str, struct insn *insn) +{ + str_append(str, "("); + print_imm(str, &insn->src); + str_append(str, "), "); + return print_reg(str, &insn->dest); +} + static int print_tlmemdisp_reg(struct string *str, struct insn *insn) { str_append(str, "gs:("); @@ -306,6 +314,12 @@ static int print_mov_imm_reg(struct string *str, struct insn *insn) return print_imm_reg(str, insn); } +static int print_mov_memdisp_reg(struct string *str, struct insn *insn) +{ + print_func_name(str); + return print_memdisp_reg(str, insn); +} + static int print_mov_memlocal_reg(struct string *str, struct insn *insn) { print_func_name(str); @@ -540,6 +554,7 @@ static print_insn_fn insn_printers[] = { [INSN_MOV_IMM_REG] = print_mov_imm_reg, [INSN_MOV_MEMLOCAL_REG] = print_mov_memlocal_reg, [INSN_MOV_MEMBASE_REG] = print_mov_membase_reg, + [INSN_MOV_MEMDISP_REG] = print_mov_memdisp_reg, [INSN_MOV_THREAD_LOCAL_MEMDISP_REG] = print_mov_tlmemdisp_reg, [INSN_MOV_MEMINDEX_REG] = print_mov_memindex_reg, [INSN_MOV_REG_MEMBASE] = print_mov_reg_membase, diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c index dcbdd18..696edbe 100644 --- a/arch/x86/use-def.c +++ b/arch/x86/use-def.c @@ -56,6 +56,7 @@ static struct insn_info insn_infos[] = { DECLARE_INFO(INSN_MOV_IMM_REG, DEF_DST), DECLARE_INFO(INSN_MOV_MEMLOCAL_REG, USE_FP | DEF_DST), DECLARE_INFO(INSN_MOV_MEMBASE_REG, USE_SRC | DEF_DST), + DECLARE_INFO(INSN_MOV_MEMDISP_REG, USE_NONE | DEF_DST), DECLARE_INFO(INSN_MOV_THREAD_LOCAL_MEMDISP_REG, USE_NONE | DEF_DST), DECLARE_INFO(INSN_MOV_MEMINDEX_REG, USE_SRC | USE_IDX_SRC | DEF_DST), DECLARE_INFO(INSN_MOV_REG_MEMINDEX, USE_SRC | USE_DST | USE_IDX_DST | DEF_NONE), -- 1.6.0.6 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel