c code CSE(common subexpression elimination) optimization

Diego Novillo dnovillo@google.com
Sat Nov 10 06:22:00 GMT 2007


On Nov 7, 2007 11:55 AM, ldeveloperxl <lgeneral_usel@yahoo.com> wrote:

> I wonder if anybody knows if gcc or any other tools that is able to take a c
> program/source code (or any other high level languages), perform CSE on the
> program, then outputs the optimized program/source code?

GCC does CSE in several passes.  During high-level optimization, it
does local cse using dominator-based optimization, then it does a
global full and partial redundancy elimination.  At the low-level it
performs two CSE passes as well.  You can request dumps from each of
these passes with -fdump-tree-dom -fdump-tree-fre -fdump-tree-pre
-fdump-rtl-cse -fdump-rtl-gcse.

The first three will show you the code in a C-like form (GIMPLE), the
last two will show you a lisp-like representation of RTL (the
low-level IL used by gcc).


Diego.



More information about the Gcc-help mailing list