Rather than trying to have LLVM codegen take care of ABI issues (which means passing all kinds of extra information in the IR), another possibility is to have LLVM provide a helper library for generating correct IR. You would say to the library: my parameter is a union type with these fields (described using C/C++ language concepts such as unions, POD etc), and it would tell you what IR to output (or output it for you). This library could then be used by clang and every front-end confronted with ABI issues. There is a bug report about this somewhere. Ciao, Duncan.
Duncan Sands <baldrick at free.fr> writes:> Rather than trying to have LLVM codegen take care of ABI issues (which means > passing all kinds of extra information in the IR), another possibility is to > have LLVM provide a helper library for generating correct IR. You would say > to the library: my parameter is a union type with these fields (described > using C/C++ language concepts such as unions, POD etc), and it would tell you > what IR to output (or output it for you). This library could then be used by > clang and every front-end confronted with ABI issues. There is a bug report > about this somewhere.That sounds like an excellent idea. I am basically at the point of rewriting our argument handling due to some past sub-optimal design choices. I can't promise anything at the moment (gotta go through corporate) but it would be in my interest to contribute that code to such a library. -David
Hi David, On 12/02/13 18:46, dag at cray.com wrote:> Duncan Sands <baldrick at free.fr> writes: > >> Rather than trying to have LLVM codegen take care of ABI issues (which means >> passing all kinds of extra information in the IR), another possibility is to >> have LLVM provide a helper library for generating correct IR. You would say >> to the library: my parameter is a union type with these fields (described >> using C/C++ language concepts such as unions, POD etc), and it would tell you >> what IR to output (or output it for you). This library could then be used by >> clang and every front-end confronted with ABI issues. There is a bug report >> about this somewhere. > > That sounds like an excellent idea. I am basically at the point of > rewriting our argument handling due to some past sub-optimal design > choices. I can't promise anything at the moment (gotta go through > corporate) but it would be in my interest to contribute that code to > such a library.I guess you could try to factor Clang's ABI code out. Ciao, Duncan.