diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eadd23b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/ir-test/ir-test diff --git a/ir-test/Makefile b/ir-test/Makefile index 65b3382..37852f2 100644 --- a/ir-test/Makefile +++ b/ir-test/Makefile @@ -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) diff --git a/ir-test/ir-test.ll b/ir-test/ir-test.ll index 7a83d65..d034549 100644 --- a/ir-test/ir-test.ll +++ b/ir-test/ir-test.ll @@ -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 }