From 7a5280b96b1028617794af8ffbab8df4fbb1d6d5 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Fri, 13 Jan 2023 02:19:29 +0000 Subject: more fixes --- compiler_and_linker/unsorted/PCodeAssembly.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'compiler_and_linker/unsorted/PCodeAssembly.c') 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; -- cgit v1.2.3