Changes between Version 4 and Version 5 of compiler/carchitecture


Ignore:
Timestamp:
Mar 12, 2010, 5:24:28 PM (9 years ago)
Author:
eamiri
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • compiler/carchitecture

    v4 v5  
    303015.  '''Output''' The abstract syntax tree is translated to the equivalent C code.
    3131
     32
     33== Normalize ==
     34
     35This pass converts the code to three address code and implements common subexpression elimination on the whole program. (This means a variable defined in a previous basic block may be used in another basic block to remove a common subexpression). No common subexpression elimination is done on while loop bodies. This restriction was applied to remove a bug (what was the bug?).
     36
     37Common subexpression elimination is based on comparing RHS of assignment statement. The string representation of RHSs are compared for equality. If string rep. of RHS of an assignment statement is in the predeclared list then the new assignment is removed.
     38
     39Variables declared in the true and false branches of a conditional statement are not used for common subexpression elimination in the outer basic blocks. This is because we don't know which path will be taken in a certain execution of code.
     40
     41For each line of code the boolean logic of RHS is simplified during conversion to three address code.
     42
     43A better design of this pass will have three individual passes.
     44-- Boolean simplification of RHSs.
     45-- Conversion to three address code.
     46-- Optimizations including common subexpression elimination can be done in later in Simplification pass. To keep the current compilation strategy we may do a common subexpression elimination here.
     47
     48 
     49
     50