add a debug subcommand for printing LLVM integer type alignment
Useful when debugging why upgrading from LLVM 17 to 18 caused C ABI regressions. Turns out LLVM 18 does the following insane thing: ```diff -[nix-shell:~/dev/zig/build-llvm17]$ stage4/bin/zig llvm-ints i386-linux-musl +[nix-shell:~/src/zig/build-llvm18]$ stage4/bin/zig llvm-ints i386-linux-musl LLVMABIAlignmentOfType(i1) == 1 LLVMABIAlignmentOfType(i8) == 1 LLVMABIAlignmentOfType(i16) == 2 LLVMABIAlignmentOfType(i32) == 4 LLVMABIAlignmentOfType(i64) == 4 -LLVMABIAlignmentOfType(i128) == 4 -LLVMABIAlignmentOfType(i256) == 4 +LLVMABIAlignmentOfType(i128) == 16 +LLVMABIAlignmentOfType(i256) == 16 ```
This commit is contained in:
@@ -43,6 +43,9 @@ pub const Context = opaque {
|
||||
|
||||
pub const getBrokenDebugInfo = ZigLLVMGetBrokenDebugInfo;
|
||||
extern fn ZigLLVMGetBrokenDebugInfo(C: *Context) bool;
|
||||
|
||||
pub const intType = LLVMIntTypeInContext;
|
||||
extern fn LLVMIntTypeInContext(C: *Context, NumBits: c_uint) *Type;
|
||||
};
|
||||
|
||||
pub const Module = opaque {
|
||||
@@ -96,13 +99,21 @@ pub const TargetMachine = opaque {
|
||||
llvm_ir_filename: ?[*:0]const u8,
|
||||
bitcode_filename: ?[*:0]const u8,
|
||||
) bool;
|
||||
|
||||
pub const createTargetDataLayout = LLVMCreateTargetDataLayout;
|
||||
extern fn LLVMCreateTargetDataLayout(*TargetMachine) *TargetData;
|
||||
};
|
||||
|
||||
pub const TargetData = opaque {
|
||||
pub const dispose = LLVMDisposeTargetData;
|
||||
extern fn LLVMDisposeTargetData(*TargetData) void;
|
||||
|
||||
pub const abiAlignmentOfType = LLVMABIAlignmentOfType;
|
||||
extern fn LLVMABIAlignmentOfType(TD: *TargetData, Ty: *Type) c_uint;
|
||||
};
|
||||
|
||||
pub const Type = opaque {};
|
||||
|
||||
pub const CodeModel = enum(c_int) {
|
||||
Default,
|
||||
JITDefault,
|
||||
|
||||
Reference in New Issue
Block a user