public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC optimizations..
@ 2010-02-12 16:36 joshuamcdo
  2010-02-13  1:52 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: joshuamcdo @ 2010-02-12 16:36 UTC (permalink / raw)
  To: gcc-help


  I have been reading, and not found what I am searching for.

 Is there a way to tell gcc to output what it doing related to
optimizations?  I know PGI does this, and it would be really nice if GCC
supported this as well.

 Thanks,
 Joshua

-- 
View this message in context: http://old.nabble.com/GCC-optimizations..-tp27566000p27566000.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GCC optimizations..
  2010-02-12 16:36 GCC optimizations joshuamcdo
@ 2010-02-13  1:52 ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2010-02-13  1:52 UTC (permalink / raw)
  To: joshuamcdo; +Cc: gcc-help

joshuamcdo <jmcdowell@redfeather-tech.com> writes:

>  Is there a way to tell gcc to output what it doing related to
> optimizations?  I know PGI does this, and it would be really nice if GCC
> supported this as well.

Yes and no.  You can a great deal of detail from the -fdump-ipa-all,
-fdump-tree-all, and -fdump-rtl-all options.  However, the amount of
detail considered as a whole is rather overwhelming.  There is no
concise optimization output.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc optimizations
       [not found] <Pine.SOL.4.10.10106181638160.11508-100000@onyx>
@ 2001-06-18 15:09 ` Matt Hiller
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Hiller @ 2001-06-18 15:09 UTC (permalink / raw)
  To: Fuat Oezdemir; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2787 bytes --]

Hello,

	To get a better idea of the exact methods that gcc is using to
optimize your code, I would recommend running gcc with -dap. This will
produce a number of debugging dumps each of which describe the internal
representation of your program that gcc has arrived at after each pass of
the compiler. It will also annotate your .s file with summaries of where
each machine instruction came from.

	Please consult the gcc manual for more details on this. In
particular, you'll want to familiarize yourself with gcc's Register
Transfer Language (RTL); the debugging dumps I describe are in RTL's
textual form.

-- 

Matt Hiller
GCC Engineer, Red Hat, Inc., Sunnyvale office
hiller@redhat.com

On Mon, 18 Jun 2001, Fuat Oezdemir wrote:

> 
> Hello,
> 
> I am an beginner with optimizing techniques from gcc. I have an example
> code  compiled with the gcc (v. egcs-2.91.57) with options 
> 
> -S 	generate assembler code
> and alternately
> -O0	no optimizing
> -O3	full optimizing.
> 
> My problem is, that I don't know which of the optimization options are the
> reason for the optimization. I tried the option -fverbose-asm of gcc. With
> this option the compiler includes, which optimization options are enabled,
> if I take the -O3 option. I tried it again with the enabled options
> without the -O3 option but in this case the compiler doesn't optimize.
> Is there anybody, who is be able to give an answer or an pointer to this
> problem.
> 
> Thank you very much in advance.
> 
> Fuat Özdemir
> 
> 
> The source code looks like this :
> 
> #include <stdio.h>
> 
> int main () {
> 
>  int a=0, b=0, zero=120;
> 
>    if(zero >= 50) {
> 
>      a=10;
> 
>    } else if (zero >= 100) { 		// unreachable !!
> 
>      b=20;
> 
>    }
> 
>    printf("a = %d   b = %d\n", a, b);
> 
>   return 1;
> }
> 
> 
> The else-if part is unreachable because zero is set to 120 and the first
> if-expression is always true.
> 
> The result of gcc with -O3 option is the following :
> 
> .file "test.c"
> gcc2_compiled.:
> ___gnu_compiled_c:
>    .def  ___main; .scl  2; .type 32;   .endef
> .text
> LC0:
>    .ascii "a = %d   b = %d\12\0"
>    .align 4
> .globl _main
>    .def  _main;   .scl  2; .type 32;   .endef
> _main:
>    pushl %ebp
>    movl %esp,%ebp
>    call ___main
>    pushl $0
>    pushl $10
>    pushl $LC0
>    call _printf
>    movl $1,%eax
>    movl %ebp,%esp
>    popl %ebp
>    ret
>    .def  _printf; .scl  2; .type 32;   .endef
> 
> 
> I am not sure about approach of every assembler command, but it looks like
> so, that the content of the main-function is optimized to one
> printf-function and the values of the variable 'a' to 10 and 'b' to 0. 
> 
>  
> --------------------------------------------------------------
> 
> E-Mail : fuat@cs.tu-berlin.de
>           
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-13  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-12 16:36 GCC optimizations joshuamcdo
2010-02-13  1:52 ` Ian Lance Taylor
     [not found] <Pine.SOL.4.10.10106181638160.11508-100000@onyx>
2001-06-18 15:09 ` gcc optimizations Matt Hiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).