Polaris: RefList< T > Class Template Reference

RefList< T > Class Template Reference

template for types derived from Listable More...

#include <RefList.h>

Inheritance diagram for RefList< T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

INLINE RefList ()
INLINE RefList (const RefList< T > &l)
virtual INLINE ~RefList ()
INLINE int entries () const
INLINE const T & operator[] (int sub) const
INLINE T & operator[] (int sub)
 Implements the subscript operator (indexed from 0).
INLINE void print (ostream &out, char *sep) const
 print list to out with 'sep' sepperating each element
INLINE void modify (int loc, T &el)
 change the reference at loc to a reference to el.
INLINE void ins (const T &new_element, int loc)
 Insert new_element at location loc, where 0 <= loc < entries().
INLINE T & grab ()
 Remove a node and returns it's reference.
INLINE T & grab (T &el)
 Remove a node and returns it's reference.
INLINE T & grab (int loc)
 Remove a node and returns it's reference.
INLINE void del (T &el)
 Delete node 'el'.
INLINE void del (T &el, int loc)
 Delete first occurence of node 'el' at or beyond locth position.
INLINE void del (int loc)
 Random Access Delete.
INLINE Boolean member (const T &el) const
 Check to see if node 'el' is a member of the RefList.
INLINE int index (const T &el) const
 Check to see if node 'el' is a member of the RefList.
INLINE Boolean valid (int loc) const
 Check to see if the locth element is valid.
INLINE Boolean valid (const T &el) const
 Check to see if the first occurence of T in the RefList is valid.
INLINE void ins_first (const T &new_element)
 Prepend new_element to the beginning of the list.
INLINE void ins_last (const T &new_element)
 Append new_element to the end of the list.
INLINE void ins_before (const T &new_element, const T &ref)
 Insert new_element before the reference element 'ref' (if ref == 0, insert at END of list).
INLINE void ins_after (const T &new_element, const T &ref)
 Insert new_element after the reference element 'ref' (if ref == 0, insert at BEGINNING of list).
INLINE void clear ()
 Delete the entire list.
INLINE RefList< T > & operator= (const RefList< T > &l)
 Copy operator copies all the valid elements of a RefList.
INLINE int structures_OK () const
 Check the structure of the data for errors or inconsistency.
INLINE Listablelistable_clone () const
 Needed for Listable class.
INLINE void print (ostream &o) const
 Needed for Listable class.

Protected Member Functions

virtual INLINE const Collection_base_collection () const
virtual INLINE Collection_base_collection ()

Protected Attributes

BaseRefList _list

Friends

class Iterator<T>
class Mutator<T>
 gcc-2.96 need the stupid "<>" pair friend ostream & operator << (ostream & o, const RefList<T> &l);
ostream & operator<< (ostream &o, const RefList< T > &l)

Detailed Description

template<class T>
class RefList< T >

template for types derived from Listable

Polaris C++ VDL

See also:
RefList.h

Overview

The RefList class creates a templatized linked-list object for references to objects which must be derived from Listable. Since the RefList is built from Collection it works with Iterators. An object must be in a live structure, like List, before it can be used in a reference structure, like RefList.

DESCRIPTION

All objects in a RefList must exist in some other live structure. If this is not the case, an error is raised upon insertion. If the live object is removed from its owner-structure, references to it within the RefList will become invalid.

RefList is subject to the restrictions of the Iterators--that is, when a wrapper is taken out of the RefList, only the pointers of the neighboring wrappers are changed--the out-going pointers are maintained (ie, _unlink_wrapper is called).

