coins.sym
Class LabelImpl

java.lang.Object
  extended bycoins.sym.SymImpl
      extended bycoins.sym.LabelImpl
All Implemented Interfaces:
java.lang.Cloneable, HasStringObject, Label, Sym, Sym0

public class LabelImpl
extends SymImpl
implements Label

class Label


Field Summary
(package private)  BBlock fBBlock
           
(package private)  LabeledStmt fHIRpos
           
(package private)  IrList fHirRefList
           
(package private)  int fLabelKind
           
(package private)  IrList fLirRefList
           
(package private)  HIR fOriginHir
           
 
Fields inherited from class coins.sym.SymImpl
fDbgLevel, fDefinedIn, fFlagBox, fKind, fName, fNextSym, fRecordedIn, fSourceInf, fSymInf, fType, fUniqueNameSym, fWork, machineParam, sourceLanguage, symRoot
 
Fields inherited from interface coins.sym.Label
CONTINUE_LABEL, ELSE_LABEL, END_IF_LABEL, ENTRY_LABEL, JUMP_LABEL, LOOP_BACK_LABEL, LOOP_BODY_LABEL, LOOP_COND_INIT_LABEL, LOOP_END_LABEL, LOOP_STEP_LABEL, RETURN_POINT_LABEL, SOURCE_LABEL, SWITCH_CASE_LABEL, SWITCH_DEFAULT_LABEL, SWITCH_END_LABEL, THEN_LABEL, UNCLASSIFIED_LABEL
 
Fields inherited from interface coins.sym.Sym
KIND_NAME, VISIBILITY
 
Fields inherited from interface coins.sym.Sym0
FLAG_ADDRESS_TAKEN, FLAG_CASTLESS_SUBP, FLAG_COMMON, FLAG_COMPLEX_STRUCT, FLAG_DERIVED_SYM, FLAG_GENERATED_SYM, FLAG_INCOMPLETE_TYPE, FLAG_POINTER_OPERATION, FLAG_REGION_ELEM, FLAG_RESERVED_NAME, FLAG_SIZEOF_TAKEN, FLAG_UNFIXED_SIZE, FLAG_UNIFORM_SIZE, FLAG_VALUE_IS_ASSIGNED, KIND_AREG, KIND_BOOL_CONST, KIND_CHAR_CONST, KIND_CONST_FIRST, KIND_CONST_LAST, KIND_ELEM, KIND_EXP_ID, KIND_FLOAT_CONST, KIND_INT_CONST, KIND_LABEL, KIND_MREG, KIND_NAMED_CONST, KIND_OTHER, KIND_PARAM, KIND_REMOVED, KIND_STRING_CONST, KIND_SUBP, KIND_TAG, KIND_TYPE, KIND_VAR, SYM_COMPILE_UNIT, SYM_EXTERN, SYM_PRIVATE, SYM_PROTECTED, SYM_PUBLIC
 
Constructor Summary
LabelImpl(SymRoot pSymRoot, java.lang.String pLabelName, Sym pDefinedIn)
           
 
Method Summary
 void addToHirRefList(LabelNode pHirRefPosition)
          addToHirRefList Add reference list of this label.
 boolean endPointLabel()
          endPointLabel true if END_IF, LOOP_END, SWITCH_END.
 BBlock getBBlock()
          getBBlock Get basic block corresponding to this label.
 LabeledStmt getHirPosition()
          getHirPosition Get the HIR statement having this label.
 int getHirRefCount()
          addToLirRefList add reference list of this label.
 IrList getHirRefList()
          getHirRefList Get reference list of this label.
 int getLabelKind()
          getLabelKind Get label kind such as hten-label, else-label, etc.
 HIR getOriginHir()
          getOriginHir
 boolean removeFromHirRefList(LabelNode labelnode)
          Remove LabelNode from HirRefList.
 void replaceHirLabel(Label pToLabel)
          replaceHirLabels Replace every LabelNode listed in getHirRefList() refering this label to a LabelNode of pToLabel.
 void resetHirRefList()
          Reset HirRefList that shows the list of LabelNodes refering this label.
 void setBBlock(BBlock pBBlock)
          setBBlock Set pBBlock as the basic block corresponding to this label.
 void setHirPosition(LabeledStmt pHirPosition)
          setHirPosition Set the HIR statement having this label.
 void setLabelKind(int pLabelKind)
          setLabelKind Set label kind.
 void setOriginHir(HIR pOriginHir)
          setOriginHir Set origin node.
 java.lang.String toString()
          Get the string image of object.
 java.lang.String toStringDetail()
          toStringDetail Get detailed attributes of this symbol in text which is not interned.
 
