Polaris: Wildcard Class Reference

Wildcard Class Reference

.all.h - Include all wildcard header files More...

#include <Wildcard.h>

Inheritance diagram for Wildcard:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Wildcard (OP_TYPE optype, const Type &type)
 Class Wildcard.
Boolean matched_exists () const
virtual Expressionmatched () const
virtual Boolean _try_for_match (Expression &other, Boolean consider_side_effects)=0
virtual Expressionclone () const =0
 Return a copy of myself.
virtual Boolean args_are_non_null () const
 Return true if the expression does not have any non-NULL subexpression arguments.
virtual RefList< Expression > * arg_refs () const
 Methods to be specified by derived classes.
virtual void convert (BinRep &, Symtab &)
 Read in the values of my fields and my subexpressions from the given BinRep object.
virtual int structures_OK () const =0
 Return 1 if my structures are in a valid state.
virtual void print_debug (ostream &o, Boolean debug) const =0
 debug indicates whether it should contain extra fields
virtual Expressionmember_ref (const Symbol *)
 If Expression is an identifier with the given name or a multiple thereof, return the Identifier expression.
virtual Boolean is_side_effect_free (void) const
 Return TRUE if expression is side-effect free.
virtual const ExprSignatureupdate_signature ()=0
 Update my signature and return it.
virtual int node_compare (const Expression &ex) const =0
 Assuming that the the two expressions have the same operation and expression type, return either -1, 0, or 1, indicating that the other expression is less than, equal, or greater than myself.

Protected Member Functions

const ExprSignature_wildcard_update_signature ()
virtual Expression_apply_rec (Expression *(*f)(Expression *))
virtual Expression_fold_top (void)
 fold_top Fold all constants at the top level of my expression.
virtual Expression_additive_inverse (void)
virtual Expression_logical_complement (void)
virtual Expression_divides_evenly (const Symbol *)
virtual Expression_divide_by_int (int &)
virtual int _gcd (void) const
virtual Expression_distribute_top (void)
 distribute_top Distribute my arguments if I am a multiply expression.
virtual Expression_combine_rec ()
virtual Expression_combine_top ()
 Methods used for simplification.
virtual Expression_subst_var (const Symbol &, const Expression &)
virtual void _backup_aux ()
 Backs up an expression tree match, resetting matches made by wildcards.
void _clear ()
 Clear any match found.

Protected Attributes

Expression_matched
 This field is NOT live for most subclasses of Wildcard, but is rather simply a pointer to a part of another structure, which may be cloned() and stuck into something else.

Friends

class Expression

Detailed Description

.all.h - Include all wildcard header files

Polaris Base

See also:
Wildcard/Wildcard.all.h

Wildcard/Wildcard.all.h

Description

This header file includes all wildcard header files.
Note:
This file is NOT NECESSARY if the creation functions defined in Wildcard.h are used instead (for instance, the any_expr() function). Therefore, use of this header file is not necessarily recommended.

Definition at line 460 of file Wildcard.h.


Constructor & Destructor Documentation

Wildcard::Wildcard OP_TYPE  optype,
const Type type
 

Class Wildcard.

Definition at line 90 of file Wildcard.cc.

References _matched, and True.


Member Function Documentation

Boolean Wildcard::matched_exists  )  const
 

Definition at line 102 of file Wildcard.cc.

References _matched.

Referenced by do_fold(), do_funny2(), and do_funny2_check().

Expression & Wildcard::matched  )  const [virtual]
 

Definition at line 108 of file Wildcard.cc.

References _matched.

Referenced by do_fold(), do_funny2(), and do_funny2_check().

virtual Boolean Wildcard::_try_for_match Expression other,
Boolean  consider_side_effects
[pure virtual]
 

Implemented in AnyExpr, AnyExprSubset, AnyOfType, AnySuchThat, WildcardAnd, WildcardContains, WildcardNot, and WildcardOr.

Referenced by Expression::_wildcard_is_equal_to().

virtual Expression* Wildcard::clone  )  const [pure virtual]
 

Return a copy of myself.

Implements Expression.

Implemented in AnyExpr, AnyExprSubset, AnyOfSpecificType, AnyOfType, AnySuchThat, WildcardAnd, WildcardContains, WildcardNot, and WildcardOr.

Boolean Wildcard::args_are_non_null  )  const [virtual]
 

Return true if the expression does not have any non-NULL subexpression arguments.

Reimplemented from Expression.

Definition at line 119 of file Wildcard.cc.

References True.

RefList< Expression > * Wildcard::arg_refs  )  const [virtual]
 

Methods to be specified by derived classes.

Reimplemented from Expression.

Definition at line 125 of file Wildcard.cc.

void Wildcard::convert BinRep ,
Symtab
[virtual]
 

Read in the values of my fields and my subexpressions from the given BinRep object.

Convert(BinRep) expects the BinRep to be referencing an expression set of the same type as the expression. On return, all data from the expression set has been inserted into the appropriate fields in the expression object. NOTE that this converts the expression to an intermediate form which may contain TableExpr objects.

Implements Expression.

Definition at line 132 of file Wildcard.cc.

virtual int Wildcard::structures_OK  )  const [pure virtual]
 

Return 1 if my structures are in a valid state.

Implements Expression.

Implemented in AnyExpr, AnyExprSubset, AnyOfType, AnySuchThat, and MultipleArgWildcard.

