This is a toolchain for an an experimental GPGPU architecture (https://github.com/jbush001/GPGPU), including a C/C++ compiler, assembler, and linker, based on the LLVM compiler infrastructure and clang compiler.
- cmake 2.8.8
- libxml
- python 2.7
- gcc 4.7+ or Apple clang 4.2+
On Ubuntu, these can be installed by using: sudo apt-get install libxml2-dev cmake gcc g++ python. You must be on at least release 12.10.
On MacOS, you'll need to either use a package manager like MacPorts, or download cmake manually and (http://cmake.org/) build it. The other dependencies should already be installed.
Assuming the proper packages are installed, configure and build using the following commands.
> mkdir build > cd build > cmake .. > make > sudo make install
A few other things to note:
- The name of the target is 'vectorproc'.
- There are also bits of an autoconf based build system in this project. It doesn't work.
- Using sudo on make install as described can leave files with root ownership in your build directory, which can then cause cryptic build errors later when building as non-root. Doing a 'sudo chown -R `whoami` .' in the build directory will fix this.
- If you want to make changes to the compiler, add '-DCMAKE_BUILD_TYPE=Debug' as a parameter to the cmake command enable a debug build. This enables the -debug flag for command line tools, which is important to see various transormations and output of intermediate passes.
Once built, the toolchain will be installed into /usr/local/llvm-vectorproc
/usr/local/llvm-vectorproc/bin/clang -o program.elf test_program.c
- Change PATH environment variable to include the binary directory (build/bin)
- the test can be run as follows (assuming you are at the top of the project directory)
llvm-lit test llvm-lit tools/clang/test/CodeGen/vectorproc*
There are a set of tests in https://github.com/jbush001/GPGPU/tree/master/tests/compiler Each test case is compiled and then run in the instruction set simulator. The output is checked for validity. This is similar to the test-suite project in LLVM. Instructions are found in that directory.