add PPCError error code enum

This commit is contained in:
Ash Wolf 2023-01-20 12:25:38 +00:00
parent 0905072b3c
commit 0b23bc6179
11 changed files with 349 additions and 121 deletions

View File

@ -1392,7 +1392,7 @@ static ENode *CExpr_ParseVecStep(void) {
}
expr = intconstnode(TYPE(&stsignedint), value);
} else {
PPCError_Error(104, "vec_step", "vec_step", type, 0);
PPCError_Error(PPCErrorStr104, "vec_step", "vec_step", type, 0);
}
} else {
CError_Error(CErrorStr114);

View File

@ -1344,7 +1344,7 @@ static void pragma_scheduling(void) {
return;
}
} else {
PPCError_Error(115);
PPCError_Error(PPCErrorStr115);
return;
}
CPrep_Error(CErrorStr186);
@ -1616,14 +1616,14 @@ void CodeGen_ParsePragma(HashNameNode *name) {
CPrep_PushOption(OPT_OFFSET(function_align), value);
break;
default:
PPCError_Warning(161);
PPCError_Warning(PPCErrorStr161);
CodeGen_EOLCheck();
return;
}
} else if (t == TK_IDENTIFIER && !strcmp(tkidentifier->name, "reset")) {
CPrep_PopOption(OPT_OFFSET(function_align));
} else {
PPCError_Warning(161);
PPCError_Warning(PPCErrorStr161);
}
CodeGen_EOLCheck();
return;
@ -1631,7 +1631,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
if (!strcmp(name->name, "processor")) {
if (cscope_currentfunc) {
PPCError_Warning(156, "pragma processor");
PPCError_Warning(PPCErrorStr156, "pragma processor");
return;
}
t = plex();
@ -1701,7 +1701,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
copts.processor = 21;
break;
default:
PPCError_Warning(208);
PPCError_Warning(PPCErrorStr208);
CodeGen_EOLCheck();
return;
}
@ -1717,9 +1717,9 @@ void CodeGen_ParsePragma(HashNameNode *name) {
else if (!strcmp(tkidentifier->name, "PPC604e"))
copts.processor = 10;
else
PPCError_Warning(208);
PPCError_Warning(PPCErrorStr208);
} else {
PPCError_Warning(208);
PPCError_Warning(PPCErrorStr208);
}
if ((str = CMach_GetCPU()))
@ -1743,7 +1743,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
CPrep_PushOption(OPT_OFFSET(min_struct_alignment), value);
break;
default:
PPCError_Warning(191);
PPCError_Warning(PPCErrorStr191);
CodeGen_EOLCheck();
return;
}
@ -1755,7 +1755,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
else if (!strcmp(tkidentifier->name, "off"))
CPrep_PushOption(OPT_OFFSET(min_struct_alignment), 1);
} else {
PPCError_Warning(161);
PPCError_Warning(PPCErrorStr161);
}
CodeGen_EOLCheck();
@ -1806,7 +1806,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) {
copts.codegen_pic = 1;
if (!copts.codegen_dynamic) {
PPCError_Error(189);
PPCError_Error(PPCErrorStr189);
copts.codegen_pic = 0;
}
} else {
@ -2031,9 +2031,9 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
case STRUCT_VECTOR_SCHAR:
case STRUCT_VECTOR_BCHAR:
if (i < 15) {
PPCError_Error(110, type, 0);
PPCError_Error(PPCErrorStr110, type, 0);
} else if (i > 15) {
PPCError_Error(111, type, 0);
PPCError_Error(PPCErrorStr111, type, 0);
} else {
escan = expr;
i = 15;
@ -2042,17 +2042,17 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
expr = escan->data.diadic.right;
v = expr->data.intval;
if (!ENODE_IS(expr, EINTCONST)) {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UCHAR) {
if (!CInt64_IsInURange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
@ -2065,15 +2065,15 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UCHAR) {
if (!CInt64_IsInURange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
vec->uc[0] = (UInt8) v.lo;
} else {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
result = 1;
@ -2085,9 +2085,9 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
case STRUCT_VECTOR_BSHORT:
case STRUCT_VECTOR_PIXEL:
if (i < 7) {
PPCError_Error(110, type, 0);
PPCError_Error(PPCErrorStr110, type, 0);
} else if (i > 7) {
PPCError_Error(111, type, 0);
PPCError_Error(PPCErrorStr111, type, 0);
} else {
escan = expr;
i = 7;
@ -2095,17 +2095,17 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
ENode *e = escan->data.diadic.right;
CInt64 v = e->data.intval;
if (!ENODE_IS(e, EINTCONST)) {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_USHORT || TYPE_STRUCT(type)->stype == STRUCT_VECTOR_PIXEL) {
if (!CInt64_IsInURange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
@ -2118,15 +2118,15 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_USHORT || TYPE_STRUCT(type)->stype == STRUCT_VECTOR_PIXEL) {
if (!CInt64_IsInURange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
vec->us[0] = (UInt16) v.lo;
} else {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
result = 1;
@ -2137,9 +2137,9 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
case STRUCT_VECTOR_SINT:
case STRUCT_VECTOR_BINT:
if (i < 3) {
PPCError_Error(110, type, 0);
PPCError_Error(PPCErrorStr110, type, 0);
} else if (i > 3) {
PPCError_Error(111, type, 0);
PPCError_Error(PPCErrorStr111, type, 0);
} else {
escan = expr;
i = 3;
@ -2148,17 +2148,17 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
expr = escan->data.diadic.right;
v = expr->data.intval;
if (!ENODE_IS(expr, EINTCONST)) {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UINT) {
if (!CInt64_IsInURange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
@ -2171,15 +2171,15 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UINT) {
if (!CInt64_IsInURange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
vec->ul[0] = v.lo;
} else {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
result = 1;
@ -2188,9 +2188,9 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
case STRUCT_VECTOR_FLOAT:
if (i < 3) {
PPCError_Error(110, type, 0);
PPCError_Error(PPCErrorStr110, type, 0);
} else if (i > 3) {
PPCError_Error(111, type, 0);
PPCError_Error(PPCErrorStr111, type, 0);
} else {
Float fv;
escan = expr;
@ -2203,7 +2203,7 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
fv = CMach_CalcFloatConvertFromInt(expr->rtype,
expr->data.intval);
} else {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
@ -2217,7 +2217,7 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
} else if (ENODE_IS(escan, EINTCONST)) {
fv = CMach_CalcFloatConvertFromInt(escan->rtype, escan->data.intval);
} else {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
@ -2237,10 +2237,10 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UCHAR) {
if (!CInt64_IsInURange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 1))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
while (i < 16)
@ -2257,10 +2257,10 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_USHORT || TYPE_STRUCT(type)->stype == STRUCT_VECTOR_PIXEL) {
if (!CInt64_IsInURange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 2))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
while (i < 8)
@ -2276,10 +2276,10 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
if (copts.pedantic) {
if (TYPE_STRUCT(type)->stype == STRUCT_VECTOR_UINT) {
if (!CInt64_IsInURange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
} else {
if (!CInt64_IsInRange(v, 4))
PPCError_Warning(113, type, 0);
PPCError_Warning(PPCErrorStr113, type, 0);
}
}
while (i < 4)
@ -2291,7 +2291,7 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
{
Float fv;
if (!CInt64_IsInRange(expr->data.intval, 4)) {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
}
fv = CMach_CalcFloatConvertFromInt(expr->rtype, expr->data.intval);
@ -2301,12 +2301,12 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
break;
}
default:
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
}
} else if (ENODE_IS(expr, EFLOATCONST)) {
switch (TYPE_STRUCT(type)->stype) {
default:
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
break;
case STRUCT_VECTOR_FLOAT:
{
@ -2322,9 +2322,9 @@ Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *ty
}
} else if (ENODE_IS2(expr, EINDIRECT, EFUNCCALL)) {
if (!IS_TYPE_STRUCT(expr->rtype))
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
} else if (!ENODE_IS(expr, EVECTOR128CONST)) {
PPCError_Error(112);
PPCError_Error(PPCErrorStr112);
}
return result;

View File

@ -243,7 +243,7 @@ void colorinstructions(Object *proc) {
save_before_coloring_nonvolatile_registers(rclass);
used_regs_before_coloring = used_virtual_registers[rclass];
if (!available_registers(rclass)) {
PPCError_Error(102, register_class_name[rclass]);
PPCError_Error(PPCErrorStr102, register_class_name[rclass]);
return;
}

View File

@ -191,7 +191,7 @@ void Assembler(Object *func) {
CodeGen_InitialSanityCheck();
if (func->qual & Q_INLINE)
PPCError_Warning(173);
PPCError_Warning(PPCErrorStr173);
CheckCLabels();
@ -265,7 +265,7 @@ void Assembler(Object *func) {
FuncAsm_AddEntryPoint(stmt, pclastblock);
} else if (ia->opcode == IADirective_FrFree) {
if (flag16)
PPCError_Error(188);
PPCError_Error(PPCErrorStr188);
else
flag16 = 1;
@ -362,11 +362,11 @@ void Assembler(Object *func) {
if (!asm_alloc_flags[1] && needs_frame()) {
if (asm_alloc_flags[3]) {
if (!asm_alloc_flags[5] || !asm_alloc_flags[6])
PPCError_Warning(187, "blr");
PPCError_Warning(PPCErrorStr187, "blr");
if (asm_alloc_flags[8])
PPCError_Warning(186);
PPCError_Warning(PPCErrorStr186);
} else {
PPCError_Warning(185, "blr");
PPCError_Warning(PPCErrorStr185, "blr");
}
}

View File

@ -77,26 +77,26 @@ static void IllegalObjectOperator(HashNameNode *name1, HashNameNode *name2, shor
}
if (!name2) {
PPCError_Error(119, opstr, name1->name);
PPCError_Error(PPCErrorStr119, opstr, name1->name);
} else if (!name1) {
PPCError_Error(120, opstr, name2->name);
PPCError_Error(PPCErrorStr120, opstr, name2->name);
} else {
PPCError_Error(118, name1->name, opstr, name2->name);
PPCError_Error(PPCErrorStr118, name1->name, opstr, name2->name);
}
}
static void IllegalObjectInConst(IAExpr *expr) {
if (expr->xC) {
PPCError_Error(122, expr->xC->name->name);
PPCError_Error(PPCErrorStr122, expr->xC->name->name);
} else if (expr->object) {
PPCError_Error(122, expr->object->name->name);
PPCError_Error(PPCErrorStr122, expr->object->name->name);
} else if (expr->label) {
PPCError_Error(166, expr->label->name->name);
PPCError_Error(PPCErrorStr166, expr->label->name->name);
}
}
static void NotInRegisterError(char *name, char rclass) {
PPCError_Error(167, name, register_class_name[rclass]);
PPCError_Error(PPCErrorStr167, name, register_class_name[rclass]);
}
static int isregisteroperand(char rclass) {
@ -113,7 +113,7 @@ static SInt32 getcroperand(char rclass) {
if (tk == TK_IDENTIFIER && (reg = InlineAsm_LookupRegisterPPCName(tkidentifier)) && reg->rclass == rclass) {
value = reg->num;
} else {
PPCError_Error(167, tkidentifier->name);
PPCError_Error(PPCErrorStr167, tkidentifier->name);
}
tk = lex();
@ -345,13 +345,13 @@ static void DiadicOperatorPPC(IAExpr *left, short token, IAExpr *right) {
if (left->xC) {
if (right->label)
PPCError_Error(124, left->xC->name->name, right->label->name->name);
PPCError_Error(PPCErrorStr124, left->xC->name->name, right->label->name->name);
if (right->xC) {
if (left->x10) {
PPCError_Error(121, left->xC->name->name, left->x10->name->name, right->xC->name->name);
PPCError_Error(PPCErrorStr121, left->xC->name->name, left->x10->name->name, right->xC->name->name);
} else if (right->x10) {
PPCError_Error(121, left->xC->name->name, right->xC->name->name, right->x10->name->name);
PPCError_Error(PPCErrorStr121, left->xC->name->name, right->xC->name->name, right->x10->name->name);
} else if (token == '-') {
left->value = CInt64_GetULong(&rightval);
left->x10 = right->xC;
@ -365,7 +365,7 @@ static void DiadicOperatorPPC(IAExpr *left, short token, IAExpr *right) {
}
} else if (right->xC) {
if (right->label)
PPCError_Error(124, right->xC->name->name, right->label->name->name);
PPCError_Error(PPCErrorStr124, right->xC->name->name, right->label->name->name);
if (token == '+') {
left->xC = right->xC;
@ -376,13 +376,13 @@ static void DiadicOperatorPPC(IAExpr *left, short token, IAExpr *right) {
}
} else if (left->label) {
if (left->xC)
PPCError_Error(124, left->label->name->name, left->xC->name->name);
PPCError_Error(PPCErrorStr124, left->label->name->name, left->xC->name->name);
if (right->label) {
if (left->x18) {
PPCError_Error(121, left->label->name->name, left->x18->name->name, right->label->name->name);
PPCError_Error(PPCErrorStr121, left->label->name->name, left->x18->name->name, right->label->name->name);
} else if (right->x18) {
PPCError_Error(121, left->label->name->name, right->label->name->name, right->x18->name->name);
PPCError_Error(PPCErrorStr121, left->label->name->name, right->label->name->name, right->x18->name->name);
} else if (token == '-') {
left->value = CInt64_GetULong(&rightval);
left->x18 = right->label;
@ -412,7 +412,7 @@ static void DiadicOperatorPPC(IAExpr *left, short token, IAExpr *right) {
left->type = right->type;
} else {
if (right->type != IAOpnd_Lab && right->type != left->type)
PPCError_Error(126);
PPCError_Error(PPCErrorStr126);
}
}
@ -538,7 +538,7 @@ static void floatoperand(IAOperand *op, InlineAsm *ia, Type *type) {
ia->argcount++;
op[1].type = IAOpnd_4;
op[1].u.obj.obj = obj;
PPCError_Error(179);
PPCError_Error(PPCErrorStr179);
op[1].u.obj.unk = IAExpr_2;
op[1].u.obj.offset = 0;
tk = lex();
@ -601,7 +601,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
if (!flag)
CError_Error(CErrorStr155);
if (expr.xC)
PPCError_Error(122, expr.xC);
PPCError_Error(PPCErrorStr122, expr.xC);
op[0].type = IAOpnd_Reg;
op[0].u.reg.rclass = RegClass_GPR;
@ -619,7 +619,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
case IAExpr_5:
expr.type = IAExpr_6;
if (expr.object->datatype != DLOCAL || !OBJECT_REG(expr.object))
PPCError_Error(180);
PPCError_Error(PPCErrorStr180);
case IAExpr_2:
case IAExpr_6:
case IAExpr_7:
@ -636,7 +636,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
if (expr.xC) {
if (expr.x10)
PPCError_Error(123, expr.xC->name->name, expr.x10->name->name);
PPCError_Error(PPCErrorStr123, expr.xC->name->name, expr.x10->name->name);
if (flag) {
if (tk == '(') {
@ -672,7 +672,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
op[0].type = IAOpnd_3;
if (expr.type == IAExpr_5) {
expr.type = IAExpr_6;
PPCError_Error(180);
PPCError_Error(PPCErrorStr180);
}
op[0].u.obj.unk = expr.type;
}
@ -710,7 +710,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
op->u.labdiff.label2 = expr.x18;
op->u.labdiff.offset = expr.value;
} else {
PPCError_Error(125, expr.label->name->name);
PPCError_Error(PPCErrorStr125, expr.label->name->name);
}
} else {
op->type = IAOpnd_Imm;
@ -770,7 +770,7 @@ static void registeroperand(IAOperand *op, char rclass, short effect) {
} else if (tk == TK_IDENTIFIER) {
NotInRegisterError(tkidentifier->name, rclass);
} else {
PPCError_Error(171);
PPCError_Error(PPCErrorStr171);
}
tk = lex();
@ -780,12 +780,12 @@ static void registeroperand(IAOperand *op, char rclass, short effect) {
if (reg->object)
op->u.reg.num = 1;
else
PPCError_Error(168);
PPCError_Error(PPCErrorStr168);
tk = lex();
} else if (rclass == RegClass_GPR) {
if (reg->object && reg->object->type->size == 8) {
HashNameNode *name = reg->object->name;
PPCError_Error(127, name->name, name->name, name->name);
PPCError_Error(PPCErrorStr127, name->name, name->name, name->name);
}
}
}
@ -845,7 +845,7 @@ static void labeloperand(InlineAsm *ia, IAOperand *op, Boolean flag1, Boolean fl
if (flag2)
op->u.obj.unk = IAExpr_10;
op->u.obj.unk = IAExpr_6;
PPCError_Error(180);
PPCError_Error(PPCErrorStr180);
}
} else {
CError_Error(CErrorStr144);
@ -927,7 +927,7 @@ static void imm_or_labeldiff_operand(InlineAsm *ia, IAOperand *op, SInt32 minimu
op->u.labdiff.label2 = expr.x18;
op->u.labdiff.offset = expr.value;
} else {
PPCError_Error(125, expr.label->name->name);
PPCError_Error(PPCErrorStr125, expr.label->name->name);
}
return;
}
@ -946,14 +946,14 @@ static void imm_or_labeldiff_operand(InlineAsm *ia, IAOperand *op, SInt32 minimu
op->type = IAOpnd_3;
if (expr.type == IAExpr_5) {
expr.type = IAExpr_6;
PPCError_Error(180);
PPCError_Error(PPCErrorStr180);
}
op->u.obj.unk = expr.type;
}
op->u.obj.obj = expr.xC;
op->u.obj.offset = expr.value;
} else {
PPCError_Error(123, expr.xC->name->name, expr.x10->name->name);
PPCError_Error(PPCErrorStr123, expr.xC->name->name, expr.x10->name->name);
}
return;
}
@ -1992,9 +1992,9 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
r20 = OBJECT_REG(src->u.reg.object);
} else {
if (Registers_GetVarInfo(src->u.reg.object)->flags & VarInfoFlag40)
PPCError_Error(172, src->u.reg.object->name->name);
PPCError_Error(PPCErrorStr172, src->u.reg.object->name->name);
else
PPCError_Error(167, src->u.reg.object->name->name);
PPCError_Error(PPCErrorStr167, src->u.reg.object->name->name);
}
} else if (src->u.reg.num == INVALID_PIC_REG) {
r20 = pic_base_reg;
@ -2145,7 +2145,7 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
int i;
for (i = 0; i < pc->argCount; i++) {
if (pc->args[i].kind == PCOp_LABEL || pc->args[i].kind == PCOp_MEMORY) {
PPCError_Error(177);
PPCError_Error(PPCErrorStr177);
break;
}
}

View File

@ -691,7 +691,7 @@ IARegister *InlineAsm_LookupRegisterPPC(char *name) {
if (reg) {
if (copts.warn_possunwant)
PPCError_Warning(117, name);
PPCError_Warning(PPCErrorStr117, name);
return reg;
}
@ -701,7 +701,7 @@ IARegister *InlineAsm_LookupRegisterPPC(char *name) {
Boolean overflow;
ScanDec(buf + 3, &result, &overflow);
if (overflow || result > 1024) {
PPCError_Error(117, name);
PPCError_Error(PPCErrorStr117, name);
return NULL;
}
@ -713,10 +713,10 @@ IARegister *InlineAsm_LookupRegisterPPC(char *name) {
if (copts.warn_possunwant) {
if (cpu == CPUMask_Generic) {
if ((cpu & CPUFLAG_LOW_MASK) != ((cpu & CPUFLAG_LOW_MASK) & spr_cpus[result]))
PPCError_Warning(117, name);
PPCError_Warning(PPCErrorStr117, name);
} else {
if (!(cpu & spr_cpus[result]))
PPCError_Warning(117, name);
PPCError_Warning(PPCErrorStr117, name);
}
}
@ -754,7 +754,7 @@ IARegister *InlineAsm_LookupDCRRegister(char *name) {
if (reg) {
if (copts.warn_possunwant)
PPCError_Warning(117, name);
PPCError_Warning(PPCErrorStr117, name);
return reg;
}
@ -764,7 +764,7 @@ IARegister *InlineAsm_LookupDCRRegister(char *name) {
Boolean overflow;
ScanDec(buf + 3, &result, &overflow);
if (overflow || result > 1024) {
PPCError_Error(117, name);
PPCError_Error(PPCErrorStr117, name);
return NULL;
}
@ -817,7 +817,7 @@ void InlineAsm_InitializeRegistersPPC(void) {
sprintf(buf, "{?}%" PRId32, asmreg->num);
break;
}
PPCError_Warning(100, obj->name->name, buf);
PPCError_Warning(PPCErrorStr100, obj->name->name, buf);
}
}
for (list = locals; list; list = list->next) {
@ -841,7 +841,7 @@ void InlineAsm_InitializeRegistersPPC(void) {
sprintf(buf, "{?}%" PRId32, asmreg->num);
break;
}
PPCError_Warning(100, obj->name->name, buf);
PPCError_Warning(PPCErrorStr100, obj->name->name, buf);
}
}

View File

@ -2412,17 +2412,17 @@ static SInt32 checkconstintarg(ENode *expr, char *name, SInt32 min, SInt32 max,
SInt32 value;
if (!ENODE_IS(expr, EINTCONST))
PPCError_ErrorTerm(210, name, 3, max, argnum);
PPCError_ErrorTerm(PPCErrorStr210, name, 3, max, argnum);
value = CInt64_GetULong(&expr->data.intval);
if (value < min) {
PPCError_Warning(211, name, argnum, value, min, max, min);
PPCError_Warning(PPCErrorStr211, name, argnum, value, min, max, min);
return min;
}
if (value > max) {
PPCError_Warning(211, name, argnum, value, min, max, value & max);
PPCError_Warning(PPCErrorStr211, name, argnum, value, min, max, value & max);
value = value & max;
}
@ -2535,7 +2535,7 @@ static int Intrinsics_VerifyParameterCount(int wantedCount, ENodeList *args, Has
count++;
if (count != wantedCount) {
PPCError_Error(103, name->name, count, wantedCount);
PPCError_Error(PPCErrorStr103, name->name, count, wantedCount);
return 0;
}
@ -2589,7 +2589,7 @@ static Type *Intrinsics_Verify1VectorArg2Ops(Intrinsics id, ENodeList *args, Has
rtype = table->rtype;
if (!rtype) {
PPCError_Error(104, name->name, name->name, arg1->rtype, 0);
PPCError_Error(PPCErrorStr104, name->name, name->name, arg1->rtype, 0);
rtype = NULL;
}
return rtype;
@ -2633,11 +2633,11 @@ static Type *Intrinsics_Verify1VectorArg(Intrinsics id, ENodeList *args, HashNam
if (ENODE_IS(arg1, EINTCONST)) {
SInt32 val = arg1->data.intval.lo;
if (val > 15 || val < -16) {
PPCError_Error(108, name->name, name->name, 5);
PPCError_Error(PPCErrorStr108, name->name, name->name, 5);
return NULL;
}
} else {
PPCError_Error(108, name->name, name->name, 5);
PPCError_Error(PPCErrorStr108, name->name, name->name, 5);
return NULL;
}
break;
@ -2645,11 +2645,11 @@ static Type *Intrinsics_Verify1VectorArg(Intrinsics id, ENodeList *args, HashNam
if (ENODE_IS(arg1, EINTCONST)) {
SInt32 val = arg1->data.intval.lo;
if (val > 3 || val < 0) {
PPCError_Error(108, name->name, name->name, 2);
PPCError_Error(PPCErrorStr108, name->name, name->name, 2);
return NULL;
}
} else {
PPCError_Error(108, name->name, name->name, 2);
PPCError_Error(PPCErrorStr108, name->name, name->name, 2);
return NULL;
}
break;
@ -2657,7 +2657,7 @@ static Type *Intrinsics_Verify1VectorArg(Intrinsics id, ENodeList *args, HashNam
rtype = table->rtype;
if (!rtype) {
PPCError_Error(104, name->name, name->name, arg1->rtype, 0);
PPCError_Error(PPCErrorStr104, name->name, name->name, arg1->rtype, 0);
rtype = NULL;
}
return rtype;
@ -2690,11 +2690,11 @@ static Type *Intrinsics_Verify2VectorArgs(Intrinsics id, ENodeList *args, HashNa
case Intrinsic_268:
if (ENODE_IS(arg2, EINTCONST)) {
if (arg2->data.intval.lo > 31 || arg2->data.intval.hi < 0) {
PPCError_Error(108, name->name, name->name, 5);
PPCError_Error(PPCErrorStr108, name->name, name->name, 5);
return NULL;
}
} else {
PPCError_Error(108, name->name, name->name, 5);
PPCError_Error(PPCErrorStr108, name->name, name->name, 5);
return NULL;
}
break;
@ -2719,7 +2719,7 @@ static Type *Intrinsics_Verify2VectorArgs(Intrinsics id, ENodeList *args, HashNa
}
if (!table->rtype) {
PPCError_Error(105, name->name, name->name, arg1->rtype, 0, arg2->rtype, 0);
PPCError_Error(PPCErrorStr105, name->name, name->name, arg1->rtype, 0, arg2->rtype, 0);
return NULL;
}
@ -2728,7 +2728,7 @@ static Type *Intrinsics_Verify2VectorArgs(Intrinsics id, ENodeList *args, HashNa
case Intrinsic_067:
case Intrinsic_068:
if (arg2->flags & ENODE_FLAG_VOLATILE)
PPCError_Warning(178, name->name);
PPCError_Warning(PPCErrorStr178, name->name);
}
return table->rtype;
@ -2783,11 +2783,11 @@ static Type *Intrinsics_Verify3VectorArgs(Intrinsics id, ENodeList *args, HashNa
if (ENODE_IS(arg3, EINTCONST)) {
SInt32 val = arg3->data.intval.lo;
if (val > 3 || val < 0) {
PPCError_Error(108, name->name, name->name, 2);
PPCError_Error(PPCErrorStr108, name->name, name->name, 2);
return NULL;
}
} else {
PPCError_Error(108, name->name, name->name, 2);
PPCError_Error(PPCErrorStr108, name->name, name->name, 2);
return NULL;
}
break;
@ -2795,18 +2795,18 @@ static Type *Intrinsics_Verify3VectorArgs(Intrinsics id, ENodeList *args, HashNa
case Intrinsic_263:
if (ENODE_IS(arg3, EINTCONST)) {
if (arg3->data.intval.lo > 15 || arg3->data.intval.hi < 0) {
PPCError_Error(108, name->name, name->name, 4);
PPCError_Error(PPCErrorStr108, name->name, name->name, 4);
return NULL;
}
} else {
PPCError_Error(108, name->name, name->name, 4);
PPCError_Error(PPCErrorStr108, name->name, name->name, 4);
return NULL;
}
break;
}
if (!table->rtype) {
PPCError_Error(106, name->name, name->name, arg1->rtype, 0, arg2->rtype, 0, arg3->rtype, 0);
PPCError_Error(PPCErrorStr106, name->name, name->name, arg1->rtype, 0, arg2->rtype, 0, arg3->rtype, 0);
return NULL;
}
@ -2815,7 +2815,7 @@ static Type *Intrinsics_Verify3VectorArgs(Intrinsics id, ENodeList *args, HashNa
case Intrinsic_115:
case Intrinsic_116:
if (arg3->flags & ENODE_FLAG_VOLATILE)
PPCError_Warning(178, name->name);
PPCError_Warning(PPCErrorStr178, name->name);
}
return table->rtype;

View File

@ -79,9 +79,9 @@ static SInt32 pcode_update_mem_labeldiff_imm(PCode *instr, const PCodeArg *op, W
offset = -offset;
if (offset > 0x7FFF)
PPCError_Error(109);
PPCError_Error(PPCErrorStr109);
else if (offset < -0x8000)
PPCError_Error(109);
PPCError_Error(PPCErrorStr109);
} else if (op->kind == PCOp_IMMEDIATE) {
offset = op->data.imm.value;
} else {
@ -1546,7 +1546,7 @@ SInt32 assemblefunction(Object *func, EntryPoint *entrypoints) {
codesize = pccomputeoffsets();
if (codesize <= 0)
PPCError_Error(190, func->name->name);
PPCError_Error(PPCErrorStr190, func->name->name);
if (copts.peephole || copts.optimizationlevel >= 3)
codesize = optimizefinalbranches(codesize);

View File

@ -8,7 +8,7 @@ static void PPCError_GetErrorString(char *str, short code) {
short scode;
scode = (short) code;
CError_ASSERT(40, scode >= 100 && scode < 212);
CError_ASSERT(40, scode >= 100 && scode < PPCErrorStrMAX);
COS_GetString(str, 10001, scode - 99);
}

View File

@ -1982,7 +1982,7 @@ static void expandTOCexpression(ENode *expr, Type *type, int ignored) {
}
if (IS_TYPE_VECTOR(expr->rtype) && !IS_TYPE_VECTOR(tmpexpr->rtype))
PPCError_Error(114);
PPCError_Error(PPCErrorStr114);
break;
case EPOSTINC:

View File

@ -3,6 +3,234 @@
#include "compiler/common.h"
enum {
// "ambiguous use of local variable(%n) and assembler register(%n) name"
PPCErrorStr100 = 100,
// "ambiguous use of argument(%n) and assembler register(%n) name"
PPCErrorStr101 = 101,
// "all registers are explictly used, can't color virtual '%u' registers"
PPCErrorStr102 = 102,
// "parameter count to AltiVec intrinsic '%u' is %i, expected %i"
PPCErrorStr103 = 103,
// "invalid parameter to AltiVec intrinsic '%u', %u( %t ) is not allowed"
PPCErrorStr104 = 104,
// "invalid parameters to AltiVec intrinsic '%u', %u( %t,%t ) is not allowed"
PPCErrorStr105 = 105,
// "invalid parameters to AltiVec intrinsic '%u', %u( %t, %t, %t ) is not allowed"
PPCErrorStr106 = 106,
// "invalid parameter type to AltiVec intrinsic '%u'"
PPCErrorStr107 = 107,
// "invalid constant parameter to AltiVec intrinsic '%u',\n'%u' last argument only accepts %i-bit constants"
PPCErrorStr108 = 108,
// "label displacement is too far (must be within 32K bytes)"
PPCErrorStr109 = 109,
// "too few initializers for '%t'"
PPCErrorStr110 = 110,
// "too many initializers for '%t'"
PPCErrorStr111 = 111,
// "illegal initialization of AltiVec vector data"
PPCErrorStr112 = 112,
// "out of range for legal initialization of AltiVec '%t'"
PPCErrorStr113 = 113,
// "illegal initialization or cast of AltiVec vector data"
PPCErrorStr114 = 114,
// "use of AltiVec Model requires AltiVec-capable scheduler"
PPCErrorStr115 = 115,
// "can't allocate AltiVec stack pointer, all registers already allocated (try optimize level 1 and higher)"
PPCErrorStr116 = 116,
// "'%u' register not applicable to this processor"
PPCErrorStr117 = 117,
// "only difference expressions are allowed on object\n (%u %u %u is not allowed)"
PPCErrorStr118 = 118,
// "'%u' expressions is not allowed on an object\n(only %u +/- constant expression is allowed)"
PPCErrorStr119 = 119,
// "'%u' operator is not allowed with an object\n(only constant expression + %u is allowed)"
PPCErrorStr120 = 120,
// "only 2 objects are allowed in assembler expressions (%u, %u, %u)"
PPCErrorStr121 = 121,
// "illegal object reference in constant expression (%u)"
PPCErrorStr122 = 122,
// "illegal use of object difference (%u-%u)"
PPCErrorStr123 = 123,
// "illegal can't mix labels and objects in expression (%u-%u)"
PPCErrorStr124 = 124,
// "illegal use of label (%u), can only use label difference in this context"
PPCErrorStr125 = 125,
// "illegal expression only one of {ha16, hi16, lo16, @h, @ha, @l} is allowed"
PPCErrorStr126 = 126,
// "illegal use of register pair (%u) use %u@hiword or %u@loword"
PPCErrorStr127 = 127,
// "cannot redefine uninitialized pooled data unless original definition is in common section"
PPCErrorStr128 = 128,
// "identifier '%n' has already been defined in the '%n' section"
PPCErrorStr129 = 129,
// "floating point type was checked in %u at line %i"
PPCErrorStr130 = 130,
// "symbol '%n' would generate floating point instructions\n(HW floating point is off)"
PPCErrorStr131 = 131,
// "processor settings don't support hardware floating point instructions"
PPCErrorStr132 = 132,
// "invalid operand values: %i must be >= %i"
PPCErrorStr133 = 133,
// "invalid operand values: %i + %i must be <= 32"
PPCErrorStr134 = 134,
// "pragma section expected valid %u addressing mode"
PPCErrorStr135 = 135,
// "pragma section expected unquoted %u addressing mode"
PPCErrorStr136 = 136,
// "pragma section expected %u"
PPCErrorStr137 = 137,
// "pragma section expected unquoted object type; found \"%u\""
PPCErrorStr138 = 138,
// "pragma section expected unquoted identifier for address mode; found \"%u\""
PPCErrorStr139 = 139,
// "invalid section name '%u'"
PPCErrorStr140 = 140,
// "initialized sections must have uniquely named uninitialized data sections;\n'%u' is already defined for another section"
PPCErrorStr141 = 141,
// "'sda_rel' addressing mode can only be used with the PPC EABI defined small data sections"
PPCErrorStr142 = 142,
// "only use the initialized section name to refer to the section\n'%u' is the name of an uninitialized data section"
PPCErrorStr143 = 143,
// "section '%u' already has uninitialized data section '%u'"
PPCErrorStr144 = 144,
// "sections used for data must have an uninitialized data section"
PPCErrorStr145 = 145,
// "section '%u' must have an uninitialized data section for object '%n'"
PPCErrorStr146 = 146,
// "unknown section name '%u'"
PPCErrorStr147 = 147,
// "pragma section expected a quoted section name"
PPCErrorStr148 = 148,
// "'%u' parameter for pragma section is out of order"
PPCErrorStr149 = 149,
// "'%u' parameter for pragma section is repeated"
PPCErrorStr150 = 150,
// "unknown parameter '%u' for pragma section"
PPCErrorStr151 = 151,
// "'%u' is only valid for '%u' addressing mode"
PPCErrorStr152 = 152,
// "pragma section expected an object type or access permission and/or a quoted section name"
PPCErrorStr153 = 153,
// "unknown or possibly out of order parameter '%u' for pragma section"
PPCErrorStr154 = 154,
// "pragma section expected a quoted uninitialized section name\nor the unquoted identifiers 'data_mode', 'code_mode', 'R', 'RW', 'RX' or 'RWX'"
PPCErrorStr155 = 155,
// "this pragma is ignored when it occurs within a function"
PPCErrorStr156 = 156,
// "'%u' object '%n' is being put into section '%u' with access permission '%u';\nsection's access permission will be changed to '%u'"
PPCErrorStr157 = 157,
// "pragma section expected an unquoted access permission; found \"%u\""
PPCErrorStr158 = 158,
// "pragma section expected object type or access permission, but not both"
PPCErrorStr159 = 159,
// "pragma rel109_offset expected an integer (0, 1, 2 or 3)"
PPCErrorStr160 = 160,
// "pragma function_align expected an integer (4, 8, 16, 32, 64 or 128)"
PPCErrorStr161 = 161,
// "address part of section name '%u' is allowed 1 - 8 hexidecimal digits"
PPCErrorStr162 = 162,
// "interrupt function '%o' is bigger than 256 bytes (%i bytes big)"
PPCErrorStr163 = 163,
// "too many #pragma section directives (max is %i)"
PPCErrorStr164 = 164,
// "EPPC Processor preference panel is incompatible with this compiler"
PPCErrorStr165 = 165,
// "illegal forward label or undefined symbol (%u) in constant expression"
PPCErrorStr166 = 166,
// "%u was not assigned to a register (try using register qualifier)"
PPCErrorStr167 = 167,
// "@hiword can't be used in this context (only works on variables not registers)"
PPCErrorStr168 = 168,
// "floating point constants are not allowed if floating point is off."
PPCErrorStr169 = 169,
// "possible unintended use of address of %u in constant expression\nUse 'la' or 'las' simplified mnemonics to load addresses"
PPCErrorStr170 = 170,
// "expected a register name here"
PPCErrorStr171 = 171,
// "out of registers for local variable %u\nTry using optimization level 1 or greater"
PPCErrorStr172 = 172,
// "function level assembler can not be inlined.\nUse 'asm { instr... }' blocks inside an inline function."
PPCErrorStr173 = 173,
// "PCode cannot access the global variable %o, because it has been stored in the TOC."
PPCErrorStr174 = 174,
// "PCode cannot use long long."
PPCErrorStr175 = 175,
// "PCode function cannot take a variable argument list."
PPCErrorStr176 = 176,
// "illegal use of label or object in a absolute branch."
PPCErrorStr177 = 177,
// "AltiVec PIM requires warning for volatile parameter to %u."
PPCErrorStr178 = 178,
// "Mach-O can't load a float constant directly. Use addis rX,picbase,ha16(float_const_var); lfd fX,lo16(float_const_var)(rX)"
PPCErrorStr179 = 179,
// "Illegal addressing mode (32 bit). Try constructing an address using addis rX,rPIC,ha16(var); lwz rX,lo16(var)(rX)"
PPCErrorStr180 = 180,
// "%o cannot be an interrupt function with variable argument list"
PPCErrorStr181 = 181,
// "incoming parameter area > 32K"
PPCErrorStr182 = 182,
// "outgoing parameter area > 32K"
PPCErrorStr183 = 183,
// "N/A"
PPCErrorStr184 = 184,
// "when there is a frame, it is best to have frfree just before the %u"
PPCErrorStr185 = 185,
// "when there is a frame, it is best to have only one explicit exit\n(try branching to a label just before the frfree)"
PPCErrorStr186 = 186,
// "when there is a frame, it is generally best to have a %u just after the frfree"
PPCErrorStr187 = 187,
// "frfree directive is only allowed at the end of a function. To exit from the middle of a function, branch to a frfree at the end."
PPCErrorStr188 = 188,
// "Mach-O 'pic' model is only supported if 'dynamic' is on."
PPCErrorStr189 = 189,
// "Function '%u' contains no instructions."
PPCErrorStr190 = 190,
// "pragma min_struct_alignment expected an integer (4, 8, 16, 32, 64 or 128)."
PPCErrorStr191 = 191,
// "correct syntax is __declspec(section \"sect_name\") where sect_name is a quoted string."
PPCErrorStr192 = 192,
// "global register variable declarations are ignored when they occur within a function."
PPCErrorStr193 = 193,
// "global register variable declarations must be variables of storage class static, extern or register."
PPCErrorStr194 = 194,
// "global register variable declaration syntax is storage_class type var_name asm (\"xn\");\nstorage_class is extern, static or register, \"xn\" is quoted, 'x' should be r,f or v,\nand 'n' should be a nonvolatile register number."
PPCErrorStr195 = 195,
// "global register variable declaration supports %i registers beginning with %u%i for this register class."
PPCErrorStr196 = 196,
// "global register variable assigned to '%u%i' can not be reassigned to '%u%i'."
PPCErrorStr197 = 197,
// "global register variable '%n' already is assigned to '%u%i'."
PPCErrorStr198 = 198,
// "gaps between assigned global register variables (nothing at '%u%i') are not permitted."
PPCErrorStr199 = 199,
// "global register variable is assigned to register class '%u' but should be '%u'."
PPCErrorStr200 = 200,
// "global register variables can only use single registers (cannot be long longs or software fp doubles)."
PPCErrorStr201 = 201,
// "global register variable '%o' cannot be assigned %u%i because that register has already been assigned to something else."
PPCErrorStr202 = 202,
// "global and static register variables cannot have the same name: '%n'."
PPCErrorStr203 = 203,
// "global register variables must be variables; '%n' isn't a variable."
PPCErrorStr204 = 204,
// "type cannot be made into a global register variable;\nonly scalers, doubles, floats and vectors are supported."
PPCErrorStr205 = 205,
// "cannot declare global register variables after code has been generated."
PPCErrorStr206 = 206,
// "correct syntax is __declspec(interrupt flags) where optional flags can be 1 or more of following space separated list:\nenable SRR DAR DSISR fprs vrs nowarn."
PPCErrorStr207 = 207,
// "pragma processor expected an integer, such as 603, or a string (no quotes), such as 603e."
PPCErrorStr208 = 208,
// "pragma prepare_compress is ignored if an appropriate processor is not passed to pragma processor."
PPCErrorStr209 = 209,
// "intrinsic %u argument %i is not constant"
PPCErrorStr210 = 210,
// "intrinsic %u argument %i constant value value %i is not in range %i..%i using %i"
PPCErrorStr211 = 211,
PPCErrorStrMAX = 212
};
extern void PPCError_Error(int code, ...);
extern void PPCError_Warning(int code, ...);
extern void PPCError_Message(char *format, ...);