mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
59 lines
1014 B
C
59 lines
1014 B
C
module test;
|
|
|
|
func void test2() {}
|
|
func void testA() {}
|
|
func void testB() {}
|
|
func void test3() {}
|
|
|
|
func int main(int argc)
|
|
{
|
|
int a = 0;
|
|
while (a)
|
|
{
|
|
defer test2();
|
|
defer
|
|
{
|
|
testA();
|
|
testB();
|
|
}
|
|
if (argc == 1) break;
|
|
test3();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// #expect: test.ll
|
|
|
|
store i32 0, i32* %a
|
|
br label %while.begin
|
|
|
|
while.begin:
|
|
%1 = load i32, i32* %a
|
|
%intbool = icmp ne i32 %1, 0
|
|
br i1 %intbool, label %while.body, label %while.exit
|
|
while.body:
|
|
%2 = load i32, i32* %argc
|
|
%eq = icmp eq i32 %2, 1
|
|
br i1 %eq, label %if.then, label %if.exit
|
|
if.then:
|
|
call void @test.testA()
|
|
call void @test.testB()
|
|
br label %exit
|
|
exit:
|
|
call void @test.test2()
|
|
br label %exit1
|
|
exit1:
|
|
br label %while.exit
|
|
if.exit:
|
|
call void @test.test3()
|
|
call void @test.testA()
|
|
call void @test.testB()
|
|
br label %exit2
|
|
exit2:
|
|
call void @test.test2()
|
|
br label %exit3
|
|
exit3:
|
|
br label %while.begin
|
|
while.exit:
|
|
ret i32 0
|