OpenASIP
2.0
|
#include <DataMemory.hh>
Public Member Functions | |
DataMemory (const TTAMachine::AddressSpace &aSpace) | |
virtual | ~DataMemory () |
void | addDataDefinition (DataDefinition *dataDef) |
DataDefinition & | dataDefinition (Address address) const |
DataDefinition & | dataDefinition (int index) const |
int | dataDefinitionCount () const |
int | dataDefinitionsEnd () const |
void | deleteDataDefinition (int index) |
const TTAMachine::AddressSpace & | addressSpace () const |
void | setAddressSpace (const TTAMachine::AddressSpace &space) |
DataMemory * | copy () const |
Private Types | |
typedef std::map< AddressImage, DataDefinition * > | DataDefMap |
Map for data definitions. More... | |
Private Attributes | |
const TTAMachine::AddressSpace * | ramSpace_ |
Address space of the memory. More... | |
DataDefMap | dataDefs_ |
Data definitions for the address space. More... | |
std::vector< DataDefinition * > | indexCache_ |
Cache for indexing dataDefinitions. More... | |
Represents an address space containing data.
Data definitions are ordered in the DataMemory class so that largest index contains the last data definition.
Definition at line 56 of file DataMemory.hh.
|
private |
Map for data definitions.
Definition at line 76 of file DataMemory.hh.
TTAProgram::DataMemory::DataMemory | ( | const TTAMachine::AddressSpace & | aSpace | ) |
Sets address space of the memory.
aSpace | Address space of the memory. |
Definition at line 46 of file DataMemory.cc.
Referenced by copy().
|
virtual |
Deletes all the added definitions.
Definition at line 53 of file DataMemory.cc.
References dataDefs_, and MapTools::deleteAllValues().
void TTAProgram::DataMemory::addDataDefinition | ( | DataDefinition * | dataDef | ) |
Adds data to memory.
Data definitions are sorted by starting address of defined area.
dataDef | Definition to add. |
Definition at line 66 of file DataMemory.cc.
References dataDefs_, indexCache_, TTAProgram::Address::location(), and TTAProgram::DataDefinition::startAddress().
Referenced by copy(), TTAProgram::Program::copyDataMemoriesFrom(), llvm::LLVMTCEBuilder::createDataDefinition(), TTAProgram::TPEFProgramFactory::createDataMemories(), llvm::LLVMTCEBuilder::createFPDataDefinition(), llvm::LLVMTCEBuilder::createGlobalValueDataDefinition(), llvm::LLVMTCEBuilder::createIntDataDefinition(), llvm::LLVMTCEBuilder::emitDataDef(), llvm::LLVMTCEBuilder::emitSPInitialization(), llvm::LLVMTCEBuilder::initDataSections(), and llvm::LLVMTCEBuilder::padToAlignment().
const TTAMachine::AddressSpace & TTAProgram::DataMemory::addressSpace | ( | ) | const |
Returns the address space of the data memory.
Definition at line 182 of file DataMemory.cc.
References ramSpace_.
Referenced by TTAProgram::Program::copyDataMemoriesFrom(), TTAProgram::ProgramWriter::createDataSections(), TTAProgram::Program::dataMemory(), POMDisassembler::disassembleProgram(), SimulatorFrontend::initializeDataMemories(), and main().
DataMemory * TTAProgram::DataMemory::copy | ( | ) | const |
POM style copy constructor, which supports dynamic binding.
Definition at line 206 of file DataMemory.cc.
References addDataDefinition(), TTAProgram::DataDefinition::copy(), dataDefinition(), dataDefinitionCount(), DataMemory(), and ramSpace_.
DataDefinition & TTAProgram::DataMemory::dataDefinition | ( | Address | address | ) | const |
Finds the data definition, which contains the requested address.
address | Address whose data definition is requested. |
Definition at line 79 of file DataMemory.cc.
References __func__, dataDefs_, TTAProgram::Address::location(), TTAMachine::Component::name(), ramSpace_, TTAProgram::DataDefinition::size(), TTAProgram::DataDefinition::startAddress(), and Conversion::toString().
Referenced by StaticProgramAnalyzer::addProgram(), ControlFlowGraph::computeLeadersFromRelocations(), copy(), TTAProgram::Program::copyDataMemoriesFrom(), TTAProgram::TPEFProgramFactory::createDataMemories(), TTAProgram::ProgramWriter::createDataSections(), llvm::LLVMTCEBuilder::deleteDeadProcedures(), POMDisassembler::disassembleProgram(), SimulatorFrontend::initializeDataMemories(), main(), TTAProgram::Program::replaceUniversalAddressSpaces(), and setAddressSpace().
DataDefinition & TTAProgram::DataMemory::dataDefinition | ( | int | index | ) | const |
Finds the data definition by index.
Indices may change if new definitions are added to memory.
index | Index of the requested data definition. |
Definition at line 110 of file DataMemory.cc.
References dataDefs_, and indexCache_.
int TTAProgram::DataMemory::dataDefinitionCount | ( | ) | const |
Returns the number of data definitions stored in memory.
Definition at line 129 of file DataMemory.cc.
References dataDefs_.
Referenced by StaticProgramAnalyzer::addProgram(), ControlFlowGraph::computeLeadersFromRelocations(), copy(), TTAProgram::Program::copyDataMemoriesFrom(), TTAProgram::TPEFProgramFactory::createDataMemories(), TTAProgram::ProgramWriter::createDataSections(), deleteDataDefinition(), POMDisassembler::disassembleProgram(), SimulatorFrontend::initializeDataMemories(), main(), TTAProgram::Program::replaceUniversalAddressSpaces(), and setAddressSpace().
int TTAProgram::DataMemory::dataDefinitionsEnd | ( | ) | const |
Returns the place where the data definitions end. Calculates it based only on the last data definition (since dataDefs_ is sorted).
Definition at line 141 of file DataMemory.cc.
References dataDefs_, TTAProgram::Address::location(), TTAProgram::DataDefinition::size(), and TTAProgram::DataDefinition::startAddress().
void TTAProgram::DataMemory::deleteDataDefinition | ( | int | index | ) |
Deletes the data definition at the given index.
index | Which data definition to delete. |
Definition at line 160 of file DataMemory.cc.
References __func__, dataDefinitionCount(), dataDefs_, and indexCache_.
void TTAProgram::DataMemory::setAddressSpace | ( | const TTAMachine::AddressSpace & | space | ) |
Set new address space for the data memory.
space | New address space. |
Definition at line 192 of file DataMemory.cc.
References dataDefinition(), dataDefinitionCount(), TTAProgram::Address::location(), ramSpace_, TTAProgram::DataDefinition::setStartAddress(), and TTAProgram::DataDefinition::startAddress().
Referenced by TTAProgram::Program::replaceUniversalAddressSpaces().
|
private |
Data definitions for the address space.
Definition at line 82 of file DataMemory.hh.
Referenced by addDataDefinition(), dataDefinition(), dataDefinitionCount(), dataDefinitionsEnd(), deleteDataDefinition(), and ~DataMemory().
|
mutableprivate |
Cache for indexing dataDefinitions.
Definition at line 85 of file DataMemory.hh.
Referenced by addDataDefinition(), dataDefinition(), and deleteDataDefinition().
|
private |
Address space of the memory.
Definition at line 79 of file DataMemory.hh.
Referenced by addressSpace(), copy(), dataDefinition(), and setAddressSpace().