Take a look at llvm-gcc. Look for HandleAggregateShadowArgument. Evan On Mar 26, 2008, at 10:31 AM, Óscar Fuentes wrote:> Óscar Fuentes <ofv at wanadoo.es> writes: > >> BTW, -fpcc-struct-return solves the case that motivated this thread. > > -fpcc-struct-return is an ABI change, hence it requires "compiling the > world". Not acceptable. > > I'll be interested on hearing ideas about how to determine how a > function returns a small struct, without knowing the internals of the > struct. > > -- > Oscar > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
I should note this how we do it today but it may not be the solution long term. In an ideal world the llvm frontend will not need to know anything about the target since llvm is intended as a virtual instruction set. Evan On Mar 26, 2008, at 11:42 AM, Evan Cheng wrote:> Take a look at llvm-gcc. Look for HandleAggregateShadowArgument. > > Evan > > On Mar 26, 2008, at 10:31 AM, Óscar Fuentes wrote: > >> Óscar Fuentes <ofv at wanadoo.es> writes: >> >>> BTW, -fpcc-struct-return solves the case that motivated this thread. >> >> -fpcc-struct-return is an ABI change, hence it requires "compiling >> the >> world". Not acceptable. >> >> I'll be interested on hearing ideas about how to determine how a >> function returns a small struct, without knowing the internals of the >> struct. >> >> -- >> Oscar >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Evan Cheng <evan.cheng at apple.com> writes:>> I'll be interested on hearing ideas about how to determine how a >> function returns a small struct, without knowing the internals of the >> struct.> Take a look at llvm-gcc. Look for HandleAggregateShadowArgument.This does not qualify as "without knowing the internals of the struct" :-) DefaultABI::HandleReturnType made an interesting reading, although it uses information which is unaccessible to my compiler. -- Oscar
On Mar 26, 2008, at 3:09 PM, Óscar Fuentes wrote:> Evan Cheng <evan.cheng at apple.com> writes: > >>> I'll be interested on hearing ideas about how to determine how a >>> function returns a small struct, without knowing the internals of >>> the >>> struct. > >> Take a look at llvm-gcc. Look for HandleAggregateShadowArgument. > > This does not qualify as "without knowing the internals of the struct" > :-) > > DefaultABI::HandleReturnType made an interesting reading, although it > uses information which is unaccessible to my compiler.Which calling convention to use depends on the contents of the struct. You cannot make all cases work without that information.