This is the mail archive of the gcc-help@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]

GCC/assembly question


Hi,

I was wondering why in Linux (RH9 - GCC 3.2.2-5 if I have this code:

main(){}

After 'gcc -S -o ex1.s ex1.c' I get:


...

main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
        leave
        ret
...


What is the purpose of:

* subl $8, %esp

There are no variables so why is the stack making space?

* andl $-16, %esp

Is the 16-bit alignment something to do with processor performance?

* movl $0, %eax
  subl %eax, %esp

Wasting time? I know if I pass the -O flag these two will dissapear from
the code.


Are there any documents where this sort of topics are discussed?


Thanks,


Diego.


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