expression_ixp Class Reference

#include <ixp.h>

Inheritance diagram for expression_ixp:

expression List of all members.

Public Member Functions

virtual ~expression_ixp ()
 expression_ixp (const expression::pointer &lhs, const expression::pointer &rhs, translator_compile *cntxt)

Protected Member Functions

type::pointer get_type () const
expression::pointer optimize () const
void traversal (int pprec)
void logical_traversal (int pprec, label::pointer &true_branch, label::pointer &false_branch, bool fall_through_preference)
int get_precedence () const
bool is_lvalue () const
side_effect_t has_side_effect () const

Private Member Functions

 expression_ixp ()
 expression_ixp (const expression_ixp &)
expression_ixpoperator= (const expression_ixp &)

Private Attributes

translator_compilecode
expression::pointer lhs
expression::pointer rhs
type::pointer tp

Detailed Description

The expression_ixp class is used to represent an expression which indexes a packed array.

Definition at line 32 of file ixp.h.


Constructor & Destructor Documentation

virtual expression_ixp::~expression_ixp (  )  [virtual]

The destructor.

expression_ixp::expression_ixp ( const expression::pointer lhs,
const expression::pointer rhs,
translator_compile cntxt 
)

The constructor.

Parameters:
lhs The left hand side of the array index, the pointer to the array itself. This is an unpacked pointer.
rhs The right hand side of the array index, the element number. It has already been range checked, and had the lower bound subtracted if necessary.
cntxt Where to send our generated code.

expression_ixp::expression_ixp (  )  [private]

The default constructor. Do not use.

expression_ixp::expression_ixp ( const expression_ixp  )  [private]

The copy constructor. Do not use.


Member Function Documentation

type::pointer expression_ixp::get_type (  )  const [protected, virtual]

The get_type method is used to get the type of this expression.

Implements expression.

expression::pointer expression_ixp::optimize (  )  const [protected, virtual]

The optimize method may be used to evaluate constant expressions, or substitute more efficient expressions.

This is intended to be called by the translator:: expression_statement method, or similar, where the expression is in its final form, and will get no deeper. In other words, when all available information has been provided.

There is no default implementation, even though most optimize implementations return self(), because this gives the compiler no opportunity to remind the authors of new classes that they have forgotten something.

Returns:
If the expression tree is not constant, or it is already as reduced as it can get, it returns itself. Otherwise, it returns a new expression node.

Implements expression.

void expression_ixp::traversal ( int  pprec  )  [protected, virtual]

The traversal method may be used to traverse each of the declaractions in the list.

Parameters:
pprec The precedence of the parent expression node.

Implements expression.

void expression_ixp::logical_traversal ( int  pprec,
label::pointer true_branch,
label::pointer false_branch,
bool  fall_through_preference 
) [protected]

int expression_ixp::get_precedence (  )  const [protected, virtual]

The get_precedence method is used to obtain the precedence of this expression node.

The highest precedence has the highest absolute value, the lowest precedence gets the lowest absolute value.

Implements expression.

bool expression_ixp::is_lvalue (  )  const [protected, virtual]

The is_lvalue method is used to determine whether or not this expression is suitable to appear on the left hand side of an assignment expression.

Implements expression.

side_effect_t expression_ixp::has_side_effect (  )  const [protected, virtual]

The has_side_effect method is used to determine if an expression has any effect. It is used by the parse to produce "statement with no effect" warnings.

Implements expression.

expression_ixp& expression_ixp::operator= ( const expression_ixp  )  [private]

The assignment operator. Do not use.


Member Data Documentation

translator_compile& expression_ixp::code [private]

The code instance variable is used to remember where to send our generated code.

Definition at line 85 of file ixp.h.

expression::pointer expression_ixp::lhs [private]

The lhs instance variable is used to remember the left hand expression, the array's base address.

Definition at line 91 of file ixp.h.

expression::pointer expression_ixp::rhs [private]

The rhs instance variable is used to remember the right hand expression, the array member of interest (zero based).

Definition at line 97 of file ixp.h.

type::pointer expression_ixp::tp [private]

The tp instance variable is used to remember the type of the value of this expression node. This is mostly an optimization.

Definition at line 103 of file ixp.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 25 01:27:12 2007 for UCSDp-SystemCrossCompiler by  doxygen 1.5.1