optimization options not working

Ian Lance Taylor iant@google.com
Tue Feb 23 18:19:00 GMT 2010


rohitgeek <rohit23taneja@gmail.com> writes:

> 1. Created the machine description files
> 2. Build my target (successful)
> 3. Compile 
>        Now this step works correctly i.e. generate correct assembly if i do
> not put any optimization option.
>    
>      command : ----    ./target-gcc -S test.c     -> works
>                               ./target-gcc -O1/2/3 -S test.c    -> no
> assembly corresponding to the variable assignment and all other operations
> i.e. it generates only prologue and epilogue(if i am correct for later
> part).

You didn't show us test.c.  You have to tell us what you did if you
expect a good answer to your question.

Without seeing test.c, I would guess that the variables are not used,
and were removed by the optimizers.


> Give me some insight into working of peephole optimizations, how do i start
> doing that.

Peephole optimization is a specific type of optimization.  See
define_peephole and define_peephole2 in the internals documentation.
See many examples in the existing backends.


Ian



More information about the Gcc-help mailing list