Otawa  0.10
otawa::ilp::Constraint Class Referenceabstract

This class is used to represent constraints in an ILP system with the following form: More...

#include <otawa/ilp/Constraint.h>

Inheritance diagram for otawa::ilp::Constraint:
otawa::ilp::AbstractConstraint otawa::ilp::ConstraintImpl

Classes

class  TermIterator
 

Public Types

enum  comparator_t {
  UNDEF = -3, LT = -2, LE = -1, EQ = 0,
  GE = 1, GT = 2
}
 
typedef otawa::ilp::Term Term
 
typedef enum
otawa::ilp::Constraint::comparator_t 
comparator_t
 

Public Member Functions

virtual ~Constraint (void)
 
virtual double coefficient (Var *var=0) const =0
 Get the coefficient for the given variable. More...
 
virtual double constant (void) const =0
 
virtual comparator_t comparator (void) const =0
 Get the constraint comparator. More...
 
virtual const stringlabel (void) const =0
 
virtual void add (double coef, Var *var=0)=0
 Add a term to the constraint to the left part of constraint. More...
 
virtual void sub (double coef, Var *var=0)=0
 Substact a factor from the constraint. More...
 
virtual
elm::datastruct::IteratorInst
< Term > * 
terms (void)=0
 
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
 
void add (const Term &t)
 
void sub (const Term &t)
 
void add (const Expression &e)
 void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint. More...
 
void sub (const Expression &e)
 Subtract an expression from the left part of the constraint. More...
 

Detailed Description

This class is used to represent constraints in an ILP system with the following form:

c1*x1 + c2*x2 + ... + cn*xn (=|<|>|<=|>=) k
  • c1, c2, ..., cn are the coefficients of terms.
  • x1, x2, ..., xn are the variables of terms.
  • c1*x1, c2*x2, ..., cn*xn are called the terms.
  • k is the constant part.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
UNDEF 
LT 
LE 
EQ 
GE 
GT 

Constructor & Destructor Documentation

virtual otawa::ilp::Constraint::~Constraint ( void  )
inlinevirtual

Member Function Documentation

void otawa::ilp::Constraint::add ( double  coef,
Var var = 0 
)
pure 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.

Parameters
coefCoefficient of the factor.
varVariable of the factor. When null, modify the constant.

Implemented in otawa::ilp::ConstraintImpl, and otawa::ilp::AbstractConstraint.

Referenced by add(), otawa::ipet::ConstraintLoader::addConstraint(), addLeft(), addRight(), otawa::ilp::cons::operator+(), otawa::ilp::cons::operator+=(), otawa::ilp::cons::operator-(), otawa::ilp::cons::operator-=(), otawa::cat::CATConstraintBuilder::processLBlockSet(), and otawa::ccg::ConstraintBuilder::processLBlockSet().

void otawa::ilp::Constraint::add ( const Term t)
inline

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

Referenced by add().

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

void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint.

Parameters
compComparator to set.
Since
ILP interface 1.2.0 void Constraint::setLabel(const string& label); Change the label of the constraint.
Parameters
labelLabel to set.
Since
ILP interface 1.2.0 Add an expression to the left part of the constraint.
Parameters
eAdded expression.

References add().

double otawa::ilp::Constraint::coefficient ( Var var = 0) const
pure virtual

Get the coefficient for the given variable.

Parameters
varVariable to get the coefficent of. Null variable allows getting the constant part.
Returns
Variable coefficient.

Implemented in otawa::ilp::AbstractConstraint.

Constraint::comparator_t otawa::ilp::Constraint::comparator ( void  ) const
pure virtual
virtual double otawa::ilp::Constraint::constant ( void  ) const
pure virtual
virtual const string& otawa::ilp::Constraint::label ( void  ) const
pure virtual
virtual void otawa::ilp::Constraint::setComparator ( comparator_t  comp)
pure virtual

Referenced by otawa::ilp::cons::set().

virtual void otawa::ilp::Constraint::setLabel ( const string label)
pure virtual
void otawa::ilp::Constraint::sub ( double  coef,
Var var = 0 
)
pure virtual

Substact a factor from the constraint.

Parameters
coefCoefficient of the factor.
varVariable of the factor.

Implemented in otawa::ilp::ConstraintImpl, and otawa::ilp::AbstractConstraint.

Referenced by otawa::ilp::cons::operator+(), otawa::ilp::cons::operator+=(), otawa::ilp::cons::operator-(), otawa::ilp::cons::operator-=(), and sub().

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

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

Referenced by sub().

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

Subtract an expression from the left part of the constraint.

Parameters
eSubtracted expression.

References sub().

virtual elm::datastruct::IteratorInst<Term>* otawa::ilp::Constraint::terms ( void  )
pure virtual

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