It is possible to have more than one reference to a single object within a RefList. This could cause confusion in terms of how the methods behave. If an object (it's address) is used as a reference point for a method and more than one exist, the first one encountered will be operated on.

Hierarchy Structure

RefList does not inherit from Collection, instead it contains a BaseRefList (which does) and inherits from TypedCollection (which provides an interface with the Iterators). The hierarchy can be represented by:

                        --- :    inherited from relationship
                        -c- :    contained in relationship
   
   
                            Collection
                           /          \                                          //
                          /            \                                         //
                  BaseList   Listable   BaseRefList
                  |  \          |             /  |
                  |   \         |            /   |
                  |    c  TypedCollection   c    |
                  |     \     /     \      /     |
                  |      \   /       \    /      |
                  |      LIST        RefList     |
                  |      Set         RefSet      |
                  c                              c
                  |          Listable            |
                  |             |                |
                  |             |                |
                  |        BaseMapRoot           |
                  |       /           \          |
                  |      /             \         |
                  BaseMap               BaseRefMap
                     |                       |
                     |                       |                            
                TypedBaseMap          TypedBaseRefMap
                  /     \                /         \                             //
                 /       \              /           \                            //
       ProtoDatabase      ProtoMap   ProtoRefMap    ProtoRefDatabase
            /  \           |    |      |     |         |         \               //
           /    \          |    |      |     |         |          \              //
    Database KeyDatabase  Map KeyMap  RefMap KeyMap  RefDatabase RefKeyDatabase

Bugs

Currently, RefLists are not equipped to be static.

See Also

Collection, Listable, RefWrapper, Iterator, TypedCollection, Zombie, BaseRefList, RefSet

Definition at line 99 of file RefList.h.


Constructor & Destructor Documentation

template<class T>
INLINE RefList< T >::RefList  ) 
 

< nothing to do

Definition at line 212 of file RefList.h.

template<class T>
INLINE RefList< T >::RefList const RefList< T > &  l  ) 
 

Definition at line 219 of file RefList.h.

References RefList< T >::_list.

template<class T>
INLINE RefList< T >::~RefList  )  [virtual]
 

< nothing to do

Definition at line 226 of file RefList.h.


Member Function Documentation

template<class T>
INLINE const Collection & RefList< T >::_base_collection  )  const [protected, virtual]
 

Implements TypedCollection< T >.

Definition at line 399 of file RefList.h.

References RefList< T >::_list.

template<class T>
INLINE Collection & RefList< T >::_base_collection  )  [protected, virtual]
 

Implements TypedCollection< T >.

Definition at line 406 of file RefList.h.

References RefList< T >::_list.

template<class T>
INLINE int RefList< T >::entries  )  const
 

Definition at line 233 of file RefList.h.

References RefList< T >::_list, and Collection::entries().

Referenced by _build_call_diamond(), _create_new_actual_consts(), _generate_subst_order(), _get_ra(), EvolutionGraph::_global_range(), EvolutionGraph::_global_range_per_iteration(), _translate_range(), DDgraphTester::add_dditerator(), add_to_chain(), ar_interleave(), build_in_out_set(), EquivalenceDict::clean(), clean_program(), SSAProgramUnit::convert_to_SSA(), IPCPProcData::create_jump_function(), enforce_standard_within_bounds(), Namelist::entries(), CommonBlock::entries(), gating(), localize_goto(), normalize_cfg(), operator<<(), optimize_ssa_gamma(), AssignedGotoStmt::print_debug(), ComputedGotoStmt::print_debug(), ArithmeticIfStmt::print_debug(), remove_assigned_goto_stmts(), simplify_descriptors(), sort_sym_list(), symgsa_callee(), trace_into_called_pgm(), SymbolAccessRef::write(), and Equivalence::write().

template<class T>
INLINE const T & RefList< T >::operator[] int  sub  )  const
 

Definition at line 240 of file RefList.h.

References RefList< T >::_list, and sub().

template<class T>
INLINE T & RefList< T >::operator[] int  sub  ) 
 

Implements the subscript operator (indexed from 0).

If the subth element is not valid, an error is raised. Should be used for random access only.

Definition at line 247 of file RefList.h.

References RefList< T >::_list, and sub().

