OpenASIP
2.0
|
#include <GlobalScope.hh>
Classes | |
class | LabelOwner |
Public Member Functions | |
GlobalScope () | |
virtual | ~GlobalScope () |
virtual bool | isGlobal () const |
int | globalCodeLabelCount (Address address) const |
const CodeLabel & | globalCodeLabel (Address address, int index) const |
int | globalCodeLabelCount () const |
const CodeLabel & | globalCodeLabel (int index) const |
int | globalDataLabelCount (Address address) const |
const DataLabel & | globalDataLabel (Address address, int index) const |
int | globalDataLabelCount () const |
const DataLabel & | globalDataLabel (int index) const |
virtual void | removeCodeLabels (InstructionAddress address) |
virtual Scope * | copy () const |
virtual Scope * | copyAndRelocate (const TTAProgram::Program &program) const |
virtual void | setDataLabelAddressSpace (const TTAMachine::AddressSpace &space) |
Public Member Functions inherited from TTAProgram::Scope | |
Scope () | |
virtual | ~Scope () |
virtual bool | isUnit () const |
virtual bool | isProcedure () const |
virtual bool | isLocal () const |
bool | containsCodeLabel (const std::string &name) const |
bool | containsDataLabel (const std::string &name) const |
const CodeLabel & | codeLabel (const std::string &name) const |
const DataLabel & | dataLabel (const std::string &name) const |
int | codeLabelCount (Address address) const |
const CodeLabel & | codeLabel (Address address, int index) const |
int | dataLabelCount (Address address) const |
const DataLabel & | dataLabel (Address address, int index) const |
virtual void | addCodeLabel (const CodeLabel *codeLabel) |
virtual void | addDataLabel (const DataLabel *dataLabel) |
Protected Member Functions | |
virtual void | addGlobalCodeLabel (const CodeLabel &codeLabel, const Scope &owner) |
virtual void | addGlobalDataLabel (const DataLabel &codeLabel, const Scope &owner) |
Protected Member Functions inherited from TTAProgram::Scope | |
Scope & | parent () const |
void | setParent (Scope &scope) |
int | childCount () const |
void | addChild (const Scope &scope) |
const Scope & | child (int index) const |
Private Types | |
typedef std::vector< LabelOwner * > | LabelOwnerList |
List for LabelOwners. More... | |
Private Member Functions | |
GlobalScope (const GlobalScope &) | |
Copying not allowed. More... | |
GlobalScope & | operator= (const GlobalScope &) |
Assignment not allowed. More... | |
Private Attributes | |
LabelOwnerList | allCodeLabels_ |
Container for all code labels contained in the global scope and its child scopes. More... | |
LabelOwnerList | allDataLabels_ |
Container for all data labels. More... | |
Additional Inherited Members | |
Protected Types inherited from TTAProgram::Scope | |
typedef std::vector< const Scope * > | ScopeList |
List for child scopes. More... | |
typedef std::vector< const DataLabel * > | DataLabelList |
List of data labels. More... | |
typedef std::vector< const CodeLabel * > | CodeLabelList |
List of code labels. More... | |
Protected Attributes inherited from TTAProgram::Scope | |
ScopeList | children_ |
Child scopes. More... | |
DataLabelList | dataLabels_ |
Data labels contained by this scope. More... | |
CodeLabelList | codeLabels_ |
Code labels contained by this scope. More... | |
Definition at line 47 of file GlobalScope.hh.
|
private |
List for LabelOwners.
Definition at line 109 of file GlobalScope.hh.
TTAProgram::GlobalScope::GlobalScope | ( | ) |
Constructor.
Definition at line 50 of file GlobalScope.cc.
Referenced by copy(), and copyAndRelocate().
|
virtual |
Destructor.
Definition at line 56 of file GlobalScope.cc.
References allCodeLabels_, allDataLabels_, and SequenceTools::deleteAllItems().
|
private |
Copying not allowed.
|
protectedvirtual |
Adds a code label to the global bookkeeping.
codeLabel | The label to be added. |
owner | The owner scope of the label. |
Implements TTAProgram::Scope.
Definition at line 78 of file GlobalScope.cc.
References allCodeLabels_, and TTAProgram::Scope::codeLabel().
|
protectedvirtual |
Adds a data label to the global bookkeeping.
Applies to all child scopes of this global scope.
dataLabel | The label to be added. |
owner | The owner scope of the label. |
Implements TTAProgram::Scope.
Definition at line 180 of file GlobalScope.cc.
References allDataLabels_, and TTAProgram::Scope::dataLabel().
|
virtual |
Creates a copy of the scope and its labels.
The targets of the labels are not converted to point to the instructions of the given program and data of the data sections.
Implements TTAProgram::Scope.
Definition at line 282 of file GlobalScope.cc.
References TTAProgram::Scope::addCodeLabel(), TTAProgram::Scope::addDataLabel(), allCodeLabels_, allDataLabels_, and GlobalScope().
|
virtual |
Creates a copy of the scope and its labels.
The targets of the labels are converted to point to the instructions of the given program. The data labels still point to the old address spaces, assuming the target machine is still the same.
program | The Program containing the instructions code labels should be converted to point to. |
Definition at line 334 of file GlobalScope.cc.
References TTAProgram::Scope::addCodeLabel(), TTAProgram::Scope::addDataLabel(), TTAProgram::CodeLabel::address(), TTAProgram::Label::address(), allCodeLabels_, allDataLabels_, GlobalScope(), TTAProgram::Address::location(), TTAProgram::Label::name(), and program.
Referenced by TTAProgram::Program::copyFrom().
Returns the code label in the given address.
Applies to all child scopes of this global scope.
address | The address of the label. |
index | The index of the label if there are many labels at the address. |
KeyNotFound | If no code labels in the given address were found. |
Definition at line 118 of file GlobalScope.cc.
References allCodeLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by TTAProgram::ProgramWriter::createBinary(), and DisassemblyGridTable::loadProgram().
const CodeLabel & TTAProgram::GlobalScope::globalCodeLabel | ( | int | index | ) | const |
Returns the code label of requested index.
Applies to all child scopes of this global scope.
index | The index of the label. |
KeyNotFound | If no code labels in the given index. |
Definition at line 162 of file GlobalScope.cc.
References allCodeLabels_, and globalCodeLabelCount().
int TTAProgram::GlobalScope::globalCodeLabelCount | ( | ) | const |
Returns the number of code labels in program.
Applies to all child scopes of this global scope.
Definition at line 148 of file GlobalScope.cc.
References allCodeLabels_.
Referenced by globalCodeLabel().
int TTAProgram::GlobalScope::globalCodeLabelCount | ( | Address | address | ) | const |
Returns the number of code labels at the given address.
Applies to all child scopes of this global scope.
address | The address of the label(s). |
Definition at line 93 of file GlobalScope.cc.
References allCodeLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by TTAProgram::ProgramWriter::createBinary(), POMDisassembler::labelCount(), and DisassemblyGridTable::loadProgram().
Returns the data label in the given address.
Applies to all child scopes of this global scope.
address | The address of the label. |
index | The index of the label if there are many labels at the address. |
KeyNotFound | If no data labels in the given address were found. |
Definition at line 220 of file GlobalScope.cc.
References allDataLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by TTAProgram::Program::convertSymbolRef(), TTAProgram::ProgramWriter::createBinary(), and setDataLabelAddressSpace().
const DataLabel & TTAProgram::GlobalScope::globalDataLabel | ( | int | index | ) | const |
Returns the data label of given index.
Applies to all child scopes of this global scope.
index | The index of the label. |
KeyNotFound | If no data labels with given index. |
Definition at line 264 of file GlobalScope.cc.
References allDataLabels_, and globalDataLabelCount().
int TTAProgram::GlobalScope::globalDataLabelCount | ( | ) | const |
Returns the number of data labels in the program.
Applies to all child scopes of this global scope.
Definition at line 250 of file GlobalScope.cc.
References allDataLabels_.
Referenced by globalDataLabel(), and setDataLabelAddressSpace().
int TTAProgram::GlobalScope::globalDataLabelCount | ( | Address | address | ) | const |
Returns the number of data labels at the given address.
Applies to all child scopes of this global scope.
address | The address of the label(s). |
Definition at line 195 of file GlobalScope.cc.
References allDataLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by TTAProgram::Program::convertSymbolRef(), and TTAProgram::ProgramWriter::createBinary().
|
virtual |
Tells whether this is a global scope.
Reimplemented from TTAProgram::Scope.
Definition at line 67 of file GlobalScope.cc.
|
private |
Assignment not allowed.
|
virtual |
Removes all code labels attached to the given instruction address.
address | The instruction address. |
Reimplemented from TTAProgram::Scope.
Definition at line 363 of file GlobalScope.cc.
References allCodeLabels_.
Referenced by TTAProgram::Procedure::remove(), and TTAProgram::Program::removeProcedure().
|
virtual |
Sets the address space of all data labels.
space | The address space. |
Definition at line 305 of file GlobalScope.cc.
References TTAProgram::Label::address(), allDataLabels_, SequenceTools::deleteAllItems(), globalDataLabel(), globalDataLabelCount(), TTAProgram::Address::location(), and TTAProgram::Label::name().
Referenced by TTAProgram::Program::replaceUniversalAddressSpaces().
|
private |
Container for all code labels contained in the global scope and its child scopes.
Definition at line 113 of file GlobalScope.hh.
Referenced by addGlobalCodeLabel(), copy(), copyAndRelocate(), globalCodeLabel(), globalCodeLabelCount(), removeCodeLabels(), and ~GlobalScope().
|
private |
Container for all data labels.
Definition at line 115 of file GlobalScope.hh.
Referenced by addGlobalDataLabel(), copy(), copyAndRelocate(), globalDataLabel(), globalDataLabelCount(), setDataLabelAddressSpace(), and ~GlobalScope().