Passing arguments to var args function

Hey,

I am working on a new back-end,
in my back end, I require to pass every argument through a register when calling a function, unless the argument is part of the ellipsis (…) and then pass it through the stack, I’ve tried creating a CCCustom function to analyze the operands when a function has var args, however, the information whether the out val is fixed or not is not passed into the analyze function, the code I’m talking about can be seen here:

https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/CallingConvLower.cpp#L138

In line 144 the Fn is called, the Outs[i] contains the information required for such thing because it contains the IsFixed flag.
Did anyone else come by such requirement? is there any other way anyone could recommend handling such requirement?

Thanks in advance, Liad.

Hi Liad,

Hey Tim, thanks for the quick answer,
this looks exactly like what I was trying to achieve, I was hoping there was something more clean,
I was wondering how the community would accept a change in the TD,
if the code at CallinvConvLower.cpp:138 would’ve passed the IsFixed flag to the AssignFn then all those workarounds wouldn’t be needed,
this example is only one of a few I can think of for expanding the CallingConvention tablegen capabilities regarding this issue.

Thanks for the answer.

I think that would be a pretty good idea. I suspect the main reason it
wasn't done for AArch64 is that the backend was secret at the time and
Jim wanted to minimize merge conflicts.

Cheers.

Tim.

Anyone looking at this issue may want to take a look at my patch here
https://reviews.llvm.org/D42374 which adds an IsFixed field to
ISD::ArgFlagsTy.

Best,

Alex