Skip to content

Instantly share code, notes, and snippets.

@andrewrk
Created February 26, 2021 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewrk/dc6868ea08409c90c818c46d80eee77a to your computer and use it in GitHub Desktop.
Save andrewrk/dc6868ea08409c90c818c46d80eee77a to your computer and use it in GitHub Desktop.
LLVM 12 sret LLVMDumpModule
; Function Attrs: nobuiltin noredzone nounwind sspstrong
define void @entry() #1 !dbg !2228 {
Entry:
%0 = alloca %Foo, align 4
call fastcc void @doit(%Foo* sret %0), !dbg !2232
ret void, !dbg !2234
}
; Function Attrs: nobuiltin noredzone nounwind sspstrong
define internal fastcc void @doit(%Foo* nonnull sret %0) unnamed_addr #1 !dbg !2235 {
Entry:
%1 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 0, !dbg !2248
store i32 0, i32* %1, align 4, !dbg !2248
%2 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 1, !dbg !2248
store i32 0, i32* %2, align 4, !dbg !2248
%3 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 2, !dbg !2248
store i32 0, i32* %3, align 4, !dbg !2248
%4 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 3, !dbg !2248
store i32 0, i32* %4, align 4, !dbg !2248
%5 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 4, !dbg !2248
store i32 0, i32* %5, align 4, !dbg !2248
%6 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 5, !dbg !2248
store i32 0, i32* %6, align 4, !dbg !2248
%7 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 6, !dbg !2248
store i32 0, i32* %7, align 4, !dbg !2248
ret void, !dbg !2250
}
const Foo = struct {
a: u32 = 0,
b: u32 = 0,
c: u32 = 0,
d: u32 = 0,
e: u32 = 0,
f: u32 = 0,
g: u32 = 0,
};
export fn entry() void {
_ = doit();
}
fn doit() Foo { return .{}; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment