From c12644aae1c43ff660b9ebd97eb75751536a565a Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 14 Jan 2023 18:58:26 +0000 Subject: [PATCH] fix more matching bugs --- compiler_and_linker/unsorted/IrOptimizer.c | 3 ++- compiler_and_linker/unsorted/IroDump.c | 3 ++- compiler_and_linker/unsorted/ObjGenMachO.c | 2 ++ compiler_and_linker/unsorted/PCodeListing.c | 4 ++-- compiler_and_linker/unsorted/Peephole.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/compiler_and_linker/unsorted/IrOptimizer.c b/compiler_and_linker/unsorted/IrOptimizer.c index 38c415e..0be1e1e 100644 --- a/compiler_and_linker/unsorted/IrOptimizer.c +++ b/compiler_and_linker/unsorted/IrOptimizer.c @@ -122,7 +122,8 @@ Statement *IRO_Optimizer(Object *func, Statement *statements) { CError_ASSERT(234, stIsSetup); #ifdef CW_PATCH_DEBUG - IRO_Log = 1; + if (copts.debuglisting) + IRO_Log = 1; #endif DisableDueToAsm = 0; diff --git a/compiler_and_linker/unsorted/IroDump.c b/compiler_and_linker/unsorted/IroDump.c index da8f676..dfa6c3e 100644 --- a/compiler_and_linker/unsorted/IroDump.c +++ b/compiler_and_linker/unsorted/IroDump.c @@ -296,7 +296,8 @@ void IRO_DumpBits(char *name, BitVector *bv) { void IRO_DumpAfterPhase(char *str, Boolean flag) { #ifdef CW_PATCH_DEBUG - flag = 1; + if (copts.debuglisting) + flag = 1; #endif if (flag) { IRO_Dump("Dumping function %s after %s \n", FunctionName ? FunctionName->name->name : "Init-code", str); diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c index ee9bf77..97f5997 100644 --- a/compiler_and_linker/unsorted/ObjGenMachO.c +++ b/compiler_and_linker/unsorted/ObjGenMachO.c @@ -610,9 +610,11 @@ void ObjGen_DeclareFloatConst(Object *object) { gl = MachO_GetGList(Sections[sectionID]); if (object->type->size == 4) { float f = object->u.data.u.floatconst->value; + CTool_EndianConvertMem(&f, 4); AppendGListData(gl, &f, 4); } else if (object->type->size == 8) { double f = object->u.data.u.floatconst->value; + CTool_EndianConvertMem(&f, 8); AppendGListData(gl, &f, 8); } else { CError_FATAL(998); diff --git a/compiler_and_linker/unsorted/PCodeListing.c b/compiler_and_linker/unsorted/PCodeListing.c index 0367250..6e87241 100644 --- a/compiler_and_linker/unsorted/PCodeListing.c +++ b/compiler_and_linker/unsorted/PCodeListing.c @@ -115,8 +115,8 @@ static void pclistblock(PCodeBlock *block, char *format, UInt32 vecSize) { fprintf( pcfile, - " %.8" PRIx32 " %.8" PRIx32 " %4" PRId32 " %-7s%c %s\n", - offset, opcode, latency, + " %.8" PRIX32 " %.8" PRIX32 " %4" PRId32 " %-7s%c %s\n", + offset, CTool_EndianConvertWord32(opcode), latency, opcodeinfo[instr->op].name, chr, buf ); diff --git a/compiler_and_linker/unsorted/Peephole.c b/compiler_and_linker/unsorted/Peephole.c index f8be4a1..3a63bff 100644 --- a/compiler_and_linker/unsorted/Peephole.c +++ b/compiler_and_linker/unsorted/Peephole.c @@ -2379,7 +2379,7 @@ static void adjustforward(PCodeBlock *block) { } } - for (op = instr->args, i = instr->argCount; i--; op++) { + for (op = scan->args, i = scan->argCount; i--; op++) { if ( PC_OP_IS_WRITE_ANY_REGISTER(op, RegClass_GPR) && (op->data.reg.reg == reg0 || op->data.reg.reg == reg1) @@ -2418,7 +2418,7 @@ static void adjustforward(PCodeBlock *block) { } } - for (op = instr->args, i = instr->argCount; i--; op++) { + for (op = scan->args, i = scan->argCount; i--; op++) { if ( PC_OP_IS_WRITE_ANY_REGISTER(op, RegClass_GPR) && (op->data.reg.reg == reg0 || op->data.reg.reg == reg1)