[PATCH v2 47/50] target/hexagon: Use helper-to-tcg helper calls

Anton Johansson via qemu development <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
Replaces the default "helper-gen.h" header with those provided by
helper-to-tcg.  `gen_helper_*()` definitions are generated for all
helpers in the input module, regardless of whether they successfully
translated or not.  The generated `gen_helper_*()` calls into either
`emit_*()` or `tcg_gen_callN` depending on whether translation of that
helper was successful or not.

Signed-off-by: Anton Johansson <[email protected]>
---
 target/hexagon/genptr.c    | 4 ++++
 target/hexagon/helper.h    | 8 ++++++++
 target/hexagon/translate.c | 8 ++++++++
 3 files changed, 20 insertions(+)

diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
index 5acf237bf0..d99580e815 100644
--- a/target/hexagon/genptr.c
+++ b/target/hexagon/genptr.c
@@ -20,7 +20,11 @@
 #include "internal.h"
 #include "tcg/tcg-op.h"
 #include "tcg/tcg-op-gvec.h"
+#if defined(TARGET_HELPER_TO_TCG)
+#include "helper-to-tcg-emitted.h"
+#else
 #include "exec/helper-gen.h"
+#endif
 #include "insn.h"
 #include "opcodes.h"
 #include "sys_macros.h"
diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h
index 74d5b7ffe8..1796ef7144 100644
--- a/target/hexagon/helper.h
+++ b/target/hexagon/helper.h
@@ -133,3 +133,11 @@ DEF_HELPER_1(resched, void, env)
 DEF_HELPER_3(modify_ssr, void, env, i32, i32)
 DEF_HELPER_1(pending_interrupt, void, env)
 #endif
+
+/*
+ * Include generated helper-to-tcg support helpers, but not during IR
+ * generation since they won't have been emitted at that point.
+ */
+#if defined(TARGET_HELPER_TO_TCG) && !defined(HELPER_TO_TCG_IR_GEN)
+# include "helper-to-tcg-support-helpers.h"
+#endif
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 870475010b..ab6e100a38 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -20,7 +20,15 @@
 #include "cpu.h"
 #include "tcg/tcg-op.h"
 #include "tcg/tcg-op-gvec.h"
+/*
+ * Include generated gen_helper_*() definitions if using helper-to-tcg, but
+ * only when not generating input IR since the header won't exist at that point.
+ */
+#if defined(TARGET_HELPER_TO_TCG) && !defined(HELPER_TO_TCG_IR_GEN)
+#include "helper-to-tcg-emitted.h"
+#else
 #include "exec/helper-gen.h"
+#endif
 #include "exec/helper-proto.h"
 #include "exec/translation-block.h"
 #include "accel/tcg/cpu-ldst.h"
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.