Otawa  0.10
otawa::clp::Value Class Reference

A set of values represented by a Circular Linear Progression. More...

#include <otawa/data/clp/ClpValue.h>

Public Member Functions

bool isConst (void) const
 
 Value (kind_t kind=VAL, intn_t lower=0, intn_t delta=0, uintn_t mtimes=0)
 Constructor for a new CLP. More...
 
 Value (const Value &val)
 Copy constructor. More...
 
 Value (const int val)
 Singleton constructor. More...
 
Valueoperator= (const Value &val)
 
bool isTop (void) const
 
bool operator== (const Value &val) const
 
bool operator!= (const Value &val) const
 
Value operator+ (const Value &val) const
 
Value operator- (const Value &val) const
 
bool operator>= (const int val) const
 
kind_t kind (void) const
 
intn_t lower (void) const
 
intn_t upper (void) const
 
intn_t delta (void) const
 
uintn_t mtimes (void) const
 
intn_t start (void) const
 
intn_t stop (void) const
 
void add (const Value &val)
 Add another set to the current one. More...
 
void sub (const Value &val)
 Subtract anothe set to the current one. More...
 
void print (io::Output &out) const
 Print a human representation of the CLP. More...
 
void shl (const Value &val)
 Left shift the current value. More...
 
void shr (const Value &val)
 Right shift the current value. More...
 
void _or (const Value &val)
 Perform OR operator on values (modifying current one). More...
 
void join (const Value &val)
 Join another set to the current one. More...
 
void widening (const Value &val)
 Perform a widening to the infinite (to be filtred later) More...
 
void ffwidening (const Value &val, int loopBound)
 Perform a widening, knowing flow facts for the loop. More...
 
void inter (const Value &val)
 Intersection with the current value. More...
 
void reverse (void)
 Reverse the CLP direction (swap upper and lower bounds, and use the opposite of delta as new delta). More...
 
bool swrap (void) const
 
bool uwrap (void) const
 
void ge (intn_t k)
 Filter the current value with signed values greater than k. More...
 
void geu (uintn_t k)
 Filter the current value with unsigned values greater than k. More...
 
void le (intn_t k)
 Filter the current value with signed values lesser than k. More...
 
void leu (uintn_t k)
 Filter the current value with unsigned values lesser than k. More...
 
void eq (uintn_t k)
 
void ne (uintn_t k)
 
void _and (const Value &val)
 Perform AND on the current value. More...
 
void set (kind_t kind, intn_t lower, intn_t delta, uintn_t mtimes)
 Set the values for the current object. More...
 

Static Public Attributes

static int and_threshold = 8
 Find a file of 1 in a word. More...
 
static const Value none
 Represents the bottom element. More...
 
static const Value all
 Represents the top element. More...
 

Private Member Functions

void check (void)
 

Private Attributes

kind_t _kind
 
intn_t _lower
 
intn_t _delta
 
uintn_t _mtimes
 

Detailed Description

A set of values represented by a Circular Linear Progression.

Represents a CLP value.

Values are defined by a 3-tuple (lower, delta, mtimes) for 32bits numbers. A constant integer k is represented by (k, 0, 0) The Top element is represented by (0, 1, 2^32 - 1)

Constructor & Destructor Documentation

otawa::clp::Value::Value ( kind_t  kind = VAL,
intn_t  lower = 0,
intn_t  delta = 0,
uintn_t  mtimes = 0 
)
inline

Constructor for a new CLP.

Parameters
kindthe kind of the CLP
lowerthe lower bound
deltathe delta
mtimesthe number of time the delta is applied
otawa::clp::Value::Value ( const Value val)
inline

Copy constructor.

otawa::clp::Value::Value ( const int  val)
inline

Singleton constructor.

Parameters
valthe single integer element of the CLP
Returns
the CLP (val, 0, 0)

Member Function Documentation

void otawa::clp::Value::_and ( const Value val)

Perform AND on the current value.

