Polaris: RangeAccessor Class Reference

RangeAccessor Class Reference

file RangeAccessor.h Interface to a RangeDict object More...

#include <RangeAccessor.h>

Inheritance diagram for RangeAccessor:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 RangeAccessor (RangeDict &ranges, const Statement &stmt)
 Create a RangeAccessor object that only uses those ranges that hold on the entry of the given statement.
 RangeAccessor (RangeDict &ranges, const Statement &stmt1, const Statement &stmt2, bool union_ranges=true)
 Create a RangeAccessor object that only uses those ranges that hold on the entries of the given pair of statements.
 RangeAccessor (const RangeAccessor &other)
 Copy constructor.
virtual ~RangeAccessor ()
 Destructor.
virtual void set_range (const Symbol &var, Expression *range)
 Set the given variable to the given range.
virtual void del_range (const Symbol &var)
 Delete the range associated with the given variable.
virtual const Expressionget_range_ref (const Symbol &var)
 Return the range associated with the given variable.
RangeAccessoroperator= (const RangeAccessor &other)
 Completely copy the contents of the other range accessor into myself.
virtual void print (ostream &out) const
 Print out the range accessor.
void pretty_print (ostream &out) const
 Print out the range dictionary in a more user-readable manner.
Relation compare (const Expression &e1, const Expression &e2)
 Return the algebraic relationship between the two expressions, taking my ranges into account.
Relation compare (const Expression &e1, int value)
 Return the algebraic relationship between the given expression and the integer value, taking Ranges into account.
virtual Listablelistable_clone (void) const
 listable_clone
virtual int structures_OK () const
 Methods required by Listable.

Detailed Description

file RangeAccessor.h Interface to a RangeDict object

Polaris Range

See also:
RangeAccessor.h

RangeAccessor.h

RangeAccessor.cc

Overview

A RangeAccessor object is an interface to a RangeDict object. RangeAccessors are typically used to compare expressions or to determine whether a single expression is always positive or always negative. See the compare() and sign() methods for more details.

Description

A RangeAccessor is created by giving it an RangeDict object and one or two statements. Subsequent comparisons performed by the RangeAccessor would be done using those ranges that hold on the entry of the given statement (or both of the two given statements) in the program unit.

Ranges can also be modified by a RangeAccessor object. However, these modifications are local to this object; that is the modifications are only seen by this object and are discarded when the object is deleted. The associated RangeDict object is not modified.

Many of the comparison operators can be found in the superclass of this object, RangeComparator.h.

Definition at line 51 of file RangeAccessor.h.


Constructor & Destructor Documentation

RangeAccessor::RangeAccessor RangeDict ranges,
const Statement stmt
 

Create a RangeAccessor object that only uses those ranges that hold on the entry of the given statement.

Definition at line 14 of file RangeAccessor.cc.

Referenced by _get_ra(), and listable_clone().

RangeAccessor::RangeAccessor RangeDict ranges,
const Statement stmt1,
const Statement stmt2,
bool  union_ranges = true
 

Create a RangeAccessor object that only uses those ranges that hold on the entries of the given pair of statements.

If union_ranges=true, the sets of ranges of the two statements are unioned together, otherwise they are intersected togethor. (Unioning means use the weaker of the two ranges, while intersecting means to use the stronger of the two.)

RangeAccessor::RangeAccessor const RangeAccessor other  ) 
 

Copy constructor.

Definition at line 37 of file RangeAccessor.cc.

RangeAccessor::~RangeAccessor  )  [virtual]
 

Destructor.

... nothing to do

Definition at line 46 of file RangeAccessor.cc.


Member Function Documentation

void RangeAccessor::set_range const Symbol var,
Expression range
[virtual]
 

Set the given variable to the given range.

Implements RangeComparator.

Definition at line 55 of file RangeAccessor.cc.

References RangeComparator::_flush_sign_caches(), Map< S, T >::ins(), and omega().

Referenced by EvolutionGraph::_eliminate_vars(), del_range(), and get_range_ref().

void RangeAccessor::del_range const Symbol var  )  [virtual]
 

Delete the range associated with the given variable.

Implements RangeComparator.

Definition at line 69 of file RangeAccessor.cc.

References set_range().

const Expression * RangeAccessor::get_range_ref const Symbol var  )  [virtual]
 

Return the range associated with the given variable.

If the variable doesn't have an associated range, return 0;

Implements RangeComparator.

Definition at line 78 of file RangeAccessor.cc.

References RangeDict::_get_range_ref(), ProtoMap< S, T >::find_ref(), intersect_ranges(), OMEGA_OP, Expression::op(), set_range(), and union_ranges().

Referenced by _filter_arrays(), SSAFullRangeDict::_get_range_ref(), GSAFullRangeDict::_get_range_ref(), and print_gsa_data_range_stats().

RangeAccessor & RangeAccessor::operator= const RangeAccessor other  ) 
 

Completely copy the contents of the other range accessor into myself.

Definition at line 118 of file RangeAccessor.cc.

References RangeComparator::operator=().

void RangeAccessor::print ostream &  out  )  const [virtual]
 

Print out the range accessor.

Reimplemented from RangeComparator.

Definition at line 136 of file RangeAccessor.cc.

References KeyIterator< S, T >::current_data(), KeyIterator< S, T >::current_key(), Symbol::name_ref(), RangeComparator::print(), Statement::tag(), and KeyIterator< S, T >::valid().

Referenced by accessor_test().

void RangeAccessor::pretty_print ostream &  out  )  const
 

Print out the range dictionary in a more user-readable manner.

Definition at line 173 of file RangeAccessor.cc.

References Iterator< T >::current(), KeyIterator< S, T >::current_key(), RefList< T >::ins_after(), Symbol::name_ref(), RangeDict::pretty_print(), pretty_print_range(), Iterator< T >::valid(), and KeyIterator< S, T >::valid().

Relation RangeAccessor::compare const Expression e1,
const Expression e2
[virtual]
 

Return the algebraic relationship between the two expressions, taking my ranges into account.

silvius: there seems to be an error: compare(N, Inf) results in <=, but it should be <

... <

... >

... <

... >

... The method compare determines relationships between two expressions ... by subtracting one expression from the other, and testing whether this ... difference is less than, equal, or greater than zero.

... Set main part of relation

... Now test for circularity if e2 is non-constant

... Set main part of relation

... Now test for circularity if e1 is non-constant

Reimplemented from RangeComparator.

Definition at line 255 of file RangeAccessor.cc.

References RangeComparator::compare().

Referenced by _eg_compare(), accessor_test(), ar_aggregate(), ar_interleave(), ar_offsets_match(), ar_subregion(), SimBiGraph::calc_similarity(), and eg_compare().

Relation RangeAccessor::compare const Expression e1,
int  value
[virtual]
 

Return the algebraic relationship between the given expression and the integer value, taking Ranges into account.

Reimplemented from RangeComparator.

Definition at line 250 of file RangeAccessor.cc.

References RangeComparator::compare().

Listable * RangeAccessor::listable_clone void   )  const [virtual]
 

listable_clone

Implements Listable.

Definition at line 234 of file RangeAccessor.cc.

References RangeAccessor().

int RangeAccessor::structures_OK  )  const [virtual]
 

Methods required by Listable.

Reimplemented from RangeComparator.

Definition at line 243 of file RangeAccessor.cc.

References BaseMapRoot::structures_OK().


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:01 2005