|
OpenASIP 2.2
|
#include <Scope.hh>


Public Member Functions | |
| Scope () | |
| virtual | ~Scope () |
| virtual bool | isGlobal () const |
| 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) |
| virtual void | removeCodeLabels (InstructionAddress address) |
| virtual Scope * | copy () const =0 |
Protected Types | |
| typedef std::vector< const Scope * > | ScopeList |
| List for child scopes. | |
| typedef std::vector< const DataLabel * > | DataLabelList |
| List of data labels. | |
| typedef std::vector< const CodeLabel * > | CodeLabelList |
| List of code labels. | |
Protected Member Functions | |
| virtual void | addGlobalCodeLabel (const CodeLabel &codeLabel, const Scope &owner)=0 |
| Adds a code label and its owner to the global label bookkeeping. | |
| virtual void | addGlobalDataLabel (const DataLabel &dataLabel, const Scope &owner)=0 |
| Adds a data label and its owner to the global label bookkeeping. | |
| Scope & | parent () const |
| void | setParent (Scope &scope) |
| int | childCount () const |
| void | addChild (const Scope &scope) |
| const Scope & | child (int index) const |
Protected Attributes | |
| ScopeList | children_ |
| Child scopes. | |
| DataLabelList | dataLabels_ |
| Data labels contained by this scope. | |
| CodeLabelList | codeLabels_ |
| Code labels contained by this scope. | |
Private Member Functions | |
| Scope (const Scope &) | |
| Copying not allowed. | |
| Scope & | operator= (const Scope &) |
| Assignment not allowed. | |
Private Attributes | |
| Scope * | parent_ |
| The smallest outer scope that contains this scope. | |
Scopes provide containers for different visibility level labels.
|
protected |
|
protected |
|
protected |
| Scope::Scope | ( | ) |
Constructor.
Definition at line 48 of file Scope.cc.
|
virtual |
Destructor.
Definition at line 54 of file Scope.cc.
References codeLabels_, and dataLabels_.
|
private |
Copying not allowed.
|
protected |
Adds a child scope to this scope.
| scope | The child scope to be added. |
| ObjectAlreadyExists | if the given scope has already been added. or a scope with the same name already exists. |
Definition at line 114 of file Scope.cc.
References children_, and ContainerTools::containsValue().

|
virtual |
Adds a code label to this scope.
| codeLabel | The code label to be added. |
| KeyAlreadyExists | of a code label of the same name already exists. |
Definition at line 376 of file Scope.cc.
References addGlobalCodeLabel(), assert, codeLabel(), codeLabels_, containsCodeLabel(), isGlobal(), TTAProgram::Label::name(), and parent().
Referenced by TTAProgram::GlobalScope::copy(), TTAProgram::GlobalScope::copyAndRelocate(), TTAProgram::TPEFProgramFactory::createLabels(), and llvm::LLVMTCEBuilder::writeMachineFunction().

|
virtual |
Adds a data label to this scope.
| dataLabel | The data label to be added. |
| KeyAlreadyExists | of a data label of the same name already exists. |
Definition at line 415 of file Scope.cc.
References addGlobalDataLabel(), assert, containsDataLabel(), dataLabel(), dataLabels_, isGlobal(), TTAProgram::Label::name(), and parent().
Referenced by TTAProgram::GlobalScope::copy(), TTAProgram::GlobalScope::copyAndRelocate(), TTAProgram::TPEFProgramFactory::createLabels(), llvm::LLVMTCEBuilder::doFinalization(), and llvm::LLVMTCEBuilder::initDataSections().

|
protectedpure virtual |
Adds a code label and its owner to the global label bookkeeping.
| dataLabel | The code label to be added. |
| owner | The owner scope of the label. |
Implemented in TTAProgram::GlobalScope.
Referenced by addCodeLabel().
|
protectedpure virtual |
Adds a data label and its owner to the global label bookkeeping.
| dataLabel | The data label to be added. |
| owner | The owner scope of the label. |
Implemented in TTAProgram::GlobalScope.
Referenced by addDataLabel().
|
protected |
Returns the child scope at given index.
| index | The index of the child scope. |
| OutOfRange | if the exceeds the number of scopes contained in this scope. |
Definition at line 184 of file Scope.cc.
References children_.
|
protected |
Returns a code label visible in this scope in the given address and index.
| address | The address of the code label. |
| index | The index of the label if there area many labels at this address. |
Definition at line 289 of file Scope.cc.
References codeLabelCount(), codeLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().

