diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-08-30 14:47:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-30 14:47:43 -0700 |
| commit | e4e91a1314abd78a0f06df718459e42e3c9fb62a (patch) | |
| tree | 0ea10dc19eb14e62fefc329e1ead6110e7c0d5bd /src/zig_llvm.cpp | |
| parent | 5d08b7f0548c61b918504a7b02573127c49c6f97 (diff) | |
| parent | a2e691d589ac1d234ee624fdf8fa931d89a719b1 (diff) | |
| download | zig-e4e91a1314abd78a0f06df718459e42e3c9fb62a.tar.gz zig-e4e91a1314abd78a0f06df718459e42e3c9fb62a.zip | |
Merge pull request #21224 from alexrp/mips-gnu-fixes
Fix MIPS PIC level and work around an LLVM bug for `mips(el)-linux-gnueabi(hf)`
Diffstat (limited to 'src/zig_llvm.cpp')
| -rw-r--r-- | src/zig_llvm.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index c798b99b75..aeaf2d29cc 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -81,7 +81,7 @@ static const bool assertions_on = false; LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, - LLVMCodeModel CodeModel, bool function_sections, bool data_sections, ZigLLVMABIType float_abi, + LLVMCodeModel CodeModel, bool function_sections, bool data_sections, ZigLLVMABIType float_abi, const char *abi_name) { std::optional<Reloc::Model> RM; @@ -258,7 +258,6 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi options->bin_filename? options->bin_filename : options->asm_filename); TargetMachine &target_machine = *reinterpret_cast<TargetMachine*>(targ_machine_ref); - target_machine.setO0WantsFastISel(true); Module &llvm_module = *unwrap(module_ref); @@ -369,6 +368,12 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi } } + if (options.allow_fast_isel) { + target_machine.setO0WantsFastISel(true); + } else { + target_machine.setFastISel(false); + } + // Optimization phase module_pm.run(llvm_module, module_am); @@ -430,12 +435,12 @@ void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv) { cl::ParseCommandLineOptions(argc, argv); } -void ZigLLVMSetModulePICLevel(LLVMModuleRef module) { - unwrap(module)->setPICLevel(PICLevel::Level::BigPIC); +void ZigLLVMSetModulePICLevel(LLVMModuleRef module, bool big) { + unwrap(module)->setPICLevel(big ? PICLevel::Level::BigPIC : PICLevel::Level::SmallPIC); } -void ZigLLVMSetModulePIELevel(LLVMModuleRef module) { - unwrap(module)->setPIELevel(PIELevel::Level::Large); +void ZigLLVMSetModulePIELevel(LLVMModuleRef module, bool large) { + unwrap(module)->setPIELevel(large ? PIELevel::Level::Large : PIELevel::Level::Small); } void ZigLLVMSetModuleCodeModel(LLVMModuleRef module, LLVMCodeModel code_model) { |
