[LLVMdev] LLVM targeting HLLs

David Given dg at cowlark.com
Mon Jan 24 14:01:15 PST 2011


I am interested in using LLVM to translate C and C++ into high-level
language code. (As an update to an earlier project of mine, Clue, which
used the Sparse compiler library to do this: it targets Lua, Javascript,
Perl 5, C, Java and Common Lisp, with a disturbing amount of success.
See http://cluecc.sourceforge.net for details.)

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 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?

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "I have a mind like a steel trap. It's rusty and full of dead mice."
│ --- Anonymous, on rasfc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110124/81d3dfc5/attachment.sig>


More information about the llvm-dev mailing list