template<class T>
INLINE void RefList< T >::print ostream &  out,
char *  sep
const
 

print list to out with 'sep' sepperating each element

Definition at line 254 of file RefList.h.

References RefList< T >::_list, and BaseRefList::print().

Referenced by RefList< T >::print(), and PhiPlaceDef::print().

template<class T>
INLINE void RefList< T >::modify int  loc,
T &  el
 

change the reference at loc to a reference to el.

Definition at line 261 of file RefList.h.

References RefList< T >::_list, and BaseRefList::modify().

Referenced by main().

template<class T>
INLINE void RefList< T >::ins const T &  new_element,
int  loc
 

Insert new_element at location loc, where 0 <= loc < entries().

Definition at line 268 of file RefList.h.

References RefList< T >::_list, and BaseRefList::ins().

Referenced by VariableSymbol::common(), Namelist::ins(), main(), and optimize_ssa_beta().

template<class T>
INLINE T & RefList< T >::grab  ) 
 

Remove a node and returns it's reference.

Definition at line 296 of file RefList.h.

Referenced by _build_call_diamond(), _generate_subst_order(), build_in_out_set(), EquivalenceDict::clean(), main(), sort_sym_list(), and Equivalence::write().

template<class T>
INLINE T & RefList< T >::grab T &  el  ) 
 

Remove a node and returns it's reference.

Definition at line 312 of file RefList.h.

References RefList< T >::del().

template<class T>
INLINE T & RefList< T >::grab int  loc  ) 
 

Remove a node and returns it's reference.

Definition at line 303 of file RefList.h.

References RefList< T >::del().

template<class T>
INLINE void RefList< T >::del T &  el  ) 
 

Delete node 'el'.

el MUST be in the list (this is not necessarily checked).

Definition at line 289 of file RefList.h.

References RefList< T >::_list, and BaseRefList::del().

Referenced by ar_intersect(), ar_subtract(), EquivalenceDict::clean(), VariableSymbol::clear_common(), elim_equivalent_descrs(), RefList< T >::grab(), localize_goto(), main(), normalize_cfg(), optimize_ssa_eta(), optimize_ssa_gamma(), optimize_ssa_mu(), process2(), and simplify_descriptors_scalar().

template<class T>
INLINE void RefList< T >::del T &  el,
int  loc
 

Delete first occurence of node 'el' at or beyond locth position.

el MUST be in the list (this is not necessarily checked).

Definition at line 282 of file RefList.h.

References RefList< T >::_list, and BaseRefList::del().

template<class T>
INLINE void RefList< T >::del int  loc  ) 
 

Random Access Delete.

Delete the Node in position loc where 0 <= loc < entries()-1.

Definition at line 275 of file RefList.h.

References RefList< T >::_list, and BaseRefList::del().

template<class T>
INLINE Boolean RefList< T >::member const T &  el  )  const
 

Check to see if node 'el' is a member of the RefList.

Return 0 if the element was not found, else return 1.

Definition at line 327 of file RefList.h.

References RefList< T >::_list, and Collection::member().

Referenced by _determine_entry_points(), add_dummy_eta_assignments_after_loops(), ar_intersect(), build_in_out_sets(), EquivalenceDict::clean(), gating(), move_saved_vars(), SSAProgramUnit::SEARCH(), SEARCH(), and untranslate_var().

template<class T>
INLINE int RefList< T >::index const T &  el  )  const
 

Check to see if node 'el' is a member of the RefList.

Return -1 if the element was not found, else return the index of the element.

Definition at line 320 of file RefList.h.

References RefList< T >::_list, and Collection::index().

Referenced by Namelist::del(), and main().

template<class T>
INLINE Boolean RefList< T >::valid int  loc  )  const
 

Check to see if the locth element is valid.

Definition at line 334 of file RefList.h.

References RefList< T >::_list, and Collection::valid().

