docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
polyhedral.h
Go to the documentation of this file.
1
22
23#pragma once
24
25#include <isl/ctx.h>
26#include <isl/map.h>
27#include <isl/set.h>
28#include <isl/space.h>
29
32
33namespace sdfg {
34namespace symbolic {
35namespace polyhedral {
36
45class IslCtx {
46public:
49
50 IslCtx(const IslCtx&) = delete;
51 IslCtx& operator=(const IslCtx&) = delete;
52 IslCtx(IslCtx&& other) noexcept;
53 IslCtx& operator=(IslCtx&& other) noexcept;
54
55 isl_ctx* get() const {
56 return ctx_;
57 }
58 explicit operator bool() const {
59 return ctx_ != nullptr;
60 }
61
62private:
63 isl_ctx* ctx_;
64};
65
72template<typename T, T* (*FreeFn)(T*)>
73class IslHandle {
74public:
75 IslHandle() : ptr_(nullptr) {
76 }
77 explicit IslHandle(T* ptr) : ptr_(ptr) {
78 }
80 reset();
81 }
82
83 IslHandle(const IslHandle&) = delete;
84 IslHandle& operator=(const IslHandle&) = delete;
85
86 IslHandle(IslHandle&& other) noexcept : ptr_(other.ptr_) {
87 other.ptr_ = nullptr;
88 }
89 IslHandle& operator=(IslHandle&& other) noexcept {
90 if (this != &other) {
91 reset();
92 ptr_ = other.ptr_;
93 other.ptr_ = nullptr;
94 }
95 return *this;
96 }
97
99 T* get() const {
100 return ptr_;
101 }
102
105 T* release() {
106 T* p = ptr_;
107 ptr_ = nullptr;
108 return p;
109 }
110
112 void reset(T* p = nullptr) {
113 if (ptr_ != nullptr) {
114 FreeFn(ptr_);
115 }
116 ptr_ = p;
117 }
118
119 explicit operator bool() const {
120 return ptr_ != nullptr;
121 }
122
123private:
124 T* ptr_;
125};
126
130
149bool equal_on_domain(const MultiExpression& f, const MultiExpression& g, const Symbol indvar, const Assumptions& assums);
150
151} // namespace polyhedral
152} // namespace symbolic
153} // namespace sdfg
Symbol assumptions for reasoning about bounds, constness, and evolution.
Map from symbols to their assumptions.
Definition assumptions.h:313
IslCtx & operator=(const IslCtx &)=delete
IslCtx(IslCtx &&other) noexcept
IslCtx(const IslCtx &)=delete
IslCtx & operator=(IslCtx &&other) noexcept
isl_ctx * get() const
Definition polyhedral.h:55
Move-only RAII owner of a reference-counted ISL object.
Definition polyhedral.h:73
IslHandle(IslHandle &&other) noexcept
Definition polyhedral.h:86
T * get() const
Borrow the raw pointer without transferring ownership.
Definition polyhedral.h:99
void reset(T *p=nullptr)
Free the current object (if any) and adopt p.
Definition polyhedral.h:112
IslHandle()
Definition polyhedral.h:75
IslHandle(const IslHandle &)=delete
IslHandle(T *ptr)
Definition polyhedral.h:77
~IslHandle()
Definition polyhedral.h:79
IslHandle & operator=(const IslHandle &)=delete
T * release()
Relinquish ownership to the caller (e.g.
Definition polyhedral.h:105
IslHandle & operator=(IslHandle &&other) noexcept
Definition polyhedral.h:89
std::vector< Expression > MultiExpression
Vector of symbolic expressions for multi-dimensional operations.
Definition symbolic.h:89
SymEngine::RCP< const SymEngine::Symbol > Symbol
Reference-counted pointer to a SymEngine Symbol.
Definition symbolic.h:71
Definition polyhedral.h:35
bool equal_on_domain(const MultiExpression &f, const MultiExpression &g, const Symbol indvar, const Assumptions &assums)
Decides whether two access expressions denote the same cell at every point of the domain implied by a...
IslHandle< isl_space, isl_space_free > IslSpace
Definition polyhedral.h:129
IslHandle< isl_set, isl_set_free > IslSet
Definition polyhedral.h:128
IslHandle< isl_map, isl_map_free > IslMap
Definition polyhedral.h:127
Definition assumptions.h:55
Definition analysis.h:7
Symbolic system for integer-based symbol analysis.