OpenASIP
2.0
|
#include <Label.hh>
Public Member Functions | |
virtual | ~Label () |
std::string | name () const |
virtual Address | address () const |
const Scope & | scope () const |
void | setAddress (Address address) |
Protected Member Functions | |
Label () | |
Label (const std::string &name, Address address, const Scope &scope) | |
void | setName (const std::string &name) |
void | setScope (const Scope &scope) |
Private Attributes | |
std::string | name_ |
Name of the label. More... | |
Address | address_ |
Address of the location corresponding to this label. More... | |
const Scope * | scope_ |
Owning scope of the label. More... | |
Marks locations of code or data area of the program.
Labels are owned by scopes. Scopes do not provide methods to add new labels, because the labels are automatically registered to a scope by their constructor: a label cannot exist without its scope.
A label must have a unique name within the owning scope. It does not matter if there are other labels with the same name in outer scopes, because the inner scope has precedence. As a result, all labels in global scope must have a unique name.
|
virtual |
|
protected |
|
protected |
The constructor.
Registers this label to the owning scope.
name | Name of the label. Must be unique within the owning scope. |
address | The address of the location corresponding to this label. |
scope | The innermost scope that contains this label. |
|
virtual |
Returns the address of the location corresponding to this label.
Reimplemented in TTAProgram::CodeLabel.
Definition at line 84 of file Label.cc.
References address_.
Referenced by TTAProgram::Program::convertSymbolRef(), TTAProgram::GlobalScope::copyAndRelocate(), TTAProgram::ProgramWriter::createBinary(), SymbolAddressCommand::execute(), SimControlLanguageCommand::parseDataAddressExpression(), setAddress(), and TTAProgram::GlobalScope::setDataLabelAddressSpace().
string TTAProgram::Label::name | ( | ) | const |
Returns the name of this label.
Definition at line 74 of file Label.cc.
References name_.
Referenced by TTAProgram::Scope::addCodeLabel(), TTAProgram::Scope::addDataLabel(), TTAProgram::CodeLabel::CodeLabel(), TTAProgram::Program::convertSymbolRef(), TTAProgram::GlobalScope::copyAndRelocate(), TTAProgram::ProgramWriter::createBinary(), DisassemblyGridTable::loadProgram(), TTAProgram::GlobalScope::setDataLabelAddressSpace(), and setName().
const Scope & TTAProgram::Label::scope | ( | ) | const |
Returns the innermost scope that contains this label.
Definition at line 94 of file Label.cc.
References scope_.
Referenced by setScope().
void TTAProgram::Label::setAddress | ( | Address | address | ) |
|
protected |
|
protected |
|
private |
Address of the location corresponding to this label.
Definition at line 75 of file Label.hh.
Referenced by address(), and setAddress().
|
private |
|
private |
Owning scope of the label.
Definition at line 77 of file Label.hh.
Referenced by scope(), and setScope().