summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/LoopOptimization.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/LoopOptimization.c
parentaec1b8dddc68ecb8288ec6132932e4c7b4bca09f (diff)
downloadMWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.tar.gz
MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.zip
getting closer
Diffstat (limited to 'compiler_and_linker/unsorted/LoopOptimization.c')
-rw-r--r--compiler_and_linker/unsorted/LoopOptimization.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler_and_linker/unsorted/LoopOptimization.c b/compiler_and_linker/unsorted/LoopOptimization.c
index c2a360f..9db7c53 100644
--- a/compiler_and_linker/unsorted/LoopOptimization.c
+++ b/compiler_and_linker/unsorted/LoopOptimization.c
@@ -175,7 +175,7 @@ static void skiplooptest(Loop *loop) {
loop->bodySize--;
}
- for (instr = instr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode)
+ for (instr = instr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
insertpcodebefore(loop->preheader->lastPCode, copypcode(instr));
}
@@ -206,7 +206,7 @@ static void unrollloop(Loop *loop) {
if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI)
CError_FATAL(450);
- for (instr = firstInstr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode)
+ for (instr = firstInstr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
appendpcode(newBlock, copypcode(instr));
for (block = loop->preheader->successors->block; block != loop->body; block = block->successors->block) {
@@ -384,7 +384,7 @@ static void unrollloopconditional(Loop *loop) {
for (j = 0; j < inputBlockCount; j++) {
for (instr = blocks[j]->firstPCode; instr; instr = instr->nextPCode) {
- if (instr->flags & fPCodeFlag1) {
+ if (instr->flags & fIsBranch) {
PCodeArg *op;
int opID;
instrCopy = copypcode(instr);
@@ -425,7 +425,7 @@ static void unrollloopconditional(Loop *loop) {
if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI)
CError_FATAL(764);
- for (instr = firstInstr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode)
+ for (instr = firstInstr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
appendpcode(blocks2[inputBlockCount - 1], copypcode(instr));
for (j = 0; j < inputBlockCount; j++) {
@@ -465,7 +465,7 @@ static void unrollloopconditional(Loop *loop) {
for (i = 0; i < inputBlockCount; i++) {
for (instr = blocks[i]->firstPCode; instr; instr = instr->nextPCode) {
- if (instr->flags & fPCodeFlag1) {
+ if (instr->flags & fIsBranch) {
PCodeArg *op;
int opID;
op = NULL;
@@ -1293,7 +1293,7 @@ void changearraytoregisters(void) {
if ((arrays = scanforlocalarrays())) {
for (block = pcbasicblocks; block; block = block->nextBlock) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
- if (!(instr->flags & fPCodeFlag1) && instr->argCount) {
+ if (!(instr->flags & fIsBranch) && instr->argCount) {
op = instr->args;
i = instr->argCount;
while (i--) {
@@ -1304,7 +1304,7 @@ void changearraytoregisters(void) {
!array->invalid
) {
if (
- (instr->flags & (fPCodeFlag2 | fPCodeFlag4)) &&
+ (instr->flags & (fIsRead | fIsWrite)) &&
(op->data.mem.offset % array->elementSize) == 0 &&
op->data.mem.offset < array->arraySize
) {
@@ -1460,9 +1460,9 @@ void changearraytoregisters(void) {
for (block = pcbasicblocks; block; block = block->nextBlock) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if (
- !(instr->flags & fPCodeFlag1) &&
+ !(instr->flags & fIsBranch) &&
instr->argCount &&
- (instr->flags & (fPCodeFlag2 | fPCodeFlag4)) &&
+ (instr->flags & (fIsRead | fIsWrite)) &&
instr->args[2].kind == PCOp_MEMORY &&
(PCOpMemoryArg) instr->args[2].arg == PCOpMemory1 &&
(array = lookup_array_object(arrays, instr->args[2].data.mem.obj)) &&