forked from simbuerg/isl-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Schedule.h
104 lines (90 loc) · 2.66 KB
/
Schedule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef ISL_CXX_Schedule_H
#define ISL_CXX_Schedule_H
#include "isl/schedule.h"
#include "isl/Ctx.h"
#include "isl/Format.h"
#include "isl/IslBase.h"
#include "isl/IslException.h"
#include "isl/band.h"
#include <string>
#include "isl/IslFnPtr.h"
namespace isl {
class ScheduleNode;
class UnionMap;
class UnionPwMultiAff;
class Schedule {
struct ptr {
isl_schedule *p;
explicit ptr(isl_schedule *p) : p(p) {}
~ptr() {
isl_schedule_free(p);
}
ptr(const ptr &other) = delete;
ptr &operator=(const ptr &other) = delete;
ptr(ptr && other) = delete;
ptr &operator=(ptr && other) = delete;
};
protected:
Ctx ctx;
std::shared_ptr<ptr> This;
public:
explicit Schedule(Ctx ctx, isl_schedule *That) : ctx(ctx), This(std::make_shared<ptr>(That)) {}
Schedule() : ctx(Ctx(nullptr)), This(nullptr) {}
const Ctx &Context() const { return ctx; }
std::shared_ptr<isl::Schedule::ptr> GetCopy() const;
/// \brief Release ownership of the wrapped object.
///
/// You are on your own now buddy.
/// The wrapper cannot be used anymore after calling Give()
///
/// \returns the wrapped isl object.
__isl_give isl_schedule *Give();
/// \brief unwrap the stored isl object.
/// \return a the wrapped isl object.
__isl_give isl_schedule *Get() const;
/// \brief Constructor for isl_schedule_read_from_str
///
/// \param ctx
/// \param str
static Schedule readFromStr(const Ctx &ctx, std::string str);
public:
virtual ~Schedule() = default;
/// \brief Generated from ::<isl_schedule_foreach_band>
///
/// \param [in] fn
/// \param [in] user
///
/// \returns A new int
int foreachBand(const std::function<int(isl_band *, void *)> && fn, void * user) const;
/// \brief Generated from ::<isl_schedule_get_map>
///
///
/// \returns A new UnionMap
UnionMap getMap() const;
/// \brief Generated from ::<isl_schedule_get_root>
///
///
/// \returns A new ScheduleNode
ScheduleNode getRoot() const;
/// \brief Generated from ::<isl_schedule_pullback_union_pw_multi_aff>
///
/// \param [in] upma
///
/// \returns A new Schedule
Schedule pullbackUnionPwMultiAff(const UnionPwMultiAff &upma) const;
/// \brief Generated from ::<isl_schedule_to_str>
///
///
/// \returns A new std::string
std::string toStr() const;
Schedule(const Schedule &Other) : ctx(Other.Context()), This(Other.GetCopy()) {}
Schedule &operator=(const Schedule &Other) = delete;
Schedule (Schedule && Other) : ctx(Other.Context()), This(Other.This) {}
Schedule &operator=(Schedule && Other) {
std::swap(This, Other.This);
ctx = Other.Context();
return *this;
}
};
} // namespace isl
#endif //ISL_CXX_Schedule_H