2022-11-20 05:07:22 +00:00
|
|
|
#include "compiler/CodeGenOptPPC.h"
|
|
|
|
#include "compiler/InstrSelection.h"
|
2023-01-10 11:05:21 +00:00
|
|
|
#include "compiler/CCompiler.h"
|
|
|
|
#include "pref_structs.h"
|
|
|
|
#include "compiler/CParser.h"
|
|
|
|
|
|
|
|
static short pref_versions;
|
2022-11-20 05:07:22 +00:00
|
|
|
|
|
|
|
void CodeGen_InitCompiler(void) {
|
|
|
|
init_cgdispatch();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CodeGen_TermCompiler(void) {
|
2023-01-10 11:05:21 +00:00
|
|
|
// empty!
|
2022-11-20 05:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CodeGen_InitBackEndOptions(void) {
|
2023-01-10 11:05:21 +00:00
|
|
|
Handle handle;
|
|
|
|
PBackEnd pb;
|
|
|
|
PMachOLinker pmol;
|
|
|
|
|
|
|
|
CWSecretGetNamedPreferences(cparams.context, "PPC CodeGen Mach-O", &handle);
|
|
|
|
pb = *((PBackEnd *) *handle);
|
|
|
|
pref_versions = pb.version;
|
|
|
|
|
|
|
|
CWSecretGetNamedPreferences(cparams.context, "PPC Mach-O Linker", &handle);
|
|
|
|
pmol = *((PMachOLinker *) *handle);
|
|
|
|
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.function_align = 16;
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.misaligned_mem_access = 1;
|
|
|
|
copts.switch_tables = 1;
|
|
|
|
copts.prepare_compress = 0;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.min_struct_alignment = 4;
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.altivec_model = 0;
|
|
|
|
copts.altivec_vrsave = 1;
|
|
|
|
copts.codegen_pic = pb.pic;
|
|
|
|
copts.codegen_dynamic = pb.dynamic;
|
|
|
|
if (!copts.codegen_dynamic)
|
|
|
|
copts.codegen_pic = 0;
|
|
|
|
copts.no_common = !pb.common;
|
|
|
|
copts.no_implicit_templates = 0;
|
|
|
|
copts.absolutepath = pmol.symfullpath;
|
|
|
|
copts.x06 = pmol.exports;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.schedule_factor = 2;
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.altivec_model = pb.altivec;
|
|
|
|
copts.readonly_strings = pb.readonlystrings;
|
|
|
|
if (pb.schedule)
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.schedule_factor = 2;
|
2023-01-10 11:05:21 +00:00
|
|
|
else
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.schedule_factor = 0;
|
2023-01-10 11:05:21 +00:00
|
|
|
|
|
|
|
switch (pb.processor) {
|
|
|
|
case 1:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC601;
|
|
|
|
copts.scheduling = 1;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC603;
|
|
|
|
copts.scheduling = 2;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC603e;
|
|
|
|
copts.scheduling = 5;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC604;
|
|
|
|
copts.scheduling = 3;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC604e;
|
|
|
|
copts.scheduling = 6;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC750;
|
|
|
|
copts.scheduling = 4;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC7400;
|
|
|
|
copts.scheduling = 7;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_PPC7450;
|
|
|
|
copts.scheduling = 10;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.processor = CPU_Generic;
|
|
|
|
copts.scheduling = 8;
|
2023-01-10 11:05:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
copts.peephole = pb.peephole;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.structalignment = pb.structalignment;
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.profile = pb.profiler;
|
|
|
|
copts.fp_contract = pb.fpcontract;
|
|
|
|
copts.traceback = pb.tracebacktables > 0;
|
|
|
|
copts.x1D = pb.tracebacktables == 2;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.gen_isel = 0;
|
|
|
|
if (pb.processorspecific && copts.processor >= CPU_PPC603)
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.gen_fsel = 10;
|
|
|
|
else
|
|
|
|
copts.gen_fsel = 0;
|
|
|
|
if (pb.vrsave)
|
|
|
|
copts.altivec_vrsave = 1;
|
|
|
|
else
|
|
|
|
copts.altivec_vrsave = 0;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.unroll_speculative = 1;
|
|
|
|
copts.unroll_instr_limit = 70;
|
|
|
|
copts.unroll_factor_limit = 10;
|
|
|
|
copts.opt_bcc_lr_ctr = 1;
|
2023-01-10 11:05:21 +00:00
|
|
|
copts.use_lmw_stmw = 1;
|
|
|
|
if (copts.optimizationlevel > 2)
|
|
|
|
copts.optimizewithasm = 1;
|
|
|
|
else
|
|
|
|
copts.optimizewithasm = 0;
|
2023-01-15 12:14:05 +00:00
|
|
|
copts.strengthreductionstrict = 1;
|
2022-11-20 05:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Test_Version_Numbers(void) {
|
2023-01-10 11:05:21 +00:00
|
|
|
// empty!
|
2022-11-20 05:07:22 +00:00
|
|
|
}
|