Otawa  0.10
otawa::se::SECmp Class Reference

Compare symbolic expression This class define three type of compare expression: condition (if): SECmp(operator, expression) undetermined compare: SECmp(CMP, exp1, exp2) determined compare: SECmp(operator, exp1, exp2) More...

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

Inheritance diagram for otawa::se::SECmp:
otawa::se::SymbExpr

Public Member Functions

 SECmp (op_t op, SymbExpr *a=NULL, SymbExpr *b=NULL, SymbExpr *parent=NULL)
 Constructors. More...
 
 SECmp (const SECmp &expr)
 Copy constructor. More...
 
virtual SECmpcopy (void)
 Operators. More...
 
virtual SymbExproperator= (const SECmp &expr)
 Affectation operator. More...
 
virtual bool operator== (const SymbExpr &expr) const
 Not equal operator. More...
 
virtual String asString (const hard::Platform *pf=0)
 Operation. More...
 
virtual void canonize (void)
 Try to recursively transform the expression into it its canonized form. More...
 
SECmplogicalNot (void)
 
bool operator!= (const SymbExpr &expr) const
 Not equal operator. More...
 
op_t op (void) const
 Accessors. More...
 
SymbExpra (void) const
 
SymbExprb (void) const
 
V val (void) const
 
SymbExprparent (void) const
 
void replace (SymbExpr *searched_se, SymbExpr *new_se)
 Operation. More...
 
void print (io::Output &out, const hard::Platform *pf=0)
 Output a string representation of the expression. More...
 
virtual Vector< Vused_reg (void)
 Return the list of registers used (recursively) in this expression. More...
 
virtual Vector< Vused_addr (void)
 Return the list of memory addresses used (recursively) in this expression. More...
 
void set_a (SymbExpr *a)
 Setters. More...
 
void set_b (SymbExpr *b)
 Set the second child expression (b) More...
 
void set_parent (SymbExpr *parent)
 Set the reference to the parent of this. More...
 

Protected Attributes

op_t _op
 Attributes. More...
 
SymbExpr_a
 
SymbExpr_b
 
V _val
 
SymbExpr_parent
 

Detailed Description

Compare symbolic expression This class define three type of compare expression: condition (if): SECmp(operator, expression) undetermined compare: SECmp(CMP, exp1, exp2) determined compare: SECmp(operator, exp1, exp2)

Constructor & Destructor Documentation

otawa::se::SECmp::SECmp ( op_t  op,
SymbExpr a = NULL,
SymbExpr b = NULL,
SymbExpr parent = NULL 
)
inline

Constructors.

Build a new Addition Symbolic Expression]

Parameters
ais a pointer to the first child expression. This pointer will be used as is (no copy), so make sure you 'new' or '->copy()' the expression before.
bis a pointer to the second child expression. This pointer will be used as is (no copy), so make sure you 'new' or '->copy()' the expression before.
parenta pointer to the parent

This class can reprensts three forms of expressions: (oplog is in [LE, LT, GE, GT, EQ, NE])

  • [oplog a] for a condition (sem instr 'if')
  • [CMP a b] for an undetermined compare (sem instr 'cmp')
  • [oplog a b] for a determined compare (result of canonize)

Referenced by copy().

otawa::se::SECmp::SECmp ( const SECmp expr)
inline

Copy constructor.

Parameters
exprthe expression to copy

Member Function Documentation

SymbExpr* otawa::se::SymbExpr::a ( void  ) const
inlineinherited
String otawa::se::SECmp::asString ( const hard::Platform pf = 0)
virtual
SymbExpr* otawa::se::SymbExpr::b ( void  ) const
inlineinherited
void otawa::se::SECmp::canonize ( void  )
virtual

Try to recursively transform the expression into it its canonized form.

Reimplemented from otawa::se::SymbExpr.

Referenced by otawa::se::getFilterForAddr(), otawa::se::getFilterForReg(), and otawa::se::FilterBuilder::makeFilters().

SECmp * otawa::se::SECmp::copy ( void  )
virtual

Operators.

Copy operator

Returns
a pointer to a copy of this

Reimplemented from otawa::se::SymbExpr.

References otawa::se::SymbExpr::_a, otawa::se::SymbExpr::_b, otawa::se::SymbExpr::_op, otawa::se::SymbExpr::copy(), and SECmp().

Referenced by otawa::se::FilterBuilder::makeFilters().

