summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/CodeGen.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-15 12:14:05 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-15 12:14:05 +0000
commit35d488e972a9dd75ce3867c000405f128b79c615 (patch)
treee3319a23d9aa0d4725f88a99fdd5131488a334a9 /compiler_and_linker/unsorted/CodeGen.c
parent8078e7f897aaae9b492b22475060052d68b9c547 (diff)
downloadMWCC-35d488e972a9dd75ce3867c000405f128b79c615.tar.gz
MWCC-35d488e972a9dd75ce3867c000405f128b79c615.zip
reorganise things a bit to align further with the actual names/structure
Diffstat (limited to 'compiler_and_linker/unsorted/CodeGen.c')
-rw-r--r--compiler_and_linker/unsorted/CodeGen.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/compiler_and_linker/unsorted/CodeGen.c b/compiler_and_linker/unsorted/CodeGen.c
index d5ba07f..4fb0b30 100644
--- a/compiler_and_linker/unsorted/CodeGen.c
+++ b/compiler_and_linker/unsorted/CodeGen.c
@@ -217,7 +217,7 @@ static void retain_argument_register(Object *obj, short reg) {
if (type->size <= 4) {
retain_register(obj, RegClass_GPR, reg);
} else if (reg < GPRLimit) {
- if (copts.little_endian)
+ if (copts.littleendian)
retain_GPR_pair(obj, reg, reg + 1);
else
retain_GPR_pair(obj, reg + 1, reg);
@@ -519,7 +519,7 @@ void move_assigned_argument(Object *obj, short reg) {
if (reg) {
if (vi->reg) {
if (TYPE_IS_8BYTES(type)) {
- if (copts.little_endian) {
+ if (copts.littleendian) {
if (vi->reg != reg)
emitpcode(PC_MR, vi->reg, reg);
if (reg < GPRLimit) {
@@ -872,7 +872,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
setheaperror(CodeGen_heaperror);
}
- if (cparamblkptr->isPrecompiling == 1)
+ if (cparamblkptr->precompile == 1)
CError_Error(CErrorStr180);
if (!func) {
@@ -928,7 +928,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
allocate_locals();
process_arguments(move_assigned_argument, has_varargs);
- if (copts.schedule_mode || copts.altivec_model)
+ if (copts.schedule_factor || copts.altivec_model)
branch_label(makepclabel());
load_TOC_pointers();
@@ -1032,7 +1032,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
else
pclistblocks(CMangler_GetLinkName(func)->name, "INITIAL CODE");
- if (copts.schedule_mode == 2) {
+ if (copts.schedule_factor == 2) {
if (copts.peephole)
peepholemergeblocks(func, 0);
if (copts.debuglisting)
@@ -1045,7 +1045,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
}
if (copts.peephole) {
- if (copts.schedule_mode == 0 && copts.optimizationlevel > 1)
+ if (copts.schedule_factor == 0 && copts.optimizationlevel > 1)
peepholemergeblocks(func, 0);
peepholeoptimizeforward(func);
if (copts.debuglisting)
@@ -1073,7 +1073,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
pclistblocks(CMangler_GetLinkName(func)->name, "AFTER GENERATING EPILOGUE, PROLOGUE");
if (copts.peephole) {
- if (copts.schedule_mode) {
+ if (copts.schedule_factor) {
peepholemergeblocks(func, 1);
if (copts.debuglisting)
pclistblocks(CMangler_GetLinkName(func)->name, "AFTER MERGING EPILOGUE, PROLOGUE");
@@ -1083,7 +1083,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
pclistblocks(CMangler_GetLinkName(func)->name, "AFTER PEEPHOLE OPTIMIZATION");
}
- if (copts.schedule_mode) {
+ if (copts.schedule_factor) {
if (copts.debuglisting)
pclistblocks_start_scheduler(CMangler_GetLinkName(func)->name, "BEFORE SCHEDULING");
scheduleinstructions(1);
@@ -1125,7 +1125,7 @@ void CodeGen_GenVDispatchThunk(Object *thunkobj, Object *obj, SInt32 a, SInt32 b
Boolean save_traceback;
char reg;
- save_debug = copts.isGeneratingDebugInfo;
+ save_debug = copts.filesyminfo;
save_peephole = copts.peephole;
save_traceback = copts.traceback;
@@ -1161,11 +1161,11 @@ void CodeGen_GenVDispatchThunk(Object *thunkobj, Object *obj, SInt32 a, SInt32 b
emitpcode(PC_B, 0, obj);
- copts.isGeneratingDebugInfo = 0;
+ copts.filesyminfo = 0;
copts.peephole = 0;
copts.traceback = 0;
assemblefunction(thunkobj, NULL);
- copts.isGeneratingDebugInfo = save_debug;
+ copts.filesyminfo = save_debug;
copts.peephole = save_peephole;
copts.traceback = save_traceback;
}
@@ -1231,7 +1231,7 @@ void CodeGen_SOMStub(Object *a, Object *b, Object *c, SInt32 offset) {
Object *tmp;
Operand opnd;
- save_debug = copts.isGeneratingDebugInfo;
+ save_debug = copts.filesyminfo;
save_peephole = copts.peephole;
save_traceback = copts.traceback;
@@ -1264,11 +1264,11 @@ void CodeGen_SOMStub(Object *a, Object *b, Object *c, SInt32 offset) {
load_store_register(PC_LWZ, 12, 12, NULL, (short) offset);
emitpcode(PC_B, 0, b);
- copts.isGeneratingDebugInfo = 0;
+ copts.filesyminfo = 0;
copts.peephole = 0;
copts.traceback = 0;
assemblefunction(a, NULL);
- copts.isGeneratingDebugInfo = save_debug;
+ copts.filesyminfo = save_debug;
copts.peephole = save_peephole;
copts.traceback = save_traceback;
}
@@ -1295,7 +1295,7 @@ static void CodeGen_EOLCheck(void) {
static void schedule_for(int what) {
CPrep_PushOption(OPT_OFFSET(schedule_cpu), what);
- if (copts.schedule_mode == 0)
+ if (copts.schedule_factor == 0)
CPrep_PushOption(OPT_OFFSET(schedule_mode), 2);
}
@@ -1467,12 +1467,12 @@ void CodeGen_ParsePragma(HashNameNode *name) {
return;
}
- if (!strcmp(name->name, "ppc_unroll_speculative")) {
+ if (!strcmp(name->name, "unroll_speculative")) {
if (plex() == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) {
- copts.ppc_unroll_speculative = 0;
+ copts.unroll_speculative = 0;
} else if (!strcmp(tkidentifier->name, "on")) {
- copts.ppc_unroll_speculative = 1;
+ copts.unroll_speculative = 1;
} else {
CError_Error(CErrorStr186);
return;
@@ -1484,19 +1484,19 @@ void CodeGen_ParsePragma(HashNameNode *name) {
return;
}
- if (!strcmp(name->name, "ppc_unroll_instructions_limit")) {
+ if (!strcmp(name->name, "unroll_instr_limit")) {
t = plex();
if (t == TK_INTCONST) {
- copts.ppc_unroll_instructions_limit = CInt64_GetULong(&tkintconst);
- if (copts.ppc_unroll_instructions_limit < 0) {
- copts.ppc_unroll_instructions_limit = 0;
+ copts.unroll_instr_limit = CInt64_GetULong(&tkintconst);
+ if (copts.unroll_instr_limit < 0) {
+ copts.unroll_instr_limit = 0;
CError_Error(CErrorStr186);
}
} else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) {
- copts.ppc_unroll_instructions_limit = 0;
+ copts.unroll_instr_limit = 0;
} else if (!strcmp(tkidentifier->name, "on")) {
- copts.ppc_unroll_instructions_limit = 70;
+ copts.unroll_instr_limit = 70;
} else {
CError_Error(CErrorStr186);
return;
@@ -1539,19 +1539,19 @@ void CodeGen_ParsePragma(HashNameNode *name) {
return;
}
- if (!strcmp(name->name, "ppc_unroll_factor_limit")) {
+ if (!strcmp(name->name, "unroll_factor_limit")) {
t = plex();
if (t == TK_INTCONST) {
- copts.ppc_unroll_factor_limit = CInt64_GetULong(&tkintconst);
- if (copts.ppc_unroll_factor_limit < 0) {
- copts.ppc_unroll_factor_limit = 0;
+ copts.unroll_factor_limit = CInt64_GetULong(&tkintconst);
+ if (copts.unroll_factor_limit < 0) {
+ copts.unroll_factor_limit = 0;
CError_Error(CErrorStr186);
}
} else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) {
- copts.ppc_unroll_factor_limit = 0;
+ copts.unroll_factor_limit = 0;
} else if (!strcmp(tkidentifier->name, "on")) {
- copts.ppc_unroll_factor_limit = 10;
+ copts.unroll_factor_limit = 10;
} else {
CError_Error(CErrorStr186);
return;
@@ -1637,67 +1637,67 @@ void CodeGen_ParsePragma(HashNameNode *name) {
if (t == TK_INTCONST) {
switch (CInt64_GetULong(&tkintconst)) {
case 401:
- copts.cpu = 0;
+ copts.processor = 0;
break;
case 403:
- copts.cpu = 1;
+ copts.processor = 1;
break;
case 505:
- copts.cpu = 2;
+ copts.processor = 2;
break;
case 509:
- copts.cpu = 3;
+ copts.processor = 3;
break;
case 555:
- copts.cpu = 4;
+ copts.processor = 4;
break;
case 556:
- copts.cpu = 25;
+ copts.processor = 25;
break;
case 565:
- copts.cpu = 26;
+ copts.processor = 26;
break;
case 601:
- copts.cpu = 5;
+ copts.processor = 5;
break;
case 602:
- copts.cpu = 6;
+ copts.processor = 6;
break;
case 8240:
- copts.cpu = 18;
+ copts.processor = 18;
break;
case 8260:
- copts.cpu = 19;
+ copts.processor = 19;
break;
case 603:
- copts.cpu = 7;
+ copts.processor = 7;
break;
case 604:
- copts.cpu = 9;
+ copts.processor = 9;
break;
case 740:
- copts.cpu = 11;
+ copts.processor = 11;
break;
case 750:
- copts.cpu = 12;
+ copts.processor = 12;
break;
case 801:
- copts.cpu = 13;
+ copts.processor = 13;
break;
case 821:
- copts.cpu = 14;
+ copts.processor = 14;
break;
case 823:
- copts.cpu = 15;
+ copts.processor = 15;
break;
case 850:
- copts.cpu = 16;
+ copts.processor = 16;
break;
case 860:
- copts.cpu = 17;
+ copts.processor = 17;
break;
case 7400:
- copts.cpu = 21;
+ copts.processor = 21;
break;
default:
PPCError_Warning(208);
@@ -1706,15 +1706,15 @@ void CodeGen_ParsePragma(HashNameNode *name) {
}
} else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "generic"))
- copts.cpu = 20;
+ copts.processor = 20;
else if (!strcmp(tkidentifier->name, "603e"))
- copts.cpu = 8;
+ copts.processor = 8;
else if (!strcmp(tkidentifier->name, "604e"))
- copts.cpu = 10;
+ copts.processor = 10;
else if (!strcmp(tkidentifier->name, "PPC603e"))
- copts.cpu = 8;
+ copts.processor = 8;
else if (!strcmp(tkidentifier->name, "PPC604e"))
- copts.cpu = 10;
+ copts.processor = 10;
else
PPCError_Warning(208);
} else {
@@ -1889,7 +1889,7 @@ void CodeGen_UpdateObject(Object *object) {
}
void CodeGen_UpdateBackEndOptions(void) {
- copts.global_optimizer = 1;
+ copts.globaloptimizer = 1;
}
SInt32 CodeGen_objc_method_self_offset(ObjCMethod *meth) {
@@ -2360,10 +2360,10 @@ void CodeGen_InsertSpecialMacros(void) {
if (!copts.codegen_dynamic)
CPrep_InsertSpecialMacro(&dynM, "__STATIC__");
- if (copts.oldalignment && copts.align_mode == AlignMode2_PPC)
+ if (copts.oldalignment && copts.structalignment == AlignMode2_PPC)
CPrep_InsertSpecialMacro(&alignM, "__NATURAL_ALIGNMENT__");
- if (!copts.ANSI_strict)
+ if (!copts.ANSIstrict)
CPrep_InsertSpecialMacro(&ppcM, "ppc");
}
@@ -2397,7 +2397,7 @@ char *CodeGen_ExpandSpecialMacro(Macro *macro) {
if (macro == &_machM) return "1";
if (macro == &archM) return "ppc";
if (macro == &dynM) return "1";
- if (!copts.ANSI_strict && macro == &ppcM) return "1";
+ if (!copts.ANSIstrict && macro == &ppcM) return "1";
if (macro == &_ppc_M) return "1";
CError_FATAL(4801);