OpenASIP
2.0
|
#include <Section.hh>
Public Member Functions | |
virtual bool | isChunkable () const |
virtual Chunk * | chunk (SectionOffset offset) const |
virtual void | assureInSection (SectionOffset offset) const |
virtual | ~RawSection () |
bool | empty () const |
virtual void | setLengthInMAUs (Word length) |
virtual Word | lengthInMAUs () const |
virtual void | setDataLength (Word length) |
virtual Word | length () const |
virtual Word | bytesToMAUs (Word byteCount) const |
virtual Word | MAUsToBytes (Word mauCount) const |
virtual Word | chunkToMAUIndex (const Chunk *chunk) const |
Word | referredChunkCount () const |
Chunk * | referredChunk (Word index) const |
bool | belongsToSection (const Chunk *chunk) const |
Public Member Functions inherited from TPEF::Section | |
virtual SectionType | type () const =0 |
Returns SectioType of actual section instance. More... | |
virtual | ~Section () |
bool | isProgramSection () const |
bool | isAuxSection () const |
virtual void | addElement (SectionElement *element) |
virtual void | setElement (Word index, SectionElement *element) |
SectionElement * | element (Word index) const |
Word | elementCount () const |
void | setFlagNoBits () |
void | unsetFlagNoBits () |
bool | noBits () const |
bool | vLen () const |
Byte | flags () const |
void | setFlags (Byte flagByte) |
void | setStartingAddress (AddressImage address) |
AddressImage | startingAddress () const |
void | setLink (const ReferenceManager::SafePointer *aLink) |
void | setLink (Section *aLink) |
Section * | link () const |
void | setASpace (const ReferenceManager::SafePointer *addrSpace) |
void | setASpace (ASpaceElement *addrSpace) |
ASpaceElement * | aSpace () const |
void | setName (const ReferenceManager::SafePointer *sectionName) |
void | setName (Chunk *sectionName) |
Chunk * | name () const |
virtual bool | isDataSection () const |
virtual bool | isCodeSection () const |
Public Member Functions inherited from TPEF::SafePointable | |
virtual | ~SafePointable () |
Protected Member Functions | |
RawSection () | |
Protected Member Functions inherited from TPEF::Section | |
virtual Section * | clone () const =0 |
Creates clone of instance. More... | |
Section () | |
void | setFlagVLen () |
void | unsetFlagVLen () |
Protected Member Functions inherited from TPEF::SafePointable | |
SafePointable () | |
Private Types | |
typedef std::map< SectionOffset, Chunk * > | ChunkMap |
Type of map that contains chunks. More... | |
Private Member Functions | |
RawSection (const RawSection &) | |
Private Attributes | |
Word | length_ |
The length of raw data section. More... | |
ChunkMap | dataChunks_ |
Container for already created chunks. More... | |
std::vector< Chunk * > | referredChunksCache_ |
Table containing all the chunks that are requested from section. More... | |
Additional Inherited Members | |
Public Types inherited from TPEF::Section | |
enum | SectionType { ST_NULL = 0x00, ST_STRTAB = 0x01, ST_SYMTAB = 0x02, ST_DEBUG = 0x03, ST_RELOC = 0x04, ST_LINENO = 0x05, ST_NOTE = 0x06, ST_ADDRSP = 0x07, ST_MR = 0x0A, ST_CODE = 0x81, ST_DATA = 0x82, ST_UDATA = 0x83, ST_LEDATA = 0x84, ST_DUMMY = 0xff } |
enum | SectionFlag { SF_VLEN = 0x40, SF_NOBITS = 0x80 } |
Static Public Member Functions inherited from TPEF::Section | |
static Section * | createSection (SectionType type) |
static bool | isProgramSection (SectionType type) |
Static Protected Member Functions inherited from TPEF::Section | |
static void | registerSection (const Section *section) |
Abstract base class for sections that stores raw data.
These sections are chunkable, that is they can create elements (chunks) on demand. These chunks point (using offsets) to section's raw data.
Definition at line 196 of file Section.hh.
|
private |
Type of map that contains chunks.
Definition at line 234 of file Section.hh.
|
virtual |
Destructor.
Definition at line 186 of file Section.cc.
References dataChunks_, and MapTools::deleteAllValues().
|
protected |
|
private |
|
virtual |
Checks that section is not indexed out of bounds.
If section is indexed out of bounds, exception is thrown.
offset | The offset being checked that it is in the area of section. |
OutOfRange | if not in area of section. |
Definition at line 354 of file Section.cc.
References __func__, and length().
Referenced by chunk().
bool TPEF::RawSection::belongsToSection | ( | const Chunk * | chunk | ) | const |
Returns true if the chunk in parameter belongs to this section.
chunk | Chunk that is checked. |
Definition at line 238 of file Section.cc.
References chunk(), MapTools::containsKey(), dataChunks_, and TPEF::Chunk::offset().
Referenced by TTAProgram::TPEFProgramFactory::createDataMemories(), and TPEFDumper::section().
|
virtual |
Returns how many MAUs is amount of bytes described in parameter.
bytes | Number of bytes to convert. |
Definition at line 296 of file Section.cc.
References abortWithError, TPEF::Section::aSpace(), assert, and BYTE_BITWIDTH.
Referenced by chunkToMAUIndex(), TTAProgram::TPEFProgramFactory::createLabels(), and lengthInMAUs().
|
virtual |
Returns a chunk object to data in the section at a given offset.
Checks that there is something in the section before returning chunk. In the other words, Chunks can not be given from outside of section's data.
offset | The offset of wanted data chunk. |
NotChunkable | If called on a section that is not RawSection. |
Reimplemented from TPEF::Section.
Definition at line 212 of file Section.cc.
References __func__, assureInSection(), MapTools::containsKey(), dataChunks_, Exception::errorMessage(), and referredChunksCache_.
Referenced by TPEF::TPEFStringSectionWriter::actualWriteData(), TPEF::TPEFDataSectionWriter::actualWriteData(), belongsToSection(), TPEF::DataSection::byte(), TPEF::StringSection::chunk2String(), chunkToMAUIndex(), TTAProgram::ProgramWriter::createBinary(), TTAProgram::ProgramWriter::createDataSections(), TPEF::TPEFUDataSectionWriter::createKeys(), TTAProgram::ProgramWriter::createRelocSections(), LabelManager::createSymbolWithReference(), LabelManager::finalize(), TPEF::AOutSymbolSectionReader::initializeSymbol(), TPEF::TPEFStringSectionReader::readData(), TPEF::AOutStringSectionReader::readData(), TPEF::TPEFTools::sectionOfElement(), TPEF::StringSection::string2Chunk(), and DataSectionCreator::writeDataLineToTPEF().
|
virtual |
Returns MAU index to given chunk.
chunk | Chunk whose MAU index should be found. |
Definition at line 341 of file Section.cc.
References bytesToMAUs(), chunk(), and TPEF::Chunk::offset().
Referenced by TTAProgram::TPEFProgramFactory::createDataMemories(), TPEF::TPEFRelocSectionReader::finalize(), TPEF::AOutRelocationSectionReader::finalize(), and TPEFDumper::section().
bool TPEF::RawSection::empty | ( | ) | const |
Referenced by TPEF::TPEFStringSectionReader::readData().
|
virtual |
Returns true if section is chunkable.
Reimplemented from TPEF::Section.
Definition at line 196 of file Section.cc.
|
virtual |
Returns length of data inside section.
Reimplemented in TPEF::DataSection.
Definition at line 275 of file Section.cc.
References length_.
Referenced by assureInSection(), lengthInMAUs(), TPEF::TPEFTools::sectionOfElement(), setDataLength(), setLengthInMAUs(), and TPEF::TPEFUDataSectionWriter::writeSize().
|
virtual |
Returns length of data section in MAUs.
Definition at line 285 of file Section.cc.
References bytesToMAUs(), and length().
Referenced by TTAProgram::ProgramWriter::createBinary(), TTAProgram::TPEFProgramFactory::createDataMemories(), TTAProgram::ProgramWriter::createDataSections(), LabelManager::findRelocationDstSection(), TTAProgram::ProgramWriter::findSection(), LabelManager::findSectionByAddress(), and TPEFDumper::section().
|
virtual |
Returns how many bytes some amount of MAUs are.
maus | Number of MAUs to convert. |
Definition at line 320 of file Section.cc.
References abortWithError, TPEF::Section::aSpace(), assert, and BYTE_BITWIDTH.
Referenced by TTAProgram::ProgramWriter::createBinary(), TTAProgram::ProgramWriter::createRelocSections(), LabelManager::createSymbolWithReference(), LabelManager::finalize(), TPEF::DataSection::MAU(), setLengthInMAUs(), DataSectionCreator::writeDataLineToTPEF(), TPEF::LEDataSection::writeValue(), and TPEF::DataSection::writeValue().
Chunk * TPEF::RawSection::referredChunk | ( | Word | index | ) | const |
Returns chunks that is requested from section before.
Index | of chunk to return. |
Definition at line 378 of file Section.cc.
References dataChunks_, and referredChunksCache_.
Referenced by TPEF::TPEFUDataSectionWriter::createKeys().
Word TPEF::RawSection::referredChunkCount | ( | ) | const |
Returns number of chunks that are requested from section.
Definition at line 366 of file Section.cc.
References dataChunks_.
Referenced by TPEF::TPEFUDataSectionWriter::createKeys().
|
virtual |
Sets the length of section's data.
length | bytes of data in section. |
Reimplemented in TPEF::DataSection.
Definition at line 253 of file Section.cc.
References length(), and length_.
Referenced by TPEF::TPEFUDataSectionReader::readData(), TPEF::AOutReader::readData(), and setLengthInMAUs().
|
virtual |
Sets the length of section's data.
length | Section length in MAUs. |
Definition at line 265 of file Section.cc.
References length(), MAUsToBytes(), and setDataLength().
Referenced by TTAProgram::ProgramWriter::createDataSections(), and DataSectionCreator::finalize().
|
mutableprivate |
Container for already created chunks.
Definition at line 237 of file Section.hh.
Referenced by belongsToSection(), chunk(), referredChunk(), referredChunkCount(), and ~RawSection().
|
private |
The length of raw data section.
Definition at line 231 of file Section.hh.
Referenced by length(), and setDataLength().
|
mutableprivate |
Table containing all the chunks that are requested from section.
Definition at line 240 of file Section.hh.
Referenced by chunk(), and referredChunk().