aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2018-11-26 12:47:28 -0800
committerRichard Henderson <richard.henderson@linaro.org>2018-12-26 06:40:27 +1100
commitd88a117eaa39b1d0eb1a79fe84c81840a39eb233 (patch)
treee586a2c98775f5e56d3f9a0614efb3a12456eb68 /tcg/tcg.c
parent15d7409260498505e991e7b9d87118627165e613 (diff)
downloadqemu-d88a117eaa39b1d0eb1a79fe84c81840a39eb233.zip
qemu-d88a117eaa39b1d0eb1a79fe84c81840a39eb233.tar.gz
qemu-d88a117eaa39b1d0eb1a79fe84c81840a39eb233.tar.bz2
tcg: Reference count labels
Increment when adding branches, and decrement when removing them. Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 963cb37..99afc65 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2171,6 +2171,26 @@ static void process_op_defs(TCGContext *s)
void tcg_op_remove(TCGContext *s, TCGOp *op)
{
+ TCGLabel *label;
+
+ switch (op->opc) {
+ case INDEX_op_br:
+ label = arg_label(op->args[0]);
+ label->refs--;
+ break;
+ case INDEX_op_brcond_i32:
+ case INDEX_op_brcond_i64:
+ label = arg_label(op->args[3]);
+ label->refs--;
+ break;
+ case INDEX_op_brcond2_i32:
+ label = arg_label(op->args[5]);
+ label->refs--;
+ break;
+ default:
+ break;
+ }
+
QTAILQ_REMOVE(&s->ops, op, link);
QTAILQ_INSERT_TAIL(&s->free_ops, op, link);
s->nb_ops--;