Polaris: Assertion.h Source File

Assertion.h

Go to the documentation of this file.
00001 #ifndef _ASSERTION_H
00002 #define _ASSERTION_H
00003 ///
00004 ///
00005 ///
00006 /// \class Assertion 
00007 /// \brief a base class for compiler assertions.
00008 /// \defgroup C
00009 /// \ingroup C++ CVDL
00010 ///  Polaris
00011 /// \see Directive/Assertion.h
00012 /// \see Directive/Assertion.h
00013 ///
00014 /// \endcode
00015 /// \section Description Description
00016 /// The Assertion class is meant to provide the base for a generic compiler
00017 /// assertion class.  Derived classes will implement specific instances of
00018 /// the different flavors of compiler assertions.
00019 ///
00020 /// \endcode
00021 /// \section Bugs Bugs
00022 /// No known bugs.
00023 ///
00024 #include <stream.h>
00025 ///
00026 #ifdef POLARIS_GNU_PRAGMAS
00027 #pragma interface
00028 #endif
00029 ///
00030 #include "../Boolean.h"
00031 #include "../Expression/Expression.h"
00032 #include "../Listable.h"
00033 #include "../StringElem.h"
00034 #include "../Collection/List.h"
00035 #include "../Collection/RefList.h"
00036 ///
00037 enum AssertionType { 
00038     AS_NONE, 
00039     AS_COMMENT,
00040     AS_CRITICAL,
00041     AS_EPILOGUE,
00042     AS_LASTVALUE,
00043     AS_PARALLEL,
00044     AS_PRIVATE, 
00045     AS_PROLOGUE,
00046     AS_REDUCTION,
00047     AS_RELATION,
00048     AS_SERIAL,
00049     AS_SUBST,
00050     AS_LOOPLABEL,
00051     AS_SHARED,
00052     AS_FIRSTVALUE,
00053     AS_PRIVATEREFS,
00054     AS_READONLYREFS,
00055     AS_SHAREDREFS,
00056     AS_RTSHADOW,
00057     AS_INLINE,
00058     AS_RECURSIVEINLINE,
00059     AS_NOINLINE,
00060     AS_NOPUTGET,
00061     ///Begin OpenMP Modification
00062     AS_NOWAIT,
00063     ///End OpenMP Modification
00064     AS_RUNTIMETEST,
00065     AS_SCHEDULE,
00066     AS_DYNLASTVALUE,
00067     AS_RANGEWRITTEN,
00068     AS_PREAMBLE,
00069     AS_POSTAMBLE,
00070     AS_MAYMOD,
00071     AS_NOMOD,
00072     AS_INDUCTION,
00073     AS_PARCONDITION,
00074     AS_SAFE_CONDITION,
00075     AS_OVERLAP,
00076     AS_OVERLAP_SORT,
00077     AS_PRIVATE_DESCR,
00078     AS_REDUCT_DESCR,
00079     AS_TEST_MONOTONE,
00080     AS_DEP_OVERLAP,
00081     AS_DEP_RO_RW,
00082     AS_DEP_RW_WF,
00083     AS_DEP_WF_RO,
00084     AS_DEP_IO,
00085     AS_INSTRUMENT,
00086     AS_FORWARD,
00087     AS_SIDE_EFFECT_FREE,
00088     AS_NODEPENDENCE,
00089     AS_RECURRENCE,
00090     ///Begin RT_LMAD Modification
00091     AS_PARTIAL_REDUCTION,
00092     AS_PARTIAL_FIRSTVALUE,
00093     ///End RT_LMAD Modification
00094     ///_ these are for Cray T3D
00095     AS_UNKNOWN_SHARED,
00096     ///_ the following are generated later, and others are considered comments
00097 /*    AS_UNKNOWN,
00098     AS_ATOMIC_UPDATE,
00099     AS_DOSHARED, */
00100 ///
00101     /// This last entry is for debugging
00102     AS_NUM_ASSERTIONS
00103 };
00104 ///
00105 class AssertionList;
00106 class ProgramUnit;
00107 
00108 class Assertion : public Listable {
00109     friend inline ostream & operator << (ostream & o, const Assertion & a) 
00110         { a.print(o); return o; }
00111 
00112  protected:  
00113     AssertionType        _type;
00114     RefList<Assertion>   _assertion_list;
00115 
00116  public:
00117     Assertion();
00118     ///< Construct a Assertion.
00119 
00120     Assertion(const Assertion & a);
00121     ///< Construct a Assertion with a copy of another Assertion's current value.
00122 
00123     virtual const List<Expression> & arg_list_guarded() const;
00124     virtual List<Expression> & arg_list_guarded();
00125     ///< return the list of expression associated with this assertion.
00126 
00127     virtual Boolean arg_list_valid() const;
00128     ///< check to see if the arg_list() exists.
00129 
00130     virtual const List<StringElem> & string_arg_list_guarded() const;
00131     virtual List<StringElem> & string_arg_list_guarded();
00132     ///< return the list of StringElems associated with this assertion.
00133 
00134     virtual Boolean string_arg_list_valid() const;
00135     ///< return the list of StringElems associated with this assertion.
00136 
00137     virtual RefList<Assertion>  & assertion_list() const;
00138     ///< return the reflist of assertions associated with this assertion.
00139 
00140     virtual Assertion *clone() const;
00141     ///< clone the Assertion
00142 
00143     virtual void relink_aptrs( ProgramUnit &p );
00144     ///< fix up the pointers in the Assertion after a copy.
00145 
00146     AssertionType         type() const;
00147     ///< return the assertion type.
00148 
00149     virtual ~Assertion();
00150     ///< destructor
00151 
00152     virtual void print(ostream &o) const;
00153     ///< print the object.
00154 
00155     virtual Assertion & operator = (const Assertion &a);
00156     ///< assignment operator.
00157 
00158     virtual Listable *listable_clone() const;
00159     ///< needed for Listable
00160 };
00161 
00162 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:39 2005