Next: Attributes
Up: SALTO User Interface Specification
Previous: SALTO Primitives
The contents of instruction operands should only be manipulated through the
operand abstraction class OperandInfo. This class provides primitives
allowing to extract and modify operand values, including register renaming
and arbitrary expression substitutions.
The abstract operand contains information on the low-level Salto object
representing the actual operand and, for resource operands (registers and
memory), gives the type and schedule of accesses made to the operand by
the instruction it is attached to. Access schedules are given wrt. the
issue cycle of the instruction (0 by convention). Multi-cycle accesses must
span an interval of consecutive cycles.
NOTE: expression operands are supposed to evaluate to the form
symbol + [symbol]
+ [signed_constant].
A family of six constructors is provided to allow for a fast and easy
construction of operand abstractions:
- OperandInfo(operand *op, accessT acc=notAccessed,
uint from=0, uint to=0)
-
builds an operand abstraction
from the low-level operand op. If present, the remaining fields
(acc, fromCycle, toCycle) define the type and the
schedule of the access.
- OperandInfo(char *name, accessT acc=notAccessed,
uint from=0, uint to=0)
-
builds the abstraction of an
access to the resource *rsrcName. If present, the remaining fields
(acc, fromCycle, toCycle) define the type and the
schedule of the access.
- OperandInfo(SymbolS *symb)
- builds the
abstraction of a reference to a symbol whose low-level Salto
representation is *symb. There is no access information, since the
operand is not a resource.
- OperandInfo(int cst)
- builds the abstraction
of a reference to an integer constant cst.
- OperandInfo(double fpcst)
- builds the
abstraction of a reference to a floating-point constant fpcst.
- OperandInfo(void)
- builds an empty operand
abstraction, to be completed through further initializations.
The type of an operand abstraction can be checked/modified by calling the
following predicates and property methods:
- operandT OperandInfo::getType(void)
- returns the type of the
operand. The type can be unknownOpdT, resIdentOpdT,
multiresIdentOpdT, FPconstOpdT, exprOpdT,
addExprOpdT, upOrLowPartOpdT, resPlaceholderOpdT, or
multiresPlaceholderOpdT.
- void OperandInfo::setType(operandT type)
- sets the type of
the operand abstraction to type.
- bool OperandInfo::isResIdent(void)
- returns true if the
operand is a reference to a single resource (register or memory).
- bool OperandInfo::isMultiresIdent(void)
- returns true if the
operand is a reference to an aggregate resource (such as SPARC's
double-precision pseudo-registers consisting of two adjacent %f
registers).
- bool OperandInfo::isFPconst(void)
- returns true if the
operand is a floating-point constant.
- bool OperandInfo::isExpr(void)
- returns true if the operand
is a constant integer expression as defined above.
- bool OperandInfo::isAddExpr(void)
- returns true if the
operand is an integer expression containing an addition of symbol values
or a metavariable term (such as a macro parameter).
- bool OperandInfo::isUpOrLowPart(void)
- returns true if the
operand is an MSB or LSB part of a resource's contents.
- bool OperandInfo::isResPlaceholder(void)
- returns true if
the operand is a meta-variable (such as a macro parameter) instantiated
with a reference to a single resource.
- bool OperandInfo::isMultiresPlaceholder(void)
- returns true
if the operand is a meta-variable (such as a macro parameter) instantiated
with a reference to an aggregate resource.
The contents of operand abstractions should only be manipulated using the
methods given below.
- res_ref OperandInfo::getRawResource(void)
- returns the pointer
to the low-level resource reference associated with the operand.
- void OperandInfo::setRawResource(res_ref *rsrc)
- sets the
pointer to the low-level resource reference associated with the operand.
- char *OperandInfo::getName(void)
- returns the name of the
resource associated with the operand.
- char *OperandInfo::rename(char *newName)
- renames the
resource associated with the operand to newName. The subject must
be a resource reference abstraction. The new resource must belong to the
same class as the original one. On success, the value returned is the
name of the original resource. On failure, the method returns NULL.
- unsigned int OperandInfo::substitute(char *oldText, char
*newText)
- substitutes newText for every
non-overlapping occurrence of oldText in the (unparsed)
representation of the expression corresponding to the abstraction. The
textual representation produced by substituting newText for
oldText is checked for syntaxical correctness, then parsed to
rebuild the expression. The method fails if the operand is not an
abstraction of a constant expression. The value returned is the number of
substitutions performed. CATCH: make sure that the value of
oldText matches the actual external representation of the
expression you want to substitute.
- operand *OperandInfo::getValue(void)
- returns the low-level
operand representation corresponding to the abstraction.
- void OperandInfo::setValue(char *resName)
- sets the
abstraction to be a reference to resource resName.
- void OperandInfo::setValue(char *multiresName, unsigned int
offset, size)
-
sets the abstraction to be a reference
to an aggregate resource of base name multiresName, consisting
of size elements starting at position offset in the resource
vector.
- void OperandInfo::setValue(double fpValue)
- sets the
abstraction to be the floating-point constant fpValue.
The following group of methods is intended for users familiar with the
internal structures of SALTO. Each `set...' method updates all
internal fields of the abstraction, leaving it in a consistent state.
NOTE: all methods return and take C++ references.
- ident &OperandInfo::getResIdent(void)
- returns the low-level
single resource reference description associated with the abstraction.
- void OperandInfo::setValue(ident &id)
- sets the
abstraction to match low-level single resource reference id.
- multi_ident &OperandInfo::getMultiresIdent(void)
- returns the
low-level aggregate resource reference description associated with the
abstraction.
- void OperandInfo::setValue(multi_ident &multiId)
- sets
the abstraction to match low-level aggregate resource reference
multiId.
- flp_const &OperandInfo::getFPconst(void)
- returns the low-level
floating-point constant representation associated with the abstraction.
- void OperandInfo::setValue(flp_const &flp)
- sets the
abstraction to match low-level floating-point constant representation
flp.
- exprn &OperandInfo::getExpr(void)
- returns the low-level
constant expression representation associated with the abstraction.
- void OperandInfo::setValue(exprn &xp)
- sets the
abstraction to match low-level constant expression representation xp.
- add_expr &OperandInfo::getAddExpr(void)
- returns the low-level
additive expression representation associated with the abstraction.
- void OperandInfo::setValue(add_expr &addxp)
- sets the
abstraction to match low-level additive expression representation
addxp.
- up_or_low_part &OperandInfo::getUpOrLowPart(void)
- returns
the low-level MSB/LSB selector representation associated with the
abstraction.
- void OperandInfo::setValue(up_or_low_part &uplow)
-
sets the abstraction to match low-level MSB/LSB selector representation
uplow.
- placeholder &OperandInfo::getResPlaceholder(void)
- returns the
low-level single resource meta-variable representation associated
with the abstraction.
- void OperandInfo::setValue(placeholder &ph)
- sets the
abstraction to match low-level single resource meta-variable
representation ph.
- multi_placeholder &OperandInfo::getMultiresPlaceholder(void)
-
returns the low-level aggregate resource meta-variable representation
associated with the abstraction.
- void OperandInfo::setValue(multi_placeholder&mph)
- sets
the abstraction to match low-level aggregate resource meta-variable
representation mph.
- accessT OperandInfo::getAccessType(void)
- returns the type of the
access. The type can be notAccessed, readAccess,
writeAccess, or useAccess.
- void OperandInfo::setAccessType(accessT access)
- sets the
access type to access.
- unsigned int OperandInfo::getFirstCycle(void)
- returns the first
cycle at which the operand resource is accessed, counted from
instruction issue. The value returned is not meaningful if the access
type is notAccessed.
- unsigned int OperandInfo::getLastCycle(void)
- returns the last
cycle at which the operand resource is accessed, counted from
instruction issue. The value returned is not meaningful if the access
type is notAccessed.
- void OperandInfo::setFirstCycle(unsigned int first)
- sets
the first cycle at which the operand resource is accessed.
- void OperandInfo::setLastCycle(unsigned int last)
- sets
the last cycle at which the operand resource is accessed.
Next: Attributes
Up: SALTO User Interface Specification
Previous: SALTO Primitives
Erven Rohou
Fri Oct 17 09:15:29 MET DST 1997