[LLVMdev] LLVM targeting HLLs

David A. Greene greened at obbligato.org
Mon Jan 24 16:17:04 PST 2011


David Given <dg at cowlark.com> writes:

> The obvious place to start on this is the C backend, except in these 2.8
> days the C backend is so hedged about with caveats I'm rather wary of
> basing anything on it. I also recall seeing comments here that it's due
> for a rewrite from scratch, and that various people were looking into
> it. Can anyone go into more detail as to what exactly is wrong with the
> C backend, and whether this rewrite is happening?

The rewrite is happening.  I've got the skeleton of the codegen done,
but I have to get it to build before I can check it in.  After that,
everyone can start adding patterns.

The main problem with the current C backend is that there is no legalize
phase.  So you end up seeing vector types and all sorts of non-C
nonsense.  It's just overall much cleaner to generate code using the
generic framework.

> The other thing I could do is to use the LLVMTargetMachine and treat my
> HLL as a low-level machine; this gets me a certain amount of good stuff
> like register allocation and more optimisations, but the documentation
> is still pretty basic (e.g.
> http://wiki.llvm.org/Absolute_Minimum_Backend is three short paragraphs)
> and I'm not certain as to whether LLVMTargetMachine is suitable. For
> example: my HLL can largely be treated as a register machine with an
> arbitrary number of registers. Can LLVMTargetMachine handle this?

Once I get the new C backend checked in (next week, hopefully), it may
be helpful as a guide.

                            -Dave



More information about the llvm-dev mailing list