mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
31 lines
645 B
C
31 lines
645 B
C
// #target: x64-darwin
|
|
|
|
struct Test
|
|
{
|
|
int x;
|
|
}
|
|
|
|
Test foo = {};
|
|
|
|
extern fn void blorg(Test t);
|
|
|
|
fn Test creator()
|
|
{
|
|
blorg(Test{});
|
|
return Test{};
|
|
}
|
|
|
|
// #expect: literal_load.ll
|
|
|
|
%literal = alloca %Test, align 4
|
|
%literal1 = alloca %Test, align 4
|
|
%0 = bitcast %Test* %literal to i32*
|
|
store i32 0, i32* %0, align 4
|
|
%1 = getelementptr inbounds %Test, %Test* %literal, i32 0, i32 0
|
|
%2 = load i32, i32* %1, align 4
|
|
call void @blorg(i32 %2)
|
|
%3 = bitcast %Test* %literal1 to i32*
|
|
store i32 0, i32* %3, align 4
|
|
%4 = getelementptr inbounds %Test, %Test* %literal1, i32 0, i32 0
|
|
%5 = load i32, i32* %4, align 4
|
|
ret i32 %5 |