-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtinki.llmake
30 lines (24 loc) · 1.05 KB
/
tinki.llmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
; ModuleID = 'Tinki Compiler'
source_filename = "Tinki Compiler"
@0 = private unnamed_addr constant [3 x i8] c"if\00", align 1
@1 = private unnamed_addr constant [9 x i8] c"if again\00", align 1
@2 = private unnamed_addr constant [5 x i8] c"else\00", align 1
declare i32 @printf(i8* %0, ...)
define i32 @main() {
entry:
%x = alloca i32
%y = alloca i32
store i32 5, i32* %x
store i32 7, i32* %y
%ltcompare = icmp slt i32* %x, %y
br i1 %ltcompare, label %if, label %else
if: ; preds = %entry
%printfcall = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @0, i32 0, i32 0))
%printfcall1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0))
br label %merge
else: ; preds = %entry
%printfcall2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0))
br label %merge
merge: ; preds = %else, %if
ret i32 0
}