Otawa  0.10
otawa::ilp::Alias Class Reference

An alias is a specific variable that represents an expressions. More...

#include <otawa/ilp/Var.h>

Inheritance diagram for otawa::ilp::Alias:
otawa::ilp::Var

Public Types

enum  type_t { NO_TYPE = 0, INT = 1, BIN = 2, FLOAT = 3 }
 Type of an ILP variable. More...
 

Public Member Functions

 Alias (Expression *expr)
 Build an anonymous alias variable. More...
 
 Alias (string name, Expression *expr)
 Build a named alias variable. More...
 
virtual ~Alias (void)
 
virtual AliastoAlias (void)
 If the variable is an alias, return it. More...
 
virtual double eval (System *sys)
 Evaluate the variable in the given system. More...
 
const Expressionexpression (void) const
 
const stringname (void) const
 Get the name of the variable if any. More...
 
type_t type (void) const
 Get the type of the variable. More...
 
virtual void print (io::Output &out)
 Print the name of the variable. More...
 

Private Attributes

Expression_expr
 

Detailed Description

An alias is a specific variable that represents an expressions.

This allows to reduce the number of true variable and to replace any variable by any possible expression.

Member Enumeration Documentation

enum otawa::ilp::Var::type_t
inherited

Type of an ILP variable.

Enumerator
NO_TYPE 

Null value for ILP variable type.

INT 

Integer (default) type for ILP variable.

BIN 

Binary type (0 or 1) for ILP variable.

FLOAT 

Real type for ILP variable.

Constructor & Destructor Documentation

otawa::ilp::Alias::Alias ( Expression expr)

Build an anonymous alias variable.

Parameters
exprExpression of the alias (this object is responsible for freeing it).
otawa::ilp::Alias::Alias ( string  name,
Expression expr 
)

Build a named alias variable.

Parameters
nameName of the variable.
exprExpression of the alias (this object is responsible for freeing it).
otawa::ilp::Alias::~Alias ( void  )
virtual

References _expr.

Member Function Documentation

double otawa::ilp::Alias::eval ( System sys)
virtual

Evaluate the variable in the given system.

Parameters
sysResolved system to look in.
Returns
Value of the variable.

Reimplemented from otawa::ilp::Var.

References _expr, and otawa::ilp::Expression::eval().

const Expression* otawa::ilp::Alias::expression ( void  ) const
inline
String & otawa::ilp::Var::name ( void  ) const
inlineinherited

Get the name of the variable if any.

Return an empty string if there is none.

Returns
Variable name.

Referenced by otawa::tsim::BBPath::makeVarName(), otawa::display::ILPSystemDisplayer::nameOf(), and otawa::ilp::operator<<().

void otawa::ilp::Var::print ( io::Output out)
virtualinherited

Print the name of the variable.

Parameters
outOutput to use.

References otawa::ilp::Var::_name.

Referenced by otawa::ilp::operator<<().

Alias * otawa::ilp::Alias::toAlias ( void  )
virtual

If the variable is an alias, return it.

Returns
Alias object if it is alias, null else.

Reimplemented from otawa::ilp::Var.

type_t otawa::ilp::Var::type ( void  ) const
inlineinherited

Get the type of the variable.

Returns
Variable type.

Member Data Documentation

Expression* otawa::ilp::Alias::_expr
private

Referenced by eval(), and ~Alias().


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