virtual void Wildcard::print_debug ostream &  o,
Boolean  debug
const [pure virtual]
 

debug indicates whether it should contain extra fields

Implements Expression.

Implemented in AnyExpr, AnyExprSubset, AnyOfSpecificType, AnyOfType, AnySuchThat, WildcardAnd, WildcardContains, WildcardNot, and WildcardOr.

Expression * Wildcard::member_ref const Symbol  )  [virtual]
 

If Expression is an identifier with the given name or a multiple thereof, return the Identifier expression.

Otherwise, return NULL.

Reimplemented from Expression.

Definition at line 138 of file Wildcard.cc.

Boolean Wildcard::is_side_effect_free void   )  const [virtual]
 

Return TRUE if expression is side-effect free.

Reimplemented from Expression.

Definition at line 145 of file Wildcard.cc.

References True.

virtual const ExprSignature& Wildcard::update_signature  )  [pure virtual]
 

Update my signature and return it.

It is assumed that the signatures of my subexpressions are correct. Also call _clear() on all wildcard descendants.

Reimplemented from Expression.

Implemented in AnyExpr, AnyExprSubset, AnyOfType, AnySuchThat, and MultipleArgWildcard.

virtual int Wildcard::node_compare const Expression ex  )  const [pure virtual]
 

Assuming that the the two expressions have the same operation and expression type, return either -1, 0, or 1, indicating that the other expression is less than, equal, or greater than myself.

Reimplemented from Expression.

Implemented in AnyExpr, AnyExprSubset, AnyOfType, AnySuchThat, and MultipleArgWildcard.

const ExprSignature & Wildcard::_wildcard_update_signature  )  [protected]
 

Clear any matches

Now figure out the new signature

Definition at line 954 of file Wildcard.cc.

References _clear(), Expression::_signature_live(), ExprSignature::clear(), ExprSignature::has_wildcard(), ExprSignature::merge(), Expression::op(), Expression::signature(), True, and Expression::type().

Referenced by AnyOfType::update_signature(), AnySuchThat::update_signature(), AnyExprSubset::update_signature(), and AnyExpr::update_signature().

Expression * Wildcard::_apply_rec Expression *(*)(Expression *)  f  )  [protected, virtual]
 

No subexpressions to apply this function to

Definition at line 151 of file Wildcard.cc.

Expression * Wildcard::_fold_top void   )  [protected, virtual]
 

fold_top Fold all constants at the top level of my expression.

Subexpressions are not folded.

Reimplemented from Expression.

Definition at line 158 of file Wildcard.cc.

Expression * Wildcard::_additive_inverse void   )  [protected, virtual]
 

Definition at line 165 of file Wildcard.cc.

Expression * Wildcard::_logical_complement void   )  [protected, virtual]
 

Definition at line 172 of file Wildcard.cc.

Expression * Wildcard::_divides_evenly const Symbol  )  [protected, virtual]
 

Reimplemented from Expression.

Definition at line 179 of file Wildcard.cc.

Expression * Wildcard::_divide_by_int int &   )  [protected, virtual]
 

Reimplemented from Expression.

Definition at line 186 of file Wildcard.cc.

int Wildcard::_gcd void   )  const [protected, virtual]
 

Reimplemented from Expression.

Definition at line 193 of file Wildcard.cc.

Expression * Wildcard::_distribute_top void   )  [protected, virtual]
 

distribute_top Distribute my arguments if I am a multiply expression.

Otherwise do nothing.

Reimplemented from Expression.

Definition at line 200 of file Wildcard.cc.

Expression * Wildcard::_combine_rec  )  [protected, virtual]
 

Definition at line 207 of file Wildcard.cc.

Expression * Wildcard::_combine_top void   )  [protected, virtual]
 

Methods used for simplification.

Subexpressions are not combined. However, I am responsible of assigning value numbers to subexpressions if I need to use them.

Reimplemented from Expression.

Definition at line 214 of file Wildcard.cc.

Expression * Wildcard::_subst_var const Symbol ,
const Expression
[protected, virtual]
 

Definition at line 221 of file Wildcard.cc.

void Wildcard::_backup_aux  )  [protected, virtual]
 

Backs up an expression tree match, resetting matches made by wildcards.

Traverse this expression tree and reset all matches made by wildcards found there (through their overridden _backup_aux() function).

This traversal need only go as far as there are actually wildcards in the braches below (i.e. look at the signature).

Precondition: Signature is correct

Nothing to do for expressions with no children and for non-wildcards

Reimplemented from Expression.

Reimplemented in MultipleArgWildcard.

Definition at line 97 of file Wildcard.cc.

References _clear().

void Wildcard::_clear  )  [inline, protected]
 

Clear any match found.

Definition at line 529 of file Wildcard.h.

References _matched.

Referenced by MultipleArgWildcard::_backup_aux(), _backup_aux(), and _wildcard_update_signature().


Friends And Related Function Documentation

friend class Expression [friend]
 

Definition at line 461 of file Wildcard.h.


Member Data Documentation

Expression* Wildcard::_matched [protected]
 

This field is NOT live for most subclasses of Wildcard, but is rather simply a pointer to a part of another structure, which may be cloned() and stuck into something else.

Definition at line 464 of file Wildcard.h.

Referenced by _clear(), matched(), matched_exists(), and Wildcard().


The documentation for this class was generated from the following files:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:08:40 2005