A collection of code based on LLVM/Clang compilation libraries and tools.
There are also some useful tutorials about LLVM/clang in directory tutorials/
.
To install llvm, you can use the installer script install-llvm-5.0.1.sh
that can be found in directory utils/
.
E.g. use $ ./install-llvm-5.0.1.sh 4 ~/
to build llvm-5.0.1 using 4 cores in your home directory.
- Tutorials
- Custom class supporting LLVM RTTI
- C AST Interpreter
- Comments Extractor
- Dataflow Points-to Analysis
- Use CalledValuePropagationPass in your tool
- Break ConstantExpr
- Unify Function Exits
- Run an LLVM Pass with Clang
- JIT for brainfuck
- Taint Propagation
- LLVM IR Tutorial - Phis, GEPs and other things, oh my!
- How to Write a Clang Static Analyzer Checker in 24 Hours
- Scalar Evolution Demystified
Sample code used to demonstrate how to set up LLVM-Style RTTI for your custom class hierarchy.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/custom-class-support-llvm-rtti
A basic tiny C language interpreter based on Clang.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/c-ast-interpreter
A simple tool based on clang's libtooling to grab all the comments from C source code.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/comments-extractor
An LLVM pass that implements a flow-sensitive, field- and context-insensitive points-to analysis via dataflow, computing the points-to set for each variable at each distinct program point.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/dataflow-points-to-analysis
Sample code used to demonstrate how to call CalledValuePropagationPass in your own tool based LLVM.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/use-calledvaluepropagation-in-your-tool
This BreakConstantExpr is a module pass that converts all constant expressions into instructions.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/break-constantexpr
This UnifyFunctionExits module pass is just a wrapper for UnifyFunctionExitNodes function pass, used to ensure that functions have at most one return instruction in them.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/unify-functionexits
Sample code used to demonstrate how to run your LLVM Pass with Clang.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/clang-pass
A JIT using LLVM for brainfuck language.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/building-a-JIT-for-BF
An LLVM transform pass implements a flow-sensitive, field- and context-insensitive taint propagation based on classic dataflow analysis.
For detail, see https://github.com/Enna1/LLVM-Clang-Examples/tree/master/taint-propagation