This project is mainly used to save some practices of writing llvm pass, which is helpful for people who are unfamiliar with LLVM.
Introduce some information about several directories.
pass_example: there are some llvm pass example, like iterate BasicBlocks
test_program: there are some C program, which is used to
Notice: More information you can see in dir's doc file
-
You should compile the LLVM for your platform
-
Select a LLVM Pass example, and copy it in LLVM
cp -R pass_example/${LLVM_PASS}
${LLVM_HOME}/lib/Transforms cd $ {LLVM_BUILD} make -
Test the LLVM Pass
clang -emit-llvm -S -o ${TEST_FILE}.ll test_program/${TEST_FILE}.c opt -load ${LLVM_BUILD}/lib/LLVM${LLVM_PASS}.so -${LLVM_PASS} ${TEST_FILE}.ll
Notice:
LLVM_HOME: llvm's home dir
LLVM_BUILD: the dir which is uesd to build llvm
LLVM_PASS: the llvm pass which you want to test
TEST_FILE: test C file