Package EDU.purdue.cs.bloat.diva
Class InductionVarAnalyzer
- java.lang.Object
-
- EDU.purdue.cs.bloat.diva.InductionVarAnalyzer
-
public class InductionVarAnalyzer extends java.lang.ObjectInductionVarAnalyzer traverses a control flow graph and looks for array element swizzle operations inside loops. If possible, these swizzle operations are hoisted out of the loop and are replaced with range swizzle operations. The technique used is Demand-driven Induction Variable Analysis (DIVA).To accomplish its tasks, InductionVarAnalyzer keeps track of a number of induction variables (represented by Swizzler objects) and local variables.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUG
-
Constructor Summary
Constructors Constructor Description InductionVarAnalyzer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidDisplay_store()Displays (to System.out) all of the Swizzlers stored in the induction variable store.voiddisplaySwizzler(Swizzler indswz)Displays the contents of a Swizzler object to System.out.MemExprget_local(int vn)Searchs the stored list of local variables for a local variable with a given value number.java.lang.Objectget_swizzler(int vn)Searches the list of induction variables for an induction variable with a given value number.voidinsert_aswrange(Swizzler indswz)Adds a swizzle range statement (SRStmt) to the end of each predacessor block of the block containing the phi statement that defines an induction variable provided that the phi block does not dominate its predacessor.BlockisMu(PhiJoinStmt phi, FlowGraph cfg)Determines whether or not a phi statement is a mu function.voidtransform(FlowGraph cfg)Performs DIVA on a CFG.
-
-
-
Method Detail
-
get_swizzler
public java.lang.Object get_swizzler(int vn)
Searches the list of induction variables for an induction variable with a given value number.- Parameters:
vn- Value number to search for.- Returns:
- Swizzler object whose target has the desired value number or null, if value number is not found.
-
get_local
public MemExpr get_local(int vn)
Searchs the stored list of local variables for a local variable with a given value number.- Parameters:
vn- The value number to search for.- Returns:
- The local variable with the given value number, or null, if not found.
-
Display_store
public void Display_store()
Displays (to System.out) all of the Swizzlers stored in the induction variable store.- See Also:
Swizzler
-
displaySwizzler
public void displaySwizzler(Swizzler indswz)
Displays the contents of a Swizzler object to System.out.- Parameters:
indswz- The Swizzler to display.
-
insert_aswrange
public void insert_aswrange(Swizzler indswz)
Adds a swizzle range statement (SRStmt) to the end of each predacessor block of the block containing the phi statement that defines an induction variable provided that the phi block does not dominate its predacessor. Phew.- Parameters:
indswz- Swizzler representing the induction variable on which the range swizzle statement is added.
-
isMu
public Block isMu(PhiJoinStmt phi, FlowGraph cfg)
Determines whether or not a phi statement is a mu function. A mu function is a phi function that merges values at loop headers, as opposed to those that occur as a result of forward branching. Mu functions always have two arguments.- Parameters:
phi- phi statement that may be a mu functioncfg- CFG to look through Get rid of this parameter- Returns:
- The block containing the mu functions external (that is, outside the loop) argument, also known as the external ssalink. If the phi statement is not a mu function, null is returned.
-
transform
public void transform(FlowGraph cfg)
Performs DIVA on a CFG.
-
-