Polaris: _find_info Class Reference

_find_info Class Reference

For NonBinaryExpr's, we need to do a little bit more than just checking all the arguments for equality. More...

List of all members.

Public Types

enum  SET_UP_RESULT {
  ONE_MATCH,
  NO_MATCHES,
  ZERO_OR_MORE_MATCHES
}

Public Member Functions

 _find_info (Boolean consider_side_effects)
 ~_find_info ()
Boolean find_match (NonBinaryExpr &nonbin, Expression &pattern)

Public Attributes

Boolean first_time
Boolean could_have_more_matches
int num_mismatches
Boolean consider_side_effects
RefList< Expressionmismatches
RefList< Expressionwild_args
Iterator< Expression > * nonbin_iter
Iterator< Expression > * wild_iter
Permutationp
int leftmost_matched_pairs
 ...


Detailed Description

For NonBinaryExpr's, we need to do a little bit more than just checking all the arguments for equality.

Since assigning a value number to a NonBinaryExpr with a commutative operator type includes reordering the arguments based on their value numbers, we have to do a little extra checking if wildcards are included in the Expression 'e', since this will mess up the neat one-to-one mapping of arguments that value numbering tries to create.

Definition at line 7779 of file Expression.cc.


Member Enumeration Documentation

enum _find_info::SET_UP_RESULT
 

Enumeration values:
ONE_MATCH 
NO_MATCHES 
ZERO_OR_MORE_MATCHES  ... (maybe many)

Definition at line 7805 of file Expression.cc.


Constructor & Destructor Documentation

_find_info::_find_info Boolean  consider_side_effects  )  [inline]
 

Definition at line 7817 of file Expression.cc.

References consider_side_effects, could_have_more_matches, False, first_time, leftmost_matched_pairs, nonbin_iter, num_mismatches, p, True, and wild_iter.

_find_info::~_find_info  )  [inline]
 

Definition at line 7829 of file Expression.cc.

References nonbin_iter, p, and wild_iter.


Member Function Documentation

Boolean _find_info::find_match NonBinaryExpr nonbin,
Expression patt
 

... Note: 'nonbin' must NOT contain wildcards, 'patt' may

... Failed

... Matched once only

... Continue to next section

... The preparation section is done. At this point, this may or may ... not be the first attempt, but it mattereth not. Be sure to ... set could_have_more_matches so that second attempts will ... cause a jump to this section to search for further matches.

... This is the point at which we iterate through all remaining ... permutations. These are permutations for trying wildcards ... against expressions which were left over from the non-wildcard ... pair matching above. Thus, we are trying to pair and match ... the expression in mismatches against the wildcard trees in ... wild_args.

... Iterate permutator

... Try this permutation for a full match.

... Note that we do not have to actually check every match that ... the permutation vector shows. But rather, some number of ... elements of the left-hande side (lower-indexed) of the ... permutation vector will already have been matched and ... validated last time. We can skip these and assume that ... they are still the same now (which they will be, assuming ... that all user-defined patterns are deterministic).

... Already matched is min of those which matched last time and ... those elements in the permutation vector which were the same ... last time.

... The number of arguments which we are considering ... already matched is smaller than the ones which we ... actually succeeded in matching last iteration. This ... means that the permutation changed in a way that ... we are throwing away some matches. We need to ... clear any matches in these wildcard arguments which ... we are throwing away from last time.

... Check the permutation for a match

... Increment both iterators past the pairs which we already know ... passed equality tests last time.

... Try next permutation

... The match failed. We need to clear any matches in the ... wildcard arguments which matched during the last iteration

Definition at line 8254 of file Expression.cc.

References consider_side_effects, could_have_more_matches, Iterator< T >::current(), dbx_wildcards_debug_level, False, Permutation::first_change(), first_time, leftmost_matched_pairs, mismatches, NO_MATCHES, num_mismatches, ONE_MATCH, p, True, Iterator< T >::valid(), Permutation::valid(), wild_args, and ZERO_OR_MORE_MATCHES.

Referenced by NonBinaryExpr::_args_are_equal().


Member Data Documentation

Boolean _find_info::first_time
 

Definition at line 7781 of file Expression.cc.

Referenced by _find_info(), and find_match().

Boolean _find_info::could_have_more_matches
 

Definition at line 7781 of file Expression.cc.

Referenced by _find_info(), and find_match().

int _find_info::num_mismatches
 

Definition at line 7782 of file Expression.cc.

Referenced by _find_info(), and find_match().

Boolean _find_info::consider_side_effects
 

Definition at line 7783 of file Expression.cc.

Referenced by _find_info(), and find_match().

RefList<Expression> _find_info::mismatches
 

Definition at line 7785 of file Expression.cc.

Referenced by find_match().

RefList<Expression> _find_info::wild_args
 

Definition at line 7786 of file Expression.cc.

Referenced by find_match().

Iterator<Expression>* _find_info::nonbin_iter
 

Definition at line 7787 of file Expression.cc.

Referenced by _find_info(), and ~_find_info().

Iterator<Expression>* _find_info::wild_iter
 

Definition at line 7788 of file Expression.cc.

Referenced by _find_info(), and ~_find_info().

Permutation* _find_info::p
 

Definition at line 7789 of file Expression.cc.

Referenced by _find_info(), find_match(), and ~_find_info().

int _find_info::leftmost_matched_pairs
 

...

Number of left-most (lower-indexed) pairs of matches that ... we found in the last iteration's permutation vector. That ... is, if the last permutation vector pitted the expressions ... lists "A, B, 1" and "A, <id>, 2" against each other, they ... would have matched up to the "1" and "2", and so the 2 ... leftmost pairs matched. Thus leftmost_matched_pairs would ... have been set to 2.

Definition at line 7798 of file Expression.cc.

Referenced by _find_info(), and find_match().


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