Otawa  0.10
otawa::WorkSpace Class Reference

A workspace represents a program, its run-time and all information about WCET computation or any other analysis. More...

#include <otawa/prog/WorkSpace.h>

Inheritance diagram for otawa::WorkSpace:
otawa::PropList

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...
 
Processprocess (void) const
 
virtual hard::Platformplatform (void)
 
virtual Managermanager (void)
 
virtual Inststart (void)
 
virtual InstfindInstAt (address_t addr)
 
string format (Address addr, bool with_address=true)
 Format an address to make it human-readable. More...
 
elm::xom::Elementconfig (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...
 
FeatureDependencygetDependency (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::ASTInfogetASTInfo (void)
 Get the AST of the project. More...
 
ilp::SystemnewILPSystem (bool max=true)
 Build an ILP system with the default ILP engine. More...
 
CFGInfogetCFGInfo (void)
 Get the CFG of the project. More...
 
CFGgetStartCFG (void)
 Get the entry CFG of the program. More...
 
virtual const
hard::CacheConfiguration
cache (void)
 
PropertygetProp (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)
 
PropertyextractProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier and return it. More...
 
PropertyextractProp (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< Processproc
 
feat_map_t featMap
 
bool cancelled
 

Detailed Description

A workspace represents a program, its run-time and all information about WCET computation or any other analysis.

Member Typedef Documentation

Constructor & Destructor Documentation

otawa::WorkSpace::WorkSpace ( Process _proc)

Build a new wokspace with the given process.

Parameters
_procProcess to use.

References proc, and TRACE.

otawa::WorkSpace::WorkSpace ( const WorkSpace ws)

Build a new workspace on the same process as the given one.

Parameters
wsWorkspace to get the process form.

References proc, process(), and TRACE.

otawa::WorkSpace::~WorkSpace ( void  )
virtual

Member Function Documentation

void otawa::WorkSpace::cancel ( void  )
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.

void otawa::WorkSpace::clearCancellation ( void  )
inline

Reset the cancellation bit.

This function must be called before starting a long running time computation.

void otawa::PropList::clearProps ( void  )
inherited
xom::Element * otawa::WorkSpace::config ( void  )

Get the current configuration, if any, as an XML XOM element.

Returns
Configuration XML element or null.

References otawa::CONFIG_ELEMENT, otawa::CONFIG_PATH, and loadConfig().

void otawa::WorkSpace::delFeatDep ( const AbstractFeature feature)
private

Invalidates and delete the FeatureDependency associated w/ this feature and workspace It has to be freed by the user.

Parameters
featureProvided feature.

References featMap, elm::genstruct::HashTable< K, T, H >::get(), and elm::genstruct::HashTable< K, T, H >::remove().

Referenced by invalidate().

Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::script::Script::makeConfig().

Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inlineinherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::PropList::extractProp().

Referenced by otawa::PropList::extractProp().

string otawa::WorkSpace::format ( Address  addr,
bool  with_address = true 
)

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.

Parameters
addrAddress to display.
with_addressSet to true to ever display the address.
Returns
Formatted string.

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().

CFGInfo * otawa::WorkSpace::getCFGInfo ( void  )

Get the CFG of the project.

If it does not exists, built it.

Deprecated:

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.

Parameters
featureProvided feature.

References featMap, and elm::genstruct::HashTable< K, T, H >::get().

Referenced by invalidate(), otawa::Processor::process(), and provide().

CFG * otawa::WorkSpace::getStartCFG ( void  )

Get the entry CFG of the program.

Returns
Entry CFG if any or null.
Deprecated:

References otawa::CFGInfo::findCFG(), getCFGInfo(), and start().

bool otawa::WorkSpace::hasFeatDep ( const AbstractFeature feature)
private

Tests if the feature has a dependency graph associated with it, in the context of the present workspace.

Parameters
featureProvided feature.

References elm::genstruct::HashTable< K, T, H >::exists(), and featMap.

Referenced by provide().

bool otawa::PropList::hasProp ( const AbstractIdentifier id) const
inlineinherited

Test if the property list contains a property matching the given identifier.

Parameters
idProperty identifier to look for.
Returns
True if the list contains the matching property, false else.

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)

Parameters
featureProvided feature.

References elm::genstruct::Vector< T >::add(), elm::genstruct::Vector< T >::count(), delFeatDep(), getDependency(), and isProvided().

Referenced by otawa::Processor::process(), and ~WorkSpace().

bool otawa::WorkSpace::isCancelled ( void  ) const
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.

Returns
True if the computation has been cancelled, false else.

Referenced by otawa::Processor::process().

void otawa::WorkSpace::loadConfig ( const elm::system::Path &  path)

Load the given configuration in the process.

Parameters
pathPath to the XML configuration file.
Exceptions
LoadExceptionIf 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().

virtual Manager* otawa::WorkSpace::manager ( void  )
inlinevirtual

References proc.

Referenced by newILPSystem().

void otawa::WorkSpace::newFeatDep ( const AbstractFeature feature)
private

Create a new FeatureDependency associated with the feature.

Parameters
featureProvided 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.

Parameters
maxTrue for a maximized system, false for a minimized.
Returns
ILP system ready to use, NULL fi there is no support for ILP.
Deprecated:

References manager(), and otawa::Manager::newILPSystem().

void otawa::PropList::print ( elm::io::Output out) const
inherited

Display the current property list.

Parameters
outOutput to use.

Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().

Process* otawa::WorkSpace::process ( void  ) const
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

Parameters
featureProvided 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.

Parameters
featureFeature to remove.

References otawa::AbstractFeature::clean().

void otawa::PropList::removeAllProp ( const AbstractIdentifier id)
inherited

Remove all the properties matching the given identifier.

Parameters
idIdentifier of properties to remove.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::LoopUnroller::unroll().

void otawa::PropList::removeProp ( const AbstractIdentifier id)
inherited
void otawa::PropList::removeProp ( const AbstractIdentifier id)
inlineinherited
void otawa::WorkSpace::require ( const AbstractFeature feature,
const PropList props = PropList::EMPTY 
)

Ensure that a feature is provided.

Parameters
featureRequired feature.
propsConfiguration properties (optional).

References isProvided(), and otawa::AbstractFeature::process().

Referenced by otawa::Processor::process(), otawa::Application::require(), and otawa::script::Script::work().

void otawa::WorkSpace::serialize ( elm::serial2::Serializer serializer)
virtual

Serialize the workspace to the current serializer.

Parameters
serializerSerializer to serialize to.

References elm::serial2::Serializer::beginField(), elm::serial2::Serializer::endField(), otawa::Process::loader(), and process().

void otawa::PropList::setProp ( Property prop)
inherited

Set the property in the property list removing any double.

Parameters
propProperty to set.

References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().

void otawa::PropList::setProp ( const AbstractIdentifier id)
inlineinherited
virtual Inst* otawa::WorkSpace::start ( void  )
inlinevirtual
void otawa::WorkSpace::unserialize ( elm::serial2::Unserializer unserializer)
virtual

Unserialize the workspace to the current unserializer.

Parameters
unserializerUnserializer to unserialize to.

Member Data Documentation

bool otawa::WorkSpace::cancelled
private
const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.

feat_map_t otawa::WorkSpace::featMap
private
AutoPtr<Process> otawa::WorkSpace::proc
private

Referenced by cache(), WorkSpace(), and ~WorkSpace().


The documentation for this class was generated from the following files: