The Rigel compilation toolchain is based on Clang 2.8, LLVM 2.8, and GNU Binutils 2.18.
The sequence of tools used to compile a C program to an executable binary is shown in the figure below.
$RIGEL_TARGETCODE/src/Makefile.common has a set of flags that mostly automate the process of compiling C code for Rigel. $RIGEL_TARGETCODE/src/benchmarks and $RIGEL_TARGETCODE/src/testing have additional Makefile scaffolding that minimizes the amount of boilerplate required for individual benchmarks or test codes. For example, here we compile and run the complex test code.
mrj10@mjlap:~/rigel$ cd $RIGEL_TARGETCODE/src/testing/complex mrj10@mjlap:~/rigel/targetcode/src/testing/complex$ cat Makefile BENCHMARK_NAME = complex SOURCES_C = complex.c EXTRA_CFLAGS = EXTRA_LDFLAGS = -lm include ../Makefile.common mrj10@mjlap:~/rigel/targetcode/src/testing/complex$ cat complex.c //conversion of a real number from its Cartesian to polar form #include <stdio.h> #include <complex.h> #include "rigel.h" int main(int argc, char *argv[]){ if(RigelGetThreadNum() == 0) { SIM_SLEEP_OFF(); double complex z = -4.4 + 3.3 * I; double radius = cabs(z); double argument = carg(z); double x = creal(z); double y = cimag(z); printf("cartesian(x,y):(%4.1f,%4.1f)\n",x,y); printf("polar(r,theta):(%4.1f,%4.1f)\n",radius,argument); } return 0; } mrj10@mjlap:~/rigel/targetcode/src/testing/complex$ make /home/mrj10/rigel/install/host/bin/clang -ccc-host-triple rigel-unknown-unknown -Qunused-arguments -nostdinc -I/home/mrj10/rigel/install/host/lib/clang/2.8/include -I. -I/home/mrj10/rigel/install/target/include -I/home/mrj10/rigel/sim/rigel-sim//includes -DLLVM28 -DRIGEL -O3 -ffast-math -fomit-frame-pointer -D"CLUSTER_LOCAL_TQ" -DINNER_LOOP_C -Wall -c complex.c -o complex.ro /home/mrj10/rigel/install/host/bin/clang -ccc-host-triple rigel-unknown-unknown -Qunused-arguments -nostdinc -I/home/mrj10/rigel/install/host/lib/clang/2.8/include -I. -I/home/mrj10/rigel/install/target/include -I/home/mrj10/rigel/sim/rigel-sim//includes -DLLVM28 -DRIGEL -O3 -ffast-math -fomit-frame-pointer -D"CLUSTER_LOCAL_TQ" -DINNER_LOOP_C -Wall complex.ro -Xlinker "--oformat=elf32-bigmips" -Xlinker "-T/home/mrj10/rigel/install/target/lib/linker/rigel.ld" -static -lm -lpar -lm -o complex.tasks /home/mrj10/rigel/install/host/bin/rigelobjdump -d -mmipsrigel32 complex.tasks >complex.obj rm complex.ro mrj10@mjlap:~/rigel/targetcode/src/testing/complex$ $RIGEL_INSTALL/host/bin/rigelsim complex.tasks RigelSim Compiled by mrj10 on Feb 26 2012 at 15:10:55 from Git commit: ... ... cartesian(x,y):(-4.4, 3.3) polar(r,theta):( 5.5, 2.5) core 0 (local 0) thread 0 halting @ cycle 93708, PC 0x00000068 Simulation exiting. Reason: System-wide halt
clang has a couple useful options to debug interactions between the components of the compilation flow.