Parameters
valValue to perform AND on.

References delta(), isConst(), lower(), mtimes(), elm::none, and otawa::clp::VAL.

void otawa::clp::Value::_or ( const Value val)

Perform OR operator on values (modifying current one).

Parameters
valThe value to OR with the current one.

References _lower, otawa::clp::ALL, isConst(), kind(), and otawa::clp::NONE.

void otawa::clp::Value::add ( const Value val)

Add another set to the current one.

Parameters
valthe value to add

References _delta, _kind, _lower, _mtimes, elm::abs(), otawa::clp::ALL, delta(), delta, otawa::clp::NONE, otawa::se::reverse(), set(), start(), otawa::clp::UMAXn, and otawa::clp::VAL.

Referenced by operator+().

void otawa::clp::Value::check ( void  )
inlineprivate
intn_t otawa::clp::Value::delta ( void  ) const
inline
void otawa::clp::Value::eq ( uintn_t  k)
void otawa::clp::Value::ffwidening ( const Value val,
int  loopBound 
)

Perform a widening, knowing flow facts for the loop.

Parameters
valthe value of the next iteration state
loopBoundthe maximum number of iteration of the loop

References _delta, _kind, _lower, _mtimes, otawa::clp::ALL, isConst(), otawa::clp::NONE, set(), otawa::clp::UMAXn, and otawa::clp::VAL.

Referenced by otawa::clp::State::widening().

void otawa::clp::Value::ge ( intn_t  k)

Filter the current value with signed values greater than k.

Parameters
kThreshold.

References otawa::clp::MAXn, elm::none, and otawa::clp::VAL.

Referenced by otawa::se::applyFilter().

void otawa::clp::Value::geu ( uintn_t  k)

Filter the current value with unsigned values greater than k.

Parameters
kThreshold.

References elm::none, otawa::clp::UMAXn, and otawa::clp::VAL.

Referenced by otawa::se::applyFilter().

void otawa::clp::Value::inter ( const Value val)

Intersection with the current value.

Parameters
valthe value to do the intersection with

References _delta, _lower, _mtimes, elm::abs(), delta, if(), isConst(), isTop(), otawa::clp::lcm(), lower(), elm::max(), elm::min(), otawa::clp::NONE, elm::roundup(), set(), start(), stop(), otawa::clp::umin(), and otawa::clp::VAL.

Referenced by otawa::se::applyFilter().

bool otawa::clp::Value::isTop ( void  ) const
inline
void otawa::clp::Value::join ( const Value val)

Join another set to the current one.

Parameters
valthe value to be joined with

References _delta, _kind, _lower, _mtimes, elm::abs(), otawa::clp::ALL, isConst(), elm::min(), otawa::clp::NONE, set(), start(), otawa::clp::umax(), otawa::clp::UMAXn, and otawa::clp::VAL.

Referenced by otawa::clp::State::join(), and otawa::dcache::CLPBlockBuilder::processBB().

void otawa::clp::Value::le ( intn_t  k)

Filter the current value with signed values lesser than k.

Parameters
kThreshold.

References otawa::clp::MAXn, otawa::clp::MINn, and elm::none.

Referenced by otawa::se::applyFilter().

void otawa::clp::Value::leu ( uintn_t  k)

Filter the current value with unsigned values lesser than k.

Parameters
kThreshold.

References elm::none, and otawa::clp::VAL.

Referenced by otawa::se::applyFilter().

uintn_t otawa::clp::Value::mtimes ( void  ) const
inline
void otawa::clp::Value::ne ( uintn_t  k)
bool otawa::clp::Value::operator!= ( const Value val) const
inline

References elm::operator==().

Value otawa::clp::Value::operator+ ( const Value val) const

References add().

Value otawa::clp::Value::operator- ( const Value val) const

References sub().

Value& otawa::clp::Value::operator= ( const Value val)
inline

References _delta, _kind, _lower, and _mtimes.

bool otawa::clp::Value::operator== ( const Value val) const
inline

