Skip to content

Instantly share code, notes, and snippets.

@obiknows
Last active May 11, 2017 02:21
Show Gist options
  • Save obiknows/11e133a791a3fa3ed68dc074e38894f4 to your computer and use it in GitHub Desktop.
Save obiknows/11e133a791a3fa3ed68dc074e38894f4 to your computer and use it in GitHub Desktop.
tbrack.wl test
make clean && make
./warhol.native -c < tests/tbrack.wl > tbrack.ll
lli tbrack.ll
; ModuleID = 'Warhol'
@fmt = private unnamed_addr constant [4 x i8] c"%d\0A\00"
declare i32 @printf(i8*, ...)
declare i32 @openfile(i8*, ...)
define i32 @main() {
entry:
%i = alloca i32
%arr = alloca [3 x i32]
store i32 0, i32* %i
%i1 = load i32* %i
%tmp = add i32 %i1, 1
%arr2 = getelementptr [3 x i32]* %arr, i32 0, i32 %tmp
store i32 1, i32* %arr2
%arr3 = getelementptr [3 x i32]* %arr, i32 0, i32 1
%arr4 = load i32* %arr3
%printf = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @fmt, i32 0, i32 0), i32 %arr4)
ret i32 0
}
plt@ubuntu-plt:~/work/warhol$ lli tbrack.ll
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment