expression_inc Class Reference

#include <inc.h>

Inheritance diagram for expression_inc:

expression List of all members.

Public Member Functions

virtual ~expression_inc ()
 expression_inc (const type::pointer &tp, const expression::pointer &lhs, int rhs, const symbol *hint, translator_compile *cntxt)

Protected Member Functions

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

Private Member Functions

 expression_inc ()
 expression_inc (const expression_inc &)
expression_incoperator= (const expression_inc &)

Private Attributes

translator_compilecode
type::pointer tp
expression::pointer lhs
int rhs
const symbolhint

Detailed Description

The expression_inc class is used to represent an INC opcode, which adds a constant number of words to a pointer.

Definition at line 32 of file inc.h.


Constructor & Destructor Documentation

virtual expression_inc::~expression_inc (  )  [virtual]

The destructor.

expression_inc::expression_inc ( const type::pointer tp,
const expression::pointer lhs,
int  rhs,
const symbol hint,
translator_compile cntxt 
)

The constructor.

Parameters:
tp The type of the resulting pointer
lhs The pointer expression to be added to
rhs the number of words to add to the pointer value
hint symbol hint for error messages
cntxt where to send our generated code

expression_inc::expression_inc (  )  [private]

The default constructor.

expression_inc::expression_inc ( const expression_inc  )  [private]

The copy constructor.


Member Function Documentation

void expression_inc::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.

expression::pointer expression_inc::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_inc::logical_traversal ( int  pprec,
label::pointer true_branch,
label::pointer false_branch,
bool  fall_through_preference 
) [protected]

int expression_inc::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.

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

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

Implements expression.

bool expression_inc::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_inc::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.

const symbol* expression_inc::get_symbol_hint (  )  const [protected, virtual]

The get_symbol_hint method is used to get the symbol associated with the expression.

Returns:
pointer to a symbol, or NULL if there is no hint present

Reimplemented from expression.

expression::pointer expression_inc::get_lhs (  )  const [inline, protected]

Definition at line 84 of file inc.h.

References lhs.

int expression_inc::get_rhs (  )  const [inline, protected]

Definition at line 85 of file inc.h.

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

The assignment operator.


Member Data Documentation

translator_compile& expression_inc::code [private]

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

Definition at line 92 of file inc.h.

type::pointer expression_inc::tp [private]

The tp instance variable is used to remember the type of the resulting pointer.

Definition at line 98 of file inc.h.

expression::pointer expression_inc::lhs [private]

The lhs instance variable is used to remember the pointer expression to be added to.

Definition at line 104 of file inc.h.

Referenced by get_lhs().

int expression_inc::rhs [private]

The rhs instance variable is used to remember the number of words to add to the pointer value

Definition at line 110 of file inc.h.

const symbol* expression_inc::hint [private]

The hint instance variable is used to remember a symbol hint for use in error messages.

Definition at line 116 of file inc.h.


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