References _delta, _kind, _lower, and _mtimes.

bool otawa::clp::Value::operator>= ( const int  val) const
inline
void otawa::clp::Value::print ( io::Output out) const

Print a human representation of the CLP.

Parameters
outthe stream to output the representation

References otawa::clp::ALL, elm::io::hex(), and otawa::clp::NONE.

Referenced by otawa::clp::operator<<().

void otawa::clp::Value::reverse ( void  )

Reverse the CLP direction (swap upper and lower bounds, and use the opposite of delta as new delta).

References set(), and otawa::clp::VAL.

void otawa::clp::Value::set ( kind_t  kind,
intn_t  lower,
intn_t  delta,
uintn_t  mtimes 
)
inline

Set the values for the current object.

Parameters
kindthe kind of the object
lowerthe lower bound of the CLP
deltathe step of the CLP
mtimesthe number of times delta need to be added to get the max bound of the CLP

References delta, and kind.

void otawa::clp::Value::shl ( const Value val)

Left shift the current value.

Parameters
valthe value to shift the current one with. Must be a positive constant.

References _lower, otawa::clp::ALL, isConst(), otawa::clp::NONE, set(), otawa::clp::UMAXn, and otawa::clp::VAL.

void otawa::clp::Value::shr ( const Value val)

Right shift the current value.

Parameters
valthe value to shift the current one with. Must be a positive constant.

References _lower, otawa::clp::ALL, isConst(), otawa::clp::NONE, set(), otawa::clp::UMAXn, and otawa::clp::VAL.

intn_t otawa::clp::Value::start ( void  ) const
inline
Returns
the "start" of the CLP, i.e. the lower bound if delta >= 0, lower + delta * mtimes else.

Referenced by add(), otawa::se::applyFilter(), inter(), join(), and widening().

intn_t otawa::clp::Value::stop ( void  ) const
inline
Returns
the "stop" of the CLP, i.e. the upper bound if delta >= 0, lower else.

Referenced by otawa::se::applyFilter(), inter(), sub(), and widening().

void otawa::clp::Value::sub ( const Value val)

Subtract anothe set to the current one.

Subtract another set to the current one.

Parameters
valthe value to subtract

References _delta, _kind, _lower, _mtimes, elm::abs(), otawa::clp::ALL, delta(), delta, otawa::clp::NONE, otawa::se::reverse(), set(), stop(), otawa::clp::UMAXn, and otawa::clp::VAL.

Referenced by operator-().

bool otawa::clp::Value::swrap ( void  ) const
inline

References elm::abs(), and otawa::clp::MAXn.

Referenced by otawa::se::applyFilter().

intn_t otawa::clp::Value::upper ( void  ) const
inline
bool otawa::clp::Value::uwrap ( void  ) const
inline

References elm::abs(), and otawa::clp::UMAXn.

Referenced by otawa::se::applyFilter().

void otawa::clp::Value::widening ( const Value val)

Perform a widening to the infinite (to be filtred later)

Parameters
valthe value of the next iteration state

References _kind, _lower, elm::abs(), otawa::clp::ALL, delta(), isConst(), otawa::clp::NONE, set(), start(), stop(), and otawa::clp::UMAXn.

Member Data Documentation

intn_t otawa::clp::Value::_delta
private
kind_t otawa::clp::Value::_kind
private
intn_t otawa::clp::Value::_lower
private
uintn_t otawa::clp::Value::_mtimes
private
const Value otawa::clp::Value::all
static
int otawa::clp::Value::and_threshold = 8
static

Find a file of 1 in a word.

Parameters
wWord to process.
nNumber of bits to one.
Returns
True if one is found, false else. Threshold giving the maximum size of a CLP set to apply AND explicitly on the whole set (and rebuilding a new CLP value).
const Value otawa::clp::Value::none
static

Represents the bottom element.

Referenced by otawa::dcache::CLPBlockBuilder::processBB().


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