summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/InterferenceGraph.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-13 01:38:15 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-13 01:38:15 +0000
commit08d21a052b9afc37292ec3fad390502610e2cb32 (patch)
tree270737c790f5d1bb05f68498f8233640ada6a0c5 /compiler_and_linker/unsorted/InterferenceGraph.c
parent54628993e0038c7bea9c064491974985b6699502 (diff)
parent9d985413ce2b60a1a8cf001913ee8dac81c03aac (diff)
downloadMWCC-08d21a052b9afc37292ec3fad390502610e2cb32.tar.gz
MWCC-08d21a052b9afc37292ec3fad390502610e2cb32.zip
Merge remote-tracking branch 'origin/main'
Diffstat (limited to 'compiler_and_linker/unsorted/InterferenceGraph.c')
-rw-r--r--compiler_and_linker/unsorted/InterferenceGraph.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/compiler_and_linker/unsorted/InterferenceGraph.c b/compiler_and_linker/unsorted/InterferenceGraph.c
index a849d1a..cc78a63 100644
--- a/compiler_and_linker/unsorted/InterferenceGraph.c
+++ b/compiler_and_linker/unsorted/InterferenceGraph.c
@@ -55,9 +55,7 @@ static void buildinterferencematrix(void) {
for (block = pcbasicblocks; block; block = block->nextBlock) {
bitvectorcopy(vec, liveinfo[block->blockIndex].out, regs);
for (instr = block->lastPCode; instr; instr = instr->prevPCode) {
- op = instr->args;
- i = instr->argCount;
- while (i--) {
+ for (op = instr->args, i = instr->argCount; i--; op++) {
if (PC_OP_IS_WRITE_ANY_REGISTER(op, coloring_class)) {
reg = op->data.reg.reg;
bitvectorclearbit(reg, vec);
@@ -73,23 +71,19 @@ static void buildinterferencematrix(void) {
}
}
}
- op++;
}
- op = instr->args;
- i = instr->argCount;
- while (i--) {
+ for (op = instr->args, i = instr->argCount; i--; op++) {
if (PC_OP_IS_READ_ANY_REGISTER(op, coloring_class)) {
reg = op->data.reg.reg;
if (bitvectorgetbit(reg, vec) == 0)
op->data.reg.effect |= Effect4;
bitvectorsetbit(reg, vec);
}
- op++;
}
if (coloring_class == RegClass_GPR) {
- if (PCODE_FLAG_SET_F(instr) & (fIsRead | fIsWrite | fPCodeFlag40000)) {
+ if (PCODE_FLAG_SET_F(instr) & (fIsRead | fIsWrite | fPCodeFlag400000)) {
if (instr->args[1].data.reg.reg >= n_real_registers[coloring_class])
makeinterfere(0, instr->args[1].data.reg.reg);
if (PCODE_FLAG_SET_F(instr) & fUpdatesPtr)
@@ -124,7 +118,7 @@ static void buildinterferencematrix(void) {
op = instr->args;
CError_ASSERT(219, instr->argCount != 0);
- while (op->kind != PCOp_REGISTER && !(op->data.reg.effect & EffectWrite)) {
+ while (op->kind != PCOp_REGISTER || !(op->data.reg.effect & EffectWrite)) {
i++;
op++;
CError_ASSERT(226, i <= instr->argCount);
@@ -136,6 +130,7 @@ static void buildinterferencematrix(void) {
for (j = 0; j < n_scratch_registers[coloring_class]; j++)
makeinterfere(op->data.reg.reg, scratch_registers[coloring_class][j]);
}
+ i++;
op++;
}
}