OpenASIP
2.0
|
#include <LImmDstRegisterField.hh>
Public Member Functions | |
LImmDstRegisterField (int width, BinaryEncoding &parent) | |
LImmDstRegisterField (const ObjectState *state, BinaryEncoding &parent) | |
virtual | ~LImmDstRegisterField () |
BinaryEncoding * | parent () const |
void | addDestination (const std::string &instructionTemplate, const std::string &immediateUnit) |
int | instructionTemplateCount () const |
std::string | instructionTemplate (int index) const |
bool | usedByInstructionTemplate (const std::string &instructionTemplate) const |
std::string | immediateUnit (const std::string &instructionTemplate) const |
virtual int | width () const |
virtual int | childFieldCount () const |
virtual ObjectState * | saveState () const |
Public Member Functions inherited from InstructionField | |
virtual | ~InstructionField () |
InstructionField * | parent () const |
virtual InstructionField & | childField (int position) const |
int | bitPosition () const |
int | relativePosition () const |
virtual void | setRelativePosition (int position) |
void | setExtraBits (int bits) |
int | extraBits () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Attributes | |
static const std::string | OSNAME_LIMM_DST_REGISTER_FIELD |
ObjectState name for long immediate destination register field. More... | |
static const std::string | OSKEY_WIDTH = "width" |
ObjectState attribute key for the width of the field. More... | |
static const std::string | OSNAME_IU_DESTINATION = "iu_dst" |
ObjectState name for a immediate unit destination. More... | |
static const std::string | OSKEY_ITEMP = "itemp" |
ObjectState attribute key for the name of the instruction template. More... | |
static const std::string | OSKEY_DST_IU = "iu" |
ObjectState attribute key for the name of the immediate unit. More... | |
Static Public Attributes inherited from InstructionField | |
static const std::string | OSNAME_INSTRUCTION_FIELD = "instr_field" |
ObjectState name for instruction field. More... | |
static const std::string | OSKEY_EXTRA_BITS = "extra_bits" |
ObjectState attribute key for the number of extra bits. More... | |
static const std::string | OSKEY_POSITION = "position" |
ObjectState attribute key for the relative position of the field. More... | |
Private Types | |
typedef std::map< std::string, std::string > | StringMap |
Map type for strings. More... | |
Private Member Functions | |
void | loadState (const ObjectState *state) |
Private Attributes | |
int | width_ |
Width of the field. More... | |
StringMap | destinationMap_ |
Maps instruction templates to immediate units. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from InstructionField | |
InstructionField (InstructionField *parent) | |
InstructionField (const ObjectState *state, InstructionField *parent) | |
void | setParent (InstructionField *parent) |
Static Protected Member Functions inherited from InstructionField | |
static void | reorderSubfields (ObjectState *state) |
Represets the instruction field that contains the register index where a long immediate is going to be written.
Definition at line 47 of file LImmDstRegisterField.hh.
|
private |
Map type for strings.
Definition at line 82 of file LImmDstRegisterField.hh.
LImmDstRegisterField::LImmDstRegisterField | ( | int | width, |
BinaryEncoding & | parent | ||
) |
The constructor.
Registers the field automatically to the given parent.
width | Width of the field. |
parent | The parent BinaryEncoding instance. |
OutOfRange | If the given width is 0 or smaller. |
Definition at line 59 of file LImmDstRegisterField.cc.
References __func__, BinaryEncoding::addLongImmDstRegisterField(), parent(), InstructionField::setParent(), and width().
LImmDstRegisterField::LImmDstRegisterField | ( | const ObjectState * | state, |
BinaryEncoding & | parent | ||
) |
The constructor.
Loads the state of the object from the given ObjectState instance. Registers the field automatically to the given parent.
state | The ObjectState instance. |
parent | The parent BinaryEncoding instance. |
ObjectStateLoadingException | If the given ObjectState instance is erroneous. |
Definition at line 81 of file LImmDstRegisterField.cc.
References BinaryEncoding::addLongImmDstRegisterField(), loadState(), parent(), and InstructionField::setParent().
|
virtual |
The destructor.
Definition at line 93 of file LImmDstRegisterField.cc.
References parent(), BinaryEncoding::removeLongImmDstRegisterField(), and InstructionField::setParent().
void LImmDstRegisterField::addDestination | ( | const std::string & | instructionTemplate, |
const std::string & | immediateUnit | ||
) |
Sets that the register index of the given immediate unit in the given instruction template is given in this field.
instructionTemplate | The instruction template. |
immediateUnit | The immediate unit. |
NotAvailable | If index of some other immediate unit is assigned to this field in the same instruction template. |
Definition at line 129 of file LImmDstRegisterField.cc.
References __func__, MapTools::containsKey(), destinationMap_, immediateUnit(), and instructionTemplate().
Referenced by BEMGenerator::addLongImmDstRegisterFields(), and loadState().
|
virtual |
Returns the number of child fields, that is always 0.
Implements InstructionField.
Definition at line 224 of file LImmDstRegisterField.cc.
std::string LImmDstRegisterField::immediateUnit | ( | const std::string & | instructionTemplate | ) | const |
Returns the name of the immediate unit for which the field is assigned in the given instruction template.
instructionTemplate | Name of the instruction template. |
NotAvailable | If the field is not used in the given instruction template. |
Definition at line 197 of file LImmDstRegisterField.cc.
References __func__, destinationMap_, and instructionTemplate().
Referenced by CodeCompressorPlugin::addBitsForDstRegisterField(), addDestination(), BEMValidator::checkLImmDstRegisterFields(), BinaryEncoding::longImmDstRegisterField(), and printLImmDstRegisterField().
std::string LImmDstRegisterField::instructionTemplate | ( | int | index | ) | const |
By the given index, returns an instruction template that uses this destination register field.
index | The index. |
OutOfRange | If the index is negative or not smaller than the number of instruction templates. |
Definition at line 162 of file LImmDstRegisterField.cc.
References __func__, destinationMap_, and instructionTemplateCount().
Referenced by addDestination(), immediateUnit(), printLImmDstRegisterField(), and usedByInstructionTemplate().
int LImmDstRegisterField::instructionTemplateCount | ( | ) | const |
Returns the number of instruction templates that use this destination register field.
Definition at line 148 of file LImmDstRegisterField.cc.
References destinationMap_.
Referenced by instructionTemplate(), and printLImmDstRegisterField().
|
privatevirtual |
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
Reimplemented from InstructionField.
Definition at line 260 of file LImmDstRegisterField.cc.
References __func__, addDestination(), ObjectState::child(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::intAttribute(), InstructionField::loadState(), ObjectState::name(), OSKEY_DST_IU, OSKEY_ITEMP, OSKEY_WIDTH, OSNAME_IU_DESTINATION, OSNAME_LIMM_DST_REGISTER_FIELD, ObjectState::stringAttribute(), and width_.
Referenced by LImmDstRegisterField().
BinaryEncoding * LImmDstRegisterField::parent | ( | ) | const |
Returns the parent BinaryEncoding instance.
Definition at line 106 of file LImmDstRegisterField.cc.
References assert, and InstructionField::parent().
Referenced by BinaryEncoding::addLongImmDstRegisterField(), LImmDstRegisterField(), BinaryEncoding::removeLongImmDstRegisterField(), and ~LImmDstRegisterField().
|
virtual |
Saves the state of the object to an ObjectState instance.
Reimplemented from InstructionField.
Definition at line 235 of file LImmDstRegisterField.cc.
References ObjectState::addChild(), destinationMap_, OSKEY_DST_IU, OSKEY_ITEMP, OSKEY_WIDTH, OSNAME_IU_DESTINATION, OSNAME_LIMM_DST_REGISTER_FIELD, InstructionField::saveState(), ObjectState::setAttribute(), ObjectState::setName(), and width().
Referenced by BinaryEncoding::saveState().
bool LImmDstRegisterField::usedByInstructionTemplate | ( | const std::string & | instructionTemplate | ) | const |
Tells whether the field is used by the given instruction template.
instructionTemplate | The instruction template. |
Definition at line 181 of file LImmDstRegisterField.cc.
References MapTools::containsKey(), destinationMap_, and instructionTemplate().
Referenced by BEMValidator::checkLImmDstRegisterFields(), and BinaryEncoding::longImmDstRegisterField().
|
virtual |
Returns the width of the field.
Implements InstructionField.
Definition at line 213 of file LImmDstRegisterField.cc.
References width_.
Referenced by CodeCompressorPlugin::addBitsForDstRegisterField(), CodeCompressorPlugin::bemInstructionBits(), BEMValidator::checkLImmDstRegisterFields(), CodeCompressorPlugin::firstMoveSlotIndex(), LImmDstRegisterField(), printInstructionLayout(), printLImmDstRegisterField(), saveState(), and BinaryEncoding::width().
|
private |
Maps instruction templates to immediate units.
Definition at line 89 of file LImmDstRegisterField.hh.
Referenced by addDestination(), immediateUnit(), instructionTemplate(), instructionTemplateCount(), saveState(), and usedByInstructionTemplate().
|
static |
ObjectState attribute key for the name of the immediate unit.
Definition at line 78 of file LImmDstRegisterField.hh.
Referenced by loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), and saveState().
|
static |
ObjectState attribute key for the name of the instruction template.
Definition at line 76 of file LImmDstRegisterField.hh.
Referenced by loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), and saveState().
|
static |
ObjectState attribute key for the width of the field.
Definition at line 72 of file LImmDstRegisterField.hh.
Referenced by loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), and saveState().
|
static |
ObjectState name for a immediate unit destination.
Definition at line 74 of file LImmDstRegisterField.hh.
Referenced by loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), and saveState().
|
static |
ObjectState name for long immediate destination register field.
Definition at line 70 of file LImmDstRegisterField.hh.
Referenced by BEMSerializer::convertToFileFormat(), loadState(), BinaryEncoding::loadState(), BEMSerializer::longImmDstRegFieldToOM(), and saveState().
|
private |
Width of the field.
Definition at line 87 of file LImmDstRegisterField.hh.
Referenced by loadState(), and width().