| const CodeLabel & Scope::codeLabel | ( | const std::string & | name | ) | const |
Returns the code label with the given name.
| name | The name of the label. |
| KeyNotFound | if no code label with the given name exists in this scope. |
Definition at line 233 of file Scope.cc.
References codeLabels_.
Referenced by addCodeLabel(), TTAProgram::GlobalScope::addGlobalCodeLabel(), and SimControlLanguageCommand::parseInstructionAddressExpression().
| int Scope::codeLabelCount | ( | Address | address | ) | const |
Returns the number of code labels in the given address visible in this scope.
| address | The address of the label. |
Definition at line 269 of file Scope.cc.
References codeLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by codeLabel().

| bool Scope::containsCodeLabel | ( | const std::string & | name | ) | const |
Tells whether this scope contains a code label with the given name.
| The | name of the label. |
Definition at line 199 of file Scope.cc.
References codeLabels_.
Referenced by addCodeLabel().
| bool Scope::containsDataLabel | ( | const std::string & | name | ) | const |
Tells whether this scope contains a data label with the given name.
| The | name of the label. |
Definition at line 215 of file Scope.cc.
References dataLabels_.
Referenced by addDataLabel().
|
pure virtual |
Implemented in TTAProgram::GlobalScope.
Returns a data label visible in this scope in the given address and index.
| address | The address of the data label. |
| index | The index of the label if there area many labels at this address. |
Definition at line 343 of file Scope.cc.
References dataLabelCount(), dataLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().

| const DataLabel & Scope::dataLabel | ( | const std::string & | name | ) | const |
Returns the data label with the given name.
| name | The name of the label. |
| KeyNotFound | if no data label with the given name exists in this scope. |
Definition at line 251 of file Scope.cc.
References dataLabels_.
Referenced by addDataLabel(), TTAProgram::GlobalScope::addGlobalDataLabel(), SymbolAddressCommand::execute(), and SimControlLanguageCommand::parseDataAddressExpression().
| int Scope::dataLabelCount | ( | Address | address | ) | const |
Returns the number of data labels in the given address visible in this scope.
| address | The address of the label. |
Definition at line 323 of file Scope.cc.
References dataLabels_, TTAProgram::Address::location(), and TTAProgram::Address::space().
Referenced by dataLabel().

|
virtual |
Tells whether this is a global scope.
Reimplemented in TTAProgram::GlobalScope.
Definition at line 72 of file Scope.cc.
Referenced by addCodeLabel(), addDataLabel(), parent(), and setParent().
|
virtual |
|
virtual |
|
virtual |
|
protected |
Return the parent scope., that is, the scope that contains this scope.
| WrongSubclass | if this scope has no parent scope (it is the global scope). |
| IllegalRegistration | if no parent has been set (and the scope is not the global scope. |
Definition at line 132 of file Scope.cc.
References isGlobal(), and parent_.
Referenced by addCodeLabel(), and addDataLabel().

|
virtual |
Removes all code labels attached to the given instruction address.
| address | The instruction address. |
Reimplemented in TTAProgram::GlobalScope.
Definition at line 451 of file Scope.cc.
References codeLabels_.
|
protected |
Sets the parent scope.
| scope | The new parent scope. |
| WrongSubclass | if the scope is the global scope. |
Definition at line 152 of file Scope.cc.
References isGlobal(), and parent_.

|
protected |
Child scopes.
Definition at line 85 of file Scope.hh.
Referenced by addChild(), child(), and childCount().
|
protected |
Code labels contained by this scope.
Definition at line 95 of file Scope.hh.
Referenced by addCodeLabel(), codeLabel(), codeLabel(), codeLabelCount(), containsCodeLabel(), removeCodeLabels(), and ~Scope().
|
protected |
Data labels contained by this scope.
Definition at line 93 of file Scope.hh.
Referenced by addDataLabel(), containsDataLabel(), dataLabel(), dataLabel(), dataLabelCount(), and ~Scope().
|
private |
The smallest outer scope that contains this scope.
Definition at line 125 of file Scope.hh.
Referenced by parent(), and setParent().