OpenASIP
2.0
|
#include <TPEFCodeSectionWriter.hh>
Protected Member Functions | |
TPEFCodeSectionWriter () | |
virtual | ~TPEFCodeSectionWriter () |
virtual Section::SectionType | type () const |
virtual void | actualWriteData (BinaryStream &stream, const Section *sect) const |
virtual void | writeInfo (BinaryStream &stream, const Section *sect) const |
virtual void | writeId (BinaryStream &stream, HalfWord id) const |
Protected Member Functions inherited from TPEF::TPEFSectionWriter | |
TPEFSectionWriter () | |
virtual | ~TPEFSectionWriter () |
virtual const BinaryWriter & | parent () const |
virtual void | actualWriteHeader (BinaryStream &stream, const Section *sect) const |
virtual void | createKeys (const Section *sect) const |
virtual void | writeSize (BinaryStream &stream, const Section *sect) const |
virtual SectionId | getSectionId () const |
virtual Word | elementSize (const Section *section) const |
Protected Member Functions inherited from TPEF::SectionWriter | |
SectionWriter () | |
virtual | ~SectionWriter () |
virtual void | finalize (BinaryStream &stream, Section *section) const |
Private Member Functions | |
TPEFCodeSectionWriter (const TPEFCodeSectionWriter &) | |
Copying not allowed. More... | |
TPEFCodeSectionWriter & | operator= (const TPEFCodeSectionWriter &) |
Assignment not allowed. More... | |
void | writeAttributeField (BinaryStream &stream, SectionElement *elem, bool isEnd) const |
void | writeDataField (BinaryStream &stream, SectionElement *elem) const |
void | writeAnnotations (BinaryStream &stream, SectionElement *elem) const |
Static Private Attributes | |
static const TPEFCodeSectionWriter | instance_ |
Unique instance of class. More... | |
static const Byte | IMMEDIATE_VALUE_MAX_BYTES = 16 |
Maximum number of bytes that single immediate can contain. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from TPEF::SectionWriter | |
static void | writeHeader (BinaryStream &stream, const Section *sect, const BinaryWriter *writer) |
static void | writeData (BinaryStream &stream, const Section *sect, const BinaryWriter *writer) |
static void | finalizeBinary (BinaryStream &stream, const Binary *binaryToFinalize, const BinaryWriter *writer) |
Static Protected Member Functions inherited from TPEF::SectionWriter | |
static void | registerSectionWriter (const SectionWriter *sWriter) |
static SectionId | getUniqueSectionId () |
Writes TPEF code section to file.
Definition at line 48 of file TPEFCodeSectionWriter.hh.
|
protected |
Constructor.
Registers itself to SectionWriter.
Definition at line 64 of file TPEFCodeSectionWriter.cc.
References TPEF::SectionWriter::registerSectionWriter().
|
protectedvirtual |
|
private |
Copying not allowed.
|
protectedvirtual |
Writes the data of the section to stream.
stream | The stream to be written to. |
sect | The section to be written. |
Reimplemented from TPEF::TPEFSectionWriter.
Definition at line 91 of file TPEFCodeSectionWriter.cc.
References TPEF::ReferenceManager::SafePointer::addObjectReference(), assert, TPEF::InstructionElement::begin(), TPEF::Section::element(), TPEF::Section::elementCount(), TPEF::ReferenceManager::SafePointer::isReferenced(), TPEF::ReferenceManager::SectionKey::sectionId(), TPEF::ReferenceManager::SafePointer::sectionKeyFor(), TPEF::SectionSizeReplacer::setSize(), writeAnnotations(), writeAttributeField(), writeDataField(), and TPEF::BinaryStream::writePosition().
|
private |
Assignment not allowed.
|
protectedvirtual |
Returns the type of section that this writer writes.
Implements TPEF::TPEFSectionWriter.
Definition at line 80 of file TPEFCodeSectionWriter.cc.
References TPEF::Section::ST_CODE.
|
private |
Writes annotations to stream if there are any.
stream | Stream to write. |
elem | Element, whose annotations are written. |
Definition at line 304 of file TPEFCodeSectionWriter.cc.
References TPEF::InstructionElement::annotation(), TPEF::InstructionElement::annotationCount(), TPEF::InstructionAnnotation::byte(), BYTE_BITWIDTH, TPEF::TPEFHeaders::IANNOTE_CONTINUATION, TPEF::TPEFHeaders::IANNOTE_SIZE, TPEF::InstructionAnnotation::id(), TPEF::InstructionAnnotation::size(), and TPEF::BinaryStream::writeByte().
Referenced by actualWriteData().
|
private |
Writes the attribute field of either move or immediate.
stream | The stream to be written to. |
elem | The element to be written out. |
Definition at line 145 of file TPEFCodeSectionWriter.cc.
References assert, BYTE_BITWIDTH, TPEF::TPEFHeaders::IA_ANNOTE, TPEF::TPEFHeaders::IA_EMPTY, TPEF::TPEFHeaders::IA_END, TPEF::TPEFHeaders::IA_MGUARD, TPEF::TPEFHeaders::IA_TYPE, TPEF::MoveElement::isEmpty(), TPEF::MoveElement::isGuarded(), TPEF::InstructionElement::isImmediate(), TPEF::ImmediateElement::length(), and TPEF::BinaryStream::writeByte().
Referenced by actualWriteData().
|
private |
Writes the data portion of either move or immediate element.
stream | The stream to be written to. |
elem | The element to be written. |
Definition at line 200 of file TPEFCodeSectionWriter.cc.
References assert, TPEF::MoveElement::bus(), TPEF::ImmediateElement::byte(), TPEF::ImmediateElement::destinationIndex(), TPEF::MoveElement::destinationIndex(), TPEF::MoveElement::destinationType(), TPEF::ImmediateElement::destinationUnit(), TPEF::MoveElement::destinationUnit(), TPEF::MoveElement::guardIndex(), TPEF::MoveElement::guardType(), TPEF::MoveElement::guardUnit(), TPEF::TPEFHeaders::IE_GUARD_INV_MASK, IMMEDIATE_VALUE_MAX_BYTES, TPEF::MoveElement::isEmpty(), TPEF::MoveElement::isGuarded(), TPEF::MoveElement::isGuardInverted(), TPEF::ImmediateElement::length(), TPEF::MoveElement::MF_IMM, TPEF::MoveElement::MF_RF, TPEF::MoveElement::MF_UNIT, TPEF::TPEFHeaders::MVD_RF, TPEF::TPEFHeaders::MVD_UNIT, TPEF::TPEFHeaders::MVG_RF, TPEF::TPEFHeaders::MVG_UNIT, TPEF::TPEFHeaders::MVS_IMM, TPEF::TPEFHeaders::MVS_RF, TPEF::TPEFHeaders::MVS_UNIT, TPEF::MoveElement::sourceIndex(), TPEF::MoveElement::sourceType(), TPEF::MoveElement::sourceUnit(), TPEF::BinaryStream::writeByte(), TPEF::BinaryStream::writeHalfWord(), and writeId().
Referenced by actualWriteData().
|
protectedvirtual |
Writes Bus, FU or RF id according to TPEF version.
Original TPEF version 1 supports only less than 256 buses, FUs and RFs. Version 2 fixes that issue and we need to check the stream version for proper amount of bytes to write.
stream | Stream to which the data is written. |
sect | id of the component. |
Definition at line 372 of file TPEFCodeSectionWriter.cc.
References TPEF::TPEFHeaders::TPEF_V1, TPEF::BinaryStream::TPEFVersion(), TPEF::BinaryStream::writeByte(), and TPEF::BinaryStream::writeHalfWord().
Referenced by writeDataField().
|
protectedvirtual |
Writes the ‘info’ field of code section header.
The ‘info’ field of code sections normally contains information related to instruction size and encoding. The TUT_TTA architecture does not use this field and ignores its contents.
stream | Stream to which the data is written. |
sect | Input section. Unused. |
Reimplemented from TPEF::TPEFSectionWriter.
Definition at line 351 of file TPEFCodeSectionWriter.cc.
References TPEF::BinaryStream::writeByte(), and TPEF::BinaryStream::writeHalfWord().
|
staticprivate |
Maximum number of bytes that single immediate can contain.
Definition at line 80 of file TPEFCodeSectionWriter.hh.
Referenced by writeDataField().
|
staticprivate |
Unique instance of class.
Definition at line 78 of file TPEFCodeSectionWriter.hh.