It will be used in lookupswitch jump instead of
PUSH_MEMBASE and RET.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 arch/x86/emit-code.c                |    7 +++++++
 arch/x86/include/arch/instruction.h |    1 +
 arch/x86/lir-printer.c              |    7 +++++++
 arch/x86/use-def.c                  |    1 +
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 263d370..8f73e53 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -1702,6 +1702,12 @@ static void emit_jmp_memindex(struct buffer *buf, struct 
operand *target)
                             encode_reg(&target->base_reg)));
 }
 
+static void emit_jmp_membase(struct buffer *buf, struct operand *target)
+{
+       __emit_membase(buf, 0xff, mach_reg(&target->base_reg), target->disp,
+                      0x04);
+}
+
 struct emitter emitters[] = {
        GENERIC_X86_EMITTERS,
        DECL_EMITTER(INSN_ADC_IMM_REG, emit_adc_imm_reg, TWO_OPERANDS),
@@ -1737,6 +1743,7 @@ struct emitter emitters[] = {
        DECL_EMITTER(INSN_CONV_FPU64_TO_GPR, emit_conv_fpu64_to_gpr, 
TWO_OPERANDS),
        DECL_EMITTER(INSN_CONV_XMM_TO_XMM64, emit_conv_xmm_to_xmm64, 
TWO_OPERANDS),
        DECL_EMITTER(INSN_CONV_XMM64_TO_XMM, emit_conv_xmm64_to_xmm, 
TWO_OPERANDS),
+       DECL_EMITTER(INSN_JMP_MEMBASE, emit_jmp_membase, SINGLE_OPERAND),
        DECL_EMITTER(INSN_JMP_MEMINDEX, emit_jmp_memindex, SINGLE_OPERAND),
        DECL_EMITTER(INSN_MOV_MEMBASE_XMM, emit_mov_membase_xmm, TWO_OPERANDS),
        DECL_EMITTER(INSN_MOV_64_MEMBASE_XMM, emit_mov_64_membase_xmm, 
TWO_OPERANDS),
diff --git a/arch/x86/include/arch/instruction.h 
b/arch/x86/include/arch/instruction.h
index b45959d..4f178a8 100644
--- a/arch/x86/include/arch/instruction.h
+++ b/arch/x86/include/arch/instruction.h
@@ -98,6 +98,7 @@ enum insn_type {
        INSN_JLE_BRANCH,
        INSN_JL_BRANCH,
        INSN_JMP_MEMINDEX,
+       INSN_JMP_MEMBASE,
        INSN_JMP_BRANCH,
        INSN_JNE_BRANCH,
        INSN_MOV_IMM_MEMBASE,
diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c
index 070a5db..f2861ae 100644
--- a/arch/x86/lir-printer.c
+++ b/arch/x86/lir-printer.c
@@ -486,6 +486,12 @@ static int print_jmp_memindex(struct string *str, struct 
insn *insn)
        return print_memindex(str, &insn->operand);
 }
 
+static int print_jmp_membase(struct string *str, struct insn *insn)
+{
+       print_func_name(str);
+       return print_membase(str, &insn->operand);
+}
+
 static int print_jne_branch(struct string *str, struct insn *insn)
 {
        print_func_name(str);
@@ -913,6 +919,7 @@ static print_insn_fn insn_printers[] = {
        [INSN_JLE_BRANCH] = print_jle_branch,
        [INSN_JL_BRANCH] = print_jl_branch,
        [INSN_JMP_BRANCH] = print_jmp_branch,
+       [INSN_JMP_MEMBASE] = print_jmp_membase,
        [INSN_JMP_MEMINDEX] = print_jmp_memindex,
        [INSN_JNE_BRANCH] = print_jne_branch,
        [INSN_MOV_IMM_MEMBASE] = print_mov_imm_membase,
diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c
index 7b82b26..8ade62a 100644
--- a/arch/x86/use-def.c
+++ b/arch/x86/use-def.c
@@ -85,6 +85,7 @@ static struct insn_info insn_infos[] = {
        DECLARE_INFO(INSN_JLE_BRANCH, USE_NONE | DEF_NONE),
        DECLARE_INFO(INSN_JL_BRANCH, USE_NONE | DEF_NONE),
        DECLARE_INFO(INSN_JMP_BRANCH, USE_NONE | DEF_NONE),
+       DECLARE_INFO(INSN_JMP_MEMBASE, USE_SRC | DEF_NONE),
        DECLARE_INFO(INSN_JMP_MEMINDEX, USE_IDX_SRC | USE_SRC | DEF_NONE),
        DECLARE_INFO(INSN_JNE_BRANCH, USE_NONE | DEF_NONE),
        DECLARE_INFO(INSN_MOV_IMM_MEMBASE, USE_DST),
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to