Update IR test for modern language and toolchain

This commit is contained in:
Josh Holtrop 2023-11-18 20:09:29 -05:00
parent 91db46aaec
commit 70fd9d8563
3 changed files with 9 additions and 10 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/ir-test/ir-test

View File

@ -3,11 +3,11 @@ PROG := ir-test
all: clean $(PROG)
$(PROG): $(PROG).bc
llvm-ld -o $@ -native $<
$(PROG): $(PROG).o
gcc -o $@ $<
%.bc: %.ll
llvm-as $<
%.o: %.ll
clang -c -o $@ $<
clean:
rm -f *~ *.bc $(PROG)
rm -f *~ *.o $(PROG)

View File

@ -1,11 +1,9 @@
@str = internal constant [12 x i8] c"hello world\00"
@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
declare i32 @puts(i8 *)
declare i32 @puts(ptr nocapture) nounwind
define i32 @main() {
%cast210 = getelementptr [12 x i8]* @str, i64 0, i64 0
call i32 @puts(i8 * %cast210)
call i32 @puts(ptr @str)
ret i32 0
}