wiki:compiler/tnotes

Version 6 (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.


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.


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.



Problems in the Current Architecture

1- A common subexpression elimination must be called after the end of dead code elimination to remove common subexpressions introduced by remove_copies() 2- Symbol tables requires better design. Sometimes we need to collapse while loop and do not count it's body, and sometime we need to expand this. Also currently we construct symbol table twice in the code. One for SSA and one for basic block creation. We need to construct the symbol table just once, so that it responds to both queries. 3- The code in normalize does three tasks: conversion to three address code, simplification using boolean algebra and common subexpression elimination. The three must be separated. At least the last two should become independent components.