scale.score.pp
Class PPSupergraphBlock

java.lang.Object
  extended by scale.common.Root
      extended by scale.score.pp.PPBlock
          extended by scale.score.pp.PPSupergraphBlock
All Implemented Interfaces:
AnnotationInterface, DisplayNode

public class PPSupergraphBlock
extends PPBlock

Represents the fake supergraph basic blocks SUPERBEGIN and SUPEREND, which are connected to the BEGIN and END, respectively, of each CFG. This class should not be needed for developing path-guided optimizations.

$Id: PPSupergraphBlock.java,v 1.5 2007-10-04 19:53:37 burrill Exp $

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


Field Summary
static int SUPERBEGIN
          Represents that this supergraph block is SUPERBEGIN.
static int SUPEREND
          Represents that this supergraph block is SUPEREND.
 
Constructor Summary
PPSupergraphBlock(int type, java.util.List<PPCfg> cfgs)
           
 
Method Summary
 void addAllInEdges(java.util.AbstractCollection<PPEdge> list)
          Add all incoming edges to the specified collection.
 void addAllOutEdges(java.util.AbstractCollection<PPEdge> list)
          Add all outgoing edges to the specified collection.
 boolean addInEdge(PPEdge edge)
          Add the edge to the incoming edges.
 boolean addOutEdge(PPEdge edge)
          Add the edge to the outgoing edges.
 boolean equals(java.lang.Object o)
          Two supergraph blocks are the same if they have the same type.
 Chord firstChord()
          Get the first Chord of this block.
 double getAvgTripCount()
          Get the average trip count for a loop.
 long getBranchEdgeFrequency()
          Return the outgoing branch edge frequency.
 PPCfg getCfg()
          Return the path profiling CFG representation that this block is part of.
 PPEdge getHighestOutEdge(long pathNum)
          Return the outgoing edge with the highest increment.
 PPEdge getInEdge(int i)
          Return the specified incoming edge.
 long getInEdgeFrequency()
          Return the incoming edge frequency.
 long getNumPaths()
          Return the number of paths for this block.
 PPEdge getOutEdge(int i)
          Return the specified outgoing edge.
 long getOutEdgeFrequency()
          Return the outgoing edge frequency.
 int hashCode()
          The hash code for a supergraph block is based on its type.
 boolean hasInEdges()
          Return true if there are any incoming edges.
 boolean hasOutEdges()
          Return true if there are any outgoing edges.
 PPEdge[] incoming()
          Return a list of the incoming edges of this block.
 void incrementInEdges(long inc)
          Add the specified increment to all of the incoming edges.
 boolean isBeginBlock()
          Returns true if and only if this basic block is BEGIN.
 boolean isEndBlock()
          Returns true if and only if this basic block is END.
 boolean isNumPathsSet()
          Return True if and only the number of paths for this block has been set.
 Chord lastChord()
          Get the last Chord of this block.
 int numInEdges()
          Return the number of incoming edges.
 int numOutEdges()
          Return the number of incoming edges.
 PPEdge[] outgoing()
          Return a list of the incoming edges of this block.
 boolean removeInEdge(PPEdge edge)
          Remove the specified incoming edge.
 boolean removeOutEdge(PPEdge edge)
          Remove the specified outgoing edge.
 void setNumPaths(long numPaths)
          Set the number of paths for this block.
 
Methods inherited from class scale.score.pp.PPBlock
dumpEdges, getDisplayName, getHighRange, getLowRange, getNumChords, getRangeText, getRank, getWeight, hasEdges, incRank, isLoopHeader, resetNumPaths, setHighRange, setLowRange, setRank, toString, unionRange, validate
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayColorHint, getDisplayLabel, getDisplayShapeHint, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, toStringSpecial, trace, trace, trace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SUPERBEGIN

public static final int SUPERBEGIN
Represents that this supergraph block is SUPERBEGIN.

See Also:
Constant Field Values

SUPEREND

public static final int SUPEREND
Represents that this supergraph block is SUPEREND.

See Also:
Constant Field Values
Constructor Detail

PPSupergraphBlock

public PPSupergraphBlock(int type,
                         java.util.List<PPCfg> cfgs)
Method Detail

firstChord

public Chord firstChord()
Get the first Chord of this block.

Overrides:
firstChord in class PPBlock

lastChord

public Chord lastChord()
Get the last Chord of this block.

Overrides:
lastChord in class PPBlock

incoming

