Class InductionVarAnalyzer

java.lang.Object
EDU.purdue.cs.bloat.diva.InductionVarAnalyzer

public class InductionVarAnalyzer extends Object
InductionVarAnalyzer 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.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Displays (to System.out) all of the Swizzlers stored in the induction variable store.
    void
    Displays the contents of a Swizzler object to System.out.
    get_local(int vn)
    Searchs the stored list of local variables for a local variable with a given value number.
    get_swizzler(int vn)
    Searches the list of induction variables for an induction variable with a given value number.
    void
    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.
    Determines whether or not a phi statement is a mu function.
    void
    Performs DIVA on a CFG.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEBUG

      public static boolean DEBUG
  • Constructor Details

    • InductionVarAnalyzer

      public InductionVarAnalyzer()
  • Method Details

    • get_swizzler

      public 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:
    • 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 function
      cfg - 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.