scale.score.dependence
Class DDNormalEdge

java.lang.Object
  extended by scale.score.dependence.DDEdge
      extended by scale.score.dependence.DDNormalEdge

public final class DDNormalEdge
extends DDEdge

This class represents a set of dependence edges from one source to one sink in the data dependence graph.

$Id: DDNormalEdge.java,v 1.20 2007-10-04 19:58:24 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

See Also:
DDEdge, DDTransEdge, DataDependence, DDGraph, DDInfo

Field Summary
 
Fields inherited from class scale.score.dependence.DDEdge
cAnti, cFlow, cInput, cNone, colors, cOutput, dependenceName, lineType
 
Constructor Summary
DDNormalEdge(SubscriptExpr src, SubscriptExpr sink, long[] ddinfo, java.lang.String aname, boolean spatial)
          Create an edge for the data dependence graph.
 
Method Summary
 boolean contains(SubscriptExpr exp)
          Return true if the expression is an end of an edge represented by this instance.
static int created()
          Return the number of instances of this class that were created.
 boolean forLoop(LoopHeaderChord loop)
          Return true if this edge has a source or sink in the specified loop.
 java.lang.String format(Note s1, Note s2, java.lang.String aname, int ddtype)
          Return a string representation of a data dependence edge.
 long[] getDDInfo()
          Return the computed data dependence information.
 int getDistance(int level)
          Return the distance for the specified level.
 int getEdgeType(Note source, Note sink)
          Return the data dependence type - flow, anti, input, or output.
 void getEnds(Vector<Note> v)
          Add the SubscriptExpr instances, that are the edge ends, to the Vector.
 int getLevel()
          Return the level of dependence.
 SubscriptExpr getSink()
          Return the sink end of the edge.
 SubscriptExpr getSource()
          Return the source end of the edge.
 void graphDependence(DisplayGraph da, boolean addChord, HashSet<Note> nodes, DDGraph graph)
          Create a graphic display of the edges represented by this instancce.
 boolean isAnyDistanceKnown()
          Return true if the distance is known at any level.
 boolean isAnyDistanceNonZero()
          Return true if any distance is unknown or not zero at any level.
 boolean isAnyDistanceNotKnown()
          Return true if the distance is not known at any level.
 boolean isDistanceKnown(int level)
          Return true if the distance is known at the specified level.
 boolean isLoopIndependentDependency()
          Return true if the edge is loop-independent dependency.
 boolean isTransitive()
          Return true if this is a transitive edge set.
 java.util.Iterator<SubscriptExpr> iterator()
          Return an iterator over the SubscriptExpr instances that are the edge ends.
 int numberEdges()
          Return a metric for the number of data dependence edges represented.
 void printDDInfo(Note s1, Note s2)
          Print to stdout the information about the data dependence.
 boolean representsAllInput()
          Return true if every edge represented is an input edge.
 java.lang.String toString()
           
 
Methods inherited from class scale.score.dependence.DDEdge
getArrayName, getNodeID, isSpatial
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DDNormalEdge

public DDNormalEdge(SubscriptExpr src,
                    SubscriptExpr sink,
                    long[] ddinfo,
                    java.lang.String aname,
                    boolean spatial)
Create an edge for the data dependence graph. The creater of the edge must guarantee that src precedes sink.

Parameters:
src - is the one end of the edge
sink - is the other end of the edge
ddinfo - is the computed data dependence information
aname - is the name of array (or scalar) involved in the dependence
spatial - is true if the edge records a spatial dependence
See Also:
DataDependence, DDGraph
Method Detail

created

public static int created()
Return the number of instances of this class that were created.


getSource

public SubscriptExpr getSource()
Return the source end of the edge.


getSink

public SubscriptExpr getSink()
Return the sink end of the edge.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

iterator

public java.util.Iterator<SubscriptExpr> iterator()
Return an iterator over the SubscriptExpr instances that are the edge ends.

Specified by:
iterator in class DDEdge

contains

public boolean contains(SubscriptExpr exp)
Return true if the expression is an end of an edge represented by this instance.

Specified by:
contains in class DDEdge

representsAllInput

public boolean representsAllInput()
Return true if every edge represented is an input edge.

Specified by:
representsAllInput in class DDEdge

getEnds

public void getEnds(Vector<Note> v)
Add the SubscriptExpr instances, that are the edge ends, to the Vector.

Specified by:
getEnds in class DDEdge

numberEdges

public int numberEdges()
Return a metric for the number of data dependence edges represented. This is the number of edge end points - 1.

Specified by:
numberEdges in class DDEdge

getDDInfo

public long[] getDDInfo()
Return the computed data dependence information.

Specified by:
getDDInfo in class DDEdge

isLoopIndependentDependency

public boolean isLoopIndependentDependency()
Return true if the edge is loop-independent dependency.

Specified by:
isLoopIndependentDependency in class DDEdge

getDistance

public int getDistance(int level)
Return the distance for the specified level.

Specified by:
getDistance in class DDEdge

isDistanceKnown

public boolean isDistanceKnown(int level)
Return true if the distance is known at the specified level.

Specified by:
isDistanceKnown in class DDEdge

isAnyDistanceKnown

public boolean isAnyDistanceKnown()
Return true if the distance is known at any level.

Specified by:
isAnyDistanceKnown in class DDEdge

isAnyDistanceNotKnown

public boolean isAnyDistanceNotKnown()
Return true if the distance is not known at any level.

Specified by:
isAnyDistanceNotKnown in class DDEdge

isAnyDistanceNonZero

public boolean isAnyDistanceNonZero()
Return true if any distance is unknown or not zero at any level.

Specified by:
isAnyDistanceNonZero in class DDEdge

isTransitive

public boolean isTransitive()
Return true if this is a transitive edge set.

Specified by:
isTransitive in class DDEdge

getEdgeType

public int getEdgeType(Note source,
                       Note sink)
Return the data dependence type - flow, anti, input, or output. This logic assumes that the s1 precedes the s2. The source and sink must the uses of the addresses represented by the SubscriptExpr instances that are the ends of the data dependence edge.

Specified by:
getEdgeType in class DDEdge
See Also:
DDGraph, DataDependence

printDDInfo

public void printDDInfo(Note s1,
                        Note s2)
Print to stdout the information about the data dependence.

Specified by:
printDDInfo in class DDEdge

format

public java.lang.String format(Note s1,
                               Note s2,
                               java.lang.String aname,
                               int ddtype)
Description copied from class: DDEdge
Return a string representation of a data dependence edge.

Specified by:
format in class DDEdge
Parameters:
s1 - is one end of the edge
s2 - is another end of the edge
aname - is the array name
ddtype - is the edge type

graphDependence

public void graphDependence(DisplayGraph da,
                            boolean addChord,
                            HashSet<Note> nodes,
                            DDGraph graph)
Create a graphic display of the edges represented by this instancce.

Specified by:
graphDependence in class DDEdge
Parameters:
da - is the graph display
addChord - is true if the ends of each edge should be added to the nodes set
nodes - is the set of

forLoop

public boolean forLoop(LoopHeaderChord loop)
Return true if this edge has a source or sink in the specified loop.

Specified by:
forLoop in class DDEdge

getLevel

public final int getLevel()
Return the level of dependence.