JonChesterfield wrote:

That's our call really. Right now this passes everything as whatever type it 
claimed to be as far as creating the call instruction goes, then variadic 
lowering pastes them all into a single structure with four byte alignment on 
every field.

Tagging some parameters as byval or byref is fine as far as variadic lowering 
goes. They'll tend to end up in their own alloca, then a ptr in the call frame. 
It means more test variation but the common path knows what byval is, and 
adding byref will be fine.

I'm not immediately worried about sdag crashing if people pass loads of data to 
a variadic call, considering our baseline capability here is no variadics at 
all. Likewise I'm not sure what the performance tradeoffs of copying into the 
frame vs indirect reference are and not very worried about making an optimal 
choice there.

I'll add some more structs to show they're also passed unchanged. If you want 
more complicated rules you're welcome to them - happy to pass arguments in 
whatever pattern you like, though the splitting them into multiple fields as we 
currently do would push the va_arg lowering complexity up alarmingly.

What would you sign off on? The current approach is the simplest. Next up is 
using the same when-to-pass-byref as fixed arguments without the splitting. 
Otherwise we can have some other heuristic.

https://github.com/llvm/llvm-project/pull/94083
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to