Otawa  0.10
otawa::Feature< T, C > Class Template Reference

A feature is a set of facilities, usually provided using properties, available on a framework. More...

#include <otawa/proc/Feature.h>

Inheritance diagram for otawa::Feature< T, C >:
otawa::AbstractFeature otawa::Identifier< Processor * > otawa::AbstractIdentifier otawa::PropList

Public Member Functions

 Feature (CString name="")
 
virtual void process (WorkSpace *fw, const PropList &props=PropList::EMPTY) const
 This method is called, when a feature is not available, to provided a default implementation of the feature. More...
 
virtual void check (WorkSpace *fw) const
 Check if the framework really implement the current feature. More...
 
virtual void clean (WorkSpace *ws) const
 This method is called each time a feature is invalidated. More...
 
const Processor *& defaultValue (void) const
 
void add (PropList &list, const Processor *&value) const
 Add a generic property to the given list with the current identifier. More...
 
void add (PropList *list, const Processor *&value) const
 Add a generic property to the given list with the current identifier. More...
 
void set (PropList &list, const Processor *&value) const
 Set the value of a generic property with the current identifier to the given list. More...
 
void set (PropList *list, const Processor *&value) const
 Set the value of a generic property with the current identifier to the given list. More...
 
void set (Property *prop, const Processor *&value) const
 
elm::Option< Processor * > get (const PropList &list) const
 
const Processor *& get (const PropList &list, const Processor *&def) const
 Get the value associated with a property matching the current identifier. More...
 
elm::Option< Processor * > get (const PropList *list) const
 
const Processor *& get (const PropList *list, const Processor *&def) const
 Get the value associated with a property matching the current identifier. More...
 
const Processor *& get (const Property *prop) const
 
Processor *& ref (PropList &list) const
 
Processor *& ref (PropList *list) const
 
const Processor *& use (const PropList &list) const
 Get the value matching the current identifier in the given list. More...
 
const Processor *& use (const PropList *list) const
 Get the value matching the current identifier in the given list. More...
 
const Processor *& value (const PropList &list) const
 For internal use only. More...
 
Ref< Processor *, Identifiervalue (PropList &list) const
 For internal use only. More...
 
const Processor *& value (const PropList *list) const
 For internal use only. More...
 
Ref< Processor *, Identifier
< Processor * > > 
value (PropList *list) const
 For internal use only. More...
 
void remove (PropList &list) const
 Remove the property with the current identifier from the given list. More...
 
void remove (PropList *list) const
 Remove the property with the current identifier from the given list. More...
 
bool exists (PropList &list) const
 Test if the given list contains a property with the current identifier. More...
 
bool exists (PropList *list) const
 Test if the given list contains a property with the current identifier. More...
 
void copy (PropList &list, Property *prop)
 
void copy (PropList *list, Property *prop)
 
virtual Propertycopy (Property &prop) const
 Build a copy of the given property. More...
 
Propertycopy (Property *prop) const
 
const Processor *& operator() (const PropList &props) const
 Read the value in a functional way. More...
 
const Processor *& operator() (const PropList *props) const
 Read the value in a functional way. More...
 
Ref< Processor *, Identifier
< Processor * > > 
operator() (PropList &props) const
 Read or write a property value in a functional way. More...
 
Ref< Processor *, Identifier
< Processor * > > 
operator() (PropList *props) const
 Read or write a property value in a functional way. More...
 
const Processor *& operator() (Property *prop) const
 
virtual void print (elm::io::Output &out, const Property *prop) const
 Print the value of the given property (accordint the property matches the given identifier). More...
 
void print (elm::io::Output &out) const
 Print the identifier. More...
 
void print (elm::io::Output &output, const Property &prop) const
 
virtual void printFormatted (io::Output &out, const Property *prop) const
 Print the value of the given property in a formatted way, that is, possibly to perform re-scanning after. More...
 
void printFormatted (elm::io::Output &output, const Property &prop) const
 
virtual const Typetype (void) const
 Get the identifier of data linked with this property. More...
 
