Otawa
0.10
|
Provide a simple implementation of a constraint using expression. More...
#include <otawa/ilp/impl.h>
Public Types | |
enum | comparator_t { UNDEF = -3, LT = -2, LE = -1, EQ = 0, GE = 1, GT = 2 } |
typedef enum otawa::ilp::Constraint::comparator_t | comparator_t |
typedef otawa::ilp::Term | Term |
Public Member Functions | |
ConstraintImpl (comparator_t comparator, string label="") | |
Build an empty constraint. More... | |
virtual double | coefficient (Var *var) |
virtual double | constant (void) const |
virtual comparator_t | comparator (void) const |
Get the constraint comparator. More... | |
virtual const string & | label (void) const |
virtual void | add (double coef, Var *var) |
Add a term to the constraint to the left part of constraint. More... | |
virtual void | sub (double coef, Var *var) |
Substact a factor from the constraint. More... | |
virtual elm::datastruct::IteratorInst < Term > * | terms (void) |
virtual double | coefficient (Var *var=0) const =0 |
Get the coefficient for the given variable. More... | |
void | add (const Term &t) |
void | add (const Expression &e) |
void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint. More... | |
void | sub (const Term &t) |
void | sub (const Expression &e) |
Subtract an expression from the left part of the constraint. More... | |
void | addLeft (double coef, Var *var=0) |
Add a factor on the left side. More... | |
void | addRight (double coef, Var *var=0) |
Add a factor on the right side. More... | |
virtual void | setComparator (comparator_t comp)=0 |
virtual void | setLabel (const string &label)=0 |
Private Attributes | |
Expression | expr |
comparator_t | comp |
string | lab |
Provide a simple implementation of a constraint using expression.
The stored expression e states only that: e {=|<|>|<=|>=} 0. It is relatively easy to push back the constant to the right of the constraint.
|
inherited |
|
inherited |
|
inherited |
otawa::ilp::ConstraintImpl::ConstraintImpl | ( | comparator_t | comparator, |
string | label = "" |
||
) |
Build an empty constraint.
comparator | Comparator to use. |
label | Label of the constraint. |
|
virtual |
Add a term to the constraint to the left part of constraint.
If var is null, sum the coefficient to the right part of the constraint.
coef | Coefficient of the factor. |
var | Variable of the factor. When null, modify the constant. |
Implements otawa::ilp::Constraint.
References otawa::ilp::Expression::add(), and expr.
|
inlineinherited |
References otawa::ilp::Constraint::add(), otawa::ilp::Term::fst, and otawa::ilp::Term::snd.
Referenced by otawa::ilp::Constraint::add().
|
inherited |
void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint.
comp | Comparator to set. |
label | Label to set. |
e | Added expression. |
References otawa::ilp::Constraint::add().
|
inlineinherited |
Add a factor on the left side.
coef | Coefficient of the factor. |
var | Variable of the factor. |
References otawa::ilp::Constraint::add().
Referenced by otawa::ccg::ConstraintBuilder::addConstraintHeader(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::etime::StandardEventBuilder::handleVariableBranchPred(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::ipet::FlowFactConstraintBuilder::processBB(), otawa::tsim::Delta::processBBPath(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::CAT2OnlyConstraintBuilder::processWorkSpace(), and otawa::dcache::CatConstraintBuilder::processWorkSpace().
|
inlineinherited |
Add a factor on the right side.
coef | Coefficient of the factor. |
var | Variable of the factor. |
References otawa::ilp::Constraint::add().
Referenced by otawa::ccg::ConstraintBuilder::addConstraintHeader(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::etime::StandardEventBuilder::handleVariableBranchPred(), otawa::etime::EventCollector::make(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::ipet::FlowFactConstraintBuilder::processBB(), otawa::tsim::Delta::processBBPath(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::CAT2OnlyConstraintBuilder::processWorkSpace(), and otawa::dcache::CatConstraintBuilder::processWorkSpace().
|
pure virtualinherited |
Get the coefficient for the given variable.
var | Variable to get the coefficent of. Null variable allows getting the constant part. |
Implemented in otawa::ilp::AbstractConstraint.
|
virtual |
Get the constraint comparator.
Implements otawa::ilp::Constraint.
References comp.
|
virtual |
Implements otawa::ilp::Constraint.
References expr.
|
virtual |
Implements otawa::ilp::Constraint.
References lab.
|
pure virtualinherited |
Referenced by otawa::ilp::cons::set().
|
pure virtualinherited |
Implemented in otawa::ilp::AbstractConstraint.
Referenced by otawa::ilp::model::operator()().
|
virtual |
Substact a factor from the constraint.
coef | Coefficient of the factor. |
var | Variable of the factor. |
Implements otawa::ilp::Constraint.
References otawa::ilp::Expression::add(), and expr.
|
inlineinherited |
References otawa::ilp::Term::fst, otawa::ilp::Term::snd, and otawa::ilp::Constraint::sub().
Referenced by otawa::ilp::Constraint::sub().
|
inherited |
Subtract an expression from the left part of the constraint.
e | Subtracted expression. |
References otawa::ilp::Constraint::sub().
|
virtual |
Implements otawa::ilp::Constraint.
References expr.
|
private |
Referenced by comparator().
|
private |
Referenced by add(), coefficient(), constant(), sub(), and terms().