Otawa
0.10
|
This class provided feature requirement for non-program processor classes. More...
#include <otawa/proc/FeatureRequirer.h>
Protected Member Functions | |
FeatureRequirer (WorkSpace *ws, AbstractFeature *features[]) | |
Check that the features are available. More... | |
Static Protected Member Functions | |
static void | require (Processor &proc, AbstractFeature *features[]) |
Added the given array of feature to the requirements of the processor. More... | |
This class provided feature requirement for non-program processor classes.
It provides two methods that takes as parameter an array of required features ended by the NULL_FEATURE.
The first one, the constructor, takes as parameter the workspace and the feature array and check that the features are available. If not, an assertion failure is raised. If the constant NDEBUG is defined, the check is not performed and no time is lost in this verification.
The second method is static and add to the current processor the array of feature as requirements. To make it working, each requirer must provide to the user processor a static method that calls this one in order to add the feature of the requirer to the feature of the processor. The constructor is only used to assert that the require method has been called.
Below, you may found an example. First, we provided a facility with a requirement:
Then, my processor uses my facility as below:
|
protected |
Check that the features are available.
ws | Workspace to work on. |
features | Array of feature to check (ended by NULL_FEATURE). |
References otawa::WorkSpace::isProvided(), and otawa::AbstractFeature::null.
|
staticprotected |
Added the given array of feature to the requirements of the processor.
proc | Processor to add feature requirements to. |
features | Array of feature to a requirement for (ended by NULL_FEATURE). |
References otawa::AbstractFeature::null, and otawa::Processor::require().