Otawa  0.10
otawa::ilp::Expression Class Reference

An expression allows to represent a sum of terms and may be used to represent the value of an aliased variable. More...

#include <otawa/ilp/Expression.h>

Classes

class  Iterator
 

Public Member Functions

 Expression (void)
 Build an empty expression. More...
 
 Expression (const Expression *expr)
 Build an expression by cloning the given one. More...
 
void add (coef_t coef, ilp::Var *var=0)
 Add a term to the expression. More...
 
void sub (coef_t coef, ilp::Var *var=0)
 Subtract a term to the expression. More...
 
void add (const Term &t)
 
void sub (const Term &t)
 
void add (const Expression *expr, coef_t coef=1)
 Perform the addition to the current expression of the given expression multiplied by the coefficient. More...
 
void sub (const Expression *expr, coef_t coef=1)
 Perform the subtraction from the current expression of the given expression multiplied by the coefficient. More...
 
void mul (coef_t coef)
 Multiply all terms of the expression by the given coefficient. More...
 
void div (coef_t coef)
 Divide all terms of the expression by the given coefficient. More...
 
void add (const Expression &e)
 Add an expression to an existing expression. More...
 
void sub (const Expression &e)
 Subtract an expression to an existing expression. More...
 
double eval (System *sys)
 Evaluate the expression using the variables solution of the given ILP system. More...
 

Private Attributes

genstruct::SLList< Termterms
 

Detailed Description

An expression allows to represent a sum of terms and may be used to represent the value of an aliased variable.

Constructor & Destructor Documentation

otawa::ilp::Expression::Expression ( void  )
inline

Build an empty expression.

otawa::ilp::Expression::Expression ( const Expression expr)
inline

Build an expression by cloning the given one.

Parameters
exprExpression to clone.

Member Function Documentation

void otawa::ilp::Expression::add ( coef_t  coef,
ilp::Var var = 0 
)
void otawa::ilp::Expression::add ( const Term t)
inline

References add(), otawa::ilp::Term::fst, and otawa::ilp::Term::snd.

Referenced by add().

void otawa::ilp::Expression::add ( const Expression expr,
coef_t  coef = 1 
)

Perform the addition to the current expression of the given expression multiplied by the coefficient.

Parameters
exprExpression to add.
coefMultiplication coefficient.

References terms.

void otawa::ilp::Expression::add ( const Expression e)

Add an expression to an existing expression.

Parameters
eAdded expression.

References add().

void otawa::ilp::Expression::div ( coef_t  coef)

Divide all terms of the expression by the given coefficient.

Parameters
coefCoefficient to divide with.

References terms.

double otawa::ilp::Expression::eval ( System sys)

Evaluate the expression using the variables solution of the given ILP system.

Parameters
sysSystem to look for variable value?
Returns
Value of the expression in the system.

References otawa::ilp::System::valueOf().

Referenced by otawa::ilp::Alias::eval().

void otawa::ilp::Expression::mul ( coef_t  coef)

Multiply all terms of the expression by the given coefficient.

Parameters
coefCoefficient to multiply with.

References terms.

void otawa::ilp::Expression::sub ( coef_t  coef,
ilp::Var var = 0 
)
inline

Subtract a term to the expression.

Parameters
coefCoefficient of the term.
varVariable of the term.

Referenced by otawa::ilp::operator-(), otawa::ilp::AbstractConstraint::sub(), and sub().

void otawa::ilp::Expression::sub ( const Term t)
inline

References otawa::ilp::Term::fst, otawa::ilp::Term::snd, and sub().

Referenced by sub().

void otawa::ilp::Expression::sub ( const Expression expr,
coef_t  coef = 1 
)

Perform the subtraction from the current expression of the given expression multiplied by the coefficient.

Parameters
exprExpression to subtract.
coefMultiplication coefficient.

References add().

void otawa::ilp::Expression::sub ( const Expression e)

Subtract an expression to an existing expression.

Parameters
eSubtracted expression.

References sub().

Member Data Documentation

genstruct::SLList<Term> otawa::ilp::Expression::terms
private

Referenced by add(), div(), and mul().


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