mirror of https://git.wuffs.org/MWCC
yet more fixes, some debugging code
This commit is contained in:
parent
7a5280b96b
commit
7a34d06bc7
|
@ -7,6 +7,8 @@ include_directories(.)
|
|||
include_directories(includes)
|
||||
include_directories(sdk_hdrs)
|
||||
|
||||
add_compile_definitions(CW_PATCH_DEBUG)
|
||||
|
||||
add_executable(mwcc
|
||||
command_line/CmdLine/Src/Clients/CLStaticMain.c
|
||||
command_line/CmdLine/Src/Clients/ClientGlue.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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue