expression_address Class Reference

#include <address.h>

Inheritance diagram for expression_address:

expression expression_address_global expression_address_intermediate expression_address_local List of all members.

Public Member Functions

virtual ~expression_address ()
 expression_address (const location &locn, unsigned offset, const type::pointer &type)
virtual expression::pointer fast_load () const=0
virtual expression::pointer fast_store (const expression::pointer &rhs) const=0
virtual expression::pointer advance_by_words (long nwords, const type::pointer &new_type, const symbol *new_hint) const=0

Protected Member Functions

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

Private Member Functions

 expression_address ()
 expression_address (const expression_address &)
expression_addressoperator= (const expression_address &)

Private Attributes

unsigned offset
type::pointer type

Detailed Description

The expression_address class is used to represent an abstract address constant.

Definition at line 30 of file address.h.


Constructor & Destructor Documentation

virtual expression_address::~expression_address (  )  [virtual]

The destructor.

expression_address::expression_address ( const location locn,
unsigned  offset,
const type::pointer type 
)

The constructor.

expression_address::expression_address (  )  [private]

The default constructor. Do not use.

expression_address::expression_address ( const expression_address  )  [private]

The copy constructor. Do not use.


Member Function Documentation

virtual expression::pointer expression_address::fast_load (  )  const [pure virtual]

The fast_load method is used by the expression_load_indirect::optimize method to produce smaller code, if possible.

Note:
It is tempting to use a default implementation which returns self(), however this prevents the compiler from telling us we missed something.

Implemented in expression_address_global, expression_address_intermediate, and expression_address_local.

virtual expression::pointer expression_address::fast_store ( const expression::pointer rhs  )  const [pure virtual]

The fast_store method is used by the expression_store_indirect::optimize method to produce smaller code, if possible.

Parameters:
rhs The value to be stored.
Note:
It is tempting to use a default implementation which returns self(), however this prevents the compiler from telling us we missed something.

Implemented in expression_address_global, expression_address_intermediate, and expression_address_local.

virtual expression::pointer expression_address::advance_by_words ( long  nwords,
const type::pointer new_type,
const symbol new_hint 
) const [pure virtual]

The advance_by_words method is used to create a new pointer constant from an old one, with the offset advanced by the given number of words.

Parameters:
nwords The number of words to advance.
new_type the new type of pointer, because usually the original is a record pointer, and the new one is a member pointer (i.e. not the same type).
new_hint New hit to attach to the new pointer node
Returns:
a new expression node.

Implemented in expression_address_global, expression_address_intermediate, and expression_address_local.

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

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

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

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

Implements expression.

bool expression_address::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_address::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::pointer expression_address::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.

unsigned expression_address::get_offset (  )  const [inline, protected]

The get_offset method is used to obtain the offset (in 16-bit words, zero based) from the base address represented by this expression node.

Definition at line 117 of file address.h.

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

The assignment operator. Do not use.


Member Data Documentation

unsigned expression_address::offset [private]

The offset instance variable is used to remember the offset from the base, in words. Zero based.

Definition at line 124 of file address.h.

type::pointer expression_address::type [private]

The type instance variable is used to remember the type of this pointer expression node.

Definition at line 130 of file address.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