Llvm refactor


Hi David

Here's the promised set of patches - I fear the main chunk of it is still quite monolithic, as I would have to invent a good amount of intermediate stages in order to make the history pretty. If you feel you need, say, a version that uses the monad but doesn't skip alloca on registers that aren't written, let me know.

The full LLVM build seems to be broken currently due to #7885, but I ran a few tests on how different LLVM versions interact with my "alias" solution to forward references. It seems declaring them as "private" is the most reliable - it will produce code like

    .Lstg_ap_n_info$alias = stg_ap_n_info

in the assembly, which then gets eliminated completely. I have tested this for every LLVM version from 2.8 to 3.3, it seems to work fine. The only problems I ran into was  3.2 throwing assertions because of the "nounwind" attribute (?!) and 3.0 choking on some vector instructions, which I guess is a known bug.

Greetings,
  Peter Wortmann