if statements work

This commit is contained in:
SpookyDervish
2025-10-14 21:23:11 +11:00
parent 48e7488a63
commit 3d9208f0f8
7 changed files with 256 additions and 34 deletions

View File

@@ -2,14 +2,23 @@
target triple = "x86_64-pc-windows-msvc"
target datalayout = ""
define i32 @"test"()
{
test_entry:
ret i32 0
}
@"true" = constant i1 1
@"false" = constant i1 0
define i32 @"main"()
{
main_entry:
ret i32 123
%".2" = alloca i32
store i32 6, i32* %".2"
%".4" = load i32, i32* %".2"
%".5" = icmp eq i32 %".4", 5
br i1 %".5", label %"main_entry.if", label %"main_entry.else"
main_entry.if:
store i32 0, i32* %".2"
br label %"main_entry.endif"
main_entry.else:
store i32 1, i32* %".2"
br label %"main_entry.endif"
main_entry.endif:
%".11" = load i32, i32* %".2"
ret i32 %".11"
}