will multi-register returns get fixed?

Jim Wilson wilson@tuliptree.org
Sat Jun 7 06:38:00 GMT 2003


David Mosberger wrote:
> A Linux-kernel related discussion brought up the topic of
> multi-register returns.

The IA-64 ABI requires decomposing structures and passing different 
parts in different registers. Gcc internals has no support for 
decomposing structures.  We work around this by forcing the structure 
into memory, so that we can decompose it via multiple load/store 
instructions.  (For gcc internals, this is the PARALLEL argument/return 
stuff.)  This results in ugly inefficient code, but at least it works.

Fixing this is a big destabilizing change to gcc.  We need a way to 
represent decomposed structrures in RTL, and we need improvements to the 
calling convention support so that we can handle decomposed structures. 
efficiently.  I don't know of anyone who is even thinking about how to 
fix this.

Targets that pass/return structures by reference get better code than 
targets that pass/return structures decomposed into registers because of 
this problem.  Unfortunately, most "modern" ABIs decompose structures 
into registers.

Your testcase is the degenerate case where each structure field is 
exactly one register.  Maybe we could have special purpose code to 
handle this efficiently, but the general case would still be badly 
broken.  And I don't know offhand what to do to fix this degenerate case.

Jim



More information about the Gcc mailing list