virtual void fromString (PropList &props, const string &str) const
 Get value of an identifier from a string and store it in the given property list. More...
 
const string name (void) const
 Get the string name of the identifier. More...
 
virtual bool equals (const Property *prop1, const Property *prop2) const
 Test if two properties are equal. More...
 
virtual void serialize (Property *prop, elm::serial2::Serializer &serializer)
 Serialize the workspace to the current serializer. More...
 
virtual Propertyunserialize (elm::serial2::Unserializer &unserializer)
 Unserialize the workspace to the current unserializer. More...
 
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...
 

Static Public Member Functions

static AbstractIdentifierfind (const string &name)
 Find an abstract identifier by its name. More...
 

Static Public Attributes

static AbstractFeaturenull = _null
 Null value for features. More...
 
static const PropList EMPTY
 This is an empty proplist for convenience. More...
 

Protected Member Functions

void initProps (Property *prop, VarArg &args)
 Add the properties found in the arguments (list of Property * ended by null) to the identifier properties. More...
 

Detailed Description

template<class T, class C = default_handler_t>
class otawa::Feature< T, C >

A feature is a set of facilities, usually provided using properties, available on a framework.

If a feature is present on a framework, it ensures that the matching properties all also set. Most of the time, the features are provided and required by the code processor. If a feature is not available, a processor matching the feature is retrieved from the processor configuration property list if any or from a default processor tied to the Feature class. This processor gives a default implementation computing the lacking feature.

Parameters
TDefault processor to compute the feature.
CFeature checker. This type (class or structure) must provide a function called "check" as provided by the Feature class.

Constructor & Destructor Documentation

template<class T , class C >
otawa::Feature< T, C >::Feature ( CString  name = "")

Member Function Documentation

void otawa::Identifier< Processor * >::add ( PropList list,
const Processor * &  value 
) const
inlineinherited

Add a generic property to the given list with the current identifier.

Parameters
listList to add to.
valueValue of the property.
void otawa::Identifier< Processor * >::add ( PropList list,
const Processor * &  value 
) const
inlineinherited

Add a generic property to the given list with the current identifier.

Parameters
listList to add to.
valueValue of the property.
template<class T, class C = default_handler_t>
virtual void otawa::Feature< T, C >::check ( WorkSpace fw) const
inlinevirtual

Check if the framework really implement the current feature.

If not, it throws a ProcessorException. This method is only usually called for debugging purpose as its execution is often very large.

Implements otawa::AbstractFeature.

template<class T, class C = default_handler_t>
virtual void otawa::Feature< T, C >::clean ( WorkSpace ws) const
inlinevirtual

This method is called each time a feature is invalidated.

In this case, the feature must removed all properties put on the workspace.

Implements otawa::AbstractFeature.

void otawa::PropList::clearProps ( void  )
inherited
Property* otawa::AbstractIdentifier::copy ( Property prop) const
inlineinherited
void otawa::Identifier< Processor * >::copy ( PropList list,
Property prop 
)
inlineinherited
void otawa::Identifier< Processor * >::copy ( PropList list,
Property prop 
)
inlineinherited
virtual Property* otawa::Identifier< Processor * >::copy ( Property prop) const
inlinevirtualinherited

Build a copy of the given property.

Parameters
propProperty to copy.
Returns
Copy of the property.

Reimplemented from otawa::AbstractIdentifier.

const Processor * & otawa::Identifier< Processor * >::defaultValue ( void  ) const
inlineinherited
bool otawa::AbstractIdentifier::equals ( const Property prop1,
const Property prop2 
) const
virtualinherited

Test if two properties are equal.

Parameters
prop1First property.
prop2Second property.
Returns
True if they are equal, false else.
bool otawa::Identifier< Processor * >::exists ( PropList list) const
inlineinherited

Test if the given list contains a property with the current identifier.

Parameters
listList to look in.
Returns
True if there is a property with current identifier, false else.
bool otawa::Identifier< Processor * >::exists ( PropList list) const
inlineinherited

