From 07de7509afa048badbdd1c4c3c9a4af407e7041c Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 29 Apr 2014 23:54:14 +0800 Subject: ... --- ssa.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ssa.c b/ssa.c index be7e4f0..bfc27a7 100644 --- a/ssa.c +++ b/ssa.c @@ -469,12 +469,26 @@ COpr_t ssa_exp_(CNode *p, CBlock_t cur, CInst_t lval, CBlock_t succ) { { inst->src1 = ssa_exp_(p->chd->next, cur, NULL, succ); ssa_exp_(p->chd, cur, inst, succ); - cblock_append(cur, inst); if (inst->op == MOVE) - return inst->dest; + { + CInst_t last = cblock_getback(cur); + if (last && last->dest->kind == TMP) + { + free(last->dest); + last->dest = inst->dest; + free(inst); + return last->dest; + } + else + { + cblock_append(cur, inst); + return inst->dest; + } + } else { CInst_t tins = NEW(CInst); + cblock_append(cur, inst); tins->op = ARR; tins->src1 = inst->dest; /* base */ tins->src2 = inst->src2; /* displacement */ -- cgit v1.2.3-70-g09d2