Polaris: AliasSets.h Source File

AliasSets.h

Go to the documentation of this file.
00001 ///
00002 #ifndef _ALIAS_SETS_H
00003 #define _ALIAS_SETS_H
00004 ///
00005 /// file AliasSets.h
00006 ///
00007 /// \class AliasSets 
00008 /// \brief Collection of sets of aliased variables.
00009 /// \defgroup Polaris
00010 /// \ingroup Polaris
00011 ///  Constant
00012 /// \see AliasSets.h
00013 /// \see AliasSets.h
00014 ///
00015 /// \endcode
00016 /// \section Overview Overview
00017 /// This class represents all aliases between global variables
00018 /// for a particular program unit.
00019 ///
00020 #include "../Listable.h"
00021 #include "../Collection/Map.h"
00022 #include "../Collection/RefSet.h"
00023 #include "../Collection/RefList.h"
00024 #include "../Collection/List.h"
00025 #include "../Symbol/Symbol.h"
00026 #include "../Expression/Expression.h"
00027 ///
00028 #include "UnionFindSetElem.h"
00029 ///
00030 class AliasSets {
00031 public:
00032     AliasSets();
00033     AliasSets(AliasSets &other);
00034     virtual ~AliasSets();
00035 
00036     void alias(const Symbol &var1, const Symbol &var2);
00037     ///< Mark the two variables as aliased.
00038 
00039     void alias(const RefList<Symbol> &formals,
00040            const List<Expression> &actuals);
00041     ///< Alias each formal/actual pair in the given list pair.
00042 
00043     RefSet<Symbol> *aliases(const Symbol &var);
00044     ///< Return all the variables aliased to the given variable.
00045 
00046     RefSet<Symbol> *aliases(const Symbol &var,
00047                 const RefSet<Symbol> &filter_vars);
00048     ///< Like the previous method, but only variables in filter_vars
00049     ///< would be in the returned set.
00050 
00051     virtual void print(ostream &o);
00052     ///< Print out my alias relationships.
00053 
00054 private:
00055     Map<Symbol, UnionFindSetElem> _alias_sets;
00056 
00057     UnionFindSetElem &_get_elem(const Symbol &var);
00058 };
00059 
00060 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:36 2005