From a80cdd3183ed85bc254cbe22ca240dc035fc6548 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 4 Jun 2021 14:26:45 -0700 Subject: tcg: Introduce tcg_remove_ops_after Introduce a function to remove everything emitted since a given point. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/tcg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tcg/tcg.c') 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; -- cgit v1.2.3