From 0c627cdca20155753a536c51385abb73941a59a0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 30 Mar 2014 16:51:54 -0700 Subject: 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 Signed-off-by: Richard Henderson --- tcg/tcg.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'tcg/tcg.c') diff --git a/tcg/tcg.c b/tcg/tcg.c index ee041b9..4115e8b 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 */ -- cgit v1.1