summaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-03-30 16:51:54 -0700
committerRichard Henderson <rth@twiddle.net>2015-02-12 21:21:38 -0800
commit0c627cdca20155753a536c51385abb73941a59a0 (patch)
tree3dd962f8a65c7734c193590f661387fcb9fb804e /tcg/tcg.c
parentc45cb8bb89fc798489869982c4c463b26ce43d7b (diff)
downloadqemu-0c627cdca20155753a536c51385abb73941a59a0.zip
tcg: Remove opcodes instead of noping them out
With the linked list scheme we need not leave nops in the stream that we need to process later. Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index ee041b9405..4115e8bae2 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1244,6 +1244,29 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs)
#endif
}
+void tcg_op_remove(TCGContext *s, TCGOp *op)
+{
+ int next = op->next;
+ int prev = op->prev;
+
+ if (next >= 0) {
+ s->gen_op_buf[next].prev = prev;
+ } else {
+ s->gen_last_op_idx = prev;
+ }
+ if (prev >= 0) {
+ s->gen_op_buf[prev].next = next;
+ } else {
+ s->gen_first_op_idx = next;
+ }
+
+ *op = (TCGOp){ .opc = INDEX_op_nop, .next = -1, .prev = -1 };
+
+#ifdef CONFIG_PROFILER
+ s->del_op_count++;
+#endif
+}
+
#ifdef USE_LIVENESS_ANALYSIS
/* liveness analysis: end of function: all temps are dead, and globals
should be in memory. */
@@ -1466,10 +1489,7 @@ static void tcg_liveness_analysis(TCGContext *s)
}
}
do_remove:
- op->opc = INDEX_op_nop;
-#ifdef CONFIG_PROFILER
- s->del_op_count++;
-#endif
+ tcg_op_remove(s, op);
} else {
do_not_remove:
/* output args are dead */