aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2014-05-18 11:36:07 +0800
committerTeddy <[email protected]>2014-05-18 11:36:07 +0800
commit73559820d75f3b766c9db2489f7f8cad224d257f (patch)
treec8f1beb4474050487affb97525d086d9a529839a
parentd84e0dac79287b481a833cce3353c0d59fa7b9a1 (diff)
...
-rw-r--r--ssa.c10
-rw-r--r--ssa.h2
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;