ACM class's compiler homework in 2022-autumn
MIT License
updated on 2022/12/5
debug/
.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
src/autotestspace
.The testIR
flag in Compiler.java
should be set to true
.
python3 ir-auto-test.py
debug/
.sh asm-riscv-gen.sh
to generate test.s
in risv32 target.sh codegen-test.sh
use test.s
, builtin.s
and ravel
to execute the program..ll
clang -S -emit-llvm test.c
clang -S -emit-llvm test.c --target=riscv32
.bc
clang -c -emit-llvm test.c
llvm-link test.ll builtin.ll -o linked.bc
.ll
or .bc
) to executableclang 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
.c
to .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..ll
to .s
)llc test.ll -o test.s -march=riscv32 -mattr=+m
m
tells the compiler not to use __mul
but to use mul
instruction.