Class RegisterAllocator
java.lang.Object
EDU.purdue.cs.bloat.codegen.RegisterAllocator
RegisterAllocator performs analysis on a control flow graph and determines
the minimum amount of local variables needed in a method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the maximum number of local variables used by the cfg after its "registers" (local variables) have been allocated.Creates a new local variable in this method (as modeled by the cfg).
-
Constructor Details
-
RegisterAllocator
Constructor. Builds an interference graph based on the expression nodes found in liveness. Traverses the graph and determines which nodes needs to be precolored and which nodes can be coalesced (move statements). Nodes are coalesced and local variables are assigned to expressions.- See Also:
-
-
Method Details
-
maxLocals
public int maxLocals()Returns the maximum number of local variables used by the cfg after its "registers" (local variables) have been allocated. -
newLocal
Creates a new local variable in this method (as modeled by the cfg). Updates the number of local variables appropriately.
-