updated on 2022/12/5
- commands
- semantic notes
- semantic checklist
- IR design
- raw IR checklist
- codegen notes
- raw codegen checklist
test.ll
(generated by my compiler from test.mx
) and builtin.ll
are both x86-64 target.
sh ir-test.sh
sh ir-draw.sh
The testIR
flag in Compiler.java
should be set to true
.
python3 ir-auto-test.py
sh asm-riscv-gen.sh
to generatetest.s
in risv32 target.sh codegen-test.sh
usetest.s
,builtin.s
andravel
to execute the program.
- to
.ll
clang -S -emit-llvm test.c
clang -S -emit-llvm test.c --target=riscv32
- to
.bc
clang -c -emit-llvm test.c
llvm-link test.ll builtin.ll -o linked.bc
clang test.ll -o test
clang test.bc -o test
lli test.ll
lli test.bc
llc test.ll -o test.s
llc test.bc -o test.s
clang -S test.c
clang -S test.c --target=riscv32 -march=rv32im
i
means basic integer instructions,m
means multiply and divide, which we will use in code-generation phase.
llc test.ll -o test.s -march=riscv32 -mattr=+m
m
tells the compiler not to use__mul
but to usemul
instruction.