Test if the given list contains a property with the current identifier.

Parameters
listList to look in.
Returns
True if there is a property with current identifier, false else.
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().

AbstractIdentifier * otawa::AbstractIdentifier::find ( const string name)
staticinherited

Find an abstract identifier by its name.

Parameters
nameName of the looked identifier.
Returns
Found identifier or null.

Referenced by otawa::ProcessorPlugin::getIdentifier(), and otawa::Application::run().

virtual void otawa::Identifier< Processor * >::fromString ( PropList props,
const string str 
) const
virtualinherited

Get value of an identifier from a string and store it in the given property list.

Parameters
propsProperty list to store result into.
strString to get value from.

Reimplemented from otawa::AbstractIdentifier.

elm::Option<Processor * > otawa::Identifier< Processor * >::get ( const PropList list) const
inlineinherited
const Processor * & otawa::Identifier< Processor * >::get ( const PropList list,
const Processor * &  def 
) const
inlineinherited

Get the value associated with a property matching the current identifier.

If the property is not found, return the default value.

Parameters
listList to look in.
defDefault value.
Returns
Found value or the default value.
elm::Option<Processor * > otawa::Identifier< Processor * >::get ( const PropList list) const
inlineinherited
const Processor * & otawa::Identifier< Processor * >::get ( const PropList list,
const Processor * &  def 
) const
inlineinherited

Get the value associated with a property matching the current identifier.

If the property is not found, return the default value.

Parameters
listList to look in.
defDefault value.
Returns
Found value or the default value.
const Processor * & otawa::Identifier< Processor * >::get ( const Property prop) const
inlineinherited
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::AbstractIdentifier::initProps ( Property prop,
VarArg args 
)
protectedinherited

Add the properties found in the arguments (list of Property * ended by null) to the identifier properties.

Parameters
propFirst property.
argsNull-ended properties to scan.

References otawa::PropList::addProp(), and elm::VarArg::next().

Referenced by otawa::AbstractIdentifier::AbstractIdentifier().

const Processor * & otawa::Identifier< Processor * >::operator() ( const PropList props) const
inlineinherited

Read the value in a functional way.

Parameters
propsProperty list to read the property from.
Returns
Value of the property matching the current identifier in the list.
const Processor * & otawa::Identifier< Processor * >::operator() ( const PropList props) const
inlineinherited

Read the value in a functional way.

Parameters
propsProperty list to read the property from.
Returns
Value of the property matching the current identifier in the list.
Ref<Processor * , Identifier<Processor * > > otawa::Identifier< Processor * >::operator() ( PropList props) const
inlineinherited

Read or write a property value in a functional way.

