summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/PCodeAssembly.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-13 02:19:29 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-13 02:19:29 +0000
commit7a5280b96b1028617794af8ffbab8df4fbb1d6d5 (patch)
treebb1813aca21d9ab39ea416b30b14af98dd1b9d0d /compiler_and_linker/unsorted/PCodeAssembly.c
parent08d21a052b9afc37292ec3fad390502610e2cb32 (diff)
downloadMWCC-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.c15
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;