coins.alias
Class Tag

java.lang.Object
  extended bycoins.alias.Tag

class Tag
extends java.lang.Object

A Tag corresponds to some area in memory. It is assciated with the set of lvalue expressions that have the same form. So this could have extended ExpId, but instead has a field that links to the ExpId (MyExpId) it represents.

Tags form a tree structure in which parent nodes represent areas in memory that includes the areas child nodes represent. This relationship is used to assign bits to each Tag. It also makes it possible, via promote() method, to accurately handle the situation where some area obsuring operations, such as pointer arithmetic, hss been performed.


Field Summary
(package private) static int ANCHORED
          Flag number for anchoredness.
(package private)  int fBitPos
          Bit position this Tag correponds to in the TagVectors to be created.
(package private)  java.util.List fChildren
          List of child Tags of this Tag.
(package private)  boolean fIsUnique
          Specifies if this Tag represents a unique area in memory.
(package private)  int fKind
          Kind of this Tag.
(package private)  MyExpId fMyExpId
          MyExpId object this Tag is associated with.
(package private)  Tag fParent
          Parent Tag of this Tag.
(package private)  int fStorageClass
          Storage class of this Tag.
(package private)  TagVector fTagVect
          TagVector object that represents all the objects this Tag may represnt.
(package private)  Type fType
          Type of the object this Tag represents.
(package private)  Tag fUnionAncestor
           
(package private) static int HAS_UNION_ANCESTOR
          Flag number for whether being a union descendant.
(package private) static int KIND_ATOMIC
          The kind for the Tags that represent atomic (scalar) type objects.
(package private) static int KIND_STRUCT
          The kind for the Tags that represent struct type objects.
(package private) static int KIND_UNION
          The kind for the Tags that represent union type objects.
(package private) static int KIND_UNKNOWN
          The kind for the Tag whose type is unknown,
(package private) static int KIND_VECTOR
          The kind for the Tags represent vector type objects.
(package private) static int STO_CUR_FRAME
          Current frmae storage class, the storage class that corresponds to automatic variables declared within the current subprogram.
(package private) static int STO_HEAP
          Heap storage class, the storage class that corresponds to areas allocated by the current subprogram.
(package private) static int STO_OTHER
          Other storage class, the storage class that does not fall into current frame or static or heap.
(package private) static int STO_ROOT
          Root storage class, the storage class that corresponds to the whole memory space.
(package private) static int STO_STATIC
          Static storage class, the storage class that corresponds to static Vars.
 
Constructor Summary
(package private) Tag(HIR pmallocInvocationNode)
          Creates a new instance of Tag that is associated with an area allocated by a single malloc invocation.
(package private) Tag(int pKind)
          Creates a new instance of Tag that corresponds to the STO_OTHER storage class.
(package private) Tag(MyExpId pMyExpId, boolean pIsAnchored, int pKind, int pStorageClass)
          Creates a new instance of Tag that is associated with a MyExpId object.
 
Method Summary
(package private)  boolean getFlag(int pFlag)
           
(package private)  void inheritAttributes()
          Inherits attributes from the parent Tag.
(package private)  boolean isAnchored()
          Returns true if this Tag has a corresponding anchor.
(package private)  Tag promote()
          Returns the Tag that covers the area that the result of the pointer operation that has a pointer expression that points to one of the areas that this Tag represents as one of its operands can point to.
(package private)  void setFlag(int pFlag, boolean pYesNo)
           
 java.lang.String toString()
          Returns the String representation of this Tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fMyExpId

MyExpId fMyExpId
MyExpId object this Tag is associated with.


fKind

int fKind
Kind of this Tag. See the static fields of the names KIND_**** of this class.


fStorageClass

int fStorageClass
Storage class of this Tag.


fType

Type fType
Type of the object this Tag represents. Tags that represent


fBitPos

int fBitPos
Bit position this Tag correponds to in the TagVectors to be created. -1 if there is no such corresponding bit.


fIsUnique

boolean fIsUnique
Specifies if this Tag represents a unique area in memory. A Tag associated with a Var or constant-subscript element of an array Var or malloced area is unique.


fParent

Tag fParent
Parent Tag of this Tag. The parent Tag of a Tag corresponds to the area in memory that directly encloses the area the original Tag represents. As such, the original Tag must represent a relatively limited area in memory (isAnchored), or fAnchored is null. See #fChildren See #isAnchored


fChildren

