[GIT] ppl/ppl(floating_point): Started drafting the classes to be used withing the PPL for testing purposes .

Module: ppl/ppl Branch: floating_point Commit: 0e4329676d8e481e3fa96cada83f3701ac91039a URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0e4329676d8e4...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Sun Jul 4 14:11:14 2010 +0200
Started drafting the classes to be used withing the PPL for testing purposes.
---
src/Concrete_Expression.defs.hh | 2 +- src/Concrete_Expression.types.hh | 2 +- src/Makefile.am | 2 + tests/Concrete_Expression/C_Expr.cc | 31 +++++++ tests/Concrete_Expression/C_Expr.defs.hh | 131 +++++++++++++++++++++++++++ tests/Concrete_Expression/C_Expr.inlines.hh | 40 ++++++++ tests/Concrete_Expression/C_Expr.types.hh | 27 ++++++ tests/Concrete_Expression/Makefile.am | 21 +++-- 8 files changed, 245 insertions(+), 11 deletions(-)
diff --git a/src/Concrete_Expression.defs.hh b/src/Concrete_Expression.defs.hh index 1324389..2666d2b 100644 --- a/src/Concrete_Expression.defs.hh +++ b/src/Concrete_Expression.defs.hh @@ -63,6 +63,6 @@ class Approximable_Reference_Base : public Concrete_Expression<Target> {
} // namespace Parma_Polyhedra_Library
-#include "Concrete_Expression.inlines.hh" +//#include "Concrete_Expression.inlines.hh"
#endif // !defined(PPL_Concrete_Expression_defs_hh) diff --git a/src/Concrete_Expression.types.hh b/src/Concrete_Expression.types.hh index 9666319..6fe20eb 100644 --- a/src/Concrete_Expression.types.hh +++ b/src/Concrete_Expression.types.hh @@ -42,7 +42,7 @@ class Floating_Point_Constant; template <typename Target> class Approximable_Reference;
-enum Concrete_Expression_Type = { +enum Concrete_Expression_Type { // To be defined with all the floating point formats and using // Bounded_Integer_Type_Width, Bounded_Integer_Type_Representation // and Bounded_Integer_Type_Overflow. diff --git a/src/Makefile.am b/src/Makefile.am index f89fd67..53e9a1c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -122,6 +122,8 @@ mp_std_bits.inlines.hh \ Proxy.types.hh \ Proxy.defs.hh \ Proxy.inlines.hh \ +Concrete_Expression.types.hh \ +Concrete_Expression.defs.hh \ Temp.defs.hh \ Temp.inlines.hh \ Temp.templates.hh \ diff --git a/tests/Concrete_Expression/C_Expr.cc b/tests/Concrete_Expression/C_Expr.cc new file mode 100644 index 0000000..4dbaec6 --- /dev/null +++ b/tests/Concrete_Expression/C_Expr.cc @@ -0,0 +1,31 @@ +/* Definitions for the C_Expr class and its subclasses: non-inline, + non-template functions. + Copyright (C) 2001-2010 Roberto Bagnara bagnara@cs.unipr.it + +This file is part of the Parma Polyhedra Library (PPL). + +The PPL is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The PPL is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. + +For the most up-to-date information see the Parma Polyhedra Library +site: http://www.cs.unipr.it/ppl/ . */ + +#include "ppl_test.hh" + +#include "C_Expr.defs.hh" + +int +main() { + return 0; +} diff --git a/tests/Concrete_Expression/C_Expr.defs.hh b/tests/Concrete_Expression/C_Expr.defs.hh new file mode 100644 index 0000000..95042a7 --- /dev/null +++ b/tests/Concrete_Expression/C_Expr.defs.hh @@ -0,0 +1,131 @@ +/* Declarations for the C_Expr class and its subclasses. + Copyright (C) 2001-2010 Roberto Bagnara bagnara@cs.unipr.it + +This file is part of the Parma Polyhedra Library (PPL). + +The PPL is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The PPL is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. + +For the most up-to-date information see the Parma Polyhedra Library +site: http://www.cs.unipr.it/ppl/ . */ + +#ifndef PPL_C_Expr_defs_hh +#define PPL_C_Expr_defs_hh 1 + +#include "C_Expr.types.hh" +#include "Concrete_Expression.types.hh" +#include "Proxy.defs.hh" + +namespace Parma_Polyhedra_Library { + +class C_Expr { + //! Returns the type of \p *this. + virtual Concrete_Expression_Type type() const = 0; + + //! Returns the kind of \p *this. + virtual Concrete_Expression_Kind kind() const = 0; +}; + +class Bin_Op : public C_Expr { +public: + //! Returns the type of \p *this. + Concrete_Expression_Type type() const; + + //! Returns the kind of \p *this. + Concrete_Expression_Kind kind() const; + + //! Returns the left-hand side of \p *this. + const C_Expr* left_hand_side() const; + + //! Returns the right-hand side of \p *this. + const C_Expr* right_hand_side() const; + +private: + //! The left-hand side of \p *this. + const C_Expr* lhs; + + //! The right-hand side of \p *this. + const C_Expr* rhs; +}; + +class Un_Op : public C_Expr { +}; + +class Cast_Op : public C_Expr { +}; + +class Int_Const : public C_Expr { +}; + +class Float_Const : public C_Expr { +}; + +class Appr_Ref : public C_Expr { +}; + +struct PPL_C_Expr; + +template <> +struct Underlying_To_Exposed<PPL_C_Expr, C_Expr> { + typedef Concrete_Expression<PPL_C_Expr> Type; +}; + +template <> +struct Underlying_To_Exposed<PPL_C_Expr, Bin_Op> { + typedef Binary_Operator<PPL_C_Expr> Type; +}; + +template<> +struct Exposed_To_Underlying<PPL_C_Expr, Concrete_Expression<PPL_C_Expr> > { + typedef C_Expr Type; +}; + +template<> +struct Exposed_To_Underlying<PPL_C_Expr, Binary_Operator<PPL_C_Expr> > { + typedef Bin_Op Type; +}; + +template <> +class Concrete_Expression<PPL_C_Expr> + : public Concrete_Expression_Base<PPL_C_Expr>, + public Proxy<PPL_C_Expr> { +private: + typedef Exposed_To_Underlying<PPL_C_Expr, + Concrete_Expression<PPL_C_Expr> >::Type + Underlying; + +public: +#if 0 + template <typename T> + static bool classof(const T* expr) { + return Underlying::classof(underlying(expr)); + } +#endif +}; + +template <> +class Binary_Operator<PPL_C_Expr> + : public Binary_Operator_Base<PPL_C_Expr> { +public: + const Concrete_Expression<PPL_C_Expr>* get_lhs() { + return exposed(underlying(this)->left_hand_side()); + } +}; + +} // namespace Parma_Polyhedra_Library + +#include "C_Expr.inlines.hh" +//#include "C_Expr.templates.hh" + +#endif // !defined(PPL_C_Expr_defs_hh) diff --git a/tests/Concrete_Expression/C_Expr.inlines.hh b/tests/Concrete_Expression/C_Expr.inlines.hh new file mode 100644 index 0000000..47f35b5 --- /dev/null +++ b/tests/Concrete_Expression/C_Expr.inlines.hh @@ -0,0 +1,40 @@ +/* Definitions for the C_Expr class and its subclasses: inline functions. + Copyright (C) 2001-2010 Roberto Bagnara bagnara@cs.unipr.it + +This file is part of the Parma Polyhedra Library (PPL). + +The PPL is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The PPL is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. + +For the most up-to-date information see the Parma Polyhedra Library +site: http://www.cs.unipr.it/ppl/ . */ + +#ifndef PPL_C_Expr_inlines_hh +#define PPL_C_Expr_inlines_hh 1 + +namespace Parma_Polyhedra_Library { + +inline const C_Expr* +Bin_Op::left_hand_side() const { + return lhs; +} + +inline const C_Expr* +Bin_Op::right_hand_side() const { + return rhs; +} + +} // namespace Parma_Polyhedra_Library + +#endif // !defined(PPL_C_Expr_inlines_hh) diff --git a/tests/Concrete_Expression/C_Expr.types.hh b/tests/Concrete_Expression/C_Expr.types.hh new file mode 100644 index 0000000..60371dc --- /dev/null +++ b/tests/Concrete_Expression/C_Expr.types.hh @@ -0,0 +1,27 @@ +/* Copyright (C) 2001-2010 Roberto Bagnara bagnara@cs.unipr.it + +This file is free software; as a special exception the author gives +unlimited permission to copy and/or distribute it, with or without +modifications, as long as this notice is preserved. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. */ + +#ifndef PPL_C_Expr_types_hh +#define PPL_C_Expr_types_hh 1 + +namespace Parma_Polyhedra_Library { + +class C_Expr; +class Bin_Op; +class Un_Op; +class Cast_Op; +class Int_Const; +class Float_Const; +class Appr_Ref; + +} // namespace Parma_Polyhedra_Library + +#endif // !defined(PPL_C_Expr_types_hh) diff --git a/tests/Concrete_Expression/Makefile.am b/tests/Concrete_Expression/Makefile.am index 55a958c..c433cad 100644 --- a/tests/Concrete_Expression/Makefile.am +++ b/tests/Concrete_Expression/Makefile.am @@ -51,15 +51,16 @@ $(top_builddir)/src/libppl.la \ @extra_libraries@
ORIGINAL_TESTS = \ -bdshape1 \ -bdshape2 \ -digitalfilters1 \ -floatingpointexpr1 \ -linearform1 \ -octagonalshape1 \ -octagonalshape2 \ -polyhedron1 \ -polyhedron2 +C_Expr +#bdshape1 \ +#bdshape2 \ +#digitalfilters1 \ +#floatingpointexpr1 \ +#linearform1 \ +#octagonalshape1 \ +#octagonalshape2 \ +#polyhedron1 \ +#polyhedron2
DERIVED_TESTS =
@@ -129,6 +130,8 @@ print_INSTANCES: # Sources for the tests #
+C_Expr_SOURCES = C_Expr.defs.hh C_Expr.inlines.hh C_Expr.cc + bdshape1_SOURCES = bdshape1.cc
bdshape2_SOURCES = bdshape2.cc
participants (1)
-
Roberto Bagnara