OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
DisassemblyInstruction Class Reference

#include <DisassemblyInstruction.hh>

Collaboration diagram for DisassemblyInstruction:
Collaboration graph

Public Member Functions

 DisassemblyInstruction ()
 
 ~DisassemblyInstruction ()
 
Word moveCount () const
 
void addMove (DisassemblyInstructionSlot *move)
 
DisassemblyInstructionSlotmove (Word index) const
 
Word longImmediateCount () const
 
void addLongImmediate (DisassemblyImmediateAssignment *longImm)
 
DisassemblyImmediateAssignmentlongImmediate (Word index) const
 
std::string toString () const
 
DisassemblyAnnotationannotation (int index) const
 
void addAnnotation (DisassemblyAnnotation *annotation)
 
int annotationCount () const
 

Private Types

typedef std::vector< DisassemblyInstructionSlot * > MoveTable
 Vector of DisassemblyMoves.
 
typedef std::vector< DisassemblyImmediateAssignment * > LongImmediateTable
 Vector of DisassemblyMoves.
 

Private Member Functions

 DisassemblyInstruction (const DisassemblyInstruction &)
 Copying not allowed.
 
DisassemblyInstruction operator= (const DisassemblyInstruction &)
 Assignment not allowed.
 

Private Attributes

MoveTable moves_
 List of instruction moves.
 
LongImmediateTable longImmediates_
 List of instruction long immediates.
 
std::vector< DisassemblyAnnotation * > annotations_
 Annotationes of instruction itself.
 

Detailed Description

Represents an instruction in the disassembler.

Definition at line 46 of file DisassemblyInstruction.hh.

Member Typedef Documentation

◆ LongImmediateTable

Vector of DisassemblyMoves.

Definition at line 70 of file DisassemblyInstruction.hh.

◆ MoveTable

Vector of DisassemblyMoves.

Definition at line 67 of file DisassemblyInstruction.hh.

Constructor & Destructor Documentation

◆ DisassemblyInstruction() [1/2]

DisassemblyInstruction::DisassemblyInstruction ( )

Constructor.

Definition at line 39 of file DisassemblyInstruction.cc.

39 {
40}

◆ ~DisassemblyInstruction()

DisassemblyInstruction::~DisassemblyInstruction ( )

Destructor.

Definition at line 46 of file DisassemblyInstruction.cc.

46 {
47 // Delete all moves of the instruction.
49}
MoveTable moves_
List of instruction moves.
static void deleteAllItems(SequenceType &aSequence)

References SequenceTools::deleteAllItems(), and moves_.

Here is the call graph for this function:

◆ DisassemblyInstruction() [2/2]

DisassemblyInstruction::DisassemblyInstruction ( const DisassemblyInstruction )
private

Copying not allowed.

Member Function Documentation

◆ addAnnotation()

void DisassemblyInstruction::addAnnotation ( DisassemblyAnnotation annotation)

Adds an annotation to instruction.

Parameters
annotationAnnotation to add.

Definition at line 175 of file DisassemblyInstruction.cc.

175 {
176 annotations_.push_back(annotation);
177}
std::vector< DisassemblyAnnotation * > annotations_
Annotationes of instruction itself.
DisassemblyAnnotation & annotation(int index) const

References annotation(), and annotations_.

Referenced by TPEFDisassembler::createInstruction().

Here is the call graph for this function:

◆ addLongImmediate()

void DisassemblyInstruction::addLongImmediate ( DisassemblyImmediateAssignment longImm)

Adds a long immediate to the instruction.

Parameters
longImmImmediate to be added.

Definition at line 96 of file DisassemblyInstruction.cc.

97 {
98
99 longImmediates_.push_back(longImm);
100}
LongImmediateTable longImmediates_
List of instruction long immediates.

References longImmediates_.

Referenced by POMDisassembler::createInstruction(), TPEFDisassembler::createInstruction(), and POMDisassembler::disassemble().

◆ addMove()

void DisassemblyInstruction::addMove ( DisassemblyInstructionSlot move)

Adds a move to the instruction.

Parameters
moveMove to be added.

Definition at line 58 of file DisassemblyInstruction.cc.

58 {
59 moves_.push_back(move);
60}
DisassemblyInstructionSlot & move(Word index) const

References move(), and moves_.

Referenced by POMDisassembler::createInstruction(), TPEFDisassembler::createInstruction(), and POMDisassembler::disassemble().

Here is the call graph for this function:

◆ annotation()

DisassemblyAnnotation & DisassemblyInstruction::annotation ( int  index) const

Returns annotation of requested index.

Parameters
indexIndex of annotation to return.
Returns
Annotation of requested index.

Definition at line 165 of file DisassemblyInstruction.cc.

165 {
166 return *(annotations_.at(index));
167}

