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) all: clean $(PROG)
$(PROG): $(PROG).bc $(PROG): $(PROG).o
llvm-ld -o $@ -native $< gcc -o $@ $<
%.bc: %.ll %.o: %.ll
llvm-as $< clang -c -o $@ $<
clean: 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() { define i32 @main() {
%cast210 = getelementptr [12 x i8]* @str, i64 0, i64 0 call i32 @puts(ptr @str)
call i32 @puts(i8 * %cast210)
ret i32 0 ret i32 0
} }