diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-11 22:29:53 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-11 22:29:53 +0000 |
commit | 0bec4f557a96e1a40437cf5af20cc78a5eec8a63 (patch) | |
tree | c1e05ec804c43aa5a8f5f21b0ed02d0587d29563 /compiler_and_linker/unsorted/PCodeInfo.c | |
parent | aec1b8dddc68ecb8288ec6132932e4c7b4bca09f (diff) | |
download | MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.tar.gz MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.zip |
getting closer
Diffstat (limited to 'compiler_and_linker/unsorted/PCodeInfo.c')
-rw-r--r-- | compiler_and_linker/unsorted/PCodeInfo.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/compiler_and_linker/unsorted/PCodeInfo.c b/compiler_and_linker/unsorted/PCodeInfo.c index c93176c..b11288b 100644 --- a/compiler_and_linker/unsorted/PCodeInfo.c +++ b/compiler_and_linker/unsorted/PCodeInfo.c @@ -126,10 +126,10 @@ PCode *vformatpcode(short opcode, va_list argList) { int tmp; int tmp2; // r19 int i; - int thing; - int thing2; - int thing3; - int thing4; + SInt32 thing; + SInt32 thing2; + SInt32 thing3; + SInt32 thing4; Object *obj; PCodeLabel *label; char c; @@ -146,7 +146,7 @@ PCode *vformatpcode(short opcode, va_list argList) { format++; } - if (info->flags & fPCodeFlag8000000) + if (info->flags & fCanSetRecordBit) unkreg_r22 = 1; if ((argcount + unkreg_r22) < 5) @@ -474,7 +474,7 @@ PCode *vformatpcode(short opcode, va_list argList) { arg->data.mem.obj = obj; arg->data.mem.offset = va_arg(argList, SInt32); - if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { + if (pcode->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) { pcode->alias = make_alias(obj, arg->data.mem.offset, nbytes_loaded_or_stored_by(pcode)); if (is_volatile_object(obj)) pcode->flags |= fIsVolatile; @@ -486,7 +486,7 @@ PCode *vformatpcode(short opcode, va_list argList) { pcode->alias = make_alias(obj, arg->data.mem.offset, 1); } CError_ASSERT(536, obj->datatype == DLOCAL || arg->data.mem.offset == 0); - if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) { + if (pcode->flags & (fIsRead | fIsWrite)) { //if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE)) if (OBJ_GET_TARGET_VOLATILE(obj)) pcode->flags |= fIsVolatile; @@ -495,7 +495,7 @@ PCode *vformatpcode(short opcode, va_list argList) { pcode->flags |= fIsConst; } - if (pcode->flags & (fPCodeFlag1 | fPCodeFlag8)) { + if (pcode->flags & (fIsBranch | fIsCall)) { arg->arg = RefType_4; } else if (obj->datatype == DLOCAL) { if (!local_is_16bit_offset(obj)) @@ -510,8 +510,8 @@ PCode *vformatpcode(short opcode, va_list argList) { arg->kind = PCOp_IMMEDIATE; arg->data.imm.value = va_arg(argList, SInt32); arg->data.imm.obj = NULL; - if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) - pcode->flags |= fPCodeFlag20; + if (pcode->flags & (fIsRead | fIsWrite)) + pcode->flags |= fIsPtrOp; } break; @@ -530,7 +530,7 @@ PCode *vformatpcode(short opcode, va_list argList) { arg->data.mem.offset = va_arg(argList, SInt32); CError_ASSERT(590, obj->datatype == DLOCAL || arg->data.mem.offset == 0); - if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) { + if (pcode->flags & (fIsRead | fIsWrite)) { //if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE)) if (OBJ_GET_TARGET_VOLATILE(obj)) pcode->flags |= fIsVolatile; @@ -549,8 +549,8 @@ PCode *vformatpcode(short opcode, va_list argList) { arg->kind = PCOp_IMMEDIATE; arg->data.imm.value = va_arg(argList, SInt32); arg->data.imm.obj = NULL; - if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) - pcode->flags |= fPCodeFlag20; + if (pcode->flags & (fIsRead | fIsWrite)) + pcode->flags |= fIsPtrOp; } break; @@ -800,9 +800,9 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) { int i; int tmp; int tmp2; - int thing; - int thing2; - int thing4; + SInt32 thing; + SInt32 thing2; + SInt32 thing4; char c; int flagSetT; int flagSetF; @@ -1048,7 +1048,7 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) { buf += expectandformatoperand(pa, PCOp_MEMORY, 0, -1, buf); else if (pa->kind == PCOp_LABELDIFF) buf += expectandformatoperand(pa, PCOp_LABELDIFF, 0, -1, buf); - else if ((pcode->flags & (fPCodeFlag1 | fPCodeFlag8)) && (pa->kind == PCOp_LABEL)) + else if ((pcode->flags & (fIsBranch | fIsCall)) && (pa->kind == PCOp_LABEL)) buf += expectandformatoperand(pa, PCOp_LABEL, 0, -1, buf); else buf += expectandformatoperand(pa, PCOp_IMMEDIATE, 0, -1, buf); @@ -1122,6 +1122,7 @@ 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) buf += sprintf(buf, "; fIsPtrOp"); @@ -1158,7 +1159,7 @@ int can_reuse_stored_value(PCode *a, PCode *b) { int nbytes_loaded_or_stored_by(PCode *pcode) { OpcodeInfo *oinfo = opcodeinfo + pcode->op; - if (oinfo->flags & (fPCodeFlag2 | fPCodeFlag4)) { + if (oinfo->flags & (fIsRead | fIsWrite)) { switch (pcode->op) { case PC_LBZ: case PC_LBZU: @@ -1265,7 +1266,7 @@ void change_num_operands(PCode *pcode, int newNum) { void change_opcode(PCode *pcode, short opcode) { pcode->flags = (pcode->flags & ~(opcodeinfo[pcode->op].flags & ~fIsPtrOp)) | opcodeinfo[opcode].flags; - if ((pcode->flags & fPCodeFlag10) && (PCODE_FLAG_SET_F(pcode) & fPCodeFlag20000000)) - pcode->flags &= ~fPCodeFlag10; + if ((pcode->flags & fIsMove) && (PCODE_FLAG_SET_F(pcode) & fRecordBit)) + pcode->flags &= ~fIsMove; pcode->op = opcode; } |