SECmp * otawa::se::SECmp::logicalNot ( void  )
bool otawa::se::SymbExpr::operator!= ( const SymbExpr expr) const
inherited

Not equal operator.

Parameters
exprthe expression to be compared with this
Returns
if the expression doesn't reprensents the same as expr

References otawa::se::SymbExpr::operator==().

SymbExpr & otawa::se::SECmp::operator= ( const SECmp expr)
virtual

Affectation operator.

Parameters
exprthe expression to be copied in this
Returns
this

References otawa::se::SymbExpr::_a, otawa::se::SymbExpr::_b, otawa::se::SymbExpr::_op, otawa::se::SymbExpr::set_a(), and otawa::se::SymbExpr::set_b().

bool otawa::se::SECmp::operator== ( const SymbExpr expr) const
virtual

Not equal operator.

Parameters
exprthe expression to be compared with this
Returns
if the expression doesn't reprensents the same as expr

Reimplemented from otawa::se::SymbExpr.

References otawa::se::SymbExpr::_a, otawa::se::SymbExpr::_b, otawa::se::SymbExpr::_op, otawa::se::SymbExpr::a(), otawa::se::SymbExpr::b(), and otawa::se::SymbExpr::op().

SymbExpr* otawa::se::SymbExpr::parent ( void  ) const
inlineinherited
Returns
a pointer to the parent of this (or NULL)
void otawa::se::SymbExpr::print ( io::Output out,
const hard::Platform pf = 0 
)
inherited

Output a string representation of the expression.

Parameters
outthe output channel
pfcurrent plarform

References otawa::se::SymbExpr::asString().

Referenced by otawa::se::FilterBuilder::makeFilters(), and operator<<().

void otawa::se::SymbExpr::replace ( SymbExpr searched_se,
SymbExpr new_se 
)
inherited

Operation.

Recursively replace in this the searched_se expression by new_se

Parameters
searched_sethe researched expression
new_sethe expression that will replace searched_se

new_se will be copied each time it replace a searched_se.

References otawa::se::SymbExpr::_a, otawa::se::SymbExpr::_b, otawa::se::SymbExpr::replace(), otawa::se::SymbExpr::set_a(), and otawa::se::SymbExpr::set_b().

Referenced by otawa::se::getFilterForAddr(), otawa::se::getFilterForReg(), otawa::se::FilterBuilder::makeFilters(), and otawa::se::SymbExpr::replace().

void otawa::se::SymbExpr::set_a ( SymbExpr a)
inlineinherited

Setters.

Set the first child expression (a)

Parameters
aa pointer to the new first child

A copy of a will be set as first child. If there was a first child in this expression, it will be delete, but after the copy of a (so it's safe to set_a() a child expression of this->a()).

References otawa::se::SymbExpr::copy(), and otawa::se::SymbExpr::set_parent().

Referenced by otawa::se::SENeg::canonize(), otawa::se::SEAdd::canonize(), otawa::se::SymbExpr::operator=(), otawa::se::SENeg::operator=(), otawa::se::SEAdd::operator=(), operator=(), and otawa::se::SymbExpr::replace().

void otawa::se::SymbExpr::set_b ( SymbExpr b)
inlineinherited

Set the second child expression (b)

Parameters
ba pointer to the new second child

A copy of b will be set as second child. If there was a second child in this expression, it will be delete, but after the copy of b (so it's safe to set_b() a child expression of this->b()).

References otawa::se::SymbExpr::copy(), and otawa::se::SymbExpr::set_parent().

Referenced by otawa::se::SENeg::canonize(), otawa::se::SEAdd::canonize(), otawa::se::SymbExpr::operator=(), otawa::se::SEAdd::operator=(), operator=(), and otawa::se::SymbExpr::replace().

void otawa::se::SymbExpr::set_parent ( SymbExpr parent)
inlineinherited

Set the reference to the parent of this.

Parameters
parenta pointer to the new parent.

Warning: this do not remove the reference to this in the old parent.

Referenced by otawa::se::SymbExpr::set_a(), and otawa::se::SymbExpr::set_b().

Vector< V > otawa::se::SymbExpr::used_addr ( void  )
virtualinherited
Vector< V > otawa::se::SymbExpr::used_reg ( void  )
virtualinherited
V otawa::se::SymbExpr::val ( void  ) const
inlineinherited

Member Data Documentation

SymbExpr* otawa::se::SymbExpr::_parent
protectedinherited

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