Re: Argument passing conventions and optimization

Marco van de Voort <marcov@stack.nl>
31 Oct 2003 23:12:05 -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)
Re: Argument passing conventions and optimization bobduff@shell01.TheWorld.com (Robert A Duff) (2003-11-08)
Re: Argument passing conventions and optimization robert.thorpe@antenova.com (Rob Thorpe) (2003-11-11)
Re: Argument passing conventions and optimization nmm1@cus.cam.ac.uk (2003-11-11)
| List of all articles for this month |
From: Marco van de Voort <marcov@stack.nl>
Newsgroups: comp.compilers
Date: 31 Oct 2003 23:12:05 -0500
Organization: Eindhoven University of Technology, The Netherlands
References: 03-10-116
Keywords: code
Posted-Date: 31 Oct 2003 23:12:05 EST

On 2003-10-27, pradeep tumati <ptumati@yahoo.com> wrote:
>
> 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?


I think you need to look for non-C compilers for this? If a compiler
encounters a C function, it can't be sure it is not exported via a
header somewhere, and those headers expect standard C calling
conventions.


So you probably need to look at a language that has functions that
aren't exported outside certain organisational units (private).


Because the compiler then knowns all calling code, it can more rigorously
optimize.


E.g. Pascal's with their local (nested) procedures or unit concept.
(non exported functions in a unit)


> 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.)


No. It might omit generating stackframes for leafpointers with some
-f option.


> 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?


I doubt it.


Post a followup to this message

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