On Tue, Nov 11, 2008 at 04:32:21PM -0800, Le Ton Chanh wrote: > I want to design a backend on GCC which has following feature: The functions > which have the attribute "pass_in_reg" (the attribute I defined) will pass > their arguments in registers; otherwise, they will pass arguments in stack. > Now I can do that, but the callee functions don't know the position of > arguments passing from caller exactly, it's wrong. Does GCC support to do > that? Can anyone help me? Thanks in advance. > > Le Ton Chanh > email:letonchanh at yahoo dot com Several ports support this already. For example, the i386 port provides "regparm" where you can say how many arguments are passed in registers. If you have alternate calling sequences, your users should have the appropriate prototypes for the function before any calls, references, or the definition. You have to define the appropriate stuff in the back end function handling stuff (FUNCTION_ARG_...) to make sure the caller and callee are consistant. -- Michael Meissner, IBM 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA meissner@xxxxxxxxxxxxxxxxxx