OpenASIP
2.0
|
#include <Operand.hh>
Public Types | |
enum | OperandType { SINT_WORD, UINT_WORD, FLOAT_WORD, DOUBLE_WORD, HALF_FLOAT_WORD, BOOL, RAW_DATA, SLONG_WORD, ULONG_WORD } |
Public Member Functions | |
Operand (bool isInput) | |
Operand (bool isInput, int index, OperandType type) | |
Operand (const Operand &op) | |
virtual | ~Operand () |
virtual int | index () const |
virtual bool | isInput () const |
virtual bool | isOutput () const |
virtual OperandType | type () const |
virtual void | setType (OperandType type) |
virtual const std::string & | typeString () const |
virtual TCEString | CTypeString () const |
virtual bool | isVector () const |
virtual int | elementWidth () const |
virtual void | setElementWidth (int elementWidth) |
virtual int | elementCount () const |
virtual void | setElementCount (int elementCount) |
virtual int | width () const |
virtual bool | isAddress () const |
virtual int | memoryUnits () const |
virtual bool | isMemoryData () const |
virtual bool | canSwap (const Operand &op) const |
virtual const std::set< int > & | swap () const |
virtual void | loadState (const ObjectState *state) |
virtual ObjectState * | saveState () const |
virtual bool | isNull () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Member Functions | |
static int | defaultElementWidth (OperandType type) |
Static Public Attributes | |
static const std::string | SLONG_WORD_STRING = "SLongWord" |
static const std::string | ULONG_WORD_STRING = "ULongWord" |
static const std::string | SINT_WORD_STRING = "SIntWord" |
static const std::string | UINT_WORD_STRING = "UIntWord" |
static const std::string | HALF_FLOAT_WORD_STRING = "HalfFloatWord" |
static const std::string | FLOAT_WORD_STRING = "FloatWord" |
static const std::string | DOUBLE_WORD_STRING = "DoubleWord" |
static const std::string | BOOL_STRING = "Bool" |
static const std::string | RAW_DATA_STRING = "RawData" |
static const std::string | UNKNOWN_TYPE_STRING = "InvalidValue" |
static const std::string | OPRND_ID = "id" |
Object state name for operand id. More... | |
static const std::string | OPRND_TYPE = "type" |
Object state name for operand type. More... | |
static const std::string | OPRND_MEM_ADDRESS = "mem-address" |
Object state name for memory address. More... | |
static const std::string | OPRND_MEM_UNITS = "mem-units" |
Object state name for memory unit count. More... | |
static const std::string | OPRND_MEM_DATA = "mem-data" |
Object state name for memory data. More... | |
static const std::string | OPRND_CAN_SWAP = "can-swap" |
Object state name for can swap. More... | |
static const std::string | OPRND_IN = "in" |
Object state name for input operand. More... | |
static const std::string | OPRND_OUT = "out" |
Object state name for output operand. More... | |
static const std::string | OPRND_ELEM_WIDTH = "element-width" |
Object state name for element width. More... | |
static const std::string | OPRND_ELEM_COUNT = "element-count" |
Object state name for element count. More... | |
Private Member Functions | |
void | clear () |
Operand & | operator= (const Operand &) |
Assignment not allowed. More... | |
Private Attributes | |
int | index_ |
Index of the Operand. More... | |
bool | isInput_ |
Direction of operand. More... | |
OperandType | type_ |
Type of the Operand. More... | |
int | elementWidth_ |
Width of an element. More... | |
int | elementCount_ |
Number of total elements. More... | |
bool | isAddress_ |
Flag indicating whether Operand is address or not. More... | |
int | addressUnits_ |
size of the data this operation addresses. 0 if unknown. More... | |
bool | isMemoryData_ |
Flag indicating whether Operand is memory data or not. More... | |
std::set< int > | swap_ |
Indexes of Operands which can be swapped with this Operand. More... | |
Class that models Operation Operand.
Contains the static properties of Operation inputs and outputs.
Definition at line 52 of file Operand.hh.
enum Operand::OperandType |
Type of operand.
Enumerator | |
---|---|
SINT_WORD | |
UINT_WORD | |
FLOAT_WORD | |
DOUBLE_WORD | |
HALF_FLOAT_WORD | |
BOOL | |
RAW_DATA | |
SLONG_WORD | |
ULONG_WORD |
Definition at line 58 of file Operand.hh.
|
explicit |
Default constructor.
Definition at line 75 of file Operand.cc.
References defaultElementWidth(), elementWidth_, and type_.
|
explicit |
Constructor.
index | Index of operand. |
Definition at line 87 of file Operand.cc.
References defaultElementWidth(), elementWidth_, and type_.
Operand::Operand | ( | const Operand & | op | ) |
|
virtual |
|
virtual |
Returns true if Operand can be swapped with op.
op | Operand being investigated. |
Reimplemented in NullOperand.
Definition at line 372 of file Operand.cc.
References ContainerTools::containsValue(), index(), and swap_.
Referenced by OperationPimpl::canSwap(), loadState(), and saveState().
|
private |
Clears the operand.
This is used when operand state is reloaded from ObjectState tree. Old must be cleared first.
Definition at line 120 of file Operand.cc.
References elementCount_, elementWidth_, index_, isAddress_, isMemoryData_, and swap_.
Referenced by loadState().
|
virtual |
Definition at line 222 of file Operand.cc.
References DOUBLE_WORD, elementWidth(), FLOAT_WORD, isVector(), RAW_DATA, SINT_WORD, type(), and UINT_WORD.
|
static |
Returns default element width depending on operand's type.
type | Operand type. |
Definition at line 557 of file Operand.cc.
References BOOL, DOUBLE_WORD, HALF_FLOAT_WORD, SLONG_WORD, type(), and ULONG_WORD.
Referenced by loadState(), OutputOperandDialog::onType(), InputOperandDialog::onType(), and Operand().
|
virtual |
Returns total number of elements.
Definition at line 298 of file Operand.cc.
References elementCount_.
Referenced by setElementCount(), and TDGenerator::ValueType::valueTypeStr().
|
virtual |
Returns width of an operand element in bits.
Definition at line 278 of file Operand.cc.
References elementWidth_.
Referenced by TDGen::analyzeMachineVectorRegisterClasses(), CTypeString(), TDGen::operandChar(), setElementWidth(), TDGen::subwordWidthOfRawData(), and TDGenerator::ValueType::valueTypeStr().
|
virtual |
Returns the index of the Operand.
Reimplemented in NullOperand.
Definition at line 135 of file Operand.cc.
References index_.
Referenced by canSwap(), TDGen::constantNodeString(), OpsetDialog::createOperation(), TDGen::createTrivialDAG(), TDGen::dagNodeToString(), OperationPimpl::insertOperand(), ImmInfo::key(), OperationPimpl::loadState(), OutputOperandDialog::onOk(), and TDGen::operandToString().
|
virtual |
Returns true if Operand is address.
Reimplemented in NullOperand.
Definition at line 328 of file Operand.cc.
References isAddress_.
Referenced by MemoryAliasAnalyzer::addressOperandMove(), TDGen::areImmediateOperandsLegal(), OpsetDialog::createOperation(), llvm::LLVMTCEBuilder::emitInstruction(), llvm::LLVMTCEBuilder::emitOperationMacro(), MemoryAliasAnalyzer::findTwoPartAddressOperands(), llvm::LLVMTCEBuilder::hasAmbiguousASpaceRefs(), MemoryAliasAnalyzer::mausOfOperation(), TDGen::operandToString(), OSEdInfoView::operationPropertyView(), osalInputIndex(), and TDGen::patInputs().
|
virtual |
Returns true if operand is input.
Reimplemented in NullOperand.
Definition at line 145 of file Operand.cc.
References isInput_.
Referenced by OperationDAGBuilder::connectOperandToNode(), TDGen::constantNodeString(), OpsetDialog::createOperation(), TDGen::createTrivialDAG(), TDGen::dagNodeToString(), SocketBusConnCmd::Do(), llvm::LLVMTCEBuilder::emitInstruction(), ConstantTransformer::runOnMachineFunction(), FUGen::scheduleOperations(), and writeCustomOpMacro().
|
virtual |
Returns true if Operand is memory data.
Reimplemented in NullOperand.
Definition at line 351 of file Operand.cc.
References isMemoryData_.
Referenced by OSEdInfoView::operationPropertyView().
|
inlinevirtual |
Reimplemented in NullOperand.
Definition at line 130 of file Operand.hh.
Referenced by llvm::LLVMTCEBuilder::emitInstruction(), and ConstantTransformer::runOnMachineFunction().
|
virtual |
Returns true if operand is output.
Reimplemented in NullOperand.
Definition at line 155 of file Operand.cc.
References isInput_.
Referenced by OperationDAGBuilder::connectOperandToNode(), OpsetDialog::createOperation(), TDGen::dagNodeToString(), llvm::LLVMTCEBuilder::emitInstruction(), and TDGen::patOutputs().
|
virtual |
Tells if the operand is a vector operand, in other words, has subwords.
Definition at line 268 of file Operand.cc.
References elementCount_.
Referenced by TDGen::analyzeMachineVectorRegisterClasses(), CTypeString(), TDGen::hasRawOperands(), TDGen::hasRegisterClassSupport(), TDGen::operandChar(), TDGen::operandToString(), TDGen::subwordWidthOfRawData(), and writeCustomOpMacro().
|
virtual |
Loads Operand state from an ObjectState object.
state | State containing operand properties. |
ObjectStateLoadingException | If loading fails for some reason. |
Implements Serializable.
Definition at line 383 of file Operand.cc.
References __func__, addressUnits_, BOOL, BOOL_STRING, ObjectState::boolAttribute(), canSwap(), ObjectState::child(), ObjectState::childCount(), clear(), defaultElementWidth(), DOUBLE_WORD, DOUBLE_WORD_STRING, elementCount_, elementWidth_, Exception::errorMessage(), Exception::errorMessageStack(), FLOAT_WORD, FLOAT_WORD_STRING, HALF_FLOAT_WORD, HALF_FLOAT_WORD_STRING, ObjectState::hasAttribute(), index_, ObjectState::intAttribute(), isAddress_, isMemoryData_, ObjectState::name(), OPRND_CAN_SWAP, OPRND_ELEM_COUNT, OPRND_ELEM_WIDTH, OPRND_ID, OPRND_MEM_ADDRESS, OPRND_MEM_DATA, OPRND_MEM_UNITS, OPRND_TYPE, RAW_DATA, RAW_DATA_STRING, Exception::setCause(), SINT_WORD, SINT_WORD_STRING, SLONG_WORD, SLONG_WORD_STRING, ObjectState::stringAttribute(), swap_, Conversion::toInt(), type_, typeString(), UINT_WORD, UINT_WORD_STRING, ULONG_WORD, and ULONG_WORD_STRING.
Referenced by OperationPimpl::loadState(), OutputOperandDialog::onOk(), InputOperandDialog::updateOperand(), and OperationPropertyDialog::updateSwapLists().
|
virtual |
Returns the count of MAU's which this operand addresses.
returns 0 if the operand is not a memory address, or the size of the memory access int MAU's this operation accesses.
Definition at line 341 of file Operand.cc.
References addressUnits_.
Referenced by MemoryAliasAnalyzer::mausOfOperation().
|
virtual |
Saves the state of the Operation to ObjectState object.
Implements Serializable.
Definition at line 490 of file Operand.cc.
References ObjectState::addChild(), addressUnits_, BOOL, BOOL_STRING, canSwap(), DOUBLE_WORD, DOUBLE_WORD_STRING, elementCount_, elementWidth_, FLOAT_WORD, FLOAT_WORD_STRING, HALF_FLOAT_WORD, HALF_FLOAT_WORD_STRING, index_, isAddress_, isMemoryData_, OPRND_CAN_SWAP, OPRND_ELEM_COUNT, OPRND_ELEM_WIDTH, OPRND_ID, OPRND_IN, OPRND_MEM_ADDRESS, OPRND_MEM_DATA, OPRND_MEM_UNITS, OPRND_TYPE, RAW_DATA, RAW_DATA_STRING, ObjectState::setAttribute(), SINT_WORD, SINT_WORD_STRING, SLONG_WORD, SLONG_WORD_STRING, swap_, type_, UINT_WORD, UINT_WORD_STRING, ULONG_WORD, ULONG_WORD_STRING, and UNKNOWN_TYPE_STRING.
Referenced by OperationPropertyDialog::updateSwapLists().
|
virtual |
Sets the number of elements.
New | element count. |
Definition at line 308 of file Operand.cc.
References elementCount(), and elementCount_.
Referenced by TDGen::writeOperationDefUsingGivenOperandTypes().
|
virtual |
Sets the element bit width.
New | element bit width. |
Definition at line 288 of file Operand.cc.
References elementWidth(), and elementWidth_.
Referenced by TDGen::writeOperationDefUsingGivenOperandTypes().
|
virtual |
Sets the operand type.
type | The new type of the operand. |
Definition at line 175 of file Operand.cc.
Referenced by TDGen::writeOperationDefUsingGivenOperandTypes().
|
virtual |
Returns the set of operands that can be swapped with this operand.
Reimplemented in NullOperand.
Definition at line 361 of file Operand.cc.
References swap_.
Referenced by TDGen::areImmediateOperandsLegal(), OSEdInfoView::operationPropertyView(), and TDGen::writeIntegerImmediateDefs().
|
virtual |
Returns the type of the Operand.
Definition at line 165 of file Operand.cc.
References type_.
Referenced by TDGen::analyzeMachineVectorRegisterClasses(), CTypeString(), defaultElementWidth(), TDGen::emulatingOpNodeLLVMName(), OperationPimpl::emulationFunctionName(), TDGen::hasRawOperands(), TDGen::operandChar(), TDGen::operandToString(), operandTypeCString(), setType(), TDGen::subwordWidthOfRawData(), PreOptimizer::tryToRemoveEq(), TDGenerator::ValueType::valueTypeStr(), OperationDAGConverter::writeNode(), and TDGen::writeOperationDefs().
|
virtual |
Returns the string type of the Operand.
Definition at line 185 of file Operand.cc.
References BOOL, BOOL_STRING, DOUBLE_WORD, DOUBLE_WORD_STRING, FLOAT_WORD, FLOAT_WORD_STRING, HALF_FLOAT_WORD, HALF_FLOAT_WORD_STRING, RAW_DATA, RAW_DATA_STRING, SINT_WORD, SINT_WORD_STRING, SLONG_WORD, SLONG_WORD_STRING, type_, UINT_WORD, UINT_WORD_STRING, ULONG_WORD, ULONG_WORD_STRING, and UNKNOWN_TYPE_STRING.
Referenced by loadState(), and OSEdInfoView::operationPropertyView().
|
virtual |
Returns width of the operand in bits.
Definition at line 318 of file Operand.cc.
References elementCount_, and elementWidth_.
Referenced by OpsetDialog::createOperation(), FUGen::DAGNodeOperandWidth(), MachineInfo::findWidestOperand(), OperationSimulator::initializeOutputs(), MachineConnectivityCheck::operandWidth(), ConstantTransformer::runOnMachineFunction(), FUGen::scheduleOperations(), SimpleOperationExecutor::startOperation(), TDGen::subwordWidthOfRawData(), TDGen::writeScalarOperationExploitations(), and TDGen::writeVectorBitwiseOperationDefs().
|
private |
size of the data this operation addresses. 0 if unknown.
Definition at line 153 of file Operand.hh.
Referenced by loadState(), memoryUnits(), and saveState().
|
static |
Definition at line 77 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 76 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
private |
Number of total elements.
Definition at line 149 of file Operand.hh.
Referenced by clear(), elementCount(), isVector(), loadState(), saveState(), setElementCount(), and width().
|
private |
Width of an element.
Definition at line 147 of file Operand.hh.
Referenced by clear(), elementWidth(), loadState(), Operand(), saveState(), setElementWidth(), and width().
|
static |
Definition at line 75 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 74 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
private |
Index of the Operand.
Definition at line 141 of file Operand.hh.
Referenced by clear(), index(), loadState(), and saveState().
|
private |
Flag indicating whether Operand is address or not.
Definition at line 151 of file Operand.hh.
Referenced by clear(), isAddress(), loadState(), and saveState().
|
private |
Direction of operand.
Definition at line 143 of file Operand.hh.
Referenced by isInput(), and isOutput().
|
private |
Flag indicating whether Operand is memory data or not.
Definition at line 155 of file Operand.hh.
Referenced by clear(), isMemoryData(), loadState(), and saveState().
|
static |
Object state name for can swap.
Definition at line 92 of file Operand.hh.
Referenced by loadState(), saveState(), OperationSerializer::setOperandProperties(), OperationSerializer::toXMLFormat(), InputOperandDialog::updateOperand(), and OperationPropertyDialog::updateSwapLists().
|
static |
Object state name for element count.
Definition at line 100 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), saveState(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Object state name for element width.
Definition at line 98 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), saveState(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Object state name for operand id.
Definition at line 82 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), OperationPropertyDialog::saveOperation(), saveState(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), InputOperandDialog::updateOperand(), and OperationPropertyDialog::updateSwapLists().
|
static |
Object state name for input operand.
Definition at line 94 of file Operand.hh.
Referenced by saveState(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Object state name for memory address.
Definition at line 86 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), saveState(), OperationSerializer::setOperandProperties(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Object state name for memory data.
Definition at line 90 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), saveState(), OperationSerializer::setOperandProperties(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Object state name for memory unit count.
Definition at line 88 of file Operand.hh.
Referenced by loadState(), saveState(), OperationSerializer::setOperandProperties(), and OperationSerializer::toXMLFormat().
|
static |
Object state name for output operand.
Definition at line 96 of file Operand.hh.
|
static |
Object state name for operand type.
Definition at line 84 of file Operand.hh.
Referenced by loadState(), OutputOperandDialog::onOk(), OperationPropertyDialog::saveOperation(), saveState(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 78 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 72 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 70 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
private |
Indexes of Operands which can be swapped with this Operand.
Definition at line 157 of file Operand.hh.
Referenced by canSwap(), clear(), loadState(), saveState(), and swap().
|
private |
Type of the Operand.
Definition at line 145 of file Operand.hh.
Referenced by loadState(), Operand(), saveState(), setType(), type(), and typeString().
|
static |
Definition at line 73 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 71 of file Operand.hh.
Referenced by InputOperandDialog::InputOperandDialog(), loadState(), OutputOperandDialog::onOk(), OutputOperandDialog::OutputOperandDialog(), saveState(), typeString(), and InputOperandDialog::updateOperand().
|
static |
Definition at line 79 of file Operand.hh.
Referenced by saveState(), and typeString().