Otawa  0.10
otawa::ilp::Var Class Reference

A variable is an identifier used for performing ILP computation. More...

#include <otawa/ilp/Var.h>

Inheritance diagram for otawa::ilp::Var:
otawa::ilp::AbstractSystem::AbstractVar otawa::ilp::Alias otawa::ilp::VarImpl

Public Types

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

Public Member Functions

virtual ~Var (void)
 
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...
 
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...
 

Protected Member Functions

 Var (type_t type=INT)
 Build an anonymous variable. More...
 
 Var (cstring name, type_t type=INT)
 
 Var (const string &name, type_t type=INT)
 Build a variable with the given name. More...
 

Private Attributes

string _name
 
type_t _type
 

Detailed Description

A variable is an identifier used for performing ILP computation.

A variable may named or not and may inserted as any property. Have just a thought about releasing it.

Member Enumeration Documentation

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::Var::~Var ( void  )
virtual
otawa::ilp::Var::Var ( type_t  type = INT)
inlineprotected

Build an anonymous variable.

Parameters
typeType of the variable (default INT).
otawa::ilp::Var::Var ( cstring  name,
type_t  type = INT 
)
inlineprotected
otawa::ilp::Var::Var ( const string name,
type_t  type = INT 
)
inlineprotected

Build a variable with the given name.

Parameters
nameName of the variable.
typeType of the variable (default INT).

Member Function Documentation

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

Evaluate the variable in the given system.

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

Reimplemented in otawa::ilp::Alias.

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

String & otawa::ilp::Var::name ( void  ) const
inline

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)
virtual

Print the name of the variable.

Parameters
outOutput to use.

References _name.

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

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

If the variable is an alias, return it.

Returns
Alias object if it is alias, null else.

Reimplemented in otawa::ilp::Alias.

Referenced by otawa::ilp::Expression::add().

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

Get the type of the variable.

Returns
Variable type.

Member Data Documentation

string otawa::ilp::Var::_name
private

Referenced by print().

type_t otawa::ilp::Var::_type
private

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