From 73559820d75f3b766c9db2489f7f8cad224d257f Mon Sep 17 00:00:00 2001 From: Teddy Date: Sun, 18 May 2014 11:36:07 +0800 Subject: ... --- ssa.c | 10 ++++++---- ssa.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ssa.c b/ssa.c index ba76a2b..86c7805 100644 --- a/ssa.c +++ b/ssa.c @@ -339,6 +339,8 @@ void ssa_generate(int quiet) { cf->defs = defs; cf->entry = entry; cf->next = func_ir; + memmove(cf->blks, blks); + memmove(cf->ord, ord); func_ir = cf; gbbase += bcnt; bcnt = 0; @@ -2145,7 +2147,7 @@ void const_propagation(void) { int i; for (i = bcnt - 1; i >= 0; i--) { - CBlock_t b = blks[vis[i]]; + CBlock_t b = blks[ord[i]]; CInst_t i, ni, ih = b->insts; for (i = ih->next; i != ih; i = ni) { @@ -2282,7 +2284,7 @@ void strength_reduction(void) { int call_cnt = 0; for (i = bcnt - 1; i >= 0; i--) { - CBlock_t b = blks[vis[i]]; + CBlock_t b = blks[ord[i]]; CInst_t i, ni, ih = b->insts; for (i = ih->next; i != ih; i = ni) { @@ -2615,7 +2617,7 @@ void deadcode_elimination() { int i; for (i = bcnt - 1; i >= 0; i--) { - CBlock_t b = blks[vis[i]]; + CBlock_t b = blks[ord[i]]; CInst_t i, ih = b->insts; for (i = ih->next; i != ih; i = i->next) { @@ -2626,7 +2628,7 @@ void deadcode_elimination() { } for (i = bcnt - 1; i >= 0; i--) { - CBlock_t b = blks[vis[i]]; + CBlock_t b = blks[ord[i]]; CInst_t i, ih = b->insts; for (i = ih->next; i != ih; i = i->next) if (i->op != CALL && i->dest && i->dest->kind == TMP && !i->dest->dep) diff --git a/ssa.h b/ssa.h index 2ad86cd..92e2262 100644 --- a/ssa.h +++ b/ssa.h @@ -149,6 +149,8 @@ typedef struct CFuncIR CFuncIR; typedef CFuncIR *CFuncIR_t; struct CFuncIR { int gbbase; + CBlock_t blks[MAX_BLOCK]; + int ord[MAX_BLOCK]; CBlock_t entry; COList_t defs; CType_t func; -- cgit v1.2.3-70-g09d2