For artifact evaluation, please check EVALUATION.md.
- AST-level pass instrumentation tool (Rust, under
src/) - Build-in LLVM library (C++, under
library/)
- rust compilation environment (cargo, rustc...)
- Provide your own LLVM project directory (modify the configurations in
config.json)."llvm"gives the path to llvm root;"opt"specifies the path tooptbinary (required for running instrumented optimizations).
{
"llvm": "your/path/to/llvm-project/llvm",
"opt": "your/opt/binary",
}If the LLVM has already been compiled, please skip.
- Clone the LLVM repo and install build tools. For saving time, you can add the flag
--depth=1when cloning.
$ git clone https://github.com/llvm/llvm-project.git
$ sudo apt install ninja-build cmake- Initialize the build directory.
$ cd llvm-project
$ cmake -S llvm -B ../build-llvm -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=On \
-DCMAKE_INSTALL_PREFIX=../llvm- Build the
opt
$ cd ../build-llvm && ninja optThis step copies the implemented library to the directory of LLVM's include files, i.e., llvm/include/llvm/Transforms/Utils/.
$ python3 script/metaloc.py setupThis step instruments a given LLVM optimization pass.
$ python3 script/metaloc.py instrument path/to/llvm/lib/Transforms/Scalar/TailRecursionElimination.cppAfter this step, the LLVM project (especially opt) should be rebuild.
$ ninja optOne can simply use opt to run the instrumented optimization pass with a specified test case.
$ opt -S -passes=tailcallelim dropping_debugloc_acc_rec_inst_rnew.ll --disable-outputOr use the script to analyze the instrumented pass with a bunch of test cases.
$ python3 script/metaloc.py analyze path/to/llvm/test/Transforms/TailCallElim/In the output, potential debug location update errors denoted by FAIL are printed along with the constructed proper updates.