public PPEdge[] incoming()
Return a list of the incoming edges of this block.

Overrides:
incoming in class PPBlock

outgoing

public PPEdge[] outgoing()
Return a list of the incoming edges of this block.

Overrides:
outgoing in class PPBlock

getInEdge

public PPEdge getInEdge(int i)
Return the specified incoming edge.

Overrides:
getInEdge in class PPBlock

getOutEdge

public PPEdge getOutEdge(int i)
Return the specified outgoing edge.

Overrides:
getOutEdge in class PPBlock

addInEdge

public boolean addInEdge(PPEdge edge)
Add the edge to the incoming edges.

Overrides:
addInEdge in class PPBlock
Returns:
true if the edge was already there

addOutEdge

public boolean addOutEdge(PPEdge edge)
Add the edge to the outgoing edges.

Overrides:
addOutEdge in class PPBlock
Returns:
true if the edge was already there

addAllInEdges

public void addAllInEdges(java.util.AbstractCollection<PPEdge> list)
Add all incoming edges to the specified collection.

Overrides:
addAllInEdges in class PPBlock

addAllOutEdges

public void addAllOutEdges(java.util.AbstractCollection<PPEdge> list)
Add all outgoing edges to the specified collection.

Overrides:
addAllOutEdges in class PPBlock

removeInEdge

public boolean removeInEdge(PPEdge edge)
Remove the specified incoming edge.

Overrides:
removeInEdge in class PPBlock
Returns:
true if the edge was an incoming edge

removeOutEdge

public boolean removeOutEdge(PPEdge edge)
Remove the specified outgoing edge.

Overrides:
removeOutEdge in class PPBlock
Returns:
true if the edge was an outgoing edge

numInEdges

public int numInEdges()
Return the number of incoming edges.

Overrides:
numInEdges in class PPBlock

numOutEdges

public int numOutEdges()
Return the number of incoming edges.

Overrides:
numOutEdges in class PPBlock

hasInEdges

public boolean hasInEdges()
Return true if there are any incoming edges.

Overrides:
hasInEdges in class PPBlock

hasOutEdges

public boolean hasOutEdges()
Return true if there are any outgoing edges.

Overrides:
hasOutEdges in class PPBlock

getInEdgeFrequency

public long getInEdgeFrequency()
Return the incoming edge frequency.

Overrides:
getInEdgeFrequency in class PPBlock

getOutEdgeFrequency

public long getOutEdgeFrequency()
Return the outgoing edge frequency.

Overrides:
getOutEdgeFrequency in class PPBlock

getBranchEdgeFrequency

public long getBranchEdgeFrequency()
Return the outgoing branch edge frequency.

Overrides:
getBranchEdgeFrequency in class PPBlock

getHighestOutEdge

public PPEdge getHighestOutEdge(long pathNum)
Return the outgoing edge with the highest increment.

Overrides:
getHighestOutEdge in class PPBlock

incrementInEdges

public void incrementInEdges(long inc)
Add the specified increment to all of the incoming edges.

Overrides:
incrementInEdges in class PPBlock

getAvgTripCount

public double getAvgTripCount()
Get the average trip count for a loop.

Overrides:
getAvgTripCount in class PPBlock

getNumPaths

public long getNumPaths()
Return the number of paths for this block. This is used for path profiling instrumentation.

Overrides:
getNumPaths in class PPBlock

setNumPaths

public void setNumPaths(long numPaths)
Set the number of paths for this block. This is used for path profiling instrumentation.

Overrides:
setNumPaths in class PPBlock
Parameters:
numPaths - The number of paths for this block.

isNumPathsSet

public boolean isNumPathsSet()
Return True if and only the number of paths for this block has been set. This is used for path profiling instrumentation.

Overrides:
isNumPathsSet in class PPBlock

isBeginBlock

public boolean isBeginBlock()
Returns true if and only if this basic block is BEGIN.

Overrides:
isBeginBlock in class PPBlock

isEndBlock

public boolean isEndBlock()
Returns true if and only if this basic block is END.

Overrides:
isEndBlock in class PPBlock

getCfg

public PPCfg getCfg()
Return the path profiling CFG representation that this block is part of.

Overrides:
getCfg in class PPBlock

equals

public boolean equals(java.lang.Object o)
Two supergraph blocks are the same if they have the same type.

Overrides:
equals in class PPBlock

hashCode

public int hashCode()
The hash code for a supergraph block is based on its type.

Overrides:
hashCode in class PPBlock