summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/InlineAsmPPC.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
commit0bec4f557a96e1a40437cf5af20cc78a5eec8a63 (patch)
treec1e05ec804c43aa5a8f5f21b0ed02d0587d29563 /compiler_and_linker/unsorted/InlineAsmPPC.c
parentaec1b8dddc68ecb8288ec6132932e4c7b4bca09f (diff)
downloadMWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.tar.gz
MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.zip
getting closer
Diffstat (limited to 'compiler_and_linker/unsorted/InlineAsmPPC.c')
-rw-r--r--compiler_and_linker/unsorted/InlineAsmPPC.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/compiler_and_linker/unsorted/InlineAsmPPC.c b/compiler_and_linker/unsorted/InlineAsmPPC.c
index e3a5f98..834432c 100644
--- a/compiler_and_linker/unsorted/InlineAsmPPC.c
+++ b/compiler_and_linker/unsorted/InlineAsmPPC.c
@@ -630,7 +630,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
CError_Error(CErrorStr155);
}
- expr.object->flags |= OBJECT_FLAGS_UNUSED;
+ expr.object->flags |= OBJECT_FLAGS_1;
return;
}
@@ -679,7 +679,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
op[0].u.obj.obj = expr.xC;
op[0].u.obj.offset = expr.value;
- expr.xC->flags |= OBJECT_FLAGS_UNUSED;
+ expr.xC->flags |= OBJECT_FLAGS_1;
return;
}
@@ -732,7 +732,7 @@ static void registeroperand(IAOperand *op, char rclass, short effect) {
op->u.reg.num = num;
op->u.reg.effect = effect;
if (obj) {
- reg->object->flags |= OBJECT_FLAGS_UNUSED;
+ reg->object->flags |= OBJECT_FLAGS_1;
Registers_GetVarInfo(obj)->flags |= VarInfoFlag40;
}
} else if (rclass == RegClass_CRFIELD) {
@@ -994,11 +994,11 @@ static InlineAsm *InlineAsm_ScanAssemblyOperands(IAMnemonic *mnemonic) {
info = &opcodeinfo[mnemonic->x4];
argcount = info->x8;
- if (PCODE_FLAG_SET_F(info) & fPCodeFlag8000000)
+ if (PCODE_FLAG_SET_F(info) & fCanSetRecordBit)
argcount++;
- if (!(PCODE_FLAG_SET_F(info) & fPCodeFlag10000000) && (PCODE_FLAG_SET_F(info) & fPCodeFlag4000000))
+ if (!(PCODE_FLAG_SET_F(info) & fSetsCarry) && (PCODE_FLAG_SET_F(info) & fCanSetCarry))
argcount++;
- if (PCODE_FLAG_SET_T(info) & fPCodeFlag2000000)
+ if (PCODE_FLAG_SET_T(info) & fCanLink)
argcount++;
buffersize = sizeof(InlineAsm) + sizeof(IAOperand) * argcount;
@@ -1669,7 +1669,7 @@ void InlineAsm_ProcessDirective(SInt32 directive) {
CError_Error(CErrorStr166);
tk = lex();
- if (tk != TK_NEG7 && tk != ';')
+ if (tk != TK_EOL && tk != ';')
fralloc_parameter_area_size = getimmediateoperand(0x20, 0x7FFE);
requires_frame = 1;
@@ -1832,9 +1832,9 @@ void InlineAsm_ScanAssemblyInstruction(void) {
CError_Error(CErrorStr261);
info = &opcodeinfo[mnemonic->x4];
- flag3 = (FLAG_SET_F(info->flags) & fPCodeFlag4000000) && (mnemonic->x10 & 0x400);
- flag4 = (FLAG_SET_T(info->flags) & fPCodeFlag20000000) && (mnemonic->x10 & 2);
- flag5 = (FLAG_SET_T(info->flags) & fPCodeFlag2000000) && (mnemonic->x10 & 1);
+ flag3 = (FLAG_SET_F(info->flags) & fCanSetCarry) && (mnemonic->x10 & 0x400);
+ flag4 = (FLAG_SET_T(info->flags) & fCanBeAbsolute) && (mnemonic->x10 & 2);
+ flag5 = (FLAG_SET_T(info->flags) & fCanLink) && (mnemonic->x10 & 1);
if ((cpu == CPUMask_Generic) && (cpu & CPUFLAG_LOW_MASK) != ((cpu & mnemonic->cpu) & CPUFLAG_LOW_MASK)) {
CError_Error(CErrorStr152);
@@ -1912,10 +1912,10 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
extra_args = 0;
reg = 0;
- if ((PCODE_FLAG_SET_F(info) & fPCodeFlag8000000) && !(PCODE_FLAG_SET_F(info) & fPCodeFlag20000000))
+ if ((PCODE_FLAG_SET_F(info) & fCanSetRecordBit) && !(PCODE_FLAG_SET_F(info) & fRecordBit))
extra_args++;
- if (!(PCODE_FLAG_SET_F(info) & fPCodeFlag10000000) && (PCODE_FLAG_SET_F(info) & fPCodeFlag4000000))
+ if (!(PCODE_FLAG_SET_F(info) & fSetsCarry) && (PCODE_FLAG_SET_F(info) & fCanSetCarry))
extra_args++;
if (argcount < ia->argcount) {
@@ -1976,8 +1976,8 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
case IAOpnd_Imm:
dest->kind = PCOp_IMMEDIATE;
dest->data.imm.value = src->u.imm.value;
- if (pc->flags & (fPCodeFlag2 | fPCodeFlag4))
- pc->flags |= fPCodeFlag20;
+ if (pc->flags & (fIsRead | fIsWrite))
+ pc->flags |= fIsPtrOp;
dest->data.imm.obj = NULL;
break;
@@ -2062,7 +2062,7 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
dest->arg = src->u.obj.unk;
dest->data.mem.obj = src->u.obj.obj;
dest->data.mem.offset = src->u.obj.offset;
- if (pc->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) {
+ if (pc->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
pc->alias = make_alias(dest->data.mem.obj, dest->data.mem.offset, nbytes_loaded_or_stored_by(pc));
if (is_volatile_object(dest->data.mem.obj))
pc->flags |= fIsVolatile;
@@ -2076,8 +2076,8 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
src->u.labdiff.label1->pclabel = makepclabel();
if (src->u.labdiff.label2->pclabel == NULL)
src->u.labdiff.label2->pclabel = makepclabel();
- if (pc->flags & (fPCodeFlag2 | fPCodeFlag4))
- pc->flags |= fPCodeFlag20;
+ if (pc->flags & (fIsRead | fIsWrite))
+ pc->flags |= fIsPtrOp;
dest->kind = PCOp_LABELDIFF;
dest->data.labeldiff.labelA = src->u.labdiff.label1->pclabel;
dest->data.labeldiff.labelB = src->u.labdiff.label2->pclabel;
@@ -2127,21 +2127,21 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
setpcodeflags(fSideEffects);
if (ia->flags2 & IAFlagsB_1) {
- if (PCODE_FLAG_SET_F(pc) & fPCodeFlag8000000)
+ if (PCODE_FLAG_SET_F(pc) & fCanSetRecordBit)
pcsetrecordbit(pclastblock->lastPCode);
else
CError_Error(CErrorStr261);
}
if (ia->flags2 & IAFlagsB_2) {
- if (PCODE_FLAG_SET_F(pc) & fPCodeFlag4000000)
+ if (PCODE_FLAG_SET_F(pc) & fCanSetCarry)
setpcodeflags(fOverflow); // idk?
else
CError_Error(CErrorStr261);
}
if (ia->flags2 & IAFlagsB_4) {
- if (PCODE_FLAG_SET_T(pc) & fPCodeFlag20000000) {
+ if (PCODE_FLAG_SET_T(pc) & fCanBeAbsolute) {
int i;
for (i = 0; i < pc->argCount; i++) {
if (pc->args[i].kind == PCOp_LABEL || pc->args[i].kind == PCOp_MEMORY) {
@@ -2149,18 +2149,18 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
break;
}
}
- setpcodeflags(fAbsolute); // idk?
+ setpcodeflags(fAbsolute);
} else {
CError_Error(CErrorStr261);
}
}
if (ia->flags2 & IAFlagsB_8) {
- if (PCODE_FLAG_SET_T(pc) & fPCodeFlag2000000) {
+ if (PCODE_FLAG_SET_T(pc) & fCanLink) {
pcsetlinkbit(pclastblock->lastPCode);
if (!(ia->flags & IAFlag2)) {
- pclastblock->lastPCode->flags &= ~fPCodeFlag8;
- pclastblock->lastPCode->flags |= fPCodeFlag1;
+ pclastblock->lastPCode->flags &= ~fIsCall;
+ pclastblock->lastPCode->flags |= fIsBranch;
}
makes_call = 1;
} else {
@@ -2169,9 +2169,9 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
}
if (ia->flags2 & IAFlagsB_10)
- setpcodeflags(fPCodeFlag8000000);
+ setpcodeflags(fCanSetRecordBit);
if (ia->flags2 & IAFlagsB_20)
- setpcodeflags(fPCodeFlag4000000);
+ setpcodeflags(fCanSetCarry);
if (OPCODE_PART_1(opcodeinfo[pc->op].insn) == 16) {
PCodeLabel *dest = NULL;
@@ -2260,7 +2260,7 @@ static void savepicbase(short reg, HashNameNode *name) {
}
static SInt32 InlineAsm_OpcodeSize(InlineAsm *ia) {
- if (opcodeinfo[ia->opcode].flags & (fPCodeFlag2 | fPCodeFlag4)) {
+ if (opcodeinfo[ia->opcode].flags & (fIsRead | fIsWrite)) {
switch (ia->opcode) {
case PC_LBZ:
case PC_LBZU:
@@ -2353,11 +2353,11 @@ static SInt32 InlineAsm_OpcodeSize(InlineAsm *ia) {
CError_FATAL(3924);
}
} else {
- if (opcodeinfo[ia->opcode].flags & fPCodeFlag80000000)
+ if (opcodeinfo[ia->opcode].flags & fOpTypeGPR)
return 4;
- if (opcodeinfo[ia->opcode].flags & fPCodeFlag40000000)
+ if (opcodeinfo[ia->opcode].flags & fOpTypeFPR)
return 8;
- if (opcodeinfo[ia->opcode].flags & (fPCodeFlag80000000 | fPCodeFlag40000000))
+ if (opcodeinfo[ia->opcode].flags & fOpTypeVR)
return 16;
if (opcodeinfo[ia->opcode].flags & fSideEffects) {
@@ -2395,17 +2395,17 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
effects->x0 = 0;
effects->x5 = 0;
- if (info->flags & fPCodeFlag20) {
- if (info->flags & fPCodeFlag2)
+ if (info->flags & fIsPtrOp) {
+ if (info->flags & fIsRead)
effects->x1 = 1;
- if (info->flags & fPCodeFlag4)
+ if (info->flags & fIsWrite)
effects->x2 = 1;
}
- if (PCODE_FLAG_SET_T(info) & fPCodeFlag2000000) {
+ if (PCODE_FLAG_SET_T(info) & fCanLink) {
if (ia->flags2 & IAFlagsB_8)
effects->x4 = 1;
- else if ((info->flags & fPCodeFlag8) || (info->flags & fPCodeFlag4))
+ else if ((info->flags & fIsCall) || (info->flags & fIsWrite))
effects->x3 = 1;
if (ia->opcode == PC_B) {
@@ -2450,13 +2450,13 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
case IAOpnd_3:
case IAOpnd_4:
if (op->u.obj.obj) {
- if (info->flags & fPCodeFlag2) {
+ if (info->flags & fIsRead) {
effects->operands[effects->numoperands].type = IAEffect_0;
effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset;
effects->operands[effects->numoperands].size = InlineAsm_OpcodeSize(ia);
effects->numoperands++;
- } else if (!(info->flags & (fPCodeFlag1 | fPCodeFlag8))) {
+ } else if (!(info->flags & (fIsBranch | fIsCall))) {
effects->operands[effects->numoperands].type = IAEffect_3;
effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset;
@@ -2510,7 +2510,7 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
case IAOpnd_3:
case IAOpnd_4:
if (op->u.obj.obj) {
- if (info->flags & fPCodeFlag4) {
+ if (info->flags & fIsWrite) {
effects->operands[effects->numoperands].type = IAEffect_1;
effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset;
@@ -2524,7 +2524,7 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
CError_ASSERT(4151, (UInt32) effects->numoperands <= IAMaxOperands);
}
- if ((info->flags & (fPCodeFlag1 | fPCodeFlag8)) && (SInt32)effects->numlabels == 0)
+ if ((info->flags & (fIsBranch | fIsCall)) && (SInt32)effects->numlabels == 0)
effects->x3 = 1;
}
@@ -2556,7 +2556,7 @@ void CodeGen_PropagateIntoAsm(Statement *stmt, Object *obj, ENode *expr) {
break;
case IAOpnd_3:
case IAOpnd_4:
- if (!(opcodeinfo[ia->opcode].flags & (fPCodeFlag4 | fPCodeFlag40000)) &&
+ if (!(opcodeinfo[ia->opcode].flags & (fIsWrite | fPCodeFlag40000)) &&
ia->args[i].u.obj.obj == obj)
ia->args[i].u.obj.obj = newobj;
break;