References annotations_.

Referenced by addAnnotation(), and toString().

◆ annotationCount()

int DisassemblyInstruction::annotationCount ( ) const

Returns the number of annotationes stored for the instruction.

Returns
The number of annotationes stored for the instruction.

Definition at line 185 of file DisassemblyInstruction.cc.

185 {
186 return static_cast<int>(annotations_.size());
187}

References annotations_.

Referenced by toString().

◆ longImmediate()

DisassemblyImmediateAssignment & DisassemblyInstruction::longImmediate ( Word  index) const

Returns the long immediate at a given index.

Parameters
indexIndex of the long immediate.
Returns
The long immediate at the index.
Exceptions
OutOfRangeIf the give index is out of range.

Definition at line 122 of file DisassemblyInstruction.cc.

122 {
123 if (index >= longImmediateCount()) {
124 throw OutOfRange(__FILE__, __LINE__, __func__);
125 }
126 return *longImmediates_[index];
127}
#define __func__

References __func__, longImmediateCount(), and longImmediates_.

Referenced by DisassemblyGridTable::GetValue(), and toString().

Here is the call graph for this function:

◆ longImmediateCount()

Word DisassemblyInstruction::longImmediateCount ( ) const

Returns number of long immediates in the instruction.

Returns
Instruction's long immediate count.

Definition at line 109 of file DisassemblyInstruction.cc.

109 {
110 return longImmediates_.size();
111}

References longImmediates_.

Referenced by DisassemblyGridTable::GetValue(), longImmediate(), and toString().

◆ move()

DisassemblyInstructionSlot & DisassemblyInstruction::move ( Word  index) const

Returns the isntruction move at a given index.

Parameters
indexIndex of the move.
Returns
The move at the index.
Exceptions
OutOfRangeIf the give index is out of range.

Definition at line 82 of file DisassemblyInstruction.cc.

82 {
83 if (index >= moveCount()) {
84 std::string procName = "DisassemblyInstruction::move";
85 throw OutOfRange(__FILE__, __LINE__, procName);
86 }
87 return *moves_[index];
88}

References moveCount(), and moves_.

Referenced by addMove(), DisassemblyGridTable::GetValue(), and toString().

Here is the call graph for this function:

◆ moveCount()

Word DisassemblyInstruction::moveCount ( ) const

Returns number of moves in the instruction.

Returns
Instruction move count.

Definition at line 69 of file DisassemblyInstruction.cc.

69 {
70 return moves_.size();
71}

References moves_.

Referenced by move(), and toString().

◆ operator=()

DisassemblyInstruction DisassemblyInstruction::operator= ( const DisassemblyInstruction )
private

Assignment not allowed.

◆ toString()

std::string DisassemblyInstruction::toString ( ) const

Returns disassembly of the instruction.

Returns
Disassembly of the instruction as a string.

Definition at line 135 of file DisassemblyInstruction.cc.

135 {
136 std::string disassembly;
137 for (Word i = 0; i < moveCount(); i++) {
138 if (i > 0) {
139 disassembly = disassembly + ", ";
140 }
141 disassembly = disassembly + move(i).toString();
142 }
143
144 for (Word i = 0; i < longImmediateCount(); i++) {
145
146 disassembly = disassembly + " " + longImmediate(i).toString();
147 }
148
149 for (int i = 0; i < annotationCount(); i++) {
150 disassembly += annotation(i).toString();
151 }
152
153 disassembly = disassembly + " ;";
154 return disassembly;
155}
virtual std::string toString() const
virtual std::string toString() const =0
DisassemblyImmediateAssignment & longImmediate(Word index) const

References annotation(), annotationCount(), longImmediate(), longImmediateCount(), move(), moveCount(), DisassemblyAnnotation::toString(), DisassemblyImmediateAssignment::toString(), and DisassemblyInstructionSlot::toString().

Referenced by POMDisassembler::disassemble(), and TPEFDumper::section().

Here is the call graph for this function:

Member Data Documentation

◆ annotations_

std::vector<DisassemblyAnnotation*> DisassemblyInstruction::annotations_
private

Annotationes of instruction itself.

Definition at line 84 of file DisassemblyInstruction.hh.

Referenced by addAnnotation(), annotation(), and annotationCount().

◆ longImmediates_

LongImmediateTable DisassemblyInstruction::longImmediates_
private

List of instruction long immediates.

Definition at line 81 of file DisassemblyInstruction.hh.

Referenced by addLongImmediate(), longImmediate(), and longImmediateCount().

◆ moves_

MoveTable DisassemblyInstruction::moves_
private

List of instruction moves.

Definition at line 78 of file DisassemblyInstruction.hh.

Referenced by addMove(), move(), moveCount(), and ~DisassemblyInstruction().


The documentation for this class was generated from the following files: