Prev Up Next
Go backward to Flow graphs and Basic Blocks
Go up to Top
Go forward to The Correctness of LR(0) parsing

Some Implementation Details

  1. When we first encounter a reference to a variable in a basic block, we need to know that it has not been previously assigned a value number.

  2. When we finish processing one block and want to begin another, we need to forget all the value numbers that had been assigned.

  3. Such a list can also reduce the effort required to handle aliasing. When we process an assignment, we can just go through the list of variables to which value numbers have been assigned and un-assign value number associated with possible aliases found in the list.

  4. The whole point of value numbering is to avoid recalculating CSEs. To do this, we have to be able to:
    1. know enough to leave a CSE's value in a temporary after we first compute it, and
    2. find the temporary holding the value when we encounter the CSE again.

  5. To make this easier, we will allocate operand descriptors for expressions while we are value numbering rather than while we are generating code.

  6. Finally, if the value of a CSE is put in a register, we have to know how long it needs to be kept so that we can reuse the register as soon as possible. We will take a very simple approach to this register/temporary allocation problem.

Computer Science 434
Department of Computer Science
Williams College

Prev Up Next