On Fri, 2007-05-11 at 23:15 -0400, me22 wrote:> On 11/05/07, Mohd-Hanafiah Abdullah <napi at axiomsol.com> wrote: > > I've been looking for a C++ to C translator for quite some time. > > The purpose is to support C++ for the compiler I developed targeting the > > JVM. But the compiler I wrote only supports ANSI C (1989). So the C++ > > to C translator is needed, and among the options are as follows: > > [...] > > c) LLVM (tried, but the resulting C code is quite hairy, pardon the > > expression) > > > So you just want to feed the C code to your C-to-JVM compiler? I don't > understand why "hairy" code would be a problem for that usage. > > As a different option, how about writing a JVM backend for LLVM?This is definitely an option too. Another one would be to write a JVM backend for gcc. But, I think somebody tried many years ago and stopped halfway (it's egcs-jvm I think). Does LLVM use RTL as intermediate language like gcc does? Thanks. Napi
On 11/05/07, Mohd-Hanafiah Abdullah <napi at axiomsol.com> wrote:> This is definitely an option too. Another one would be to write a JVM > backend for gcc. But, I think somebody tried many years ago and stopped > halfway (it's egcs-jvm I think). Does LLVM use RTL as intermediate > language like gcc does? >I'm not exactly sure how llvm-g++ works. I think it goes through the standard gcc sequence (gimple, rtl, and such) but then outputs LLVM (http://llvm.org/docs/LangRef.html), which is the intermediate representation used by the rest of the chain. To make an LLVM backend you would not need to deal with RTL and such at all. There's a name change in progress to make it clearer that what's now called LLVM is much more than just the LLVM language :) ~ Scott
On Fri, 11 May 2007, me22 wrote:> I'm not exactly sure how llvm-g++ works. I think it goes through the > standard gcc sequence (gimple, rtl, and such) but then outputs LLVM > (http://llvm.org/docs/LangRef.html), which is the intermediate > representation used by the rest of the chain. To make an LLVM backend > you would not need to deal with RTL and such at all.llvm-g++ converts from trees to high-gimple to LLVM. RTL is not involved. LLVM also does have an MSIL backend, if you are interested in a JVM backend, it may be a starting point. -Chris -- http://nondot.org/sabre/ http://llvm.org/