|
OpenASIP 2.2
|
#include <InstructionBitVector.hh>


Public Member Functions | |
| InstructionBitVector () | |
| InstructionBitVector (const InstructionBitVector &toCopy) | |
| virtual | ~InstructionBitVector () |
| void | pushBack (const InstructionBitVector &bits) |
| void | pushBack (const BitVector &bits) |
| InstructionBitVector * | subVector (unsigned int firstIndex, unsigned int lastIndex) const |
| void | startSettingInstructionReference (const TTAProgram::Instruction &instruction) |
| void | addIndexBoundsForReference (IndexBound bounds) |
| void | fixInstructionAddress (const TTAProgram::Instruction &instruction, unsigned int address) |
| void | markInstructionStartingPoint (unsigned int position) |
| unsigned int | instructionCount () const |
| unsigned int | instructionStartingPoint (unsigned int index) const |
Public Member Functions inherited from BitVector | |
| BitVector () | |
| BitVector (const BitVector &vector, unsigned int firstIndex, unsigned int lastIndex) | |
| virtual | ~BitVector () |
| void | pushBack (long long unsigned int integer, int size) |
| void | pushBack (const BitVector &bits) |
| void | pushBack (bool bit) |
| std::string | toString () const |
Private Types | |
| typedef std::vector< IndexBound > | IndexBoundTable |
| A vector type that stores index bounds. | |
| typedef std::set< IndexBoundTable * > | IndexBoundSet |
| A set type that stores IndexBoundTables. | |
| typedef std::map< const TTAProgram::Instruction *, IndexBoundSet * > | ReferenceMap |
| A map type that maps Instructions to IndexBoundSets. | |
| typedef std::vector< unsigned int > | BoundaryTable |
| A vector type that stores instruction boundaries. | |
| typedef std::map< const TTAProgram::Instruction *, unsigned int > | InstructionAddressTable |
| A map type for instruction addresses. | |
Private Member Functions | |
| IndexBoundSet & | indexBounds (const TTAProgram::Instruction &instruction) |
| void | addIndexBoundTables (const IndexBoundSet &from, IndexBoundSet &to) |
| void | fixBits (const IndexBoundTable &indexes, unsigned int value) |
Static Private Member Functions | |
| static unsigned int | availableSize (const IndexBoundTable &indexes) |
Private Attributes | |
| ReferenceMap | references_ |
| Contains information of the parts of the bit vector that refer to an instruction address. | |
| IndexBoundTable * | currentTable_ |
| IndexBoundTable being under construction. | |
| BoundaryTable | instructionBoundaries_ |
| Stores the instruction boundaries. | |
| InstructionAddressTable | instructionAddresses_ |
| Addresses of the instructions. | |
A bit vector class that provides instruction relocation capabilities.
Definition at line 50 of file InstructionBitVector.hh.
|
private |
A vector type that stores instruction boundaries.
Definition at line 81 of file InstructionBitVector.hh.
|
private |
A set type that stores IndexBoundTables.
Definition at line 76 of file InstructionBitVector.hh.
|
private |
A vector type that stores index bounds.
Definition at line 74 of file InstructionBitVector.hh.
|
private |
A map type for instruction addresses.
Definition at line 84 of file InstructionBitVector.hh.
|
private |
A map type that maps Instructions to IndexBoundSets.
Definition at line 79 of file InstructionBitVector.hh.
| InstructionBitVector::InstructionBitVector | ( | ) |
The constructor.
Definition at line 46 of file InstructionBitVector.cc.
| InstructionBitVector::InstructionBitVector | ( | const InstructionBitVector & | toCopy | ) |
The copy constructor.
| toCopy | Bit vector to copy. |
Definition at line 56 of file InstructionBitVector.cc.
References currentTable_, indexBounds(), and references_.

|
virtual |
| void InstructionBitVector::addIndexBoundsForReference | ( | IndexBound | bounds | ) |
Adds a pair of indexes that bound a part of the bit vector that refer to address of another instruction (given in startSettingInstructionReference).
| start | The start index (included in the boundary). |
| end | The end index (included in the boundary). |
Definition at line 179 of file InstructionBitVector.cc.
References assert, currentTable_, IndexBound::slotEndIndex(), and IndexBound::slotStartIndex().
Referenced by CodeCompressorPlugin::bemInstructionBits(), and CodeCompressorPlugin::encodeImmediateTerminal().

|
private |
Adds the IndexBoundTables from the given IndexBoundSet to the given IndexBoundSet.
| from | The IndexBoundSet from which the tables are copied. |
| to | The IndexBoundSet to which the tables are added. |
Definition at line 308 of file InstructionBitVector.cc.
Referenced by pushBack().
|
staticprivate |
Returns the number of bits available in the given IndexBoundTable.
| indexes | The IndexBoundTable. |
Definition at line 387 of file InstructionBitVector.cc.
Referenced by fixBits().
|
private |
Fixes the sections given in the IndexBoundTable of the bit vector with the given value.
| indexes | The table of section being fixed. |
| value | The value. |
| OutOfRange | If the value is too large to fit to the boundary. |
Definition at line 338 of file InstructionBitVector.cc.
References __func__, assert, availableSize(), MathTools::bit(), IndexBound::limmLeftIndex(), IndexBound::limmRightIndex(), IndexBound::limmWidth(), MathTools::requiredBits(), IndexBound::slotEndIndex(), and IndexBound::slotStartIndex().
Referenced by fixInstructionAddress(), and pushBack().

