Files
c3c/test/test_suite/functions/test_regression_mingw.c3t
2023-07-04 01:12:39 +02:00

656 lines
21 KiB
C

// #target: mingw-x64
module test;
import test2;
import std::collections::list;
import std::collections::linkedlist;
import hello_world;
extern fn int printf(char *, ...);
fn void helloWorld()
{
printf("helloWorld!\n");
}
fn int test_static()
{
static int x = 1;
x++;
printf("Test static %d\n", x);
return x;
}
struct Bobo { short b; float c; short d; short e; float f; short g; }
struct Blob { int z; int f; }
union Foor
{
long a;
char[12] b;
}
fn int helo(double d, Bobo b)
{
int[3] de = { 1, 2, 3 };
Bobo c = b;
helo(1.0, c);
return 1;
}
fn int test1(int a, int b)
{
a = a >> b;
if (b > 128) return -1;
return a;
}
struct Foo2
{
int x;
}
fn void Foo2.printme(Foo2 *foo)
{
printf("Foo is: %d\n", foo.x);
}
fn int Foo2.mutate(Foo2 *foo)
{
printf("Mutating");
return ++foo.x;
}
def oopsInt = test2::argh<int>;
def oopsDouble = test2::argh<int>;
def Argh = fn int(double, Bobo);
def Argh2 = fn int(double, Bobo);
fn int sum_us(int... x)
{
int sum = 0;
if (x.len == 0) return 0;
sum += x[0] + sum_us(...x[1..^1]);
return sum;
}
def Frob = long;
fn int sumd(int[] x)
{
int sum = 0;
for (int i = 0; i < x.len; i++) sum += x[i];
return sum;
}
struct Foo
{
int a;
int b;
}
def getValueInt = test2::getValue<int>;
def getValueDouble = test2::getValue<double>;
def IntBlob = test2::Blob<int>;
def DoubleBlob = Blob<double>;
def getMultInt = test2::getMult<int>;
def getMultDouble = test2::getMult<double>;
def IntArray = List<int>;
def IntList = LinkedList<int>;
enum MyEnum : int
{
HELO,
WORLD,
BYE
}
fn void main()
{
test_static();
test_static();
test_static();
hello_world::hello();
IntList list;
list.push(10);
list.push(15);
list.push(30);
for (int i = 0; i < (int)(list.len()); i++)
{
printf("Element[%d]: %d\n", i, list.get(i));
}
list.free();
printf("Elements: %d\n", (int)(MyEnum.elements));
int elements = MyEnum.elements;
printf("Hello\n");
IntArray array;
array.append(100);
array.append(200);
array.append(400);
array.push(600);
array.insert_at(2, 300);
for (int i = 0; i < (int)(array.len()); i++)
{
printf("Element[%d]: %d\n", i, array.get(i));
}
array.free();
IntBlob a = { 42 };
DoubleBlob b = { 33.3 };
printf("a was %d\n", getValueInt(a));
printf("b was %f\n", getValueDouble(b));
printf("Mult int was %d\n", getMultInt(25));
printf("Mult double was %f\n", getMultDouble(3.3));
helloWorld();
Foo ddx;
int fro = 3;
int[4] x = { 1, 2, 3, 3 };
fro += printf("1Vararg4splatA: %d\n", sum_us(...x));
printf("%d\n", fro);
int[] z = &x;
int[3] de = { 1, 2, 3 };
printf("Vararg4splatB: %d\n", sum_us(...&x));
printf("Vararg4splatC: %d\n", sum_us(...z));
printf("Vararg4: %d\n", sum_us(1, 2, 4, 5));
printf("Vararg1: %d\n", sum_us(1));
printf("Vararg0: %d\n", sum_us());
Argh a1;
Argh2 b2;
}
module hello_world;
import foo;
extern fn int printf(char *, ...);
def doubleMult = foo::check<double>;
fn void hello()
{
printf("Hello baby\n");
printf("Mult %f\n", doubleMult(11.1));
}
module foo <Type>;
fn Type check(Type i)
{
return i * i;
}
module test2 <Type>;
struct Blob
{
Type a;
}
fn Type getMult(Type a)
{
return a * a;
}
Type argh = 234;
fault MyErr
{
X,
Y
}
enum Hello : int
{
FOO,
BAR,
}
macro Hello wut()
{
return Hello.FOO;
}
def Bye = Hello;
def wat = wut;
def byebye = hello;
fn int hello()
{
return 1;
}
fn Type getValue(Blob blob)
{
return blob.a;
}
/* #expect: test.ll
%Blob = type { i32 }
%Blob.0 = type { double }
%Foo2 = type { i32 }
%Bobo = type { i16, float, i16, i16, float, i16 }
%"int[]" = type { ptr, i64 }
%LinkedList = type { ptr, i64, ptr, ptr }
%List = type { i64, i64, ptr, ptr }
%Foo = type { i32, i32 }
$"$ct.test.Bobo" = comdat any
$"$ct.test.Blob" = comdat any
$"$ct.test.Foor" = comdat any
$"$ct.test.Foo2" = comdat any
$"$ct.test.Foo" = comdat any
$"$ct.int" = comdat any
$"$ct.test.MyEnum" = comdat any
@"$ct.test.Bobo" = linkonce global %.introspect { i8 10, ptr null, i64 20, i64 0, i64 6, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.test.Blob" = linkonce global %.introspect { i8 10, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.test.Foor" = linkonce global %.introspect { i8 11, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.test.Foo2" = linkonce global %.introspect { i8 10, ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.test.Foo" = linkonce global %.introspect { i8 10, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.int" = linkonce global %.introspect { i8 2, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, comdat, align 8
@"$ct.test.MyEnum" = linkonce global { i8, ptr, i64, i64, i64, [3 x %"char[]"] } { i8 8, ptr null, i64 4, i64 ptrtoint (ptr @"$ct.int" to i64), i64 3, [3 x %"char[]"] [%"char[]" { ptr @.enum.0, i64 4 }, %"char[]" { ptr @.enum.1, i64 5 }, %"char[]" { ptr @.enum.2, i64 3 }] }, comdat, align 8
@.str = private unnamed_addr constant [13 x i8] c"helloWorld!\0A\00", align 1
@test_static.x = internal unnamed_addr global i32 1, align 4
@.str.1 = private unnamed_addr constant [16 x i8] c"Test static %d\0A\00", align 1
@.__const = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4
@.str.2 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"Elements: %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
@.str.5 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1
@.__const.6 = private unnamed_addr constant %Blob { i32 42 }, align 4
@.__const.7 = private unnamed_addr constant %Blob.0 { double 3.330000e+01 }, align 8
@.str.8 = private unnamed_addr constant [10 x i8] c"a was %d\0A\00", align 1
@.str.9 = private unnamed_addr constant [10 x i8] c"b was %f\0A\00", align 1
@.str.10 = private unnamed_addr constant [17 x i8] c"Mult int was %d\0A\00", align 1
@.str.11 = private unnamed_addr constant [20 x i8] c"Mult double was %f\0A\00", align 1
@.__const.12 = private unnamed_addr constant [4 x i32] [i32 1, i32 2, i32 3, i32 3], align 16
@.str.13 = private unnamed_addr constant [20 x i8] c"1Vararg4splatA: %d\0A\00", align 1
@.str.14 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.__const.15 = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4
@.str.16 = private unnamed_addr constant [19 x i8] c"Vararg4splatB: %d\0A\00", align 1
@.str.17 = private unnamed_addr constant [19 x i8] c"Vararg4splatC: %d\0A\00", align 1
@.str.18 = private unnamed_addr constant [13 x i8] c"Vararg4: %d\0A\00", align 1
@.str.19 = private unnamed_addr constant [13 x i8] c"Vararg1: %d\0A\00", align 1
@.str.20 = private unnamed_addr constant [13 x i8] c"Vararg0: %d\0A\00", align 1
@.str.21 = private unnamed_addr constant [12 x i8] c"Foo is: %d\0A\00", align 1
@.str.22 = private unnamed_addr constant [9 x i8] c"Mutating\00", align 1
; Function Attrs: nounwind
define void @test.Foo2.printme(ptr %0) #0 {
entry:
%1 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0
%2 = load i32, ptr %1, align 4
%3 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %2)
ret void
}
; Function Attrs: nounwind
define i32 @test.Foo2.mutate(ptr %0) #0 {
entry:
%1 = call i32 (ptr, ...) @printf(ptr @.str.22)
%2 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0
%3 = load i32, ptr %2, align 4
%add = add i32 %3, 1
store i32 %add, ptr %2, align 4
ret i32 %add
}
; Function Attrs: nounwind
declare i32 @printf(ptr, ...) #0
; Function Attrs: nounwind
define void @test.helloWorld() #0 {
entry:
%0 = call i32 (ptr, ...) @printf(ptr @.str)
ret void
}
; Function Attrs: nounwind
define i32 @test.test_static() #0 {
entry:
%0 = load i32, ptr @test_static.x, align 4
%add = add i32 %0, 1
store i32 %add, ptr @test_static.x, align 4
%1 = load i32, ptr @test_static.x, align 4
%2 = call i32 (ptr, ...) @printf(ptr @.str.1, i32 %1)
%3 = load i32, ptr @test_static.x, align 4
ret i32 %3
}
; Function Attrs: nounwind
define i32 @test.helo(double %0, ptr align 4 %1) #0 {
entry:
%de = alloca [3 x i32], align 4
%c = alloca %Bobo, align 4
%indirectarg = alloca %Bobo, align 4
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const, i32 12, i1 false)
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %c, ptr align 4 %1, i32 20, i1 false)
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %indirectarg, ptr align 4 %c, i32 20, i1 false)
%2 = call i32 @test.helo(double 1.000000e+00, ptr align 4 %indirectarg)
ret i32 1
}
; Function Attrs: nounwind
define i32 @test.test1(i32 %0, i32 %1) #0 {
entry:
%a = alloca i32, align 4
store i32 %0, ptr %a, align 4
%2 = load i32, ptr %a, align 4
%ashr = ashr i32 %2, %1
%3 = freeze i32 %ashr
store i32 %3, ptr %a, align 4
%gt = icmp sgt i32 %1, 128
br i1 %gt, label %if.then, label %if.exit
if.then: ; preds = %entry
ret i32 -1
if.exit: ; preds = %entry
%4 = load i32, ptr %a, align 4
ret i32 %4
}
; Function Attrs: nounwind
define i32 @test.sum_us(ptr align 8 %0) #0 {
entry:
%sum = alloca i32, align 4
%indirectarg = alloca %"int[]", align 8
store i32 0, ptr %sum, align 4
%1 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 1
%2 = load i64, ptr %1, align 8
%eq = icmp eq i64 0, %2
br i1 %eq, label %if.then, label %if.exit
if.then: ; preds = %entry
ret i32 0
if.exit: ; preds = %entry
%3 = load i32, ptr %sum, align 4
%4 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 0
%5 = load ptr, ptr %4, align 8
%ptroffset = getelementptr inbounds i32, ptr %5, i64 0
%6 = load i32, ptr %ptroffset, align 4
%7 = load %"int[]", ptr %0, align 8
%8 = extractvalue %"int[]" %7, 0
%9 = extractvalue %"int[]" %7, 1
%sub = sub i64 %9, 1
%10 = add i64 %sub, 1
%size = sub i64 %10, 1
%ptroffset1 = getelementptr inbounds i32, ptr %8, i64 1
%11 = insertvalue %"int[]" undef, ptr %ptroffset1, 0
%12 = insertvalue %"int[]" %11, i64 %size, 1
store %"int[]" %12, ptr %indirectarg, align 8
%13 = call i32 @test.sum_us(ptr align 8 %indirectarg)
%add = add i32 %6, %13
%add2 = add i32 %3, %add
store i32 %add2, ptr %sum, align 4
%14 = load i32, ptr %sum, align 4
ret i32 %14
}
; Function Attrs: nounwind
define i32 @test.sumd(ptr align 8 %0) #0 {
entry:
%sum = alloca i32, align 4
%i = alloca i32, align 4
store i32 0, ptr %sum, align 4
store i32 0, ptr %i, align 4
br label %loop.cond
loop.cond: ; preds = %loop.body, %entry
%1 = load i32, ptr %i, align 4
%sext = sext i32 %1 to i64
%2 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 1
%3 = load i64, ptr %2, align 8
%lt = icmp slt i64 %sext, %3
%check = icmp slt i64 %3, 0
%siui-lt = or i1 %check, %lt
br i1 %siui-lt, label %loop.body, label %loop.exit
loop.body: ; preds = %loop.cond
%4 = load i32, ptr %sum, align 4
%5 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 0
%6 = load ptr, ptr %5, align 8
%7 = load i32, ptr %i, align 4
%sext1 = sext i32 %7 to i64
%ptroffset = getelementptr inbounds i32, ptr %6, i64 %sext1
%8 = load i32, ptr %ptroffset, align 4
%add = add i32 %4, %8
store i32 %add, ptr %sum, align 4
%9 = load i32, ptr %i, align 4
%add2 = add i32 %9, 1
store i32 %add2, ptr %i, align 4
br label %loop.cond
loop.exit: ; preds = %loop.cond
%10 = load i32, ptr %sum, align 4
ret i32 %10
}
; Function Attrs: nounwind
define void @test.main() #0 {
entry:
%list = alloca %LinkedList, align 8
%i = alloca i32, align 4
%elements = alloca i32, align 4
%array = alloca %List, align 8
%i1 = alloca i32, align 4
%a = alloca %Blob, align 4
%b = alloca %Blob.0, align 8
%ddx = alloca %Foo, align 4
%fro = alloca i32, align 4
%x = alloca [4 x i32], align 16
%indirectarg = alloca %"int[]", align 8
%z = alloca %"int[]", align 8
%de = alloca [3 x i32], align 4
%indirectarg10 = alloca %"int[]", align 8
%indirectarg11 = alloca %"int[]", align 8
%varargslots = alloca [4 x i32], align 16
%indirectarg12 = alloca %"int[]", align 8
%varargslots13 = alloca [1 x i32], align 4
%indirectarg14 = alloca %"int[]", align 8
%indirectarg15 = alloca %"int[]", align 8
%a1 = alloca ptr, align 8
%b2 = alloca ptr, align 8
%0 = call i32 @test.test_static()
%1 = call i32 @test.test_static()
%2 = call i32 @test.test_static()
call void @hello_world.hello()
call void @llvm.memset.p0.i64(ptr align 8 %list, i8 0, i64 32, i1 false)
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 10)
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 15)
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 30)
store i32 0, ptr %i, align 4
br label %loop.cond
loop.cond: ; preds = %loop.body, %entry
%3 = load i32, ptr %i, align 4
%4 = call i64 @"std.collections.linkedlist$int$.LinkedList.len"(ptr %list) #3
%trunc = trunc i64 %4 to i32
%lt = icmp slt i32 %3, %trunc
br i1 %lt, label %loop.body, label %loop.exit
loop.body: ; preds = %loop.cond
%5 = load i32, ptr %i, align 4
%6 = load i32, ptr %i, align 4
%sext = sext i32 %6 to i64
%7 = call i32 @"std.collections.linkedlist$int$.LinkedList.get"(ptr %list, i64 %sext)
%8 = call i32 (ptr, ...) @printf(ptr @.str.2, i32 %5, i32 %7)
%9 = load i32, ptr %i, align 4
%add = add i32 %9, 1
store i32 %add, ptr %i, align 4
br label %loop.cond
loop.exit: ; preds = %loop.cond
call void @"std.collections.linkedlist$int$.LinkedList.free"(ptr %list)
%10 = call i32 (ptr, ...) @printf(ptr @.str.3, i32 3)
store i32 3, ptr %elements, align 4
%11 = call i32 (ptr, ...) @printf(ptr @.str.4)
call void @llvm.memset.p0.i64(ptr align 8 %array, i8 0, i64 32, i1 false)
call void @"std.collections.list$int$.List.append"(ptr %array, i32 100)
call void @"std.collections.list$int$.List.append"(ptr %array, i32 200)
call void @"std.collections.list$int$.List.append"(ptr %array, i32 400)
call void @"std.collections.list$int$.List.push"(ptr %array, i32 600) #3
call void @"std.collections.list$int$.List.insert_at"(ptr %array, i64 2, i32 300)
store i32 0, ptr %i1, align 4
br label %loop.cond2
loop.cond2: ; preds = %loop.body5, %loop.exit
%12 = load i32, ptr %i1, align 4
%13 = call i64 @"std.collections.list$int$.List.len"(ptr %array)
%trunc3 = trunc i64 %13 to i32
%lt4 = icmp slt i32 %12, %trunc3
br i1 %lt4, label %loop.body5, label %loop.exit8
loop.body5: ; preds = %loop.cond2
%14 = load i32, ptr %i1, align 4
%15 = load i32, ptr %i1, align 4
%sext6 = sext i32 %15 to i64
%16 = call i32 @"std.collections.list$int$.List.get"(ptr %array, i64 %sext6)
%17 = call i32 (ptr, ...) @printf(ptr @.str.5, i32 %14, i32 %16)
%18 = load i32, ptr %i1, align 4
%add7 = add i32 %18, 1
store i32 %add7, ptr %i1, align 4
br label %loop.cond2
loop.exit8: ; preds = %loop.cond2
call void @"std.collections.list$int$.List.free"(ptr %array)
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a, ptr align 4 @.__const.6, i32 4, i1 false)
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %b, ptr align 8 @.__const.7, i32 8, i1 false)
%19 = load i32, ptr %a, align 4
%20 = call i32 @"test2$int$.getValue"(i32 %19)
%21 = call i32 (ptr, ...) @printf(ptr @.str.8, i32 %20)
%22 = load i64, ptr %b, align 8
%23 = call double @"test2$double$.getValue"(i64 %22)
%24 = call i32 (ptr, ...) @printf(ptr @.str.9, double %23)
%25 = call i32 @"test2$int$.getMult"(i32 25)
%26 = call i32 (ptr, ...) @printf(ptr @.str.10, i32 %25)
%27 = call double @"test2$double$.getMult"(double 3.300000e+00)
%28 = call i32 (ptr, ...) @printf(ptr @.str.11, double %27)
call void @test.helloWorld()
%29 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 0
store i32 0, ptr %29, align 4
%30 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 1
store i32 0, ptr %30, align 4
store i32 3, ptr %fro, align 4
call void @llvm.memcpy.p0.p0.i32(ptr align 16 %x, ptr align 16 @.__const.12, i32 16, i1 false)
%31 = load i32, ptr %fro, align 4
%32 = insertvalue %"int[]" undef, ptr %x, 0
%33 = insertvalue %"int[]" %32, i64 4, 1
store %"int[]" %33, ptr %indirectarg, align 8
%34 = call i32 @test.sum_us(ptr align 8 %indirectarg)
%35 = call i32 (ptr, ...) @printf(ptr @.str.13, i32 %34)
%add9 = add i32 %31, %35
store i32 %add9, ptr %fro, align 4
%36 = load i32, ptr %fro, align 4
%37 = call i32 (ptr, ...) @printf(ptr @.str.14, i32 %36)
%38 = insertvalue %"int[]" undef, ptr %x, 0
%39 = insertvalue %"int[]" %38, i64 4, 1
store %"int[]" %39, ptr %z, align 8
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const.15, i32 12, i1 false)
%40 = insertvalue %"int[]" undef, ptr %x, 0
%41 = insertvalue %"int[]" %40, i64 4, 1
store %"int[]" %41, ptr %indirectarg10, align 8
%42 = call i32 @test.sum_us(ptr align 8 %indirectarg10)
%43 = call i32 (ptr, ...) @printf(ptr @.str.16, i32 %42)
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg11, ptr align 8 %z, i32 16, i1 false)
%44 = call i32 @test.sum_us(ptr align 8 %indirectarg11)
%45 = call i32 (ptr, ...) @printf(ptr @.str.17, i32 %44)
%46 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 0
store i32 1, ptr %46, align 4
%47 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 1
store i32 2, ptr %47, align 4
%48 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 2
store i32 4, ptr %48, align 4
%49 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 3
store i32 5, ptr %49, align 4
%50 = insertvalue %"int[]" undef, ptr %varargslots, 0
%51 = insertvalue %"int[]" %50, i64 4, 1
store %"int[]" %51, ptr %indirectarg12, align 8
%52 = call i32 @test.sum_us(ptr align 8 %indirectarg12)
%53 = call i32 (ptr, ...) @printf(ptr @.str.18, i32 %52)
%54 = getelementptr inbounds [1 x i32], ptr %varargslots13, i64 0, i64 0
store i32 1, ptr %54, align 4
%55 = insertvalue %"int[]" undef, ptr %varargslots13, 0
%56 = insertvalue %"int[]" %55, i64 1, 1
store %"int[]" %56, ptr %indirectarg14, align 8
%57 = call i32 @test.sum_us(ptr align 8 %indirectarg14)
%58 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %57)
store %"int[]" zeroinitializer, ptr %indirectarg15, align 8
%59 = call i32 @test.sum_us(ptr align 8 %indirectarg15)
%60 = call i32 (ptr, ...) @printf(ptr @.str.20, i32 %59)
store ptr null, ptr %a1, align 8
store ptr null, ptr %b2, align 8
ret void
}
declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1
declare void @hello_world.hello() #0
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
declare void @"std.collections.linkedlist$int$.LinkedList.push"(ptr, i32) #0
declare i64 @"std.collections.linkedlist$int$.LinkedList.len"(ptr) #0
declare i32 @"std.collections.linkedlist$int$.LinkedList.get"(ptr, i64) #0
declare void @"std.collections.linkedlist$int$.LinkedList.free"(ptr) #0
declare void @"std.collections.list$int$.List.append"(ptr, i32) #0
declare void @"std.collections.list$int$.List.push"(ptr, i32) #0
declare void @"std.collections.list$int$.List.insert_at"(ptr, i64, i32) #0
declare i64 @"std.collections.list$int$.List.len"(ptr) #0
declare i32 @"std.collections.list$int$.List.get"(ptr, i64) #0
declare void @"std.collections.list$int$.List.free"(ptr) #0
declare i32 @"test2$int$.getValue"(i32) #0
declare double @"test2$double$.getValue"(i64) #0
declare i32 @"test2$int$.getMult"(i32) #0
declare double @"test2$double$.getMult"(double) #0
// #expect: hello_world.ll
define void @hello_world.hello() #0 {
entry:
%0 = call i32 (ptr, ...) @printf(ptr @.str)
%1 = call double @"foo$double$.check"(double 1.110000e+01)
%2 = call i32 (ptr, ...) @printf(ptr @.str.1, double %1)
ret void
}
// #expect: foo.double.ll
define double @"foo$double$.check"(double %0)
entry:
%fmul = fmul double %0, %0
ret double %fmul
// #expect: test2.int.ll
%Blob = type { i32 }
@"test2$int$.argh" = local_unnamed_addr global i32 234, align 4
define i32 @"test2$int$.getMult"(i32 %0)
entry:
%mul = mul i32 %0, %0
ret i32 %mul
define i32 @"test2$int$.hello"()
entry:
ret i32 1
}
define i32 @"test2$int$.getValue"(i32 %0)
entry:
%blob = alloca %Blob, align 4
store i32 %0, ptr %blob, align 4
%1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0
%2 = load i32, ptr %1, align 4
ret i32 %2
// #expect: test2.double.ll
%Blob = type { double }
@"test2$double$.argh" = local_unnamed_addr global double 2.340000e+02, align 8
define double @"test2$double$.getMult"(double %0)
entry:
%fmul = fmul double %0, %0
ret double %fmul
define i32 @"test2$double$.hello"()
entry:
ret i32 1
define double @"test2$double$.getValue"(i64 %0)
entry:
%blob = alloca %Blob, align 8
store i64 %0, ptr %blob, align 8
%1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0
%2 = load double, ptr %1, align 8
ret double %2