Otawa
0.10
|
A workspace represents a program, its run-time and all information about WCET computation or any other analysis. More...
#include <otawa/prog/WorkSpace.h>
Public Member Functions | |
WorkSpace (Process *_proc) | |
Build a new wokspace with the given process. More... | |
WorkSpace (const WorkSpace *ws) | |
Build a new workspace on the same process as the given one. More... | |
virtual | ~WorkSpace (void) |
Delete the workspace and the associated process. More... | |
Process * | process (void) const |
virtual hard::Platform * | platform (void) |
virtual Manager * | manager (void) |
virtual Inst * | start (void) |
virtual Inst * | findInstAt (address_t addr) |
string | format (Address addr, bool with_address=true) |
Format an address to make it human-readable. More... | |
elm::xom::Element * | config (void) |
Get the current configuration, if any, as an XML XOM element. More... | |
void | loadConfig (const elm::system::Path &path) |
Load the given configuration in the process. More... | |
void | require (const AbstractFeature &feature, const PropList &props=PropList::EMPTY) |
Ensure that a feature is provided. More... | |
void | provide (const AbstractFeature &feature, const Vector< const AbstractFeature * > *required=NULL) |
Record in the workspace that a feature is provided. More... | |
bool | isProvided (const AbstractFeature &feature) |
Test if a feature is provided. More... | |
void | remove (const AbstractFeature &feature) |
Remove a feature. More... | |
void | invalidate (const AbstractFeature &feature) |
Invalidate a feature (removing its dependencies) More... | |
FeatureDependency * | getDependency (const AbstractFeature *feature) |
Get the dependency graph node associated with the feature and workspace. More... | |
void | clearCancellation (void) |
Reset the cancellation bit. More... | |
void | cancel (void) |
Informs the current computation to stop as soon as possible. More... | |
bool | isCancelled (void) const |
Test if the cancel() method has been called on the workspace. More... | |
virtual void | serialize (elm::serial2::Serializer &serializer) |
Serialize the workspace to the current serializer. More... | |
virtual void | unserialize (elm::serial2::Unserializer &unserializer) |
Unserialize the workspace to the current unserializer. More... | |
ast::ASTInfo * | getASTInfo (void) |
Get the AST of the project. More... | |
ilp::System * | newILPSystem (bool max=true) |
Build an ILP system with the default ILP engine. More... | |
CFGInfo * | getCFGInfo (void) |
Get the CFG of the project. More... | |
CFG * | getStartCFG (void) |
Get the entry CFG of the program. More... | |
virtual const hard::CacheConfiguration & | cache (void) |
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... | |
Static Public Attributes | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Private Types | |
typedef HashTable< const AbstractFeature *, FeatureDependency * > | feat_map_t |
Private Member Functions | |
void | newFeatDep (const AbstractFeature *feature) |
Create a new FeatureDependency associated with the feature. More... | |
bool | hasFeatDep (const AbstractFeature *feature) |
Tests if the feature has a dependency graph associated with it, in the context of the present workspace. More... | |
void | delFeatDep (const AbstractFeature *feature) |
Invalidates and delete the FeatureDependency associated w/ this feature and workspace It has to be freed by the user. More... | |
Private Attributes | |
AutoPtr< Process > | proc |
feat_map_t | featMap |
bool | cancelled |
A workspace represents a program, its run-time and all information about WCET computation or any other analysis.
|
private |
otawa::WorkSpace::WorkSpace | ( | Process * | _proc | ) |
otawa::WorkSpace::WorkSpace | ( | const WorkSpace * | ws | ) |
|
virtual |
Delete the workspace and the associated process.
References elm::genstruct::Vector< T >::add(), otawa::PropList::clearProps(), featMap, invalidate(), isProvided(), elm::genstruct::Vector< T >::length(), proc, and TRACE.
|
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().
|
virtual |
|
inline |
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.
|
inline |
Reset the cancellation bit.
This function must be called before starting a long running time computation.
|
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 ~WorkSpace().
xom::Element * otawa::WorkSpace::config | ( | void | ) |
Get the current configuration, if any, as an XML XOM element.
References otawa::CONFIG_ELEMENT, otawa::CONFIG_PATH, and loadConfig().
|
private |
Invalidates and delete the FeatureDependency associated w/ this feature and workspace It has to be freed by the user.
feature | Provided feature. |
References featMap, elm::genstruct::HashTable< K, T, H >::get(), and elm::genstruct::HashTable< K, T, H >::remove().
Referenced by invalidate().
|
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().
References proc.
Referenced by otawa::CFGBuilder::buildCFG(), otawa::AbsoluteAddress::cfg(), otawa::LabelAddress::cfg(), format(), otawa::VarTextDecoder::getInst(), otawa::ipet::FlowFactLoader::lookLineAt(), otawa::ast::ASTLoader::makeBlock(), otawa::VarTextDecoder::processWorkSpace(), otawa::CFGProcessor::str(), and yyparse().
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 otawa::ProgItem::address(), buf, findInstAt(), otawa::Process::getSourceLine(), hex(), otawa::Symbol::ID, otawa::Address::isNull(), otawa::Inst::prevInst(), process(), and elm::StringBuffer::toString().
Referenced by otawa::CFGChecker::processBB(), and otawa::ipet::FlowFactConstraintBuilder::processBB().
ast::ASTInfo * otawa::WorkSpace::getASTInfo | ( | void | ) |
Get the AST of the project.
Referenced by otawa::ets::ACSComputation::applyProcess(), otawa::ets::CacheHitComputation::computation(), otawa::ets::CacheMissComputation::computation(), otawa::ets::CacheFirstMissComputation::computation(), otawa::ets::WCETComputation::computation(), otawa::ets::ACSComputation::initialization(), otawa::ets::FlowFactLoader::processAST(), otawa::ets::TrivialAstBlockTime::processAST(), and otawa::FunProcessor::processWorkSpace().
CFGInfo * otawa::WorkSpace::getCFGInfo | ( | void | ) |
Get the CFG of the project.
If it does not exists, built it.
References otawa::CFGInfo::ID, and otawa::Processor::process().
Referenced by getStartCFG().
FeatureDependency * otawa::WorkSpace::getDependency | ( | const AbstractFeature * | feature | ) |
Get the dependency graph node associated with the feature and workspace.
feature | Provided feature. |
References featMap, and elm::genstruct::HashTable< K, T, H >::get().
Referenced by invalidate(), otawa::Processor::process(), and provide().
|
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().
CFG * otawa::WorkSpace::getStartCFG | ( | void | ) |
Get the entry CFG of the program.
References otawa::CFGInfo::findCFG(), getCFGInfo(), and start().
|
private |
Tests if the feature has a dependency graph associated with it, in the context of the present workspace.
feature | Provided feature. |
References elm::genstruct::HashTable< K, T, H >::exists(), and featMap.
Referenced by provide().
|
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().
void otawa::WorkSpace::invalidate | ( | const AbstractFeature & | feature | ) |
Invalidate a feature (removing its dependencies)
feature | Provided feature. |
References elm::genstruct::Vector< T >::add(), elm::genstruct::Vector< T >::count(), delFeatDep(), getDependency(), and isProvided().
Referenced by otawa::Processor::process(), and ~WorkSpace().
|
inline |
Test if the cancel() method has been called on the workspace.
This method is usually called by code processor to know if the computation has been canceled.
Referenced by otawa::Processor::process().
bool otawa::WorkSpace::isProvided | ( | const AbstractFeature & | feature | ) |
Test if a feature is provided.
feature | Feature to test. |
References featMap, and elm::genstruct::HashTable< K, T, H >::get().
Referenced by otawa::AbsoluteAddress::cfg(), otawa::LabelAddress::cfg(), otawa::FeatureRequirer::FeatureRequirer(), invalidate(), otawa::Processor::process(), otawa::FlowFactLoader::processWorkSpace(), provide(), require(), otawa::ipet::FlowFactLoader::setup(), otawa::BBRatioDisplayer::setup(), otawa::etime::StandardEventBuilder::setup(), and ~WorkSpace().
void otawa::WorkSpace::loadConfig | ( | const elm::system::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. |
References _, elm::xom::Builder::build(), otawa::CONFIG_ELEMENT, elm::xom::Element::getLocalName(), elm::xom::Element::getNamespaceURI(), and elm::xom::Document::getRootElement().
Referenced by config().
|
inlinevirtual |
References proc.
Referenced by newILPSystem().
|
private |
Create a new FeatureDependency associated with the feature.
feature | Provided feature. |
References featMap, elm::genstruct::HashTable< K, T, H >::get(), and elm::genstruct::HashTable< K, T, H >::put().
Referenced by provide().
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().
|
inlinevirtual |
References proc.
Referenced by otawa::ExeGraph< N >::build(), otawa::ParExeGraph::createSequenceResources(), otawa::ParamExeGraph::ParamExeGraph(), otawa::EdgeCAT2Builder::processCFG(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::EdgeACSBuilder::processWorkSpace(), otawa::ResourceList::ResourceList(), and otawa::dcache::BlockBuilder::setup().
|
inherited |
Display the current property list.
out | Output to use. |
Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().
|
inline |
References proc.
Referenced by otawa::PFGBuilder::addFunction(), otawa::FlowFactLoader::addressOf(), otawa::Loader::check(), otawa::CFGInfo::findCFG(), otawa::ast::ASTLoader::findLabel(), format(), otawa::VarTextDecoder::getBytes(), otawa::VarTextDecoder::getInst(), otawa::ipet::FlowFactLoader::lookLineAt(), otawa::DelayedBuilder::makeNOp(), otawa::clp::Manager::Manager(), otawa::DelayedBuilder::next(), otawa::FlowFactLoader::onCheckSum(), 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::onRegSet(), otawa::FlowFactLoader::onReturn(), otawa::FlowFactLoader::onSetInlining(), otawa::ParExeGraph::ParExeGraph(), otawa::cfgio::Output::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::CFGCheckSummer::processCFG(), otawa::ipet::ConstraintLoader::processCFG(), otawa::TextDecoder::processWorkSpace(), otawa::VarTextDecoder::processWorkSpace(), otawa::hard::Dumper::processWorkSpace(), otawa::FixedTextDecoder::processWorkSpace(), otawa::CFGBuilder::processWorkSpace(), otawa::PFGBuilder::processWorkSpace(), otawa::StackAnalysis::processWorkSpace(), otawa::ipet::ILPSystemGetter::processWorkSpace(), otawa::ast::ASTLoader::processWorkSpace(), otawa::display::ILPSystemDisplayer::processWorkSpace(), otawa::clp::Analysis::processWorkSpace(), otawa::FlowFactLoader::processWorkSpace(), otawa::FlowFactLoader::scanIgnoreControl(), otawa::FlowFactLoader::scanIgnoreSeq(), otawa::FlowFactLoader::scanMultiBranch(), otawa::FlowFactLoader::scanMultiCall(), otawa::FlowFactLoader::scanNoInline(), otawa::FlowFactLoader::scanSetInlining(), serialize(), otawa::FixedTextDecoder::setup(), otawa::tsim::BBTimeSimulator::setup(), otawa::dcache::BlockBuilder::setup(), otawa::tsim::BBPath::simulate(), otawa::DelayedBuilder::size(), otawa::LabelAddress::toAddress(), otawa::script::Script::work(), and WorkSpace().
void otawa::WorkSpace::provide | ( | const AbstractFeature & | feature, |
const Vector< const AbstractFeature * > * | required = NULL |
||
) |
Record in the workspace that a feature is provided.
Also update the feature dependency graph
feature | Provided feature. |
References otawa::FeatureDependency::add(), elm::genstruct::Vector< T >::contains(), elm::genstruct::Vector< T >::count(), elm::genstruct::Vector< T >::get(), getDependency(), hasFeatDep(), isProvided(), otawa::AbstractIdentifier::name(), and newFeatDep().
Referenced by otawa::Process::link(), and otawa::Processor::process().
void otawa::WorkSpace::remove | ( | const AbstractFeature & | feature | ) |
Remove a feature.
It is usually called by processor whose actions remove some properties from the workspace.
feature | Feature to remove. |
References otawa::AbstractFeature::clean().
|
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::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::Processor::process(), otawa::Application::require(), and otawa::script::Script::work().
|
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(), and process().
|
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().
|
inlinevirtual |
References proc.
Referenced by getStartCFG(), otawa::VarTextDecoder::processWorkSpace(), otawa::CFGBuilder::processWorkSpace(), and otawa::PFGBuilder::processWorkSpace().
|
virtual |
Unserialize the workspace to the current unserializer.
unserializer | Unserializer to unserialize to. |
|
private |
|
staticinherited |
This is an empty proplist for convenience.
|
private |
Referenced by delFeatDep(), getDependency(), hasFeatDep(), isProvided(), newFeatDep(), and ~WorkSpace().
Referenced by cache(), WorkSpace(), and ~WorkSpace().