edA-qa mort-ora-y
2012-Nov-07 06:32 UTC
[LLVMdev] using large structures in registers/returns
I can't find a lot of information about using structures directly as parameters, returns, and in registers. Is this fully supported on all platforms? Does it always convert to creating a hidden parameter when too large? For example (assume very.large is too big to fit in the target machine registers): define %very.large @get_struct() { %m1 = insertvalue %very.large undef, i32 10, 0 ... %m10 = insertvalue %very.large %m9, i32 25, 9 ret %very.large %m10 } define void @use_struct( %very.large %m ) { ... } define i32 @main() { %m = call %very.large @get_struct() call void @use_struct( %very.large %m ) } Will this work on all targets? -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I'm also happy to receive encrypted mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/53bbb79d/attachment.sig>
Chandler Carruth
2012-Nov-07 06:53 UTC
[LLVMdev] using large structures in registers/returns
On Tue, Nov 6, 2012 at 10:32 PM, edA-qa mort-ora-y <eda-qa at disemia.com> wrote:> I can't find a lot of information about using structures directly as > parameters, returns, and in registers. Is this fully supported on all > platforms? Does it always convert to creating a hidden parameter when > too large? > > For example (assume very.large is too big to fit in the target machine > registers): > > define %very.large @get_struct() { > %m1 = insertvalue %very.large undef, i32 10, 0 > ... > %m10 = insertvalue %very.large %m9, i32 25, 9 > ret %very.large %m10 > } > > define void @use_struct( %very.large %m ) { ... } > > define i32 @main() { > %m = call %very.large @get_struct() > call void @use_struct( %very.large %m ) > } > > Will this work on all targets?It should "work", although it may not match any ABI you care about. However, you don't need to ask us. =] Just try it with various backends and check the assembly that comes out.