The Middle-End of GCC performs SSA based optimizations on GIMPLE, then converts the GIMPLE to RTL and does more optimizations. Finally it hands it off the optimized RTL to the BackEnd.

Work has started on performing Interprocedural_optimizations in GCC. See also the ipa-branch and the -fwhole-program compilation flag (useful when passing a whole program source as several compilation units passed together to the compiler).

middle end passes

The following passes are done on the GIMPLE SSA representation. We are supposing -O2 optimization level (and perhaps more, even -fwhole-program)

See chapter 8 Tree-SSA passes of the GCC internal documentation for an overview

please check and complete this list

  1. Many passes are working on trees before the SSA, in particular for the call flow graph (the pass_build_cfg is building it in file gcc/tree-cfg.c) and tree inlining (pass_ipa_inline in file gcc/ipa-inline.c)

  2. the pass_build_ssa (in file gcc/tree-into-ssa.c) is building the SSA representation

  3. the pass_lower_vector and pass_lower_vector_ssa (file gcc/tree-vect-generic.c) are expanding vector to scalar operations (???)

  4. The pass_may_alias and pass_alias (invoked several times, from gcc/tree-ssa-alias.c) computes may-alias information

  5. The pass_return_slot (from gcc/tree-nrv.c) implements return value optimizations for functions which return aggregate types

  6. The pass_rename_ssa_copies (from gcc/tree-ssa-copyrename.c) implements the SSA copy renaming phase

  7. The pass_fre (from gcc/tree-ssa-pre.c) makes some full redunduncy elimination (?)

  8. The pass_ccp and pass_store_ccp and pass_fold_builtins (from gcc/tree-ssa-ccp.c) are for conditional constant propagation

  9. The pass_dce (from gcc/tree-ssa-dce.c) for dead code elimination

  10. The pass_forwprop (from gcc/tree-ssa-forwprop.c, invoked several times) for forward propagation of expressions for single use variables

  11. The pass_copyprop and pass_store_copy_prop (from gcc/tree-ssa-copy.c) is the copy propagator

  12. The pass_merge_phi (from gcc/tree-cfgcleanup.c) is a merging CFG cleanup

  13. The pass_vrp (from gcc/tree-vrp.c) is for value range propagation

  14. The pass_dce (in gcc/tree-ssa-dce.c) is dead code elimination on SSA

  15. The pass_dominator and pass_phi_only_cprop (both in gcc/tree-ssa-dom.c, invoked several times) implement optimizations on the dominator tree.

  16. The pass_phiopt (in gcc/tree-ssa-phiopt.c) optimizes PHI nodes by converting them into straightline code

  17. The pass_tail_recursion and pass_tail_calls (in gcc/tree-tailcall.) handle tail calls and recursions

  18. The pass_profile (in gcc/predict.c) does branch prediction and profiling

  19. The pass_ch (in gcc/tree-ssa-loop-ch.c) is for loop header copying

  20. The pass_lower_complex and pass_lower_complex_O0 (in gcc/tree-complex.c) lower complex number operations to scalar operations

  21. The pass_sra (in gcc/tree-sra.c) is for scalar replacement of aggregates (by converting some structure references to scalar references)

  22. The pass_rename_ssa_copies (in gcc/tree-ssa-copyrename.c) implements the SSA copy renaming phase

  23. The pass_reassoc (in gcc/tree-ssa-reassoc.c) is a simple (arithmetic) reassociation pass

  24. The pass_dse (in gcc/tree-ssa-dse.c) does dead store elimination

  25. The pass_object_sizes (in gcc/tree-object-size.c) does builtin object size computation

  26. The pass_split_crit_edges (in gcc/tree-cfg.c) splits critical edges in the control flow graph


The tree_folder is also considered part of the middle-end, but the FrontEnds use it for constant folding also.

None: MiddleEnd (last edited 2008-01-10 19:38:37 by localhost)