[Cowlark Logo] cowlark.com

LLVM for the VideoCore4

LLVM for the VideoCore4


This is an in-progress LLVM backend for Broadcom's VideoCore 4 processor, as made famous by the Raspberry Pi.

Right now it's a prototype only --- there are a number of major missing features, and I've yet to actually show the generated code to a real VC4 processor. But the code quality looks reasonable (or at least, will be reasonable once some of the bugs are fixed).


Download the source by checking out the Fossil repository.

$ mkdir llvm
$ cd llvm
$ fossil clone https://cowlark.com/llvm llvm.fossil
$ fossil open llvm.fossil

Regenerate the autoconf stuff. LLVM depends on the achingly archaic autoconf 2.60, so you'll need to either install this or hack the script to use a more modern version (easily done).

$ autoconf/AutoRegen.sh

Configure and build.

$ ./configure --enable-targets=vc4 --enable-assertions --enable-expensive-checks --enable-debug-runtime --enable-debug-symbols
$ make

Compile some test code with a third-party clang, and then use the llc you've just built to generate the VC4 code.

$ clang -S -O3 -fno-vectorize -fno-slp-vectorize -emit-llvm test.c
$ Debug+Asserts+Checks/bin/llc -O3 --mtriple vc4 test.ll 

There's no assembler or toolchain yet. You'll need to find your own.

Why not?

There are currently some big holes in the code generation.

- no 64 bit arithmetic. This can be a pain, as LLVM likes doing loop induction to do bulk operations in 64-bit variables. - no support for condition codes. - no support for measuring code size, which means it doesn't know when to use near and far branches. Right now this is all just broken. - brutally simplified patterns for just about everything --- I've been concentrating on making things work, rather than making things good. - bugs. Oh god, so many bugs.

Right now this is for interested parties and LLVM hackers only. It's not for real use. I did mention that I haven't actually tried running this yet, right?


If you have any comments --- or contributions! Please! --- email me: David Given.


My additions are licensed under the same license as LLVM: the University of Illinois Open Source License.

Fossil version [7b0dbe8079] 2019-02-20 22:28:24 © 2008-2012 David Given, unless specified otherwise