[LLVMdev] How to represent __attribute__((fastcall)) functions in the IL
rengolin at systemcall.org
Fri Oct 19 08:58:19 PDT 2012
On 19 October 2012 16:40, Chandler Carruth <chandlerc at google.com> wrote:
> Don't get me wrong, I don't have any good ideas about how to do this, I'm
> just hoping someone does. End result might allow something like:
> declare void @foo(double inreg <eax,edx> %x)
We were discussing about this on the Cambridge LLVM Social a while
ago, and we felt that there were far too much target dependent stuff
in the procedure call standards as it is.
Our approach would be to have a PCS layer, either in the front-end or
as a pass, that would know about both language and target to be able
to construct calls as the target is expecting (ABI-wise).
David Chisnall proposed a PCSBuilder (similar to IRBuilder, for
building function calls), where you just pass the basic info (return
type, arguments, flags, name) and it builds the function for you,
mangling names, changing parameters and assigning things to registers
when the ABI is less than helpful, possibly having an inreg syntax
like you describe.
My idea was to make it a pass, so you could delay the PCS mess up to a
later stage, when possibly you'd already have more information about
the target, but that's not necessarily true and might open the can of
worms that is having a multi-layered IR. For simplicity, we might
consider David's approach first, and move the code later, if the idea
of a multi-layered IR gets on.
Would that make sense in Clang? It should be a matter of code movement
more than new code, and would provide a common place for more
front-ends to use.
Would that make sense in dragonegg?
More information about the llvm-dev