scale.score.expr
Class CallExpr

java.lang.Object
  extended by scale.common.Root
      extended by scale.score.Note
          extended by scale.score.expr.Expr
              extended by scale.score.expr.NaryExpr
                  extended by scale.score.expr.CallExpr
All Implemented Interfaces:
AnnotationInterface, DisplayNode
Direct Known Subclasses:
CallFunctionExpr, CallMethodExpr

public abstract class CallExpr
extends NaryExpr

This is the base class for calls to routines.

$Id: CallExpr.java,v 1.46 2007-10-04 19:58:28 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
 
Fields inherited from class scale.score.expr.Expr
fpReorder, SE_DOMAIN, SE_NONE, SE_OVERFLOW, SE_STATE
 
Constructor Summary
CallExpr(Type type, Expr routine, Vector<Expr> arguments)
          We may want to add a constructor that accepts the routine as a Declaration node.
 
Method Summary
 void addMayDef(MayDef md)
          Add may definition information to the call expression.
 void addMayUse(MayUse mu)
          Add may use information to the call expression.
 int executionCostEstimate()
          Return a relative cost estimate for executing the expression.
protected  Chord findCriticalChord(HashMap<Expr,Chord> lMap, Chord independent)
          Return the Chord with the highest label value from the set of Chords that must be executed before this expression.
 Expr getArgument(int i)
          Return the expression representing the i-th argument to the function.
 Expr[] getArgumentArray()
          Return an array of the arguments.
 CallExpr getCall(boolean ignorePure)
          Return the call expression or null if none.
 DColor getDisplayColorHint()
          Return a String specifying the color to use for coloring this node in a graphical display.
 Expr getFunction()
          Return the expression representing the function being called,
 java.util.Enumeration<MayDef> getMayDef()
          Return a list of the may definition expressions associated with the call expression.
 java.util.Enumeration<MayUse> getMayUse()
          Return a list of the may use expressions associated with the call expression.
 int getProfCallCnt()
          Return the number of times this call occurred during execution.
 boolean inMayDef(Declaration d)
          Return true if parameter's declaration already present in mayDef vector
 boolean isPure()
          Return true if this is a call to pure function.
 boolean mayGenerateCall()
          Return true if this expression may result in the generation of a call to a subroutine.
 int numArguments()
          Return the number of function arguments.
 boolean optimizationCandidate()
          Return true if the expression can be moved without problems.
 void setProfCallCnt(int count)
          Specify the number of times this call occurred during execution.
 int sideEffects()
          Return an indication of the side effects execution of this expression may cause.
 
Methods inherited from class scale.score.expr.NaryExpr
addOperand, containsDeclaration, dependsOnDeclaration, equivalent, getDeclList, getExprList, getLoadExprList, getOperand, getOperandArray, loopClean, numOperands, pushOperands, recordRefs, removeOperand, removeRefs, removeUseDef, replaceDecl, setOperand, unlinkExpression, validate
 
Methods inherited from class scale.score.expr.Expr
addCast, addCast, canonical, changeInDataEdge, conditionalCopy, conditionalUnlinkExpression, copy, deleteOutDataEdge, executionOrder, executionOrdinal, findLinearCoefficient, findSubscriptExpr, getAffineExpr, getAffineRepresentation, getAliasAnnote, getConstantValue, getConstantValue, getCoreType, getCriticalChord, getDefExpr, getDisplayLabel, getDisplayShapeHint, getDualExpr, getInDataEdge, getInDataEdgeArray, getLoopHeader, getLow, getLValue, getOutDataEdge, getPointedToCore, getReference, getReuseLevel, getRValue, getType, getUseDef, hasTrueFalseResult, isCast, isDefined, isDefined, isLiteralExpr, isLoopInvariant, isMatchExpr, isMemoryDef, isMemRefExpr, isScalar, isSimpleExpr, numInDataEdges, reduce, removeDualExprs, setCrossloopReuse, setOutDataEdge, setSpatialReuse, setStep, setTemporalReuse, setType, setUseDef, toStringSpecial, validLValue
 
Methods inherited from class scale.score.Note
getChord, getEssentialUse, setAnnotationLevel, setReportLevel, toString, visit
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallExpr

public CallExpr(Type type,
                Expr routine,
                Vector<Expr> arguments)
We may want to add a constructor that accepts the routine as a Declaration node.

Parameters:
type - result type of the routine call. Void for procedures.
routine - expression node holding address of routine to call
arguments - vector of expressions representing arguments
Method Detail

sideEffects

public int sideEffects()
Return an indication of the side effects execution of this expression may cause.

Overrides:
sideEffects in class NaryExpr
See Also:
Expr.SE_NONE

getFunction

public final Expr getFunction()
Return the expression representing the function being called,


getArgument

public final Expr getArgument(int i)
Return the expression representing the i-th argument to the function.


numArguments

public final int numArguments()
Return the number of function arguments.


getArgumentArray

public final Expr[] getArgumentArray()
Return an array of the arguments.


setProfCallCnt

public final void setProfCallCnt(int count)
Specify the number of times this call occurred during execution.


getProfCallCnt

public final int getProfCallCnt()
Return the number of times this call occurred during execution.


addMayDef

public void addMayDef(MayDef md)
Add may definition information to the call expression.

Parameters:
md - the may definition expression

getMayDef

public java.util.Enumeration<MayDef> getMayDef()
Return a list of the may definition expressions associated with the call expression.


addMayUse

public void addMayUse(MayUse mu)
Add may use information to the call expression.

Parameters:
mu - the may use expression

getMayUse

public java.util.Enumeration<MayUse> getMayUse()
Return a list of the may use expressions associated with the call expression.


inMayDef

public boolean inMayDef(Declaration d)
Return true if parameter's declaration already present in mayDef vector


findCriticalChord

protected Chord findCriticalChord(HashMap<Expr,Chord> lMap,
                                  Chord independent)
Return the Chord with the highest label value from the set of Chords that must be executed before this expression.

Overrides:
findCriticalChord in class Expr
Parameters:
lMap - is used to memoize the expression to critical Chord information
independent - is returned if the expression is not dependent on anything

getDisplayColorHint

public DColor getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display.

Specified by:
getDisplayColorHint in interface DisplayNode
Overrides:
getDisplayColorHint in class Expr
See Also:
DColor

mayGenerateCall

public boolean mayGenerateCall()
Return true if this expression may result in the generation of a call to a subroutine.

Overrides:
mayGenerateCall in class Expr

isPure

public boolean isPure()
Return true if this is a call to pure function.


getCall

public CallExpr getCall(boolean ignorePure)
Return the call expression or null if none.

Overrides:
getCall in class Expr
Parameters:
ignorePure - is true if pure function calls are to be ignored.

optimizationCandidate

public boolean optimizationCandidate()
Return true if the expression can be moved without problems. Expressions that reference global variables, non-atomic variables, etc are not optimization candidates.

Overrides:
optimizationCandidate in class NaryExpr

executionCostEstimate

public int executionCostEstimate()
Return a relative cost estimate for executing the expression.

Overrides:
executionCostEstimate in class NaryExpr