summary refs log tree commit diff stats
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-06-04 14:26:45 -0700
committerRichard Henderson <richard.henderson@linaro.org>2021-06-13 17:42:40 -0700
commita80cdd3183ed85bc254cbe22ca240dc035fc6548 (patch)
tree93e6c5628e1c266ef32b3013030614d1f551ef15 /tcg/tcg.c
parent42eb6dfcf135068aa6873e6e9f5f8afa77858914 (diff)
downloadfocaccia-qemu-a80cdd3183ed85bc254cbe22ca240dc035fc6548.tar.gz
focaccia-qemu-a80cdd3183ed85bc254cbe22ca240dc035fc6548.zip
tcg: Introduce tcg_remove_ops_after
Introduce a function to remove everything emitted
since a given point.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 81da553244..ca482c2301 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2083,6 +2083,19 @@ void tcg_op_remove(TCGContext *s, TCGOp *op)
 #endif
 }
 
+void tcg_remove_ops_after(TCGOp *op)
+{
+    TCGContext *s = tcg_ctx;
+
+    while (true) {
+        TCGOp *last = tcg_last_op();
+        if (last == op) {
+            return;
+        }
+        tcg_op_remove(s, last);
+    }
+}
+
 static TCGOp *tcg_op_alloc(TCGOpcode opc)
 {
     TCGContext *s = tcg_ctx;