Methods inherited from class coins.sym.SymImpl
bareStringConst, baseType, boolConst, charConst, charConst, charConst, definedType, definedType, defineElem, defineLabel, defineParam, defineRegionVar, defineSubp, defineVar, defineVar, derivedSym, enumType, enumType, floatConst, floatConst, getDefinedColumn, getDefinedFile, getDefinedIn, getDefinedInName, getDefinedLine, getFlag, getInf, getName, getNameOrNull, getNextSym, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getRecordedIn, getSourceInf, getSymKind, getSymKindName, getSymType, getUniqueName, getWork, intConst, intConst, intObject, isGlobal, isHIR, isRemoved, isSym, linkSym, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeExpString, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, namedConst, pointerType, pointerType, pointerType, pointerType, pointerType, print, print, regionType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setFlag, setOriginalSym, setParameters, setRecordedIn, setSourceInf, setSymKind, setSymType, setUniqueNameSym, setWork, stringConst, stringConstFromQuotedString, structType, structType, subpType, subpType, symbol, toStringShort, unionType, unionType, vectorType, vectorType, vectorType, vectorType, vectorTypeUnfixed, vectorTypeUnfixed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.sym.Sym
baseType, boolConst, charConst, defineVar, derivedSym, floatConst, getDefinedColumn, getDefinedInName, getDefinedLine, getInf, getNameOrNull, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getSymKindName, getWork, intConst, intObject, isRemoved, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, pointerType, pointerType, pointerType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setRecordedIn, setSymKind, setSymType, setUniqueNameSym, setWork, stringConstFromQuotedString, symbol, toStringShort, vectorType, vectorType, vectorType, vectorTypeUnfixed
 
Methods inherited from interface coins.sym.Sym0
charConst, definedType, defineElem, defineLabel, defineParam, defineSubp, defineVar, enumType, floatConst, getDefinedFile, getDefinedIn, getFlag, getName, getNextSym, getRecordedIn, getSymKind, getSymType, getUniqueName, intConst, isGlobal, namedConst, pointerType, setFlag, stringConst, structType, subpType, unionType, vectorType, vectorTypeUnfixed
 

Field Detail

fHirRefList

IrList fHirRefList

fLirRefList

IrList fLirRefList

fHIRpos

LabeledStmt fHIRpos

fLabelKind

int fLabelKind

fOriginHir

HIR fOriginHir

fBBlock

BBlock fBBlock
Constructor Detail

LabelImpl

public LabelImpl(SymRoot pSymRoot,
                 java.lang.String pLabelName,
                 Sym pDefinedIn)
Method Detail

getHirPosition

public LabeledStmt getHirPosition()
getHirPosition Get the HIR statement having this label.

Specified by:
getHirPosition in interface Label
Returns:
HIR statement to which this is defined as its label.

setHirPosition

public void setHirPosition(LabeledStmt pHirPosition)
setHirPosition Set the HIR statement having this label.

Specified by:
setHirPosition in interface Label
Parameters:
pHirPosition - HIR statement to which this is defined as its label. set pHirPosition as the HIR position of this label.

getHirRefList

public IrList getHirRefList()
getHirRefList Get reference list of this label.

Specified by:
getHirRefList in interface Label
Returns:
IrList the list of LabelNodes refering this label.

resetHirRefList

public void resetHirRefList()
Reset HirRefList that shows the list of LabelNodes refering this label. This method is called from JumpStmt, SwitchStmt and buildLabelRefList of Subp. It is not recommended to be used from other modules.


addToHirRefList

