[LLVMdev] struct passing on X86-64
Dr.Graef at t-online.de
Sat Jun 11 01:53:45 PDT 2011
On 06/10/2011 07:29 PM, David A. Greene wrote:
> Duncan Sands<baldrick at free.fr> writes:
>> See PR4246 for a plan to have generic helper codes for ABI lowering.
> It seems a bit complicated to me. Wouldn't it be simpler to just encode
> the language type information in metadata, or, if metadata isn't
> appropriate because it can be dropped, in some language information
> piece within Type? Then the target ABI stuff can know exactly what to
> do and we won't have various other pieces all trying to figure out the
> same stuff.
There's a similar problem I've been grappling with in the Pure compiler.
Pure can load LLVM bitcode files (and even produce them on the fly,
using clang or llvm-gcc, if you inline C/C++/Fortran code in Pure
scripts) and make the functions in those files callable from Pure
without having to explicitly declare the call interfaces.
This is very convenient and works reasonably well, except that the
bitcode loader can't distinguish between void* and char* which both end
up as i8* in bitcode. (This needs to be done so that Pure strings can be
properly marshalled to C and back.)
To solve this, it would be *very* nice to have some kind of annotation
in the bitcode which tells me whether an i8* is actually void* or char*
on the C side (this would then have to be generated by the C/C++ frontend).
The only way to get that kind of information that I currently see is to
somehow make clang also spit out the AST along with the bitcode, but
that seems wasteful. (If anyone has a better idea, please let me know.)
So this kind of type annotation would be useful for more than ABI
lowering, and I'd really welcome that addition.
Dr. Albert Gr"af
Dept. of Music-Informatics, University of Mainz, Germany
Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de
More information about the llvm-dev