| author | |
| committer | |
| log | e585103306f5b69a62c71e8462dc78a8ef2da9f9 |
| tree | 5597579d7f92cab3a2340554f8891c2bcd32035b |
| parent | 7d9edff11d4c0dd6793bfd4bb2d7e3c2d32c88cd |
| signature |
Until llvm/llvm-project#106231 trickles down.4 files changed, 10 insertions(+), 1 deletions(-)
src/codegen/llvm.zig+2| ... | @@ -1280,6 +1280,8 @@ pub const Object = struct { | ... | @@ -1280,6 +1280,8 @@ pub const Object = struct { |
| 1280 | .tsan = options.sanitize_thread, | 1280 | .tsan = options.sanitize_thread, |
| 1281 | .sancov = options.fuzz, | 1281 | .sancov = options.fuzz, |
| 1282 | .lto = options.lto, | 1282 | .lto = options.lto, |
| 1283 | // https://github.com/ziglang/zig/issues/21215 | ||
| 1284 | .allow_fast_isel = !comp.root_mod.resolved_target.result.cpu.arch.isMIPS(), | ||
| 1283 | .asm_filename = null, | 1285 | .asm_filename = null, |
| 1284 | .bin_filename = options.bin_path, | 1286 | .bin_filename = options.bin_path, |
| 1285 | .llvm_ir_filename = options.post_ir_path, | 1287 | .llvm_ir_filename = options.post_ir_path, |
src/codegen/llvm/bindings.zig+1| ... | @@ -91,6 +91,7 @@ pub const TargetMachine = opaque { | ... | @@ -91,6 +91,7 @@ pub const TargetMachine = opaque { |
| 91 | tsan: bool, | 91 | tsan: bool, |
| 92 | sancov: bool, | 92 | sancov: bool, |
| 93 | lto: bool, | 93 | lto: bool, |
| 94 | allow_fast_isel: bool, | ||
| 94 | asm_filename: ?[*:0]const u8, | 95 | asm_filename: ?[*:0]const u8, |
| 95 | bin_filename: ?[*:0]const u8, | 96 | bin_filename: ?[*:0]const u8, |
| 96 | llvm_ir_filename: ?[*:0]const u8, | 97 | llvm_ir_filename: ?[*:0]const u8, |
src/zig_llvm.cpp+6-1| ... | @@ -258,7 +258,6 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi | ... | @@ -258,7 +258,6 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi |
| 258 | options.bin_filename? options.bin_filename : options.asm_filename); | 258 | options.bin_filename? options.bin_filename : options.asm_filename); |
| 259 | 259 | ||
| 260 | TargetMachine &target_machine = *reinterpret_cast<TargetMachine*>(targ_machine_ref); | 260 | TargetMachine &target_machine = *reinterpret_cast<TargetMachine*>(targ_machine_ref); |
| 261 | target_machine.setO0WantsFastISel(true); | ||
| 262 | 261 | ||
| 263 | Module &llvm_module = *unwrap(module_ref); | 262 | Module &llvm_module = *unwrap(module_ref); |
| 264 | 263 | ||
| ... | @@ -369,6 +368,12 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi | ... | @@ -369,6 +368,12 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi |
| 369 | } | 368 | } |
| 370 | } | 369 | } |
| 371 | 370 | ||
| 371 | if (options.allow_fast_isel) { | ||
| 372 | target_machine.setO0WantsFastISel(true); | ||
| 373 | } else { | ||
| 374 | target_machine.setFastISel(false); | ||
| 375 | } | ||
| 376 | |||
| 372 | // Optimization phase | 377 | // Optimization phase |
| 373 | module_pm.run(llvm_module, module_am); | 378 | module_pm.run(llvm_module, module_am); |
| 374 | 379 |
src/zig_llvm.h+1| ... | @@ -59,6 +59,7 @@ struct ZigLLVMEmitOptions { | ... | @@ -59,6 +59,7 @@ struct ZigLLVMEmitOptions { |
| 59 | bool tsan; | 59 | bool tsan; |
| 60 | bool sancov; | 60 | bool sancov; |
| 61 | bool lto; | 61 | bool lto; |
| 62 | bool allow_fast_isel; | ||
| 62 | const char *asm_filename; | 63 | const char *asm_filename; |
| 63 | const char *bin_filename; | 64 | const char *bin_filename; |
| 64 | const char *llvm_ir_filename; | 65 | const char *llvm_ir_filename; |