Polly 20.0.0git
ISLOperators.h
Go to the documentation of this file.
1//===------ ISLOperators.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Operator overloads for isl C++ objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef POLLY_ISLOPERATORS_H
14#define POLLY_ISLOPERATORS_H
15
17
18namespace polly {
19
20/// Addition
21/// @{
23 return Left.add(Right);
24}
25
26inline isl::pw_aff operator+(isl::val ValLeft, isl::pw_aff Right) {
27 isl::pw_aff Left(Right.domain(), ValLeft);
28 return Left.add(Right);
29}
30
31inline isl::pw_aff operator+(isl::pw_aff Left, isl::val ValRight) {
32 isl::pw_aff Right(Left.domain(), ValRight);
33 return Left.add(Right);
34}
35
36inline isl::pw_aff operator+(long IntLeft, isl::pw_aff Right) {
37 isl::ctx Ctx = Right.ctx();
38 isl::val ValLeft(Ctx, IntLeft);
39 isl::pw_aff Left(Right.domain(), ValLeft);
40 return Left.add(Right);
41}
42
43inline isl::pw_aff operator+(isl::pw_aff Left, long IntRight) {
44 isl::ctx Ctx = Left.ctx();
45 isl::val ValRight(Ctx, IntRight);
46 isl::pw_aff Right(Left.domain(), ValRight);
47 return Left.add(Right);
48}
49/// @}
50
51/// Multiplication
52/// @{
54 return Left.mul(Right);
55}
56
57inline isl::pw_aff operator*(isl::val ValLeft, isl::pw_aff Right) {
58 isl::pw_aff Left(Right.domain(), ValLeft);
59 return Left.mul(Right);
60}
61
62inline isl::pw_aff operator*(isl::pw_aff Left, isl::val ValRight) {
63 isl::pw_aff Right(Left.domain(), ValRight);
64 return Left.mul(Right);
65}
66
67inline isl::pw_aff operator*(long IntLeft, isl::pw_aff Right) {
68 isl::ctx Ctx = Right.ctx();
69 isl::val ValLeft(Ctx, IntLeft);
70 isl::pw_aff Left(Right.domain(), ValLeft);
71 return Left.mul(Right);
72}
73
74inline isl::pw_aff operator*(isl::pw_aff Left, long IntRight) {
75 isl::ctx Ctx = Left.ctx();
76 isl::val ValRight(Ctx, IntRight);
77 isl::pw_aff Right(Left.domain(), ValRight);
78 return Left.mul(Right);
79}
80/// @}
81
82/// Subtraction
83/// @{
85 return Left.sub(Right);
86}
87
88inline isl::pw_aff operator-(isl::val ValLeft, isl::pw_aff Right) {
89 isl::pw_aff Left(Right.domain(), ValLeft);
90 return Left.sub(Right);
91}
92
93inline isl::pw_aff operator-(isl::pw_aff Left, isl::val ValRight) {
94 isl::pw_aff Right(Left.domain(), ValRight);
95 return Left.sub(Right);
96}
97
98inline isl::pw_aff operator-(long IntLeft, isl::pw_aff Right) {
99 isl::ctx Ctx = Right.ctx();
100 isl::val ValLeft(Ctx, IntLeft);
101 isl::pw_aff Left(Right.domain(), ValLeft);
102 return Left.sub(Right);
103}
104
105inline isl::pw_aff operator-(isl::pw_aff Left, long IntRight) {
106 isl::ctx Ctx = Left.ctx();
107 isl::val ValRight(Ctx, IntRight);
108 isl::pw_aff Right(Left.domain(), ValRight);
109 return Left.sub(Right);
110}
111/// @}
112
113/// Division
114///
115/// This division rounds towards zero. This follows the semantics of C/C++.
116///
117/// @{
119 return Left.tdiv_q(Right);
120}
121
123 isl::pw_aff Left(Right.domain(), ValLeft);
124 return Left.tdiv_q(Right);
125}
126
128 isl::pw_aff Right(Left.domain(), ValRight);
129 return Left.tdiv_q(Right);
130}
131
132inline isl::pw_aff operator/(long IntLeft, isl::pw_aff Right) {
133 isl::ctx Ctx = Right.ctx();
134 isl::val ValLeft(Ctx, IntLeft);
135 isl::pw_aff Left(Right.domain(), ValLeft);
136 return Left.tdiv_q(Right);
137}
138
139inline isl::pw_aff operator/(isl::pw_aff Left, long IntRight) {
140 isl::ctx Ctx = Left.ctx();
141 isl::val ValRight(Ctx, IntRight);
142 isl::pw_aff Right(Left.domain(), ValRight);
143 return Left.tdiv_q(Right);
144}
145/// @}
146
147/// Remainder
148///
149/// This is the remainder of a division which rounds towards zero. This follows
150/// the semantics of C/C++.
151///
152/// @{
154 return Left.tdiv_r(Right);
155}
156
158 isl::pw_aff Left(Right.domain(), ValLeft);
159 return Left.tdiv_r(Right);
160}
161
163 isl::pw_aff Right(Left.domain(), ValRight);
164 return Left.tdiv_r(Right);
165}
166
167inline isl::pw_aff operator%(long IntLeft, isl::pw_aff Right) {
168 isl::ctx Ctx = Right.ctx();
169 isl::val ValLeft(Ctx, IntLeft);
170 isl::pw_aff Left(Right.domain(), ValLeft);
171 return Left.tdiv_r(Right);
172}
173
174inline isl::pw_aff operator%(isl::pw_aff Left, long IntRight) {
175 isl::ctx Ctx = Left.ctx();
176 isl::val ValRight(Ctx, IntRight);
177 isl::pw_aff Right(Left.domain(), ValRight);
178 return Left.tdiv_r(Right);
179}
180/// @}
181
182} // namespace polly
183
184#endif // POLLY_ISLOPERATORS_H
isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const
isl::set domain() const
isl::ctx ctx() const
isl::pw_aff tdiv_q(isl::pw_aff pa2) const
isl::pw_aff tdiv_r(isl::pw_aff pa2) const
isl::pw_aff mul(isl::pw_aff pwaff2) const
isl::multi_pw_aff add(const isl::multi_pw_aff &multi2) const
isl::pw_aff operator/(isl::pw_aff Left, isl::pw_aff Right)
Division.
Definition: ISLOperators.h:118
isl::pw_aff operator%(isl::pw_aff Left, isl::pw_aff Right)
Remainder.
Definition: ISLOperators.h:153
isl::pw_aff operator+(isl::pw_aff Left, isl::pw_aff Right)
Addition.
Definition: ISLOperators.h:22
isl::pw_aff operator-(isl::pw_aff Left, isl::pw_aff Right)
Subtraction.
Definition: ISLOperators.h:84
isl::pw_aff operator*(isl::pw_aff Left, isl::pw_aff Right)
Multiplication.
Definition: ISLOperators.h:53
static TupleKindPtr Ctx