Next: Reservation Table Management
Up: SALTO User Interface Specification
Previous: Operand Abstraction
Attributes provide a means of annotating instructions and basic blocks with
arbitrary information. Attributes attached to an object are structured into
a list. An attribute has three properties:
- a value, which is an opaque string of bytes;
- a size, which is an integer representing the length of
value in bytes,
- a type, which is an integer representing the
nature of the information stored in the value field; for
system-defined attributes, type is a negative number.
There are five predefined attribute types. The user can define additional
types; user-defined types must correspond to strictly positive type codes.
- NO_ATT
- is the attribute type returned by the SALTO
attribute manipulation calls on failure;
- UNPARSE_ATT
- modifies the behavior of produceCode() methods
of classes INST and BB; if this attribute is present, the
text produced by the unparser will be the value of the attribute,
and not the external representation of actual basic block or
instruction.
- CYCLE_ATT
- is used by schedule management functions
INST::setCycle(), and INST::getCycle() and
BB::orderAccordingToCycles() when setting scheduling
information of instructions in a basic block and reordering the
instructions of a basic block according to their cycle numbers.
- COMMENT_ATT
- allows to attach comments to a basic block or an
instruction. When unparsing an instruction, an end-of-line comment
is added. When unparsing a basic block, a number of line comments
sufficient to represent the value of the attribute is placed
immediately before the first instruction of the basic block.
- EXTENDED_BB_ATT,
- if attached to a basic block, indicates that
this block contains multiple branch instructions and/or backward
jumps to the beginning of the block, but still has a single entry
point (the first instruction of the block).
- INST_IL_ID_ATT
- allows to attach to an instruction its ID
number in an external tool attached to SALTO.
- SaltoAttribute::SaltoAttribute(int t, void *pt, int
size)
- default constructor;
builds an attribute of type t,
containing the data of size size pointed to by pt;
- int SaltoAttribute::getAttributeType(void)
- returns the type of
the attribute;
- void SaltoAttribute::setAttributeType(int t)
- sets the
type of the attribute;
- void *SaltoAttribute::getAttributeData(void)
- returns a pointer
to the data field of the attribute;
- void SaltoAttribute::setAttributeData(void *d)
- sets the
data pointer of the attribute to d;
- int SaltoAttribute::getAttributeSize()
- returns the size of the
data field of the attribute;
- void SaltoAttribute::setAttributeSize(int s)
- sets the
size of the data field of the attribute to s;
- int SaltoAttribute::getTypeNode()
- returns the type of the
object to which the attribute is attached; possible return values are
CFGNODE, BBNODE and INSTNODE.
- void *SaltoAttribute::getPtToSalto()
- returns a pointer to the
SALTO object to which the attribute is attached; this pointer must be
re-cast according to the type of the attribute.
- void SaltoAttribute::setPtToSalto(void *sa)
- sets the
pointer to the SALTO object to which the attribute is attached;
- void SaltoAttribute::resetPtToSalto()
- sets the pointer to
SALTO object to NULL.
- void SaltoAttribute::setPtToSalto(BB &st)
- sets the
pointer to SALTO object to the address of basic block &st;
- void SaltoAttribute::setPtToSalto(INST &st)
- sets the
pointer to SALTO object to the address of instruction &st;
- void SaltoAttribute::getCFG(void)
- returns the pointer to the
CFG attribute is attached to; returns NULL if the attribute is attached to
a SALTO object of another type.
- BB *SaltoAttribute::getBB(void)
- returns the pointer to the basic
block the attribute is attached to; returns NULL if the attribute is
attached to a SALTO object of another type.
- INST *SaltoAttribute::getINST(void)
- returns the pointer to the
instruction the attribute is attached to; returns NULL if the attribute is
attached to a SALTO object of another type.
- SaltoAttribute *copy(void)
- copy an attribute; the data field is
not copied.
The following are methods for attribute manipulation, available on objects
of classes CFG, BB, and INST.
N.B: since these methods are applicable to objects of several classes, no
class prefix is given in the prototypes listed.
- int numberOfAttributes(void)
- returns the number of attributes
currently attached to the object;
- int numberOfAttributes(int type)
- returns the number of
attributes of type type already attached to the object;
- SaltoAttribute *getAttribute(int pos)
- returns the
pos-th attribute of the current object;
- SaltoAttribute *getAttribute(int pos, int type)
-
returns the pos-th attribute of type
type attached
to the current object;
- void setAttribute(int pos, SaltoAttribute *att)
-
sets the pos-th attribute of the current object to att;
prints an error message and returns without side effects if no such
attribute exists;
- void setAttribute(int pos, int type, SaltoAttribute
*att)
- sets the pos-th attribute of type
type attached to the object to att; prints an error
message and returns without side effects if no such attribute
exists;
- int attributeType(int pos)
- returns the type of the
pos-th attribute attached to the object; returns NO_ATT if
no such attribute exists;
- void *attributeValue(int pos)
- returns the pointer to the
value of pos-th attribute of the object; returns NULL if no such
attribute exists;
- void *attributeValue(int pos, int type)
-
returns the value of the pos-th attribute of type
type attached to the object; returns NULL if no such
attribute exists;
- void addAttribute(int type, void *a, int size)
-
adds an attribute of type type and
size size, and
containing the data pointed to by a, at end of attribute list
of the current object; no copy of data is made;
- void addAttribute(int type)
- adds an attribute of type
type and containing no data;
- void addAttribute(void *a, int size)
- adds a type-less
attribute of size size containing the data pointed to by
a, at end of attribute list
of the current object; no copy of data is made;
- void addAttribute(Attribute *att)
- adds a complete attribute
pointed to by att at the end of the attribute list of the
object;
- void *deleteAttribute(uint pos)
- removes the pos-th
attribute of the object.
Next: Reservation Table Management
Up: SALTO User Interface Specification
Previous: Operand Abstraction
Erven Rohou
Fri Oct 17 09:15:29 MET DST 1997