
Module: ppl/ppl Branch: floating_point Commit: e9ad67116f5f290c8e4d83d3eeae7051aa549302 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e9ad67116f5f2...
Author: Fabio Bossi bossi@cs.unipr.it Date: Mon Jul 26 17:45:17 2010 +0200
Concrete_Expression: - Added two methods.
C_Expr: - Some progress in the implementation.
---
src/Concrete_Expression.defs.hh | 7 ++++++ tests/Concrete_Expression/C_Expr.defs.hh | 27 +++++++++++++++++++++++++ tests/Concrete_Expression/C_Expr.inlines.hh | 29 +++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/src/Concrete_Expression.defs.hh b/src/Concrete_Expression.defs.hh index f6777cd..217e239 100644 --- a/src/Concrete_Expression.defs.hh +++ b/src/Concrete_Expression.defs.hh @@ -150,6 +150,8 @@ public:
template <typename Target> class Cast_Operator_Base : public Concrete_Expression<Target> { + //! Returns the casted expression. + const Concrete_Expression<Target>* argument() const; };
template <typename Target> @@ -158,6 +160,11 @@ class Integer_Constant_Base : public Concrete_Expression<Target> {
template <typename Target> class Floating_Point_Constant_Base : public Concrete_Expression<Target> { + /*! \brief + Returns a string for the floating point constant as written + in the analyzed program. + */ + const char* get_value_as_string() const; };
template <typename Target> diff --git a/tests/Concrete_Expression/C_Expr.defs.hh b/tests/Concrete_Expression/C_Expr.defs.hh index 073e9a8..fb94904 100644 --- a/tests/Concrete_Expression/C_Expr.defs.hh +++ b/tests/Concrete_Expression/C_Expr.defs.hh @@ -141,6 +141,10 @@ template <> class Cast_Operator<C_Expr> : public Cast_Operator_Base<C_Expr> { public: + //! Constructor from cast type and argument. + Cast_Operator<C_Expr>(Concrete_Expression_Type c_type, + const Concrete_Expression<C_Expr>* ar); + //! Do-nothing destructor. ~Cast_Operator<C_Expr>();
@@ -150,8 +154,18 @@ public: //! Returns the kind of \p *this. Concrete_Expression_Kind kind() const;
+ //! Returns the casted expression. + const Concrete_Expression<C_Expr>* argument() const; + //! Constant identifying cast nodes. enum { KIND = 3 }; + +private: + //! The type of the cast expression. + Concrete_Expression_Type cast_type; + + //! The casted expression. + const Concrete_Expression<C_Expr>* arg; };
template <> @@ -175,6 +189,9 @@ template <> class Floating_Point_Constant<C_Expr> : public Floating_Point_Constant_Base<C_Expr> { public: + //! Constructor from value. + Floating_Point_Constant<C_Expr>(const char* value_string); + //! Do-nothing destructor. ~Floating_Point_Constant<C_Expr>();
@@ -184,8 +201,18 @@ public: //! Returns the kind of \p *this. Concrete_Expression_Kind kind() const;
+ /*! \brief + Returns a string for the floating point constant as written + in the analyzed program. + */ + const char* get_value_as_string() const; + //! Constant identifying floating constant nodes. enum { KIND = 5 }; + +private: + //! The floating point constant as written. + const char* value; };
// We currently only consider variable references. diff --git a/tests/Concrete_Expression/C_Expr.inlines.hh b/tests/Concrete_Expression/C_Expr.inlines.hh index 900e90f..7263eae 100644 --- a/tests/Concrete_Expression/C_Expr.inlines.hh +++ b/tests/Concrete_Expression/C_Expr.inlines.hh @@ -87,14 +87,32 @@ Unary_Operator<C_Expr>::argument() const { }
inline +Cast_Operator<C_Expr>:: +Cast_Operator(Concrete_Expression_Type c_type, + const Concrete_Expression<C_Expr>* ar) + : cast_type(c_type), + arg(ar) { +} + +inline Cast_Operator<C_Expr>::~Cast_Operator<C_Expr>() { }
+inline Concrete_Expression_Type +Cast_Operator<C_Expr>::type() const { + return cast_type; +} + inline Concrete_Expression_Kind Cast_Operator<C_Expr>::kind() const { return KIND; }
+inline const Concrete_Expression<C_Expr>* +Cast_Operator<C_Expr>::argument() const { + return arg; +} + inline Integer_Constant<C_Expr>::~Integer_Constant<C_Expr>() { } @@ -105,6 +123,12 @@ Integer_Constant<C_Expr>::kind() const { }
inline +Floating_Point_Constant<C_Expr>:: +Floating_Point_Constant(const char* value_string) + : value(value_string) { +} + +inline Floating_Point_Constant<C_Expr>::~Floating_Point_Constant<C_Expr>() { }
@@ -113,6 +137,11 @@ Floating_Point_Constant<C_Expr>::kind() const { return KIND; }
+inline const char* +Floating_Point_Constant<C_Expr>::get_value_as_string() const { + return value; +} + inline Approximable_Reference<C_Expr>:: Approximable_Reference(dimension_type var_index)