summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_and_linker/unsorted')
-rw-r--r--compiler_and_linker/unsorted/CException.c5
-rw-r--r--compiler_and_linker/unsorted/COptimizer.c2
-rw-r--r--compiler_and_linker/unsorted/MachO.c2
-rw-r--r--compiler_and_linker/unsorted/ObjGenMachO.c4
-rw-r--r--compiler_and_linker/unsorted/PCodeInfo.c11
-rw-r--r--compiler_and_linker/unsorted/PCodeListing.c27
-rw-r--r--compiler_and_linker/unsorted/Peephole.c2
7 files changed, 39 insertions, 14 deletions
diff --git a/compiler_and_linker/unsorted/CException.c b/compiler_and_linker/unsorted/CException.c
index d8a100c..c398afb 100644
--- a/compiler_and_linker/unsorted/CException.c
+++ b/compiler_and_linker/unsorted/CException.c
@@ -1796,6 +1796,7 @@ static ENode *CExcept_TempTransExpr(ENode *expr) {
return expr;
case ELAND:
case ELOR:
+ case ECOMMA:
expr->data.diadic.left = CExcept_TempTransExpr(expr->data.diadic.left);
expr->data.diadic.right = CExcept_TempTransExprCond(expr->data.diadic.right);
return expr;
@@ -1829,7 +1830,6 @@ static ENode *CExcept_TempTransExpr(ENode *expr) {
case EANDASS:
case EXORASS:
case EORASS:
- case ECOMMA:
case EROTL:
case EROTR:
expr->data.diadic.left = CExcept_TempTransExpr(expr->data.diadic.left);
@@ -1851,8 +1851,11 @@ static ENode *CExcept_TempTransExpr(ENode *expr) {
case EFLOATCONST:
case ESTRINGCONST:
case EOBJREF:
+ case EMFPOINTER:
case EPRECOMP:
case ELABEL:
+ case EOBJLIST:
+ case EMEMBER:
case EINSTRUCTION:
case EVECTOR128CONST:
return expr;
diff --git a/compiler_and_linker/unsorted/COptimizer.c b/compiler_and_linker/unsorted/COptimizer.c
index 8fd01ae..a8fb93b 100644
--- a/compiler_and_linker/unsorted/COptimizer.c
+++ b/compiler_and_linker/unsorted/COptimizer.c
@@ -1244,7 +1244,7 @@ static void BasicBlockAnalyze(Statement *stmt) {
block->x1C = counter;
continue;
case ST_NOP:
- case ST_GOTO:
+ case ST_LABEL:
case ST_ENTRY:
if (stmt->next && stmt->next->type != ST_LABEL) {
stmt = stmt->next;
diff --git a/compiler_and_linker/unsorted/MachO.c b/compiler_and_linker/unsorted/MachO.c
index 18d91bb..1fb2d05 100644
--- a/compiler_and_linker/unsorted/MachO.c
+++ b/compiler_and_linker/unsorted/MachO.c
@@ -343,7 +343,7 @@ static void WriteSymtabLoadCommand(void) {
cmd.cmdsize = CTool_EndianConvertWord32(sizeof(cmd));
cmd.symoff = CTool_EndianConvertWord32(FileOffset);
total = SymNum + NumStabs;
- cmd.nsyms = total;
+ cmd.nsyms = CTool_EndianConvertWord32(total);
FileOffset += total * sizeof(struct nlist);
cmd.stroff = CTool_EndianConvertWord32(FileOffset);
cmd.strsize = CTool_EndianConvertWord32(StringTable.size);
diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c
index dfa77b8..961d5bb 100644
--- a/compiler_and_linker/unsorted/ObjGenMachO.c
+++ b/compiler_and_linker/unsorted/ObjGenMachO.c
@@ -1517,7 +1517,7 @@ void CodeGen_GenDynLinkStub(MachOSection *a, MachOSection *b, SInt32 relocID) {
if (copts.codegen_pic) {
UInt32 i;
for (i = 0; i < 9; i++)
- AppendGListLong(gl, pic_stub[i]);
+ AppendGListLong(gl, CTool_EndianConvertWord32(pic_stub[i]));
pic_base_offset = offset + 8;
ObjGen_Relocate(a, offset + 16, relocID, RT_4, MW_RELOC_7_HA16);
ObjGen_Relocate(a, offset + 20, relocID, RT_4, MW_RELOC_5_LO16);
@@ -1525,7 +1525,7 @@ void CodeGen_GenDynLinkStub(MachOSection *a, MachOSection *b, SInt32 relocID) {
} else {
UInt32 i;
for (i = 0; i < 5; i++)
- AppendGListLong(gl, abs_stub[i]);
+ AppendGListLong(gl, CTool_EndianConvertWord32(abs_stub[i]));
ObjGen_Relocate(a, offset, relocID, RT_4, MW_RELOC_7_HA16);
ObjGen_Relocate(a, offset + 4, relocID, RT_4, MW_RELOC_5_LO16);
ObjGen_Relocate(a, offset + 12, relocID, RT_4, MW_RELOC_5_LO16);
diff --git a/compiler_and_linker/unsorted/PCodeInfo.c b/compiler_and_linker/unsorted/PCodeInfo.c
index fdfa71e..fdd19a2 100644
--- a/compiler_and_linker/unsorted/PCodeInfo.c
+++ b/compiler_and_linker/unsorted/PCodeInfo.c
@@ -284,6 +284,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
format += pcode_const_from_format(format + 1, &thing);
else
CError_FATAL(319);
+ case 's':
tmp = va_arg(argList, int);
tmp2 = -1;
for (i = 0; i < 4; i++) {
@@ -879,8 +880,8 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
buf += sprintf(buf, "!!!r");
}
buf += sprintf(buf, "0");
+ break;
}
- break;
case 'r':
buf += expectandformatoperand(pa, PCOp_REGISTER, RegClass_GPR, -1, buf);
break;
@@ -956,7 +957,7 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
break;
case 'Q':
- buf += expectandformatoperand(pa, PCOp_REGISTER, RegClass_SPR, -1, buf);
+ buf += expectandformatoperand(pa, PCOp_REGISTER, RegClass_CRFIELD, -1, buf);
*(buf++) = ',';
pa++;
arg_index++;
@@ -999,9 +1000,11 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
case 't':
if (pa->kind == PCOp_IMMEDIATE && pa->data.imm.value > 0 && pa->data.imm.value < 31 && (name = to[pa->data.imm.value])[0]) {
buf += sprintf(buf, "%s", name);
- } else {
- buf += expectandformatoperand(pa, PCOp_IMMEDIATE, 'x', 5, buf);
+ break;
}
+
+ case 'B':
+ buf += expectandformatoperand(pa, PCOp_IMMEDIATE, 'x', 5, buf);
break;
case 'l':
diff --git a/compiler_and_linker/unsorted/PCodeListing.c b/compiler_and_linker/unsorted/PCodeListing.c
index ffaec79..f03c939 100644
--- a/compiler_and_linker/unsorted/PCodeListing.c
+++ b/compiler_and_linker/unsorted/PCodeListing.c
@@ -48,10 +48,10 @@ static void pclistblock(PCodeBlock *block, char *format, UInt32 vecSize) {
PCLink *link;
PCodeLabel *label;
int cpu;
- int chr; // r21
- PCode *instr; // r20
- int offset; // r19
- int latency; // r18
+ int chr;
+ PCode *instr;
+ int offset;
+ int latency;
UInt32 opcode;
MachineInfo *mi;
char buf[500];
@@ -150,9 +150,28 @@ void pcinitlisting() {
}
void pccleanuplisting(void) {
+#ifdef CW_PATCH_DEBUG
+ // this code is not based on the original as we don't have it
+ if (pcfile) {
+ fclose(pcfile);
+ pcfile = NULL;
+ }
+#endif
}
void pclistblocks(char *name1, char *name2) {
+#ifdef CW_PATCH_DEBUG
+ // this code is not based on the original as we don't have it
+ if (!pcfile) {
+ PCodeBlock *block;
+
+ pcfile = fopen("pcdump.txt", "a");
+ fprintf(pcfile, "\n%s\n%s\n", name1, name2);
+
+ for (block = pcbasicblocks; block; block = block->nextBlock)
+ pclistblock(block, NULL, 0);
+ }
+#endif
}
void pclistdataflow() {
diff --git a/compiler_and_linker/unsorted/Peephole.c b/compiler_and_linker/unsorted/Peephole.c
index c9e4850..ea625d2 100644
--- a/compiler_and_linker/unsorted/Peephole.c
+++ b/compiler_and_linker/unsorted/Peephole.c
@@ -2353,7 +2353,7 @@ static void adjustforward(PCodeBlock *block) {
} else if (
instr->op == PC_EXTSB &&
- (reg0 = instr->args[0].data.reg.reg) == (reg1 = instr->args[1].data.reg.reg)
+ (reg0 = instr->args[0].data.reg.reg) != (reg1 = instr->args[1].data.reg.reg)
)
{
short flag = 0;