Polaris: RangeExpr.h Source File

RangeExpr.h

Go to the documentation of this file.
00001 ///
00002 ///
00003 /// file RangeExpr.h
00004 ///
00005 #ifndef _RANGE_EXPR_H
00006 #define _RANGE_EXPR_H
00007 ///
00008 /// \class RangeExpr 
00009 /// \brief An expression that holds a range of values
00010 /// \defgroup Polaris
00011 /// \ingroup Polaris
00012 ///  Range
00013 /// \see RangeExpr.h
00014 /// \see RangeExpr.h
00015 /// \see RangeExpr.cc
00016 ///
00017 /// \endcode
00018 /// \section Overview Overview
00019 /// A RangeExpr is an expression that represents a contiguous range of
00020 /// integer values between a lower and upper bound.
00021 ///
00022 #include "../Expression/Expression.h"
00023 #include "../Expression/BinaryExpr.h"
00024 ///
00025 class RangeExpr : public BinaryExpr {
00026  public:
00027     inline RangeExpr(const Type & etype, Expression *lower,
00028              Expression *upper);
00029     RangeExpr(Expression *lower, Expression *upper);
00030     inline RangeExpr(const RangeExpr & e);
00031     inline virtual ~RangeExpr();
00032 
00033     virtual Expression *clone() const;
00034 
00035     RangeExpr & operator = (const RangeExpr & e);
00036 
00037     virtual const Expression & lb() const;
00038     virtual Expression & lb();
00039     virtual void         lb(Expression *);
00040     virtual Expression * grab_lb();
00041     ///< Accessing methods for the range's lower bound
00042 
00043     virtual const Expression & ub() const;
00044     virtual Expression & ub();
00045     virtual void         ub(Expression *);
00046     virtual Expression * grab_ub();
00047     ///< Accessing methods for the range's upper bound
00048 
00049     bool                 has_lb() const;
00050     ///< Return trueif the range has an lower bound.
00051     ///< (lb isn't -Infinity.)
00052 
00053     bool                 has_ub() const;
00054     ///< Return true if the range has an upper bound.
00055     ///< (ub isn't +Infinity.)
00056 
00057     virtual int     structures_OK() const;
00058     virtual void    convert(BinRep & exprSet, Symtab & symtab);
00059     virtual void    print_debug(ostream & o, Boolean debug) const;
00060 };
00061 
00062 ///< Description:
00063 ///< Return true if the given expression is a range expression with no
00064 ///< elements
00065 
00066 bool is_empty_range(const Expression &);
00067 
00068 ///< Description:
00069 ///< Return true if the given expression is omega or a range expression
00070 ///< with bounds of -Inf and +Inf
00071 
00072 bool is_unbounded_range(const Expression &);
00073 
00074 ///< Description:
00075 ///< Convert the given expression to a RangeExpr.  That is, if
00076 ///< expression E is not a range expression, return the range
00077 ///< expression [E:E].
00078 
00079 RangeExpr *convert_to_range(Expression *expr);
00080 
00081 
00082 ///< inline functions
00083 
00084 inline
00085 RangeExpr::RangeExpr(const Type & etype, Expression *lower,
00086              Expression *upper)
00087 : BinaryExpr(RANGE_OP, etype, lower, upper)
00088 {
00089     ///< Do nothing
00090 }
00091 
00092 inline
00093 RangeExpr::RangeExpr(const RangeExpr & e)
00094 : BinaryExpr(e)
00095 {
00096     ///< Do nothing
00097 }
00098 
00099 inline
00100 RangeExpr::~RangeExpr()
00101 {
00102     ///< Do nothing
00103 }
00104 
00105 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:04 2005