This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: side effects of the compiler-generated calls
Tobias Schlüter wrote:
David Livshin wrote:
Actually I hoped that as routines from the fortran library, they
might have "simplified" calling convention, e.g. affect less ( then
normal calls ) resources ( registers ). As to the stack pointer,
analyzing the compiler generated code, I didn't see any cases of
stack-adjustment after the calls to these routines - the question is
if I may assume it to be a rule; for what routines is it a rule?
libgfortran is (for the most part) implemented in C, so it uses the C
ABI. I had a quick look through the code to verify that no attributes
which may affect calling conventions are set. I don't think you may
assume anything beyond that.
From the description of your software it looks like you're the
assembly expert, so I may be wrong here, but I assume that you don't
see stack adjustments because as long as the compiler doesn't get
confused, it doesn't have to re-adjust the stack. So instead of doing
push arg
push arg
call f
add %esp, ...
push arg
call g
add %esp, ...
it can omit the first add, using a larger offset in the second add (or
sub, if I misremembered the stack growth direction).
- Tobi
Normally stack cleanup is the responsibility of the caller, and normally
it is not necessary as compiler uses "mov" instructions rather than
"push"es to pass parameters on the stack. So it seems that my question
is not fortran-specific but is more general, related to the gcc calling
conventions.
Thank you for your help and assistance,
David
--
David Livshin
http://www.dalsoft.com