If you just want to use the backend come back later when it's finished, at the current stage it's only useful if you plan to work on it.
The good stuff lives here: https://github.com/Hoernchen
Building is pretty much straightforward, clone llvm, checkout epiphany, cd llvm/tools, clone clang, checkout epiphany, cd llvm/lib/Target, clone Epiphany
You need to use cmake, the necessary settings are -DLLVM_TARGETS_TO_BUILD="AArch64;Epiphany" -DCMAKE_BUILD_TYPE=Debug - the build needs a few gigabytes of space, so plan ahead.
I chose to base the backend on AArch64 because it is the newest backend that is "ARM-like", and the actual ARM backend is not really a good example for anything because it supports thumbv1/2, vfpv2/3, neon, and pretty much everything else there is so the code is a bit of a mess. This is why most of the code, including the comments, looks like aarch64 backend code - there is no reason to reinvent the wheel, most problems you're facing when working on a backend are far from unique, so looking at all the other existing backends makes sense.
My primary goal was to match "epiphany-elf-gcc -S -c -o - -mcmove -mno-soft-cmpsf -mshort-calls -mfp-mode=round-nearest -fomit-frame-pointer -ffast-math -O3" because I'm mostly interested in using the epiphany for stuff it is good at, which means dsp stuff involving floats. At the moment I'm still using the aarch64 clang frontend, because it "just works", although in the long run this will obviously require some work.
Using the backend works like this: clang -target aarch64--eabi -emit-llvm foobla.c -c -O3 -ffast-math -fomit-frame-pointer -o - -S -ffp-contract=fast | llc -march=epiphany
So, let's sum up what it does have:
* asm printer that is not immediately compatible with the epiphany binutils (printing of floating point constants, double reg names, ..) because this is my "debug output"
* FMA/FMSUB support
* a pass that removes unnecessary compares
* a pass that tries to combine loads and stores to double loads and stores if the alignment matches, mostly useful for stuff involving the complex floats, manually providing the alignment using __builtin_assume_aligned is necessary for this. This can be enabled with -double-ls. Code to try, provided by tnt: http://pastebin.com/A6xp01R6
..and what it doesn't have:
* elf writer
* instruction encoding, because there is no elf writer
* support for the secondary integer instructions
* switching of rounding modes for float/fix
* postmodify loads and stores, this might need a pass after the double l/s combine pass
* software float compares, ieee-754 style, for proper inf/nan handling
* support for variadic functions
* a call convention that is rock solid
* -O0 breaks stuff
* target specific scheduling
* R63, because I abuse that reg as destination for compares and for some other stuff
* tail call optimizations (not particularly important)
* pretty code
* probably something else i forgot to mention
In short, expect it to break, fix it, rinse and repeat.