-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSchedule.hpp
More file actions
104 lines (90 loc) · 2.72 KB
/
Schedule.hpp
File metadata and controls
104 lines (90 loc) · 2.72 KB
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_IMPL_H
#define ISL_CXX_Schedule_IMPL_H
#include "isl/Schedule.h"
#include "isl/ScheduleNode.hpp"
#include "isl/UnionMap.hpp"
#include "isl/UnionPwMultiAff.hpp"
#include "isl/Ctx.hpp"
#include "isl/Format.h"
#include "isl/IslBase.h"
#include "isl/IslException.h"
#include "isl/band.h"
#include <string>
#include <cassert>
namespace isl {
inline std::shared_ptr<isl::Schedule::ptr> Schedule::GetCopy() const {
return Schedule::This;
}
inline Schedule Schedule::readFromStr(const Ctx &ctx, std::string str) {
const Ctx &_ctx = ctx.Context();
_ctx.lock();
isl_schedule *That = isl_schedule_read_from_str((ctx.Get()), str.c_str());
_ctx.unlock();
if (_ctx.hasError()) {
handleError("isl_schedule_read_from_str returned a NULL pointer.");
}
return Schedule(_ctx, That);
}
/// rief Release ownership of the wrapped object.
///
/// You are on your own now buddy.
/// The wrapper cannot be used anymore after calling Give()
///
///@return the wrapped isl object.
inline isl_schedule *Schedule::Give() {
isl_schedule *res = This.get()->p;
This.get()->p = nullptr;
This.reset();
return res;
}
/// \brief Unwrap the stored isl object.
/// \returns A the wrapped isl object.
inline isl_schedule *Schedule::Get() const { return (isl_schedule *)This.get()->p;
}
inline int Schedule::foreachBand(const std::function<int(isl_band *, void *)> && fn, void * user) const {
ctx.lock();
int res = isl_schedule_foreach_band((*this).Get(), get_fn_ptr<14>(fn), user);
ctx.unlock();
return res;
}
inline UnionMap Schedule::getMap() const {
ctx.lock();
isl_union_map * res = isl_schedule_get_map((*this).Get());
ctx.unlock();
if (ctx.hasError()) {
handleError("isl_schedule_get_map returned a NULL pointer.");
}
return UnionMap(ctx, res);
}
inline ScheduleNode Schedule::getRoot() const {
ctx.lock();
isl_schedule_node * res = isl_schedule_get_root((*this).Get());
ctx.unlock();
if (ctx.hasError()) {
handleError("isl_schedule_get_root returned a NULL pointer.");
}
return ScheduleNode(ctx, res);
}
inline Schedule Schedule::pullbackUnionPwMultiAff(const UnionPwMultiAff &upma) const {
ctx.lock();
isl_schedule * res = isl_schedule_pullback_union_pw_multi_aff((*this).Get(), (upma).GetCopy());
ctx.unlock();
if (ctx.hasError()) {
handleError("isl_schedule_pullback_union_pw_multi_aff returned a NULL pointer.");
}
return Schedule(ctx, res);
}
inline std::string Schedule::toStr() const {
ctx.lock();
char * res = isl_schedule_to_str((*this).Get());
ctx.unlock();
std::string res_;
if (ctx.hasError()) {
handleError("isl_schedule_to_str returned a NULL pointer.");
}
res_ = res;
free((void *)res);
return res_;
}
} // namespace isl
#endif //ISL_CXX_Schedule_IMPL_H