Referenced by _get_ra(), add_to_chain(), ar_intersect(), ar_subtract(), build_in_out_set(), cdg_dag2tree(), AbstractAccess::check_access_patterns(), EquivalenceDict::clean(), clean_program(), DominanceFrontier(), Dominator(), Dominator_S(), elim_equivalent_descrs(), AssignedGotoStmt::exchange_convert(), ComputedGotoStmt::exchange_convert(), gating(), Directive::generate_convex_parallel_directive(), Directive::generate_convex_spp_parallel_directive(), Directive::generate_csrd_parallel_directive(), InsertPhiStmt(), localize_goto(), move_saved_vars(), pDominanceFrontier(), pDominator(), SSAProgramUnit::place_phi_functions(), pDominatorWorkSpace::print(), GSAWorkSpace::print(), DominatorWorkSpace::print(), SymbolAccessRef::relink_eptrs(), SEARCH(), simplify_descriptors_scalar(), and Equivalence::write().

template<class T>
INLINE Boolean RefList< T >::valid const T &  el  )  const
 

Check to see if the first occurence of T in the RefList is valid.

Definition at line 341 of file RefList.h.

References RefList< T >::_list, and Collection::valid().

template<class T>
INLINE void RefList< T >::ins_first const T &  new_element  ) 
 

Prepend new_element to the beginning of the list.

Definition at line 348 of file RefList.h.

References RefList< T >::_list, and BaseRefList::ins().

Referenced by _build_call_diamond(), SymbolAccessRef::_copy_access_lists(), _generate_subst_order(), add_to_chain(), ar_interleave(), ar_subtract(), cdg_dag2tree(), elim_equivalent_descrs(), main(), operator<<(), process(), process2(), and simplify_descriptors_scalar().

template<class T>
INLINE void RefList< T >::ins_last const T &  new_element  ) 
 

Append new_element to the end of the list.

Definition at line 355 of file RefList.h.

References RefList< T >::_list, Collection::entries(), and BaseRefList::ins().

Referenced by _build_call_diamond(), _determine_entry_points(), _find_scalar_sources(), _generate_subst_order(), _get_ra(), _multiply_out_divs_for_var1(), DDgraphTester::add_dditerator(), add_dummy_eta_assignments_after_loops(), IPCPProcData::add_maymods(), SymbolAccessRef::add_read(), SymbolAccessRef::add_readwrite(), add_to_chain(), SymbolAccessRef::add_write(), ar_interleave(), ar_intersect(), UnaryExpr::arg_refs(), NonBinaryExpr::arg_refs(), BinaryExpr::arg_refs(), ArithmeticIfStmt::ArithmeticIfStmt(), AssignedGotoStmt::AssignedGotoStmt(), build_in_out_set(), build_in_out_sets(), EquivalenceDict::clean(), clean_program(), CommonBlock::CommonBlock(), COMPRESS_PATH(), ComputedGotoStmt::ComputedGotoStmt(), SSAProgramUnit::convert_to_SSA(), SSAProgramUnit::convert_to_standard(), DominanceFrontier(), Dominator(), Dominator_S(), enforce_standard_within_bounds(), EVAL_PATH(), gating(), SSAProgramUnit::init_variable_set(), insert_pseudo_assignment_stmts(), localize_goto(), main(), modify_dummy_eta_assignments_after_loops(), move_saved_vars(), Namelist::Namelist(), operator<<(), optimize_ssa_beta(), optimize_ssa_eta(), optimize_ssa_gamma(), optimize_ssa_mu(), pDominanceFrontier(), pDominator(), SSAFullRangeDict::pretty_print(), SSAControlRangeDict::pretty_print(), GSAFullRangeDict::pretty_print(), GSAControlRangeDict::pretty_print(), ControlRangeDict::pretty_print(), BaseStmtRanges::pretty_print(), remove_assigned_goto_stmts(), SSAProgramUnit::SEARCH(), SEARCH(), StmtRanges::simplify_min_max(), untranslate_var(), and Equivalence::write().

