It's needed to implement monoburg rule reg: OP_XOR(reg, reg)

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 7ded6ea..1f6a699 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -919,6 +919,12 @@ static void emit_or_reg_reg(struct buffer *buf, struct 
operand *src,
        emit_reg_reg(buf, 0x0b, dest, src);
 }
 
+static void emit_xor_reg_reg(struct buffer *buf, struct operand *src,
+                            struct operand *dest)
+{
+       emit_reg_reg(buf, 0x33, dest, src);
+}
+
 static void __emit_add_imm_reg(struct buffer *buf, long imm, enum machine_reg 
reg)
 {
        emit_alu_imm_reg(buf, 0x00, imm, reg);
@@ -1061,6 +1067,7 @@ struct emitter emitters[] = {
        DECL_EMITTER(INSN_TEST_MEMBASE_REG, emit_test_membase_reg, 
TWO_OPERANDS),
        DECL_EMITTER(INSN_XOR_MEMBASE_REG, emit_xor_membase_reg, TWO_OPERANDS),
        DECL_EMITTER(INSN_XOR_IMM_REG, emit_xor_imm_reg, TWO_OPERANDS),
+       DECL_EMITTER(INSN_XOR_REG_REG, emit_xor_reg_reg, TWO_OPERANDS),
 };
 
 /*
diff --git a/arch/x86/include/arch/instruction.h 
b/arch/x86/include/arch/instruction.h
index 9dd5e3c..cb8128c 100644
--- a/arch/x86/include/arch/instruction.h
+++ b/arch/x86/include/arch/instruction.h
@@ -112,6 +112,7 @@ enum insn_type {
        INSN_TEST_MEMBASE_REG,
        INSN_XOR_MEMBASE_REG,
        INSN_XOR_IMM_REG,
+       INSN_XOR_REG_REG,
 
 #ifdef CONFIG_X86_64
        INSN64_ADD_IMM_REG,
diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c
index 8b4bc7f..28d76a0 100644
--- a/arch/x86/lir-printer.c
+++ b/arch/x86/lir-printer.c
@@ -504,6 +504,12 @@ static int print_xor_imm_reg(struct string *str, struct 
insn *insn)
        return print_imm_reg(str, insn);
 }
 
+static int print_xor_reg_reg(struct string *str, struct insn *insn)
+{
+       print_func_name(str);
+       return print_reg_reg(str, insn);
+}
+
 typedef int (*print_insn_fn) (struct string *str, struct insn *insn);
 
 static print_insn_fn insn_printers[] = {
@@ -565,6 +571,7 @@ static print_insn_fn insn_printers[] = {
        [INSN_TEST_MEMBASE_REG] = print_test_membase_reg,
        [INSN_XOR_MEMBASE_REG] = print_xor_membase_reg,
        [INSN_XOR_IMM_REG] = print_xor_imm_reg,
+       [INSN_XOR_REG_REG] = print_xor_reg_reg,
 };
 
 int lir_print(struct insn *insn, struct string *str)
diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c
index 12e4720..dcbdd18 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_TEST_MEMBASE_REG, USE_SRC | USE_DST | DEF_NONE),
        DECLARE_INFO(INSN_XOR_MEMBASE_REG, USE_SRC | DEF_DST),
        DECLARE_INFO(INSN_XOR_IMM_REG, USE_SRC | DEF_DST),
+       DECLARE_INFO(INSN_XOR_REG_REG, USE_SRC | DEF_DST),
 };
 
 static inline struct insn_info *get_info(struct insn *insn)
-- 
1.6.0.6


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

Reply via email to