aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-08-30 12:18:37 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-08-30 11:02:12 -0700
commit5723fcaac1b473acee2fb3f5ea5486527eac5359 (patch)
tree1f16033f5935491182cce49844b6108ca18b9613 /src/codegen
parentaaca4ff74dab5d749cd292d31957ce19ab5901c7 (diff)
downloadzig-5723fcaac1b473acee2fb3f5ea5486527eac5359.tar.gz
zig-5723fcaac1b473acee2fb3f5ea5486527eac5359.zip
llvm: Pass EmitOptions to libzigcpp by pointer.
Passing it by value means that bringup on new architectures is harder for no real benefit. Passing it by pointer allows to get the compiler running without needing to figure out the C calling convention details first. This manifested in practice on LoongArch, for example.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig4
-rw-r--r--src/codegen/llvm/bindings.zig2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 6bf7476a4e..00ce2ca226 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1325,7 +1325,7 @@ pub const Object = struct {
},
};
if (options.asm_path != null and options.bin_path != null) {
- if (target_machine.emitToFile(module, &error_message, lowered_options)) {
+ if (target_machine.emitToFile(module, &error_message, &lowered_options)) {
defer llvm.disposeMessage(error_message);
log.err("LLVM failed to emit bin={s} ir={s}: {s}", .{
emit_bin_msg, post_llvm_ir_msg, error_message,
@@ -1337,7 +1337,7 @@ pub const Object = struct {
}
lowered_options.asm_filename = options.asm_path;
- if (target_machine.emitToFile(module, &error_message, lowered_options)) {
+ if (target_machine.emitToFile(module, &error_message, &lowered_options)) {
defer llvm.disposeMessage(error_message);
log.err("LLVM failed to emit asm={s} bin={s} ir={s} bc={s}: {s}", .{
emit_asm_msg, emit_bin_msg, post_llvm_ir_msg, post_llvm_bc_msg,
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig
index ebab18f68a..bb294f27d9 100644
--- a/src/codegen/llvm/bindings.zig
+++ b/src/codegen/llvm/bindings.zig
@@ -130,7 +130,7 @@ pub const TargetMachine = opaque {
T: *TargetMachine,
M: *Module,
ErrorMessage: *[*:0]const u8,
- options: EmitOptions,
+ options: *const EmitOptions,
) bool;
pub const createTargetDataLayout = LLVMCreateTargetDataLayout;