The returned value may be read (automatic conversion to the value) or written (using operator = to set the value or += to add a new value at the property list.

Parameters
propsProperty list to read the property from.
Returns
Value of the property matching the current identifier in the list.
Ref<Processor * , Identifier<Processor * > > otawa::Identifier< Processor * >::operator() ( PropList props) const
inlineinherited

Read or write a property value in a functional way.

The returned value may be read (automatic conversion to the value) or written (using operator = to set the value or += to add a new value at the property list.

Parameters
propsProperty list to read the property from.
Returns
Value of the property matching the current identifier in the list.
const Processor * & otawa::Identifier< Processor * >::operator() ( Property prop) const
inlineinherited
void otawa::AbstractIdentifier::print ( elm::io::Output out) const
inherited

Print the identifier.

Parameters
outOutput stream.

References otawa::AbstractIdentifier::nam.

void otawa::AbstractIdentifier::print ( elm::io::Output output,
const Property prop 
) const
inlineinherited
virtual void otawa::Identifier< Processor * >::print ( elm::io::Output out,
const Property prop 
) const
inlinevirtualinherited

Print the value of the given property (accordint the property matches the given identifier).

It is an error to call this method with a property matching a different identifier.

Use the print() method of a property instead.

Reimplemented from otawa::AbstractIdentifier.

void otawa::AbstractIdentifier::printFormatted ( elm::io::Output output,
const Property prop 
) const
inlineinherited
virtual void otawa::Identifier< Processor * >::printFormatted ( io::Output out,
const Property prop 
) const
inlinevirtualinherited

Print the value of the given property in a formatted way, that is, possibly to perform re-scanning after.

For example, string are quoted and special character escaped.

Parameters
outOutput to use.
propProperty to display.

Reimplemented from otawa::AbstractIdentifier.

template<class T , class C >
void otawa::Feature< T, C >::process ( WorkSpace fw,
const PropList props = PropList::EMPTY 
) const
virtual

This method is called, when a feature is not available, to provided a default implementation of the feature.

Parameters
fwFramework to work on.
propsProperty list configuration.

Implements otawa::AbstractFeature.

References proc, and otawa::Processor::process().

Processor * & otawa::Identifier< Processor * >::ref ( PropList list) const
inlineinherited
Processor * & otawa::Identifier< Processor * >::ref ( PropList list) const
inlineinherited
void otawa::Identifier< Processor * >::remove ( PropList list) const
inlineinherited

Remove the property with the current identifier from the given list.

Parameters
listList to remove from.
void otawa::Identifier< Processor * >::remove ( PropList list) const
inlineinherited

Remove the property with the current identifier from the given list.

Parameters
listList to remove from.
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::AbstractIdentifier::serialize ( Property prop,
elm::serial2::Serializer serializer 
)
virtualinherited

Serialize the workspace to the current serializer.

In the default implementation, do nothing.

Parameters
propProperty containing the value to serialize.
serializerSerializer to serialize to.
void otawa::Identifier< Processor * >::set ( PropList list,
const Processor * &  value 
) const
inlineinherited

Set the value of a generic property with the current identifier to the given list.

Parameters
listList to set in.
valueValue to set.
void otawa::Identifier< Processor * >::set ( PropList list,
const Processor * &  value 
) const
inlineinherited

Set the value of a generic property with the current identifier to the given list.

Parameters
listList to set in.
valueValue to set.
void otawa::Identifier< Processor * >::set ( Property prop,
const Processor * &  value 
) const
inlineinherited
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 const Type& otawa::Identifier< Processor * >::type ( void  ) const
inlinevirtualinherited

Get the identifier of data linked with this property.

It may return Type::no_type ever meaning that the identifier does not support type system or that it is just a flag without associated data.

Returns
Type of the associated data.

Reimplemented from otawa::AbstractIdentifier.

Property * otawa::AbstractIdentifier::unserialize ( elm::serial2::Unserializer unserializer)
virtualinherited

Unserialize the workspace to the current unserializer.

In the default implementation, do nothing.

Parameters
unserializerUnserializer to unserialize to.
Returns
Property result of unserialization, null if the property cannot be unserialized.
const Processor * & otawa::Identifier< Processor * >::use ( const PropList list) const
inlineinherited

Get the value matching the current identifier in the given list.

Cause a run-time abort if the property is not available.

Parameters
listList to look in.
Returns
Matching value.
const Processor * & otawa::Identifier< Processor * >::use ( const PropList list) const
inlineinherited

Get the value matching the current identifier in the given list.

Cause a run-time abort if the property is not available.

Parameters
listList to look in.
Returns
Matching value.
const Processor * & otawa::Identifier< Processor * >::value ( const PropList list) const
inlineinherited

For internal use only.

Referenced by otawa::ActualFeature::~ActualFeature().

Ref<Processor * , Identifier> otawa::Identifier< Processor * >::value ( PropList list) const
inlineinherited

For internal use only.

const Processor * & otawa::Identifier< Processor * >::value ( const PropList list) const
inlineinherited

For internal use only.

Ref<Processor * , Identifier<Processor * > > otawa::Identifier< Processor * >::value ( PropList list) const
inlineinherited

For internal use only.

Member Data Documentation

const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.

AbstractFeature & otawa::AbstractFeature::null = _null
staticinherited

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