GRaph cOmpiler Solely for cS241
GROSS is a research compiler used for studying non-traditional Graph IR, which has advantages on both code optimization and code generations.
This compiler was originally created as a class project in Advanced Compiler Construction(CS241) in UC Irvine. The class was instructed by Prof. Michael Franz.
This project requires CMake
(>= 3.5) and any compiler that supports C++11.
First, we need to boot up submodules
git submodule init
git submodule update
Then configure with CMake
mkdir build
cd build
cmake -G <generator> ..
There are two important CMake variables:
CMAKE_BUILD_TYPE
. Set toRelease
,Debug
or more advance configuration. Note that if it's set toDebug
and you're using clang, the following sanitizer will be turned on by default:- Address Sanitizer (ASAN)
- Undefined Behavior Sanitizer (UBSAN)
GROSS_ENABLE_UNIT_TESTS
will add unit tests and integration tests to build targets.
For example, the following will generate a debug build with all tests included:
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DGROSS_ENABLE_UNIT_TESTS=True ..
Finally, build it
ninja
Use check-units
to only run the unit tests, check-integrations
for integration tests, and check-gross
for all the above.
ninja check-units
ninja check-integrations
ninja check-gross
The gross
tool under src/Driver
simply runs the entire compilation pipeline and provides options for dumping intermediate IR graph. Please run gross --help
for available options.
The Graph IR is inspired by TurboFan JIT compiler in V8 javascript engine, which is also called "Sea of Nodes" IR.
- C Click, KD Cooper."Combining analyses, combining optimizations"
- The original "Sea of Nodes" paper. (Jump to Chap 6 and 7 for TL;DR)
- TurboFan TechTalk presentation
- TurboFan IR