This is Team 10's code repo of the course project for Principles and Practices of Software Development @ Seoul National University. This project is an improved version of the naive compiler provided in snu-sf-class/swpp202001-compiler, which converts LLVM IR to SWPP assembly.
Project collaborators are Jasmine Abtahi (YPH95), alphy1, Hexiang Geng (CuriousLocky) and Minghang Li (Matchy).
To compile this project, you'll need to clone & build LLVM 10.0 first. Please follow README.md from https://github.com/aqjune/llvmscript using llvm-10.0.json.
After LLVM 10.0 is successfully built, please run:
./configure.sh <LLVM bin dir (ex: ~/llvm-10.0-releaseassert/bin)>
make
To run tests including FileCheck and Google Test:
make test
Compile LLVM IR input.ll
into an assembly a.s
using this command:
./sf-compiler input.ll -o a.s
To see the IR that has registers depromoted before emitting assembly, please run:
./sf-compiler input.ll -o a.s -print-depromoted-module
run-test.sh
will help you check the correctness of your implementation by running it on the tests provided by our TA. It can also generate a cost report, which is test-score.log
.
If you want to check on all the tests provided by the TA, do:
./run-test.sh all <Interpreter Path>
For example,
./run-test.sh all ~/swpp202001-interpreter/sf-interpreter
If you only want to check on certain test provded by the TA, do:
./run-test.sh <Test Path> <Interpreter Path>
For example,
./run-test.sh ./test/binary_tree/ ~/swpp202001-interpreter/sf-interpreter
The automater can catch undesired outputs, terminate the test and print it to stdout
. If terminates normally, it suggests that the compiler runs okay.
You can analyze how much improvment you made by adding your Pass into main.cpp
utilizing compare.py
.
- Generate two
test-score.log
files, one with your Pass registered inmain.cpp
and the other without. Remember to rename the first file so that the second round of test result won't overwrite the first round's. - Run
python3 ./compare.py <old-log-file> <new-log-file>
(For example,python3 ./compare.py old-score.log with-pass.log
) - Look at
improve-report.log
to see how your Pass improved the performance!
For the ease of copy-and-paste:
python3 ./compare.py old-score.log with-pass.log
There are two popular ways of writing a commit message: Tim Pope style (This is also recommended in the official guideline of Git, Pro Git), and the Conventional Commits style. The latter one is preferred in many large open-source projects since it dovetails SemVer. Here we adopt the Tim Pope style, for it's succinctness.
Here are the 7 rules for writing a good Tim Pope style commit message:
- Limit the subject line to 50 characters.
- Capitalize only the first letter in the subject line.
- Don't put a period at the end of the subject line.
- Put a blank line between the subject line and the body.
- Wrap the body at 72 characters.
- Use the imperative mood, but not past tense.
- Describe what was done and why, but not how.
Read this nice blog post for explanation on why we set up those rules.
See project/optList.md for possible optimization opitions.