#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.code_alignment = 16; copts.misaligned_mem_access = 1; copts.switch_tables = 1; copts.prepare_compress = 0; copts.some_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_mode = 2; copts.altivec_model = pb.altivec; copts.readonly_strings = pb.readonlystrings; if (pb.schedule) copts.schedule_mode = 2; else copts.schedule_mode = 0; switch (pb.processor) { case 1: copts.cpu = CPU_PPC601; copts.schedule_cpu = 1; break; case 2: copts.cpu = CPU_PPC603; copts.schedule_cpu = 2; break; case 3: copts.cpu = CPU_PPC603e; copts.schedule_cpu = 5; break; case 4: copts.cpu = CPU_PPC604; copts.schedule_cpu = 3; break; case 5: copts.cpu = CPU_PPC604e; copts.schedule_cpu = 6; break; case 6: copts.cpu = CPU_PPC750; copts.schedule_cpu = 4; break; case 7: copts.cpu = CPU_PPC7400; copts.schedule_cpu = 7; break; case 8: copts.cpu = CPU_PPC7450; copts.schedule_cpu = 10; break; default: copts.cpu = CPU_Generic; copts.schedule_cpu = 8; break; } copts.peephole = pb.peephole; copts.align_mode = pb.structalignment; copts.profile = pb.profiler; copts.fp_contract = pb.fpcontract; copts.traceback = pb.tracebacktables > 0; copts.x1D = pb.tracebacktables == 2; copts.x1E = 0; if (pb.processorspecific && copts.cpu >= CPU_PPC603) copts.gen_fsel = 10; else copts.gen_fsel = 0; if (pb.vrsave) copts.altivec_vrsave = 1; else copts.altivec_vrsave = 0; copts.ppc_unroll_speculative = 1; copts.ppc_unroll_instructions_limit = 70; copts.ppc_unroll_factor_limit = 10; copts.ppc_opt_bclr_bcctr = 1; copts.use_lmw_stmw = 1; if (copts.optimizationlevel > 2) copts.optimizewithasm = 1; else copts.optimizewithasm = 0; copts.opt_strength_reduction_strict = 1; } void Test_Version_Numbers(void) { // empty! }