Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In GCC, what are "tree optimizations" vs "RTL optimizations"?

When I file a bug against GCC about a missed optimization, I am always at a loss whether I should file it under "rtl-optimizations" or "tree-optimizations". I looked at the components page on the GCC bugzilla, and it isn't really explained there.

So, what are these two kinds of optimizations, or rather what distinguishes between them?

like image 366
einpoklum Avatar asked Mar 04 '19 09:03

einpoklum


1 Answers

Partial answer:

The distinction has to do with different internal representations of (semi-compiled) programs within the GCC compiler. This is actually a rather complex issue, but for the purposes of this question:

  • There's a abstact-syntax-tree-based representation called GIMPLE. Some optimization passes are made on this representation; see this list. These are known as Tree Optimizations or Tree-SSA Optimizations.
  • A later and "lower-level" representation is in the Register Transfer Language (or RTL). Other optimization passes are made on this representation, later in the process than the tree optimizations; here's a list of these. These are call RTL optimizations.

That being said, I haven't given an easy rule-of-thumb for distinguishing which optimizations belong where.


For a lot more information, you might want to read the GCC internals guide, where I've found the lists of optimization passes.

like image 94
einpoklum Avatar answered Sep 25 '22 09:09

einpoklum