wiki:compiler/tnotes

Version 3 (modified by eamiri, 9 years ago) (diff)

--

This file includes short notes related to the current version of the compiler.

Conversion to SSA

1- The body of a while loop is not converted to SSA. 2- Variables defined inside true branch or false branch of a conditional statement may be defined in the other branch of the same conditional statement, too. This is based on the observation that two branches of one conditional statement are the same, except that one is optimized.


Optimize Pragma

1- The location of Optimize pragma inside the program does not change its semantics. 2- The code that is optimized by the pragma starts from the first line after the last definition of the optimized variable through end of the program.


Dead Code Elimination

1- A common subexpression elimination must be called after the end of dead code elimination to remove common subexpressions introduced by remove_copies()


While Loop and Optimize interaction

1- If Optimize is called on a variable whose last definition is inside the body of a loop, the corresponding if-then-else will start right after that while loop.

2- Optimize cannot be used for a loop variable.


Abstract Syntax Tree

1- An idea: Keep the internal representation of the program in the compiler consistent with Python as long as possible. This allows us to use tools developed for Python.


Performance of the Compiler

1- Currently the a seriously time consuming operation in the compiler is copy.deepcopy(). All invocations of copy.deepcopy() must be check and all unnecessary ones must be removed.