aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-29 15:33:45 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-29 15:33:45 -0700
commitbdbedff910e18e18dc31db84a80607435e9b6ee0 (patch)
treed0081d6089f09f797662b6f22d05a73895e5aacd /src/codegen/llvm
parentea6706b6f406606a7523e35e34e390fb880b607e (diff)
downloadzig-bdbedff910e18e18dc31db84a80607435e9b6ee0.tar.gz
zig-bdbedff910e18e18dc31db84a80607435e9b6ee0.zip
stage2: LLVM backend: properly set module target data
Also fix tripping LLVM assert having to do with 0 bit integers. stage2 behavior tests now run clean in a debug build of llvm 12.
Diffstat (limited to 'src/codegen/llvm')
-rw-r--r--src/codegen/llvm/bindings.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig
index 8ded801165..69845c0899 100644
--- a/src/codegen/llvm/bindings.zig
+++ b/src/codegen/llvm/bindings.zig
@@ -219,6 +219,9 @@ pub const Module = opaque {
pub const verify = LLVMVerifyModule;
extern fn LLVMVerifyModule(*const Module, Action: VerifierFailureAction, OutMessage: *[*:0]const u8) Bool;
+ pub const setModuleDataLayout = LLVMSetModuleDataLayout;
+ extern fn LLVMSetModuleDataLayout(*const Module, *const TargetData) void;
+
pub const addFunction = LLVMAddFunction;
extern fn LLVMAddFunction(*const Module, Name: [*:0]const u8, FunctionTy: *const Type) *const Value;
@@ -766,6 +769,14 @@ pub const TargetMachine = opaque {
llvm_ir_filename: ?[*:0]const u8,
bitcode_filename: ?[*:0]const u8,
) bool;
+
+ pub const createTargetDataLayout = LLVMCreateTargetDataLayout;
+ extern fn LLVMCreateTargetDataLayout(*const TargetMachine) *const TargetData;
+};
+
+pub const TargetData = opaque {
+ pub const dispose = LLVMDisposeTargetData;
+ extern fn LLVMDisposeTargetData(*const TargetData) void;
};
pub const CodeModel = enum(c_int) {