mirror of https://git.wuffs.org/MWCC
121 lines
3.2 KiB
C
121 lines
3.2 KiB
C
#include "compiler/CodeGenOptPPC.h"
|
|
#include "compiler/InstrSelection.h"
|
|
#include "compiler/CCompiler.h"
|
|
#include "pref_structs.h"
|
|
#include "compiler/CParser.h"
|
|
|
|
static short pref_versions;
|
|
|
|
void CodeGen_InitCompiler(void) {
|
|
init_cgdispatch();
|
|
}
|
|
|
|
void CodeGen_TermCompiler(void) {
|
|
// empty!
|
|
}
|
|
|
|
void CodeGen_InitBackEndOptions(void) {
|
|
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);
|
|
|
|
copts.function_align = 16;
|
|
copts.misaligned_mem_access = 1;
|
|
copts.switch_tables = 1;
|
|
copts.prepare_compress = 0;
|
|
copts.min_struct_alignment = 4;
|
|
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;
|
|
copts.schedule_factor = 2;
|
|
copts.altivec_model = pb.altivec;
|
|
copts.readonly_strings = pb.readonlystrings;
|
|
if (pb.schedule)
|
|
copts.schedule_factor = 2;
|
|
else
|
|
copts.schedule_factor = 0;
|
|
|
|
switch (pb.processor) {
|
|
case 1:
|
|
copts.processor = CPU_PPC601;
|
|
copts.scheduling = 1;
|
|
break;
|
|
case 2:
|
|
copts.processor = CPU_PPC603;
|
|
copts.scheduling = 2;
|
|
break;
|
|
case 3:
|
|
copts.processor = CPU_PPC603e;
|
|
copts.scheduling = 5;
|
|
break;
|
|
case 4:
|
|
copts.processor = CPU_PPC604;
|
|
copts.scheduling = 3;
|
|
break;
|
|
case 5:
|
|
copts.processor = CPU_PPC604e;
|
|
copts.scheduling = 6;
|
|
break;
|
|
case 6:
|
|
copts.processor = CPU_PPC750;
|
|
copts.scheduling = 4;
|
|
break;
|
|
case 7:
|
|
copts.processor = CPU_PPC7400;
|
|
copts.scheduling = 7;
|
|
break;
|
|
case 8:
|
|
copts.processor = CPU_PPC7450;
|
|
copts.scheduling = 10;
|
|
break;
|
|
default:
|
|
copts.processor = CPU_Generic;
|
|
copts.scheduling = 8;
|
|
break;
|
|
}
|
|
|
|
copts.peephole = pb.peephole;
|
|
copts.structalignment = pb.structalignment;
|
|
copts.profile = pb.profiler;
|
|
copts.fp_contract = pb.fpcontract;
|
|
copts.traceback = pb.tracebacktables > 0;
|
|
copts.x1D = pb.tracebacktables == 2;
|
|
copts.gen_isel = 0;
|
|
if (pb.processorspecific && copts.processor >= CPU_PPC603)
|
|
copts.gen_fsel = 10;
|
|
else
|
|
copts.gen_fsel = 0;
|
|
if (pb.vrsave)
|
|
copts.altivec_vrsave = 1;
|
|
else
|
|
copts.altivec_vrsave = 0;
|
|
copts.unroll_speculative = 1;
|
|
copts.unroll_instr_limit = 70;
|
|
copts.unroll_factor_limit = 10;
|
|
copts.opt_bcc_lr_ctr = 1;
|
|
copts.use_lmw_stmw = 1;
|
|
if (copts.optimizationlevel > 2)
|
|
copts.optimizewithasm = 1;
|
|
else
|
|
copts.optimizewithasm = 0;
|
|
copts.strengthreductionstrict = 1;
|
|
}
|
|
|
|
void Test_Version_Numbers(void) {
|
|
// empty!
|
|
}
|