Argument passing conventions and optimization

pradeep tumati <ptumati@yahoo.com>
27 Oct 2003 16:08:13 -0500

          From comp.compilers

Related articles
Argument passing conventions and optimization ptumati@yahoo.com (pradeep tumati) (2003-10-27)
Re: Argument passing conventions and optimization derkgwen@HotPOP.com (Derk Gwen) (2003-10-31)
Re: Argument passing conventions and optimization fjh@cs.mu.oz.au (Fergus Henderson) (2003-10-31)
Re: Argument passing conventions and optimization marcov@stack.nl (Marco van de Voort) (2003-10-31)
Re: Argument passing conventions and optimization nmm1@cus.cam.ac.uk (2003-11-01)
Re: Argument passing conventions and optimization ptumati@yahoo.com (pradeep tumati) (2003-11-02)
Re: Argument passing conventions and optimization nmm1@cus.cam.ac.uk (2003-11-08)
[3 later articles]
| List of all articles for this month |
From: pradeep tumati <ptumati@yahoo.com>
Newsgroups: comp.compilers
Date: 27 Oct 2003 16:08:13 -0500
Organization: Compilers Central
Keywords: code, question, optimize, comment
Posted-Date: 27 Oct 2003 16:08:13 EST

Hello Everyone,


In general whenever a function calls another function, it passes
arguments by pushing the values onto the stack. Similarly, when a
called function returns a value, it either pushes the value onto the
stack or puts the return value in one of the registers (dpending on
the compiler). Of course, this also depends on the processor that we
are looking at.


Now, assuming that we are using GCC 3.2.x (x86, linux) does the
following situation ever arise?


Do we ever get a situation where one of the GCC optimizations changes
the argument passing mechanism?


For example, if I compile the C code using the -O0 (no optimization)
option, and say it generates the argument passing/return code by using
the standard calling convention of that platform. Now, if I compile
the same program with -O2 option on the same platform, do I get a
situation where the argument passing/return mechanism is changed all
together in the newly generated code? (I tried many cases, but this
never happened as yet. I am not sure if this happens or not.)


My question is: Does any of the known compiler (inter procedural)
optimizations which are in usage modify the standard argument passing
mechanism? Do I get a situation where I get two different argument
passing/ return mechanisms when I compile a program with no
optimization and Full optimization?


Thanks for you time.


Warm Regards,
Pradeep Tumati
[Other than inlining, I don't recall ever seeing an optimization that
affected the calling sequence. On architectures with more registers
than the x86, most arguments are passed in registers so it's less of
an issue. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.