Otawa  0.10
otawa::ContextualLoopBound Class Reference

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_ttree
 

Detailed Description

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.

Member Typedef Documentation

Constructor & Destructor Documentation

otawa::ContextualLoopBound::ContextualLoopBound ( int  max = undefined,
int  total = undefined 
)

Build a contextual loop bound with the given bounds.

Parameters
maxMaximum iteration.
totalTotal iteration.

Member Function Documentation

void otawa::ContextualLoopBound::addMax ( const ContextPath< Address > &  path,
int  max 
)
throw (AmbiguousBoundException
)

Add a context max bound.

Parameters
pathCall context.
maxMax bound.
Exceptions
AmbiguousBoundExceptionThrown 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.

Parameters
pathCall context.
totalTotal bound.
Exceptions
AmbiguousBoundExceptionThrown 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.

Parameters
pathContext path.
Returns
Maxmimum value (may be undefined).

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.

Parameters
pathContext path.
Returns
Total value (may be undefined).

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.

genstruct::Tree< ContextualLoopBound::data_t > * otawa::ContextualLoopBound::look ( const ContextPath< Address > &  path)
private

Look for the subtree matching the given path (build the subtree if required).

Parameters
pathPath to look in.
Returns
Matching subtree.

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.

int otawa::ContextualLoopBound::lookMax ( genstruct::Tree< data_t > *  cur)
private

Look to find the maximum in the tree children.

Parameters
curTree to look in.
Returns
Maximum.

References elm::genstruct::Tree< class >::children(), elm::genstruct::Tree< class >::data(), otawa::clp::max(), and undefined.

Referenced by findMax().

int otawa::ContextualLoopBound::lookTotal ( genstruct::Tree< data_t > *  cur)
private

Look to find the total in the tree children.

Parameters
curTree to look in.
Returns
Total.

References elm::genstruct::Tree< class >::children(), elm::genstruct::Tree< class >::isEmpty(), and undefined.

Referenced by findTotal().

void otawa::ContextualLoopBound::print ( genstruct::Tree< data_t > *  cur,
int  tab = 0 
)
private

Member Data Documentation

genstruct::Tree<data_t> otawa::ContextualLoopBound::tree
private

Referenced by findMax(), findTotal(), and look().

const int otawa::ContextualLoopBound::undefined = -1
static

Referenced by findMax(), findTotal(), lookMax(), and lookTotal().


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