Update IR test for modern language and toolchain
This commit is contained in:
parent
91db46aaec
commit
70fd9d8563
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/ir-test/ir-test
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user