diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-13 02:19:29 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-13 02:19:29 +0000 |
commit | 7a5280b96b1028617794af8ffbab8df4fbb1d6d5 (patch) | |
tree | bb1813aca21d9ab39ea416b30b14af98dd1b9d0d /compiler_and_linker/unsorted/PCodeAssembly.c | |
parent | 08d21a052b9afc37292ec3fad390502610e2cb32 (diff) | |
download | MWCC-7a5280b96b1028617794af8ffbab8df4fbb1d6d5.tar.gz MWCC-7a5280b96b1028617794af8ffbab8df4fbb1d6d5.zip |
more fixes
Diffstat (limited to 'compiler_and_linker/unsorted/PCodeAssembly.c')
-rw-r--r-- | compiler_and_linker/unsorted/PCodeAssembly.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler_and_linker/unsorted/PCodeAssembly.c b/compiler_and_linker/unsorted/PCodeAssembly.c index 2c87ce3..0455d77 100644 --- a/compiler_and_linker/unsorted/PCodeAssembly.c +++ b/compiler_and_linker/unsorted/PCodeAssembly.c @@ -1297,7 +1297,6 @@ static void insertlongbranches(SInt32 mask) { SInt32 optimizefinalbranches(SInt32 codesize) { PCodeBlock *block; - PCodeBlock *block2; PCode *instr; SInt32 offset; int changed; @@ -1337,9 +1336,9 @@ SInt32 optimizefinalbranches(SInt32 codesize) { continue; } - if ((instr->op == PC_BT || instr->op == PC_BF) && instr->args[0].kind == PCOp_LABEL) { - block2 = instr->block; - label = instr->args[0].data.label.label; + if ((instr->op == PC_BT || instr->op == PC_BF) && instr->args[2].kind == PCOp_LABEL) { + PCodeBlock *block2 = instr->block; + label = instr->args[2].data.label.label; target = targetinstruction(label); if (label->block->codeOffset == (offset + 4)) { @@ -1414,8 +1413,8 @@ SInt32 optimizefinalbranches(SInt32 codesize) { !(PCODE_FLAG_SET_T(instr) & (fSideEffects | fLink)) ) { - block2 = instr->block; - label = instr->args[2].data.label.label; + PCodeBlock *block2 = instr->block; + label = instr->args[3].data.label.label; target = targetinstruction(label); if (label->block->codeOffset == (offset + 4)) { @@ -1449,7 +1448,7 @@ SInt32 optimizefinalbranches(SInt32 codesize) { ) { if ((val & 30) == 4) instr->args[0].data.imm.value = val | 12; - else + else if ((val & 30) == 12) instr->args[0].data.imm.value = val & 23; instr->op = PC_BCLR; instr->argCount = 3; @@ -1470,7 +1469,7 @@ SInt32 optimizefinalbranches(SInt32 codesize) { ) { if ((val & 30) == 4) instr->args[0].data.imm.value = val | 12; - else + else if ((val & 30) == 12) instr->args[0].data.imm.value = val & 23; instr->op = PC_BCCTR; instr->argCount = 3; |