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]

Re: regarding optimization options in phase ordering


Thanx Ian,

My question is as follwos

We've a problem here. we were trying to use cc1 with & without -O option to
verify the optimizations happening in our sample code. 
the sample code is given below
file name : 1.c
 #include
 int main() 
{ int a=5; 
int b; 
b=a; 
printf("the number is :%d",b); }
Here, in 1.c.026t.copyrename1, we get the following output

1.c.026t.copyrename1
 ;; Function main (main) 
main ()
 { int b; int a; : a_2 = b_1(D); return; }
 but in 1.c.027t.ccp1, the output does not contain the actual assignment
b=a. 
;; Function main (main)
 main () 
{ int b; int a; : return; }
 We want to know, without b=a, how is it generating the following final code
for b=a 
pushl   %ebp
>         movl    %esp, %ebp
>         andl    $-16, %esp
>         subl    $16, %esp
>         movl    $5, 4(%esp)
>         movl    $.LC0, (%esp)
>         call    printf
Kindly help 















> thanks, But b=a is a assignment statement. It is doing some memory
> operations
> isn't it. Assuming b=a is a dead statement, how r the following i386
> assembly statements generated
>  pushl   %ebp
>         movl    %esp, %ebp
>         andl    $-16, %esp
>         subl    $16, %esp
>         movl    $5, 4(%esp)
>         movl    $.LC0, (%esp)
>         call    printf

The first four statements set up the stack.  The last three do the
printf statement.

What is your real question?

Ian



-- 
View this message in context: http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24898021.html
Sent from the gcc - Dev mailing list archive at Nabble.com.


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