Otawa
0.10
|
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< Term > | terms |
An expression allows to represent a sum of terms and may be used to represent the value of an aliased variable.
|
inline |
Build an empty expression.
|
inline |
Build an expression by cloning the given one.
expr | Expression to clone. |
Add a term to the expression.
coef | Coefficient of the term. |
var | Variable of the term. |
References otawa::ilp::Alias::expression(), terms, and otawa::ilp::Var::toAlias().
Referenced by otawa::ilp::AbstractConstraint::add(), otawa::ilp::ConstraintImpl::add(), add(), otawa::ilp::AbstractSystem::addObjectFunction(), otawa::ilp::operator+(), otawa::ilp::operator-(), otawa::ilp::ConstraintImpl::sub(), and sub().
|
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.
expr | Expression to add. |
coef | Multiplication coefficient. |
References terms.
void otawa::ilp::Expression::add | ( | const Expression & | e | ) |
void otawa::ilp::Expression::div | ( | coef_t | coef | ) |
Divide all terms of the expression by the given coefficient.
coef | Coefficient to divide with. |
References terms.
double otawa::ilp::Expression::eval | ( | System * | sys | ) |
Evaluate the expression using the variables solution of the given ILP system.
sys | System to look for variable value? |
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.
coef | Coefficient to multiply with. |
References terms.
Subtract a term to the expression.
coef | Coefficient of the term. |
var | Variable of the term. |
Referenced by otawa::ilp::operator-(), otawa::ilp::AbstractConstraint::sub(), and sub().
|
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.
expr | Expression to subtract. |
coef | Multiplication coefficient. |
References add().
void otawa::ilp::Expression::sub | ( | const Expression & | e | ) |
Subtract an expression to an existing expression.
e | Subtracted expression. |
References sub().
|
private |