java.util.List fChildren
List of child Tags of this Tag. A child Tag of a Tag corresponds to an area in memory that is directly enclosed by the area the original Tag represnts. As such, the original Tag must represent a relatively limited area in memory (isAnchored), or fChildren is empyt. See #fParent See #isAnchored


fUnionAncestor

Tag fUnionAncestor

KIND_VECTOR

static final int KIND_VECTOR
The kind for the Tags represent vector type objects.

See Also:
Constant Field Values

KIND_STRUCT

static final int KIND_STRUCT
The kind for the Tags that represent struct type objects.

See Also:
Constant Field Values

KIND_UNION

static final int KIND_UNION
The kind for the Tags that represent union type objects.

See Also:
Constant Field Values

KIND_ATOMIC

static final int KIND_ATOMIC
The kind for the Tags that represent atomic (scalar) type objects.

See Also:
Constant Field Values

KIND_UNKNOWN

static final int KIND_UNKNOWN
The kind for the Tag whose type is unknown,

See Also:
Constant Field Values

STO_ROOT

static final int STO_ROOT
Root storage class, the storage class that corresponds to the whole memory space.

See Also:
Constant Field Values

STO_CUR_FRAME

static final int STO_CUR_FRAME
Current frmae storage class, the storage class that corresponds to automatic variables declared within the current subprogram.

See Also:
Constant Field Values

STO_STATIC

static final int STO_STATIC
Static storage class, the storage class that corresponds to static Vars.

See Also:
Constant Field Values

STO_HEAP

static final int STO_HEAP
Heap storage class, the storage class that corresponds to areas allocated by the current subprogram.

See Also:
Constant Field Values

STO_OTHER

static final int STO_OTHER
Other storage class, the storage class that does not fall into current frame or static or heap. It covers automatic Vars from subprograms calling the current subprogram, global Vars that do not appear in the current subprogram, and areas allocated by the subprograms calling the current subprogram.

See Also:
Constant Field Values

fTagVect

TagVector fTagVect
TagVector object that represents all the objects this Tag may represnt. This will change as the analysis goes on.


ANCHORED

static final int ANCHORED
Flag number for anchoredness. See getFlag See setFlag

See Also:
Constant Field Values

HAS_UNION_ANCESTOR

static final int HAS_UNION_ANCESTOR
Flag number for whether being a union descendant. See getFlag See setFlag

See Also:
Constant Field Values
Constructor Detail

Tag

Tag(MyExpId pMyExpId,
    boolean pIsAnchored,
    int pKind,
    int pStorageClass)
Creates a new instance of Tag that is associated with a MyExpId object.

Parameters:
pMyExpId - MyExpId object this Tag is associated with.
pIsAnchored - Is this Tag associated with a single named Var?
pKind - kind of this Tag.
pStorageClass - storage class of this Tag.

Tag

Tag(HIR pmallocInvocationNode)
Creates a new instance of Tag that is associated with an area allocated by a single malloc invocation. malloc invocation within loops are not considered distinct (there are considered a single invocation).

Parameters:
pmallocInvocationNode - FunctionExp node that is an malloc invocation node.

Tag

Tag(int pKind)
Creates a new instance of Tag that corresponds to the STO_OTHER storage class.

Parameters:
pKind - the kind of Tag to be created.
Method Detail

inheritAttributes

void inheritAttributes()
Inherits attributes from the parent Tag. Attributes to be inherited are anchoredness (specified by isAnchored) and HAS_UNION_ANCESTOR flag. Additionally, if this Tag is of kind UNION, sets the HAS_UNION_ANCESTOR flag. See #isAnchored See HAS_UNION_ANCESTOR See KIND_UNION


isAnchored

boolean isAnchored()
Returns true if this Tag has a corresponding anchor. A Tag represents an area in memory, but which area it represents may not be accurately determined at compile time. Tags which are anchored can only represent areas in memory that are inside the area the anchor Tag represents.

Returns:
true if this Tag has a corresponding anchor.

promote

Tag promote()
Returns the Tag that covers the area that the result of the pointer operation that has a pointer expression that points to one of the areas that this Tag represents as one of its operands can point to. It is either fAnchor or this Tag itself.

Returns:
the Tag the area which it represents the result of the pointer operations involving pointers to the area this Tag represents may point to.

getFlag

boolean getFlag(int pFlag)

setFlag

void setFlag(int pFlag,
             boolean pYesNo)

toString

public java.lang.String toString()
Returns the String representation of this Tag.

Returns:
the String representation of this Tag.