#include <InstructionSignature.h>
Public Member Functions | |
InstructionSignature (string const &name) | |
InstructionSignature (string const &name, vector< StandardTypeDescriptorOrdinal > const &operands) | |
InstructionSignature (string const &name, vector< RegisterReference * > const &operands) | |
InstructionSignature (string const &name, TProgramCounter pc, vector< StandardTypeDescriptorOrdinal > const &operands) | |
InstructionSignature (string const &name, TProgramCounter pc, vector< RegisterReference * > const &operands) | |
string | compute () const |
string | getName () const |
RegisterReference * | operator[] (uint index) const |
uint | size () const |
TProgramCounter | getPc () const |
Static Public Member Functions | |
static vector< StandardTypeDescriptorOrdinal > | typeVector (bool(*typeFunction)(StandardTypeDescriptorOrdinal)) |
Returns a vector that contains all types that match a given StandardTypeDescriptor::function(). | |
Private Member Functions | |
void | registersToTypes () |
Private Attributes | |
string | name |
vector< StandardTypeDescriptorOrdinal > | types |
vector< RegisterReference * > | registers |
bool | hasRegisters |
TProgramCounter | pc |
bool | hasPc |
Definition at line 37 of file InstructionSignature.h.
InstructionSignature::InstructionSignature | ( | string const & | name | ) | [explicit] |
Definition at line 28 of file InstructionSignature.cpp.
00030 : name(name), 00031 hasRegisters(false), 00032 hasPc(false) 00033 { 00034 }
InstructionSignature::InstructionSignature | ( | string const & | name, | |
vector< StandardTypeDescriptorOrdinal > const & | operands | |||
) | [explicit] |
Definition at line 36 of file InstructionSignature.cpp.
00040 : name(name), 00041 types(operands), 00042 hasRegisters(false), 00043 hasPc(false) 00044 { 00045 }
InstructionSignature::InstructionSignature | ( | string const & | name, | |
vector< RegisterReference * > const & | operands | |||
) | [explicit] |
Definition at line 47 of file InstructionSignature.cpp.
References registersToTypes().
00050 : name(name), 00051 registers(operands), 00052 hasRegisters(true), 00053 hasPc(false) 00054 { 00055 registersToTypes(); 00056 }
InstructionSignature::InstructionSignature | ( | string const & | name, | |
TProgramCounter | pc, | |||
vector< StandardTypeDescriptorOrdinal > const & | operands | |||
) | [explicit] |
Definition at line 58 of file InstructionSignature.cpp.
00063 : name(name), 00064 types(operands), 00065 hasRegisters(false), 00066 pc(pc), 00067 hasPc(true) 00068 { 00069 }
InstructionSignature::InstructionSignature | ( | string const & | name, | |
TProgramCounter | pc, | |||
vector< RegisterReference * > const & | operands | |||
) | [explicit] |
Definition at line 71 of file InstructionSignature.cpp.
References registersToTypes().
00075 : name(name), 00076 registers(operands), 00077 hasRegisters(true), 00078 pc(pc), 00079 hasPc(true) 00080 { 00081 registersToTypes(); 00082 }
string InstructionSignature::compute | ( | ) | const |
Definition at line 85 of file InstructionSignature.cpp.
References hasPc, name, size(), StandardTypeDescriptor::toString(), and types.
Referenced by InstructionFactory::createInstruction(), CalcAssembler::createInstruction(), InstructionFactory::createInstructionHelper(), and ReturnInstructionRegister::registerInstructions().
00086 { 00087 ostringstream ostr; 00088 uint size = types.size(); 00089 00090 ostr << name << "("; 00091 if (hasPc) { 00092 ostr << "PC"; 00093 if (size) { 00094 ostr << ","; 00095 } 00096 } 00097 for (uint i = 0; i < size; i++) { 00098 if (i > 0) { 00099 ostr << ","; 00100 } 00101 ostr << StandardTypeDescriptor::toString(types[i]); 00102 } 00103 ostr << ")"; 00104 return ostr.str(); 00105 }
string InstructionSignature::getName | ( | ) | const |
Definition at line 108 of file InstructionSignature.cpp.
References name.
00109 { 00110 return name; 00111 }
RegisterReference * InstructionSignature::operator[] | ( | uint | index | ) | const |
Definition at line 114 of file InstructionSignature.cpp.
References hasRegisters, and registers.
00115 { 00116 assert(hasRegisters); 00117 return registers[index]; 00118 }
uint InstructionSignature::size | ( | ) | const |
Definition at line 121 of file InstructionSignature.cpp.
References types.
Referenced by compute(), RaiseInstruction::create(), ReturnInstruction::create(), PointerToNull< PTR_TYPE >::create(), PointerRef< PTR_TYPE >::create(), PointerMove< PTR_TYPE >::create(), PointerSub< PTR_TYPE >::create(), PointerAdd< PTR_TYPE >::create(), PointerPutSize< PTR_TYPE >::create(), NativeToNull< TMPLT >::create(), NativeRef< TMPLT >::create(), NativeMove< TMPLT >::create(), NativeRound< TMPLT >::create(), NativeNeg< TMPLT >::create(), NativeDiv< TMPLT >::create(), NativeMul< TMPLT >::create(), NativeSub< TMPLT >::create(), NativeAdd< TMPLT >::create(), JumpNotNull::create(), JumpNull::create(), JumpFalse::create(), JumpTrue::create(), Jump::create(), PointerGetMaxSize< PTR_TYPE >::create(), PointerGetSize< PTR_TYPE >::create(), IntegralNativeShiftRight< TMPLT >::create(), IntegralNativeShiftLeft< TMPLT >::create(), IntegralNativeOr< TMPLT >::create(), IntegralNativeAnd< TMPLT >::create(), IntegralNativeMod< TMPLT >::create(), CastCast< RESULT_T, SOURCE_T >::create(), BoolPointerIsNotNull< PTR_TYPE >::create(), BoolPointerIsNull< PTR_TYPE >::create(), BoolPointerLessEqual< PTR_TYPE >::create(), BoolPointerLess< PTR_TYPE >::create(), BoolPointerGreaterEqual< PTR_TYPE >::create(), BoolPointerGreater< PTR_TYPE >::create(), BoolPointerNotEqual< PTR_TYPE >::create(), BoolPointerEqual< PTR_TYPE >::create(), BoolNativeIsNotNull< TMPLT >::create(), BoolNativeIsNull< TMPLT >::create(), BoolNativeLessEqual< TMPLT >::create(), BoolNativeLess< TMPLT >::create(), BoolNativeGreaterEqual< TMPLT >::create(), BoolNativeGreater< TMPLT >::create(), BoolNativeNotEqual< TMPLT >::create(), BoolNativeEqual< TMPLT >::create(), BoolToNull::create(), BoolIsNotNull::create(), BoolIsNull::create(), BoolLessEqual::create(), BoolLess::create(), BoolGreaterEqual::create(), BoolGreater::create(), BoolNotEqual::create(), BoolEqual::create(), BoolIsNot::create(), BoolIs::create(), BoolRef::create(), BoolMove::create(), BoolNot::create(), BoolAnd::create(), and BoolOr::create().
00122 { 00123 return types.size(); 00124 }
TProgramCounter InstructionSignature::getPc | ( | ) | const |
Definition at line 127 of file InstructionSignature.cpp.
Referenced by JumpNotNull::create(), JumpNull::create(), JumpFalse::create(), JumpTrue::create(), and Jump::create().
vector< StandardTypeDescriptorOrdinal > InstructionSignature::typeVector | ( | bool(*)(StandardTypeDescriptorOrdinal) | typeFunction | ) | [static] |
Returns a vector that contains all types that match a given StandardTypeDescriptor::function().
Definition at line 134 of file InstructionSignature.cpp.
References STANDARD_TYPE_END_NO_UNICODE, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, and STANDARD_TYPE_VARBINARY.
Referenced by PointerPointerInstructionRegister::registerInstructions(), PointerIntegralInstructionRegister::registerInstructions(), NativeNativeInstructionRegister::registerInstructions(), IntegralPointerInstructionRegister::registerInstructions(), IntegralNativeInstructionRegister::registerInstructions(), CastInstructionRegister::registerInstructions(), BoolPointerInstructionRegister::registerInstructions(), and BoolNativeInstructionRegister::registerInstructions().
00136 { 00137 vector<StandardTypeDescriptorOrdinal> v; 00138 int iter; 00139 StandardTypeDescriptorOrdinal iter2; 00140 assert(STANDARD_TYPE_MIN < STANDARD_TYPE_END_NO_UNICODE); 00141 assert(STANDARD_TYPE_MIN == STANDARD_TYPE_INT_8); 00142 assert(STANDARD_TYPE_END_NO_UNICODE == STANDARD_TYPE_VARBINARY + 1); 00143 00144 for (iter = STANDARD_TYPE_MIN; iter < STANDARD_TYPE_END_NO_UNICODE; 00145 iter++) 00146 { 00147 iter2 = StandardTypeDescriptorOrdinal(iter); 00148 if (typeFunction(iter2)) { 00149 v.push_back(iter2); 00150 } 00151 } 00152 00153 return v; 00154 }
void InstructionSignature::registersToTypes | ( | ) | [private] |
Definition at line 157 of file InstructionSignature.cpp.
References registers, and types.
Referenced by InstructionSignature().
00158 { 00159 for (uint i = 0; i < registers.size(); i++) { 00160 assert(registers[i] != NULL); 00161 types.push_back(registers[i]->type()); 00162 } 00163 00164 }
string InstructionSignature::name [private] |
vector<StandardTypeDescriptorOrdinal> InstructionSignature::types [private] |
Definition at line 81 of file InstructionSignature.h.
Referenced by compute(), registersToTypes(), and size().
vector<RegisterReference*> InstructionSignature::registers [private] |
Definition at line 82 of file InstructionSignature.h.
Referenced by operator[](), and registersToTypes().
bool InstructionSignature::hasRegisters [private] |
TProgramCounter InstructionSignature::pc [private] |
bool InstructionSignature::hasPc [private] |