[LLVMdev] Can I port LLVM as a source-to-source compiler?
Greg Chadwick
gac43 at cam.ac.uk
Tue Jan 19 06:57:35 PST 2010
Junchao Zhang wrote:
> Hello,
> I am working in a project on a parallel programming language. I want to
> base our language on Java or C/C++. But Java is preferred.
>
> Many similar projects adopts a source-to-source methodology, e.g.,
> Berkeley UPC(using Open64), Titanium, and Rice University's Co-array
> Fortran. They output C code with calls to the runtime. I think there
> are at least three reasons: 1) using C as the output, it gets more
> portability. 2) leverage the front ends of existing compilers. 3)
> leverage optimizations in existing compilers.
>
> I wonder if LLVM is suitable for this kind of work. Can LLVM experienced
> users give me some hints on this topic?
>
> Thanks in advance.
>
> Junchao Zhang
As others have mentioned there is a C backend, though in this case I see
little point in using it. If you produce a LLVM language front-end
(i.e. something which takes your language and creates LLVM) then you get
portability and a whole bunch of optimizations. If you think it's
significantly easier to compile your language down to C rather than LLVM
then you could pass that into one of the C language front ends (LLVM-GCC
or Clang).
Cheers,
Greg Chadwick
More information about the llvm-dev
mailing list