This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

not using push by gcc


Dear gcc developer,

I have a code like this:

#include <stdio.h>
void foo(int x)
{
  int y;
  x++;
  y = 4;
}
int main(void)
{
  foo(2);
  return 0;
}

and compiled with "gcc -o outexec srcfile.c" command.
when disassemble the file we see that sending argument to function
"foo" is done by

--------------------------------------
sub     esp, 4
mov     dword ptr [esp], 2
call    foo
--------------------------------------

instructions. why gcc doesn't use the "push" command like:

--------------------------------------
push 2
call    foo
--------------------------------------

?

Sincerely.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]