scale.score.expr
Class FieldExpr

java.lang.Object
  extended by scale.common.Root
      extended by scale.score.Note
          extended by scale.score.expr.Expr
              extended by scale.score.expr.UnaryExpr
                  extended by scale.score.expr.FieldExpr
All Implemented Interfaces:
AnnotationInterface, DisplayNode
Direct Known Subclasses:
LoadFieldAddressExpr, LoadFieldValueExpr

public abstract class FieldExpr
extends UnaryExpr

This is the base class for field reference operations.

$Id: FieldExpr.java,v 1.50 2007-01-04 17:26:10 burrill Exp $

Copyright 2007 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
FieldExpr(Type type, Expr structure, FieldDecl field)
           
 
Method Summary
 long canonical()
          Return a unique value representing this particular expression.
 boolean equivalent(Expr exp)
          Return true if the expressions are equivalent.
 java.lang.String getDisplayLabel()
          Return a String suitable for labeling this node in a graphical display.
 FieldDecl getField()
          Return the expression specifying the field.
 Expr getReference()
          Return the structure associated with the field expression.
 Expr getStructure()
          Return the expression specifying the structure.
 boolean isDefined(Expr expr)
          The given expression is defined if the FieldExpr expression is defined and the given expression is the structure.
 boolean isLoopInvariant(LoopHeaderChord loop)
          Return true if this expression is loop invariant.
 boolean isMemRefExpr()
          Return true if the expression loads a value from memory.
 
Methods inherited from class scale.score.expr.UnaryExpr
containsDeclaration, dependsOnDeclaration, executionCostEstimate, getAliasAnnote, getArg, getDeclList, getExprList, getLoadExprList, getOperand, getOperandArray, loopClean, numOperands, optimizationCandidate, pushOperands, recordRefs, removeRefs, removeUseDef, replaceDecl, setArg, setOperand, sideEffects, unlinkExpression, validate
 
Methods inherited from class scale.score.expr.Expr
addCast, addCast, changeInDataEdge, conditionalCopy, conditionalUnlinkExpression, copy, deleteOutDataEdge, executionOrder, executionOrdinal, findCriticalChord, findLinearCoefficient, findSubscriptExpr, getAffineExpr, getAffineRepresentation, getCall, getConstantValue, getConstantValue, getCoreType, getCriticalChord, getDefExpr, getDisplayColorHint, getDisplayShapeHint, getDualExpr, getInDataEdge, getInDataEdgeArray, getLoopHeader, getLow, getLValue, getOutDataEdge, getPointedToCore, getReuseLevel, getRValue, getType, getUseDef, hasTrueFalseResult, isCast, isDefined, isLiteralExpr, isMatchExpr, isMemoryDef, isScalar, isSimpleExpr, mayGenerateCall, 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

FieldExpr

public FieldExpr(Type type,
                 Expr structure,
                 FieldDecl field)
Parameters:
type - is the result type of the field reference
structure - is the address of the structure accessed
field - specifies the field being referenced
Method Detail

equivalent

public boolean equivalent(Expr exp)
Return true if the expressions are equivalent. This method should be called by the equivalent() method of the derived classes.

Overrides:
equivalent in class UnaryExpr
Returns:
true if classes are identical and the core types are equivalent

getStructure

public final Expr getStructure()
Return the expression specifying the structure.


getField

public FieldDecl getField()
Return the expression specifying the field.


isMemRefExpr

public boolean isMemRefExpr()
Return true if the expression loads a value from memory.

Overrides:
isMemRefExpr in class Expr

getDisplayLabel

public java.lang.String getDisplayLabel()
Description copied from class: Expr
Return a String suitable for labeling this node in a graphical display. This method should be over-ridden as it simplay returns the class name.

Specified by:
getDisplayLabel in interface DisplayNode
Overrides:
getDisplayLabel in class Expr

isDefined

public boolean isDefined(Expr expr)
The given expression is defined if the FieldExpr expression is defined and the given expression is the structure.

Overrides:
isDefined in class Expr
Parameters:
expr - the expression representing the structure name
Returns:
true if the structure name is defined.

getReference

public Expr getReference()
Return the structure associated with the field expression. We use the structure name to represent the access of the structure - instead of the field name.

Overrides:
getReference in class Expr
Returns:
null since a general expression doesn't have a variable

canonical

public long canonical()
Return a unique value representing this particular expression.

Overrides:
canonical in class Expr

isLoopInvariant

public boolean isLoopInvariant(LoopHeaderChord loop)
Return true if this expression is loop invariant.

Overrides:
isLoopInvariant in class Expr
Parameters:
loop - is the loop