Re: where can I get gcc optimizations information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Juan Castillo writes:
>  > I need some help with gcc optimizations and I don't know where I
>  > can get it.
>  >
>  > The objective of my work is to estimate how many machine
>  > instructions I can save in a program execution employing compiler
>  > optimizations. I am working with ARM architecture. Anyway, I have
>  > understood that main gcc optimizations are
>  > architecture-independent.
>  >
>  > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3
>  > and -Os activate different optimization flags (starting with "-f",
>  > I think), but not all of them are available individually. If I
>  > switch on all flags available individually for -O1 (-fdefer-pop,
>  > -fmerge-constants...) they have no effect in obtained machine code,
>  > but if I compile with -O1 option, there is a reduction of about 50%
>  > in machine instructions number with respect to basic compilation.
>  >
>  > With these results, I suppose that -O1 performs more actions that
>  > are not reported in any document I have found in The Internet. I
>  > have downloaded the gcc source-code but it is too difficult for me
>  > to understand it. My question is: where can I get full information
>  > about gcc optimizations and how they are performed?
>
> Full information is in the source.  As Euclid (or someone else!) may
> once have said, "There is no royal road to mathematics".  If you are
> really to understand, you'll have to get in there some time.
>
> However, some things will help you.  -fverbose-asm produces a list of
> optimization passes.  The dumps "-da" and "-fdump-tree-all" produce a
> lot of files, one per optimization pass, so you can see what each pass
> did.  Once you know which pass does what, you can start to look at the
> code.
>
Thanks for your answer.
When using "-fverbose-asm" flag in the commmand line to produce the list of 
optimization passes, I suppose you mean adding the "-S" flag to see the 
assemble file, don't you? I say this because using the flag in a common 
compilation doesn't produce any change.

Anyway, taking a look at the assemble file, I can see the flags employed when 
I compile with -O1 option, but if I introduce them all in the command line 
instead of -O1 (it is supposed that the executable file would be the same), 
optimizations are not performed. What am I doing wrong? I have read source 
code and -O1 flag activates some other flags and it seems it does not any 
more.

>  > And another question: would be possible to get a benchmark or
>  > similar for compiler optimizations? That is, some set of programs
>  > that estimate the save that a compiler can achieve. I know it
>  > depends on the algotihms compiled, employed architecture and more
>  > (please, don't remember me that...). I just need an
>  > estimation. That would be great for my work.
>
> SPEC is a standard, but it's unfree and therefore off-topic here.
>
> Andrew.

Thank you very much.

--------------------------------------------------------------------
Juan Castillo
Microelectronics Engineering Group.     Dep. TEISA
University of Cantabria. Spain. E-mail: castillo@xxxxxxxxxxxxxxx
--------------------------------------------------------------------

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux