Otawa
0.10
|
A symbol is a name of a location in a program. More...
#include <otawa/prog/Symbol.h>
Public Types | |
enum | kind_t { NONE = 0, FUNCTION = 1, LABEL = 2, DATA = 3 } |
This type describes the kind of existing symbol. More... | |
typedef enum otawa::Symbol::kind_t | kind_t |
Public Member Functions | |
Symbol (File &file, String name, kind_t kind, address_t address, ot::size size=0) | |
Build a symbol. More... | |
File & | file (void) const |
Get the owner file of the given symbol. More... | |
kind_t | kind (void) const |
Get the kind of the symbol. More... | |
const String & | name (void) const |
Get the name of the symbol. More... | |
address_t | address (void) const |
Get the address of the location referenced by this symbol. More... | |
ot::size | size (void) const |
Get the size of the item referenced by this symbol. More... | |
Inst * | findInst (void) const |
If the symbol points to code memory, return the matching instruction. More... | |
bool | doesNotReturn (void) const |
Test if it is a no returning function. More... | |
void | setNoReturn (void) |
Set the no-return property to this symbol. More... | |
void | print (io::Output &out) const |
Property * | getProp (const AbstractIdentifier *id) const |
Find a property by its identifier. More... | |
void | setProp (Property *prop) |
Set the property in the property list removing any double. More... | |
void | setProp (const AbstractIdentifier *id) |
void | removeProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier. More... | |
void | removeProp (const AbstractIdentifier &id) |
Property * | extractProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier and return it. More... | |
Property * | extractProp (const AbstractIdentifier &id) |
Remove a property matching the given identifier and return it. More... | |
void | addProp (Property *prop) |
Add property to the list without checking of duplication. More... | |
void | removeAllProp (const AbstractIdentifier *id) |
Remove all the properties matching the given identifier. More... | |
bool | hasProp (const AbstractIdentifier &id) const |
Test if the property list contains a property matching the given identifier. More... | |
void | clearProps (void) |
Remove all properties from the list. More... | |
void | addProps (const PropList &props) |
Add all properties from the given property list, in a reverse order. More... | |
Static Public Attributes | |
static Identifier< Symbol * > | ID |
This property is used to attach a symbol to an instruction. More... | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Private Attributes | |
File & | _file |
String | _name |
kind_t | _kind |
address_t | _address |
size_t | _size |
bool | no_return |
A symbol is a name of a location in a program.
Currently, only function and label symbols are supported.
To fit with the OTAWA low-level abstraction architecture, this class is only an empty interface implemented by the program loader.
typedef enum otawa::Symbol::kind_t otawa::Symbol::kind_t |
|
inherited |
Add property to the list without checking of duplication.
prop | Property to add. |
References otawa::Property::_next.
Referenced by otawa::Identifier< T >::add(), otawa::ast::ASTInfo::ASTInfo(), otawa::Identifier< otawa::arm::Info * >::copy(), otawa::AbstractIdentifier::initProps(), otawa::ContextualProperty::make(), otawa::script::Script::makeConfig(), otawa::ccg::Builder::processLBlockSet(), otawa::ipet::ILPSystemGetter::processWorkSpace(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), and otawa::ContextualProperty::refProps().
|
inherited |
Add all properties from the given property list, in a reverse order.
props | Property list to clone. |
References copy(), otawa::PropList::head, and otawa::Property::next().
Referenced by otawa::display::CFGDrawer::CFGDrawer(), otawa::display::GraphVizGraph::GraphVizGraph(), otawa::ParamFeature::instantiate(), otawa::Manager::loadXML(), otawa::display::GraphVizGraph::newEdge(), otawa::display::GraphVizGraph::newNode(), otawa::PropList::operator=(), otawa::Process::Process(), otawa::PropList::PropList(), otawa::display::GraphVizItem::setProps(), otawa::VirtualBasicBlock::VirtualBasicBlock(), and otawa::VirtualCFG::VirtualCFG().
|
inline |
Get the address of the location referenced by this symbol.
References _address.
Referenced by otawa::File::findLabel(), otawa::FlowFactLoader::scanAddress(), and otawa::LabelAddress::toAddress().
|
inherited |
Remove all properties from the list.
References otawa::Property::next().
Referenced by otawa::PSTBuilder::getVCFG(), otawa::PropList::operator=(), otawa::display::GraphVizItem::setProps(), otawa::PropList::~PropList(), and otawa::WorkSpace::~WorkSpace().
|
inline |
Test if it is a no returning function.
References no_return.
|
inherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::script::Script::makeConfig().
|
inlineinherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::PropList::extractProp().
Referenced by otawa::PropList::extractProp().
|
inline |
Inst * otawa::Symbol::findInst | ( | void | ) | const |
If the symbol points to code memory, return the matching instruction.
References _address, _file, and otawa::File::findByAddress().
|
inherited |
Find a property by its identifier.
id | Identifier of the property to find. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::Identifier< otawa::arm::Info * >::exists(), otawa::ContextualProperty::exists(), otawa::ContextualProperty::find(), otawa::Identifier< T >::get(), otawa::PropList::hasProp(), otawa::ContextualProperty::make(), otawa::ParamFeature::matches(), otawa::ImmutableRef< T, I >::print(), otawa::ContextualProperty::print(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), otawa::ContextualProperty::refProps(), otawa::Identifier< T >::set(), otawa::Identifier< T >::use(), and otawa::Identifier< T >::value().
|
inlineinherited |
Test if the property list contains a property matching the given identifier.
id | Property identifier to look for. |
References otawa::PropList::getProp().
Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().
|
inline |
|
inline |
Get the name of the symbol.
References _name.
Referenced by otawa::File::addSymbol(), print(), and otawa::File::removeSymbol().
void otawa::Symbol::print | ( | io::Output & | out | ) | const |
References name().
Referenced by otawa::operator<<().
|
inherited |
Remove all the properties matching the given identifier.
id | Identifier of properties to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::LoopUnroller::unroll().
|
inherited |
Remove a property matching the given identifier.
id | Identifier of the property to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::PSTBuilder::buildTree(), otawa::BBRemover< T >::clean(), otawa::display::CFGOutput::processCFG(), otawa::SubCFGBuilder::processWorkSpace(), otawa::Ref< T, I >::remove(), and otawa::ContextualPath::Ref< T >::remove().
|
inlineinherited |
References otawa::PropList::removeProp().
Referenced by otawa::PropList::removeProp().
void otawa::Symbol::setNoReturn | ( | void | ) |
Set the no-return property to this symbol.
References _address, _file, _kind, _name, otawa::File::findInstAt(), FUNCTION, no_return, and otawa::NO_RETURN.
|
inherited |
Set the property in the property list removing any double.
prop | Property to set. |
References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().
|
inlineinherited |
References otawa::PropList::setProp().
Referenced by otawa::PropList::setProp().
|
inline |
Get the size of the item referenced by this symbol.
References _size.
Referenced by otawa::FlowFactLoader::scanAddress().
|
private |
Referenced by address(), findInst(), and setNoReturn().
|
private |
Referenced by file(), findInst(), and setNoReturn().
|
private |
Referenced by kind(), and setNoReturn().
|
private |
Referenced by name(), and setNoReturn().
|
staticinherited |
This is an empty proplist for convenience.
|
static |
This property is used to attach a symbol to an instruction.
Referenced by otawa::WorkSpace::format().
|
private |
Referenced by doesNotReturn(), and setNoReturn().