|
From: Bryan M. <om...@br...> - 2006-08-28 12:58:34
|
Julian Seward wrote: >> Would it be acceptable to determine the compiler version at compile time >> and insert/remove code sections based upon it? > > I don't think that would be a robust assumption in practice. Not only > that, but gcc isn't the only compiler in the universe; icc is quite > widely used for one. > > What is it about the particular stack handling of different gccs that > makes a difference for you? > > J > Julian, I am aware of icc but don't have access to it - it would also have to be taken into account though. The main difference is the amount of stack manipulation that occurs: the old version tends to move the stack pointer around piecemeal as it needs to. The newer version moves the sp at the top of the function then typically leaves it alone. This is also evident in the use of push in the old verses mov (%esp) in the new. Looking at the two programs side by side, I think the real crux of it is the differing epilog code. I think I am falling over trying to detect when there is a value being returned through the accumulator. I need to know this as the accumulator should be ignored if it isn't being used to return anything, possibly generating a leak report at function exit. Is there a robust method of determining if a function returns a value (and in which register(s))? Bryan |