| void InstructionBitVector::fixInstructionAddress | ( | const TTAProgram::Instruction & | instruction, |
| unsigned int | address | ||
| ) |
Fixes the address of the given instruction.
When this is called, all the references to the given instruction are fixed with the given value of the address.
| instruction | The instruction. |
| address | The address of the instruction. |
| OutOfRange | If the given value is too large to fit to a boundary that refers to the instruction. |
Definition at line 199 of file InstructionBitVector.cc.
References MapTools::containsKey(), fixBits(), indexBounds(), instructionAddresses_, and references_.
Referenced by CodeCompressorPlugin::addInstruction().

|
private |
Returns the set of index bounds that refer to the given instruction.
| instruction | The instruction. |
Definition at line 284 of file InstructionBitVector.cc.
References MapTools::containsKey(), MapTools::keyForValue(), and references_.
Referenced by fixInstructionAddress(), InstructionBitVector(), and startSettingInstructionReference().

| unsigned int InstructionBitVector::instructionCount | ( | ) | const |
Returns the number of instructions in the vector.
The count is determined by means of the number of instruction boundaries.
Definition at line 254 of file InstructionBitVector.cc.
References instructionBoundaries_.
Referenced by ArrayProgramImageWriter::writeImage(), AsciiProgramImageWriter::writeImage(), and Bin2nProgramImageWriter::writeImage().
| unsigned int InstructionBitVector::instructionStartingPoint | ( | unsigned int | index | ) | const |
Returns the instruction starting point at the given position.
The boundaries are returned in the correct order, that is, if parameter 0 is given, the starting point of the first instruction is returned.
| OutOfRange | If the given index is too large. |
Definition at line 269 of file InstructionBitVector.cc.
References instructionBoundaries_.
Referenced by ArrayProgramImageWriter::writeImage(), AsciiProgramImageWriter::writeImage(), and Bin2nProgramImageWriter::writeImage().
| void InstructionBitVector::markInstructionStartingPoint | ( | unsigned int | position | ) |
Marks the instruction starting point.
The instruction starting point should be marked to the position of the first bit (the smallest index in the vector) of instruction.
| position | The position of the starting point. |
Definition at line 224 of file InstructionBitVector.cc.
References assert, and instructionBoundaries_.
Referenced by CodeCompressorPlugin::addInstruction().
| void InstructionBitVector::pushBack | ( | const BitVector & | bits | ) |
Concatenates the given bit vector to this vector.
| bits | The bit vector to be concatenated to this vector. |
Definition at line 149 of file InstructionBitVector.cc.
References BitVector::pushBack().

| void InstructionBitVector::pushBack | ( | const InstructionBitVector & | bits | ) |
Concatenates the given instruction bit vector to this vector.
Fixes the instruction references of the given bit vector with the known instruction addresses.
| bits | The bit vector to be concatenated to this vector. |
| OutOfRange | If some of the instruction references cannot be fixed due to insufficient bit width. |
Definition at line 102 of file InstructionBitVector.cc.
References addIndexBoundTables(), MapTools::containsKey(), fixBits(), instructionAddresses_, MapTools::keyForValue(), and references_.
Referenced by CodeCompressorPlugin::addInstruction(), CodeCompressorPlugin::bemBits(), and CodeCompressorPlugin::encodeImmediateTerminal().

| void InstructionBitVector::startSettingInstructionReference | ( | const TTAProgram::Instruction & | instruction | ) |
Starts setting an instruction reference.
| instruction | The instruction being referenced. |
Definition at line 160 of file InstructionBitVector.cc.
References currentTable_, and indexBounds().
Referenced by CodeCompressorPlugin::bemInstructionBits(), and CodeCompressorPlugin::encodeImmediateTerminal().

| InstructionBitVector * InstructionBitVector::subVector | ( | unsigned int | firstIndex, |
| unsigned int | lastIndex | ||
| ) | const |
|
private |
IndexBoundTable being under construction.
Definition at line 96 of file InstructionBitVector.hh.
Referenced by addIndexBoundsForReference(), InstructionBitVector(), and startSettingInstructionReference().
|
private |
Addresses of the instructions.
Definition at line 100 of file InstructionBitVector.hh.
Referenced by fixInstructionAddress(), and pushBack().
|
private |
Stores the instruction boundaries.
Definition at line 98 of file InstructionBitVector.hh.
Referenced by instructionCount(), instructionStartingPoint(), and markInstructionStartingPoint().
|
private |
Contains information of the parts of the bit vector that refer to an instruction address.
Definition at line 94 of file InstructionBitVector.hh.
Referenced by fixInstructionAddress(), indexBounds(), InstructionBitVector(), and pushBack().