public void addToHirRefList(LabelNode pHirRefPosition)
addToHirRefList Add reference list of this label. This method is called from JumpStmt, SwitchStmt and buildLabelRefList of Subp. It is not recommended to be used from other modules.

Parameters:
pHirRefPosition - HIR refenence node of this label. add pHirRefPosition to the reference list of this label. If there is no HIR reference, return null.

removeFromHirRefList

public boolean removeFromHirRefList(LabelNode labelnode)
Remove LabelNode from HirRefList. This method is called from JumpStmt, SwitchStmt and buildLabelRefList of Subp. It is not recommended to be used from other modules.

Parameters:
labelnode -
Returns:
true if removed, false if not.

getHirRefCount

public int getHirRefCount()
addToLirRefList add reference list of this label.

Specified by:
getHirRefCount in interface Label
Returns:
the HIR reference count of this label.

getBBlock

public BBlock getBBlock()
Description copied from interface: Label
getBBlock Get basic block corresponding to this label.

Specified by:
getBBlock in interface Label
Returns:
the basic block.

setBBlock

public void setBBlock(BBlock pBBlock)
Description copied from interface: Label
setBBlock Set pBBlock as the basic block corresponding to this label.

Specified by:
setBBlock in interface Label
Parameters:
pBBlock - basic block to be set.

getLabelKind

public int getLabelKind()
Description copied from interface: Label
getLabelKind Get label kind such as hten-label, else-label, etc.

Specified by:
getLabelKind in interface Label
Returns:
label kind.

setLabelKind

public void setLabelKind(int pLabelKind)
Description copied from interface: Label
setLabelKind Set label kind. The label kind is used in modifying control flow graph.

Specified by:
setLabelKind in interface Label

endPointLabel

public boolean endPointLabel()
Description copied from interface: Label
endPointLabel true if END_IF, LOOP_END, SWITCH_END.

Specified by:
endPointLabel in interface Label
Returns:
true/false

getOriginHir

public HIR getOriginHir()
Description copied from interface: Label
getOriginHir
 Get the node that originate this label
                such as if-node for then-label,
                while-node for loop-back label, etc.
  Correspondence between fLabelKind and fOriginHir ..
        fLabelKind           fOriginHir
      ENTRY_LABEL          : entry node
      THEN_LABEL           : IfStmt node
      ELSE_LABEL           : IfStmt node
      END_IF_LABEL         : IfStmt node
      LOOP_COND_INIT_LABEL : LoopStmt node
      LOOP_BACK_LABEL      : LoopStmt node
      LOOP_BODY_LABEL      : LoopStmt node
      LOOP_STEP_LABEL      : LoopStmt node
      LOOP_END_LABEL       : LoopStmt node
      SWITCH_CASE_LABEL    : SwitchStmt node
      SWITCH_DEFAULT_LABEL : SwitchStmt node
      SWITCH_END_LABEL     : SwitchStmt node
      RETURN_POINT_LABEL   : FunctionExp node
      JUMP_LABEL           : JumpStmt node
      CONTINUE_LABEL       : Predecessor node
      SOURCE_LABEL         : JumpStmt node if there is.

Specified by:
getOriginHir in interface Label

setOriginHir

public void setOriginHir(HIR pOriginHir)
Description copied from interface: Label
setOriginHir Set origin node.

Specified by:
setOriginHir in interface Label
Parameters:
pOriginHir - Origin node of this label.

replaceHirLabel

public void replaceHirLabel(Label pToLabel)
Description copied from interface: Label
replaceHirLabels Replace every LabelNode listed in getHirRefList() refering this label to a LabelNode of pToLabel. If this label has no reference, then no replecement is done.

Specified by:
replaceHirLabel in interface Label
Parameters:
pToLabel - Label by which this label is to be replaced.

toString

public java.lang.String toString()
Description copied from interface: HasStringObject
Get the string image of object.

Specified by:
toString in interface HasStringObject
Overrides:
toString in class SymImpl

toStringDetail

public java.lang.String toStringDetail()
Description copied from interface: Sym
toStringDetail Get detailed attributes of this symbol in text which is not interned.

Specified by:
toStringDetail in interface Sym
Overrides:
toStringDetail in class SymImpl