summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-09-12 08:40:59 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2020-09-12 08:40:59 +0200
commit58d6d07fe2b423c76737baeecb8424dbc93c37e1 (patch)
treefd9f8ec5b6fdcf8b621b177934c2ea27816738d5
parent578f0b0fdf12dd9b6b1fa0748aaf3a56e68d2627 (diff)
downloadcompilertests-58d6d07fe2b423c76737baeecb8424dbc93c37e1.tar.gz
compilertests-58d6d07fe2b423c76737baeecb8424dbc93c37e1.tar.bz2
updated LLVM test README
-rw-r--r--old/llvmtests/README30
1 files changed, 25 insertions, 5 deletions
diff --git a/old/llvmtests/README b/old/llvmtests/README
index 8de04b8..6755a79 100644
--- a/old/llvmtests/README
+++ b/old/llvmtests/README
@@ -1,5 +1,25 @@
-clang -o hello.l -I../../include/wolf -Os -S -emit-llvm hello.c
-opt -S hello.s > hello-opt.s
-xxdiff hello.s hello-opt.s
-llc -O0 hello.l -march=x86-64 -p hello-amd64.s
-llc -O0 hello.l -march=mipsel -o hello-mipsel.s
+# generate LLVM IR
+clang -o hello.l -O0 -S -emit-llvm hello.c
+clang --target=x86_64-pc-linux-gnu -o hello-x86_64.l -O0 -S -emit-llvm hello.c
+clang --target=i386-pc-linux-gnu -o hello-i386.l -O0 -S -emit-llvm hello.c
+clang --target=aarch64-unknown-linux-gui -o hello-aarch64.l -O0 -S -emit-llvm hello.c
+
+# optimize and compare
+opt -S hello.l > hello-opt.l
+xxdiff hello.l hello-opt.l
+
+# run LLVM code in interpreter
+lli hello.l
+
+# generate native assembler
+llc -O0 hello.l -o hello.s
+llc -O0 hello-x86_64.l -march=x86-64 -o hello-amd64.s
+llc -O0 hello-i386.l -march=i386 -o hello-i386.s
+llc -O0 hello-aarch64.l -march=aarch64 -o hello-aarch64.s
+
+# cross toolchains needed for i386 and aarch64
+as -o hello.o hello.s
+gcc -o hello hello.o
+
+# TBD
+gcc -fverbose-asm -Os -S -o hello.s hello.c