Otawa
0.10
|
A contextual loop bound is a collection of loop bound (including max iteration and total iteration number) for the different call contexts of a loop. More...
#include <otawa/flowfact/ContextualLoopBound.h>
Classes | |
struct | data_t |
Public Member Functions | |
ContextualLoopBound (int max=undefined, int total=undefined) | |
Build a contextual loop bound with the given bounds. More... | |
void | addMax (const ContextPath< Address > &path, int max) throw (AmbiguousBoundException) |
Add a context max bound. More... | |
void | addTotal (const ContextPath< Address > &path, int total) throw (AmbiguousBoundException) |
Add a context total bound. More... | |
int | findMax (const ContextPath< Address > &path) |
Find the maximum bound for the given context. More... | |
int | findTotal (const ContextPath< Address > &path) |
Find the total bound for the given context. More... | |
Static Public Attributes | |
static const int | undefined = -1 |
Private Types | |
typedef struct otawa::ContextualLoopBound::data_t | data_t |
Private Member Functions | |
genstruct::Tree< data_t > * | look (const ContextPath< Address > &path) |
Look for the subtree matching the given path (build the subtree if required). More... | |
int | lookMax (genstruct::Tree< data_t > *cur) |
Look to find the maximum in the tree children. More... | |
int | lookTotal (genstruct::Tree< data_t > *cur) |
Look to find the total in the tree children. More... | |
void | print (genstruct::Tree< data_t > *cur, int tab=0) |
Private Attributes | |
genstruct::Tree< data_t > | tree |
A contextual loop bound is a collection of loop bound (including max iteration and total iteration number) for the different call contexts of a loop.
The contextual loop bound does not require to contain all possible contexts but enough information for the top part of the call context. At worse, it may only contain the max loop bound for any context. The collection of the collections does not need to be exhaustive if safe loop count is given for less precise contexts.
|
private |
Build a contextual loop bound with the given bounds.
max | Maximum iteration. |
total | Total iteration. |
void otawa::ContextualLoopBound::addMax | ( | const ContextPath< Address > & | path, |
int | max | ||
) | |||
throw | ( | AmbiguousBoundException | |
) |
Add a context max bound.
path | Call context. |
max | Max bound. |
AmbiguousBoundException | Thrown when there is already a bound for the given context. |
References elm::genstruct::Tree< class >::data(), elm::max(), and otawa::clp::max().
void otawa::ContextualLoopBound::addTotal | ( | const ContextPath< Address > & | path, |
int | total | ||
) | |||
throw | ( | AmbiguousBoundException | |
) |
Add a context total bound.
path | Call context. |
total | Total bound. |
AmbiguousBoundException | Thrown when there is already a bound for the given context. |
References elm::genstruct::Tree< class >::data(), and elm::max().
int otawa::ContextualLoopBound::findMax | ( | const ContextPath< Address > & | path | ) |
Find the maximum bound for the given context.
path | Context path. |
References elm::genstruct::Tree< class >::children(), otawa::ContextPath< T >::count(), elm::genstruct::Tree< class >::data(), lookMax(), otawa::clp::max(), elm::genstruct::Tree< class >::sibling(), tree, and undefined.
int otawa::ContextualLoopBound::findTotal | ( | const ContextPath< Address > & | path | ) |
Find the total bound for the given context.
path | Context path. |
References elm::genstruct::Tree< class >::children(), otawa::ContextPath< T >::count(), elm::genstruct::Tree< class >::data(), lookTotal(), otawa::clp::max(), elm::genstruct::Tree< class >::sibling(), tree, and undefined.
|
private |
Look for the subtree matching the given path (build the subtree if required).
path | Path to look in. |
References elm::genstruct::Tree< class >::add(), elm::genstruct::Tree< class >::children(), otawa::ContextPath< T >::count(), elm::genstruct::Tree< class >::data(), elm::genstruct::Tree< class >::sibling(), and tree.
|
private |
Look to find the maximum in the tree children.
cur | Tree to look in. |
References elm::genstruct::Tree< class >::children(), elm::genstruct::Tree< class >::data(), otawa::clp::max(), and undefined.
Referenced by findMax().
|
private |
Look to find the total in the tree children.
cur | Tree to look in. |
References elm::genstruct::Tree< class >::children(), elm::genstruct::Tree< class >::isEmpty(), and undefined.
Referenced by findTotal().
|
private |
|
private |
Referenced by findMax(), findTotal(), and look().
|
static |
Referenced by findMax(), findTotal(), lookMax(), and lookTotal().