summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/ValueNumbering.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
commit0bec4f557a96e1a40437cf5af20cc78a5eec8a63 (patch)
treec1e05ec804c43aa5a8f5f21b0ed02d0587d29563 /compiler_and_linker/unsorted/ValueNumbering.c
parentaec1b8dddc68ecb8288ec6132932e4c7b4bca09f (diff)
downloadMWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.tar.gz
MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.zip
getting closer
Diffstat (limited to 'compiler_and_linker/unsorted/ValueNumbering.c')
-rw-r--r--compiler_and_linker/unsorted/ValueNumbering.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler_and_linker/unsorted/ValueNumbering.c b/compiler_and_linker/unsorted/ValueNumbering.c
index 670471d..0907fa1 100644
--- a/compiler_and_linker/unsorted/ValueNumbering.c
+++ b/compiler_and_linker/unsorted/ValueNumbering.c
@@ -265,7 +265,7 @@ static int matchvalues(AvailableValue *av, PCode *match) {
}
}
- if ((match->flags & (fPCodeFlag2 | fPCodeFlag20000)) && match->alias->valuenumber != av->aliasnumber)
+ if ((match->flags & (fIsRead | fPCodeFlag20000)) && match->alias->valuenumber != av->aliasnumber)
return 0;
return 1;
@@ -331,7 +331,7 @@ static void addavailablevalue(PCode *pcode) {
av->opnumbers[i] = regvalue[op->arg][op->data.reg.reg].number;
}
- if (pcode->flags & (fPCodeFlag2 | fPCodeFlag20000))
+ if (pcode->flags & (fIsRead | fPCodeFlag20000))
av->aliasnumber = pcode->alias->valuenumber;
op = &pcode->args[0];
@@ -368,7 +368,7 @@ static int isCSEop(PCode *pcode) {
break;
}
- if (PCODE_FLAG_SET_F(pcode) & (fIsVolatile | fSideEffects | fOverflow | fPCodeFlag10000000 | fPCodeFlag20000000))
+ if (PCODE_FLAG_SET_F(pcode) & (fIsVolatile | fSideEffects | fOverflow | fSetsCarry | fRecordBit))
return 0;
for (i = 0, op = &pcode->args[0]; i < pcode->argCount; i++, op++) {
@@ -542,17 +542,17 @@ static void removecsesfrombasicblock(PCodeBlock *block) {
for (pcode = block->firstPCode; pcode; pcode = next) {
next = pcode->nextPCode;
propagatecopiesto(pcode);
- if (pcode->flags & fPCodeFlag10) {
+ if (pcode->flags & fIsMove) {
registercopy(pcode);
- } else if ((pcode->flags & fPCodeFlag8) && (pcode->flags & (fLink | fSideEffects))) {
+ } else if ((pcode->flags & fIsCall) && (pcode->flags & (fLink | fSideEffects))) {
functioncall(pcode);
- } else if (pcode->flags & fPCodeFlag2) {
- if (pcode->flags & fPCodeFlag20)
+ } else if (pcode->flags & fIsRead) {
+ if (pcode->flags & fIsPtrOp)
pointerload(pcode);
else
simpleload(pcode);
- } else if (pcode->flags & fPCodeFlag4) {
- if (pcode->flags & fPCodeFlag20)
+ } else if (pcode->flags & fIsWrite) {
+ if (pcode->flags & fIsPtrOp)
pointerstore(pcode);
else
simplestore(pcode);
@@ -567,7 +567,7 @@ static void removecsesfrombasicblock(PCodeBlock *block) {
}
}
- block->flags |= fPCBlockFlag4;
+ block->flags |= fVisited;
}
static void getvaluestate(State *state) {
@@ -621,7 +621,7 @@ static void removecsesfromextendedbasicblock(PCodeBlock *block) {
counter = 0;
for (succ = block->successors; succ; succ = succ->nextLink) {
- if (!(succ->block->flags & fPCBlockFlag4) && succ->block->predecessors && !succ->block->predecessors->nextLink)
+ if (!(succ->block->flags & fVisited) && succ->block->predecessors && !succ->block->predecessors->nextLink)
counter++;
}
@@ -629,7 +629,7 @@ static void removecsesfromextendedbasicblock(PCodeBlock *block) {
getvaluestate(&state);
forkvaluestate(nextvaluenumber);
for (succ = block->successors; succ; succ = succ->nextLink) {
- if (!(succ->block->flags & fPCBlockFlag4) && succ->block->predecessors && !succ->block->predecessors->nextLink) {
+ if (!(succ->block->flags & fVisited) && succ->block->predecessors && !succ->block->predecessors->nextLink) {
removecsesfromextendedbasicblock(succ->block);
regressvaluestate();
}
@@ -647,10 +647,10 @@ void removecommonsubexpressions(Object *proc, int flag) {
allocatecsedatastructures();
for (block = pcbasicblocks; block; block = block->nextBlock)
- block->flags &= ~fPCBlockFlag4;
+ block->flags &= ~fVisited;
for (block = pcbasicblocks; block; block = block->nextBlock) {
- if (!(block->flags & fPCBlockFlag4)) {
+ if (!(block->flags & fVisited)) {
initializecsedatastructures();
removecsesfromextendedbasicblock(block);
}