![]() |
OTAWA
2.0
Framework to perform machine analysis and compute WCET.
|
#include <otawa/prog/WorkSpace.h>
Classes | |
struct | Dependency |
Public Member Functions | |
void | cancel (void) |
void | clearCancellation (void) |
elm::xom::Element * | config (void) |
Get the current configuration, if any, as an XML XOM element. More... | |
virtual Inst * | findInstAt (address_t addr) |
Find an instruction at the given address. More... | |
string | format (Address addr, bool with_address=true) |
Format an address to make it human-readable. More... | |
ast::ASTInfo * | getASTInfo (void) |
Get the AST of the project. More... | |
CFGInfo * | getCFGInfo (void) |
Get the CFG of the project. More... | |
Processor * | getImpl (const AbstractFeature &feature) const |
Get the implementor of a feature (if provided). More... | |
CFG * | getStartCFG (void) |
Get the entry CFG of the program. More... | |
bool | implements (const AbstractFeature &feature) |
void | invalidate (const AbstractFeature &feature) |
Invalidate a feature (removing its dependencies) More... | |
bool | isCancelled (void) const |
bool | isProvided (const AbstractFeature &feature) |
void | loadConfig (const elm::sys::Path &path) |
Load the given configuration in the process. More... | |
sys::Path | makeWorkDir () |
Build and return the working directory. More... | |
virtual Manager * | manager (void) |
Get the manager of the workspace. More... | |
string | name () const |
WorkSpace & | name (string name) |
ilp::System * | newILPSystem (bool max=true) |
Build an ILP system with the default ILP engine. More... | |
virtual hard::Platform * | platform (void) |
Get the platform used by the process. More... | |
Process * | process (void) const |
bool | provides (const AbstractFeature &feature) |
Test if a feature is provided. More... | |
bool | provides (cstring name) |
Test if the named feature is provided. More... | |
void | require (const AbstractFeature &feature, const PropList &props=PropList::EMPTY) |
Ensure that a feature is provided. More... | |
template<class T > | |
T * | run (const PropList &props=PropList::EMPTY) |
Processor * | run (cstring name, const PropList &props=PropList::EMPTY) |
Find and run the code processor corresponding to the given name with the given configuration. More... | |
void | run (Processor &proc, const PropList &props, bool del_proc=false) |
void | run (Processor *proc, const PropList &props=PropList::EMPTY, bool del_proc=false) |
Processor *WorkSpace::run(const PropList& props); Create a processor of type T and run it in the current workspace using the given properties. More... | |
virtual void | serialize (elm::serial2::Serializer &serializer) |
Serialize the workspace to the current serializer. More... | |
virtual Inst * | start (void) |
Get the start instruction of the program. More... | |
virtual void | unserialize (elm::serial2::Unserializer &unserializer) |
Unserialize the workspace to the current unserializer. More... | |
sys::Path | workDir () |
Get the working directory. More... | |
WorkSpace & | workDir (sys::Path path) |
WorkSpace (const WorkSpace *ws) | |
Build a new workspace on the same process as the given one. More... | |
WorkSpace (Process *_proc) | |
Build a new wokspace with the given process. More... | |
virtual | ~WorkSpace (void) |
Delete the workspace and the associated process. More... | |
![]() | |
void | addProp (Property *prop) |
Add property to the list without checking of duplication. More... | |
void | addProps (const PropList &props) |
Add all properties from the given property list, in a reverse order. More... | |
GetterRange | all (const AbstractIdentifier &id) const |
void | clearProps (void) |
Remove all properties from the list. More... | |
Property * | extractProp (const AbstractIdentifier &id) |
Property * | extractProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier and return it. More... | |
Property * | getProp (const AbstractIdentifier *id) const |
Find a property by its identifier. More... | |
bool | hasProp (const AbstractIdentifier &id) const |
PropList & | operator= (const PropList &props) |
void | print (elm::io::Output &out) const |
Display the current property list. More... | |
PropRange | properties (void) const |
PropList (const PropList &props) | |
Initialize a property list from a sequence of (identifier, value) pairs passed as variable arguments. More... | |
PropList (void) | |
void | removeAllProp (const AbstractIdentifier *id) |
Remove all the properties matching the given identifier. More... | |
void | removeProp (const AbstractIdentifier &id) |
void | removeProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier. More... | |
void | setProp (const AbstractIdentifier *id) |
void | setProp (Property *prop) |
Set the property in the property list removing any double. More... | |
void | takeProps (PropList &props) |
Take properties from props to the current property list. More... | |
~PropList (void) | |
Static Public Member Functions | |
static WorkSpace * | load (sys::Path path, const PropList &props=PropList::EMPTY) |
Build a workspace for the given binary file using the default manager. More... | |
static WorkSpace * | load (sys::Path path, const PropList *props) |
static void | remove (Property *prop) |
Remove a property in a thread-safe way. More... | |
static sys::Thread * | run (sys::Runnable &run) |
Launch in a different thread the given runnable. More... | |
static void | runAll (sys::Runnable &run) |
Run all threads with the given runnable. More... | |
Static Public Attributes | |
static rtti::Type & | __type = workspace_class |
![]() | |
static rtti::Type & | __type = prop_list_class |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Private Types | |
typedef HashMap< const AbstractFeature *, Dependency * > | dep_map_t |
typedef struct otawa::WorkSpace::Dependency | Dependency |
Private Member Functions | |
void | add (Processor *proc, bool del_proc) |
Add a new dependency. More... | |
void | invalidate (Dependency *dep) |
Invalidate a dependency (removing its dependencies) More... | |
void | remove (Dependency *dep) |
Remove a dependency. More... | |
Private Attributes | |
string | _name |
bool | cancelled |
dep_map_t | dep_map |
LockPtr< Process > | proc |
sys::Path | wdir |
A workspace represents a program, its run-time and all information about WCET computation or any other analysis.
|
private |
|
private |
otawa::WorkSpace::WorkSpace | ( | Process * | _proc | ) |
Build a new wokspace with the given process.
_proc | Process to use. |
References dep_map, otawa::Process::features(), elm::HashMap< class, class, class, class, class >::put(), and TRACE.
otawa::WorkSpace::WorkSpace | ( | const WorkSpace * | ws | ) |
Build a new workspace on the same process as the given one.
ws | Workspace to get the process form. |
References dep_map, otawa::Process::features(), proc, process(), elm::HashMap< class, class, class, class, class >::put(), and TRACE.
|
virtual |
Delete the workspace and the associated process.
References elm::Vector< class, class, class >::add(), elm::Vector< class, class, class >::contains(), dep_map, invalidate(), and TRACE.
Add a new dependency.
proc | Current processor. |
del_proc | True if the processor has to be deleted. |
References _, otawa::WorkSpace::Dependency::_used, otawa::WorkSpace::Dependency::_users, dep_map, elm::HashMap< class, class, class, class, class >::get(), otawa::Processor::IS_TIED, proc, otawa::FeatureUsage::provide, elm::HashMap< class, class, class, class, class >::put(), otawa::FeatureUsage::require, and TRACE.
Referenced by run().
Informs the current computation to stop as soon as possible. This feature has not direct on the workspace but is used by code processor to change their behaviour. It may be used to stop a computation in a parallel or a GUI context.
Reset the cancellation bit. This function must be called before starting a long running time computation.
xom::Element * otawa::WorkSpace::config | ( | void | ) |
Get the current configuration, if any, as an XML XOM element.
References otawa::CONFIG_ELEMENT.
Find an instruction at the given address.
addr | Looked address. |
References proc.
Referenced by otawa::AbstractCFGBuilder::cleanup(), otawa::FlowFactLoader::findCall(), format(), otawa::VarTextDecoder::processWorkSpace(), otawa::AbstractCFGBuilder::scanCFG(), otawa::CFGBuilder::setup(), otawa::AbstractCFGBuilder::setup(), and otawa::CFGCollector::setup().
Format an address to make it human-readable.
First look for debugging information, else try to build the form label + offset else fall back to address itself.
addr | Address to display. |
with_address | Set to true to ever display the address. |
References buf, findInstAt(), otawa::Process::getSourceLine(), hex(), otawa::Address::isNull(), process(), otawa::SYMBOL, and elm::StringBuffer::toString().
ast::ASTInfo * otawa::WorkSpace::getASTInfo | ( | void | ) |
Get the CFG of the project.
If it does not exists, built it.
References otawa::CFGInfo::ID.
Referenced by getStartCFG().
Processor * otawa::WorkSpace::getImpl | ( | const AbstractFeature & | feature | ) | const |
Get the implementor of a feature (if provided).
feature | Feature for which the implementor is looked. |
References otawa::WorkSpace::Dependency::_proc, dep_map, and elm::HashMap< class, class, class, class, class >::get().
Referenced by otawa::p::get_impl().
Get the entry CFG of the program.
References otawa::CFGInfo::findCFG(), getCFGInfo(), and start().
|
inline |
void otawa::WorkSpace::invalidate | ( | const AbstractFeature & | feature | ) |
Invalidate a feature (removing its dependencies)
feature | Provided feature. |
References dep_map, elm::HashMap< class, class, class, class, class >::get(), and otawa::AbstractIdentifier::name().
Referenced by run(), otawa::Processor::~Processor(), and ~WorkSpace().
|
private |
Invalidate a dependency (removing its dependencies)
dep | Dependency to invalidate. |
References otawa::WorkSpace::Dependency::_proc, otawa::WorkSpace::Dependency::_users, otawa::Processor::destroy(), elm::Vector< class, class, class >::pop(), elm::Vector< class, class, class >::push(), remove(), and elm::Vector< class, class, class >::top().
|
inline |
Test if a feature is provided.
feature | Feature to test. |
Referenced by otawa::GraphBBTime< ParExeGraph >::configureMem(), otawa::FeatureRequirer::FeatureRequirer(), otawa::ParExeGraph::ParExeGraph(), otawa::DelayedBuilder::processWorkSpace(), otawa::FlowFactLoader::processWorkSpace(), require(), run(), otawa::ipet::FlowFactLoader::setup(), otawa::BBRatioDisplayer::setup(), and otawa::etime::StandardEventBuilder::setup().
|
static |
Build a workspace for the given binary file using the default manager.
path | Path to the file. |
props | Configuration properties (optional). |
otawa::Exception | In case of error. |
void otawa::WorkSpace::loadConfig | ( | const elm::sys::Path & | path | ) |
Load the given configuration in the process.
path | Path to the XML configuration file. |
LoadException | If the file cannot be found or if it does not match the OTAWA XML type. |
sys::Path otawa::WorkSpace::makeWorkDir | ( | ) |
Build and return the working directory.
elm::sys::SystemException | If there is an IO error. |
Get the manager of the workspace.
References proc.
Referenced by newILPSystem().
|
inline |
Get the name of the workspace (if any) or an empty string.
Referenced by otawa::CFGCollector::cleanup(), provides(), run(), and workDir().
ilp::System * otawa::WorkSpace::newILPSystem | ( | bool | max = true | ) |
Build an ILP system with the default ILP engine.
max | True for a maximized system, false for a minimized. |
References manager(), and otawa::Manager::newILPSystem().
|
virtual |
Get the platform used by the process.
References proc.
Referenced by otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::EdgeACSBuilder::processWorkSpace(), otawa::clp::Analysis::processWorkSpace(), and otawa::ResourceList::ResourceList().
Referenced by otawa::FlowFactLoader::addressOf(), otawa::Loader::check(), otawa::display::CFGDecorator::displaySourceLine(), otawa::FlowFactLoader::findCall(), otawa::CFGInfo::findCFG(), format(), otawa::VarTextDecoder::getBytes(), otawa::DelayedBuilder::makeNOp(), otawa::clp::Manager::Manager(), otawa::DelayedBuilder::next(), otawa::FlowFactLoader::onCheckSum(), otawa::FlowFactLoader::onMultiBranch(), otawa::FlowFactLoader::onMultiCall(), otawa::FlowFactLoader::onNoReturn(), otawa::FlowFactLoader::onRegSet(), otawa::FlowFactLoader::onReturn(), otawa::cfgio::Output::processBB(), otawa::FixedTextDecoder::processWorkSpace(), otawa::TextDecoder::processWorkSpace(), otawa::VarTextDecoder::processWorkSpace(), otawa::ipet::ILPSystemGetter::processWorkSpace(), otawa::display::ILPSystemDisplayer::processWorkSpace(), otawa::etime::StepGraphBuilder::reset(), otawa::FlowFactLoader::scanIgnoreControl(), otawa::FlowFactLoader::scanIgnoreSeq(), otawa::FlowFactLoader::scanMultiBranch(), otawa::FlowFactLoader::scanMultiCall(), otawa::FlowFactLoader::scanNoInline(), otawa::FlowFactLoader::scanSetInlining(), serialize(), otawa::tsim::BBTimeSimulator::setup(), otawa::FixedTextDecoder::setup(), otawa::CFGBuilder::setup(), otawa::CFGCollector::setup(), otawa::dcache::BlockBuilder::setup(), otawa::display::CFGOutput::setup(), otawa::DelayedBuilder::size(), otawa::LabelAddress::toAddress(), otawa::script::Script::work(), workDir(), and WorkSpace().
bool otawa::WorkSpace::provides | ( | const AbstractFeature & | feature | ) |
Test if a feature is provided.
feature | Feature to test. |
References dep_map, and elm::HashMap< class, class, class, class, class >::hasKey().
Referenced by otawa::ipet::WCETComputation::collectStats(), provides(), run(), otawa::StandardEventBuilder::setup(), and otawa::etime::StandardEventBuilder::setup().
Test if the named feature is provided.
name | Name of the look feature. |
References otawa::AbstractIdentifier::find(), otawa::p::is_feature(), name(), and provides().
|
private |
Remove a dependency.
dep | Dependency to remove. |
References otawa::WorkSpace::Dependency::_del_proc, otawa::WorkSpace::Dependency::_proc, otawa::WorkSpace::Dependency::_used, dep_map, otawa::Monitor::flags, otawa::Processor::name(), otawa::FeatureUsage::provide, otawa::Processor::registration(), elm::HashMap< class, class, class, class, class >::remove(), and TRACE.
Remove a property in a thread-safe way.
prop | Property to remove. |
Referenced by invalidate().
void otawa::WorkSpace::require | ( | const AbstractFeature & | feature, |
const PropList & | props = PropList::EMPTY |
||
) |
Ensure that a feature is provided.
feature | Required feature. |
props | Configuration properties (optional). |
References isProvided(), and otawa::AbstractFeature::process().
Referenced by otawa::Application::require(), run(), and otawa::script::Script::work().
|
inline |
References p().
Processor * otawa::WorkSpace::run | ( | cstring | name, |
const PropList & | props = PropList::EMPTY |
||
) |
Find and run the code processor corresponding to the given name with the given configuration.
props | Property list to use (optional). |
otawa::Exception | – if there is an error in the processor or the processor cannot be found. |
References _, otawa::ProcessorPlugin::getProcessor(), name(), p(), and run().
void otawa::WorkSpace::run | ( | Processor * | proc, |
const PropList & | props = PropList::EMPTY , |
||
bool | del_proc = false |
||
) |
Processor *WorkSpace::run(const PropList& props); Create a processor of type T and run it in the current workspace using the given properties.
As locally declared processor are no more allowed, this function is the easier to call a processor which class is known.
T | Class of the processor. |
props | Configuration properties (optional). |
otawa::Exception | As thrown by the code processor during its execution. Run the given in the current workspace. |
Notice that, after this call, the workspace is the owner of the passed processor object and, therefore, will be in charge of releasing it at the right time.
proc | Processor to run. |
props | Configuration to use. |
del_proc | Set to true if the processor needs to be deleted when it is no more used. |
References _, elm::Vector< class, class, class >::add(), add(), elm::Vector< class, class, class >::contains(), endl, otawa::FeatureUsage::invalidate, invalidate(), otawa::Processor::IS_DONE, isCancelled(), isProvided(), kind, otawa::Monitor::LOG_DEPS, otawa::AbstractRegistration::name(), proc, otawa::FeatureUsage::provide, provides(), elm::Vector< class, class, class >::remove(), otawa::FeatureUsage::require, require(), otawa::FeatureUsage::use, and otawa::AbstractRegistration::uses().
Referenced by otawa::DynProcessor::process(), otawa::Feature< T, C >::process(), otawa::p::feature::process(), otawa::TextDecoder::processWorkSpace(), otawa::Application::run(), run(), otawa::Application::stats(), and otawa::script::Script::work().
|
static |
Launch in a different thread the given runnable.
If no more thread is available, launch the runnable in the current thread.
Using this method to start a thread allows the management of property in thread-safe way.
runnable | Runnable to launch. |
References elm::sys::Runnable::run().
|
static |
Run all threads with the given runnable.
Return only when all threads has stopped.
Using this method to start a thread allows the management of property in thread-safe way.
runnable | Runnable to launch. |
References elm::sys::Runnable::run().
Referenced by otawa::ConcurrentCFGProcessor::processWorkSpace().
|
virtual |
Serialize the workspace to the current serializer.
serializer | Serializer to serialize to. |
References elm::serial2::Serializer::beginField(), elm::serial2::Serializer::endField(), otawa::Process::loader(), elm::sys::Plugin::path(), process(), and elm::sys::Path::toString().
Get the start instruction of the program.
References proc.
Referenced by getStartCFG(), and otawa::VarTextDecoder::processWorkSpace().
|
virtual |
Unserialize the workspace to the current unserializer.
unserializer | Unserializer to unserialize to. |
sys::Path otawa::WorkSpace::workDir | ( | ) |
Get the working directory.
If the binary has for path DIR/FILE.EXT and if the workspace has for name NAME, the working directory is:
DIR/NAME-otawa
If the workspace has no name, the working directory is:
DIR/FILE-otwaa
References _name, elm::sys::Path::isEmpty(), name(), elm::sys::Path::namePart(), elm::sys::Path::parent(), process(), wdir, and elm::sys::Path::withoutExt().
Referenced by makeWorkDir(), otawa::Application::run(), and otawa::Application::stats().
Set the path of the working directory.
path | new path to the working directory. |
|
static |
|
private |
|
private |
Referenced by add(), getImpl(), invalidate(), provides(), remove(), WorkSpace(), and ~WorkSpace().
Referenced by add(), findInstAt(), manager(), platform(), run(), start(), and WorkSpace().