Otawa
0.10
|
A process is the realization of a program on a platform. More...
#include <otawa/prog/Process.h>
Classes | |
class | FileIter |
Public Member Functions | |
Process (Manager *manager, const PropList &props=EMPTY, File *program=0) | |
Build a new empty process. More... | |
virtual | ~Process (void) |
virtual hard::Platform * | platform (void)=0 |
Get the platform of the process. More... | |
Manager * | manager (void) |
Get the manager owning this process. More... | |
virtual const hard::CacheConfiguration & | cache (void) |
Get the cache hierarchy of the current processor. More... | |
virtual Inst * | start (void)=0 |
Get the address of the first instruction of the program. More... | |
virtual Inst * | findInstAt (address_t addr) |
Find the instruction at the given address. More... | |
virtual address_t | findLabel (const string &label) |
Find the address of the given label. More... | |
virtual Inst * | findInstAt (const string &label) |
find the instruction at the given label if the label matches a code segment. More... | |
File * | program (void) const |
Get the program file, that is, the startup executable of the process. More... | |
virtual int | instSize (void) const =0 |
Get the instruction size. More... | |
virtual Processor * | decoder (void) |
Get a decoder usuful to decode instructions. More... | |
virtual Loader * | loader (void) const |
Get the loader that has created this process. More... | |
Symbol * | findSymbol (const string &name) |
Find the symbol matching the given name. More... | |
Symbol * | findSymbolAt (const Address &address) |
Find a symbol by its address. More... | |
virtual Address | initialSP (void) const |
Get the initial address of the stack pointer. More... | |
virtual Inst * | newNOp (Address addr=Address::null) |
Build a NOP instruction at the given address. More... | |
virtual void | deleteNop (Inst *inst) |
Delete a NOP instruction previously allocated by NewOP(). More... | |
virtual int | maxTemp (void) const |
Get the maximum number of temporaries used in the semantics instruction block. More... | |
virtual void | get (Address at, t::int8 &val) |
Get a signed byte value from the process. More... | |
virtual void | get (Address at, t::uint8 &val) |
Get an unsigned byte value from the process. More... | |
virtual void | get (Address at, t::int16 &val) |
Get a signed half-word value from the process. More... | |
virtual void | get (Address at, t::uint16 &val) |
Get a unsigned half-word value from the process. More... | |
virtual void | get (Address at, t::int32 &val) |
Get a signed word value from the process. More... | |
virtual void | get (Address at, t::uint32 &val) |
Get a unsigned word value from the process. More... | |
virtual void | get (Address at, t::int64 &val) |
Get a signed long word value from the process. More... | |
virtual void | get (Address at, t::uint64 &val) |
Get a unsigned long word value from the process. More... | |
virtual void | get (Address at, Address &val) |
Get an address value from the process. More... | |
virtual void | get (Address at, float &val) |
Get a float value from the process. More... | |
virtual void | get (Address at, double &val) |
Get a double value from the process. More... | |
virtual void | get (Address at, long double &val) |
Get a long double value from the process. More... | |
virtual void | get (Address at, string &str) |
Get a string value from the process. More... | |
virtual void | get (Address at, char *buf, int size) |
Get a byte block value from the process. More... | |
virtual Option< Pair< cstring, int > > | getSourceLine (Address addr) throw (UnsupportedFeatureException) |
Get the source file and the line matching the given address. More... | |
virtual void | getAddresses (cstring file, int line, Vector< Pair< Address, Address > > &addresses) throw (UnsupportedFeatureException) |
Get the list of addresses implementing the given (source, line) pair. More... | |
virtual SimState * | newState (void) |
Get a fresh startup state of the process for functional simulation. More... | |
virtual sim::Simulator * | simulator (void) |
Find the simulator used for the current process. More... | |
File * | loadProgram (elm::CString path) |
Load the program file. More... | |
virtual File * | loadFile (elm::CString path)=0 |
Load an existing file. More... | |
virtual Address | defaultStack (void) const |
Get a default address for the stack top. More... | |
virtual void | semInit (sem::Block &block) const |
Provide semantic sequence to initialize the environment before performing static analysis. More... | |
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... | |
void | print (elm::io::Output &out) const |
Display the current property list. More... | |
void | lock (void) |
void | unlock () |
Static Public Attributes | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Protected Member Functions | |
void | addFile (File *file) |
Add the given file to the list of files. More... | |
void | provide (AbstractFeature &feature) |
This method let provide feature from the loader / processors. More... | |
Private Member Functions | |
void | link (WorkSpace *ws) |
This method is called each a workspace using the current process is created. More... | |
void | unlink (WorkSpace *ws) |
This method is called each a workspace using the current process is deleted. More... | |
Private Attributes | |
Vector< File * > | files |
Get the list of files used in this process. More... | |
Vector< AbstractFeature * > | provided |
File * | prog |
Manager * | man |
stree::Tree< Address::offset_t, Symbol * > * | smap |
Friends | |
class | WorkSpace |
A process is the realization of a program on a platform.
It represents the program and its implementation on the platform. A process may be formed by many files in case of shared object for example. A process provides the information needed for simulating, analyzing or transforming a program.
Build a new empty process.
manager | Current manager. |
props | Configuration properties to create this process. |
program | The program file creating this process. |
References addFile(), otawa::PropList::addProps(), and prog.
|
virtual |
References smap.
|
protected |
|
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=(), Process(), otawa::PropList::PropList(), otawa::display::GraphVizItem::setProps(), otawa::VirtualBasicBlock::VirtualBasicBlock(), and otawa::VirtualCFG::VirtualCFG().
|
virtual |
Get the cache hierarchy of the current processor.
The cachers are ordered according the index in the vector.
References otawa::hard::Platform::cache(), and platform().
|
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().
|
virtual |
Get a decoder usuful to decode instructions.
May be overriden to give instruction set architecture dependent decoders.
Referenced by otawa::TextDecoder::processWorkSpace().
|
virtual |
Get a default address for the stack top.
Referenced by otawa::clp::Analysis::processWorkSpace(), and otawa::dcache::BlockBuilder::setup().
|
virtual |
Delete a NOP instruction previously allocated by NewOP().
inst | Instruction to delete. |
|
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().
Find the instruction at the given address.
addr | Address of instruction to retrieve. |
addr | Address to look at. |
Referenced by otawa::PFGBuilder::addFunction(), otawa::CFGInfo::findCFG(), findInstAt(), otawa::DelayedBuilder::makeNOp(), otawa::DelayedBuilder::next(), otawa::FlowFactLoader::onIgnoreControl(), otawa::FlowFactLoader::onIgnoreSeq(), otawa::FlowFactLoader::onLoop(), otawa::FlowFactLoader::onMemoryAccess(), otawa::FlowFactLoader::onMultiBranch(), otawa::FlowFactLoader::onMultiCall(), otawa::FlowFactLoader::onNoCall(), otawa::FlowFactLoader::onNoInline(), otawa::FlowFactLoader::onNoReturn(), otawa::FlowFactLoader::onPreserve(), otawa::FlowFactLoader::onReturn(), otawa::FlowFactLoader::onSetInlining(), otawa::FlowFactLoader::scanIgnoreControl(), otawa::FlowFactLoader::scanIgnoreSeq(), otawa::FlowFactLoader::scanMultiBranch(), otawa::FlowFactLoader::scanMultiCall(), otawa::FlowFactLoader::scanNoInline(), otawa::FlowFactLoader::scanSetInlining(), and otawa::DelayedBuilder::size().
find the instruction at the given label if the label matches a code segment.
label | Label to look for. |
References findInstAt(), and findLabel().
Find the address of the given label.
For performing it, it looks iteratively one each file of the process until finding it.
label | Label to find. |
References otawa::Address::null.
Referenced by otawa::FlowFactLoader::addressOf(), and findInstAt().
Find the symbol matching the given name.
name | Symbol name to look for. |
Referenced by otawa::LabelAddress::toAddress().
Find a symbol by its address.
address | Address of the looked symbol. |
References elm::stree::SegmentBuilder< K, T, class >::add(), otawa::Symbol::DATA, otawa::Symbol::FUNCTION, elm::stree::SegmentBuilder< K, T, class >::make(), otawa::Address::offset(), and smap.
Get a signed byte value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Referenced by otawa::VarTextDecoder::getBytes(), and otawa::CFGCheckSummer::processCFG().
Get an unsigned byte value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a signed half-word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a unsigned half-word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a signed word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a unsigned word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a signed long word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a unsigned long word value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get an address value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.
References otawa::MEMORY_ACCESS_FEATURE.
|
virtual |
Get a float value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
|
virtual |
Get a double value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
|
virtual |
Get a long double value from the process.
at | Address of the value to get. |
val | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
References otawa::MEMORY_ACCESS_FEATURE.
Get a string value from the process.
at | Address of the value to get. |
str | Got value. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.
References otawa::MEMORY_ACCESS_FEATURE.
|
virtual |
Get a byte block value from the process.
at | Address of the value to get. |
buf | Buffer to store block to. |
size | Size of block. |
UnsupportedFeatureException | if this method is called but the loader does not provide this feature. |
OutOfMemStaticException | if the given address does not point to a static segment of the executable file. |
Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.
References otawa::MEMORY_ACCESS_FEATURE.
|
virtual |
Get the list of addresses implementing the given (source, line) pair.
file | Looked source file. |
line | Looked source line. |
addresses | Output parameter containing the list of address ranges matching the given line. This vector is empty if the source (file, line) cannot be found. |
UnsupportedFeatureException | If this function is called and the feature SOURCE_LINE_FEATURE is not implemented. |
Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.
References otawa::SOURCE_LINE_FEATURE.
Referenced by otawa::ipet::FlowFactLoader::lookLineAt().
|
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().
|
virtual |
Get the source file and the line matching the given address.
addr | Address to get source and line. |
UnsupportedFeatureException | If this function is called and the feature SOURCE_LINE_FEATURE is not implemented. |
Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.
References otawa::SOURCE_LINE_FEATURE.
Referenced by otawa::WorkSpace::format(), otawa::ipet::FlowFactLoader::lookLineAt(), otawa::cfgio::Output::processBB(), and otawa::BBRatioDisplayer::processBB().
|
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().
|
virtual |
Get the initial address of the stack pointer.
If the program is embedded, this call does not return any meaningful value as the value is initialized at the program start. For program running in a rich OS environment, this is the value of the stack pointer after the OS has filled environment and program arguments.
References otawa::Address::null.
|
pure virtual |
Get the instruction size.
Referenced by otawa::VarTextDecoder::getInst(), newNOp(), otawa::ParExeGraph::ParExeGraph(), otawa::TextDecoder::processWorkSpace(), and otawa::FixedTextDecoder::setup().
|
private |
This method is called each a workspace using the current process is created.
It may be used to perform some workspace initialization like feature providing.
References otawa::WorkSpace::provide(), and provided.
|
virtual |
Get the loader that has created this process.
The result may be null.
Reimplemented in otawa::loader::old_gliss::Process.
Referenced by otawa::Loader::check(), and otawa::WorkSpace::serialize().
|
pure virtual |
Load an existing file.
path | Path to the file to load. |
LoadException | Error during the load. |
UnsupportedPlatformException | Platform of the file does not match the platform of the process. |
Implemented in otawa::loader::new_gliss::Process, and otawa::loader::old_gliss::Process.
Referenced by loadProgram().
File * otawa::Process::loadProgram | ( | elm::CString | path | ) |
Load the program file.
References loadFile(), and prog.
|
inline |
Get the manager owning this process.
Referenced by otawa::ipet::ILPSystemGetter::processWorkSpace(), and simulator().
|
virtual |
Get the maximum number of temporaries used in the semantics instruction block.
|
virtual |
Build a NOP instruction at the given address.
addr | Address of the instruction (default to null address). |
References instSize().
|
virtual |
Get a fresh startup state of the process for functional simulation.
|
pure virtual |
Get the platform of the process.
Implemented in otawa::loader::new_gliss::Process, and otawa::loader::old_gliss::Process.
Referenced by cache(), otawa::FlowFactLoader::onRegSet(), otawa::hard::Dumper::processWorkSpace(), otawa::StackAnalysis::processWorkSpace(), and otawa::clp::Analysis::processWorkSpace().
|
inherited |
Display the current property list.
out | Output to use. |
Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().
|
inline |
Get the program file, that is, the startup executable of the process.
Referenced by otawa::ast::ASTLoader::findLabel(), otawa::ProcessException::message(), otawa::operator<<(), otawa::ipet::ConstraintLoader::processCFG(), otawa::CFGBuilder::processWorkSpace(), otawa::ast::ASTLoader::processWorkSpace(), otawa::display::ILPSystemDisplayer::processWorkSpace(), otawa::FlowFactLoader::processWorkSpace(), and otawa::script::Script::work().
|
protected |
This method let provide feature from the loader / processors.
References provided.
|
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().
|
virtual |
Provide semantic sequence to initialize the environment before performing static analysis.
As a default, do nothing.
|
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().
|
virtual |
Find the simulator used for the current process.
References _, otawa::Manager::findSimulator(), manager(), name, otawa::SIMULATOR, and otawa::SIMULATOR_NAME.
Referenced by otawa::tsim::BBTimeSimulator::setup(), and otawa::tsim::BBPath::simulate().
|
pure virtual |
Get the address of the first instruction of the program.
Implemented in otawa::loader::new_gliss::Process, and otawa::loader::old_gliss::Process.
|
private |
This method is called each a workspace using the current process is deleted.
|
friend |
|
staticinherited |
This is an empty proplist for convenience.
|
private |
|
private |
|
private |
Referenced by addFile(), loadProgram(), and Process().
|
private |
|
private |
Referenced by findSymbolAt(), and ~Process().