Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  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.  
  16. #include "isl/isl-noexceptions.h"
  17.  
  18. namespace polly {
  19.  
  20. /// Addition
  21. /// @{
  22. inline isl::pw_aff operator+(isl::pw_aff Left, isl::pw_aff Right) {
  23.   return Left.add(Right);
  24. }
  25.  
  26. inline 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.  
  31. inline 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.  
  36. inline 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.  
  43. inline 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. /// @{
  53. inline isl::pw_aff operator*(isl::pw_aff Left, isl::pw_aff Right) {
  54.   return Left.mul(Right);
  55. }
  56.  
  57. inline 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.  
  62. inline 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.  
  67. inline 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.  
  74. inline 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. /// @{
  84. inline isl::pw_aff operator-(isl::pw_aff Left, isl::pw_aff Right) {
  85.   return Left.sub(Right);
  86. }
  87.  
  88. inline 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.  
  93. inline 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.  
  98. inline 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.  
  105. inline 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. /// @{
  118. inline isl::pw_aff operator/(isl::pw_aff Left, isl::pw_aff Right) {
  119.   return Left.tdiv_q(Right);
  120. }
  121.  
  122. inline isl::pw_aff operator/(isl::val ValLeft, isl::pw_aff Right) {
  123.   isl::pw_aff Left(Right.domain(), ValLeft);
  124.   return Left.tdiv_q(Right);
  125. }
  126.  
  127. inline isl::pw_aff operator/(isl::pw_aff Left, isl::val ValRight) {
  128.   isl::pw_aff Right(Left.domain(), ValRight);
  129.   return Left.tdiv_q(Right);
  130. }
  131.  
  132. inline 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.  
  139. inline 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. /// @{
  153. inline isl::pw_aff operator%(isl::pw_aff Left, isl::pw_aff Right) {
  154.   return Left.tdiv_r(Right);
  155. }
  156.  
  157. inline isl::pw_aff operator%(isl::val ValLeft, isl::pw_aff Right) {
  158.   isl::pw_aff Left(Right.domain(), ValLeft);
  159.   return Left.tdiv_r(Right);
  160. }
  161.  
  162. inline isl::pw_aff operator%(isl::pw_aff Left, isl::val ValRight) {
  163.   isl::pw_aff Right(Left.domain(), ValRight);
  164.   return Left.tdiv_r(Right);
  165. }
  166.  
  167. inline 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.  
  174. inline 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
  185.