92 assert(theCodeSection != NULL);
102 theCodeSection->
element(currIndex));
109 std::vector<MoveElement*> moves;
112 if (currElement->
isMove()) {
115 moves.push_back(move);
127 immediates[immKey] = imm;
166 theCodeSection->
element(currIndex));
168 }
while (!currElement->
begin());
174 assert(resources != NULL);
176 std::vector<DisassemblyInstructionSlot*> organizedInstr;
185 organizedInstr.push_back(NULL);
189 for (
unsigned int i = 0; i < moves.size(); i++) {
229 if (currMove->
bus() > 0) {
230 organizedInstr[currMove->
bus() - 1] = newMove;
232 organizedInstr.push_back(newMove);
246 for (Word i = 0; i < organizedInstr.size(); i++) {
248 if (organizedInstr[i] != NULL) {
249 newInstruction->
addMove(organizedInstr[i]);
253 newInstruction->
addMove(newNOP);
257 return newInstruction;
270 assert(theCodeSection != NULL);
311 assert(theCodeSection != NULL);
313 for (Word i = 0; i < theCodeSection->
elementCount(); i++) {
341 assert(resources != NULL);
416 std::string opString =
419 std::string::size_type dotIndex = opString.rfind(
'.');
420 std::string opName = opString.substr(0,dotIndex);
425 std::string opIndexStr = opString.substr(
426 dotIndex, opString.length() - dotIndex);
450 "Can't find universal operand or special register "
471 std::string fuPortName =
482 std::string operandString =
485 std::string::size_type dotPos = operandString.rfind(
".");
487 assert(dotPos != std::string::npos);
489 std::string opName = operandString.substr(0, dotPos);
491 std::string operandIndexString =
492 operandString.substr(
493 dotPos+1, operandString.length() - dotPos - 1);
513 "Can't find real port, operation or special register by "
#define abortWithError(message)
#define assert(condition)
static std::string toString(const T &source)
static int toInt(const T &source)
static unsigned int toUnsignedInt(const T &source)
void addAnnotation(DisassemblyAnnotation *annotation)
void addAnnotation(DisassemblyAnnotation *annotation)
void addLongImmediate(DisassemblyImmediateAssignment *longImm)
void addMove(DisassemblyInstructionSlot *move)
virtual Word startAddress() const
virtual DisassemblyInstruction * createInstruction(Word instructionIndex) const
DisassemblyElement * createDisassemblyElement(TPEF::MoveElement::FieldType type, Word unit, Word index, ImmediateMap &immediateMap) const
TPEFDisassembler(const TPEF::Binary &aTpef)
std::pair< Word, Word > ImmediateKey
std::vector< Word > instructionStartCache_
Cache of starting elements of instructions.
const TPEF::Binary * tpef_
Binary where data for disassembler is retrieved.
virtual ~TPEFDisassembler()
std::map< ImmediateKey, TPEF::ImmediateElement * > ImmediateMap
virtual Word instructionCount() const
Section * section(Word index) const
virtual InstructionElement * element(Word index) const
const std::vector< Byte > & payload() const
Word annotationCount() const
InstructionAnnotation * annotation(Word index) const
FieldType destinationType() const
HalfWord destinationIndex() const
HalfWord destinationUnit() const
HalfWord guardUnit() const
HalfWord sourceUnit() const
FieldType guardType() const
HalfWord guardIndex() const
bool isGuardInverted() const
HalfWord sourceIndex() const
FieldType sourceType() const
ResourceType type() const
static const std::string RETURN_ADDRESS_NAME
Reserved string of return address special register.
@ MRT_SR
Special register.
@ MRT_PORT
Function unit port.
@ MRT_OP
Operation operand or function unit register.
@ UNIVERSAL_BUS
Universal bus.
@ UNIVERSAL_FU
Universal function unit.
@ INT_RF
Universal integer register file.
@ UNIVERSAL_RF_MASK
Bit to check if registerfile is real or universal.
@ BOOL_RF
Universal boolean register file.
@ FP_RF
Universal floating point register file.
ResourceElement & findResource(ResourceElement::ResourceType aType, HalfWord anId) const
bool hasResource(ResourceElement::ResourceType aType, HalfWord anId) const
AddressImage startingAddress() const
@ ST_MR
Machine resources section.
SectionElement * element(Word index) const
Word elementCount() const
std::string chunk2String(const Chunk *chunk) const