template<class T>
INLINE void RefList< T >::ins_before const T &  new_element,
const T &  ref
 

Insert new_element before the reference element 'ref' (if ref == 0, insert at END of list).

ref MUST be in the list (this is not necessarily checked).

Definition at line 362 of file RefList.h.

References RefList< T >::_list, and BaseRefList::ins_before().

Referenced by localize_goto(), and main().

template<class T>
INLINE void RefList< T >::ins_after const T &  new_element,
const T &  ref
 

Insert new_element after the reference element 'ref' (if ref == 0, insert at BEGINNING of list).

ref MUST be in the list (this is not necessarily checked).

Definition at line 369 of file RefList.h.

References RefList< T >::_list, and BaseRefList::ins_after().

Referenced by localize_goto(), main(), normalize_cfg(), and RangeAccessor::pretty_print().

template<class T>
INLINE void RefList< T >::clear  ) 
 

Delete the entire list.

Definition at line 376 of file RefList.h.

References RefList< T >::_list, and Collection::clear().

Referenced by Assertion::Assertion(), main(), Assertion::operator=(), SSAFullRangeDict::pretty_print(), GSAFullRangeDict::pretty_print(), SSAProgramUnit::SEARCH(), SEARCH(), and Assertion::~Assertion().

template<class T>
INLINE RefList< T > & RefList< T >::operator= const RefList< T > &  l  ) 
 

Copy operator copies all the valid elements of a RefList.

Definition at line 384 of file RefList.h.

References RefList< T >::_list.

template<class T>
INLINE int RefList< T >::structures_OK  )  const
 

Check the structure of the data for errors or inconsistency.

Return 0 and print error message if problems found, otherwise return 1 without message.

Definition at line 392 of file RefList.h.

References RefList< T >::_list, and Collection::structures_OK().

Referenced by ReturnJumpFunction::structures_OK(), and IPCPProcData::structures_OK().

template<class T>
INLINE Listable * RefList< T >::listable_clone  )  const [virtual]
 

Needed for Listable class.

Implements Listable.

Definition at line 413 of file RefList.h.

template<class T>
INLINE void RefList< T >::print ostream &  o  )  const [virtual]
 

Needed for Listable class.

It invokes a non-virtual member function to print a representation of the data structure at this level of the Collection hierarchy, and, since it is not a class member function, it must be explicitly instantiated before use.

Implements Listable.

Definition at line 420 of file RefList.h.

References RefList< T >::print().


Friends And Related Function Documentation

template<class T>
friend class Iterator<T> [friend]
 

Reimplemented from TypedCollection< T >.

Definition at line 100 of file RefList.h.

template<class T>
friend class Mutator<T> [friend]
 

gcc-2.96 need the stupid "<>" pair friend ostream & operator << (ostream & o, const RefList<T> &l);

Reimplemented from TypedCollection< T >.

Definition at line 103 of file RefList.h.

template<class T>
ostream& operator<< ostream &  o,
const RefList< T > &  l
[friend]
 

Definition at line 432 of file RefList.h.


Member Data Documentation

template<class T>
BaseRefList RefList< T >::_list [protected]
 

Definition at line 108 of file RefList.h.

Referenced by RefList< T >::_base_collection(), RefList< T >::clear(), RefList< T >::del(), RefList< T >::entries(), RefList< T >::index(), RefList< T >::ins(), RefList< T >::ins_after(), RefList< T >::ins_before(), RefList< T >::ins_first(), RefList< T >::ins_last(), RefList< T >::member(), RefList< T >::modify(), RefList< T >::operator=(), RefList< T >::operator[](), RefList< T >::print(), RefList< T >::RefList(), RefList< T >::structures_OK(), and RefList< T >::valid().


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:08:06 2005