these might be the last codegen fixes needed for now

This commit is contained in:
Ash Wolf 2023-01-13 20:22:51 +00:00
parent 7a34d06bc7
commit 00edfdb0d4
3 changed files with 14 additions and 15 deletions

View File

@ -1130,23 +1130,22 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
if (pcode->flags & fCommutative) if (pcode->flags & fCommutative)
buf += sprintf(buf, "; fCommutative"); buf += sprintf(buf, "; fCommutative");
// i think these are the wrong way round lol if (flagSetF & fIsPtrOp)
if (flagSetT & fIsPtrOp)
buf += sprintf(buf, "; fIsPtrOp"); buf += sprintf(buf, "; fIsPtrOp");
if (flagSetF) { if (flagSetT) {
if (flagSetF & fLink) if (flagSetT & fLink)
buf += sprintf(buf, "; fLink"); buf += sprintf(buf, "; fLink");
if (flagSetF & fAbsolute) if (flagSetT & fAbsolute)
buf += sprintf(buf, "; fAbsolute"); buf += sprintf(buf, "; fAbsolute");
if (flagSetF & fBranchTaken) if (flagSetT & fBranchTaken)
buf += sprintf(buf, "; fBranchTaken"); buf += sprintf(buf, "; fBranchTaken");
if (flagSetF & fBranchNotTaken) if (flagSetT & fBranchNotTaken)
buf += sprintf(buf, "; fBranchNotTaken"); buf += sprintf(buf, "; fBranchNotTaken");
} else if (flagSetT) { } else if (flagSetF) {
if (flagSetT & fSetsCarry) if (flagSetF & fSetsCarry)
buf += sprintf(buf, "; fSetsCarry"); buf += sprintf(buf, "; fSetsCarry");
if (flagSetT & fOverflow) if (flagSetF & fOverflow)
buf += sprintf(buf, "; fOverflow"); buf += sprintf(buf, "; fOverflow");
} }

View File

@ -162,12 +162,12 @@ void pccleanuplisting(void) {
void pclistblocks(char *name1, char *name2) { void pclistblocks(char *name1, char *name2) {
#ifdef CW_PATCH_DEBUG #ifdef CW_PATCH_DEBUG
// this code is not based on the original as we don't have it // this code is not based on the original as we don't have it
if (!pcfile) { PCodeBlock *block;
PCodeBlock *block; if (copts.debuglisting) {
if (!pcfile)
pcfile = fopen("pcdump.txt", "a");
pcfile = fopen("pcdump.txt", "a");
fprintf(pcfile, "\n%s\n%s\n", name1, name2); fprintf(pcfile, "\n%s\n%s\n", name1, name2);
for (block = pcbasicblocks; block; block = block->nextBlock) for (block = pcbasicblocks; block; block = block->nextBlock)
pclistblock(block, NULL, 0); pclistblock(block, NULL, 0);
} }

View File

@ -2500,7 +2500,7 @@ static void adjustforward(PCodeBlock *block) {
break; break;
} }
for (op = instr->args, i = instr->argCount; i--; op++) { for (op = scan->args, i = scan->argCount; i--; op++) {
if (PC_OP_IS_R_OR_W_REGISTER(op, RegClass_GPR, reg0)) { if (PC_OP_IS_R_OR_W_REGISTER(op, RegClass_GPR, reg0)) {
if (flag1 && scan->prevPCode != instr) { if (flag1 && scan->prevPCode != instr) {
tmp = instr->prevPCode; tmp = instr->prevPCode;