qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 29/39] target/i386: introduce helper-based co


From: Jan Bobek
Subject: [Qemu-devel] [RFC PATCH v2 29/39] target/i386: introduce helper-based code generator macros
Date: Sat, 10 Aug 2019 00:12:45 -0400

Code generators defined using these macros rely on a helper function
(as emitted by gen_helper_*).

Signed-off-by: Jan Bobek <address@hidden>
---
 target/i386/translate.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/target/i386/translate.c b/target/i386/translate.c
index 19b92d61f6..d721bb5142 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -4856,6 +4856,32 @@ INSNOP_LDST_UNIFY(Qq, Nq, NqMq)
 #define gen_insn_wrrr(mnem, opW1, opR1, opR2, opR3)     \
     gen_ ## mnem ## _ ## opW1 ## opR1 ## opR2 ## opR3
 
+#define GEN_INSN_HELPER(mnem, helper)           \
+    static void gen_insn(mnem)(                 \
+        CPUX86State *env, DisasContext *s)      \
+    {                                           \
+        gen_helper_ ## helper(cpu_env);         \
+    }
+#define GEN_INSN_WR_HELPER(mnem, helper, opW1, opR1)            \
+    static void gen_insn_wr(mnem, opW1, opR1)(                  \
+        CPUX86State *env, DisasContext *s, insnop_t(opW1) ret,  \
+        insnop_t(opR1) arg1)                                    \
+    {                                                           \
+        tcg_gen_addi_ptr(s->ptr0, cpu_env, ret);                \
+        tcg_gen_addi_ptr(s->ptr1, cpu_env, arg1);               \
+        gen_helper_ ## helper(cpu_env, s->ptr0, s->ptr1);       \
+    }
+#define GEN_INSN_WRR_HELPER(mnem, helper, opW1, opR1, opR2)     \
+    static void gen_insn_wrr(mnem, opW1, opR1, opR2)(           \
+        CPUX86State *env, DisasContext *s, insnop_t(opW1) ret,  \
+        insnop_t(opR1) arg1, insnop_t(opR2) arg2)               \
+    {                                                           \
+        assert(ret == arg1);                                    \
+        tcg_gen_addi_ptr(s->ptr0, cpu_env, ret);                \
+        tcg_gen_addi_ptr(s->ptr1, cpu_env, arg2);               \
+        gen_helper_ ## helper(cpu_env, s->ptr0, s->ptr1);       \
+    }
+
 /*
  * Instruction translators
  */
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]