[cfe-dev] Targeting Clang?

John McCall rjmccall at apple.com
Fri Nov 13 11:01:13 PST 2009


Rick R wrote:
>
> I am considering writing a LLVM back end for Scala. A major goal of 
> mine is interoperability with C (and perhaps C++)
> Would it make sense to try to leverage parts of Clang for this 
> purpose? Is there an intermediate language for c/c++/objc that 
> languages are compiled into before being compiled to LLVM?  That would 
> be optimal. If that's not possible, are there parts of clang that are 
> recommended for use with other languages? 
>
> Failing any of that, does anyone have any recommendations for setting 
> out to build an LLVM back end for a language with the goal of ABI 
> compatibility in mind?

LLVM doesn't make any formal promises about this, but it will generally 
ensure ABI compatibility for function types featuring only pointer, 
integer, and floating-point types.

If you really needed to use clang's ABI support (and you might), there's 
an ABIInfo interface, but it's not really factored for ease of external 
use.  Ideally we would have an interface taking a clang::FunctionType, a 
list of arguments, and an IRBuilder (possibly +1 for making allocas), 
but that's not how it's written.

John.



More information about the cfe-dev mailing list