On Fri, Jul 1, 2011 at 11:41 AM, Paulo J. Matos <pocma...@gmail.com> wrote: > On 01/07/11 10:31, Richard Guenther wrote: >> >> It is being done because the edges are not kept up-to-date. There is >> no other way to find callees but to walk all statements. I also do not >> see a good reason why you would want to use the number of callees >> of a function to decide whether to emit sibcalls from it. >> > > Thanks for the input Richard. Makes sense. One way which seems to work is to > obviously add a pass to rebuild the cgraph edges before pass_expand and > remove them afterwards. > > The reason why I need them is that I need know if a given register is live. > I can check this when I expand_epilogue but not during expand (because RA > has not been done). This special register is used for the return address of > a function. So, if it is live it tells me that there was another function > call besides the sibcall. If there was, it means I have to emit some extra > instructions to do the sibcall. However, if I have to emit extra > instructions then I don't actually want to do the sibcall cause I will be > adding to the resulting size of the function which goes against our backend > port policy. > > By checking if there is more than 1 callee (an extra function called besides > the sibcall) then I will know if I will need extra instructions or not and > if I do, I say the function is _not_ ok for sibcall. > > I guess if I don't want to add the extra passes before and after pass expand > then I have to walk the statements. Sounds like it's the cleaner solution if > I don't want to mess with the core.
You could add this logic to the tree-tailcall.c pass. I suppose what you really want is no dominating call rather than only a single call in total. Richard. > Cheers, > -- > PMatos > >