Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:48:20

0001 //===------ ISLOperators.h --------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Operator overloads for isl C++ objects.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef POLLY_ISLOPERATORS_H
0014 #define POLLY_ISLOPERATORS_H
0015 
0016 #include "isl/isl-noexceptions.h"
0017 
0018 namespace polly {
0019 
0020 /// Addition
0021 /// @{
0022 inline isl::pw_aff operator+(isl::pw_aff Left, isl::pw_aff Right) {
0023   return Left.add(Right);
0024 }
0025 
0026 inline isl::pw_aff operator+(isl::val ValLeft, isl::pw_aff Right) {
0027   isl::pw_aff Left(Right.domain(), ValLeft);
0028   return Left.add(Right);
0029 }
0030 
0031 inline isl::pw_aff operator+(isl::pw_aff Left, isl::val ValRight) {
0032   isl::pw_aff Right(Left.domain(), ValRight);
0033   return Left.add(Right);
0034 }
0035 
0036 inline isl::pw_aff operator+(long IntLeft, isl::pw_aff Right) {
0037   isl::ctx Ctx = Right.ctx();
0038   isl::val ValLeft(Ctx, IntLeft);
0039   isl::pw_aff Left(Right.domain(), ValLeft);
0040   return Left.add(Right);
0041 }
0042 
0043 inline isl::pw_aff operator+(isl::pw_aff Left, long IntRight) {
0044   isl::ctx Ctx = Left.ctx();
0045   isl::val ValRight(Ctx, IntRight);
0046   isl::pw_aff Right(Left.domain(), ValRight);
0047   return Left.add(Right);
0048 }
0049 /// @}
0050 
0051 /// Multiplication
0052 /// @{
0053 inline isl::pw_aff operator*(isl::pw_aff Left, isl::pw_aff Right) {
0054   return Left.mul(Right);
0055 }
0056 
0057 inline isl::pw_aff operator*(isl::val ValLeft, isl::pw_aff Right) {
0058   isl::pw_aff Left(Right.domain(), ValLeft);
0059   return Left.mul(Right);
0060 }
0061 
0062 inline isl::pw_aff operator*(isl::pw_aff Left, isl::val ValRight) {
0063   isl::pw_aff Right(Left.domain(), ValRight);
0064   return Left.mul(Right);
0065 }
0066 
0067 inline isl::pw_aff operator*(long IntLeft, isl::pw_aff Right) {
0068   isl::ctx Ctx = Right.ctx();
0069   isl::val ValLeft(Ctx, IntLeft);
0070   isl::pw_aff Left(Right.domain(), ValLeft);
0071   return Left.mul(Right);
0072 }
0073 
0074 inline isl::pw_aff operator*(isl::pw_aff Left, long IntRight) {
0075   isl::ctx Ctx = Left.ctx();
0076   isl::val ValRight(Ctx, IntRight);
0077   isl::pw_aff Right(Left.domain(), ValRight);
0078   return Left.mul(Right);
0079 }
0080 /// @}
0081 
0082 /// Subtraction
0083 /// @{
0084 inline isl::pw_aff operator-(isl::pw_aff Left, isl::pw_aff Right) {
0085   return Left.sub(Right);
0086 }
0087 
0088 inline isl::pw_aff operator-(isl::val ValLeft, isl::pw_aff Right) {
0089   isl::pw_aff Left(Right.domain(), ValLeft);
0090   return Left.sub(Right);
0091 }
0092 
0093 inline isl::pw_aff operator-(isl::pw_aff Left, isl::val ValRight) {
0094   isl::pw_aff Right(Left.domain(), ValRight);
0095   return Left.sub(Right);
0096 }
0097 
0098 inline isl::pw_aff operator-(long IntLeft, isl::pw_aff Right) {
0099   isl::ctx Ctx = Right.ctx();
0100   isl::val ValLeft(Ctx, IntLeft);
0101   isl::pw_aff Left(Right.domain(), ValLeft);
0102   return Left.sub(Right);
0103 }
0104 
0105 inline isl::pw_aff operator-(isl::pw_aff Left, long IntRight) {
0106   isl::ctx Ctx = Left.ctx();
0107   isl::val ValRight(Ctx, IntRight);
0108   isl::pw_aff Right(Left.domain(), ValRight);
0109   return Left.sub(Right);
0110 }
0111 /// @}
0112 
0113 /// Division
0114 ///
0115 /// This division rounds towards zero. This follows the semantics of C/C++.
0116 ///
0117 /// @{
0118 inline isl::pw_aff operator/(isl::pw_aff Left, isl::pw_aff Right) {
0119   return Left.tdiv_q(Right);
0120 }
0121 
0122 inline isl::pw_aff operator/(isl::val ValLeft, isl::pw_aff Right) {
0123   isl::pw_aff Left(Right.domain(), ValLeft);
0124   return Left.tdiv_q(Right);
0125 }
0126 
0127 inline isl::pw_aff operator/(isl::pw_aff Left, isl::val ValRight) {
0128   isl::pw_aff Right(Left.domain(), ValRight);
0129   return Left.tdiv_q(Right);
0130 }
0131 
0132 inline isl::pw_aff operator/(long IntLeft, isl::pw_aff Right) {
0133   isl::ctx Ctx = Right.ctx();
0134   isl::val ValLeft(Ctx, IntLeft);
0135   isl::pw_aff Left(Right.domain(), ValLeft);
0136   return Left.tdiv_q(Right);
0137 }
0138 
0139 inline isl::pw_aff operator/(isl::pw_aff Left, long IntRight) {
0140   isl::ctx Ctx = Left.ctx();
0141   isl::val ValRight(Ctx, IntRight);
0142   isl::pw_aff Right(Left.domain(), ValRight);
0143   return Left.tdiv_q(Right);
0144 }
0145 /// @}
0146 
0147 /// Remainder
0148 ///
0149 /// This is the remainder of a division which rounds towards zero. This follows
0150 /// the semantics of C/C++.
0151 ///
0152 /// @{
0153 inline isl::pw_aff operator%(isl::pw_aff Left, isl::pw_aff Right) {
0154   return Left.tdiv_r(Right);
0155 }
0156 
0157 inline isl::pw_aff operator%(isl::val ValLeft, isl::pw_aff Right) {
0158   isl::pw_aff Left(Right.domain(), ValLeft);
0159   return Left.tdiv_r(Right);
0160 }
0161 
0162 inline isl::pw_aff operator%(isl::pw_aff Left, isl::val ValRight) {
0163   isl::pw_aff Right(Left.domain(), ValRight);
0164   return Left.tdiv_r(Right);
0165 }
0166 
0167 inline isl::pw_aff operator%(long IntLeft, isl::pw_aff Right) {
0168   isl::ctx Ctx = Right.ctx();
0169   isl::val ValLeft(Ctx, IntLeft);
0170   isl::pw_aff Left(Right.domain(), ValLeft);
0171   return Left.tdiv_r(Right);
0172 }
0173 
0174 inline isl::pw_aff operator%(isl::pw_aff Left, long IntRight) {
0175   isl::ctx Ctx = Left.ctx();
0176   isl::val ValRight(Ctx, IntRight);
0177   isl::pw_aff Right(Left.domain(), ValRight);
0178   return Left.tdiv_r(Right);
0179 }
0180 /// @}
0181 
0182 } // namespace polly
0183 
0184 #endif // POLLY_ISLOPERATORS_H