mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Symtab has a new hash map type. New, small, sourcespan, external symbols simplified. Updated docs.
This commit is contained in:
committed by
Christoffer Lerno
parent
e45853c0cb
commit
4f4bc80953
@@ -55,154 +55,3 @@ fn void main()
|
||||
test();
|
||||
printf("Hello!\n");
|
||||
}
|
||||
|
||||
// #expect: mymodule.ll
|
||||
|
||||
define void @mymodule.test() #0 {
|
||||
entry:
|
||||
%x = alloca i32, align 4
|
||||
%x.f = alloca i64, align 8
|
||||
%z = alloca i64, align 8
|
||||
%err = alloca i64, align 8
|
||||
%switch = alloca i64, align 8
|
||||
%switch4 = alloca i64, align 8
|
||||
%a = alloca i32, align 4
|
||||
%b = alloca i32, align 4
|
||||
%zy = alloca i32, align 4
|
||||
%switch17 = alloca i32, align 4
|
||||
store i64 ptrtoint ([2 x i8*]* @"mymodule.ByeErr$elements" to i64), i64* %x.f, align 8
|
||||
store i64 5, i64* %z, align 8
|
||||
br label %testblock
|
||||
|
||||
testblock: ; preds = %entry
|
||||
%0 = load i64, i64* %x.f, align 8
|
||||
%not_err = icmp eq i64 %0, 0
|
||||
br i1 %not_err, label %after_check, label %error
|
||||
|
||||
error: ; preds = %testblock
|
||||
store i64 %0, i64* %err, align 8
|
||||
br label %end_block
|
||||
|
||||
after_check: ; preds = %testblock
|
||||
store i64 0, i64* %err, align 8
|
||||
br label %end_block
|
||||
|
||||
end_block: ; preds = %after_check, %error
|
||||
%1 = load i64, i64* %err, align 8
|
||||
%neq = icmp ne i64 %1, 0
|
||||
br i1 %neq, label %if.then, label %if.exit
|
||||
|
||||
if.then: ; preds = %end_block
|
||||
store i64 %1, i64* %switch, align 8
|
||||
br label %switch.entry
|
||||
|
||||
switch.entry: ; preds = %if.then
|
||||
%2 = load i64, i64* %switch, align 8
|
||||
%eq = icmp eq i64 ptrtoint ([1 x i8*]* @"mymodule.HelloErr$elements" to i64), %2
|
||||
br i1 %eq, label %switch.case, label %next_if
|
||||
|
||||
switch.case: ; preds = %switch.entry
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0))
|
||||
br label %switch.exit
|
||||
|
||||
next_if: ; preds = %switch.entry
|
||||
%eq1 = icmp eq i64 ptrtoint ([2 x i8*]* @"mymodule.ByeErr$elements" to i64), %2
|
||||
br i1 %eq1, label %switch.case2, label %next_if3
|
||||
|
||||
switch.case2: ; preds = %next_if
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0))
|
||||
br label %switch.exit
|
||||
|
||||
next_if3: ; preds = %next_if
|
||||
br label %switch.default
|
||||
|
||||
switch.default: ; preds = %next_if3
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i32 0, i32 0))
|
||||
br label %switch.exit
|
||||
|
||||
switch.exit: ; preds = %switch.default, %switch.case2, %switch.case
|
||||
br label %if.exit
|
||||
|
||||
if.exit: ; preds = %switch.exit, %end_block
|
||||
%3 = load i64, i64* %z, align 8
|
||||
store i64 %3, i64* %switch4, align 8
|
||||
br label %switch.entry5
|
||||
|
||||
switch.entry5: ; preds = %if.exit
|
||||
%4 = load i64, i64* %switch4, align 8
|
||||
%eq6 = icmp eq i64 5, %4
|
||||
br i1 %eq6, label %switch.case7, label %next_if8
|
||||
|
||||
switch.case7: ; preds = %switch.entry5
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0))
|
||||
br label %switch.exit16
|
||||
|
||||
next_if8: ; preds = %switch.entry5
|
||||
%eq9 = icmp eq i64 2, %4
|
||||
br i1 %eq9, label %switch.case10, label %next_if11
|
||||
|
||||
switch.case10: ; preds = %next_if8
|
||||
br label %switch.case13
|
||||
|
||||
next_if11: ; preds = %next_if8
|
||||
%eq12 = icmp eq i64 15, %4
|
||||
br i1 %eq12, label %switch.case13, label %next_if14
|
||||
|
||||
switch.case13: ; preds = %next_if11, %switch.case10
|
||||
br label %switch.default15
|
||||
|
||||
next_if14: ; preds = %next_if11
|
||||
br label %switch.default15
|
||||
|
||||
switch.default15: ; preds = %next_if14, %switch.case13
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i32 0, i32 0))
|
||||
br label %switch.exit16
|
||||
|
||||
switch.exit16: ; preds = %switch.default15, %switch.case7
|
||||
store i32 1, i32* %a, align 4
|
||||
store i32 2, i32* %b, align 4
|
||||
%5 = load i32, i32* %b, align 4
|
||||
%6 = load i32, i32* %a, align 4
|
||||
%add = add i32 %5, %6
|
||||
store i32 %add, i32* %zy, align 4
|
||||
%7 = load i32, i32* %zy, align 4
|
||||
store i32 %7, i32* %switch17, align 4
|
||||
br label %switch.entry18
|
||||
|
||||
switch.entry18: ; preds = %switch.exit16
|
||||
%8 = load i32, i32* %switch17, align 4
|
||||
%9 = load i32, i32* %a, align 4
|
||||
%eq19 = icmp eq i32 %9, %8
|
||||
br i1 %eq19, label %switch.case20, label %next_if21
|
||||
|
||||
switch.case20: ; preds = %switch.entry18
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0))
|
||||
br label %switch.exit26
|
||||
|
||||
next_if21: ; preds = %switch.entry18
|
||||
%10 = load i32, i32* %b, align 4
|
||||
%eq22 = icmp eq i32 %10, %8
|
||||
br i1 %eq22, label %switch.case23, label %next_if24
|
||||
|
||||
switch.case23: ; preds = %next_if21
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0))
|
||||
br label %switch.exit26
|
||||
|
||||
next_if24: ; preds = %next_if21
|
||||
br label %switch.default25
|
||||
|
||||
switch.default25: ; preds = %next_if24
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i32 0, i32 0))
|
||||
br label %switch.exit26
|
||||
|
||||
switch.exit26: ; preds = %switch.default25, %switch.case23, %switch.case20
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define void @mymodule.main() #0 {
|
||||
entry:
|
||||
call void @mymodule.test()
|
||||
call void (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0))
|
||||
ret void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user