Package EDU.purdue.cs.bloat.tree
Class StackOptimizer
- java.lang.Object
-
- EDU.purdue.cs.bloat.tree.StackOptimizer
-
public class StackOptimizer extends java.lang.ObjectStackOptimizer analyzes the relative distances of various uses of the same definition of a local variable to add dups and swaps to the bytecode and eliminate loads and stores.
-
-
Constructor Summary
Constructors Constructor Description StackOptimizer(Block owningBlock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdup_x1s(LocalExpr expr)intdup_x2s(LocalExpr expr)intdups(LocalExpr expr)voidinfoDisplay(LocalExpr expr)booleanonStack(LocalExpr expr)voidoptimize()Optimize runs the algorithm for analyzing the tree, looking for opportunities to replaces stores and loads with dups and swaps.static voidoptimizeCFG(FlowGraph cfg)booleanshouldStore(LocalExpr expr)Various methods used by CodeGenerator, used as an interface into the information in defInfoMap and useInfoMapbooleanshouldSwap(LocalExpr expr)
-
-
-
Constructor Detail
-
StackOptimizer
public StackOptimizer(Block owningBlock)
-
-
Method Detail
-
optimizeCFG
public static void optimizeCFG(FlowGraph cfg)
-
optimize
public void optimize()
Optimize runs the algorithm for analyzing the tree, looking for opportunities to replaces stores and loads with dups and swaps. It initiates several visitors, and information is sotred in defInfoMap and useInfoMap
-
shouldStore
public boolean shouldStore(LocalExpr expr)
Various methods used by CodeGenerator, used as an interface into the information in defInfoMap and useInfoMap
-
dups
public int dups(LocalExpr expr)
-
dup_x1s
public int dup_x1s(LocalExpr expr)
-
dup_x2s
public int dup_x2s(LocalExpr expr)
-
onStack
public boolean onStack(LocalExpr expr)
-
shouldSwap
public boolean shouldSwap(LocalExpr expr)
-
infoDisplay
public void infoDisplay(LocalExpr expr)
-
-