In the MACH project, we are working on transparent compilation toolchain for heterogeneous targets (CPUs, GPUs, ManyCores). Starting from the R language, we have built a higher level intermediate representation on top of the LLVM-IR, to benefit from a well defined target for the front-end generation and to reuse the LLVM optimization passes framework over that IR. The compiler generates LLVM-IR proper, integrated with a dataflow oriented, heterogeneous capable high performance runtime (StarPU). This talk will describe the higher-level IR and how the required transformations were implemented as LLVM passes.