11.6.1 Register Allocation vs.Assignment

11.6.2 Register Allocation Schemes

11.6.3 Register Allocation by Usage Counts

11.6.4 Register Allocation by Graph Coloring

11.6.5 Register Assignment and Reassignment

11.6.4 Register Management

11.6.5 Register Assignment and Reassignment

Register Allocation prioritizes which variables to be kept in registers

Register Assignment (the other side) Which actual registers to use

May depend on the machine

Registers allocated and then freed

Register spill: when we remove a value we'd really like to keep in a register, but can't

    Small constants

    Stored value same

    Variables and expressions not "live"

    Heuristics

      Algorithm

      Belady's Algorithm adapted for Register Allocation

      If the required value is already in a register, then leave it there.

      Create A Node

      Else if there is an acceptable register, use it

      Else use that register whose value won't be used for the longest time (spill the value)