Otawa  0.10
otawa::se::SymbExpr Class Reference

Symbolic expression. More...

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

Inheritance diagram for otawa::se::SymbExpr:
otawa::se::SEAdd otawa::se::SEAddr otawa::se::SECmp otawa::se::SEConst otawa::se::SENeg otawa::se::SEReg

Public Member Functions

 SymbExpr (op_t op=NONE, SymbExpr *a=NULL, SymbExpr *b=NULL, V val=0, SymbExpr *parent=NULL)
 Constructor and destructor. More...
 
 SymbExpr (const SymbExpr &expr)
 Copy constructor. More...
 
virtual ~SymbExpr ()
 Destructor of a symbolic expression This recursively delete a and b childs, and set to NULL the reference of this in the parent (if any). More...
 
virtual SymbExprcopy (void)
 Operators. More...
 
virtual SymbExproperator= (const SymbExpr &expr)
 Affectation operator. More...
 
virtual bool operator== (const SymbExpr &expr) const
 Equality. More...
 
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...
 
virtual String asString (const hard::Platform *pf=0)
 
void print (io::Output &out, const hard::Platform *pf=0)
 Output a string representation of the expression. More...
 
virtual void canonize (void)
 Try to recursively transform the expression into it its canonized form. 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

Symbolic expression.

Constructor & Destructor Documentation

otawa::se::SymbExpr::SymbExpr ( op_t  op = NONE,
SymbExpr a = NULL,
SymbExpr b = NULL,
V  val = 0,
SymbExpr parent = NULL 
)
inline

Constructor and destructor.

Build a new symbolic expression You shoul instaciate childs instead of this expression

References otawa::se::NONE, and otawa::se::OR.

Referenced by copy().

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

Copy constructor.

Parameters
exprthe expression to copy

References _a, _b, otawa::se::NONE, and otawa::se::OR.

virtual otawa::se::SymbExpr::~SymbExpr ( )
inlinevirtual

Destructor of a symbolic expression This recursively delete a and b childs, and set to NULL the reference of this in the parent (if any).

Member Function Documentation

String otawa::se::SymbExpr::asString ( const hard::Platform pf = 0)
virtual
Returns
a string reprensentation of the expression

Reimplemented in otawa::se::SECmp, otawa::se::SEAdd, otawa::se::SENeg, otawa::se::SEReg, otawa::se::SEAddr, and otawa::se::SEConst.

Referenced by otawa::se::SENeg::asString(), otawa::se::SEAdd::asString(), and print().

SymbExpr* otawa::se::SymbExpr::b ( void  ) const
inline
void otawa::se::SymbExpr::canonize ( void  )
virtual

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

Reimplemented in otawa::se::SECmp, otawa::se::SEAdd, otawa::se::SENeg, otawa::se::SEReg, otawa::se::SEAddr, and otawa::se::SEConst.

References _a, _b, and canonize().

Referenced by canonize(), otawa::se::SENeg::canonize(), and otawa::se::SEAdd::canonize().

SymbExpr * otawa::se::SymbExpr::copy ( void  )
virtual
bool otawa::se::SymbExpr::operator!= ( const SymbExpr expr) const

Not equal operator.

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

References operator==().

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

Affectation operator.

Parameters
exprthe expression to be copied in this
Returns
this

References _a, _b, _op, _val, set_a(), and set_b().

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

Equality.

Parameters
exprthe expression to be compared with this
Returns
if the expression reprensents the same as expr (recursively)

Reimplemented in otawa::se::SECmp, otawa::se::SEAdd, otawa::se::SENeg, otawa::se::SEReg, otawa::se::SEAddr, and otawa::se::SEConst.

References _op.

Referenced by operator!=().

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

Output a string representation of the expression.

Parameters
outthe output channel
pfcurrent plarform

References asString().

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

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

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 _a, _b, replace(), set_a(), and set_b().

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

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

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 copy(), and set_parent().

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

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

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 copy(), and set_parent().

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

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

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 set_a(), and set_b().

Vector< V > otawa::se::SymbExpr::used_addr ( void  )
virtual

Return the list of memory addresses used (recursively) in this expression.

Returns
a vector of int.

Reimplemented in otawa::se::SEAddr.

References _a, _b, elm::genstruct::Vector< T >::add(), elm::genstruct::Vector< T >::contains(), elm::genstruct::Vector< T >::length(), and used_addr().

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

Vector< V > otawa::se::SymbExpr::used_reg ( void  )
virtual

Return the list of registers used (recursively) in this expression.

Returns
a vector of int.

Reimplemented in otawa::se::SEReg.

References _a, _b, elm::genstruct::Vector< T >::add(), elm::genstruct::Vector< T >::contains(), elm::genstruct::Vector< T >::length(), and used_reg().

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

Member Data Documentation

SymbExpr* otawa::se::SymbExpr::_parent
protected

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