Skip to content
Snippets Groups Projects
Select Git revision
  • 24fb1deb46120718dcff507584d6f99f96cecdc9
  • public default protected
  • input_conditionals
3 results

PolyWrap.h

Blame
  • PolyWrap.h 14.80 KiB
    #ifndef POLYWRAP_H
    #define POLYWRAP_H 1
    
    #include <ppl.hh>
    #include <elm/io/Output.h>
    #include <elm/io/io.h>
    
    namespace otawa { 
    namespace poly {
    
    namespace PPL = Parma_Polyhedra_Library;
    
    typedef unsigned long long guid_t;
    typedef std::GMP_Integer coef_t;
    typedef PPL::dimension_type dim_t;
    typedef elm::io::Output output_t;
    
    class WVar;
    class WCons;
    class WLinExpr;
    class WPoly;
    
    output_t& operator<< (output_t& stream, const coef_t&);
    output_t& operator<< (output_t& stream, const WLinExpr&);
    output_t& operator<< (output_t& stream, const WCons&);
    output_t& operator<< (output_t& stream, const WPoly&);
    output_t& operator<< (output_t& stream, const WVar&);
    WCons operator==(const WLinExpr &a, const WLinExpr &b);
    bool operator==(const WPoly &a, const WPoly &b);
    bool operator!=(const WPoly &a, const WPoly &b);
    WCons operator>=(const WLinExpr &a, const WLinExpr &b);
    WCons operator<=(const WLinExpr &a, const WLinExpr &b);
    WCons operator>(const WLinExpr &a, const WLinExpr &b);
    WCons operator<(const WLinExpr &a, const WLinExpr &b);
    WLinExpr operator+(const WLinExpr &a, const WLinExpr &b);
    WLinExpr operator*(const WLinExpr &a, const coef_t b);
    WLinExpr operator*(const coef_t b, const WLinExpr &a);
    WLinExpr operator-(const WLinExpr &a, const WLinExpr &b);
    WLinExpr operator+=(WLinExpr &a, const WLinExpr &b);
    WLinExpr operator-=(WLinExpr &a, const WLinExpr &b);
    
    class TranslationFailed : public std::exception {
    };
    
    class WVar {
    	public:
    		inline WVar() {
    			_guid = _guid_generator;
    			_guid_generator++;
    		}
    		inline WVar(guid_t guid) { _guid = guid; }
    		inline guid_t guid() const { return _guid; }
    		inline guid_t id() const { return _guid; }
    
    		static guid_t _guid_generator; // TODO FIXME: public needed for gruikfix in memMerge()
    	private:
    		guid_t _guid;
    };
    
    // WVar
    //
    class WLinExpr {
    	public:
    		friend WLinExpr operator+(const WLinExpr &a, const WLinExpr &b);
    		friend WLinExpr operator-(const WLinExpr &a, const WLinExpr &b);
    		friend WLinExpr operator*(const WLinExpr &a, const coef_t b);
    		friend WLinExpr operator*(const WLinExpr &a, const coef_t b);
    		friend WCons operator==(const WLinExpr &a, const WLinExpr &b);
    
    		WLinExpr(const coef_t c = 0) { cst = c; }