This will be necessary for stack slot copies when doing control flow
resolution.

Signed-off-by: Arthur Huillet <arthur.huil...@free.fr>
---
 arch/x86/emit-code.c                |    8 ++++++++
 arch/x86/include/arch/instruction.h |    1 +
 arch/x86/lir-printer.c              |    7 +++++++
 arch/x86/use-def.c                  |    2 ++
 4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 227efcb..ea11cec 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -887,6 +887,13 @@ static void emit_pop_memlocal(struct buffer *buf, struct 
operand *operand)
        __emit_membase(buf, 0x8f, REG_EBP, disp, 0);
 }
 
+static void emit_push_memlocal(struct buffer *buf, struct operand *operand)
+{
+       unsigned long disp = slot_offset(operand->slot);
+
+       __emit_membase(buf, 0xff, REG_EBP, disp, 6);
+}
+
 static void emit_pop_reg(struct buffer *buf, struct operand *operand)
 {
        __emit_pop_reg(buf, mach_reg(&operand->reg));
@@ -1329,6 +1336,7 @@ struct emitter emitters[] = {
        DECL_EMITTER(INSN_OR_REG_REG, emit_or_reg_reg, TWO_OPERANDS),
        DECL_EMITTER(INSN_PUSH_IMM, emit_push_imm, SINGLE_OPERAND),
        DECL_EMITTER(INSN_PUSH_REG, emit_push_reg, SINGLE_OPERAND),
+       DECL_EMITTER(INSN_PUSH_MEMLOCAL, emit_push_memlocal, SINGLE_OPERAND),
        DECL_EMITTER(INSN_POP_MEMLOCAL, emit_pop_memlocal, SINGLE_OPERAND),
        DECL_EMITTER(INSN_POP_REG, emit_pop_reg, SINGLE_OPERAND),
        DECL_EMITTER(INSN_SAR_IMM_REG, emit_sar_imm_reg, TWO_OPERANDS),
diff --git a/arch/x86/include/arch/instruction.h 
b/arch/x86/include/arch/instruction.h
index 9639e12..5ac90d3 100644
--- a/arch/x86/include/arch/instruction.h
+++ b/arch/x86/include/arch/instruction.h
@@ -111,6 +111,7 @@ enum insn_type {
        INSN_OR_REG_REG,
        INSN_PUSH_IMM,
        INSN_PUSH_REG,
+       INSN_PUSH_MEMLOCAL,
        INSN_POP_MEMLOCAL,
        INSN_POP_REG,
        INSN_RET,
diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c
index c27c4f4..819680e 100644
--- a/arch/x86/lir-printer.c
+++ b/arch/x86/lir-printer.c
@@ -523,6 +523,12 @@ static int print_push_reg(struct string *str, struct insn 
*insn)
        return print_reg(str, &insn->operand);
 }
 
+static int print_push_memlocal(struct string *str, struct insn *insn)
+{
+       print_func_name(str);
+       return print_memlocal(str, &insn->operand);
+}
+
 static int print_pop_memlocal(struct string *str, struct insn *insn)
 {
        print_func_name(str);
@@ -690,6 +696,7 @@ static print_insn_fn insn_printers[] = {
        [INSN_OR_REG_REG] = print_or_reg_reg,
        [INSN_PUSH_IMM] = print_push_imm,
        [INSN_PUSH_REG] = print_push_reg,
+       [INSN_PUSH_MEMLOCAL] = print_push_memlocal,
        [INSN_POP_MEMLOCAL] = print_pop_memlocal,
        [INSN_POP_REG] = print_pop_reg,
        [INSN_RET] = print_ret,
diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c
index 1c7790c..39a9cfe 100644
--- a/arch/x86/use-def.c
+++ b/arch/x86/use-def.c
@@ -95,7 +95,9 @@ static struct insn_info insn_infos[] = {
        DECLARE_INFO(INSN_OR_REG_REG, USE_SRC | DEF_DST),
        DECLARE_INFO(INSN_PUSH_IMM, USE_NONE | DEF_NONE),
        DECLARE_INFO(INSN_PUSH_REG, USE_SRC | DEF_NONE),
+       DECLARE_INFO(INSN_PUSH_MEMLOCAL, USE_SRC | DEF_NONE),
        DECLARE_INFO(INSN_POP_REG, USE_NONE | DEF_SRC),
+       DECLARE_INFO(INSN_POP_MEMLOCAL, USE_SRC | DEF_NONE),
        DECLARE_INFO(INSN_RET, USE_NONE | DEF_NONE),
        DECLARE_INFO(INSN_SAR_IMM_REG, DEF_DST),
        DECLARE_INFO(INSN_SAR_REG_REG, USE_SRC | DEF_DST),
-- 
1.5.6.3



------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to