summaryrefslogtreecommitdiff
path: root/compiler_and_linker
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-13 20:22:51 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-13 20:22:51 +0000
commit00edfdb0d430d8bf1d2fc98cb226114ef271d993 (patch)
tree14708cde7bb2df1038cb42ff13d0f365245dcc3b /compiler_and_linker
parent7a34d06bc7de5e71b83fbdda408664849d1a2274 (diff)
downloadMWCC-00edfdb0d430d8bf1d2fc98cb226114ef271d993.tar.gz
MWCC-00edfdb0d430d8bf1d2fc98cb226114ef271d993.zip
these might be the last codegen fixes needed for now
Diffstat (limited to 'compiler_and_linker')
-rw-r--r--compiler_and_linker/unsorted/PCodeInfo.c19
-rw-r--r--compiler_and_linker/unsorted/PCodeListing.c8
-rw-r--r--compiler_and_linker/unsorted/Peephole.c2
3 files changed, 14 insertions, 15 deletions
diff --git a/compiler_and_linker/unsorted/PCodeInfo.c b/compiler_and_linker/unsorted/PCodeInfo.c
index fdd19a2..8f863f7 100644
--- a/compiler_and_linker/unsorted/PCodeInfo.c
+++ b/compiler_and_linker/unsorted/PCodeInfo.c
@@ -1130,23 +1130,22 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
if (pcode->flags & fCommutative)
buf += sprintf(buf, "; fCommutative");
- // i think these are the wrong way round lol
- if (flagSetT & fIsPtrOp)
+ if (flagSetF & fIsPtrOp)
buf += sprintf(buf, "; fIsPtrOp");
- if (flagSetF) {
- if (flagSetF & fLink)
+ if (flagSetT) {
+ if (flagSetT & fLink)
buf += sprintf(buf, "; fLink");
- if (flagSetF & fAbsolute)
+ if (flagSetT & fAbsolute)
buf += sprintf(buf, "; fAbsolute");
- if (flagSetF & fBranchTaken)
+ if (flagSetT & fBranchTaken)
buf += sprintf(buf, "; fBranchTaken");
- if (flagSetF & fBranchNotTaken)
+ if (flagSetT & fBranchNotTaken)
buf += sprintf(buf, "; fBranchNotTaken");
- } else if (flagSetT) {
- if (flagSetT & fSetsCarry)
+ } else if (flagSetF) {
+ if (flagSetF & fSetsCarry)
buf += sprintf(buf, "; fSetsCarry");
- if (flagSetT & fOverflow)
+ if (flagSetF & fOverflow)
buf += sprintf(buf, "; fOverflow");
}
diff --git a/compiler_and_linker/unsorted/PCodeListing.c b/compiler_and_linker/unsorted/PCodeListing.c
index f03c939..c4425a7 100644
--- a/compiler_and_linker/unsorted/PCodeListing.c
+++ b/compiler_and_linker/unsorted/PCodeListing.c
@@ -162,12 +162,12 @@ void pccleanuplisting(void) {
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;
+ 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);
-
for (block = pcbasicblocks; block; block = block->nextBlock)
pclistblock(block, NULL, 0);
}
diff --git a/compiler_and_linker/unsorted/Peephole.c b/compiler_and_linker/unsorted/Peephole.c
index ea625d2..f8be4a1 100644
--- a/compiler_and_linker/unsorted/Peephole.c
+++ b/compiler_and_linker/unsorted/Peephole.c
@@ -2500,7 +2500,7 @@ static void adjustforward(PCodeBlock *block) {
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 (flag1 && scan->prevPCode != instr) {
tmp = instr->prevPCode;