plugins: Replace pr_ops with a proper debug dump flag
The DEBUG_PLUGIN_GEN_OPS ifdef is replaced with "-d op_plugin".
The second pr_ops call can be obtained with "-d op".
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/tcg/tcg.c b/tcg/tcg.c
index cfcf912..d827c6d 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2540,6 +2540,15 @@
[TCG_BSWAP_IZ | TCG_BSWAP_OS] = "iz,os",
};
+#ifdef CONFIG_PLUGIN
+static const char * const plugin_from_name[] = {
+ "from-tb",
+ "from-insn",
+ "after-insn",
+ "after-tb",
+};
+#endif
+
static inline bool tcg_regset_single(TCGRegSet d)
{
return (d & (d - 1)) == 0;
@@ -2558,7 +2567,7 @@
#define ne_fprintf(...) \
({ int ret_ = fprintf(__VA_ARGS__); ret_ >= 0 ? ret_ : 0; })
-static void tcg_dump_ops(TCGContext *s, FILE *f, bool have_prefs)
+void tcg_dump_ops(TCGContext *s, FILE *f, bool have_prefs)
{
char buf[128];
TCGOp *op;
@@ -2714,6 +2723,24 @@
i = k = 1;
}
break;
+#ifdef CONFIG_PLUGIN
+ case INDEX_op_plugin_cb:
+ {
+ TCGArg from = op->args[k++];
+ const char *name = NULL;
+
+ if (from < ARRAY_SIZE(plugin_from_name)) {
+ name = plugin_from_name[from];
+ }
+ if (name) {
+ col += ne_fprintf(f, "%s", name);
+ } else {
+ col += ne_fprintf(f, "$0x%" TCG_PRIlx, from);
+ }
+ i = 1;
+ }
+ break;
+#endif
default:
i = 0;
break;