<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 24, 2011, at 2:01 PM, David Given wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I am interested in using LLVM to translate C and C++ into high-level<br>language code. (As an update to an earlier project of mine, Clue, which<br>used the Sparse compiler library to do this: it targets Lua, Javascript,<br>Perl 5, C, Java and Common Lisp, with a disturbing amount of success.<br>See <a href="http://cluecc.sourceforge.net">http://cluecc.sourceforge.net</a> for details.)<br><br>The obvious place to start on this is the C backend, except in these 2.8<br>days the C backend is so hedged about with caveats I'm rather wary of<br>basing anything on it. I also recall seeing comments here that it's due<br>for a rewrite from scratch, and that various people were looking into<br>it. Can anyone go into more detail as to what exactly is wrong with the<br>C backend, and whether this rewrite is happening?<br><br>The other thing I could do is to use the LLVMTargetMachine and treat my<br>HLL as a low-level machine; this gets me a certain amount of good stuff<br>like register allocation and more optimisations, but the documentation<br>is still pretty basic (e.g.<br><a href="http://wiki.llvm.org/Absolute_Minimum_Backend">http://wiki.llvm.org/Absolute_Minimum_Backend</a> is three short paragraphs)<br>and I'm not certain as to whether LLVMTargetMachine is suitable. For<br>example: my HLL can largely be treated as a register machine with an<br>arbitrary number of registers. Can LLVMTargetMachine handle this?<br></div></blockquote></div><br><div>You could create a different code generator from clang or use the rewriting</div><div>machinery?</div><div><br></div><div>-eric</div></body></html>