diff --git a/.circleci/config.yml b/.circleci/config.yml index 7972c71f9..ae07bae7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,11 +9,11 @@ jobs: steps: - checkout - run: - name: conda_tapir_halide + name: conda_llvm_halide command: | . /opt/conda/anaconda/bin/activate source activate tc_build - conda install -y -c nicolasvasilache llvm-tapir50 halide + conda install -y -c nicolasvasilache llvm-trunk halide - run: name: check_formatting diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 7648102d5..b1d97f315 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,7 +2,7 @@ Tensor Comprehensions Github Issues Guidelines ---------------------------------------------- If you have a feature request or a bug report (build issue), please open an issue on Github and fill the template below so we can help you better and faster. If you have some general -questions about Tensor Comprehensions, please visit our [slack channel](https://tensorcomprehensions.herokuapp.com/) or email us at tensorcomp@fb.com +questions about Tensor Comprehensions, please email us at tensorcomp@fb.com For build issues, please add `[Build]` at the beginning of issue title. @@ -16,7 +16,7 @@ When submitting a bug report, please include the following information (where re - GCC/GXX version (if compiling from source): - LLVM/Tapir git hash used (if compiling from source): - To get the hash, run: `$HOME/clang+llvm-tapir5.0/bin/clang --version` + To get the hash, run: `$CONDA_PREFIX/bin/clang --version` - Commit hash of our repo and submodules (if compiling from source): diff --git a/.gitignore b/.gitignore index c57028a04..7ce0b55ab 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ __pycache__/ *~ build/* docs/build/* -tc/proto/*.py -tc/proto/*.cc -tc/proto/*.h third-party/*_cache third-party/llvm_sources* third-party-install/* @@ -17,8 +14,6 @@ conda */.nfs* tensor_comprehensions.egg-info/ tensor_comprehensions/version.py -tensor_comprehensions/*.proto -tensor_comprehensions/*_pb2.py slurm-* examples/results* *.pyc diff --git a/.jenkins/build.sh b/.jenkins/build.sh index e0e97bf8b..1aeba7681 100755 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -60,7 +60,7 @@ cd /var/lib/jenkins/workspace git submodule update --init --recursive source activate tc_build -conda install -y -c nicolasvasilache llvm-tapir50 halide +conda install -y -c nicolasvasilache llvm-trunk halide conda install -y -c conda-forge eigen conda install -y -c nicolasvasilache caffe2 diff --git a/CMakeLists.txt b/CMakeLists.txt index ef1ac6fcc..2dd1d46e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,6 @@ if(WITH_CUDA) find_package(CUDA REQUIRED) include_directories(BEFORE ${CUDA_TOOLKIT_ROOT_DIR}/include) - # modified CUB - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_CUDA -DCUDA_HOME=\"\\\"${CUDA_INCLUDE_DIRS}\\\"\" -DCUB_HOME=\"\\\"${CUB_INSTALL_DIR}\\\"\" ") - # Inherited from Torch, see # https://github.com/torch/cutorch/blob/master/lib/THC/cmake/select_compute_arch.cmake INCLUDE(cmake/select_compute_arch.cmake) @@ -226,13 +223,11 @@ message(STATUS "Found ATen.so file: ${ATEN_LIBRARIES}") ################################################################################ # isl ################################################################################ -set(ISL_INT "gmp" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") # use locally generated C++ bindings include_directories(AFTER ${PROJECT_SOURCE_DIR}/isl_interface/include) include_directories(AFTER ${PROJECT_SOURCE_DIR}/third-party/islpp/include) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/third-party/islpp/include) -add_subdirectory(third-party/islpp) -set(ISL_LIBRARIES isl-static) +add_subdirectory(external/isl) ################################################################################ # Halide @@ -261,6 +256,20 @@ include(cmake/GetGitRevisionDescription.cmake) ################################################################################ # Finally, build ################################################################################ +# Variables for tc_config.h.in +set(TC_DIR ${TC_DIR}) +execute_process(COMMAND ${CLANG_PREFIX}/bin/llvm-config --bindir OUTPUT_VARIABLE LLVM_BIN_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) +set(TC_LLVM_BIN_DIR ${LLVM_BIN_DIR}) +if (WITH_CUDA) + # CUDA-specific variables for tc_config.h.in + set(TC_WITH_CUDA 1) + set(TC_CUB_INCLUDE_DIR ${CUB_INSTALL_DIR}) + set(TC_CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) + set(TC_CUDA_INCLUDE_DIR ${CUDA_INCLUDE_DIRS}) +else() + set(TC_WITH_CUDA 0) +endif() +configure_file("tc/tc_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/tc/tc_config.h") ################################################################################ # Compile flags @@ -283,13 +292,12 @@ elseif(${CMAKE_BUILD_TYPE} MATCHES "Release") endif() message(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_DIR=\"\\\"${TC_DIR}\\\"\" ") - include_directories(BEFORE ${PROJECT_SOURCE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(tc) # At the moment pybind is only supported in CUDA mode and compilation fails -# for non-CUDA mode (CUDA_HOME and CUB_HOME undefined error). +# for non-CUDA mode (CUDA_INCLUDE_DIR and CUB_INCLUDE_DIR undefined error). # Once the core CPU mapper is stabilized we can worry about pybind, deactivate # conditionally for now if (WITH_CUDA) diff --git a/README.md b/README.md index b6384f964..5567b40ea 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ After a few generations of `autotuning` on a 2-GPU P100 system, we see results r ![Autotuning Sample](docs/source/_static/img/autotuning.png) -In C++ a minimal autotuning example resembles the [following](example/example_tensordot.cc): +In C++ a minimal autotuning example resembles the [following](tc/examples/tensordot.cc): ```cpp TEST(TensorDot, SimpleAutotune) { // 1. Define and setup the TC compilation unit with CUDA memory @@ -131,7 +131,6 @@ You can find documentation [here](https://facebookresearch.github.io/TensorCompr * **Email**: tensorcomp@fb.com * **GitHub issues**: bug reports, feature requests, install issues, RFCs, thoughts, etc. -* **Slack**: For discussion around framework integration, build support, collaboration, etc. join our slack channel https://tensorcomprehensions.herokuapp.com/. # Code of Conduct See the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file for more details. diff --git a/build.sh b/build.sh index 1d6a94d96..385b8639b 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -ex diff --git a/check_and_fix_format.sh b/check_and_fix_format.sh index b4252e7f0..3794839b1 100755 --- a/check_and_fix_format.sh +++ b/check_and_fix_format.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash CLANG=${CLANG:=clang-format-4.0} diff --git a/cmake/FindCuDNN.cmake b/cmake/FindCuDNN.cmake index bf6f1f4fe..f9cddd10e 100644 --- a/cmake/FindCuDNN.cmake +++ b/cmake/FindCuDNN.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # Taken from Caffe2 # - Try to find cuDNN @@ -52,4 +66,4 @@ if(CUDNN_FOUND) set(CUDNN_LIBRARIES ${CUDNN_LIBRARY}) message(STATUS "Found cuDNN: v${CUDNN_VERSION} (include: ${CUDNN_INCLUDE_DIR}, library: ${CUDNN_LIBRARY})") mark_as_advanced(CUDNN_ROOT_DIR CUDNN_LIBRARY CUDNN_INCLUDE_DIR) -endif() \ No newline at end of file +endif() diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index aa78ad8ff..8b9c4dd29 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # - Returns a version string from Git # # These functions force a re-configure on each git commit so that you can diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in index 6d8b708ef..88e6f36f6 100644 --- a/cmake/GetGitRevisionDescription.cmake.in +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # # Internal file for GetGitRevisionDescription.cmake # diff --git a/cmake/select_compute_arch.cmake b/cmake/select_compute_arch.cmake index 9334b0485..85902acb0 100644 --- a/cmake/select_compute_arch.cmake +++ b/cmake/select_compute_arch.cmake @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## # Synopsis: # CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures]) # -- Selects GPU arch flags for nvcc based on target_CUDA_architectures @@ -197,4 +211,4 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}") set(${out_variable} ${nvcc_flags} PARENT_SCOPE) set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE) -endfunction() \ No newline at end of file +endfunction() diff --git a/conda_recipes/README.md b/conda_recipes/README.md index 6f64d2075..6243852fc 100644 --- a/conda_recipes/README.md +++ b/conda_recipes/README.md @@ -17,7 +17,7 @@ nvidia-docker run --rm -i -t tc-cuda9.0-cudnn7.1-ubuntu16.04-devel We are ready to build conda package for TC. To simplify the build process we ship TC dependencies as conda packages. -We need to build packages for `llvm-tapir50`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`. +We need to build packages for `llvm-trunk`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`. For building each package, we need to specify a `build version`, `build number` and `git hash`. This information is used to build each package. diff --git a/conda_recipes/caffe2/build.sh b/conda_recipes/caffe2/build.sh index 17068db9e..e4c66bb78 100644 --- a/conda_recipes/caffe2/build.sh +++ b/conda_recipes/caffe2/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/conda_build_tc.sh b/conda_recipes/conda_build_tc.sh index 6d4f125cc..4ef3dd78c 100755 --- a/conda_recipes/conda_build_tc.sh +++ b/conda_recipes/conda_build_tc.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e @@ -28,27 +42,31 @@ time conda build -c $ANACONDA_USER --python 3.6 caffe2 echo "Caffe2 packaged Successfully" ############################################################################### -# LLVM_TAPIR settings -LLVM_TAPIR_BUILD_VERSION="1.0.0" -LLVM_TAPIR_BUILD_NUMBER=1 -LLVM_TAPIR_GIT_HASH="1482504e234a65bffc8c54de8de9fc877822345d" +# LLVM_TRUNK settings +LLVM_TRUNK_BUILD_VERSION="1.0.0" +LLVM_TRUNK_BUILD_NUMBER=1 +LLVM_TRUNK_SOURCE_DIR=$(mktemp -d /tmp/d.XXXXXX) +trap 'rm -rf "${LLVM_TRUNK_SOURCE_DIR}"' EXIT + +svn co http://llvm.org/svn/llvm-project/llvm/trunk ${LLVM_TRUNK_SOURCE_DIR} +svn co http://llvm.org/svn/llvm-project/cfe/trunk ${LLVM_TRUNK_SOURCE_DIR}/tools/clang -echo "Building llvm-tapir50" -echo "LLVM_TAPIR_BUILD_VERSION: $LLVM_TAPIR_BUILD_VERSION LLVM_TAPIR_BUILD_NUMBER: ${LLVM_TAPIR_BUILD_NUMBER}" +echo "Building llvm-trunk" +echo "LLVM_TRUNK_BUILD_VERSION: $LLVM_TRUNK_BUILD_VERSION LLVM_TRUNK_BUILD_NUMBER: ${LLVM_TRUNK_BUILD_NUMBER}" -export LLVM_TAPIR_BUILD_VERSION=$LLVM_TAPIR_BUILD_VERSION -export LLVM_TAPIR_BUILD_NUMBER=$LLVM_TAPIR_BUILD_NUMBER -export LLVM_TAPIR_GIT_HASH=$LLVM_TAPIR_GIT_HASH +export LLVM_TRUNK_BUILD_VERSION=$LLVM_TRUNK_BUILD_VERSION +export LLVM_TRUNK_BUILD_NUMBER=$LLVM_TRUNK_BUILD_NUMBER +export LLVM_TRUNK_SOURCE_DIR=$LLVM_TRUNK_SOURCE_DIR -time conda build -c $ANACONDA_USER --python 3.6 llvm-tapir50 +time conda build -c $ANACONDA_USER --python 3.6 llvm-trunk -echo "llvm-tapir50 packaged Successfully" +echo "llvm-trunk packaged Successfully" ############################################################################## # Halide settings HALIDE_BUILD_VERSION="1.0.0" -HALIDE_BUILD_NUMBER=0 -HALIDE_GIT_HASH="35be67b3a3e4c4461f79949109ff35c54cf307de" +HALIDE_BUILD_NUMBER=1 +HALIDE_GIT_HASH="0b29cacf636852933892bbaa61dd2050c8dcaff2" echo "Packaging HALIDE ==> HALIDE_BUILD_VERSION: ${HALIDE_BUILD_VERSION} HALIDE_BUILD_NUMBER: ${HALIDE_BUILD_NUMBER}" @@ -75,4 +93,3 @@ echo "HALIDE packaged Successfully" #time conda build -c $ANACONDA_USER --python 3.6 tensor_comprehensions # #echo "Tensor Comprehensions packaged Successfully" -# diff --git a/conda_recipes/halide/build.sh b/conda_recipes/halide/build.sh index da5dd1b0e..8fb3735af 100644 --- a/conda_recipes/halide/build.sh +++ b/conda_recipes/halide/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/halide/meta.yaml b/conda_recipes/halide/meta.yaml index b937193b5..61ff43826 100644 --- a/conda_recipes/halide/meta.yaml +++ b/conda_recipes/halide/meta.yaml @@ -8,10 +8,10 @@ source: requirements: build: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - cmake run: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - cmake build: diff --git a/conda_recipes/llvm-tapir50/build.sh b/conda_recipes/llvm-tapir50/build.sh index b42950e1e..37d4d31ec 100644 --- a/conda_recipes/llvm-tapir50/build.sh +++ b/conda_recipes/llvm-tapir50/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/llvm-trunk/build.sh b/conda_recipes/llvm-trunk/build.sh new file mode 100644 index 000000000..78f972ad0 --- /dev/null +++ b/conda_recipes/llvm-trunk/build.sh @@ -0,0 +1,76 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +#!/usr/bin/env bash + +set -e + +# code gets checked out at below: +# $SOURCE_DIR ===> /conda-bld/llvm-trunk_/work +# +# build directory gets created at $SOURCE_DIR/build +# +# CONDA environment for debugging: +# cd /conda-bld/llvm-trunk_ +# source activate ./_h_env_...... # long placeholders +# +# $CONDA_PREFIX and $PREFIX are set to the same value i.e. the environment value +# +# Installation happens in the $PREFIX which is the environment and rpath is set +# to that +# +# For tests, a new environment _test_env_.... is created +# During the tests, you will see that the llvm-trunk package gets checked out +# NOTE: once the build finished, the packaging and unpackaging step takes long +# and might seem like it's stuck but it's not. + +CMAKE_VERSION=${CMAKE_VERSION:="`which cmake3 || which cmake`"} +VERBOSE=${VERBOSE:=0} + +echo "CONDA_PREFIX: ${CONDA_PREFIX}" +echo "PREFIX: ${PREFIX}" + +echo "Building llvm-trunk conda package" + +echo "Clean up existing build packages if any" +rm -rf llvm_build || true + +mkdir -p llvm_build +cd llvm_build + +echo "Configuring llvm-trunk" +VERBOSE=${VERBOSE} ${CMAKE_VERSION} \ + -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DCOMPILER_RT_BUILD_CILKTOOLS=OFF \ + -DLLVM_ENABLE_CXX1Y=ON \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_BUILD_TESTS=OFF \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_OCAMLDOC=OFF \ + -DLLVM_INSTALL_OCAMLDOC_HTML_DIR=/tmp \ + -DLLVM_OCAML_INSTALL_PATH=/tmp \ + -DLLVM_ENABLE_RTTI=ON .. || exit 1 + +echo "Installing llvm-trunk" +VERBOSE=${VERBOSE} make -j"$(nproc)" -s || exit 1 + +VERBOSE=${VERBOSE} make install -j"$(nproc)" -s || exit 1 + +echo SUCCESS || echo FAILURE + +echo "Successfully built llvm-trunk conda package" diff --git a/conda_recipes/llvm-trunk/meta.yaml b/conda_recipes/llvm-trunk/meta.yaml new file mode 100644 index 000000000..4b37aebac --- /dev/null +++ b/conda_recipes/llvm-trunk/meta.yaml @@ -0,0 +1,33 @@ +package: + name: llvm-trunk + version: "{{ environ.get('LLVM_TRUNK_BUILD_VERSION') }}" + +source: + path: "{{ environ.get('LLVM_TRUNK_SOURCE_DIR') }}" + +requirements: + build: + - cmake + run: + - cmake + +build: + number: {{ environ.get('LLVM_TRUNK_BUILD_NUMBER') }} + skip: True # [win] + +test: + commands: + - $PREFIX/bin/llvm-config --libs + - $PREFIX/bin/llc -version + - test -f $PREFIX/include/llvm/Pass.h + - test -f $PREFIX/lib/libLLVMCore.a + + - $PREFIX/bin/clang --version + - $PREFIX/bin/clang++ --version + - $PREFIX/bin/clang-check --version + - test -f $PREFIX/include/clang/Lex/Lexer.h + - test -f $PREFIX/lib/libclangBasic.a + +extra: + recipe-maintainers: + - nicolasvasilache diff --git a/conda_recipes/tensor_comprehensions/build.sh b/conda_recipes/tensor_comprehensions/build.sh index fd7b6dc38..0f0d832a0 100755 --- a/conda_recipes/tensor_comprehensions/build.sh +++ b/conda_recipes/tensor_comprehensions/build.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env bash set -e diff --git a/conda_recipes/tensor_comprehensions/meta.yaml b/conda_recipes/tensor_comprehensions/meta.yaml index 90db013a9..e69ba0905 100644 --- a/conda_recipes/tensor_comprehensions/meta.yaml +++ b/conda_recipes/tensor_comprehensions/meta.yaml @@ -8,7 +8,7 @@ source: requirements: build: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - halide==1.0.0 - caffe2==1.0.0 - pytorch==0.4.0 @@ -17,7 +17,7 @@ requirements: - setuptools run: - - llvm-tapir50==1.0.0 + - llvm-trunk==1.0.0 - halide==1.0.0 - caffe2==1.0.0 - pytorch==0.4.0 diff --git a/docs/source/_static/css/tc_theme.css b/docs/source/_static/css/tc_theme.css index 46600755e..1d5085dda 100644 --- a/docs/source/_static/css/tc_theme.css +++ b/docs/source/_static/css/tc_theme.css @@ -1,3 +1,17 @@ +/* # Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################# */ body { font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif; } diff --git a/docs/source/conf.py b/docs/source/conf.py index 10fe9451a..b2b71c922 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/usr/bin/env python3 # -*- coding: utf-8 -*- # diff --git a/docs/source/contacts.rst b/docs/source/contacts.rst index fef45d711..d8c00d8b9 100644 --- a/docs/source/contacts.rst +++ b/docs/source/contacts.rst @@ -20,9 +20,3 @@ Contributions Want to contribute? Open a `pull request on Github `_. Don't forget to read the `contributor's instructions `_. Different parts of Tensor Comprehensions are managed by different people, make sure to tag the `code owners `_ of the part you are modifying. - - -Slack channel -------------- - -For a faster and tighter interaction, join our team on Slack: `TensorComprehensions.slack.com `_. diff --git a/docs/source/framework/pytorch_integration/writing_layers.rst b/docs/source/framework/pytorch_integration/writing_layers.rst index 67a847b30..ea536a0ca 100644 --- a/docs/source/framework/pytorch_integration/writing_layers.rst +++ b/docs/source/framework/pytorch_integration/writing_layers.rst @@ -200,7 +200,7 @@ functions. For example, assume one wants to use :code:`fmax` CUDA function in TC O = T.relu(torch.randn(100, 128, device='cuda')) TC only supports a subset of built-in CUDA functions. -Built-in functions supported in TC are listed in `this file `_. +Built-in functions supported in TC are listed in `this file `_. Documentation for these functions is available as part of the official `CUDA documentation `_. diff --git a/docs/source/installation.rst b/docs/source/installation.rst index bfe6f2a0b..0da17a4ba 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -66,14 +66,14 @@ Create a new environment in which TC will be built and install core dependencies conda create -y --name tc_build python=3.6 conda activate tc_build conda install -y pyyaml mkl-include pytest - conda install -y -c nicolasvasilache llvm-tapir50 halide + conda install -y -c nicolasvasilache llvm-trunk halide -Then install the PyTorch version that corresponds to your system binaries +Then install the PyTorch 0.4.0 version that corresponds to your system binaries (e.g. cuda 9.0): .. code-block:: bash - conda install -y -c pytorch pytorch torchvision cuda90 + conda install -y -c pytorch pytorch=0.4.0 torchvision cuda90 conda remove -y cudatoolkit --force .. note:: @@ -84,6 +84,12 @@ Then install the PyTorch version that corresponds to your system binaries libraries and we remove it explicitly. In a near future, the unified PyTorch + Caffe2 build system will link everything statically and stop pulling the cudatoolkit dependency. + + .. note:: + As of PyTorch 0.4.1, the ATen library is no shipped in libATen.so anymore. It is + now instead part of libcaffe2.so. In shipping binaries, the PyTorch team opted + to use the older GCC 4.9.2 C++ ABI. TC only supports the newer ABI. As a consequence + TC must link with the libraries provided by the `pytorch=0.4.0` package. Activate conda in your current terminal """""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/external/isl/CMakeLists.txt b/external/isl/CMakeLists.txt new file mode 100644 index 000000000..cb3f151ad --- /dev/null +++ b/external/isl/CMakeLists.txt @@ -0,0 +1,110 @@ +find_path(GMP_INCLUDE_DIR gmp.h) +find_library(GMP_LIBRARY NAMES gmp) + +set(ISL_SOURCE_DIR "${PROJECT_SOURCE_DIR}/third-party/islpp") + +set(ISL_SOURCES + ${ISL_SOURCE_DIR}/basis_reduction_tab.c + ${ISL_SOURCE_DIR}/isl_aff.c + ${ISL_SOURCE_DIR}/isl_aff_map.c + ${ISL_SOURCE_DIR}/isl_affine_hull.c + ${ISL_SOURCE_DIR}/isl_arg.c + ${ISL_SOURCE_DIR}/isl_ast_build.c + ${ISL_SOURCE_DIR}/isl_ast_build_expr.c + ${ISL_SOURCE_DIR}/isl_ast.c + ${ISL_SOURCE_DIR}/isl_ast_codegen.c + ${ISL_SOURCE_DIR}/isl_ast_graft.c + ${ISL_SOURCE_DIR}/isl_bernstein.c + ${ISL_SOURCE_DIR}/isl_blk.c + ${ISL_SOURCE_DIR}/isl_bound.c + ${ISL_SOURCE_DIR}/isl_box.c + ${ISL_SOURCE_DIR}/isl_coalesce.c + ${ISL_SOURCE_DIR}/isl_constraint.c + ${ISL_SOURCE_DIR}/isl_convex_hull.c + ${ISL_SOURCE_DIR}/isl_ctx.c + ${ISL_SOURCE_DIR}/isl_deprecated.c + ${ISL_SOURCE_DIR}/isl_dim_map.c + ${ISL_SOURCE_DIR}/isl_equalities.c + ${ISL_SOURCE_DIR}/isl_factorization.c + ${ISL_SOURCE_DIR}/isl_farkas.c + ${ISL_SOURCE_DIR}/isl_ffs.c + ${ISL_SOURCE_DIR}/isl_flow.c + ${ISL_SOURCE_DIR}/isl_fold.c + ${ISL_SOURCE_DIR}/isl_hash.c + ${ISL_SOURCE_DIR}/isl_id.c + ${ISL_SOURCE_DIR}/isl_id_to_ast_expr.c + ${ISL_SOURCE_DIR}/isl_id_to_id.c + ${ISL_SOURCE_DIR}/isl_id_to_pw_aff.c + ${ISL_SOURCE_DIR}/isl_ilp.c + ${ISL_SOURCE_DIR}/isl_input.c + ${ISL_SOURCE_DIR}/isl_local.c + ${ISL_SOURCE_DIR}/isl_local_space.c + ${ISL_SOURCE_DIR}/isl_lp.c + ${ISL_SOURCE_DIR}/isl_map.c + ${ISL_SOURCE_DIR}/isl_map_list.c + ${ISL_SOURCE_DIR}/isl_map_simplify.c + ${ISL_SOURCE_DIR}/isl_map_subtract.c + ${ISL_SOURCE_DIR}/isl_map_to_basic_set.c + ${ISL_SOURCE_DIR}/isl_mat.c + ${ISL_SOURCE_DIR}/isl_morph.c + ${ISL_SOURCE_DIR}/isl_obj.c + ${ISL_SOURCE_DIR}/isl_options.c + ${ISL_SOURCE_DIR}/isl_output.c + ${ISL_SOURCE_DIR}/isl_point.c + ${ISL_SOURCE_DIR}/isl_polynomial.c + ${ISL_SOURCE_DIR}/isl_printer.c + ${ISL_SOURCE_DIR}/isl_range.c + ${ISL_SOURCE_DIR}/isl_reordering.c + ${ISL_SOURCE_DIR}/isl_sample.c + ${ISL_SOURCE_DIR}/isl_scan.c + ${ISL_SOURCE_DIR}/isl_schedule.c + ${ISL_SOURCE_DIR}/isl_schedule_band.c + ${ISL_SOURCE_DIR}/isl_schedule_node.c + ${ISL_SOURCE_DIR}/isl_schedule_read.c + ${ISL_SOURCE_DIR}/isl_schedule_tree.c + ${ISL_SOURCE_DIR}/isl_scheduler.c + ${ISL_SOURCE_DIR}/isl_schedule_constraints.c + ${ISL_SOURCE_DIR}/isl_seq.c + ${ISL_SOURCE_DIR}/isl_set_list.c + ${ISL_SOURCE_DIR}/isl_sort.c + ${ISL_SOURCE_DIR}/isl_space.c + ${ISL_SOURCE_DIR}/isl_stream.c + ${ISL_SOURCE_DIR}/isl_stride.c + ${ISL_SOURCE_DIR}/isl_system.c + ${ISL_SOURCE_DIR}/isl_tab.c + ${ISL_SOURCE_DIR}/isl_tab_pip.c + ${ISL_SOURCE_DIR}/isl_tarjan.c + ${ISL_SOURCE_DIR}/isl_transitive_closure.c + ${ISL_SOURCE_DIR}/isl_union_map.c + ${ISL_SOURCE_DIR}/isl_val.c + ${ISL_SOURCE_DIR}/isl_vec.c + ${ISL_SOURCE_DIR}/isl_version.c + ${ISL_SOURCE_DIR}/isl_vertices.c + ${ISL_SOURCE_DIR}/print.c + ${ISL_SOURCE_DIR}/isl_gmp.c + ${ISL_SOURCE_DIR}/isl_val_gmp.c +) + +# The tc_isl library is included in the (shared) tc_core library. +add_library(tc_isl STATIC) +set_property(TARGET tc_isl PROPERTY POSITION_INDEPENDENT_CODE ON) +target_include_directories( + tc_isl + PRIVATE + ${PROJECT_SOURCE_DIR}/third-party/islpp + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${GMP_INCLUDE_DIR} +) +target_sources(tc_isl PRIVATE ${ISL_SOURCES}) +target_link_libraries(tc_isl ${GMP_LIBRARY}) + +# The following sets "gitversion.h" only at configure time. +# Since TC currently does not call isl_version(), +# it is not worth it to try and be more accurate. +execute_process( + COMMAND ${GIT_EXECUTABLE} describe + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third-party/islpp + OUTPUT_VARIABLE ISL_GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) +configure_file("gitversion.h.in" "gitversion.h") diff --git a/external/isl/gitversion.h.in b/external/isl/gitversion.h.in new file mode 100644 index 000000000..c3a36627e --- /dev/null +++ b/external/isl/gitversion.h.in @@ -0,0 +1,15 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################# +#define GIT_HEAD_ID "${ISL_GIT_VERSION}" diff --git a/external/isl/isl_config.h b/external/isl/isl_config.h new file mode 100644 index 000000000..f884c1677 --- /dev/null +++ b/external/isl/isl_config.h @@ -0,0 +1,38 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## +/* Hard-coded configuration variables. */ + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ /**/ + +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#define HAVE_DECL_FFS 1 + +/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRCASECMP 1 + +/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRNCASECMP 1 + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#define HAVE_DECL_SNPRINTF 1 + +/* use gmp to implement isl_int */ +#define USE_GMP_FOR_MP + +#include diff --git a/isl_interface/CMakeLists.txt b/isl_interface/CMakeLists.txt index 426ba1c9d..6ddb04b75 100644 --- a/isl_interface/CMakeLists.txt +++ b/isl_interface/CMakeLists.txt @@ -76,6 +76,7 @@ execute_process(COMMAND include_directories(.) add_executable(extract_isl_interface ${ISL_INTERFACE_DIR}/cpp.cc + ${ISL_INTERFACE_DIR}/cpp_conversion.cc ${ISL_INTERFACE_DIR}/extract_interface.cc ${ISL_INTERFACE_DIR}/generator.cc ${ISL_INTERFACE_DIR}/python.cc @@ -102,7 +103,7 @@ add_custom_command( COMMAND cat ${ISL_DIR}/cpp/cpp.h.pre >> ${ISL_CPP_H} || exit 1 COMMAND extract_isl_interface --language=cpp -I${ISL_DIR}/include ${ISL_DIR}/all.h - -I${CMAKE_CURRENT_LIST_DIR} >> ${ISL_CPP_H} || exit 1 + -I${CMAKE_CURRENT_LIST_DIR}/include >> ${ISL_CPP_H} || exit 1 COMMAND cat ${ISL_DIR}/cpp/cpp.h.bot >> ${ISL_CPP_H} || exit 1 DEPENDS extract_isl_interface ) diff --git a/isl_interface/include/isl/cpp.h b/isl_interface/include/isl/cpp.h index 21b11c778..d60fc4aa5 100644 --- a/isl_interface/include/isl/cpp.h +++ b/isl_interface/include/isl/cpp.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## /// These are automatically generated C++ bindings for isl. /// /// isl is a library for computing with integer sets and maps described by @@ -21,7 +35,6 @@ #include #include #include -#include #include #include @@ -33,6 +46,20 @@ #include #include +/* ISL_USE_EXCEPTIONS should be defined to 1 if exceptions are available. + * gcc and clang define __cpp_exceptions; MSVC and xlC define _CPPUNWIND. + * Older versions of gcc (e.g., 4.9) only define __EXCEPTIONS. + * If exceptions are not available, any error condition will result + * in an abort. + */ +#ifndef ISL_USE_EXCEPTIONS +#if defined(__cpp_exceptions) || defined(_CPPUNWIND) || defined(__EXCEPTIONS) +#define ISL_USE_EXCEPTIONS 1 +#else +#define ISL_USE_EXCEPTIONS 0 +#endif +#endif + namespace isl { class ctx { @@ -49,6 +76,20 @@ class ctx { } }; +/* Macros hiding try/catch. + * If exceptions are not available, then no exceptions will be thrown and + * there is nothing to catch. + */ +#if ISL_USE_EXCEPTIONS +#define ISL_CPP_TRY try +#define ISL_CPP_CATCH_ALL catch (...) +#else +#define ISL_CPP_TRY if (1) +#define ISL_CPP_CATCH_ALL if (0) +#endif + +#if ISL_USE_EXCEPTIONS + /* Class capturing isl errors. * * The what() return value is stored in a reference counted string @@ -68,10 +109,29 @@ class exception : public std::exception { } static inline exception create(enum isl_error error, const char *msg, const char *file, int line); - static inline exception create_from_last_error(isl::ctx ctx); + static inline exception create_from_last_error(ctx ctx); virtual const char *what() const noexcept { return what_str->c_str(); } + + /* Default behavior on error conditions that occur inside isl calls + * performed from inside the bindings. + * In the case exceptions are available, isl should continue + * without printing a warning since the warning message + * will be included in the exception thrown from inside the bindings. + */ + static constexpr auto on_error = ISL_ON_ERROR_CONTINUE; + /* Wrapper for throwing an exception with the given message. + */ + static void throw_invalid(const char *msg, const char *file, int line) { + throw create(isl_error_invalid, msg, file, line); + } + /* Wrapper for throwing an exception corresponding to the last + * error on "ctx". + */ + static void throw_last_error(ctx ctx) { + throw create_from_last_error(ctx); + } }; /* Create an exception of a type described by "what_arg", with @@ -154,7 +214,7 @@ exception exception::create(enum isl_error error, const char *msg, return exception_unsupported(msg, file, line); } - throw exception_invalid("invalid error type", __FILE__, __LINE__); + throw exception_invalid("invalid error type", file, line); } /* Create an exception from the last error that occurred on "ctx" and @@ -163,7 +223,7 @@ exception exception::create(enum isl_error error, const char *msg, * If "ctx" is NULL or if it is not in an error state at the start, * then an invalid argument exception is thrown. */ -exception exception::create_from_last_error(isl::ctx ctx) +exception exception::create_from_last_error(ctx ctx) { enum isl_error error; const char *msg, *file; @@ -178,6 +238,37 @@ exception exception::create_from_last_error(isl::ctx ctx) return create(error, msg, file, line); } +#else + +#include +#include + +class exception { +public: + /* Default behavior on error conditions that occur inside isl calls + * performed from inside the bindings. + * In the case exceptions are not available, isl should abort. + */ + static constexpr auto on_error = ISL_ON_ERROR_ABORT; + /* Wrapper for throwing an exception with the given message. + * In the case exceptions are not available, print an error and abort. + */ + static void throw_invalid(const char *msg, const char *file, int line) { + fprintf(stderr, "%s:%d: %s\n", file, line, msg); + abort(); + } + /* Wrapper for throwing an exception corresponding to the last + * error on "ctx". + * isl should already abort when an error condition occurs, + * so this function should never be called. + */ + static void throw_last_error(ctx ctx) { + abort(); + } +}; + +#endif + /* Helper class for setting the on_error and resetting the option * to the original value when leaving the scope. */ @@ -185,7 +276,7 @@ class options_scoped_set_on_error { isl_ctx *ctx; int saved_on_error; public: - options_scoped_set_on_error(isl::ctx ctx, int on_error) { + options_scoped_set_on_error(class ctx ctx, int on_error) { this->ctx = ctx.get(); saved_on_error = isl_options_get_on_error(this->ctx); isl_options_set_on_error(this->ctx, on_error); @@ -195,24 +286,6 @@ class options_scoped_set_on_error { } }; -enum class dim_type { - cst = isl_dim_cst, - param = isl_dim_param, - in = isl_dim_in, - out = isl_dim_out, - set = isl_dim_set, - div = isl_dim_div, - all = isl_dim_all -}; - -enum class ast_loop_type { - error = isl_ast_loop_error, - _default = isl_ast_loop_default, - atomic = isl_ast_loop_atomic, - unroll = isl_ast_loop_unroll, - separate = isl_ast_loop_separate -}; - } // namespace isl namespace isl { @@ -262,8 +335,6 @@ class basic_map; class basic_map_list; class basic_set; class basic_set_list; -class constraint; -class constraint_list; class fixed_box; class id; class id_list; @@ -309,12 +380,12 @@ class val; class val_list; // declarations for isl::aff -inline isl::aff manage(__isl_take isl_aff *ptr); -inline isl::aff manage_copy(__isl_keep isl_aff *ptr); +inline aff manage(__isl_take isl_aff *ptr); +inline aff manage_copy(__isl_keep isl_aff *ptr); class aff { - friend inline isl::aff manage(__isl_take isl_aff *ptr); - friend inline isl::aff manage_copy(__isl_keep isl_aff *ptr); + friend inline aff manage(__isl_take isl_aff *ptr); + friend inline aff manage_copy(__isl_keep isl_aff *ptr); protected: isl_aff *ptr = nullptr; @@ -323,12 +394,11 @@ class aff { public: inline /* implicit */ aff(); - inline /* implicit */ aff(const isl::aff &obj); - inline explicit aff(isl::local_space ls); - inline explicit aff(isl::local_space ls, isl::val val); - inline explicit aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos); - inline explicit aff(isl::ctx ctx, const std::string &str); - inline isl::aff &operator=(isl::aff obj); + inline /* implicit */ aff(const aff &obj); + inline explicit aff(local_space ls); + inline explicit aff(local_space ls, val val); + inline explicit aff(ctx ctx, const std::string &str); + inline aff &operator=(aff obj); inline ~aff(); inline __isl_give isl_aff *copy() const &; inline __isl_give isl_aff *copy() && = delete; @@ -336,51 +406,52 @@ class aff { inline __isl_give isl_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::aff add(isl::aff aff2) const; - inline isl::aff add_constant_si(int v) const; - inline isl::aff ceil() const; - inline isl::aff div(isl::aff aff2) const; - inline isl::set eq_set(isl::aff aff2) const; - inline isl::val eval(isl::point pnt) const; - inline isl::aff floor() const; - inline isl::set ge_set(isl::aff aff2) const; - inline isl::val get_constant_val() const; - inline isl::val get_denominator_val() const; - inline isl::aff get_div(int pos) const; - inline isl::local_space get_local_space() const; - inline isl::space get_space() const; - inline isl::set gt_set(isl::aff aff2) const; - inline isl::set le_set(isl::aff aff2) const; - inline isl::set lt_set(isl::aff aff2) const; - inline isl::aff mod(isl::val mod) const; - inline isl::aff mul(isl::aff aff2) const; - inline isl::set ne_set(isl::aff aff2) const; - inline isl::aff neg() const; - static inline isl::aff param_on_domain_space(isl::space space, isl::id id); - inline bool plain_is_equal(const isl::aff &aff2) const; - inline isl::aff project_domain_on_params() const; - inline isl::aff pullback(isl::multi_aff ma) const; - inline isl::aff scale(isl::val v) const; - inline isl::aff scale_down(isl::val v) const; - inline isl::aff scale_down_ui(unsigned int f) const; - inline isl::aff set_constant_si(int v) const; - inline isl::aff set_constant_val(isl::val v) const; - inline isl::aff sub(isl::aff aff2) const; - inline isl::aff unbind_params_insert_domain(isl::multi_id domain) const; - static inline isl::aff zero_on_domain(isl::space space); + inline aff add(aff aff2) const; + inline aff add_constant(val v) const; + inline aff add_constant_si(int v) const; + inline aff ceil() const; + inline aff div(aff aff2) const; + inline set eq_set(aff aff2) const; + inline val eval(point pnt) const; + inline aff floor() const; + inline set ge_set(aff aff2) const; + inline val get_constant_val() const; + inline val get_denominator_val() const; + inline aff get_div(int pos) const; + inline local_space get_local_space() const; + inline space get_space() const; + inline set gt_set(aff aff2) const; + inline set le_set(aff aff2) const; + inline set lt_set(aff aff2) const; + inline aff mod(val mod) const; + inline aff mul(aff aff2) const; + inline set ne_set(aff aff2) const; + inline aff neg() const; + static inline aff param_on_domain_space(space space, id id); + inline bool plain_is_equal(const aff &aff2) const; + inline aff project_domain_on_params() const; + inline aff pullback(multi_aff ma) const; + inline aff scale(val v) const; + inline aff scale_down(val v) const; + inline aff scale_down_ui(unsigned int f) const; + inline aff set_constant_si(int v) const; + inline aff set_constant_val(val v) const; + inline aff sub(aff aff2) const; + inline aff unbind_params_insert_domain(multi_id domain) const; + static inline aff zero_on_domain(space space); typedef isl_aff* isl_ptr_t; }; // declarations for isl::aff_list -inline isl::aff_list manage(__isl_take isl_aff_list *ptr); -inline isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr); +inline aff_list manage(__isl_take isl_aff_list *ptr); +inline aff_list manage_copy(__isl_keep isl_aff_list *ptr); class aff_list { - friend inline isl::aff_list manage(__isl_take isl_aff_list *ptr); - friend inline isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr); + friend inline aff_list manage(__isl_take isl_aff_list *ptr); + friend inline aff_list manage_copy(__isl_keep isl_aff_list *ptr); protected: isl_aff_list *ptr = nullptr; @@ -389,10 +460,10 @@ class aff_list { public: inline /* implicit */ aff_list(); - inline /* implicit */ aff_list(const isl::aff_list &obj); - inline explicit aff_list(isl::aff el); - inline explicit aff_list(isl::ctx ctx, int n); - inline isl::aff_list &operator=(isl::aff_list obj); + inline /* implicit */ aff_list(const aff_list &obj); + inline explicit aff_list(aff el); + inline explicit aff_list(ctx ctx, int n); + inline aff_list &operator=(aff_list obj); inline ~aff_list(); inline __isl_give isl_aff_list *copy() const &; inline __isl_give isl_aff_list *copy() && = delete; @@ -400,25 +471,25 @@ class aff_list { inline __isl_give isl_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::aff_list add(isl::aff el) const; - inline isl::aff_list concat(isl::aff_list list2) const; - inline isl::aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::aff get_at(int index) const; - inline isl::aff_list reverse() const; + inline ctx get_ctx() const; + + inline aff_list add(aff el) const; + inline aff_list concat(aff_list list2) const; + inline aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline aff get_at(int index) const; + inline aff_list reverse() const; inline int size() const; typedef isl_aff_list* isl_ptr_t; }; // declarations for isl::ast_build -inline isl::ast_build manage(__isl_take isl_ast_build *ptr); -inline isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr); +inline ast_build manage(__isl_take isl_ast_build *ptr); +inline ast_build manage_copy(__isl_keep isl_ast_build *ptr); class ast_build { - friend inline isl::ast_build manage(__isl_take isl_ast_build *ptr); - friend inline isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr); + friend inline ast_build manage(__isl_take isl_ast_build *ptr); + friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr); protected: isl_ast_build *ptr = nullptr; @@ -427,9 +498,9 @@ class ast_build { public: inline /* implicit */ ast_build(); - inline /* implicit */ ast_build(const isl::ast_build &obj); - inline explicit ast_build(isl::ctx ctx); - inline isl::ast_build &operator=(isl::ast_build obj); + inline /* implicit */ ast_build(const ast_build &obj); + inline explicit ast_build(ctx ctx); + inline ast_build &operator=(ast_build obj); inline ~ast_build(); inline __isl_give isl_ast_build *copy() const &; inline __isl_give isl_ast_build *copy() && = delete; @@ -437,42 +508,42 @@ class ast_build { inline __isl_give isl_ast_build *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; private: - inline isl::ast_build ©_callbacks(const isl::ast_build &obj); + inline ast_build ©_callbacks(const ast_build &obj); struct at_each_domain_data { - std::function func; + std::function func; std::exception_ptr eptr; }; std::shared_ptr at_each_domain_data; static inline isl_ast_node *at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2); - inline void set_at_each_domain_data(const std::function &fn); + inline void set_at_each_domain_data(const std::function &fn); public: - inline isl::ast_build set_at_each_domain(const std::function &fn) const; - inline isl::ast_expr access_from(isl::pw_multi_aff pma) const; - inline isl::ast_expr access_from(isl::multi_pw_aff mpa) const; - inline isl::ast_node ast_from_schedule(isl::union_map schedule) const; - inline isl::ast_expr call_from(isl::pw_multi_aff pma) const; - inline isl::ast_expr call_from(isl::multi_pw_aff mpa) const; - inline isl::ast_expr expr_from(isl::set set) const; - inline isl::ast_expr expr_from(isl::pw_aff pa) const; - static inline isl::ast_build from_context(isl::set set); - inline isl::union_map get_schedule() const; - inline isl::space get_schedule_space() const; - inline isl::ast_node node_from(isl::schedule schedule) const; - inline isl::ast_node node_from_schedule_map(isl::union_map schedule) const; - inline isl::ast_build set_iterators(isl::id_list iterators) const; + inline ast_build set_at_each_domain(const std::function &fn) const; + inline ast_expr access_from(pw_multi_aff pma) const; + inline ast_expr access_from(multi_pw_aff mpa) const; + inline ast_node ast_from_schedule(union_map schedule) const; + inline ast_expr call_from(pw_multi_aff pma) const; + inline ast_expr call_from(multi_pw_aff mpa) const; + inline ast_expr expr_from(set set) const; + inline ast_expr expr_from(pw_aff pa) const; + static inline ast_build from_context(set set); + inline union_map get_schedule() const; + inline space get_schedule_space() const; + inline ast_node node_from(schedule schedule) const; + inline ast_node node_from_schedule_map(union_map schedule) const; + inline ast_build set_iterators(id_list iterators) const; typedef isl_ast_build* isl_ptr_t; }; // declarations for isl::ast_expr -inline isl::ast_expr manage(__isl_take isl_ast_expr *ptr); -inline isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); +inline ast_expr manage(__isl_take isl_ast_expr *ptr); +inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); class ast_expr { - friend inline isl::ast_expr manage(__isl_take isl_ast_expr *ptr); - friend inline isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); + friend inline ast_expr manage(__isl_take isl_ast_expr *ptr); + friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr); protected: isl_ast_expr *ptr = nullptr; @@ -481,8 +552,8 @@ class ast_expr { public: inline /* implicit */ ast_expr(); - inline /* implicit */ ast_expr(const isl::ast_expr &obj); - inline isl::ast_expr &operator=(isl::ast_expr obj); + inline /* implicit */ ast_expr(const ast_expr &obj); + inline ast_expr &operator=(ast_expr obj); inline ~ast_expr(); inline __isl_give isl_ast_expr *copy() const &; inline __isl_give isl_ast_expr *copy() && = delete; @@ -492,11 +563,11 @@ class ast_expr { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline bool is_equal(const isl::ast_expr &expr2) const; - inline isl::ast_expr set_op_arg(int pos, isl::ast_expr arg) const; + inline bool is_equal(const ast_expr &expr2) const; + inline ast_expr set_op_arg(int pos, ast_expr arg) const; inline std::string to_C_str() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -513,12 +584,12 @@ class ast_expr_id : public ast_expr { public: inline /* implicit */ ast_expr_id(); - inline /* implicit */ ast_expr_id(const isl::ast_expr_id &obj); - inline isl::ast_expr_id &operator=(isl::ast_expr_id obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_expr_id(const ast_expr_id &obj); + inline ast_expr_id &operator=(ast_expr_id obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; + inline id get_id() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -534,12 +605,12 @@ class ast_expr_int : public ast_expr { public: inline /* implicit */ ast_expr_int(); - inline /* implicit */ ast_expr_int(const isl::ast_expr_int &obj); - inline isl::ast_expr_int &operator=(isl::ast_expr_int obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_expr_int(const ast_expr_int &obj); + inline ast_expr_int &operator=(ast_expr_int obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::val get_val() const; + inline val get_val() const; typedef isl_ast_expr* isl_ptr_t; }; @@ -555,25 +626,25 @@ class ast_expr_op : public ast_expr { public: inline /* implicit */ ast_expr_op(); - inline /* implicit */ ast_expr_op(const isl::ast_expr_op &obj); - inline isl::ast_expr_op &operator=(isl::ast_expr_op obj); + inline /* implicit */ ast_expr_op(const ast_expr_op &obj); + inline ast_expr_op &operator=(ast_expr_op obj); template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_arg(int pos) const; + inline ast_expr get_arg(int pos) const; inline int get_n_arg() const; typedef isl_ast_expr* isl_ptr_t; }; // declarations for isl::ast_node -inline isl::ast_node manage(__isl_take isl_ast_node *ptr); -inline isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr); +inline ast_node manage(__isl_take isl_ast_node *ptr); +inline ast_node manage_copy(__isl_keep isl_ast_node *ptr); class ast_node { - friend inline isl::ast_node manage(__isl_take isl_ast_node *ptr); - friend inline isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr); + friend inline ast_node manage(__isl_take isl_ast_node *ptr); + friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr); protected: isl_ast_node *ptr = nullptr; @@ -582,8 +653,8 @@ class ast_node { public: inline /* implicit */ ast_node(); - inline /* implicit */ ast_node(const isl::ast_node &obj); - inline isl::ast_node &operator=(isl::ast_node obj); + inline /* implicit */ ast_node(const ast_node &obj); + inline ast_node &operator=(ast_node obj); inline ~ast_node(); inline __isl_give isl_ast_node *copy() const &; inline __isl_give isl_ast_node *copy() && = delete; @@ -593,11 +664,11 @@ class ast_node { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_annotation() const; - inline isl::ast_node set_annotation(isl::id annotation) const; + inline id get_annotation() const; + inline ast_node set_annotation(id annotation) const; inline std::string to_C_str() const; typedef isl_ast_node* isl_ptr_t; }; @@ -614,12 +685,12 @@ class ast_node_block : public ast_node { public: inline /* implicit */ ast_node_block(); - inline /* implicit */ ast_node_block(const isl::ast_node_block &obj); - inline isl::ast_node_block &operator=(isl::ast_node_block obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_block(const ast_node_block &obj); + inline ast_node_block &operator=(ast_node_block obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_node_list get_children() const; + inline ast_node_list get_children() const; typedef isl_ast_node* isl_ptr_t; }; @@ -635,16 +706,16 @@ class ast_node_for : public ast_node { public: inline /* implicit */ ast_node_for(); - inline /* implicit */ ast_node_for(const isl::ast_node_for &obj); - inline isl::ast_node_for &operator=(isl::ast_node_for obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_for(const ast_node_for &obj); + inline ast_node_for &operator=(ast_node_for obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_node get_body() const; - inline isl::ast_expr get_cond() const; - inline isl::ast_expr get_inc() const; - inline isl::ast_expr get_init() const; - inline isl::ast_expr get_iterator() const; + inline ast_node get_body() const; + inline ast_expr get_cond() const; + inline ast_expr get_inc() const; + inline ast_expr get_init() const; + inline ast_expr get_iterator() const; inline bool is_coincident() const; inline bool is_degenerate() const; typedef isl_ast_node* isl_ptr_t; @@ -662,25 +733,25 @@ class ast_node_if : public ast_node { public: inline /* implicit */ ast_node_if(); - inline /* implicit */ ast_node_if(const isl::ast_node_if &obj); - inline isl::ast_node_if &operator=(isl::ast_node_if obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_if(const ast_node_if &obj); + inline ast_node_if &operator=(ast_node_if obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_cond() const; - inline isl::ast_node get_else() const; - inline isl::ast_node get_then() const; + inline ast_expr get_cond() const; + inline ast_node get_else() const; + inline ast_node get_then() const; inline bool has_else() const; typedef isl_ast_node* isl_ptr_t; }; // declarations for isl::ast_node_list -inline isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr); -inline isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); +inline ast_node_list manage(__isl_take isl_ast_node_list *ptr); +inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); class ast_node_list { - friend inline isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr); - friend inline isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); + friend inline ast_node_list manage(__isl_take isl_ast_node_list *ptr); + friend inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr); protected: isl_ast_node_list *ptr = nullptr; @@ -689,10 +760,10 @@ class ast_node_list { public: inline /* implicit */ ast_node_list(); - inline /* implicit */ ast_node_list(const isl::ast_node_list &obj); - inline explicit ast_node_list(isl::ast_node el); - inline explicit ast_node_list(isl::ctx ctx, int n); - inline isl::ast_node_list &operator=(isl::ast_node_list obj); + inline /* implicit */ ast_node_list(const ast_node_list &obj); + inline explicit ast_node_list(ast_node el); + inline explicit ast_node_list(ctx ctx, int n); + inline ast_node_list &operator=(ast_node_list obj); inline ~ast_node_list(); inline __isl_give isl_ast_node_list *copy() const &; inline __isl_give isl_ast_node_list *copy() && = delete; @@ -700,14 +771,14 @@ class ast_node_list { inline __isl_give isl_ast_node_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::ast_node_list add(isl::ast_node el) const; - inline isl::ast_node_list concat(isl::ast_node_list list2) const; - inline isl::ast_node_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::ast_node get_at(int index) const; - inline isl::ast_node_list reverse() const; + inline ctx get_ctx() const; + + inline ast_node_list add(ast_node el) const; + inline ast_node_list concat(ast_node_list list2) const; + inline ast_node_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline ast_node get_at(int index) const; + inline ast_node_list reverse() const; inline int size() const; typedef isl_ast_node_list* isl_ptr_t; }; @@ -724,13 +795,13 @@ class ast_node_mark : public ast_node { public: inline /* implicit */ ast_node_mark(); - inline /* implicit */ ast_node_mark(const isl::ast_node_mark &obj); - inline isl::ast_node_mark &operator=(isl::ast_node_mark obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_mark(const ast_node_mark &obj); + inline ast_node_mark &operator=(ast_node_mark obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; - inline isl::ast_node get_node() const; + inline id get_id() const; + inline ast_node get_node() const; typedef isl_ast_node* isl_ptr_t; }; @@ -746,12 +817,12 @@ class ast_node_user : public ast_node { public: inline /* implicit */ ast_node_user(); - inline /* implicit */ ast_node_user(const isl::ast_node_user &obj); - inline isl::ast_node_user &operator=(isl::ast_node_user obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_node_user(const ast_node_user &obj); + inline ast_node_user &operator=(ast_node_user obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::ast_expr get_expr() const; + inline ast_expr get_expr() const; typedef isl_ast_node* isl_ptr_t; }; @@ -767,9 +838,9 @@ class ast_op_access : public ast_expr_op { public: inline /* implicit */ ast_op_access(); - inline /* implicit */ ast_op_access(const isl::ast_op_access &obj); - inline isl::ast_op_access &operator=(isl::ast_op_access obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_access(const ast_op_access &obj); + inline ast_op_access &operator=(ast_op_access obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -787,9 +858,9 @@ class ast_op_add : public ast_expr_op { public: inline /* implicit */ ast_op_add(); - inline /* implicit */ ast_op_add(const isl::ast_op_add &obj); - inline isl::ast_op_add &operator=(isl::ast_op_add obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_add(const ast_op_add &obj); + inline ast_op_add &operator=(ast_op_add obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -807,9 +878,9 @@ class ast_op_address_of : public ast_expr_op { public: inline /* implicit */ ast_op_address_of(); - inline /* implicit */ ast_op_address_of(const isl::ast_op_address_of &obj); - inline isl::ast_op_address_of &operator=(isl::ast_op_address_of obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_address_of(const ast_op_address_of &obj); + inline ast_op_address_of &operator=(ast_op_address_of obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -827,9 +898,9 @@ class ast_op_and : public ast_expr_op { public: inline /* implicit */ ast_op_and(); - inline /* implicit */ ast_op_and(const isl::ast_op_and &obj); - inline isl::ast_op_and &operator=(isl::ast_op_and obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_and(const ast_op_and &obj); + inline ast_op_and &operator=(ast_op_and obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -847,9 +918,9 @@ class ast_op_and_then : public ast_expr_op { public: inline /* implicit */ ast_op_and_then(); - inline /* implicit */ ast_op_and_then(const isl::ast_op_and_then &obj); - inline isl::ast_op_and_then &operator=(isl::ast_op_and_then obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_and_then(const ast_op_and_then &obj); + inline ast_op_and_then &operator=(ast_op_and_then obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -867,9 +938,9 @@ class ast_op_call : public ast_expr_op { public: inline /* implicit */ ast_op_call(); - inline /* implicit */ ast_op_call(const isl::ast_op_call &obj); - inline isl::ast_op_call &operator=(isl::ast_op_call obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_call(const ast_op_call &obj); + inline ast_op_call &operator=(ast_op_call obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -887,9 +958,9 @@ class ast_op_cond : public ast_expr_op { public: inline /* implicit */ ast_op_cond(); - inline /* implicit */ ast_op_cond(const isl::ast_op_cond &obj); - inline isl::ast_op_cond &operator=(isl::ast_op_cond obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_cond(const ast_op_cond &obj); + inline ast_op_cond &operator=(ast_op_cond obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -907,9 +978,9 @@ class ast_op_div : public ast_expr_op { public: inline /* implicit */ ast_op_div(); - inline /* implicit */ ast_op_div(const isl::ast_op_div &obj); - inline isl::ast_op_div &operator=(isl::ast_op_div obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_div(const ast_op_div &obj); + inline ast_op_div &operator=(ast_op_div obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -927,9 +998,9 @@ class ast_op_eq : public ast_expr_op { public: inline /* implicit */ ast_op_eq(); - inline /* implicit */ ast_op_eq(const isl::ast_op_eq &obj); - inline isl::ast_op_eq &operator=(isl::ast_op_eq obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_eq(const ast_op_eq &obj); + inline ast_op_eq &operator=(ast_op_eq obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -947,9 +1018,9 @@ class ast_op_fdiv_q : public ast_expr_op { public: inline /* implicit */ ast_op_fdiv_q(); - inline /* implicit */ ast_op_fdiv_q(const isl::ast_op_fdiv_q &obj); - inline isl::ast_op_fdiv_q &operator=(isl::ast_op_fdiv_q obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_fdiv_q(const ast_op_fdiv_q &obj); + inline ast_op_fdiv_q &operator=(ast_op_fdiv_q obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -967,9 +1038,9 @@ class ast_op_ge : public ast_expr_op { public: inline /* implicit */ ast_op_ge(); - inline /* implicit */ ast_op_ge(const isl::ast_op_ge &obj); - inline isl::ast_op_ge &operator=(isl::ast_op_ge obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_ge(const ast_op_ge &obj); + inline ast_op_ge &operator=(ast_op_ge obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -987,9 +1058,9 @@ class ast_op_gt : public ast_expr_op { public: inline /* implicit */ ast_op_gt(); - inline /* implicit */ ast_op_gt(const isl::ast_op_gt &obj); - inline isl::ast_op_gt &operator=(isl::ast_op_gt obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_gt(const ast_op_gt &obj); + inline ast_op_gt &operator=(ast_op_gt obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1007,9 +1078,9 @@ class ast_op_le : public ast_expr_op { public: inline /* implicit */ ast_op_le(); - inline /* implicit */ ast_op_le(const isl::ast_op_le &obj); - inline isl::ast_op_le &operator=(isl::ast_op_le obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_le(const ast_op_le &obj); + inline ast_op_le &operator=(ast_op_le obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1027,9 +1098,9 @@ class ast_op_lt : public ast_expr_op { public: inline /* implicit */ ast_op_lt(); - inline /* implicit */ ast_op_lt(const isl::ast_op_lt &obj); - inline isl::ast_op_lt &operator=(isl::ast_op_lt obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_lt(const ast_op_lt &obj); + inline ast_op_lt &operator=(ast_op_lt obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1047,9 +1118,9 @@ class ast_op_max : public ast_expr_op { public: inline /* implicit */ ast_op_max(); - inline /* implicit */ ast_op_max(const isl::ast_op_max &obj); - inline isl::ast_op_max &operator=(isl::ast_op_max obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_max(const ast_op_max &obj); + inline ast_op_max &operator=(ast_op_max obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1067,9 +1138,9 @@ class ast_op_member : public ast_expr_op { public: inline /* implicit */ ast_op_member(); - inline /* implicit */ ast_op_member(const isl::ast_op_member &obj); - inline isl::ast_op_member &operator=(isl::ast_op_member obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_member(const ast_op_member &obj); + inline ast_op_member &operator=(ast_op_member obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1087,9 +1158,9 @@ class ast_op_min : public ast_expr_op { public: inline /* implicit */ ast_op_min(); - inline /* implicit */ ast_op_min(const isl::ast_op_min &obj); - inline isl::ast_op_min &operator=(isl::ast_op_min obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_min(const ast_op_min &obj); + inline ast_op_min &operator=(ast_op_min obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1107,9 +1178,9 @@ class ast_op_minus : public ast_expr_op { public: inline /* implicit */ ast_op_minus(); - inline /* implicit */ ast_op_minus(const isl::ast_op_minus &obj); - inline isl::ast_op_minus &operator=(isl::ast_op_minus obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_minus(const ast_op_minus &obj); + inline ast_op_minus &operator=(ast_op_minus obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1127,9 +1198,9 @@ class ast_op_mul : public ast_expr_op { public: inline /* implicit */ ast_op_mul(); - inline /* implicit */ ast_op_mul(const isl::ast_op_mul &obj); - inline isl::ast_op_mul &operator=(isl::ast_op_mul obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_mul(const ast_op_mul &obj); + inline ast_op_mul &operator=(ast_op_mul obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1147,9 +1218,9 @@ class ast_op_or : public ast_expr_op { public: inline /* implicit */ ast_op_or(); - inline /* implicit */ ast_op_or(const isl::ast_op_or &obj); - inline isl::ast_op_or &operator=(isl::ast_op_or obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_or(const ast_op_or &obj); + inline ast_op_or &operator=(ast_op_or obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1167,9 +1238,9 @@ class ast_op_or_else : public ast_expr_op { public: inline /* implicit */ ast_op_or_else(); - inline /* implicit */ ast_op_or_else(const isl::ast_op_or_else &obj); - inline isl::ast_op_or_else &operator=(isl::ast_op_or_else obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_or_else(const ast_op_or_else &obj); + inline ast_op_or_else &operator=(ast_op_or_else obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1187,9 +1258,9 @@ class ast_op_pdiv_q : public ast_expr_op { public: inline /* implicit */ ast_op_pdiv_q(); - inline /* implicit */ ast_op_pdiv_q(const isl::ast_op_pdiv_q &obj); - inline isl::ast_op_pdiv_q &operator=(isl::ast_op_pdiv_q obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_pdiv_q(const ast_op_pdiv_q &obj); + inline ast_op_pdiv_q &operator=(ast_op_pdiv_q obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1207,9 +1278,9 @@ class ast_op_pdiv_r : public ast_expr_op { public: inline /* implicit */ ast_op_pdiv_r(); - inline /* implicit */ ast_op_pdiv_r(const isl::ast_op_pdiv_r &obj); - inline isl::ast_op_pdiv_r &operator=(isl::ast_op_pdiv_r obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_pdiv_r(const ast_op_pdiv_r &obj); + inline ast_op_pdiv_r &operator=(ast_op_pdiv_r obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1227,9 +1298,9 @@ class ast_op_select : public ast_expr_op { public: inline /* implicit */ ast_op_select(); - inline /* implicit */ ast_op_select(const isl::ast_op_select &obj); - inline isl::ast_op_select &operator=(isl::ast_op_select obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_select(const ast_op_select &obj); + inline ast_op_select &operator=(ast_op_select obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1247,9 +1318,9 @@ class ast_op_sub : public ast_expr_op { public: inline /* implicit */ ast_op_sub(); - inline /* implicit */ ast_op_sub(const isl::ast_op_sub &obj); - inline isl::ast_op_sub &operator=(isl::ast_op_sub obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_sub(const ast_op_sub &obj); + inline ast_op_sub &operator=(ast_op_sub obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; @@ -1267,21 +1338,21 @@ class ast_op_zdiv_r : public ast_expr_op { public: inline /* implicit */ ast_op_zdiv_r(); - inline /* implicit */ ast_op_zdiv_r(const isl::ast_op_zdiv_r &obj); - inline isl::ast_op_zdiv_r &operator=(isl::ast_op_zdiv_r obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ ast_op_zdiv_r(const ast_op_zdiv_r &obj); + inline ast_op_zdiv_r &operator=(ast_op_zdiv_r obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_ast_expr* isl_ptr_t; }; // declarations for isl::basic_map -inline isl::basic_map manage(__isl_take isl_basic_map *ptr); -inline isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr); +inline basic_map manage(__isl_take isl_basic_map *ptr); +inline basic_map manage_copy(__isl_keep isl_basic_map *ptr); class basic_map { - friend inline isl::basic_map manage(__isl_take isl_basic_map *ptr); - friend inline isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr); + friend inline basic_map manage(__isl_take isl_basic_map *ptr); + friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr); protected: isl_basic_map *ptr = nullptr; @@ -1290,12 +1361,12 @@ class basic_map { public: inline /* implicit */ basic_map(); - inline /* implicit */ basic_map(const isl::basic_map &obj); - inline explicit basic_map(isl::ctx ctx, const std::string &str); - inline explicit basic_map(isl::basic_set domain, isl::basic_set range); - inline explicit basic_map(isl::aff aff); - inline explicit basic_map(isl::multi_aff maff); - inline isl::basic_map &operator=(isl::basic_map obj); + inline /* implicit */ basic_map(const basic_map &obj); + inline explicit basic_map(ctx ctx, const std::string &str); + inline explicit basic_map(basic_set domain, basic_set range); + inline explicit basic_map(aff aff); + inline explicit basic_map(multi_aff maff); + inline basic_map &operator=(basic_map obj); inline ~basic_map(); inline __isl_give isl_basic_map *copy() const &; inline __isl_give isl_basic_map *copy() && = delete; @@ -1303,53 +1374,49 @@ class basic_map { inline __isl_give isl_basic_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_map add_constraint(isl::constraint constraint) const; - inline isl::basic_map affine_hull() const; - inline isl::basic_map apply_domain(isl::basic_map bmap2) const; - inline isl::basic_map apply_range(isl::basic_map bmap2) const; + inline basic_map affine_hull() const; + inline basic_map apply_domain(basic_map bmap2) const; + inline basic_map apply_range(basic_map bmap2) const; inline bool can_curry() const; inline bool can_uncurry() const; - inline isl::basic_map curry() const; - inline isl::basic_set deltas() const; - inline isl::basic_map detect_equalities() const; - inline isl::basic_set domain() const; - static inline isl::basic_map empty(isl::space space); - inline isl::basic_map flatten() const; - inline isl::basic_map flatten_domain() const; - inline isl::basic_map flatten_range() const; - inline void foreach_constraint(const std::function &fn) const; - static inline isl::basic_map from_domain(isl::basic_set bset); - static inline isl::basic_map from_range(isl::basic_set bset); - inline isl::constraint_list get_constraint_list() const; - inline isl::space get_space() const; - inline isl::basic_map gist(isl::basic_map context) const; - inline isl::basic_map intersect(isl::basic_map bmap2) const; - inline isl::basic_map intersect_domain(isl::basic_set bset) const; - inline isl::basic_map intersect_range(isl::basic_set bset) const; + inline basic_map curry() const; + inline basic_set deltas() const; + inline basic_map detect_equalities() const; + inline basic_set domain() const; + static inline basic_map empty(space space); + inline basic_map flatten() const; + inline basic_map flatten_domain() const; + inline basic_map flatten_range() const; + static inline basic_map from_domain(basic_set bset); + static inline basic_map from_range(basic_set bset); + inline space get_space() const; + inline basic_map gist(basic_map context) const; + inline basic_map intersect(basic_map bmap2) const; + inline basic_map intersect_domain(basic_set bset) const; + inline basic_map intersect_range(basic_set bset) const; inline bool is_empty() const; - inline bool is_equal(const isl::basic_map &bmap2) const; - inline bool is_subset(const isl::basic_map &bmap2) const; - inline isl::map lexmax() const; - inline isl::map lexmin() const; - inline int n_constraint() const; - inline isl::basic_map reverse() const; - inline isl::basic_map sample() const; - inline isl::basic_map uncurry() const; - inline isl::map unite(isl::basic_map bmap2) const; - inline isl::basic_set wrap() const; + inline bool is_equal(const basic_map &bmap2) const; + inline bool is_subset(const basic_map &bmap2) const; + inline map lexmax() const; + inline map lexmin() const; + inline basic_map reverse() const; + inline basic_map sample() const; + inline basic_map uncurry() const; + inline map unite(basic_map bmap2) const; + inline basic_set wrap() const; typedef isl_basic_map* isl_ptr_t; }; // declarations for isl::basic_map_list -inline isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr); -inline isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); +inline basic_map_list manage(__isl_take isl_basic_map_list *ptr); +inline basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); class basic_map_list { - friend inline isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr); - friend inline isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); + friend inline basic_map_list manage(__isl_take isl_basic_map_list *ptr); + friend inline basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr); protected: isl_basic_map_list *ptr = nullptr; @@ -1358,10 +1425,10 @@ class basic_map_list { public: inline /* implicit */ basic_map_list(); - inline /* implicit */ basic_map_list(const isl::basic_map_list &obj); - inline explicit basic_map_list(isl::basic_map el); - inline explicit basic_map_list(isl::ctx ctx, int n); - inline isl::basic_map_list &operator=(isl::basic_map_list obj); + inline /* implicit */ basic_map_list(const basic_map_list &obj); + inline explicit basic_map_list(basic_map el); + inline explicit basic_map_list(ctx ctx, int n); + inline basic_map_list &operator=(basic_map_list obj); inline ~basic_map_list(); inline __isl_give isl_basic_map_list *copy() const &; inline __isl_give isl_basic_map_list *copy() && = delete; @@ -1369,26 +1436,26 @@ class basic_map_list { inline __isl_give isl_basic_map_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::basic_map_list add(isl::basic_map el) const; - inline isl::basic_map_list concat(isl::basic_map_list list2) const; - inline isl::basic_map_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::basic_map get_at(int index) const; - inline isl::basic_map intersect() const; - inline isl::basic_map_list reverse() const; + inline ctx get_ctx() const; + + inline basic_map_list add(basic_map el) const; + inline basic_map_list concat(basic_map_list list2) const; + inline basic_map_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline basic_map get_at(int index) const; + inline basic_map intersect() const; + inline basic_map_list reverse() const; inline int size() const; typedef isl_basic_map_list* isl_ptr_t; }; // declarations for isl::basic_set -inline isl::basic_set manage(__isl_take isl_basic_set *ptr); -inline isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr); +inline basic_set manage(__isl_take isl_basic_set *ptr); +inline basic_set manage_copy(__isl_keep isl_basic_set *ptr); class basic_set { - friend inline isl::basic_set manage(__isl_take isl_basic_set *ptr); - friend inline isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr); + friend inline basic_set manage(__isl_take isl_basic_set *ptr); + friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr); protected: isl_basic_set *ptr = nullptr; @@ -1397,10 +1464,10 @@ class basic_set { public: inline /* implicit */ basic_set(); - inline /* implicit */ basic_set(const isl::basic_set &obj); - inline /* implicit */ basic_set(isl::point pnt); - inline explicit basic_set(isl::ctx ctx, const std::string &str); - inline isl::basic_set &operator=(isl::basic_set obj); + inline /* implicit */ basic_set(const basic_set &obj); + inline /* implicit */ basic_set(point pnt); + inline explicit basic_set(ctx ctx, const std::string &str); + inline basic_set &operator=(basic_set obj); inline ~basic_set(); inline __isl_give isl_basic_set *copy() const &; inline __isl_give isl_basic_set *copy() && = delete; @@ -1408,54 +1475,49 @@ class basic_set { inline __isl_give isl_basic_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::basic_set add_constraint(isl::constraint constraint) const; - inline isl::basic_set affine_hull() const; - inline isl::basic_set apply(isl::basic_map bmap) const; - inline isl::set compute_divs() const; - inline isl::basic_set detect_equalities() const; - inline isl::val dim_max_val(int pos) const; - inline isl::basic_set flatten() const; - inline void foreach_constraint(const std::function &fn) const; - inline isl::basic_set from_params() const; - inline isl::constraint_list get_constraint_list() const; - inline isl::local_space get_local_space() const; - inline isl::space get_space() const; - inline isl::basic_set gist(isl::basic_set context) const; - inline isl::basic_set intersect(isl::basic_set bset2) const; - inline isl::basic_set intersect_params(isl::basic_set bset2) const; + inline basic_set affine_hull() const; + inline basic_set apply(basic_map bmap) const; + inline set compute_divs() const; + inline basic_set detect_equalities() const; + inline val dim_max_val(int pos) const; + inline basic_set flatten() const; + inline basic_set from_params() const; + inline space get_space() const; + inline basic_set gist(basic_set context) const; + inline basic_set intersect(basic_set bset2) const; + inline basic_set intersect_params(basic_set bset2) const; inline bool is_empty() const; - inline bool is_equal(const isl::basic_set &bset2) const; - inline bool is_subset(const isl::basic_set &bset2) const; + inline bool is_equal(const basic_set &bset2) const; + inline bool is_subset(const basic_set &bset2) const; inline bool is_universe() const; inline bool is_wrapping() const; - inline isl::set lexmax() const; - inline isl::set lexmin() const; - inline isl::val max_val(const isl::aff &obj) const; - inline int n_constraint() const; + inline set lexmax() const; + inline set lexmin() const; + inline val max_val(const aff &obj) const; inline unsigned int n_dim() const; inline unsigned int n_param() const; - static inline isl::basic_set nat_universe(isl::space dim); - inline isl::basic_set params() const; + static inline basic_set nat_universe(space dim); + inline basic_set params() const; inline bool plain_is_universe() const; - inline isl::basic_set sample() const; - inline isl::point sample_point() const; - inline isl::basic_set set_tuple_id(isl::id id) const; - inline isl::set unite(isl::basic_set bset2) const; - static inline isl::basic_set universe(isl::space space); - inline isl::basic_map unwrap() const; + inline basic_set sample() const; + inline point sample_point() const; + inline basic_set set_tuple_id(id id) const; + inline set unite(basic_set bset2) const; + static inline basic_set universe(space space); + inline basic_map unwrap() const; typedef isl_basic_set* isl_ptr_t; }; // declarations for isl::basic_set_list -inline isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr); -inline isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); +inline basic_set_list manage(__isl_take isl_basic_set_list *ptr); +inline basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); class basic_set_list { - friend inline isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr); - friend inline isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); + friend inline basic_set_list manage(__isl_take isl_basic_set_list *ptr); + friend inline basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr); protected: isl_basic_set_list *ptr = nullptr; @@ -1464,10 +1526,10 @@ class basic_set_list { public: inline /* implicit */ basic_set_list(); - inline /* implicit */ basic_set_list(const isl::basic_set_list &obj); - inline explicit basic_set_list(isl::basic_set el); - inline explicit basic_set_list(isl::ctx ctx, int n); - inline isl::basic_set_list &operator=(isl::basic_set_list obj); + inline /* implicit */ basic_set_list(const basic_set_list &obj); + inline explicit basic_set_list(basic_set el); + inline explicit basic_set_list(ctx ctx, int n); + inline basic_set_list &operator=(basic_set_list obj); inline ~basic_set_list(); inline __isl_give isl_basic_set_list *copy() const &; inline __isl_give isl_basic_set_list *copy() && = delete; @@ -1475,108 +1537,25 @@ class basic_set_list { inline __isl_give isl_basic_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::basic_set_list add(isl::basic_set el) const; - inline isl::basic_set_list concat(isl::basic_set_list list2) const; - inline isl::basic_set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::basic_set get_at(int index) const; - inline isl::basic_set_list reverse() const; + inline ctx get_ctx() const; + + inline basic_set_list add(basic_set el) const; + inline basic_set_list concat(basic_set_list list2) const; + inline basic_set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline basic_set get_at(int index) const; + inline basic_set_list reverse() const; inline int size() const; typedef isl_basic_set_list* isl_ptr_t; }; -// declarations for isl::constraint -inline isl::constraint manage(__isl_take isl_constraint *ptr); -inline isl::constraint manage_copy(__isl_keep isl_constraint *ptr); - -class constraint { - friend inline isl::constraint manage(__isl_take isl_constraint *ptr); - friend inline isl::constraint manage_copy(__isl_keep isl_constraint *ptr); - -protected: - isl_constraint *ptr = nullptr; - - inline explicit constraint(__isl_take isl_constraint *ptr); - -public: - inline /* implicit */ constraint(); - inline /* implicit */ constraint(const isl::constraint &obj); - inline isl::constraint &operator=(isl::constraint obj); - inline ~constraint(); - inline __isl_give isl_constraint *copy() const &; - inline __isl_give isl_constraint *copy() && = delete; - inline __isl_keep isl_constraint *get() const; - inline __isl_give isl_constraint *release(); - inline bool is_null() const; - inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - static inline isl::constraint alloc_equality(isl::local_space ls); - static inline isl::constraint alloc_inequality(isl::local_space ls); - inline int cmp_last_non_zero(const isl::constraint &c2) const; - inline int dim(enum isl::dim_type type) const; - inline isl::aff get_aff() const; - inline isl::val get_constant_val() const; - inline isl::aff get_div(int pos) const; - inline isl::local_space get_local_space() const; - inline isl::space get_space() const; - inline int is_div_constraint() const; - inline bool is_equal(const isl::constraint &constraint2) const; - inline bool is_equality() const; - inline int plain_cmp(const isl::constraint &c2) const; - inline isl::constraint set_coefficient_si(enum isl::dim_type type, int pos, int v) const; - inline isl::constraint set_constant_si(int v) const; - inline isl::constraint set_constant_val(isl::val v) const; - typedef isl_constraint* isl_ptr_t; -}; - -// declarations for isl::constraint_list -inline isl::constraint_list manage(__isl_take isl_constraint_list *ptr); -inline isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr); - -class constraint_list { - friend inline isl::constraint_list manage(__isl_take isl_constraint_list *ptr); - friend inline isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr); - -protected: - isl_constraint_list *ptr = nullptr; - - inline explicit constraint_list(__isl_take isl_constraint_list *ptr); - -public: - inline /* implicit */ constraint_list(); - inline /* implicit */ constraint_list(const isl::constraint_list &obj); - inline explicit constraint_list(isl::constraint el); - inline explicit constraint_list(isl::ctx ctx, int n); - inline isl::constraint_list &operator=(isl::constraint_list obj); - inline ~constraint_list(); - inline __isl_give isl_constraint_list *copy() const &; - inline __isl_give isl_constraint_list *copy() && = delete; - inline __isl_keep isl_constraint_list *get() const; - inline __isl_give isl_constraint_list *release(); - inline bool is_null() const; - inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::constraint_list add(isl::constraint el) const; - inline isl::constraint_list concat(isl::constraint_list list2) const; - inline isl::constraint_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::constraint get_at(int index) const; - inline isl::constraint_list reverse() const; - inline int size() const; - typedef isl_constraint_list* isl_ptr_t; -}; - // declarations for isl::fixed_box -inline isl::fixed_box manage(__isl_take isl_fixed_box *ptr); -inline isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); +inline fixed_box manage(__isl_take isl_fixed_box *ptr); +inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); class fixed_box { - friend inline isl::fixed_box manage(__isl_take isl_fixed_box *ptr); - friend inline isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); + friend inline fixed_box manage(__isl_take isl_fixed_box *ptr); + friend inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr); protected: isl_fixed_box *ptr = nullptr; @@ -1585,8 +1564,8 @@ class fixed_box { public: inline /* implicit */ fixed_box(); - inline /* implicit */ fixed_box(const isl::fixed_box &obj); - inline isl::fixed_box &operator=(isl::fixed_box obj); + inline /* implicit */ fixed_box(const fixed_box &obj); + inline fixed_box &operator=(fixed_box obj); inline ~fixed_box(); inline __isl_give isl_fixed_box *copy() const &; inline __isl_give isl_fixed_box *copy() && = delete; @@ -1594,22 +1573,22 @@ class fixed_box { inline __isl_give isl_fixed_box *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; - inline isl::multi_aff get_offset() const; - inline isl::multi_val get_size() const; - inline isl::space get_space() const; + inline multi_aff get_offset() const; + inline multi_val get_size() const; + inline space get_space() const; inline bool is_valid() const; typedef isl_fixed_box* isl_ptr_t; }; // declarations for isl::id -inline isl::id manage(__isl_take isl_id *ptr); -inline isl::id manage_copy(__isl_keep isl_id *ptr); +inline id manage(__isl_take isl_id *ptr); +inline id manage_copy(__isl_keep isl_id *ptr); class id { - friend inline isl::id manage(__isl_take isl_id *ptr); - friend inline isl::id manage_copy(__isl_keep isl_id *ptr); + friend inline id manage(__isl_take isl_id *ptr); + friend inline id manage_copy(__isl_keep isl_id *ptr); protected: isl_id *ptr = nullptr; @@ -1618,9 +1597,9 @@ class id { public: inline /* implicit */ id(); - inline /* implicit */ id(const isl::id &obj); - inline explicit id(isl::ctx ctx, const std::string &str); - inline isl::id &operator=(isl::id obj); + inline /* implicit */ id(const id &obj); + inline explicit id(ctx ctx, const std::string &str); + inline id &operator=(id obj); inline ~id(); inline __isl_give isl_id *copy() const &; inline __isl_give isl_id *copy() && = delete; @@ -1628,7 +1607,7 @@ class id { inline __isl_give isl_id *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; inline std::string get_name() const; @@ -1636,12 +1615,12 @@ class id { }; // declarations for isl::id_list -inline isl::id_list manage(__isl_take isl_id_list *ptr); -inline isl::id_list manage_copy(__isl_keep isl_id_list *ptr); +inline id_list manage(__isl_take isl_id_list *ptr); +inline id_list manage_copy(__isl_keep isl_id_list *ptr); class id_list { - friend inline isl::id_list manage(__isl_take isl_id_list *ptr); - friend inline isl::id_list manage_copy(__isl_keep isl_id_list *ptr); + friend inline id_list manage(__isl_take isl_id_list *ptr); + friend inline id_list manage_copy(__isl_keep isl_id_list *ptr); protected: isl_id_list *ptr = nullptr; @@ -1650,10 +1629,10 @@ class id_list { public: inline /* implicit */ id_list(); - inline /* implicit */ id_list(const isl::id_list &obj); - inline explicit id_list(isl::id el); - inline explicit id_list(isl::ctx ctx, int n); - inline isl::id_list &operator=(isl::id_list obj); + inline /* implicit */ id_list(const id_list &obj); + inline explicit id_list(id el); + inline explicit id_list(ctx ctx, int n); + inline id_list &operator=(id_list obj); inline ~id_list(); inline __isl_give isl_id_list *copy() const &; inline __isl_give isl_id_list *copy() && = delete; @@ -1661,25 +1640,25 @@ class id_list { inline __isl_give isl_id_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::id_list add(isl::id el) const; - inline isl::id_list concat(isl::id_list list2) const; - inline isl::id_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::id get_at(int index) const; - inline isl::id_list reverse() const; + inline ctx get_ctx() const; + + inline id_list add(id el) const; + inline id_list concat(id_list list2) const; + inline id_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline id get_at(int index) const; + inline id_list reverse() const; inline int size() const; typedef isl_id_list* isl_ptr_t; }; // declarations for isl::local_space -inline isl::local_space manage(__isl_take isl_local_space *ptr); -inline isl::local_space manage_copy(__isl_keep isl_local_space *ptr); +inline local_space manage(__isl_take isl_local_space *ptr); +inline local_space manage_copy(__isl_keep isl_local_space *ptr); class local_space { - friend inline isl::local_space manage(__isl_take isl_local_space *ptr); - friend inline isl::local_space manage_copy(__isl_keep isl_local_space *ptr); + friend inline local_space manage(__isl_take isl_local_space *ptr); + friend inline local_space manage_copy(__isl_keep isl_local_space *ptr); protected: isl_local_space *ptr = nullptr; @@ -1688,9 +1667,9 @@ class local_space { public: inline /* implicit */ local_space(); - inline /* implicit */ local_space(const isl::local_space &obj); - inline explicit local_space(isl::space dim); - inline isl::local_space &operator=(isl::local_space obj); + inline /* implicit */ local_space(const local_space &obj); + inline explicit local_space(space dim); + inline local_space &operator=(local_space obj); inline ~local_space(); inline __isl_give isl_local_space *copy() const &; inline __isl_give isl_local_space *copy() && = delete; @@ -1698,31 +1677,31 @@ class local_space { inline __isl_give isl_local_space *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::local_space domain() const; - inline isl::local_space flatten_domain() const; - inline isl::local_space flatten_range() const; - inline isl::local_space from_domain() const; - inline isl::aff get_div(int pos) const; - inline isl::space get_space() const; - inline isl::local_space intersect(isl::local_space ls2) const; - inline bool is_equal(const isl::local_space &ls2) const; + inline ctx get_ctx() const; + + inline local_space domain() const; + inline local_space flatten_domain() const; + inline local_space flatten_range() const; + inline local_space from_domain() const; + inline aff get_div(int pos) const; + inline space get_space() const; + inline local_space intersect(local_space ls2) const; + inline bool is_equal(const local_space &ls2) const; inline bool is_params() const; inline bool is_set() const; - inline isl::basic_map lifting() const; - inline isl::local_space range() const; - inline isl::local_space wrap() const; + inline basic_map lifting() const; + inline local_space range() const; + inline local_space wrap() const; typedef isl_local_space* isl_ptr_t; }; // declarations for isl::map -inline isl::map manage(__isl_take isl_map *ptr); -inline isl::map manage_copy(__isl_keep isl_map *ptr); +inline map manage(__isl_take isl_map *ptr); +inline map manage_copy(__isl_keep isl_map *ptr); class map { - friend inline isl::map manage(__isl_take isl_map *ptr); - friend inline isl::map manage_copy(__isl_keep isl_map *ptr); + friend inline map manage(__isl_take isl_map *ptr); + friend inline map manage_copy(__isl_keep isl_map *ptr); protected: isl_map *ptr = nullptr; @@ -1731,13 +1710,13 @@ class map { public: inline /* implicit */ map(); - inline /* implicit */ map(const isl::map &obj); - inline explicit map(isl::ctx ctx, const std::string &str); - inline /* implicit */ map(isl::basic_map bmap); - inline explicit map(isl::set domain, isl::set range); - inline explicit map(isl::aff aff); - inline explicit map(isl::multi_aff maff); - inline isl::map &operator=(isl::map obj); + inline /* implicit */ map(const map &obj); + inline explicit map(ctx ctx, const std::string &str); + inline /* implicit */ map(basic_map bmap); + inline explicit map(set domain, set range); + inline explicit map(aff aff); + inline explicit map(multi_aff maff); + inline map &operator=(map obj); inline ~map(); inline __isl_give isl_map *copy() const &; inline __isl_give isl_map *copy() && = delete; @@ -1745,90 +1724,90 @@ class map { inline __isl_give isl_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::map add_constraint(isl::constraint constraint) const; - inline isl::basic_map affine_hull() const; - inline isl::map apply_domain(isl::map map2) const; - inline isl::map apply_range(isl::map map2) const; + inline basic_map affine_hull() const; + inline map apply_domain(map map2) const; + inline map apply_range(map map2) const; inline bool can_curry() const; inline bool can_range_curry() const; inline bool can_uncurry() const; - inline isl::map coalesce() const; - inline isl::map complement() const; - inline isl::map compute_divs() const; - inline isl::map curry() const; - inline isl::set deltas() const; - inline isl::map detect_equalities() const; - inline isl::set domain() const; - inline isl::map domain_factor_domain() const; - inline isl::map domain_factor_range() const; - inline isl::map domain_map() const; - inline isl::map domain_product(isl::map map2) const; - static inline isl::map empty(isl::space space); - inline isl::map flatten() const; - inline isl::map flatten_domain() const; - inline isl::map flatten_range() const; - inline void foreach_basic_map(const std::function &fn) const; - static inline isl::map from(isl::pw_multi_aff pma); - static inline isl::map from_domain(isl::set set); - static inline isl::map from_range(isl::set set); - static inline isl::map from_union_map(isl::union_map umap); - inline isl::basic_map_list get_basic_map_list() const; - inline isl::fixed_box get_range_simple_fixed_box_hull() const; - inline isl::stride_info get_range_stride_info(int pos) const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline isl::map gist(isl::map context) const; - inline isl::map gist_domain(isl::set context) const; - static inline isl::map identity(isl::space dim); - inline isl::map intersect(isl::map map2) const; - inline isl::map intersect_domain(isl::set set) const; - inline isl::map intersect_params(isl::set params) const; - inline isl::map intersect_range(isl::set set) const; + inline map coalesce() const; + inline map complement() const; + inline map compute_divs() const; + inline map curry() const; + inline set deltas() const; + inline map detect_equalities() const; + inline set domain() const; + inline map domain_factor_domain() const; + inline map domain_factor_range() const; + inline map domain_map() const; + inline map domain_product(map map2) const; + static inline map empty(space space); + inline map flatten() const; + inline map flatten_domain() const; + inline map flatten_range() const; + inline void foreach_basic_map(const std::function &fn) const; + static inline map from(pw_multi_aff pma); + static inline map from(union_map umap); + static inline map from_domain(set set); + static inline map from_range(set set); + inline basic_map_list get_basic_map_list() const; + inline fixed_box get_range_simple_fixed_box_hull() const; + inline stride_info get_range_stride_info(int pos) const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline map gist(map context) const; + inline map gist_domain(set context) const; + static inline map identity(space dim); + inline map intersect(map map2) const; + inline map intersect_domain(set set) const; + inline map intersect_params(set params) const; + inline map intersect_range(set set) const; inline bool is_bijective() const; - inline bool is_disjoint(const isl::map &map2) const; + inline bool is_disjoint(const map &map2) const; inline bool is_empty() const; - inline bool is_equal(const isl::map &map2) const; + inline bool is_equal(const map &map2) const; inline bool is_injective() const; inline bool is_single_valued() const; - inline bool is_strict_subset(const isl::map &map2) const; - inline bool is_subset(const isl::map &map2) const; - inline isl::map lexmax() const; - inline isl::map lexmin() const; + inline bool is_strict_subset(const map &map2) const; + inline bool is_subset(const map &map2) const; + inline map lexmax() const; + inline map lexmin() const; inline int n_basic_map() const; - inline isl::set params() const; - inline isl::basic_map polyhedral_hull() const; - inline isl::map preimage_domain(isl::multi_aff ma) const; - inline isl::map preimage_range(isl::multi_aff ma) const; - inline isl::set range() const; - inline isl::map range_curry() const; - inline isl::map range_factor_domain() const; - inline isl::map range_factor_range() const; - inline isl::map range_map() const; - inline isl::map range_product(isl::map map2) const; - inline isl::map reverse() const; - inline isl::basic_map sample() const; - inline isl::map set_tuple_id(enum isl::dim_type type, isl::id id) const; - inline isl::basic_map simple_hull() const; - inline isl::map subtract(isl::map map2) const; - inline isl::map sum(isl::map map2) const; - inline isl::map uncurry() const; - inline isl::map unite(isl::map map2) const; - static inline isl::map universe(isl::space space); - inline isl::basic_map unshifted_simple_hull() const; - inline isl::set wrap() const; + inline set params() const; + inline basic_map polyhedral_hull() const; + inline map preimage_domain(multi_aff ma) const; + inline map preimage_range(multi_aff ma) const; + inline set range() const; + inline map range_curry() const; + inline map range_factor_domain() const; + inline map range_factor_range() const; + inline map range_map() const; + inline map range_product(map map2) const; + inline map reverse() const; + inline basic_map sample() const; + inline map set_range_tuple_id(id id) const; + inline basic_map simple_hull() const; + inline map subtract(map map2) const; + inline map sum(map map2) const; + inline map uncurry() const; + inline map unite(map map2) const; + static inline map universe(space space); + inline basic_map unshifted_simple_hull() const; + inline set wrap() const; + inline map zip() const; typedef isl_map* isl_ptr_t; }; // declarations for isl::map_list -inline isl::map_list manage(__isl_take isl_map_list *ptr); -inline isl::map_list manage_copy(__isl_keep isl_map_list *ptr); +inline map_list manage(__isl_take isl_map_list *ptr); +inline map_list manage_copy(__isl_keep isl_map_list *ptr); class map_list { - friend inline isl::map_list manage(__isl_take isl_map_list *ptr); - friend inline isl::map_list manage_copy(__isl_keep isl_map_list *ptr); + friend inline map_list manage(__isl_take isl_map_list *ptr); + friend inline map_list manage_copy(__isl_keep isl_map_list *ptr); protected: isl_map_list *ptr = nullptr; @@ -1837,10 +1816,10 @@ class map_list { public: inline /* implicit */ map_list(); - inline /* implicit */ map_list(const isl::map_list &obj); - inline explicit map_list(isl::map el); - inline explicit map_list(isl::ctx ctx, int n); - inline isl::map_list &operator=(isl::map_list obj); + inline /* implicit */ map_list(const map_list &obj); + inline explicit map_list(map el); + inline explicit map_list(ctx ctx, int n); + inline map_list &operator=(map_list obj); inline ~map_list(); inline __isl_give isl_map_list *copy() const &; inline __isl_give isl_map_list *copy() && = delete; @@ -1848,25 +1827,25 @@ class map_list { inline __isl_give isl_map_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::map_list add(isl::map el) const; - inline isl::map_list concat(isl::map_list list2) const; - inline isl::map_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::map get_at(int index) const; - inline isl::map_list reverse() const; + inline ctx get_ctx() const; + + inline map_list add(map el) const; + inline map_list concat(map_list list2) const; + inline map_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline map get_at(int index) const; + inline map_list reverse() const; inline int size() const; typedef isl_map_list* isl_ptr_t; }; // declarations for isl::multi_aff -inline isl::multi_aff manage(__isl_take isl_multi_aff *ptr); -inline isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); +inline multi_aff manage(__isl_take isl_multi_aff *ptr); +inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); class multi_aff { - friend inline isl::multi_aff manage(__isl_take isl_multi_aff *ptr); - friend inline isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); + friend inline multi_aff manage(__isl_take isl_multi_aff *ptr); + friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr); protected: isl_multi_aff *ptr = nullptr; @@ -1875,11 +1854,11 @@ class multi_aff { public: inline /* implicit */ multi_aff(); - inline /* implicit */ multi_aff(const isl::multi_aff &obj); - inline explicit multi_aff(isl::space space, isl::aff_list list); - inline /* implicit */ multi_aff(isl::aff aff); - inline explicit multi_aff(isl::ctx ctx, const std::string &str); - inline isl::multi_aff &operator=(isl::multi_aff obj); + inline /* implicit */ multi_aff(const multi_aff &obj); + inline explicit multi_aff(ctx ctx, const std::string &str); + inline explicit multi_aff(space space, aff_list list); + inline /* implicit */ multi_aff(aff aff); + inline multi_aff &operator=(multi_aff obj); inline ~multi_aff(); inline __isl_give isl_multi_aff *copy() const &; inline __isl_give isl_multi_aff *copy() && = delete; @@ -1887,57 +1866,55 @@ class multi_aff { inline __isl_give isl_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_aff add(isl::multi_aff multi2) const; - inline isl::multi_aff align_params(isl::space model) const; - static inline isl::multi_aff domain_map(isl::space space); - inline isl::multi_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; - inline isl::multi_aff factor_domain() const; - inline isl::multi_aff factor_range() const; - inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const; - inline isl::multi_aff flatten_range() const; - inline isl::multi_aff floor() const; - inline isl::multi_aff from_range() const; - inline isl::aff get_aff(int pos) const; - inline isl::aff_list get_aff_list() const; - inline isl::space get_domain_space() const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline bool has_tuple_id(enum isl::dim_type type) const; - static inline isl::multi_aff identity(isl::space space); - inline isl::multi_aff mod(isl::multi_val mv) const; - inline isl::multi_aff neg() const; - inline isl::multi_aff product(isl::multi_aff multi2) const; - inline isl::multi_aff pullback(isl::multi_aff ma2) const; - inline isl::multi_aff range_factor_domain() const; - inline isl::multi_aff range_factor_range() const; - static inline isl::multi_aff range_map(isl::space space); - inline isl::multi_aff range_product(isl::multi_aff multi2) const; - inline isl::multi_aff range_splice(unsigned int pos, isl::multi_aff multi2) const; - inline isl::multi_aff reset_tuple_id(enum isl::dim_type type) const; - inline isl::multi_aff reset_user() const; - inline isl::multi_aff scale(isl::val v) const; - inline isl::multi_aff scale(isl::multi_val mv) const; - inline isl::multi_aff scale_down(isl::val v) const; - inline isl::multi_aff scale_down(isl::multi_val mv) const; - inline isl::multi_aff set_aff(int pos, isl::aff el) const; - inline isl::multi_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; + inline multi_aff add(multi_aff multi2) const; + inline multi_aff align_params(space model) const; + static inline multi_aff domain_map(space space); + inline multi_aff factor_domain() const; + inline multi_aff factor_range() const; + inline multi_aff flat_range_product(multi_aff multi2) const; + inline multi_aff flatten_range() const; + inline multi_aff floor() const; + inline multi_aff from_range() const; + inline aff get_aff(int pos) const; + inline aff_list get_aff_list() const; + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline multi_aff identity(space space); + inline multi_aff mod(multi_val mv) const; + inline multi_aff neg() const; + inline multi_aff product(multi_aff multi2) const; + inline multi_aff pullback(multi_aff ma2) const; + inline multi_aff range_factor_domain() const; + inline multi_aff range_factor_range() const; + static inline multi_aff range_map(space space); + inline multi_aff range_product(multi_aff multi2) const; + inline multi_aff range_splice(unsigned int pos, multi_aff multi2) const; + inline multi_aff reset_user() const; + inline multi_aff scale(val v) const; + inline multi_aff scale(multi_val mv) const; + inline multi_aff scale_down(val v) const; + inline multi_aff scale_down(multi_val mv) const; + inline multi_aff set_aff(int pos, aff el) const; + inline multi_aff set_range_tuple_id(id id) const; inline int size() const; - inline isl::multi_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const; - inline isl::multi_aff sub(isl::multi_aff multi2) const; - static inline isl::multi_aff zero(isl::space space); + inline multi_aff splice(unsigned int in_pos, unsigned int out_pos, multi_aff multi2) const; + inline multi_aff sub(multi_aff multi2) const; + static inline multi_aff wrapped_range_map(space space); + static inline multi_aff zero(space space); typedef isl_multi_aff* isl_ptr_t; }; // declarations for isl::multi_id -inline isl::multi_id manage(__isl_take isl_multi_id *ptr); -inline isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr); +inline multi_id manage(__isl_take isl_multi_id *ptr); +inline multi_id manage_copy(__isl_keep isl_multi_id *ptr); class multi_id { - friend inline isl::multi_id manage(__isl_take isl_multi_id *ptr); - friend inline isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr); + friend inline multi_id manage(__isl_take isl_multi_id *ptr); + friend inline multi_id manage_copy(__isl_keep isl_multi_id *ptr); protected: isl_multi_id *ptr = nullptr; @@ -1946,9 +1923,9 @@ class multi_id { public: inline /* implicit */ multi_id(); - inline /* implicit */ multi_id(const isl::multi_id &obj); - inline explicit multi_id(isl::space space, isl::id_list list); - inline isl::multi_id &operator=(isl::multi_id obj); + inline /* implicit */ multi_id(const multi_id &obj); + inline explicit multi_id(space space, id_list list); + inline multi_id &operator=(multi_id obj); inline ~multi_id(); inline __isl_give isl_multi_id *copy() const &; inline __isl_give isl_multi_id *copy() && = delete; @@ -1956,35 +1933,35 @@ class multi_id { inline __isl_give isl_multi_id *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::multi_id align_params(isl::space model) const; - inline isl::multi_id factor_domain() const; - inline isl::multi_id factor_range() const; - inline isl::multi_id flat_range_product(isl::multi_id multi2) const; - inline isl::multi_id flatten_range() const; - inline isl::multi_id from_range() const; - inline isl::space get_domain_space() const; - inline isl::id get_id(int pos) const; - inline isl::id_list get_id_list() const; - inline isl::space get_space() const; - inline isl::multi_id range_factor_domain() const; - inline isl::multi_id range_factor_range() const; - inline isl::multi_id range_product(isl::multi_id multi2) const; - inline isl::multi_id range_splice(unsigned int pos, isl::multi_id multi2) const; - inline isl::multi_id reset_user() const; - inline isl::multi_id set_id(int pos, isl::id el) const; + inline ctx get_ctx() const; + + inline multi_id align_params(space model) const; + inline multi_id factor_domain() const; + inline multi_id factor_range() const; + inline multi_id flat_range_product(multi_id multi2) const; + inline multi_id flatten_range() const; + inline multi_id from_range() const; + inline space get_domain_space() const; + inline id get_id(int pos) const; + inline id_list get_id_list() const; + inline space get_space() const; + inline multi_id range_factor_domain() const; + inline multi_id range_factor_range() const; + inline multi_id range_product(multi_id multi2) const; + inline multi_id range_splice(unsigned int pos, multi_id multi2) const; + inline multi_id reset_user() const; + inline multi_id set_id(int pos, id el) const; inline int size() const; typedef isl_multi_id* isl_ptr_t; }; // declarations for isl::multi_pw_aff -inline isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); -inline isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); +inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); +inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); class multi_pw_aff { - friend inline isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); - friend inline isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); + friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr); + friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr); protected: isl_multi_pw_aff *ptr = nullptr; @@ -1993,13 +1970,13 @@ class multi_pw_aff { public: inline /* implicit */ multi_pw_aff(); - inline /* implicit */ multi_pw_aff(const isl::multi_pw_aff &obj); - inline explicit multi_pw_aff(isl::space space, isl::pw_aff_list list); - inline /* implicit */ multi_pw_aff(isl::multi_aff ma); - inline /* implicit */ multi_pw_aff(isl::pw_aff pa); - inline /* implicit */ multi_pw_aff(isl::pw_multi_aff pma); - inline explicit multi_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::multi_pw_aff &operator=(isl::multi_pw_aff obj); + inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj); + inline explicit multi_pw_aff(space space, pw_aff_list list); + inline /* implicit */ multi_pw_aff(multi_aff ma); + inline /* implicit */ multi_pw_aff(pw_aff pa); + inline /* implicit */ multi_pw_aff(pw_multi_aff pma); + inline explicit multi_pw_aff(ctx ctx, const std::string &str); + inline multi_pw_aff &operator=(multi_pw_aff obj); inline ~multi_pw_aff(); inline __isl_give isl_multi_pw_aff *copy() const &; inline __isl_give isl_multi_pw_aff *copy() && = delete; @@ -2007,58 +1984,55 @@ class multi_pw_aff { inline __isl_give isl_multi_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff align_params(isl::space model) const; - inline isl::set domain() const; - inline isl::multi_pw_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; - inline isl::multi_pw_aff factor_domain() const; - inline isl::multi_pw_aff factor_range() const; - inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff flatten_range() const; - inline isl::multi_pw_aff from_range() const; - inline isl::space get_domain_space() const; - inline isl::pw_aff get_pw_aff(int pos) const; - inline isl::pw_aff_list get_pw_aff_list() const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline bool has_tuple_id(enum isl::dim_type type) const; - static inline isl::multi_pw_aff identity(isl::space space); - inline bool is_equal(const isl::multi_pw_aff &mpa2) const; - inline isl::multi_pw_aff mod(isl::multi_val mv) const; - inline isl::multi_pw_aff neg() const; - inline isl::multi_pw_aff product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff pullback(isl::multi_aff ma) const; - inline isl::multi_pw_aff pullback(isl::pw_multi_aff pma) const; - inline isl::multi_pw_aff pullback(isl::multi_pw_aff mpa2) const; - inline isl::multi_pw_aff range_factor_domain() const; - inline isl::multi_pw_aff range_factor_range() const; - inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff range_splice(unsigned int pos, isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff reset_tuple_id(enum isl::dim_type type) const; - inline isl::multi_pw_aff reset_user() const; - inline isl::multi_pw_aff scale(isl::val v) const; - inline isl::multi_pw_aff scale(isl::multi_val mv) const; - inline isl::multi_pw_aff scale_down(isl::val v) const; - inline isl::multi_pw_aff scale_down(isl::multi_val mv) const; - inline isl::multi_pw_aff set_pw_aff(int pos, isl::pw_aff el) const; - inline isl::multi_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; + inline multi_pw_aff add(multi_pw_aff multi2) const; + inline multi_pw_aff align_params(space model) const; + inline set domain() const; + inline multi_pw_aff factor_domain() const; + inline multi_pw_aff factor_range() const; + inline multi_pw_aff flat_range_product(multi_pw_aff multi2) const; + inline multi_pw_aff flatten_range() const; + inline multi_pw_aff from_range() const; + inline space get_domain_space() const; + inline pw_aff get_pw_aff(int pos) const; + inline pw_aff_list get_pw_aff_list() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline multi_pw_aff identity(space space); + inline bool is_equal(const multi_pw_aff &mpa2) const; + inline multi_pw_aff mod(multi_val mv) const; + inline multi_pw_aff neg() const; + inline multi_pw_aff product(multi_pw_aff multi2) const; + inline multi_pw_aff pullback(multi_aff ma) const; + inline multi_pw_aff pullback(pw_multi_aff pma) const; + inline multi_pw_aff pullback(multi_pw_aff mpa2) const; + inline multi_pw_aff range_factor_domain() const; + inline multi_pw_aff range_factor_range() const; + inline multi_pw_aff range_product(multi_pw_aff multi2) const; + inline multi_pw_aff range_splice(unsigned int pos, multi_pw_aff multi2) const; + inline multi_pw_aff reset_user() const; + inline multi_pw_aff scale(val v) const; + inline multi_pw_aff scale(multi_val mv) const; + inline multi_pw_aff scale_down(val v) const; + inline multi_pw_aff scale_down(multi_val mv) const; + inline multi_pw_aff set_pw_aff(int pos, pw_aff el) const; + inline multi_pw_aff set_range_tuple_id(id id) const; inline int size() const; - inline isl::multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const; - inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const; - static inline isl::multi_pw_aff zero(isl::space space); + inline multi_pw_aff splice(unsigned int in_pos, unsigned int out_pos, multi_pw_aff multi2) const; + inline multi_pw_aff sub(multi_pw_aff multi2) const; + static inline multi_pw_aff zero(space space); typedef isl_multi_pw_aff* isl_ptr_t; }; // declarations for isl::multi_union_pw_aff -inline isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); -inline isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); +inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); +inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); class multi_union_pw_aff { - friend inline isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); - friend inline isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); + friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr); + friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr); protected: isl_multi_union_pw_aff *ptr = nullptr; @@ -2067,14 +2041,14 @@ class multi_union_pw_aff { public: inline /* implicit */ multi_union_pw_aff(); - inline /* implicit */ multi_union_pw_aff(const isl::multi_union_pw_aff &obj); - inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list); - inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa); - inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_val mv); - inline explicit multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma); - inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::multi_union_pw_aff &operator=(isl::multi_union_pw_aff obj); + inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj); + inline /* implicit */ multi_union_pw_aff(union_pw_aff upa); + inline /* implicit */ multi_union_pw_aff(multi_pw_aff mpa); + inline explicit multi_union_pw_aff(union_set domain, multi_val mv); + inline explicit multi_union_pw_aff(union_set domain, multi_aff ma); + inline explicit multi_union_pw_aff(space space, union_pw_aff_list list); + inline explicit multi_union_pw_aff(ctx ctx, const std::string &str); + inline multi_union_pw_aff &operator=(multi_union_pw_aff obj); inline ~multi_union_pw_aff(); inline __isl_give isl_multi_union_pw_aff *copy() const &; inline __isl_give isl_multi_union_pw_aff *copy() && = delete; @@ -2082,62 +2056,62 @@ class multi_union_pw_aff { inline __isl_give isl_multi_union_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_union_pw_aff add(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff align_params(isl::space model) const; - inline isl::multi_union_pw_aff apply(isl::multi_aff ma) const; - inline isl::multi_union_pw_aff apply(isl::pw_multi_aff pma) const; - inline isl::union_set domain() const; - inline isl::multi_union_pw_aff drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; - inline isl::multi_pw_aff extract_multi_pw_aff(isl::space space) const; - inline isl::multi_union_pw_aff factor_domain() const; - inline isl::multi_union_pw_aff factor_range() const; - inline isl::multi_union_pw_aff flat_range_product(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff flatten_range() const; - inline isl::multi_union_pw_aff floor() const; - inline isl::multi_union_pw_aff from_range() const; - static inline isl::multi_union_pw_aff from_union_map(isl::union_map umap); - inline isl::space get_domain_space() const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline isl::union_pw_aff get_union_pw_aff(int pos) const; - inline isl::union_pw_aff_list get_union_pw_aff_list() const; - inline isl::multi_union_pw_aff gist(isl::union_set context) const; - inline bool has_tuple_id(enum isl::dim_type type) const; - inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const; - inline bool involves_param(const isl::id &id) const; - inline isl::multi_union_pw_aff mod(isl::multi_val mv) const; - inline isl::multi_union_pw_aff neg() const; - inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const; - inline isl::multi_union_pw_aff range_factor_domain() const; - inline isl::multi_union_pw_aff range_factor_range() const; - inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff range_splice(unsigned int pos, isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff reset_tuple_id(enum isl::dim_type type) const; - inline isl::multi_union_pw_aff reset_user() const; - inline isl::multi_union_pw_aff scale(isl::val v) const; - inline isl::multi_union_pw_aff scale(isl::multi_val mv) const; - inline isl::multi_union_pw_aff scale_down(isl::val v) const; - inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const; - inline isl::multi_union_pw_aff set_tuple_id(enum isl::dim_type type, isl::id id) const; - inline isl::multi_union_pw_aff set_union_pw_aff(int pos, isl::union_pw_aff el) const; + inline multi_union_pw_aff add(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff align_params(space model) const; + inline multi_union_pw_aff apply(multi_aff ma) const; + inline multi_union_pw_aff apply(pw_multi_aff pma) const; + inline union_set domain() const; + inline multi_pw_aff extract_multi_pw_aff(space space) const; + inline multi_union_pw_aff factor_domain() const; + inline multi_union_pw_aff factor_range() const; + inline multi_union_pw_aff flat_range_product(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff flatten_range() const; + inline multi_union_pw_aff floor() const; + inline multi_union_pw_aff from_range() const; + static inline multi_union_pw_aff from_union_map(union_map umap); + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline union_pw_aff get_union_pw_aff(int pos) const; + inline union_pw_aff_list get_union_pw_aff_list() const; + inline multi_union_pw_aff gist(union_set context) const; + inline multi_union_pw_aff intersect_domain(union_set uset) const; + inline multi_union_pw_aff intersect_params(set params) const; + inline bool involves_param(const id &id) const; + inline multi_val max_multi_val() const; + inline multi_val min_multi_val() const; + inline multi_union_pw_aff mod(multi_val mv) const; + inline multi_union_pw_aff neg() const; + inline multi_union_pw_aff pullback(union_pw_multi_aff upma) const; + inline multi_union_pw_aff range_factor_domain() const; + inline multi_union_pw_aff range_factor_range() const; + inline multi_union_pw_aff range_product(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff range_splice(unsigned int pos, multi_union_pw_aff multi2) const; + inline multi_union_pw_aff reset_user() const; + inline multi_union_pw_aff scale(val v) const; + inline multi_union_pw_aff scale(multi_val mv) const; + inline multi_union_pw_aff scale_down(val v) const; + inline multi_union_pw_aff scale_down(multi_val mv) const; + inline multi_union_pw_aff set_range_tuple_id(id id) const; + inline multi_union_pw_aff set_union_pw_aff(int pos, union_pw_aff el) const; inline int size() const; - inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const; - inline isl::multi_union_pw_aff union_add(isl::multi_union_pw_aff mupa2) const; - static inline isl::multi_union_pw_aff zero(isl::space space); - inline isl::union_set zero_union_set() const; + inline multi_union_pw_aff sub(multi_union_pw_aff multi2) const; + inline multi_union_pw_aff union_add(multi_union_pw_aff mupa2) const; + static inline multi_union_pw_aff zero(space space); + inline union_set zero_union_set() const; typedef isl_multi_union_pw_aff* isl_ptr_t; }; // declarations for isl::multi_val -inline isl::multi_val manage(__isl_take isl_multi_val *ptr); -inline isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr); +inline multi_val manage(__isl_take isl_multi_val *ptr); +inline multi_val manage_copy(__isl_keep isl_multi_val *ptr); class multi_val { - friend inline isl::multi_val manage(__isl_take isl_multi_val *ptr); - friend inline isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr); + friend inline multi_val manage(__isl_take isl_multi_val *ptr); + friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr); protected: isl_multi_val *ptr = nullptr; @@ -2146,9 +2120,9 @@ class multi_val { public: inline /* implicit */ multi_val(); - inline /* implicit */ multi_val(const isl::multi_val &obj); - inline explicit multi_val(isl::space space, isl::val_list list); - inline isl::multi_val &operator=(isl::multi_val obj); + inline /* implicit */ multi_val(const multi_val &obj); + inline explicit multi_val(space space, val_list list); + inline multi_val &operator=(multi_val obj); inline ~multi_val(); inline __isl_give isl_multi_val *copy() const &; inline __isl_give isl_multi_val *copy() && = delete; @@ -2156,52 +2130,49 @@ class multi_val { inline __isl_give isl_multi_val *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::multi_val add(isl::multi_val multi2) const; - inline isl::multi_val align_params(isl::space model) const; - inline isl::multi_val drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; - inline isl::multi_val factor_domain() const; - inline isl::multi_val factor_range() const; - inline isl::multi_val flat_range_product(isl::multi_val multi2) const; - inline isl::multi_val flatten_range() const; - inline isl::multi_val from_range() const; - inline isl::space get_domain_space() const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline isl::val get_val(int pos) const; - inline isl::val_list get_val_list() const; - inline bool has_tuple_id(enum isl::dim_type type) const; - inline isl::multi_val mod(isl::multi_val mv) const; - inline isl::multi_val neg() const; - inline isl::multi_val product(isl::multi_val multi2) const; - inline isl::multi_val range_factor_domain() const; - inline isl::multi_val range_factor_range() const; - inline isl::multi_val range_product(isl::multi_val multi2) const; - inline isl::multi_val range_splice(unsigned int pos, isl::multi_val multi2) const; - inline isl::multi_val reset_tuple_id(enum isl::dim_type type) const; - inline isl::multi_val reset_user() const; - inline isl::multi_val scale(isl::val v) const; - inline isl::multi_val scale(isl::multi_val mv) const; - inline isl::multi_val scale_down(isl::val v) const; - inline isl::multi_val scale_down(isl::multi_val mv) const; - inline isl::multi_val set_tuple_id(enum isl::dim_type type, isl::id id) const; - inline isl::multi_val set_val(int pos, isl::val el) const; + inline multi_val add(multi_val multi2) const; + inline multi_val align_params(space model) const; + inline multi_val factor_domain() const; + inline multi_val factor_range() const; + inline multi_val flat_range_product(multi_val multi2) const; + inline multi_val flatten_range() const; + inline multi_val from_range() const; + inline space get_domain_space() const; + inline id get_range_tuple_id() const; + inline space get_space() const; + inline val get_val(int pos) const; + inline val_list get_val_list() const; + inline multi_val mod(multi_val mv) const; + inline multi_val neg() const; + inline multi_val product(multi_val multi2) const; + inline multi_val range_factor_domain() const; + inline multi_val range_factor_range() const; + inline multi_val range_product(multi_val multi2) const; + inline multi_val range_splice(unsigned int pos, multi_val multi2) const; + inline multi_val reset_user() const; + inline multi_val scale(val v) const; + inline multi_val scale(multi_val mv) const; + inline multi_val scale_down(val v) const; + inline multi_val scale_down(multi_val mv) const; + inline multi_val set_range_tuple_id(id id) const; + inline multi_val set_val(int pos, val el) const; inline int size() const; - inline isl::multi_val splice(unsigned int in_pos, unsigned int out_pos, isl::multi_val multi2) const; - inline isl::multi_val sub(isl::multi_val multi2) const; - static inline isl::multi_val zero(isl::space space); + inline multi_val splice(unsigned int in_pos, unsigned int out_pos, multi_val multi2) const; + inline multi_val sub(multi_val multi2) const; + static inline multi_val zero(space space); typedef isl_multi_val* isl_ptr_t; }; // declarations for isl::point -inline isl::point manage(__isl_take isl_point *ptr); -inline isl::point manage_copy(__isl_keep isl_point *ptr); +inline point manage(__isl_take isl_point *ptr); +inline point manage_copy(__isl_keep isl_point *ptr); class point { - friend inline isl::point manage(__isl_take isl_point *ptr); - friend inline isl::point manage_copy(__isl_keep isl_point *ptr); + friend inline point manage(__isl_take isl_point *ptr); + friend inline point manage_copy(__isl_keep isl_point *ptr); protected: isl_point *ptr = nullptr; @@ -2210,9 +2181,9 @@ class point { public: inline /* implicit */ point(); - inline /* implicit */ point(const isl::point &obj); - inline explicit point(isl::space dim); - inline isl::point &operator=(isl::point obj); + inline /* implicit */ point(const point &obj); + inline explicit point(space dim); + inline point &operator=(point obj); inline ~point(); inline __isl_give isl_point *copy() const &; inline __isl_give isl_point *copy() && = delete; @@ -2220,21 +2191,21 @@ class point { inline __isl_give isl_point *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::space get_space() const; + inline space get_space() const; inline bool is_void() const; typedef isl_point* isl_ptr_t; }; // declarations for isl::pw_aff -inline isl::pw_aff manage(__isl_take isl_pw_aff *ptr); -inline isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); +inline pw_aff manage(__isl_take isl_pw_aff *ptr); +inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); class pw_aff { - friend inline isl::pw_aff manage(__isl_take isl_pw_aff *ptr); - friend inline isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); + friend inline pw_aff manage(__isl_take isl_pw_aff *ptr); + friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr); protected: isl_pw_aff *ptr = nullptr; @@ -2243,13 +2214,12 @@ class pw_aff { public: inline /* implicit */ pw_aff(); - inline /* implicit */ pw_aff(const isl::pw_aff &obj); - inline /* implicit */ pw_aff(isl::aff aff); - inline explicit pw_aff(isl::local_space ls); - inline explicit pw_aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos); - inline explicit pw_aff(isl::set domain, isl::val v); - inline explicit pw_aff(isl::ctx ctx, const std::string &str); - inline isl::pw_aff &operator=(isl::pw_aff obj); + inline /* implicit */ pw_aff(const pw_aff &obj); + inline /* implicit */ pw_aff(aff aff); + inline explicit pw_aff(local_space ls); + inline explicit pw_aff(set domain, val v); + inline explicit pw_aff(ctx ctx, const std::string &str); + inline pw_aff &operator=(pw_aff obj); inline ~pw_aff(); inline __isl_give isl_pw_aff *copy() const &; inline __isl_give isl_pw_aff *copy() && = delete; @@ -2257,59 +2227,61 @@ class pw_aff { inline __isl_give isl_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::pw_aff add(isl::pw_aff pwaff2) const; - inline isl::pw_aff ceil() const; - inline isl::pw_aff cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const; - inline isl::pw_aff div(isl::pw_aff pa2) const; - inline isl::set domain() const; - inline isl::map eq_map(isl::pw_aff pa2) const; - inline isl::set eq_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff floor() const; - inline void foreach_piece(const std::function &fn) const; - inline isl::set ge_set(isl::pw_aff pwaff2) const; - inline isl::space get_space() const; - inline isl::map gt_map(isl::pw_aff pa2) const; - inline isl::set gt_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff intersect_domain(isl::set set) const; - inline isl::pw_aff intersect_params(isl::set set) const; - inline bool involves_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const; + inline pw_aff add(pw_aff pwaff2) const; + inline pw_aff ceil() const; + inline pw_aff cond(pw_aff pwaff_true, pw_aff pwaff_false) const; + inline pw_aff div(pw_aff pa2) const; + inline set domain() const; + inline map eq_map(pw_aff pa2) const; + inline set eq_set(pw_aff pwaff2) const; + inline pw_aff floor() const; + inline void foreach_piece(const std::function &fn) const; + inline set ge_set(pw_aff pwaff2) const; + inline space get_space() const; + inline map gt_map(pw_aff pa2) const; + inline set gt_set(pw_aff pwaff2) const; + inline pw_aff intersect_domain(set set) const; + inline pw_aff intersect_params(set set) const; inline bool involves_nan() const; inline bool is_cst() const; - inline bool is_equal(const isl::pw_aff &pa2) const; - inline isl::set le_set(isl::pw_aff pwaff2) const; - inline isl::map lt_map(isl::pw_aff pa2) const; - inline isl::set lt_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff max(isl::pw_aff pwaff2) const; - inline isl::pw_aff min(isl::pw_aff pwaff2) const; - inline isl::pw_aff mod(isl::val mod) const; - inline isl::pw_aff mul(isl::pw_aff pwaff2) const; + inline bool is_equal(const pw_aff &pa2) const; + inline set le_set(pw_aff pwaff2) const; + inline map lt_map(pw_aff pa2) const; + inline set lt_set(pw_aff pwaff2) const; + inline pw_aff max(pw_aff pwaff2) const; + inline pw_aff min(pw_aff pwaff2) const; + inline pw_aff mod(val mod) const; + inline pw_aff mul(pw_aff pwaff2) const; inline int n_piece() const; - inline isl::set ne_set(isl::pw_aff pwaff2) const; - inline isl::pw_aff neg() const; - inline isl::set params() const; - inline isl::pw_aff project_domain_on_params() const; - inline isl::pw_aff pullback(isl::multi_aff ma) const; - inline isl::pw_aff pullback(isl::pw_multi_aff pma) const; - inline isl::pw_aff pullback(isl::multi_pw_aff mpa) const; - inline isl::pw_aff scale(isl::val v) const; - inline isl::pw_aff scale_down(isl::val f) const; - inline isl::pw_aff sub(isl::pw_aff pwaff2) const; - inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const; - inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const; - inline isl::pw_aff union_add(isl::pw_aff pwaff2) const; + inline set ne_set(pw_aff pwaff2) const; + inline pw_aff neg() const; + inline set nonneg_set() const; + inline set params() const; + inline set pos_set() const; + inline pw_aff project_domain_on_params() const; + inline pw_aff pullback(multi_aff ma) const; + inline pw_aff pullback(pw_multi_aff pma) const; + inline pw_aff pullback(multi_pw_aff mpa) const; + inline pw_aff scale(val v) const; + inline pw_aff scale_down(val f) const; + inline pw_aff sub(pw_aff pwaff2) const; + inline pw_aff tdiv_q(pw_aff pa2) const; + inline pw_aff tdiv_r(pw_aff pa2) const; + inline pw_aff union_add(pw_aff pwaff2) const; + inline set zero_set() const; typedef isl_pw_aff* isl_ptr_t; }; // declarations for isl::pw_aff_list -inline isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); -inline isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); +inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); +inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); class pw_aff_list { - friend inline isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); - friend inline isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); + friend inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr); + friend inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr); protected: isl_pw_aff_list *ptr = nullptr; @@ -2318,10 +2290,10 @@ class pw_aff_list { public: inline /* implicit */ pw_aff_list(); - inline /* implicit */ pw_aff_list(const isl::pw_aff_list &obj); - inline explicit pw_aff_list(isl::pw_aff el); - inline explicit pw_aff_list(isl::ctx ctx, int n); - inline isl::pw_aff_list &operator=(isl::pw_aff_list obj); + inline /* implicit */ pw_aff_list(const pw_aff_list &obj); + inline explicit pw_aff_list(pw_aff el); + inline explicit pw_aff_list(ctx ctx, int n); + inline pw_aff_list &operator=(pw_aff_list obj); inline ~pw_aff_list(); inline __isl_give isl_pw_aff_list *copy() const &; inline __isl_give isl_pw_aff_list *copy() && = delete; @@ -2329,25 +2301,25 @@ class pw_aff_list { inline __isl_give isl_pw_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::pw_aff_list add(isl::pw_aff el) const; - inline isl::pw_aff_list concat(isl::pw_aff_list list2) const; - inline isl::pw_aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::pw_aff get_at(int index) const; - inline isl::pw_aff_list reverse() const; + inline ctx get_ctx() const; + + inline pw_aff_list add(pw_aff el) const; + inline pw_aff_list concat(pw_aff_list list2) const; + inline pw_aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline pw_aff get_at(int index) const; + inline pw_aff_list reverse() const; inline int size() const; typedef isl_pw_aff_list* isl_ptr_t; }; // declarations for isl::pw_multi_aff -inline isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); -inline isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); +inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); +inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); class pw_multi_aff { - friend inline isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); - friend inline isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); + friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr); + friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr); protected: isl_pw_multi_aff *ptr = nullptr; @@ -2356,13 +2328,13 @@ class pw_multi_aff { public: inline /* implicit */ pw_multi_aff(); - inline /* implicit */ pw_multi_aff(const isl::pw_multi_aff &obj); - inline /* implicit */ pw_multi_aff(isl::multi_aff ma); - inline /* implicit */ pw_multi_aff(isl::pw_aff pa); - inline explicit pw_multi_aff(isl::set domain, isl::multi_val mv); - inline explicit pw_multi_aff(isl::map map); - inline explicit pw_multi_aff(isl::ctx ctx, const std::string &str); - inline isl::pw_multi_aff &operator=(isl::pw_multi_aff obj); + inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj); + inline /* implicit */ pw_multi_aff(multi_aff ma); + inline /* implicit */ pw_multi_aff(pw_aff pa); + inline explicit pw_multi_aff(set domain, multi_val mv); + inline explicit pw_multi_aff(map map); + inline explicit pw_multi_aff(ctx ctx, const std::string &str); + inline pw_multi_aff &operator=(pw_multi_aff obj); inline ~pw_multi_aff(); inline __isl_give isl_pw_multi_aff *copy() const &; inline __isl_give isl_pw_multi_aff *copy() && = delete; @@ -2370,41 +2342,41 @@ class pw_multi_aff { inline __isl_give isl_pw_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::pw_multi_aff add(isl::pw_multi_aff pma2) const; - inline isl::set domain() const; - inline isl::pw_multi_aff flat_range_product(isl::pw_multi_aff pma2) const; - inline void foreach_piece(const std::function &fn) const; - static inline isl::pw_multi_aff from(isl::multi_pw_aff mpa); - inline isl::pw_aff get_pw_aff(int pos) const; - inline isl::space get_space() const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - static inline isl::pw_multi_aff identity(isl::space space); - inline bool is_equal(const isl::pw_multi_aff &pma2) const; + inline pw_multi_aff add(pw_multi_aff pma2) const; + inline set domain() const; + inline pw_multi_aff flat_range_product(pw_multi_aff pma2) const; + inline void foreach_piece(const std::function &fn) const; + static inline pw_multi_aff from(multi_pw_aff mpa); + inline pw_aff get_pw_aff(int pos) const; + inline id get_range_tuple_id() const; + inline space get_space() const; + static inline pw_multi_aff identity(space space); + inline bool is_equal(const pw_multi_aff &pma2) const; inline int n_piece() const; - inline isl::pw_multi_aff product(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff project_domain_on_params() const; - inline isl::pw_multi_aff pullback(isl::multi_aff ma) const; - inline isl::pw_multi_aff pullback(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff range_factor_domain() const; - inline isl::pw_multi_aff range_factor_range() const; - inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const; - inline isl::pw_multi_aff scale_down_val(isl::val v) const; - inline isl::pw_multi_aff scale_val(isl::val v) const; - inline isl::pw_multi_aff set_pw_aff(unsigned int pos, isl::pw_aff pa) const; - inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const; + inline pw_multi_aff product(pw_multi_aff pma2) const; + inline pw_multi_aff project_domain_on_params() const; + inline pw_multi_aff pullback(multi_aff ma) const; + inline pw_multi_aff pullback(pw_multi_aff pma2) const; + inline pw_multi_aff range_factor_domain() const; + inline pw_multi_aff range_factor_range() const; + inline pw_multi_aff range_product(pw_multi_aff pma2) const; + inline pw_multi_aff scale(val v) const; + inline pw_multi_aff scale_down(val v) const; + inline pw_multi_aff set_pw_aff(unsigned int pos, pw_aff pa) const; + inline pw_multi_aff union_add(pw_multi_aff pma2) const; typedef isl_pw_multi_aff* isl_ptr_t; }; // declarations for isl::schedule -inline isl::schedule manage(__isl_take isl_schedule *ptr); -inline isl::schedule manage_copy(__isl_keep isl_schedule *ptr); +inline schedule manage(__isl_take isl_schedule *ptr); +inline schedule manage_copy(__isl_keep isl_schedule *ptr); class schedule { - friend inline isl::schedule manage(__isl_take isl_schedule *ptr); - friend inline isl::schedule manage_copy(__isl_keep isl_schedule *ptr); + friend inline schedule manage(__isl_take isl_schedule *ptr); + friend inline schedule manage_copy(__isl_keep isl_schedule *ptr); protected: isl_schedule *ptr = nullptr; @@ -2413,9 +2385,9 @@ class schedule { public: inline /* implicit */ schedule(); - inline /* implicit */ schedule(const isl::schedule &obj); - inline explicit schedule(isl::ctx ctx, const std::string &str); - inline isl::schedule &operator=(isl::schedule obj); + inline /* implicit */ schedule(const schedule &obj); + inline explicit schedule(ctx ctx, const std::string &str); + inline schedule &operator=(schedule obj); inline ~schedule(); inline __isl_give isl_schedule *copy() const &; inline __isl_give isl_schedule *copy() && = delete; @@ -2423,29 +2395,29 @@ class schedule { inline __isl_give isl_schedule *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - static inline isl::schedule from_domain(isl::union_set domain); - inline isl::union_set get_domain() const; - inline isl::union_map get_map() const; - inline isl::schedule_node get_root() const; - inline isl::schedule insert_partial_schedule(isl::multi_union_pw_aff partial) const; - inline bool plain_is_equal(const isl::schedule &schedule2) const; - inline isl::schedule pullback(isl::union_pw_multi_aff upma) const; - inline isl::schedule reset_user() const; - inline isl::schedule sequence(isl::schedule schedule2) const; - inline isl::schedule set(isl::schedule schedule2) const; + static inline schedule from_domain(union_set domain); + inline union_set get_domain() const; + inline union_map get_map() const; + inline schedule_node get_root() const; + inline schedule insert_partial_schedule(multi_union_pw_aff partial) const; + inline bool plain_is_equal(const schedule &schedule2) const; + inline schedule pullback(union_pw_multi_aff upma) const; + inline schedule reset_user() const; + inline schedule sequence(schedule schedule2) const; + inline schedule set(schedule schedule2) const; typedef isl_schedule* isl_ptr_t; }; // declarations for isl::schedule_constraints -inline isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); -inline isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); +inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); +inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); class schedule_constraints { - friend inline isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); - friend inline isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); + friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr); + friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr); protected: isl_schedule_constraints *ptr = nullptr; @@ -2454,9 +2426,9 @@ class schedule_constraints { public: inline /* implicit */ schedule_constraints(); - inline /* implicit */ schedule_constraints(const isl::schedule_constraints &obj); - inline explicit schedule_constraints(isl::ctx ctx, const std::string &str); - inline isl::schedule_constraints &operator=(isl::schedule_constraints obj); + inline /* implicit */ schedule_constraints(const schedule_constraints &obj); + inline explicit schedule_constraints(ctx ctx, const std::string &str); + inline schedule_constraints &operator=(schedule_constraints obj); inline ~schedule_constraints(); inline __isl_give isl_schedule_constraints *copy() const &; inline __isl_give isl_schedule_constraints *copy() && = delete; @@ -2464,36 +2436,36 @@ class schedule_constraints { inline __isl_give isl_schedule_constraints *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::schedule compute_schedule() const; - inline isl::union_map get_coincidence() const; - inline isl::union_map get_conditional_validity() const; - inline isl::union_map get_conditional_validity_condition() const; - inline isl::set get_context() const; - inline isl::union_set get_domain() const; - inline isl::multi_union_pw_aff get_prefix() const; - inline isl::union_map get_proximity() const; - inline isl::union_map get_validity() const; - inline isl::schedule_constraints intersect_domain(isl::union_set domain) const; - static inline isl::schedule_constraints on_domain(isl::union_set domain); - inline isl::schedule_constraints set_coincidence(isl::union_map coincidence) const; - inline isl::schedule_constraints set_conditional_validity(isl::union_map condition, isl::union_map validity) const; - inline isl::schedule_constraints set_context(isl::set context) const; - inline isl::schedule_constraints set_prefix(isl::multi_union_pw_aff prefix) const; - inline isl::schedule_constraints set_proximity(isl::union_map proximity) const; - inline isl::schedule_constraints set_validity(isl::union_map validity) const; + inline schedule compute_schedule() const; + inline union_map get_coincidence() const; + inline union_map get_conditional_validity() const; + inline union_map get_conditional_validity_condition() const; + inline set get_context() const; + inline union_set get_domain() const; + inline multi_union_pw_aff get_prefix() const; + inline union_map get_proximity() const; + inline union_map get_validity() const; + inline schedule_constraints intersect_domain(union_set domain) const; + static inline schedule_constraints on_domain(union_set domain); + inline schedule_constraints set_coincidence(union_map coincidence) const; + inline schedule_constraints set_conditional_validity(union_map condition, union_map validity) const; + inline schedule_constraints set_context(set context) const; + inline schedule_constraints set_prefix(multi_union_pw_aff prefix) const; + inline schedule_constraints set_proximity(union_map proximity) const; + inline schedule_constraints set_validity(union_map validity) const; typedef isl_schedule_constraints* isl_ptr_t; }; // declarations for isl::schedule_node -inline isl::schedule_node manage(__isl_take isl_schedule_node *ptr); -inline isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); +inline schedule_node manage(__isl_take isl_schedule_node *ptr); +inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); class schedule_node { - friend inline isl::schedule_node manage(__isl_take isl_schedule_node *ptr); - friend inline isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); + friend inline schedule_node manage(__isl_take isl_schedule_node *ptr); + friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr); protected: isl_schedule_node *ptr = nullptr; @@ -2502,8 +2474,8 @@ class schedule_node { public: inline /* implicit */ schedule_node(); - inline /* implicit */ schedule_node(const isl::schedule_node &obj); - inline isl::schedule_node &operator=(isl::schedule_node obj); + inline /* implicit */ schedule_node(const schedule_node &obj); + inline schedule_node &operator=(schedule_node obj); inline ~schedule_node(); inline __isl_give isl_schedule_node *copy() const &; inline __isl_give isl_schedule_node *copy() && = delete; @@ -2513,54 +2485,54 @@ class schedule_node { inline explicit operator bool() const; template inline bool isa(); template inline T as(); - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::schedule_node ancestor(int generation) const; - inline isl::schedule_node child(int pos) const; - inline isl::schedule_node cut() const; - inline isl::schedule_node del() const; - inline bool every_descendant(const std::function &test) const; - inline isl::schedule_node first_child() const; - inline void foreach_descendant_top_down(const std::function &fn) const; - static inline isl::schedule_node from_domain(isl::union_set domain); - static inline isl::schedule_node from_extension(isl::union_map extension); - inline int get_ancestor_child_position(const isl::schedule_node &ancestor) const; - inline isl::schedule_node get_child(int pos) const; + inline schedule_node ancestor(int generation) const; + inline schedule_node child(int pos) const; + inline schedule_node cut() const; + inline schedule_node del() const; + inline bool every_descendant(const std::function &test) const; + inline schedule_node first_child() const; + inline void foreach_descendant_top_down(const std::function &fn) const; + static inline schedule_node from_domain(union_set domain); + static inline schedule_node from_extension(union_map extension); + inline int get_ancestor_child_position(const schedule_node &ancestor) const; + inline schedule_node get_child(int pos) const; inline int get_child_position() const; - inline isl::union_set get_domain() const; - inline isl::multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const; - inline isl::union_map get_prefix_schedule_relation() const; - inline isl::union_map get_prefix_schedule_union_map() const; - inline isl::union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const; - inline isl::schedule get_schedule() const; + inline union_set get_domain() const; + inline multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const; + inline union_map get_prefix_schedule_relation() const; + inline union_map get_prefix_schedule_union_map() const; + inline union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const; + inline schedule get_schedule() const; inline int get_schedule_depth() const; - inline isl::schedule_node get_shared_ancestor(const isl::schedule_node &node2) const; + inline schedule_node get_shared_ancestor(const schedule_node &node2) const; inline int get_tree_depth() const; - inline isl::union_set get_universe_domain() const; - inline isl::schedule_node graft_after(isl::schedule_node graft) const; - inline isl::schedule_node graft_before(isl::schedule_node graft) const; + inline union_set get_universe_domain() const; + inline schedule_node graft_after(schedule_node graft) const; + inline schedule_node graft_before(schedule_node graft) const; inline bool has_children() const; inline bool has_next_sibling() const; inline bool has_parent() const; inline bool has_previous_sibling() const; - inline isl::schedule_node insert_context(isl::set context) const; - inline isl::schedule_node insert_filter(isl::union_set filter) const; - inline isl::schedule_node insert_guard(isl::set context) const; - inline isl::schedule_node insert_mark(isl::id mark) const; - inline isl::schedule_node insert_partial_schedule(isl::multi_union_pw_aff schedule) const; - inline isl::schedule_node insert_sequence(isl::union_set_list filters) const; - inline isl::schedule_node insert_set(isl::union_set_list filters) const; - inline bool is_equal(const isl::schedule_node &node2) const; + inline schedule_node insert_context(set context) const; + inline schedule_node insert_filter(union_set filter) const; + inline schedule_node insert_guard(set context) const; + inline schedule_node insert_mark(id mark) const; + inline schedule_node insert_partial_schedule(multi_union_pw_aff schedule) const; + inline schedule_node insert_sequence(union_set_list filters) const; + inline schedule_node insert_set(union_set_list filters) const; + inline bool is_equal(const schedule_node &node2) const; inline bool is_subtree_anchored() const; - inline isl::schedule_node map_descendant_bottom_up(const std::function &fn) const; + inline schedule_node map_descendant_bottom_up(const std::function &fn) const; inline int n_children() const; - inline isl::schedule_node next_sibling() const; - inline isl::schedule_node order_after(isl::union_set filter) const; - inline isl::schedule_node order_before(isl::union_set filter) const; - inline isl::schedule_node parent() const; - inline isl::schedule_node previous_sibling() const; - inline isl::schedule_node root() const; + inline schedule_node next_sibling() const; + inline schedule_node order_after(union_set filter) const; + inline schedule_node order_before(union_set filter) const; + inline schedule_node parent() const; + inline schedule_node previous_sibling() const; + inline schedule_node root() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2576,30 +2548,36 @@ class schedule_node_band : public schedule_node { public: inline /* implicit */ schedule_node_band(); - inline /* implicit */ schedule_node_band(const isl::schedule_node_band &obj); - inline isl::schedule_node_band &operator=(isl::schedule_node_band obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_band(const schedule_node_band &obj); + inline schedule_node_band &operator=(schedule_node_band obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_ast_build_options() const; - inline isl::set get_ast_isolate_option() const; - inline isl::multi_union_pw_aff get_partial_schedule() const; - inline isl::union_map get_partial_schedule_union_map() const; + inline union_set get_ast_build_options() const; + inline set get_ast_isolate_option() const; + inline multi_union_pw_aff get_partial_schedule() const; + inline union_map get_partial_schedule_union_map() const; inline bool get_permutable() const; - inline isl::space get_space() const; + inline space get_space() const; inline bool member_get_coincident(int pos) const; - inline isl::schedule_node_band member_set_ast_loop_type(int pos, enum isl::ast_loop_type type) const; - inline isl::schedule_node_band member_set_coincident(int pos, int coincident) const; - inline isl::schedule_node_band member_set_isolate_ast_loop_type(int pos, enum isl::ast_loop_type type) const; - inline isl::schedule_node_band mod(isl::multi_val mv) const; + inline schedule_node_band member_set_coincident(int pos, int coincident) const; + inline schedule_node_band mod(multi_val mv) const; inline unsigned int n_member() const; - inline isl::schedule_node_band scale(isl::multi_val mv) const; - inline isl::schedule_node_band scale_down(isl::multi_val mv) const; - inline isl::schedule_node_band set_ast_build_options(isl::union_set options) const; - inline isl::schedule_node_band set_permutable(int permutable) const; - inline isl::schedule_node_band shift(isl::multi_union_pw_aff shift) const; - inline isl::schedule_node_band split(int pos) const; - inline isl::schedule_node_band tile(isl::multi_val sizes) const; + inline schedule_node_band scale(multi_val mv) const; + inline schedule_node_band scale_down(multi_val mv) const; + inline schedule_node_band set_ast_build_options(union_set options) const; + inline schedule_node_band set_permutable(int permutable) const; + inline schedule_node_band shift(multi_union_pw_aff shift) const; + inline schedule_node_band split(int pos) const; + inline schedule_node_band tile(multi_val sizes) const; + inline schedule_node_band member_set_ast_loop_default(int pos) const; + inline schedule_node_band member_set_ast_loop_atomic(int pos) const; + inline schedule_node_band member_set_ast_loop_unroll(int pos) const; + inline schedule_node_band member_set_ast_loop_separate(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_default(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_atomic(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_unroll(int pos) const; + inline schedule_node_band member_set_isolate_ast_loop_separate(int pos) const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2615,12 +2593,12 @@ class schedule_node_context : public schedule_node { public: inline /* implicit */ schedule_node_context(); - inline /* implicit */ schedule_node_context(const isl::schedule_node_context &obj); - inline isl::schedule_node_context &operator=(isl::schedule_node_context obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_context(const schedule_node_context &obj); + inline schedule_node_context &operator=(schedule_node_context obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::set get_context() const; + inline set get_context() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2636,12 +2614,12 @@ class schedule_node_domain : public schedule_node { public: inline /* implicit */ schedule_node_domain(); - inline /* implicit */ schedule_node_domain(const isl::schedule_node_domain &obj); - inline isl::schedule_node_domain &operator=(isl::schedule_node_domain obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_domain(const schedule_node_domain &obj); + inline schedule_node_domain &operator=(schedule_node_domain obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_domain() const; + inline union_set get_domain() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2657,13 +2635,13 @@ class schedule_node_expansion : public schedule_node { public: inline /* implicit */ schedule_node_expansion(); - inline /* implicit */ schedule_node_expansion(const isl::schedule_node_expansion &obj); - inline isl::schedule_node_expansion &operator=(isl::schedule_node_expansion obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_expansion(const schedule_node_expansion &obj); + inline schedule_node_expansion &operator=(schedule_node_expansion obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_multi_aff get_contraction() const; - inline isl::union_map get_expansion() const; + inline union_pw_multi_aff get_contraction() const; + inline union_map get_expansion() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2679,12 +2657,12 @@ class schedule_node_extension : public schedule_node { public: inline /* implicit */ schedule_node_extension(); - inline /* implicit */ schedule_node_extension(const isl::schedule_node_extension &obj); - inline isl::schedule_node_extension &operator=(isl::schedule_node_extension obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_extension(const schedule_node_extension &obj); + inline schedule_node_extension &operator=(schedule_node_extension obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map get_extension() const; + inline union_map get_extension() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2700,12 +2678,12 @@ class schedule_node_filter : public schedule_node { public: inline /* implicit */ schedule_node_filter(); - inline /* implicit */ schedule_node_filter(const isl::schedule_node_filter &obj); - inline isl::schedule_node_filter &operator=(isl::schedule_node_filter obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_filter(const schedule_node_filter &obj); + inline schedule_node_filter &operator=(schedule_node_filter obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set get_filter() const; + inline union_set get_filter() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2721,12 +2699,12 @@ class schedule_node_guard : public schedule_node { public: inline /* implicit */ schedule_node_guard(); - inline /* implicit */ schedule_node_guard(const isl::schedule_node_guard &obj); - inline isl::schedule_node_guard &operator=(isl::schedule_node_guard obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_guard(const schedule_node_guard &obj); + inline schedule_node_guard &operator=(schedule_node_guard obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::set get_guard() const; + inline set get_guard() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2742,9 +2720,9 @@ class schedule_node_leaf : public schedule_node { public: inline /* implicit */ schedule_node_leaf(); - inline /* implicit */ schedule_node_leaf(const isl::schedule_node_leaf &obj); - inline isl::schedule_node_leaf &operator=(isl::schedule_node_leaf obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_leaf(const schedule_node_leaf &obj); + inline schedule_node_leaf &operator=(schedule_node_leaf obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; @@ -2762,12 +2740,12 @@ class schedule_node_mark : public schedule_node { public: inline /* implicit */ schedule_node_mark(); - inline /* implicit */ schedule_node_mark(const isl::schedule_node_mark &obj); - inline isl::schedule_node_mark &operator=(isl::schedule_node_mark obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_mark(const schedule_node_mark &obj); + inline schedule_node_mark &operator=(schedule_node_mark obj); + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::id get_id() const; + inline id get_id() const; typedef isl_schedule_node* isl_ptr_t; }; @@ -2783,9 +2761,9 @@ class schedule_node_sequence : public schedule_node { public: inline /* implicit */ schedule_node_sequence(); - inline /* implicit */ schedule_node_sequence(const isl::schedule_node_sequence &obj); - inline isl::schedule_node_sequence &operator=(isl::schedule_node_sequence obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_sequence(const schedule_node_sequence &obj); + inline schedule_node_sequence &operator=(schedule_node_sequence obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; @@ -2803,21 +2781,21 @@ class schedule_node_set : public schedule_node { public: inline /* implicit */ schedule_node_set(); - inline /* implicit */ schedule_node_set(const isl::schedule_node_set &obj); - inline isl::schedule_node_set &operator=(isl::schedule_node_set obj); - inline isl::ctx get_ctx() const; + inline /* implicit */ schedule_node_set(const schedule_node_set &obj); + inline schedule_node_set &operator=(schedule_node_set obj); + inline ctx get_ctx() const; inline std::string to_str() const; typedef isl_schedule_node* isl_ptr_t; }; // declarations for isl::set -inline isl::set manage(__isl_take isl_set *ptr); -inline isl::set manage_copy(__isl_keep isl_set *ptr); +inline set manage(__isl_take isl_set *ptr); +inline set manage_copy(__isl_keep isl_set *ptr); class set { - friend inline isl::set manage(__isl_take isl_set *ptr); - friend inline isl::set manage_copy(__isl_keep isl_set *ptr); + friend inline set manage(__isl_take isl_set *ptr); + friend inline set manage_copy(__isl_keep isl_set *ptr); protected: isl_set *ptr = nullptr; @@ -2826,11 +2804,11 @@ class set { public: inline /* implicit */ set(); - inline /* implicit */ set(const isl::set &obj); - inline /* implicit */ set(isl::point pnt); - inline explicit set(isl::ctx ctx, const std::string &str); - inline /* implicit */ set(isl::basic_set bset); - inline isl::set &operator=(isl::set obj); + inline /* implicit */ set(const set &obj); + inline /* implicit */ set(point pnt); + inline explicit set(ctx ctx, const std::string &str); + inline /* implicit */ set(basic_set bset); + inline set &operator=(set obj); inline ~set(); inline __isl_give isl_set *copy() const &; inline __isl_give isl_set *copy() && = delete; @@ -2838,86 +2816,81 @@ class set { inline __isl_give isl_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::set add_constraint(isl::constraint constraint) const; - inline isl::set add_dims(enum isl::dim_type type, unsigned int n) const; - inline isl::basic_set affine_hull() const; - inline isl::set align_params(isl::space model) const; - inline isl::set apply(isl::map map) const; - inline isl::set coalesce() const; - inline isl::set complement() const; - inline isl::set compute_divs() const; - inline isl::set detect_equalities() const; - inline unsigned int dim(enum isl::dim_type type) const; - inline isl::pw_aff dim_max(int pos) const; - inline isl::pw_aff dim_min(int pos) const; - static inline isl::set empty(isl::space space); - inline isl::set flatten() const; - inline isl::map flatten_map() const; - inline void foreach_basic_set(const std::function &fn) const; - static inline isl::set from(isl::multi_aff ma); - inline isl::set from_params() const; - static inline isl::set from_union_set(isl::union_set uset); - inline isl::basic_set_list get_basic_set_list() const; - inline isl::space get_space() const; - inline isl::val get_stride(int pos) const; - inline isl::id get_tuple_id() const; + inline basic_set affine_hull() const; + inline set align_params(space model) const; + inline set apply(map map) const; + inline set coalesce() const; + inline set complement() const; + inline set compute_divs() const; + inline set detect_equalities() const; + inline pw_aff dim_max(int pos) const; + inline pw_aff dim_min(int pos) const; + static inline set empty(space space); + inline set flatten() const; + inline map flatten_map() const; + inline void foreach_basic_set(const std::function &fn) const; + static inline set from(multi_aff ma); + inline set from_params() const; + static inline set from_union_set(union_set uset); + inline basic_set_list get_basic_set_list() const; + inline space get_space() const; + inline val get_stride(int pos) const; + inline id get_tuple_id() const; inline std::string get_tuple_name() const; - inline isl::set gist(isl::set context) const; + inline set gist(set context) const; inline bool has_tuple_id() const; inline bool has_tuple_name() const; - inline isl::map identity() const; - inline isl::set intersect(isl::set set2) const; - inline isl::set intersect_params(isl::set params) const; - inline bool involves_param(const isl::id &id) const; - inline bool is_disjoint(const isl::set &set2) const; + inline map identity() const; + inline set intersect(set set2) const; + inline set intersect_params(set params) const; + inline bool involves_param(const id &id) const; + inline bool is_disjoint(const set &set2) const; inline bool is_empty() const; - inline bool is_equal(const isl::set &set2) const; + inline bool is_equal(const set &set2) const; inline bool is_singleton() const; - inline bool is_strict_subset(const isl::set &set2) const; - inline bool is_subset(const isl::set &set2) const; + inline bool is_strict_subset(const set &set2) const; + inline bool is_subset(const set &set2) const; inline bool is_wrapping() const; - inline isl::set lexmax() const; - inline isl::set lexmin() const; - inline isl::val max_val(const isl::aff &obj) const; - inline isl::val min_val(const isl::aff &obj) const; + inline set lexmax() const; + inline set lexmin() const; + inline val max_val(const aff &obj) const; + inline val min_val(const aff &obj) const; inline int n_basic_set() const; inline unsigned int n_dim() const; inline unsigned int n_param() const; - static inline isl::set nat_universe(isl::space dim); - inline isl::set params() const; - inline isl::val plain_get_val_if_fixed(enum isl::dim_type type, unsigned int pos) const; + static inline set nat_universe(space dim); + inline set params() const; inline bool plain_is_universe() const; - inline isl::basic_set polyhedral_hull() const; - inline isl::set preimage_multi_aff(isl::multi_aff ma) const; - inline isl::set product(isl::set set2) const; - inline isl::set reset_tuple_id() const; - inline isl::basic_set sample() const; - inline isl::point sample_point() const; - inline isl::set set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const; - inline isl::set set_tuple_id(isl::id id) const; - inline isl::set set_tuple_name(const std::string &s) const; - inline isl::basic_set simple_hull() const; - inline isl::set subtract(isl::set set2) const; - inline isl::set unbind_params(isl::multi_id tuple) const; - inline isl::map unbind_params_insert_domain(isl::multi_id domain) const; - inline isl::set unite(isl::set set2) const; - static inline isl::set universe(isl::space space); - inline isl::basic_set unshifted_simple_hull() const; - inline isl::map unwrap() const; - inline isl::map wrapped_domain_map() const; + inline basic_set polyhedral_hull() const; + inline set preimage_multi_aff(multi_aff ma) const; + inline set product(set set2) const; + inline set reset_tuple_id() const; + inline basic_set sample() const; + inline point sample_point() const; + inline set set_tuple_id(id id) const; + inline set set_tuple_name(const std::string &s) const; + inline basic_set simple_hull() const; + inline set subtract(set set2) const; + inline set unbind_params(multi_id tuple) const; + inline map unbind_params_insert_domain(multi_id domain) const; + inline set unite(set set2) const; + static inline set universe(space space); + inline basic_set unshifted_simple_hull() const; + inline map unwrap() const; + inline map wrapped_domain_map() const; typedef isl_set* isl_ptr_t; }; // declarations for isl::set_list -inline isl::set_list manage(__isl_take isl_set_list *ptr); -inline isl::set_list manage_copy(__isl_keep isl_set_list *ptr); +inline set_list manage(__isl_take isl_set_list *ptr); +inline set_list manage_copy(__isl_keep isl_set_list *ptr); class set_list { - friend inline isl::set_list manage(__isl_take isl_set_list *ptr); - friend inline isl::set_list manage_copy(__isl_keep isl_set_list *ptr); + friend inline set_list manage(__isl_take isl_set_list *ptr); + friend inline set_list manage_copy(__isl_keep isl_set_list *ptr); protected: isl_set_list *ptr = nullptr; @@ -2926,10 +2899,10 @@ class set_list { public: inline /* implicit */ set_list(); - inline /* implicit */ set_list(const isl::set_list &obj); - inline explicit set_list(isl::set el); - inline explicit set_list(isl::ctx ctx, int n); - inline isl::set_list &operator=(isl::set_list obj); + inline /* implicit */ set_list(const set_list &obj); + inline explicit set_list(set el); + inline explicit set_list(ctx ctx, int n); + inline set_list &operator=(set_list obj); inline ~set_list(); inline __isl_give isl_set_list *copy() const &; inline __isl_give isl_set_list *copy() && = delete; @@ -2937,25 +2910,25 @@ class set_list { inline __isl_give isl_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::set_list add(isl::set el) const; - inline isl::set_list concat(isl::set_list list2) const; - inline isl::set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::set get_at(int index) const; - inline isl::set_list reverse() const; + inline ctx get_ctx() const; + + inline set_list add(set el) const; + inline set_list concat(set_list list2) const; + inline set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline set get_at(int index) const; + inline set_list reverse() const; inline int size() const; typedef isl_set_list* isl_ptr_t; }; // declarations for isl::space -inline isl::space manage(__isl_take isl_space *ptr); -inline isl::space manage_copy(__isl_keep isl_space *ptr); +inline space manage(__isl_take isl_space *ptr); +inline space manage_copy(__isl_keep isl_space *ptr); class space { - friend inline isl::space manage(__isl_take isl_space *ptr); - friend inline isl::space manage_copy(__isl_keep isl_space *ptr); + friend inline space manage(__isl_take isl_space *ptr); + friend inline space manage_copy(__isl_keep isl_space *ptr); protected: isl_space *ptr = nullptr; @@ -2964,11 +2937,11 @@ class space { public: inline /* implicit */ space(); - inline /* implicit */ space(const isl::space &obj); - inline explicit space(isl::ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out); - inline explicit space(isl::ctx ctx, unsigned int nparam, unsigned int dim); - inline explicit space(isl::ctx ctx, unsigned int nparam); - inline isl::space &operator=(isl::space obj); + inline /* implicit */ space(const space &obj); + inline explicit space(ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out); + inline explicit space(ctx ctx, unsigned int nparam, unsigned int dim); + inline explicit space(ctx ctx, unsigned int nparam); + inline space &operator=(space obj); inline ~space(); inline __isl_give isl_space *copy() const &; inline __isl_give isl_space *copy() && = delete; @@ -2976,56 +2949,51 @@ class space { inline __isl_give isl_space *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::space add_param(isl::id id) const; - inline isl::space align_params(isl::space dim2) const; + inline space add_named_tuple_id_ui(id tuple_id, unsigned int dim) const; + inline space add_param(id id) const; + inline space add_unnamed_tuple_ui(unsigned int dim) const; + inline space align_params(space dim2) const; inline bool can_curry() const; inline bool can_uncurry() const; - inline isl::space curry() const; - inline unsigned int dim(enum isl::dim_type type) const; - inline isl::space domain() const; - inline isl::space domain_map() const; - inline isl::space domain_product(isl::space right) const; - inline int find_dim_by_name(enum isl::dim_type type, const std::string &name) const; - inline isl::space from_domain() const; - inline isl::space from_range() const; - inline std::string get_dim_name(enum isl::dim_type type, unsigned int pos) const; - inline isl::id get_tuple_id(enum isl::dim_type type) const; - inline bool has_equal_params(const isl::space &space2) const; - inline bool has_equal_tuples(const isl::space &space2) const; - inline bool has_param(const isl::id &id) const; - inline bool has_tuple_id(enum isl::dim_type type) const; - inline bool is_equal(const isl::space &space2) const; + inline space curry() const; + inline space domain() const; + inline space domain_map() const; + inline space domain_product(space right) const; + inline space from_domain() const; + inline space from_range() const; + inline id get_map_range_tuple_id() const; + inline bool has_equal_params(const space &space2) const; + inline bool has_equal_tuples(const space &space2) const; + inline bool has_param(const id &id) const; + inline bool is_equal(const space &space2) const; inline bool is_params() const; inline bool is_set() const; inline bool is_wrapping() const; - inline isl::space map_from_domain_and_range(isl::space range) const; - inline isl::space map_from_set() const; - inline isl::space named_set_from_params_id(isl::id tuple_id, unsigned int dim) const; - inline isl::space params() const; - inline isl::space product(isl::space right) const; - inline isl::space range() const; - inline isl::space range_map() const; - inline isl::space range_product(isl::space right) const; - inline isl::space set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const; - inline isl::space set_from_params() const; - inline isl::space set_tuple_name(enum isl::dim_type type, const std::string &s) const; - inline isl::space uncurry() const; - inline isl::space unnamed_set_from_params(unsigned int dim) const; - inline isl::space unwrap() const; - inline isl::space wrap() const; + inline space map_from_domain_and_range(space range) const; + inline space map_from_set() const; + inline space params() const; + inline space product(space right) const; + inline space range() const; + inline space range_map() const; + inline space range_product(space right) const; + inline space set_from_params() const; + inline space set_set_tuple_id(id id) const; + inline space uncurry() const; + inline space unwrap() const; + inline space wrap() const; typedef isl_space* isl_ptr_t; }; // declarations for isl::stride_info -inline isl::stride_info manage(__isl_take isl_stride_info *ptr); -inline isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr); +inline stride_info manage(__isl_take isl_stride_info *ptr); +inline stride_info manage_copy(__isl_keep isl_stride_info *ptr); class stride_info { - friend inline isl::stride_info manage(__isl_take isl_stride_info *ptr); - friend inline isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr); + friend inline stride_info manage(__isl_take isl_stride_info *ptr); + friend inline stride_info manage_copy(__isl_keep isl_stride_info *ptr); protected: isl_stride_info *ptr = nullptr; @@ -3034,8 +3002,8 @@ class stride_info { public: inline /* implicit */ stride_info(); - inline /* implicit */ stride_info(const isl::stride_info &obj); - inline isl::stride_info &operator=(isl::stride_info obj); + inline /* implicit */ stride_info(const stride_info &obj); + inline stride_info &operator=(stride_info obj); inline ~stride_info(); inline __isl_give isl_stride_info *copy() const &; inline __isl_give isl_stride_info *copy() && = delete; @@ -3043,20 +3011,20 @@ class stride_info { inline __isl_give isl_stride_info *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; - inline isl::aff get_offset() const; - inline isl::val get_stride() const; + inline aff get_offset() const; + inline val get_stride() const; typedef isl_stride_info* isl_ptr_t; }; // declarations for isl::union_access_info -inline isl::union_access_info manage(__isl_take isl_union_access_info *ptr); -inline isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); +inline union_access_info manage(__isl_take isl_union_access_info *ptr); +inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); class union_access_info { - friend inline isl::union_access_info manage(__isl_take isl_union_access_info *ptr); - friend inline isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); + friend inline union_access_info manage(__isl_take isl_union_access_info *ptr); + friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr); protected: isl_union_access_info *ptr = nullptr; @@ -3065,9 +3033,9 @@ class union_access_info { public: inline /* implicit */ union_access_info(); - inline /* implicit */ union_access_info(const isl::union_access_info &obj); - inline explicit union_access_info(isl::union_map sink); - inline isl::union_access_info &operator=(isl::union_access_info obj); + inline /* implicit */ union_access_info(const union_access_info &obj); + inline explicit union_access_info(union_map sink); + inline union_access_info &operator=(union_access_info obj); inline ~union_access_info(); inline __isl_give isl_union_access_info *copy() const &; inline __isl_give isl_union_access_info *copy() && = delete; @@ -3075,25 +3043,25 @@ class union_access_info { inline __isl_give isl_union_access_info *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_flow compute_flow() const; - inline isl::union_access_info set_kill(isl::union_map kill) const; - inline isl::union_access_info set_may_source(isl::union_map may_source) const; - inline isl::union_access_info set_must_source(isl::union_map must_source) const; - inline isl::union_access_info set_schedule(isl::schedule schedule) const; - inline isl::union_access_info set_schedule_map(isl::union_map schedule_map) const; + inline union_flow compute_flow() const; + inline union_access_info set_kill(union_map kill) const; + inline union_access_info set_may_source(union_map may_source) const; + inline union_access_info set_must_source(union_map must_source) const; + inline union_access_info set_schedule(schedule schedule) const; + inline union_access_info set_schedule_map(union_map schedule_map) const; typedef isl_union_access_info* isl_ptr_t; }; // declarations for isl::union_flow -inline isl::union_flow manage(__isl_take isl_union_flow *ptr); -inline isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr); +inline union_flow manage(__isl_take isl_union_flow *ptr); +inline union_flow manage_copy(__isl_keep isl_union_flow *ptr); class union_flow { - friend inline isl::union_flow manage(__isl_take isl_union_flow *ptr); - friend inline isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr); + friend inline union_flow manage(__isl_take isl_union_flow *ptr); + friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr); protected: isl_union_flow *ptr = nullptr; @@ -3102,8 +3070,8 @@ class union_flow { public: inline /* implicit */ union_flow(); - inline /* implicit */ union_flow(const isl::union_flow &obj); - inline isl::union_flow &operator=(isl::union_flow obj); + inline /* implicit */ union_flow(const union_flow &obj); + inline union_flow &operator=(union_flow obj); inline ~union_flow(); inline __isl_give isl_union_flow *copy() const &; inline __isl_give isl_union_flow *copy() && = delete; @@ -3111,25 +3079,25 @@ class union_flow { inline __isl_give isl_union_flow *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map get_full_may_dependence() const; - inline isl::union_map get_full_must_dependence() const; - inline isl::union_map get_may_dependence() const; - inline isl::union_map get_may_no_source() const; - inline isl::union_map get_must_dependence() const; - inline isl::union_map get_must_no_source() const; + inline union_map get_full_may_dependence() const; + inline union_map get_full_must_dependence() const; + inline union_map get_may_dependence() const; + inline union_map get_may_no_source() const; + inline union_map get_must_dependence() const; + inline union_map get_must_no_source() const; typedef isl_union_flow* isl_ptr_t; }; // declarations for isl::union_map -inline isl::union_map manage(__isl_take isl_union_map *ptr); -inline isl::union_map manage_copy(__isl_keep isl_union_map *ptr); +inline union_map manage(__isl_take isl_union_map *ptr); +inline union_map manage_copy(__isl_keep isl_union_map *ptr); class union_map { - friend inline isl::union_map manage(__isl_take isl_union_map *ptr); - friend inline isl::union_map manage_copy(__isl_keep isl_union_map *ptr); + friend inline union_map manage(__isl_take isl_union_map *ptr); + friend inline union_map manage_copy(__isl_keep isl_union_map *ptr); protected: isl_union_map *ptr = nullptr; @@ -3138,11 +3106,11 @@ class union_map { public: inline /* implicit */ union_map(); - inline /* implicit */ union_map(const isl::union_map &obj); - inline /* implicit */ union_map(isl::basic_map bmap); - inline /* implicit */ union_map(isl::map map); - inline explicit union_map(isl::ctx ctx, const std::string &str); - inline isl::union_map &operator=(isl::union_map obj); + inline /* implicit */ union_map(const union_map &obj); + inline /* implicit */ union_map(basic_map bmap); + inline /* implicit */ union_map(map map); + inline explicit union_map(ctx ctx, const std::string &str); + inline union_map &operator=(union_map obj); inline ~union_map(); inline __isl_give isl_union_map *copy() const &; inline __isl_give isl_union_map *copy() && = delete; @@ -3150,87 +3118,87 @@ class union_map { inline __isl_give isl_union_map *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_map add_map(isl::map map) const; - inline isl::union_map affine_hull() const; - inline isl::union_map apply_domain(isl::union_map umap2) const; - inline isl::union_map apply_range(isl::union_map umap2) const; - inline isl::union_map coalesce() const; - inline isl::union_map compute_divs() const; - inline isl::union_map curry() const; - inline isl::union_set deltas() const; - inline isl::union_map detect_equalities() const; - inline isl::union_set domain() const; - inline isl::union_map domain_factor_domain() const; - inline isl::union_map domain_factor_range() const; - inline isl::union_map domain_map() const; - inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const; - inline isl::union_map domain_product(isl::union_map umap2) const; - static inline isl::union_map empty(isl::space space); - inline isl::union_map eq_at(isl::multi_union_pw_aff mupa) const; - inline isl::map extract_map(isl::space dim) const; - inline isl::union_map factor_domain() const; - inline isl::union_map factor_range() const; - inline isl::union_map fixed_power(isl::val exp) const; - inline isl::union_map flat_range_product(isl::union_map umap2) const; - inline void foreach_map(const std::function &fn) const; - static inline isl::union_map from(isl::union_pw_multi_aff upma); - static inline isl::union_map from(isl::multi_union_pw_aff mupa); - static inline isl::union_map from_domain(isl::union_set uset); - static inline isl::union_map from_domain_and_range(isl::union_set domain, isl::union_set range); - static inline isl::union_map from_range(isl::union_set uset); - inline isl::map_list get_map_list() const; - inline isl::space get_space() const; - inline isl::union_map gist(isl::union_map context) const; - inline isl::union_map gist_domain(isl::union_set uset) const; - inline isl::union_map gist_params(isl::set set) const; - inline isl::union_map gist_range(isl::union_set uset) const; - inline isl::union_map intersect(isl::union_map umap2) const; - inline isl::union_map intersect_domain(isl::union_set uset) const; - inline isl::union_map intersect_params(isl::set set) const; - inline isl::union_map intersect_range(isl::union_set uset) const; + inline union_map add_map(map map) const; + inline union_map affine_hull() const; + inline union_map apply_domain(union_map umap2) const; + inline union_map apply_range(union_map umap2) const; + inline union_map coalesce() const; + inline union_map compute_divs() const; + inline union_map curry() const; + inline union_set deltas() const; + inline union_map detect_equalities() const; + inline union_set domain() const; + inline union_map domain_factor_domain() const; + inline union_map domain_factor_range() const; + inline union_map domain_map() const; + inline union_pw_multi_aff domain_map_union_pw_multi_aff() const; + inline union_map domain_product(union_map umap2) const; + static inline union_map empty(space space); + inline union_map eq_at(multi_union_pw_aff mupa) const; + inline map extract_map(space dim) const; + inline union_map factor_domain() const; + inline union_map factor_range() const; + inline union_map fixed_power(val exp) const; + inline union_map flat_range_product(union_map umap2) const; + inline void foreach_map(const std::function &fn) const; + static inline union_map from(union_pw_multi_aff upma); + static inline union_map from(multi_union_pw_aff mupa); + static inline union_map from_domain(union_set uset); + static inline union_map from_domain_and_range(union_set domain, union_set range); + static inline union_map from_range(union_set uset); + inline map_list get_map_list() const; + inline space get_space() const; + inline union_map gist(union_map context) const; + inline union_map gist_domain(union_set uset) const; + inline union_map gist_params(set set) const; + inline union_map gist_range(union_set uset) const; + inline union_map intersect(union_map umap2) const; + inline union_map intersect_domain(union_set uset) const; + inline union_map intersect_params(set set) const; + inline union_map intersect_range(union_set uset) const; inline bool is_bijective() const; inline bool is_empty() const; - inline bool is_equal(const isl::union_map &umap2) const; + inline bool is_equal(const union_map &umap2) const; inline bool is_injective() const; inline bool is_single_valued() const; - inline bool is_strict_subset(const isl::union_map &umap2) const; - inline bool is_subset(const isl::union_map &umap2) const; - inline isl::union_map lex_gt_at(isl::multi_union_pw_aff mupa) const; - inline isl::union_map lex_lt_at(isl::multi_union_pw_aff mupa) const; - inline isl::union_map lexmax() const; - inline isl::union_map lexmin() const; + inline bool is_strict_subset(const union_map &umap2) const; + inline bool is_subset(const union_map &umap2) const; + inline union_map lex_gt_at(multi_union_pw_aff mupa) const; + inline union_map lex_lt_at(multi_union_pw_aff mupa) const; + inline union_map lexmax() const; + inline union_map lexmin() const; inline int n_map() const; - inline isl::union_map polyhedral_hull() const; - inline isl::union_map preimage_range_multi_aff(isl::multi_aff ma) const; - inline isl::union_map product(isl::union_map umap2) const; - inline isl::union_map project_out_all_params() const; - inline isl::union_set range() const; - inline isl::union_map range_factor_domain() const; - inline isl::union_map range_factor_range() const; - inline isl::union_map range_map() const; - inline isl::union_map range_product(isl::union_map umap2) const; - inline isl::union_map reverse() const; - inline isl::union_map subtract(isl::union_map umap2) const; - inline isl::union_map subtract_domain(isl::union_set dom) const; - inline isl::union_map subtract_range(isl::union_set dom) const; - inline isl::union_map uncurry() const; - inline isl::union_map unite(isl::union_map umap2) const; - inline isl::union_map universe() const; - inline isl::union_set wrap() const; - inline isl::union_map zip() const; + inline union_map polyhedral_hull() const; + inline union_map preimage_range_multi_aff(multi_aff ma) const; + inline union_map product(union_map umap2) const; + inline union_map project_out_all_params() const; + inline union_set range() const; + inline union_map range_factor_domain() const; + inline union_map range_factor_range() const; + inline union_map range_map() const; + inline union_map range_product(union_map umap2) const; + inline union_map reverse() const; + inline union_map subtract(union_map umap2) const; + inline union_map subtract_domain(union_set dom) const; + inline union_map subtract_range(union_set dom) const; + inline union_map uncurry() const; + inline union_map unite(union_map umap2) const; + inline union_map universe() const; + inline union_set wrap() const; + inline union_map zip() const; typedef isl_union_map* isl_ptr_t; }; // declarations for isl::union_pw_aff -inline isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); -inline isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); +inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); +inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); class union_pw_aff { - friend inline isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); - friend inline isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); + friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr); + friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr); protected: isl_union_pw_aff *ptr = nullptr; @@ -3239,12 +3207,12 @@ class union_pw_aff { public: inline /* implicit */ union_pw_aff(); - inline /* implicit */ union_pw_aff(const isl::union_pw_aff &obj); - inline /* implicit */ union_pw_aff(isl::pw_aff pa); - inline explicit union_pw_aff(isl::union_set domain, isl::val v); - inline explicit union_pw_aff(isl::union_set domain, isl::aff aff); - inline explicit union_pw_aff(isl::ctx ctx, const std::string &str); - inline isl::union_pw_aff &operator=(isl::union_pw_aff obj); + inline /* implicit */ union_pw_aff(const union_pw_aff &obj); + inline /* implicit */ union_pw_aff(pw_aff pa); + inline explicit union_pw_aff(union_set domain, val v); + inline explicit union_pw_aff(union_set domain, aff aff); + inline explicit union_pw_aff(ctx ctx, const std::string &str); + inline union_pw_aff &operator=(union_pw_aff obj); inline ~union_pw_aff(); inline __isl_give isl_union_pw_aff *copy() const &; inline __isl_give isl_union_pw_aff *copy() && = delete; @@ -3252,40 +3220,42 @@ class union_pw_aff { inline __isl_give isl_union_pw_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_aff add(isl::union_pw_aff upa2) const; - inline isl::union_set domain() const; - static inline isl::union_pw_aff empty(isl::space space); - inline isl::pw_aff extract_on_domain(isl::space space) const; - inline isl::pw_aff extract_pw_aff(isl::space space) const; - inline isl::union_pw_aff floor() const; - inline void foreach_pw_aff(const std::function &fn) const; - inline isl::pw_aff_list get_pw_aff_list() const; - inline isl::space get_space() const; - inline isl::union_pw_aff intersect_domain(isl::union_set uset) const; - inline bool involves_param(const isl::id &id) const; - inline isl::union_pw_aff mod_val(isl::val f) const; + inline union_pw_aff add(union_pw_aff upa2) const; + inline union_set domain() const; + static inline union_pw_aff empty(space space); + inline pw_aff extract_on_domain(space space) const; + inline pw_aff extract_pw_aff(space space) const; + inline union_pw_aff floor() const; + inline void foreach_pw_aff(const std::function &fn) const; + inline pw_aff_list get_pw_aff_list() const; + inline space get_space() const; + inline union_pw_aff intersect_domain(union_set uset) const; + inline bool involves_param(const id &id) const; + inline val max_val() const; + inline val min_val() const; + inline union_pw_aff mod(val f) const; inline int n_pw_aff() const; - static inline isl::union_pw_aff param_on_domain(isl::union_set domain, isl::id id); - inline bool plain_is_equal(const isl::union_pw_aff &upa2) const; - inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const; - inline isl::union_pw_aff scale_down(isl::val v) const; - inline isl::union_pw_aff scale_val(isl::val v) const; - inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const; - inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const; - inline isl::union_set zero_union_set() const; + static inline union_pw_aff param_on_domain(union_set domain, id id); + inline bool plain_is_equal(const union_pw_aff &upa2) const; + inline union_pw_aff pullback(union_pw_multi_aff upma) const; + inline union_pw_aff scale(val v) const; + inline union_pw_aff scale_down(val v) const; + inline union_pw_aff sub(union_pw_aff upa2) const; + inline union_pw_aff union_add(union_pw_aff upa2) const; + inline union_set zero_union_set() const; typedef isl_union_pw_aff* isl_ptr_t; }; // declarations for isl::union_pw_aff_list -inline isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); -inline isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); +inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); +inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); class union_pw_aff_list { - friend inline isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); - friend inline isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); + friend inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr); + friend inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr); protected: isl_union_pw_aff_list *ptr = nullptr; @@ -3294,10 +3264,10 @@ class union_pw_aff_list { public: inline /* implicit */ union_pw_aff_list(); - inline /* implicit */ union_pw_aff_list(const isl::union_pw_aff_list &obj); - inline explicit union_pw_aff_list(isl::union_pw_aff el); - inline explicit union_pw_aff_list(isl::ctx ctx, int n); - inline isl::union_pw_aff_list &operator=(isl::union_pw_aff_list obj); + inline /* implicit */ union_pw_aff_list(const union_pw_aff_list &obj); + inline explicit union_pw_aff_list(union_pw_aff el); + inline explicit union_pw_aff_list(ctx ctx, int n); + inline union_pw_aff_list &operator=(union_pw_aff_list obj); inline ~union_pw_aff_list(); inline __isl_give isl_union_pw_aff_list *copy() const &; inline __isl_give isl_union_pw_aff_list *copy() && = delete; @@ -3305,25 +3275,25 @@ class union_pw_aff_list { inline __isl_give isl_union_pw_aff_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::union_pw_aff_list add(isl::union_pw_aff el) const; - inline isl::union_pw_aff_list concat(isl::union_pw_aff_list list2) const; - inline isl::union_pw_aff_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::union_pw_aff get_at(int index) const; - inline isl::union_pw_aff_list reverse() const; + inline ctx get_ctx() const; + + inline union_pw_aff_list add(union_pw_aff el) const; + inline union_pw_aff_list concat(union_pw_aff_list list2) const; + inline union_pw_aff_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline union_pw_aff get_at(int index) const; + inline union_pw_aff_list reverse() const; inline int size() const; typedef isl_union_pw_aff_list* isl_ptr_t; }; // declarations for isl::union_pw_multi_aff -inline isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); -inline isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); +inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); +inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); class union_pw_multi_aff { - friend inline isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); - friend inline isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); + friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr); + friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr); protected: isl_union_pw_multi_aff *ptr = nullptr; @@ -3332,12 +3302,12 @@ class union_pw_multi_aff { public: inline /* implicit */ union_pw_multi_aff(); - inline /* implicit */ union_pw_multi_aff(const isl::union_pw_multi_aff &obj); - inline /* implicit */ union_pw_multi_aff(isl::pw_multi_aff pma); - inline explicit union_pw_multi_aff(isl::union_set domain, isl::multi_val mv); - inline explicit union_pw_multi_aff(isl::ctx ctx, const std::string &str); - inline /* implicit */ union_pw_multi_aff(isl::union_pw_aff upa); - inline isl::union_pw_multi_aff &operator=(isl::union_pw_multi_aff obj); + inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj); + inline /* implicit */ union_pw_multi_aff(pw_multi_aff pma); + inline explicit union_pw_multi_aff(union_set domain, multi_val mv); + inline explicit union_pw_multi_aff(ctx ctx, const std::string &str); + inline /* implicit */ union_pw_multi_aff(union_pw_aff upa); + inline union_pw_multi_aff &operator=(union_pw_multi_aff obj); inline ~union_pw_multi_aff(); inline __isl_give isl_union_pw_multi_aff *copy() const &; inline __isl_give isl_union_pw_multi_aff *copy() && = delete; @@ -3345,33 +3315,33 @@ class union_pw_multi_aff { inline __isl_give isl_union_pw_multi_aff *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_pw_multi_aff add(isl::union_pw_multi_aff upma2) const; - inline isl::union_set domain() const; - inline isl::pw_multi_aff extract_pw_multi_aff(isl::space space) const; - inline isl::union_pw_multi_aff flat_range_product(isl::union_pw_multi_aff upma2) const; - inline void foreach_pw_multi_aff(const std::function &fn) const; - static inline isl::union_pw_multi_aff from(isl::union_map umap); - static inline isl::union_pw_multi_aff from_multi_union_pw_aff(isl::multi_union_pw_aff mupa); - inline isl::space get_space() const; - inline isl::union_pw_aff get_union_pw_aff(int pos) const; + inline union_pw_multi_aff add(union_pw_multi_aff upma2) const; + inline union_set domain() const; + inline pw_multi_aff extract_pw_multi_aff(space space) const; + inline union_pw_multi_aff flat_range_product(union_pw_multi_aff upma2) const; + inline void foreach_pw_multi_aff(const std::function &fn) const; + static inline union_pw_multi_aff from(union_map umap); + static inline union_pw_multi_aff from_multi_union_pw_aff(multi_union_pw_aff mupa); + inline space get_space() const; + inline union_pw_aff get_union_pw_aff(int pos) const; inline int n_pw_multi_aff() const; - inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const; - inline isl::union_pw_multi_aff scale_down_val(isl::val val) const; - inline isl::union_pw_multi_aff scale_val(isl::val val) const; - inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const; + inline union_pw_multi_aff pullback(union_pw_multi_aff upma2) const; + inline union_pw_multi_aff scale(val val) const; + inline union_pw_multi_aff scale_down(val val) const; + inline union_pw_multi_aff union_add(union_pw_multi_aff upma2) const; typedef isl_union_pw_multi_aff* isl_ptr_t; }; // declarations for isl::union_set -inline isl::union_set manage(__isl_take isl_union_set *ptr); -inline isl::union_set manage_copy(__isl_keep isl_union_set *ptr); +inline union_set manage(__isl_take isl_union_set *ptr); +inline union_set manage_copy(__isl_keep isl_union_set *ptr); class union_set { - friend inline isl::union_set manage(__isl_take isl_union_set *ptr); - friend inline isl::union_set manage_copy(__isl_keep isl_union_set *ptr); + friend inline union_set manage(__isl_take isl_union_set *ptr); + friend inline union_set manage_copy(__isl_keep isl_union_set *ptr); protected: isl_union_set *ptr = nullptr; @@ -3380,12 +3350,12 @@ class union_set { public: inline /* implicit */ union_set(); - inline /* implicit */ union_set(const isl::union_set &obj); - inline /* implicit */ union_set(isl::basic_set bset); - inline /* implicit */ union_set(isl::set set); - inline /* implicit */ union_set(isl::point pnt); - inline explicit union_set(isl::ctx ctx, const std::string &str); - inline isl::union_set &operator=(isl::union_set obj); + inline /* implicit */ union_set(const union_set &obj); + inline /* implicit */ union_set(basic_set bset); + inline /* implicit */ union_set(set set); + inline /* implicit */ union_set(point pnt); + inline explicit union_set(ctx ctx, const std::string &str); + inline union_set &operator=(union_set obj); inline ~union_set(); inline __isl_give isl_union_set *copy() const &; inline __isl_give isl_union_set *copy() && = delete; @@ -3393,58 +3363,58 @@ class union_set { inline __isl_give isl_union_set *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::union_set add_set(isl::set set) const; - inline isl::union_set affine_hull() const; - inline isl::union_set apply(isl::union_map umap) const; - inline isl::union_set coalesce() const; - inline isl::union_set compute_divs() const; - inline isl::union_set detect_equalities() const; - static inline isl::union_set empty(isl::space space); - inline bool every_set(const std::function &test) const; - inline isl::set extract_set(isl::space dim) const; - inline void foreach_point(const std::function &fn) const; - inline void foreach_set(const std::function &fn) const; - inline isl::set_list get_set_list() const; - inline isl::space get_space() const; - inline isl::union_set gist(isl::union_set context) const; - inline isl::union_set gist_params(isl::set set) const; - inline isl::union_map identity() const; - inline isl::union_set intersect(isl::union_set uset2) const; - inline isl::union_set intersect_params(isl::set set) const; - inline bool involves_param(const isl::id &id) const; - inline bool is_disjoint(const isl::union_set &uset2) const; + inline union_set add_set(set set) const; + inline union_set affine_hull() const; + inline union_set apply(union_map umap) const; + inline union_set coalesce() const; + inline union_set compute_divs() const; + inline union_set detect_equalities() const; + static inline union_set empty(space space); + inline bool every_set(const std::function &test) const; + inline set extract_set(space dim) const; + inline void foreach_point(const std::function &fn) const; + inline void foreach_set(const std::function &fn) const; + inline set_list get_set_list() const; + inline space get_space() const; + inline union_set gist(union_set context) const; + inline union_set gist_params(set set) const; + inline union_map identity() const; + inline union_set intersect(union_set uset2) const; + inline union_set intersect_params(set set) const; + inline bool involves_param(const id &id) const; + inline bool is_disjoint(const union_set &uset2) const; inline bool is_empty() const; - inline bool is_equal(const isl::union_set &uset2) const; + inline bool is_equal(const union_set &uset2) const; inline bool is_params() const; - inline bool is_strict_subset(const isl::union_set &uset2) const; - inline bool is_subset(const isl::union_set &uset2) const; - inline isl::union_set lexmax() const; - inline isl::union_set lexmin() const; + inline bool is_strict_subset(const union_set &uset2) const; + inline bool is_subset(const union_set &uset2) const; + inline union_set lexmax() const; + inline union_set lexmin() const; inline int n_set() const; - inline isl::set params() const; - inline isl::union_set polyhedral_hull() const; - inline isl::union_set preimage(isl::multi_aff ma) const; - inline isl::union_set preimage(isl::pw_multi_aff pma) const; - inline isl::union_set preimage(isl::union_pw_multi_aff upma) const; - inline isl::point sample_point() const; - inline isl::union_set subtract(isl::union_set uset2) const; - inline isl::union_set unite(isl::union_set uset2) const; - inline isl::union_set universe() const; - inline isl::union_map unwrap() const; - inline isl::union_map wrapped_domain_map() const; + inline set params() const; + inline union_set polyhedral_hull() const; + inline union_set preimage(multi_aff ma) const; + inline union_set preimage(pw_multi_aff pma) const; + inline union_set preimage(union_pw_multi_aff upma) const; + inline point sample_point() const; + inline union_set subtract(union_set uset2) const; + inline union_set unite(union_set uset2) const; + inline union_set universe() const; + inline union_map unwrap() const; + inline union_map wrapped_domain_map() const; typedef isl_union_set* isl_ptr_t; }; // declarations for isl::union_set_list -inline isl::union_set_list manage(__isl_take isl_union_set_list *ptr); -inline isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); +inline union_set_list manage(__isl_take isl_union_set_list *ptr); +inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); class union_set_list { - friend inline isl::union_set_list manage(__isl_take isl_union_set_list *ptr); - friend inline isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); + friend inline union_set_list manage(__isl_take isl_union_set_list *ptr); + friend inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr); protected: isl_union_set_list *ptr = nullptr; @@ -3453,10 +3423,10 @@ class union_set_list { public: inline /* implicit */ union_set_list(); - inline /* implicit */ union_set_list(const isl::union_set_list &obj); - inline explicit union_set_list(isl::union_set el); - inline explicit union_set_list(isl::ctx ctx, int n); - inline isl::union_set_list &operator=(isl::union_set_list obj); + inline /* implicit */ union_set_list(const union_set_list &obj); + inline explicit union_set_list(union_set el); + inline explicit union_set_list(ctx ctx, int n); + inline union_set_list &operator=(union_set_list obj); inline ~union_set_list(); inline __isl_give isl_union_set_list *copy() const &; inline __isl_give isl_union_set_list *copy() && = delete; @@ -3464,25 +3434,25 @@ class union_set_list { inline __isl_give isl_union_set_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::union_set_list add(isl::union_set el) const; - inline isl::union_set_list concat(isl::union_set_list list2) const; - inline isl::union_set_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::union_set get_at(int index) const; - inline isl::union_set_list reverse() const; + inline ctx get_ctx() const; + + inline union_set_list add(union_set el) const; + inline union_set_list concat(union_set_list list2) const; + inline union_set_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline union_set get_at(int index) const; + inline union_set_list reverse() const; inline int size() const; typedef isl_union_set_list* isl_ptr_t; }; // declarations for isl::val -inline isl::val manage(__isl_take isl_val *ptr); -inline isl::val manage_copy(__isl_keep isl_val *ptr); +inline val manage(__isl_take isl_val *ptr); +inline val manage_copy(__isl_keep isl_val *ptr); class val { - friend inline isl::val manage(__isl_take isl_val *ptr); - friend inline isl::val manage_copy(__isl_keep isl_val *ptr); + friend inline val manage(__isl_take isl_val *ptr); + friend inline val manage_copy(__isl_keep isl_val *ptr); protected: isl_val *ptr = nullptr; @@ -3491,10 +3461,10 @@ class val { public: inline /* implicit */ val(); - inline /* implicit */ val(const isl::val &obj); - inline explicit val(isl::ctx ctx, const std::string &str); - inline explicit val(isl::ctx ctx, long i); - inline isl::val &operator=(isl::val obj); + inline /* implicit */ val(const val &obj); + inline explicit val(ctx ctx, const std::string &str); + inline explicit val(ctx ctx, long i); + inline val &operator=(val obj); inline ~val(); inline __isl_give isl_val *copy() const &; inline __isl_give isl_val *copy() && = delete; @@ -3502,25 +3472,25 @@ class val { inline __isl_give isl_val *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; + inline ctx get_ctx() const; inline std::string to_str() const; - inline isl::val abs() const; - inline bool abs_eq(const isl::val &v2) const; - inline isl::val add(isl::val v2) const; - inline isl::val ceil() const; + inline val abs() const; + inline bool abs_eq(const val &v2) const; + inline val add(val v2) const; + inline val ceil() const; inline int cmp_si(long i) const; - inline isl::val div(isl::val v2) const; - inline bool eq(const isl::val &v2) const; - inline isl::val floor() const; - inline isl::val gcd(isl::val v2) const; - inline bool ge(const isl::val &v2) const; + inline val div(val v2) const; + inline bool eq(const val &v2) const; + inline val floor() const; + inline val gcd(val v2) const; + inline bool ge(const val &v2) const; inline long get_den_si() const; inline long get_num_si() const; - inline bool gt(const isl::val &v2) const; - static inline isl::val infty(isl::ctx ctx); - inline isl::val inv() const; - inline bool is_divisible_by(const isl::val &v2) const; + inline bool gt(const val &v2) const; + static inline val infty(ctx ctx); + inline val inv() const; + inline bool is_divisible_by(const val &v2) const; inline bool is_infty() const; inline bool is_int() const; inline bool is_nan() const; @@ -3533,32 +3503,32 @@ class val { inline bool is_pos() const; inline bool is_rat() const; inline bool is_zero() const; - inline bool le(const isl::val &v2) const; - inline bool lt(const isl::val &v2) const; - inline isl::val max(isl::val v2) const; - inline isl::val min(isl::val v2) const; - inline isl::val mod(isl::val v2) const; - inline isl::val mul(isl::val v2) const; - static inline isl::val nan(isl::ctx ctx); - inline bool ne(const isl::val &v2) const; - inline isl::val neg() const; - static inline isl::val neginfty(isl::ctx ctx); - static inline isl::val negone(isl::ctx ctx); - static inline isl::val one(isl::ctx ctx); + inline bool le(const val &v2) const; + inline bool lt(const val &v2) const; + inline val max(val v2) const; + inline val min(val v2) const; + inline val mod(val v2) const; + inline val mul(val v2) const; + static inline val nan(ctx ctx); + inline bool ne(const val &v2) const; + inline val neg() const; + static inline val neginfty(ctx ctx); + static inline val negone(ctx ctx); + static inline val one(ctx ctx); inline int sgn() const; - inline isl::val sub(isl::val v2) const; - inline isl::val trunc() const; - static inline isl::val zero(isl::ctx ctx); + inline val sub(val v2) const; + inline val trunc() const; + static inline val zero(ctx ctx); typedef isl_val* isl_ptr_t; }; // declarations for isl::val_list -inline isl::val_list manage(__isl_take isl_val_list *ptr); -inline isl::val_list manage_copy(__isl_keep isl_val_list *ptr); +inline val_list manage(__isl_take isl_val_list *ptr); +inline val_list manage_copy(__isl_keep isl_val_list *ptr); class val_list { - friend inline isl::val_list manage(__isl_take isl_val_list *ptr); - friend inline isl::val_list manage_copy(__isl_keep isl_val_list *ptr); + friend inline val_list manage(__isl_take isl_val_list *ptr); + friend inline val_list manage_copy(__isl_keep isl_val_list *ptr); protected: isl_val_list *ptr = nullptr; @@ -3567,10 +3537,10 @@ class val_list { public: inline /* implicit */ val_list(); - inline /* implicit */ val_list(const isl::val_list &obj); - inline explicit val_list(isl::val el); - inline explicit val_list(isl::ctx ctx, int n); - inline isl::val_list &operator=(isl::val_list obj); + inline /* implicit */ val_list(const val_list &obj); + inline explicit val_list(val el); + inline explicit val_list(ctx ctx, int n); + inline val_list &operator=(val_list obj); inline ~val_list(); inline __isl_give isl_val_list *copy() const &; inline __isl_give isl_val_list *copy() && = delete; @@ -3578,95 +3548,85 @@ class val_list { inline __isl_give isl_val_list *release(); inline bool is_null() const; inline explicit operator bool() const; - inline isl::ctx get_ctx() const; - - inline isl::val_list add(isl::val el) const; - inline isl::val_list concat(isl::val_list list2) const; - inline isl::val_list drop(unsigned int first, unsigned int n) const; - inline void foreach(const std::function &fn) const; - inline isl::val get_at(int index) const; - inline isl::val_list reverse() const; + inline ctx get_ctx() const; + + inline val_list add(val el) const; + inline val_list concat(val_list list2) const; + inline val_list drop(unsigned int first, unsigned int n) const; + inline void foreach(const std::function &fn) const; + inline val get_at(int index) const; + inline val_list reverse() const; inline int size() const; typedef isl_val_list* isl_ptr_t; }; // implementations for isl::aff -isl::aff manage(__isl_take isl_aff *ptr) { +aff manage(__isl_take isl_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return aff(ptr); } -isl::aff manage_copy(__isl_keep isl_aff *ptr) { +aff manage_copy(__isl_keep isl_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return aff(ptr); } aff::aff() : ptr(nullptr) {} -aff::aff(const isl::aff &obj) - : ptr(obj.copy()) +aff::aff(const aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } aff::aff(__isl_take isl_aff *ptr) : ptr(ptr) {} -aff::aff(isl::local_space ls) +aff::aff(local_space ls) { if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_zero_on_domain(ls.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff::aff(isl::local_space ls, isl::val val) +aff::aff(local_space ls, val val) { if (ls.is_null() || val.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_val_on_domain(ls.release(), val.release()); if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -aff::aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_aff_var_on_domain(ls.release(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff::aff(isl::ctx ctx, const std::string &str) +aff::aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff &aff::operator=(isl::aff obj) { +aff &aff::operator=(aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -3714,449 +3674,462 @@ std::string aff::to_str() const { } -isl::ctx aff::get_ctx() const { - return isl::ctx(isl_aff_get_ctx(ptr)); +ctx aff::get_ctx() const { + return ctx(isl_aff_get_ctx(ptr)); } -isl::aff aff::add(isl::aff aff2) const +aff aff::add(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_add(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +aff aff::add_constant(val v) const +{ + if (!ptr || v.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_aff_add_constant_val(copy(), v.release()); + if (!res) + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::add_constant_si(int v) const +aff aff::add_constant_si(int v) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_add_constant_si(copy(), v); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::ceil() const +aff aff::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::div(isl::aff aff2) const +aff aff::div(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_div(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::eq_set(isl::aff aff2) const +set aff::eq_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_eq_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::eval(isl::point pnt) const +val aff::eval(point pnt) const { if (!ptr || pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_eval(copy(), pnt.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::floor() const +aff aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::ge_set(isl::aff aff2) const +set aff::ge_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ge_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::get_constant_val() const +val aff::get_constant_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_constant_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val aff::get_denominator_val() const +val aff::get_denominator_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_denominator_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::get_div(int pos) const +aff aff::get_div(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_div(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space aff::get_local_space() const +local_space aff::get_local_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_local_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space aff::get_space() const +space aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::gt_set(isl::aff aff2) const +set aff::gt_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_gt_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::le_set(isl::aff aff2) const +set aff::le_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_le_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::lt_set(isl::aff aff2) const +set aff::lt_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_lt_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::mod(isl::val mod) const +aff aff::mod(val mod) const { if (!ptr || mod.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_mod_val(copy(), mod.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::mul(isl::aff aff2) const +aff aff::mul(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_mul(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set aff::ne_set(isl::aff aff2) const +set aff::ne_set(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_ne_set(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::neg() const +aff aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::param_on_domain_space(isl::space space, isl::id id) +aff aff::param_on_domain_space(space space, id id) { if (space.is_null() || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_param_on_domain_space_id(space.release(), id.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool aff::plain_is_equal(const isl::aff &aff2) const +bool aff::plain_is_equal(const aff &aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_plain_is_equal(get(), aff2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::aff aff::project_domain_on_params() const +aff aff::project_domain_on_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_project_domain_on_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::pullback(isl::multi_aff ma) const +aff aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale(isl::val v) const +aff aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale_down(isl::val v) const +aff aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::scale_down_ui(unsigned int f) const +aff aff::scale_down_ui(unsigned int f) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_scale_down_ui(copy(), f); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::set_constant_si(int v) const +aff aff::set_constant_si(int v) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_set_constant_si(copy(), v); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::set_constant_val(isl::val v) const +aff aff::set_constant_val(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_set_constant_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::sub(isl::aff aff2) const +aff aff::sub(aff aff2) const { if (!ptr || aff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_sub(copy(), aff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::unbind_params_insert_domain(isl::multi_id domain) const +aff aff::unbind_params_insert_domain(multi_id domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_unbind_params_insert_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff aff::zero_on_domain(isl::space space) +aff aff::zero_on_domain(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_zero_on_domain_space(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::aff_list -isl::aff_list manage(__isl_take isl_aff_list *ptr) { +aff_list manage(__isl_take isl_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return aff_list(ptr); } -isl::aff_list manage_copy(__isl_keep isl_aff_list *ptr) { +aff_list manage_copy(__isl_keep isl_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return aff_list(ptr); } aff_list::aff_list() : ptr(nullptr) {} -aff_list::aff_list(const isl::aff_list &obj) - : ptr(obj.copy()) +aff_list::aff_list(const aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } aff_list::aff_list(__isl_take isl_aff_list *ptr) : ptr(ptr) {} -aff_list::aff_list(isl::aff el) +aff_list::aff_list(aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_from_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff_list::aff_list(isl::ctx ctx, int n) +aff_list::aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -aff_list &aff_list::operator=(isl::aff_list obj) { +aff_list &aff_list::operator=(aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4190,62 +4163,62 @@ aff_list::operator bool() const -isl::ctx aff_list::get_ctx() const { - return isl::ctx(isl_aff_list_get_ctx(ptr)); +ctx aff_list::get_ctx() const { + return ctx(isl_aff_list_get_ctx(ptr)); } -isl::aff_list aff_list::add(isl::aff el) const +aff_list aff_list::add(aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::concat(isl::aff_list list2) const +aff_list aff_list::concat(aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::drop(unsigned int first, unsigned int n) const +aff_list aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void aff_list::foreach(const std::function &fn) const +void aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -4254,86 +4227,90 @@ void aff_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::aff aff_list::get_at(int index) const +aff aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list aff_list::reverse() const +aff_list aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_aff_list_size(get()); return res; } // implementations for isl::ast_build -isl::ast_build manage(__isl_take isl_ast_build *ptr) { +ast_build manage(__isl_take isl_ast_build *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_build(ptr); } -isl::ast_build manage_copy(__isl_keep isl_ast_build *ptr) { +ast_build manage_copy(__isl_keep isl_ast_build *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_build_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_build_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_build(ptr); } ast_build::ast_build() : ptr(nullptr) {} -ast_build::ast_build(const isl::ast_build &obj) - : ptr(obj.copy()) +ast_build::ast_build(const ast_build &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_build_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); copy_callbacks(obj); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_build_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_build::ast_build(__isl_take isl_ast_build *ptr) : ptr(ptr) {} -ast_build::ast_build(isl::ctx ctx) +ast_build::ast_build(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_alloc(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_build &ast_build::operator=(isl::ast_build obj) { +ast_build &ast_build::operator=(ast_build obj) { std::swap(this->ptr, obj.ptr); copy_callbacks(obj); return *this; @@ -4354,8 +4331,7 @@ __isl_keep isl_ast_build *ast_build::get() const { __isl_give isl_ast_build *ast_build::release() { if (at_each_domain_data) - throw isl::exception::create(isl_error_invalid, - "cannot release object with persistent callbacks", __FILE__, __LINE__); + exception::throw_invalid("cannot release object with persistent callbacks", __FILE__, __LINE__); isl_ast_build *tmp = ptr; ptr = nullptr; return tmp; @@ -4371,11 +4347,11 @@ ast_build::operator bool() const -isl::ctx ast_build::get_ctx() const { - return isl::ctx(isl_ast_build_get_ctx(ptr)); +ctx ast_build::get_ctx() const { + return ctx(isl_ast_build_get_ctx(ptr)); } -ast_build &ast_build::copy_callbacks(const isl::ast_build &obj) +ast_build &ast_build::copy_callbacks(const ast_build &obj) { at_each_domain_data = obj.at_each_domain_data; return *this; @@ -4384,41 +4360,41 @@ ast_build &ast_build::copy_callbacks(const isl::ast_build &obj) isl_ast_node *ast_build::at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2) { auto *data = static_cast(arg_2); - try { - auto ret = (data->func)(isl::manage(arg_0), isl::manage_copy(arg_1)); + ISL_CPP_TRY { + auto ret = (data->func)(manage(arg_0), manage_copy(arg_1)); return ret.release(); - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return NULL; } } -void ast_build::set_at_each_domain_data(const std::function &fn) +void ast_build::set_at_each_domain_data(const std::function &fn) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_build_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); at_each_domain_data = std::make_shared(); at_each_domain_data->func = fn; ptr = isl_ast_build_set_at_each_domain(ptr, &at_each_domain, at_each_domain_data.get()); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); } -isl::ast_build ast_build::set_at_each_domain(const std::function &fn) const +ast_build ast_build::set_at_each_domain(const std::function &fn) const { auto copy = *this; copy.set_at_each_domain_data(fn); return copy; } -isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const +ast_expr ast_build::access_from(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4426,16 +4402,16 @@ isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const +ast_expr ast_build::access_from(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4443,16 +4419,16 @@ isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::ast_from_schedule(isl::union_map schedule) const +ast_node ast_build::ast_from_schedule(union_map schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_ast_from_schedule(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4460,16 +4436,16 @@ isl::ast_node ast_build::ast_from_schedule(isl::union_map schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const +ast_expr ast_build::call_from(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4477,16 +4453,16 @@ isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const +ast_expr ast_build::call_from(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4494,16 +4470,16 @@ isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::expr_from(isl::set set) const +ast_expr ast_build::expr_from(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_expr_from_set(get(), set.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4511,16 +4487,16 @@ isl::ast_expr ast_build::expr_from(isl::set set) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const +ast_expr ast_build::expr_from(pw_aff pa) const { if (!ptr || pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4528,29 +4504,28 @@ isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_build ast_build::from_context(isl::set set) +ast_build ast_build::from_context(set set) { if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_from_context(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map ast_build::get_schedule() const +union_map ast_build::get_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_get_schedule(get()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4558,16 +4533,16 @@ isl::union_map ast_build::get_schedule() const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space ast_build::get_schedule_space() const +space ast_build::get_schedule_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_get_schedule_space(get()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4575,16 +4550,16 @@ isl::space ast_build::get_schedule_space() const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::node_from(isl::schedule schedule) const +ast_node ast_build::node_from(schedule schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_node_from_schedule(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4592,16 +4567,16 @@ isl::ast_node ast_build::node_from(isl::schedule schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const +ast_node ast_build::node_from_schedule_map(union_map schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4609,16 +4584,16 @@ isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_build ast_build::set_iterators(isl::id_list iterators) const +ast_build ast_build::set_iterators(id_list iterators) const { if (!ptr || iterators.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_build_set_iterators(copy(), iterators.release()); if (at_each_domain_data && at_each_domain_data->eptr) { std::exception_ptr eptr = at_each_domain_data->eptr; @@ -4626,43 +4601,47 @@ isl::ast_build ast_build::set_iterators(isl::id_list iterators) const std::rethrow_exception(eptr); } if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res).copy_callbacks(*this); } // implementations for isl::ast_expr -isl::ast_expr manage(__isl_take isl_ast_expr *ptr) { +ast_expr manage(__isl_take isl_ast_expr *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_expr(ptr); } -isl::ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) { +ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_expr_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_expr_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_expr(ptr); } ast_expr::ast_expr() : ptr(nullptr) {} -ast_expr::ast_expr(const isl::ast_expr &obj) - : ptr(obj.copy()) +ast_expr::ast_expr(const ast_expr &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_expr_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_expr_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_expr::ast_expr(__isl_take isl_ast_expr *ptr) : ptr(ptr) {} -ast_expr &ast_expr::operator=(isl::ast_expr obj) { +ast_expr &ast_expr::operator=(ast_expr obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4718,8 +4697,7 @@ template bool ast_expr::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_expr_get_type(get()) == T::type; } template @@ -4728,40 +4706,40 @@ T ast_expr::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_expr::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -bool ast_expr::is_equal(const isl::ast_expr &expr2) const +bool ast_expr::is_equal(const ast_expr &expr2) const { if (!ptr || expr2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_is_equal(get(), expr2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::ast_expr ast_expr::set_op_arg(int pos, isl::ast_expr arg) const +ast_expr ast_expr::set_op_arg(int pos, ast_expr arg) const { if (!ptr || arg.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_set_op_arg(copy(), pos, arg.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string ast_expr::to_C_str() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_to_C_str(get()); std::string tmp(res); free(res); @@ -4773,7 +4751,7 @@ std::string ast_expr::to_C_str() const ast_expr_id::ast_expr_id() : ast_expr() {} -ast_expr_id::ast_expr_id(const isl::ast_expr_id &obj) +ast_expr_id::ast_expr_id(const ast_expr_id &obj) : ast_expr(obj) { } @@ -4782,7 +4760,7 @@ ast_expr_id::ast_expr_id(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_id &ast_expr_id::operator=(isl::ast_expr_id obj) { +ast_expr_id &ast_expr_id::operator=(ast_expr_id obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4809,19 +4787,19 @@ std::string ast_expr_id::to_str() const { } -isl::ctx ast_expr_id::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_id::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::id ast_expr_id::get_id() const +id ast_expr_id::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_id_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -4830,7 +4808,7 @@ isl::id ast_expr_id::get_id() const ast_expr_int::ast_expr_int() : ast_expr() {} -ast_expr_int::ast_expr_int(const isl::ast_expr_int &obj) +ast_expr_int::ast_expr_int(const ast_expr_int &obj) : ast_expr(obj) { } @@ -4839,7 +4817,7 @@ ast_expr_int::ast_expr_int(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_int &ast_expr_int::operator=(isl::ast_expr_int obj) { +ast_expr_int &ast_expr_int::operator=(ast_expr_int obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4866,19 +4844,19 @@ std::string ast_expr_int::to_str() const { } -isl::ctx ast_expr_int::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_int::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::val ast_expr_int::get_val() const +val ast_expr_int::get_val() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_int_get_val(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -4887,7 +4865,7 @@ isl::val ast_expr_int::get_val() const ast_expr_op::ast_expr_op() : ast_expr() {} -ast_expr_op::ast_expr_op(const isl::ast_expr_op &obj) +ast_expr_op::ast_expr_op(const ast_expr_op &obj) : ast_expr(obj) { } @@ -4896,7 +4874,7 @@ ast_expr_op::ast_expr_op(__isl_take isl_ast_expr *ptr) : ast_expr(ptr) {} -ast_expr_op &ast_expr_op::operator=(isl::ast_expr_op obj) { +ast_expr_op &ast_expr_op::operator=(ast_expr_op obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -4927,8 +4905,7 @@ template bool ast_expr_op::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_expr_op_get_type(get()) == T::type; } template @@ -4937,65 +4914,69 @@ T ast_expr_op::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_expr_op::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_expr_op::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } -isl::ast_expr ast_expr_op::get_arg(int pos) const +ast_expr ast_expr_op::get_arg(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_op_get_arg(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int ast_expr_op::get_n_arg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_expr_op_get_n_arg(get()); return res; } // implementations for isl::ast_node -isl::ast_node manage(__isl_take isl_ast_node *ptr) { +ast_node manage(__isl_take isl_ast_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_node(ptr); } -isl::ast_node manage_copy(__isl_keep isl_ast_node *ptr) { +ast_node manage_copy(__isl_keep isl_ast_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_node_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_node_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_node(ptr); } ast_node::ast_node() : ptr(nullptr) {} -ast_node::ast_node(const isl::ast_node &obj) - : ptr(obj.copy()) +ast_node::ast_node(const ast_node &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_node_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_node_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_node::ast_node(__isl_take isl_ast_node *ptr) : ptr(ptr) {} -ast_node &ast_node::operator=(isl::ast_node obj) { +ast_node &ast_node::operator=(ast_node obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5047,8 +5028,7 @@ template bool ast_node::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_ast_node_get_type(get()) == T::type; } template @@ -5057,40 +5037,40 @@ T ast_node::as() return isa() ? T(copy()) : T(); } -isl::ctx ast_node::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::id ast_node::get_annotation() const +id ast_node::get_annotation() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_get_annotation(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node::set_annotation(isl::id annotation) const +ast_node ast_node::set_annotation(id annotation) const { if (!ptr || annotation.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_set_annotation(copy(), annotation.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string ast_node::to_C_str() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_to_C_str(get()); std::string tmp(res); free(res); @@ -5102,7 +5082,7 @@ std::string ast_node::to_C_str() const ast_node_block::ast_node_block() : ast_node() {} -ast_node_block::ast_node_block(const isl::ast_node_block &obj) +ast_node_block::ast_node_block(const ast_node_block &obj) : ast_node(obj) { } @@ -5111,7 +5091,7 @@ ast_node_block::ast_node_block(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_block &ast_node_block::operator=(isl::ast_node_block obj) { +ast_node_block &ast_node_block::operator=(ast_node_block obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5134,19 +5114,19 @@ std::string ast_node_block::to_str() const { } -isl::ctx ast_node_block::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_block::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_node_list ast_node_block::get_children() const +ast_node_list ast_node_block::get_children() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_block_get_children(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5155,7 +5135,7 @@ isl::ast_node_list ast_node_block::get_children() const ast_node_for::ast_node_for() : ast_node() {} -ast_node_for::ast_node_for(const isl::ast_node_for &obj) +ast_node_for::ast_node_for(const ast_node_for &obj) : ast_node(obj) { } @@ -5164,7 +5144,7 @@ ast_node_for::ast_node_for(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_for &ast_node_for::operator=(isl::ast_node_for obj) { +ast_node_for &ast_node_for::operator=(ast_node_for obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5187,92 +5167,92 @@ std::string ast_node_for::to_str() const { } -isl::ctx ast_node_for::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_for::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_node ast_node_for::get_body() const +ast_node ast_node_for::get_body() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_body(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_cond() const +ast_expr ast_node_for::get_cond() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_cond(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_inc() const +ast_expr ast_node_for::get_inc() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_inc(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_init() const +ast_expr ast_node_for::get_init() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_init(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_expr ast_node_for::get_iterator() const +ast_expr ast_node_for::get_iterator() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_get_iterator(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool ast_node_for::is_coincident() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_is_coincident(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool ast_node_for::is_degenerate() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_for_is_degenerate(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } // implementations for isl::ast_node_if @@ -5280,7 +5260,7 @@ bool ast_node_for::is_degenerate() const ast_node_if::ast_node_if() : ast_node() {} -ast_node_if::ast_node_if(const isl::ast_node_if &obj) +ast_node_if::ast_node_if(const ast_node_if &obj) : ast_node(obj) { } @@ -5289,7 +5269,7 @@ ast_node_if::ast_node_if(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_if &ast_node_if::operator=(isl::ast_node_if obj) { +ast_node_if &ast_node_if::operator=(ast_node_if obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5312,111 +5292,114 @@ std::string ast_node_if::to_str() const { } -isl::ctx ast_node_if::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_if::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_expr ast_node_if::get_cond() const +ast_expr ast_node_if::get_cond() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_cond(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_if::get_else() const +ast_node ast_node_if::get_else() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_else(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_if::get_then() const +ast_node ast_node_if::get_then() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_get_then(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool ast_node_if::has_else() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_if_has_else(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } // implementations for isl::ast_node_list -isl::ast_node_list manage(__isl_take isl_ast_node_list *ptr) { +ast_node_list manage(__isl_take isl_ast_node_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return ast_node_list(ptr); } -isl::ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) { +ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_ast_node_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_ast_node_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return ast_node_list(ptr); } ast_node_list::ast_node_list() : ptr(nullptr) {} -ast_node_list::ast_node_list(const isl::ast_node_list &obj) - : ptr(obj.copy()) +ast_node_list::ast_node_list(const ast_node_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_ast_node_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_ast_node_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } ast_node_list::ast_node_list(__isl_take isl_ast_node_list *ptr) : ptr(ptr) {} -ast_node_list::ast_node_list(isl::ast_node el) +ast_node_list::ast_node_list(ast_node el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_from_ast_node(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_node_list::ast_node_list(isl::ctx ctx, int n) +ast_node_list::ast_node_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -ast_node_list &ast_node_list::operator=(isl::ast_node_list obj) { +ast_node_list &ast_node_list::operator=(ast_node_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5450,62 +5433,62 @@ ast_node_list::operator bool() const -isl::ctx ast_node_list::get_ctx() const { - return isl::ctx(isl_ast_node_list_get_ctx(ptr)); +ctx ast_node_list::get_ctx() const { + return ctx(isl_ast_node_list_get_ctx(ptr)); } -isl::ast_node_list ast_node_list::add(isl::ast_node el) const +ast_node_list ast_node_list::add(ast_node el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::concat(isl::ast_node_list list2) const +ast_node_list ast_node_list::concat(ast_node_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const +ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void ast_node_list::foreach(const std::function &fn) const +void ast_node_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_ast_node *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -5514,40 +5497,40 @@ void ast_node_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::ast_node ast_node_list::get_at(int index) const +ast_node ast_node_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node_list ast_node_list::reverse() const +ast_node_list ast_node_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int ast_node_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_list_size(get()); return res; } @@ -5557,7 +5540,7 @@ int ast_node_list::size() const ast_node_mark::ast_node_mark() : ast_node() {} -ast_node_mark::ast_node_mark(const isl::ast_node_mark &obj) +ast_node_mark::ast_node_mark(const ast_node_mark &obj) : ast_node(obj) { } @@ -5566,7 +5549,7 @@ ast_node_mark::ast_node_mark(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_mark &ast_node_mark::operator=(isl::ast_node_mark obj) { +ast_node_mark &ast_node_mark::operator=(ast_node_mark obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5589,31 +5572,31 @@ std::string ast_node_mark::to_str() const { } -isl::ctx ast_node_mark::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_mark::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::id ast_node_mark::get_id() const +id ast_node_mark::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_mark_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::ast_node ast_node_mark::get_node() const +ast_node ast_node_mark::get_node() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_mark_get_node(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5622,7 +5605,7 @@ isl::ast_node ast_node_mark::get_node() const ast_node_user::ast_node_user() : ast_node() {} -ast_node_user::ast_node_user(const isl::ast_node_user &obj) +ast_node_user::ast_node_user(const ast_node_user &obj) : ast_node(obj) { } @@ -5631,7 +5614,7 @@ ast_node_user::ast_node_user(__isl_take isl_ast_node *ptr) : ast_node(ptr) {} -ast_node_user &ast_node_user::operator=(isl::ast_node_user obj) { +ast_node_user &ast_node_user::operator=(ast_node_user obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5654,19 +5637,19 @@ std::string ast_node_user::to_str() const { } -isl::ctx ast_node_user::get_ctx() const { - return isl::ctx(isl_ast_node_get_ctx(ptr)); +ctx ast_node_user::get_ctx() const { + return ctx(isl_ast_node_get_ctx(ptr)); } -isl::ast_expr ast_node_user::get_expr() const +ast_expr ast_node_user::get_expr() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_ast_node_user_get_expr(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -5675,7 +5658,7 @@ isl::ast_expr ast_node_user::get_expr() const ast_op_access::ast_op_access() : ast_expr_op() {} -ast_op_access::ast_op_access(const isl::ast_op_access &obj) +ast_op_access::ast_op_access(const ast_op_access &obj) : ast_expr_op(obj) { } @@ -5684,7 +5667,7 @@ ast_op_access::ast_op_access(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_access &ast_op_access::operator=(isl::ast_op_access obj) { +ast_op_access &ast_op_access::operator=(ast_op_access obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5711,8 +5694,8 @@ std::string ast_op_access::to_str() const { } -isl::ctx ast_op_access::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_access::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5721,7 +5704,7 @@ isl::ctx ast_op_access::get_ctx() const { ast_op_add::ast_op_add() : ast_expr_op() {} -ast_op_add::ast_op_add(const isl::ast_op_add &obj) +ast_op_add::ast_op_add(const ast_op_add &obj) : ast_expr_op(obj) { } @@ -5730,7 +5713,7 @@ ast_op_add::ast_op_add(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_add &ast_op_add::operator=(isl::ast_op_add obj) { +ast_op_add &ast_op_add::operator=(ast_op_add obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5757,8 +5740,8 @@ std::string ast_op_add::to_str() const { } -isl::ctx ast_op_add::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_add::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5767,7 +5750,7 @@ isl::ctx ast_op_add::get_ctx() const { ast_op_address_of::ast_op_address_of() : ast_expr_op() {} -ast_op_address_of::ast_op_address_of(const isl::ast_op_address_of &obj) +ast_op_address_of::ast_op_address_of(const ast_op_address_of &obj) : ast_expr_op(obj) { } @@ -5776,7 +5759,7 @@ ast_op_address_of::ast_op_address_of(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_address_of &ast_op_address_of::operator=(isl::ast_op_address_of obj) { +ast_op_address_of &ast_op_address_of::operator=(ast_op_address_of obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5803,8 +5786,8 @@ std::string ast_op_address_of::to_str() const { } -isl::ctx ast_op_address_of::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_address_of::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5813,7 +5796,7 @@ isl::ctx ast_op_address_of::get_ctx() const { ast_op_and::ast_op_and() : ast_expr_op() {} -ast_op_and::ast_op_and(const isl::ast_op_and &obj) +ast_op_and::ast_op_and(const ast_op_and &obj) : ast_expr_op(obj) { } @@ -5822,7 +5805,7 @@ ast_op_and::ast_op_and(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_and &ast_op_and::operator=(isl::ast_op_and obj) { +ast_op_and &ast_op_and::operator=(ast_op_and obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5849,8 +5832,8 @@ std::string ast_op_and::to_str() const { } -isl::ctx ast_op_and::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_and::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5859,7 +5842,7 @@ isl::ctx ast_op_and::get_ctx() const { ast_op_and_then::ast_op_and_then() : ast_expr_op() {} -ast_op_and_then::ast_op_and_then(const isl::ast_op_and_then &obj) +ast_op_and_then::ast_op_and_then(const ast_op_and_then &obj) : ast_expr_op(obj) { } @@ -5868,7 +5851,7 @@ ast_op_and_then::ast_op_and_then(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_and_then &ast_op_and_then::operator=(isl::ast_op_and_then obj) { +ast_op_and_then &ast_op_and_then::operator=(ast_op_and_then obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5895,8 +5878,8 @@ std::string ast_op_and_then::to_str() const { } -isl::ctx ast_op_and_then::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_and_then::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5905,7 +5888,7 @@ isl::ctx ast_op_and_then::get_ctx() const { ast_op_call::ast_op_call() : ast_expr_op() {} -ast_op_call::ast_op_call(const isl::ast_op_call &obj) +ast_op_call::ast_op_call(const ast_op_call &obj) : ast_expr_op(obj) { } @@ -5914,7 +5897,7 @@ ast_op_call::ast_op_call(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_call &ast_op_call::operator=(isl::ast_op_call obj) { +ast_op_call &ast_op_call::operator=(ast_op_call obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5941,8 +5924,8 @@ std::string ast_op_call::to_str() const { } -isl::ctx ast_op_call::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_call::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5951,7 +5934,7 @@ isl::ctx ast_op_call::get_ctx() const { ast_op_cond::ast_op_cond() : ast_expr_op() {} -ast_op_cond::ast_op_cond(const isl::ast_op_cond &obj) +ast_op_cond::ast_op_cond(const ast_op_cond &obj) : ast_expr_op(obj) { } @@ -5960,7 +5943,7 @@ ast_op_cond::ast_op_cond(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_cond &ast_op_cond::operator=(isl::ast_op_cond obj) { +ast_op_cond &ast_op_cond::operator=(ast_op_cond obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -5987,8 +5970,8 @@ std::string ast_op_cond::to_str() const { } -isl::ctx ast_op_cond::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_cond::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -5997,7 +5980,7 @@ isl::ctx ast_op_cond::get_ctx() const { ast_op_div::ast_op_div() : ast_expr_op() {} -ast_op_div::ast_op_div(const isl::ast_op_div &obj) +ast_op_div::ast_op_div(const ast_op_div &obj) : ast_expr_op(obj) { } @@ -6006,7 +5989,7 @@ ast_op_div::ast_op_div(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_div &ast_op_div::operator=(isl::ast_op_div obj) { +ast_op_div &ast_op_div::operator=(ast_op_div obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6033,8 +6016,8 @@ std::string ast_op_div::to_str() const { } -isl::ctx ast_op_div::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_div::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6043,7 +6026,7 @@ isl::ctx ast_op_div::get_ctx() const { ast_op_eq::ast_op_eq() : ast_expr_op() {} -ast_op_eq::ast_op_eq(const isl::ast_op_eq &obj) +ast_op_eq::ast_op_eq(const ast_op_eq &obj) : ast_expr_op(obj) { } @@ -6052,7 +6035,7 @@ ast_op_eq::ast_op_eq(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_eq &ast_op_eq::operator=(isl::ast_op_eq obj) { +ast_op_eq &ast_op_eq::operator=(ast_op_eq obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6079,8 +6062,8 @@ std::string ast_op_eq::to_str() const { } -isl::ctx ast_op_eq::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_eq::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6089,7 +6072,7 @@ isl::ctx ast_op_eq::get_ctx() const { ast_op_fdiv_q::ast_op_fdiv_q() : ast_expr_op() {} -ast_op_fdiv_q::ast_op_fdiv_q(const isl::ast_op_fdiv_q &obj) +ast_op_fdiv_q::ast_op_fdiv_q(const ast_op_fdiv_q &obj) : ast_expr_op(obj) { } @@ -6098,7 +6081,7 @@ ast_op_fdiv_q::ast_op_fdiv_q(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_fdiv_q &ast_op_fdiv_q::operator=(isl::ast_op_fdiv_q obj) { +ast_op_fdiv_q &ast_op_fdiv_q::operator=(ast_op_fdiv_q obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6125,8 +6108,8 @@ std::string ast_op_fdiv_q::to_str() const { } -isl::ctx ast_op_fdiv_q::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_fdiv_q::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6135,7 +6118,7 @@ isl::ctx ast_op_fdiv_q::get_ctx() const { ast_op_ge::ast_op_ge() : ast_expr_op() {} -ast_op_ge::ast_op_ge(const isl::ast_op_ge &obj) +ast_op_ge::ast_op_ge(const ast_op_ge &obj) : ast_expr_op(obj) { } @@ -6144,7 +6127,7 @@ ast_op_ge::ast_op_ge(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_ge &ast_op_ge::operator=(isl::ast_op_ge obj) { +ast_op_ge &ast_op_ge::operator=(ast_op_ge obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6171,8 +6154,8 @@ std::string ast_op_ge::to_str() const { } -isl::ctx ast_op_ge::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_ge::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6181,7 +6164,7 @@ isl::ctx ast_op_ge::get_ctx() const { ast_op_gt::ast_op_gt() : ast_expr_op() {} -ast_op_gt::ast_op_gt(const isl::ast_op_gt &obj) +ast_op_gt::ast_op_gt(const ast_op_gt &obj) : ast_expr_op(obj) { } @@ -6190,7 +6173,7 @@ ast_op_gt::ast_op_gt(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_gt &ast_op_gt::operator=(isl::ast_op_gt obj) { +ast_op_gt &ast_op_gt::operator=(ast_op_gt obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6217,8 +6200,8 @@ std::string ast_op_gt::to_str() const { } -isl::ctx ast_op_gt::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_gt::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6227,7 +6210,7 @@ isl::ctx ast_op_gt::get_ctx() const { ast_op_le::ast_op_le() : ast_expr_op() {} -ast_op_le::ast_op_le(const isl::ast_op_le &obj) +ast_op_le::ast_op_le(const ast_op_le &obj) : ast_expr_op(obj) { } @@ -6236,7 +6219,7 @@ ast_op_le::ast_op_le(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_le &ast_op_le::operator=(isl::ast_op_le obj) { +ast_op_le &ast_op_le::operator=(ast_op_le obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6263,8 +6246,8 @@ std::string ast_op_le::to_str() const { } -isl::ctx ast_op_le::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_le::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6273,7 +6256,7 @@ isl::ctx ast_op_le::get_ctx() const { ast_op_lt::ast_op_lt() : ast_expr_op() {} -ast_op_lt::ast_op_lt(const isl::ast_op_lt &obj) +ast_op_lt::ast_op_lt(const ast_op_lt &obj) : ast_expr_op(obj) { } @@ -6282,7 +6265,7 @@ ast_op_lt::ast_op_lt(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_lt &ast_op_lt::operator=(isl::ast_op_lt obj) { +ast_op_lt &ast_op_lt::operator=(ast_op_lt obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6309,8 +6292,8 @@ std::string ast_op_lt::to_str() const { } -isl::ctx ast_op_lt::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_lt::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6319,7 +6302,7 @@ isl::ctx ast_op_lt::get_ctx() const { ast_op_max::ast_op_max() : ast_expr_op() {} -ast_op_max::ast_op_max(const isl::ast_op_max &obj) +ast_op_max::ast_op_max(const ast_op_max &obj) : ast_expr_op(obj) { } @@ -6328,7 +6311,7 @@ ast_op_max::ast_op_max(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_max &ast_op_max::operator=(isl::ast_op_max obj) { +ast_op_max &ast_op_max::operator=(ast_op_max obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6355,8 +6338,8 @@ std::string ast_op_max::to_str() const { } -isl::ctx ast_op_max::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_max::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6365,7 +6348,7 @@ isl::ctx ast_op_max::get_ctx() const { ast_op_member::ast_op_member() : ast_expr_op() {} -ast_op_member::ast_op_member(const isl::ast_op_member &obj) +ast_op_member::ast_op_member(const ast_op_member &obj) : ast_expr_op(obj) { } @@ -6374,7 +6357,7 @@ ast_op_member::ast_op_member(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_member &ast_op_member::operator=(isl::ast_op_member obj) { +ast_op_member &ast_op_member::operator=(ast_op_member obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6401,8 +6384,8 @@ std::string ast_op_member::to_str() const { } -isl::ctx ast_op_member::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_member::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6411,7 +6394,7 @@ isl::ctx ast_op_member::get_ctx() const { ast_op_min::ast_op_min() : ast_expr_op() {} -ast_op_min::ast_op_min(const isl::ast_op_min &obj) +ast_op_min::ast_op_min(const ast_op_min &obj) : ast_expr_op(obj) { } @@ -6420,7 +6403,7 @@ ast_op_min::ast_op_min(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_min &ast_op_min::operator=(isl::ast_op_min obj) { +ast_op_min &ast_op_min::operator=(ast_op_min obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6447,8 +6430,8 @@ std::string ast_op_min::to_str() const { } -isl::ctx ast_op_min::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_min::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6457,7 +6440,7 @@ isl::ctx ast_op_min::get_ctx() const { ast_op_minus::ast_op_minus() : ast_expr_op() {} -ast_op_minus::ast_op_minus(const isl::ast_op_minus &obj) +ast_op_minus::ast_op_minus(const ast_op_minus &obj) : ast_expr_op(obj) { } @@ -6466,7 +6449,7 @@ ast_op_minus::ast_op_minus(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_minus &ast_op_minus::operator=(isl::ast_op_minus obj) { +ast_op_minus &ast_op_minus::operator=(ast_op_minus obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6493,8 +6476,8 @@ std::string ast_op_minus::to_str() const { } -isl::ctx ast_op_minus::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_minus::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6503,7 +6486,7 @@ isl::ctx ast_op_minus::get_ctx() const { ast_op_mul::ast_op_mul() : ast_expr_op() {} -ast_op_mul::ast_op_mul(const isl::ast_op_mul &obj) +ast_op_mul::ast_op_mul(const ast_op_mul &obj) : ast_expr_op(obj) { } @@ -6512,7 +6495,7 @@ ast_op_mul::ast_op_mul(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_mul &ast_op_mul::operator=(isl::ast_op_mul obj) { +ast_op_mul &ast_op_mul::operator=(ast_op_mul obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6539,8 +6522,8 @@ std::string ast_op_mul::to_str() const { } -isl::ctx ast_op_mul::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_mul::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6549,7 +6532,7 @@ isl::ctx ast_op_mul::get_ctx() const { ast_op_or::ast_op_or() : ast_expr_op() {} -ast_op_or::ast_op_or(const isl::ast_op_or &obj) +ast_op_or::ast_op_or(const ast_op_or &obj) : ast_expr_op(obj) { } @@ -6558,7 +6541,7 @@ ast_op_or::ast_op_or(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_or &ast_op_or::operator=(isl::ast_op_or obj) { +ast_op_or &ast_op_or::operator=(ast_op_or obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6585,8 +6568,8 @@ std::string ast_op_or::to_str() const { } -isl::ctx ast_op_or::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_or::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6595,7 +6578,7 @@ isl::ctx ast_op_or::get_ctx() const { ast_op_or_else::ast_op_or_else() : ast_expr_op() {} -ast_op_or_else::ast_op_or_else(const isl::ast_op_or_else &obj) +ast_op_or_else::ast_op_or_else(const ast_op_or_else &obj) : ast_expr_op(obj) { } @@ -6604,7 +6587,7 @@ ast_op_or_else::ast_op_or_else(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_or_else &ast_op_or_else::operator=(isl::ast_op_or_else obj) { +ast_op_or_else &ast_op_or_else::operator=(ast_op_or_else obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6631,8 +6614,8 @@ std::string ast_op_or_else::to_str() const { } -isl::ctx ast_op_or_else::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_or_else::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6641,7 +6624,7 @@ isl::ctx ast_op_or_else::get_ctx() const { ast_op_pdiv_q::ast_op_pdiv_q() : ast_expr_op() {} -ast_op_pdiv_q::ast_op_pdiv_q(const isl::ast_op_pdiv_q &obj) +ast_op_pdiv_q::ast_op_pdiv_q(const ast_op_pdiv_q &obj) : ast_expr_op(obj) { } @@ -6650,7 +6633,7 @@ ast_op_pdiv_q::ast_op_pdiv_q(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_pdiv_q &ast_op_pdiv_q::operator=(isl::ast_op_pdiv_q obj) { +ast_op_pdiv_q &ast_op_pdiv_q::operator=(ast_op_pdiv_q obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6677,8 +6660,8 @@ std::string ast_op_pdiv_q::to_str() const { } -isl::ctx ast_op_pdiv_q::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_pdiv_q::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6687,7 +6670,7 @@ isl::ctx ast_op_pdiv_q::get_ctx() const { ast_op_pdiv_r::ast_op_pdiv_r() : ast_expr_op() {} -ast_op_pdiv_r::ast_op_pdiv_r(const isl::ast_op_pdiv_r &obj) +ast_op_pdiv_r::ast_op_pdiv_r(const ast_op_pdiv_r &obj) : ast_expr_op(obj) { } @@ -6696,7 +6679,7 @@ ast_op_pdiv_r::ast_op_pdiv_r(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_pdiv_r &ast_op_pdiv_r::operator=(isl::ast_op_pdiv_r obj) { +ast_op_pdiv_r &ast_op_pdiv_r::operator=(ast_op_pdiv_r obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6723,8 +6706,8 @@ std::string ast_op_pdiv_r::to_str() const { } -isl::ctx ast_op_pdiv_r::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_pdiv_r::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6733,7 +6716,7 @@ isl::ctx ast_op_pdiv_r::get_ctx() const { ast_op_select::ast_op_select() : ast_expr_op() {} -ast_op_select::ast_op_select(const isl::ast_op_select &obj) +ast_op_select::ast_op_select(const ast_op_select &obj) : ast_expr_op(obj) { } @@ -6742,7 +6725,7 @@ ast_op_select::ast_op_select(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_select &ast_op_select::operator=(isl::ast_op_select obj) { +ast_op_select &ast_op_select::operator=(ast_op_select obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6769,8 +6752,8 @@ std::string ast_op_select::to_str() const { } -isl::ctx ast_op_select::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_select::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6779,7 +6762,7 @@ isl::ctx ast_op_select::get_ctx() const { ast_op_sub::ast_op_sub() : ast_expr_op() {} -ast_op_sub::ast_op_sub(const isl::ast_op_sub &obj) +ast_op_sub::ast_op_sub(const ast_op_sub &obj) : ast_expr_op(obj) { } @@ -6788,7 +6771,7 @@ ast_op_sub::ast_op_sub(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_sub &ast_op_sub::operator=(isl::ast_op_sub obj) { +ast_op_sub &ast_op_sub::operator=(ast_op_sub obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6815,8 +6798,8 @@ std::string ast_op_sub::to_str() const { } -isl::ctx ast_op_sub::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_sub::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } @@ -6825,7 +6808,7 @@ isl::ctx ast_op_sub::get_ctx() const { ast_op_zdiv_r::ast_op_zdiv_r() : ast_expr_op() {} -ast_op_zdiv_r::ast_op_zdiv_r(const isl::ast_op_zdiv_r &obj) +ast_op_zdiv_r::ast_op_zdiv_r(const ast_op_zdiv_r &obj) : ast_expr_op(obj) { } @@ -6834,7 +6817,7 @@ ast_op_zdiv_r::ast_op_zdiv_r(__isl_take isl_ast_expr *ptr) : ast_expr_op(ptr) {} -ast_op_zdiv_r &ast_op_zdiv_r::operator=(isl::ast_op_zdiv_r obj) { +ast_op_zdiv_r &ast_op_zdiv_r::operator=(ast_op_zdiv_r obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6861,88 +6844,89 @@ std::string ast_op_zdiv_r::to_str() const { } -isl::ctx ast_op_zdiv_r::get_ctx() const { - return isl::ctx(isl_ast_expr_get_ctx(ptr)); +ctx ast_op_zdiv_r::get_ctx() const { + return ctx(isl_ast_expr_get_ctx(ptr)); } // implementations for isl::basic_map -isl::basic_map manage(__isl_take isl_basic_map *ptr) { +basic_map manage(__isl_take isl_basic_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_map(ptr); } -isl::basic_map manage_copy(__isl_keep isl_basic_map *ptr) { +basic_map manage_copy(__isl_keep isl_basic_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_map(ptr); } basic_map::basic_map() : ptr(nullptr) {} -basic_map::basic_map(const isl::basic_map &obj) - : ptr(obj.copy()) +basic_map::basic_map(const basic_map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_map::basic_map(__isl_take isl_basic_map *ptr) : ptr(ptr) {} -basic_map::basic_map(isl::ctx ctx, const std::string &str) +basic_map::basic_map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::basic_set domain, isl::basic_set range) +basic_map::basic_map(basic_set domain, basic_set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::aff aff) +basic_map::basic_map(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map::basic_map(isl::multi_aff maff) +basic_map::basic_map(multi_aff maff) { if (maff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = maff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_multi_aff(maff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map &basic_map::operator=(isl::basic_map obj) { +basic_map &basic_map::operator=(basic_map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -6994,488 +6978,426 @@ std::string basic_map::to_str() const { } -isl::ctx basic_map::get_ctx() const { - return isl::ctx(isl_basic_map_get_ctx(ptr)); -} - -isl::basic_map basic_map::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +ctx basic_map::get_ctx() const { + return ctx(isl_basic_map_get_ctx(ptr)); } -isl::basic_map basic_map::affine_hull() const +basic_map basic_map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::apply_domain(isl::basic_map bmap2) const +basic_map basic_map::apply_domain(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_apply_domain(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::apply_range(isl::basic_map bmap2) const +basic_map basic_map::apply_range(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_apply_range(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_map::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool basic_map::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::basic_map basic_map::curry() const +basic_map basic_map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::deltas() const +basic_set basic_map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::detect_equalities() const +basic_map basic_map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::domain() const +basic_set basic_map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::empty(isl::space space) +basic_map basic_map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten() const +basic_map basic_map::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten_domain() const +basic_map basic_map::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::flatten_range() const +basic_map basic_map::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_map::foreach_constraint(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_basic_map_foreach_constraint(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - -isl::basic_map basic_map::from_domain(isl::basic_set bset) +basic_map basic_map::from_domain(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_domain(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::from_range(isl::basic_set bset) +basic_map basic_map::from_range(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_from_range(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::constraint_list basic_map::get_constraint_list() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_get_constraint_list(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space basic_map::get_space() const +space basic_map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::gist(isl::basic_map context) const +basic_map basic_map::gist(basic_map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect(isl::basic_map bmap2) const +basic_map basic_map::intersect(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect_domain(isl::basic_set bset) const +basic_map basic_map::intersect_domain(basic_set bset) const { if (!ptr || bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect_domain(copy(), bset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::intersect_range(isl::basic_set bset) const +basic_map basic_map::intersect_range(basic_set bset) const { if (!ptr || bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_intersect_range(copy(), bset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool basic_map::is_equal(const isl::basic_map &bmap2) const +bool basic_map::is_equal(const basic_map &bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_equal(get(), bmap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool basic_map::is_subset(const isl::basic_map &bmap2) const +bool basic_map::is_subset(const basic_map &bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_is_subset(get(), bmap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::map basic_map::lexmax() const +map basic_map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map basic_map::lexmin() const +map basic_map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -int basic_map::n_constraint() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_map_n_constraint(get()); - return res; -} - -isl::basic_map basic_map::reverse() const +basic_map basic_map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::sample() const +basic_map basic_map::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map::uncurry() const +basic_map basic_map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map basic_map::unite(isl::basic_map bmap2) const +map basic_map::unite(basic_map bmap2) const { if (!ptr || bmap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_union(copy(), bmap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_map::wrap() const +basic_set basic_map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::basic_map_list -isl::basic_map_list manage(__isl_take isl_basic_map_list *ptr) { +basic_map_list manage(__isl_take isl_basic_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_map_list(ptr); } -isl::basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr) { +basic_map_list manage_copy(__isl_keep isl_basic_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_map_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_map_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_map_list(ptr); } basic_map_list::basic_map_list() : ptr(nullptr) {} -basic_map_list::basic_map_list(const isl::basic_map_list &obj) - : ptr(obj.copy()) +basic_map_list::basic_map_list(const basic_map_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_map_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_map_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_map_list::basic_map_list(__isl_take isl_basic_map_list *ptr) : ptr(ptr) {} -basic_map_list::basic_map_list(isl::basic_map el) +basic_map_list::basic_map_list(basic_map el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_from_basic_map(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map_list::basic_map_list(isl::ctx ctx, int n) +basic_map_list::basic_map_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_map_list &basic_map_list::operator=(isl::basic_map_list obj) { +basic_map_list &basic_map_list::operator=(basic_map_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -7509,62 +7431,62 @@ basic_map_list::operator bool() const -isl::ctx basic_map_list::get_ctx() const { - return isl::ctx(isl_basic_map_list_get_ctx(ptr)); +ctx basic_map_list::get_ctx() const { + return ctx(isl_basic_map_list_get_ctx(ptr)); } -isl::basic_map_list basic_map_list::add(isl::basic_map el) const +basic_map_list basic_map_list::add(basic_map el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::concat(isl::basic_map_list list2) const +basic_map_list basic_map_list::concat(basic_map_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::drop(unsigned int first, unsigned int n) const +basic_map_list basic_map_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_map_list::foreach(const std::function &fn) const +void basic_map_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -7573,109 +7495,112 @@ void basic_map_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::basic_map basic_map_list::get_at(int index) const +basic_map basic_map_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_map_list::intersect() const +basic_map basic_map_list::intersect() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_intersect(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list basic_map_list::reverse() const +basic_map_list basic_map_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int basic_map_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_map_list_size(get()); return res; } // implementations for isl::basic_set -isl::basic_set manage(__isl_take isl_basic_set *ptr) { +basic_set manage(__isl_take isl_basic_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_set(ptr); } -isl::basic_set manage_copy(__isl_keep isl_basic_set *ptr) { +basic_set manage_copy(__isl_keep isl_basic_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_set_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_set_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_set(ptr); } basic_set::basic_set() : ptr(nullptr) {} -basic_set::basic_set(const isl::basic_set &obj) - : ptr(obj.copy()) +basic_set::basic_set(const basic_set &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_set_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_set_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_set::basic_set(__isl_take isl_basic_set *ptr) : ptr(ptr) {} -basic_set::basic_set(isl::point pnt) +basic_set::basic_set(point pnt) { if (pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pnt.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_from_point(pnt.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set::basic_set(isl::ctx ctx, const std::string &str) +basic_set::basic_set(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set &basic_set::operator=(isl::basic_set obj) { +basic_set &basic_set::operator=(basic_set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -7727,318 +7652,244 @@ std::string basic_set::to_str() const { } -isl::ctx basic_set::get_ctx() const { - return isl::ctx(isl_basic_set_get_ctx(ptr)); -} - -isl::basic_set basic_set::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +ctx basic_set::get_ctx() const { + return ctx(isl_basic_set_get_ctx(ptr)); } -isl::basic_set basic_set::affine_hull() const +basic_set basic_set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::apply(isl::basic_map bmap) const +basic_set basic_set::apply(basic_map bmap) const { if (!ptr || bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_apply(copy(), bmap.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::compute_divs() const +set basic_set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::detect_equalities() const +basic_set basic_set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val basic_set::dim_max_val(int pos) const +val basic_set::dim_max_val(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_dim_max_val(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::flatten() const +basic_set basic_set::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_set::foreach_constraint(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_basic_set_foreach_constraint(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - -isl::basic_set basic_set::from_params() const +basic_set basic_set::from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::constraint_list basic_set::get_constraint_list() const +space basic_set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_get_constraint_list(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::local_space basic_set::get_local_space() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_get_local_space(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::space basic_set::get_space() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::gist(isl::basic_set context) const +basic_set basic_set::gist(basic_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::intersect(isl::basic_set bset2) const +basic_set basic_set::intersect(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_intersect(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::intersect_params(isl::basic_set bset2) const +basic_set basic_set::intersect_params(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_intersect_params(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool basic_set::is_equal(const isl::basic_set &bset2) const +bool basic_set::is_equal(const basic_set &bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_equal(get(), bset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool basic_set::is_subset(const isl::basic_set &bset2) const +bool basic_set::is_subset(const basic_set &bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_subset(get(), bset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool basic_set::is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool basic_set::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::set basic_set::lexmax() const +set basic_set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::lexmin() const +set basic_set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val basic_set::max_val(const isl::aff &obj) const +val basic_set::max_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_max_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -int basic_set::n_constraint() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_basic_set_n_constraint(get()); - return res; -} - unsigned int basic_set::n_dim() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_n_dim(get()); return res; } @@ -8046,176 +7897,177 @@ unsigned int basic_set::n_dim() const unsigned int basic_set::n_param() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_n_param(get()); return res; } -isl::basic_set basic_set::nat_universe(isl::space dim) +basic_set basic_set::nat_universe(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_nat_universe(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::params() const +basic_set basic_set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool basic_set::plain_is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_plain_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::basic_set basic_set::sample() const +basic_set basic_set::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point basic_set::sample_point() const +point basic_set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::set_tuple_id(isl::id id) const +basic_set basic_set::set_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set basic_set::unite(isl::basic_set bset2) const +set basic_set::unite(basic_set bset2) const { if (!ptr || bset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_union(copy(), bset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set basic_set::universe(isl::space space) +basic_set basic_set::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map basic_set::unwrap() const +basic_map basic_set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::basic_set_list -isl::basic_set_list manage(__isl_take isl_basic_set_list *ptr) { +basic_set_list manage(__isl_take isl_basic_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return basic_set_list(ptr); } -isl::basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { +basic_set_list manage_copy(__isl_keep isl_basic_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_basic_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_basic_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return basic_set_list(ptr); } basic_set_list::basic_set_list() : ptr(nullptr) {} -basic_set_list::basic_set_list(const isl::basic_set_list &obj) - : ptr(obj.copy()) +basic_set_list::basic_set_list(const basic_set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_basic_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_basic_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } basic_set_list::basic_set_list(__isl_take isl_basic_set_list *ptr) : ptr(ptr) {} -basic_set_list::basic_set_list(isl::basic_set el) +basic_set_list::basic_set_list(basic_set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_from_basic_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set_list::basic_set_list(isl::ctx ctx, int n) +basic_set_list::basic_set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -basic_set_list &basic_set_list::operator=(isl::basic_set_list obj) { +basic_set_list &basic_set_list::operator=(basic_set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -8249,62 +8101,62 @@ basic_set_list::operator bool() const -isl::ctx basic_set_list::get_ctx() const { - return isl::ctx(isl_basic_set_list_get_ctx(ptr)); +ctx basic_set_list::get_ctx() const { + return ctx(isl_basic_set_list_get_ctx(ptr)); } -isl::basic_set_list basic_set_list::add(isl::basic_set el) const +basic_set_list basic_set_list::add(basic_set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::concat(isl::basic_set_list list2) const +basic_set_list basic_set_list::concat(basic_set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const +basic_set_list basic_set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void basic_set_list::foreach(const std::function &fn) const +void basic_set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -8313,662 +8165,222 @@ void basic_set_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::basic_set basic_set_list::get_at(int index) const +basic_set basic_set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list basic_set_list::reverse() const +basic_set_list basic_set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int basic_set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_basic_set_list_size(get()); return res; } -// implementations for isl::constraint -isl::constraint manage(__isl_take isl_constraint *ptr) { +// implementations for isl::fixed_box +fixed_box manage(__isl_take isl_fixed_box *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return constraint(ptr); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + return fixed_box(ptr); } -isl::constraint manage_copy(__isl_keep isl_constraint *ptr) { +fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_constraint_get_ctx(ptr); - ptr = isl_constraint_copy(ptr); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_fixed_box_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = isl_fixed_box_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); - return constraint(ptr); + exception::throw_last_error(ctx); + return fixed_box(ptr); } -constraint::constraint() +fixed_box::fixed_box() : ptr(nullptr) {} -constraint::constraint(const isl::constraint &obj) - : ptr(obj.copy()) +fixed_box::fixed_box(const fixed_box &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_fixed_box_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_constraint_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } -constraint::constraint(__isl_take isl_constraint *ptr) +fixed_box::fixed_box(__isl_take isl_fixed_box *ptr) : ptr(ptr) {} -constraint &constraint::operator=(isl::constraint obj) { +fixed_box &fixed_box::operator=(fixed_box obj) { std::swap(this->ptr, obj.ptr); return *this; } -constraint::~constraint() { +fixed_box::~fixed_box() { if (ptr) - isl_constraint_free(ptr); + isl_fixed_box_free(ptr); } -__isl_give isl_constraint *constraint::copy() const & { - return isl_constraint_copy(ptr); +__isl_give isl_fixed_box *fixed_box::copy() const & { + return isl_fixed_box_copy(ptr); } -__isl_keep isl_constraint *constraint::get() const { +__isl_keep isl_fixed_box *fixed_box::get() const { return ptr; } -__isl_give isl_constraint *constraint::release() { - isl_constraint *tmp = ptr; +__isl_give isl_fixed_box *fixed_box::release() { + isl_fixed_box *tmp = ptr; ptr = nullptr; return tmp; } -bool constraint::is_null() const { +bool fixed_box::is_null() const { return ptr == nullptr; } -constraint::operator bool() const +fixed_box::operator bool() const { return !is_null(); } -inline bool operator==(const constraint& C1, const constraint& C2) { - return C1.is_equal(C2); -} - - - -isl::ctx constraint::get_ctx() const { - return isl::ctx(isl_constraint_get_ctx(ptr)); -} - -isl::constraint constraint::alloc_equality(isl::local_space ls) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_alloc_equality(ls.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::constraint constraint::alloc_inequality(isl::local_space ls) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_alloc_inequality(ls.release()); - if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} -int constraint::cmp_last_non_zero(const isl::constraint &c2) const -{ - if (!ptr || c2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_cmp_last_non_zero(get(), c2.get()); - return res; -} -int constraint::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_dim(get(), static_cast(type)); - return res; +ctx fixed_box::get_ctx() const { + return ctx(isl_fixed_box_get_ctx(ptr)); } -isl::aff constraint::get_aff() const +multi_aff fixed_box::get_offset() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_aff(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_fixed_box_get_offset(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val constraint::get_constant_val() const +multi_val fixed_box::get_size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_constant_val(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_fixed_box_get_size(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff constraint::get_div(int pos) const +space fixed_box::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_div(get(), pos); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_fixed_box_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space constraint::get_local_space() const +bool fixed_box::is_valid() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_local_space(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_fixed_box_is_valid(get()); + if (res < 0) + exception::throw_last_error(ctx); + return bool(res); } -isl::space constraint::get_space() const -{ +// implementations for isl::id +id manage(__isl_take isl_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_get_space(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + return id(ptr); } - -int constraint::is_div_constraint() const -{ +id manage_copy(__isl_keep isl_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_div_constraint(get()); - return res; + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_id_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = isl_id_copy(ptr); + if (!ptr) + exception::throw_last_error(ctx); + return id(ptr); } -bool constraint::is_equal(const isl::constraint &constraint2) const -{ - if (!ptr || constraint2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_equal(get(), constraint2.get()); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} +id::id() + : ptr(nullptr) {} -bool constraint::is_equality() const +id::id(const id &obj) + : ptr(nullptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_is_equality(get()); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_id_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); + if (obj.ptr && !ptr) + exception::throw_last_error(ctx); } -int constraint::plain_cmp(const isl::constraint &c2) const -{ - if (!ptr || c2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_plain_cmp(get(), c2.get()); - return res; -} +id::id(__isl_take isl_id *ptr) + : ptr(ptr) {} -isl::constraint constraint::set_coefficient_si(enum isl::dim_type type, int pos, int v) const +id::id(ctx ctx, const std::string &str) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_coefficient_si(copy(), static_cast(type), pos, v); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_id_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); + exception::throw_last_error(ctx); + ptr = res; } -isl::constraint constraint::set_constant_si(int v) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_constant_si(copy(), v); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +id &id::operator=(id obj) { + std::swap(this->ptr, obj.ptr); + return *this; } -isl::constraint constraint::set_constant_val(isl::val v) const -{ - if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_set_constant_val(copy(), v.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +id::~id() { + if (ptr) + isl_id_free(ptr); } -// implementations for isl::constraint_list -isl::constraint_list manage(__isl_take isl_constraint_list *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return constraint_list(ptr); -} -isl::constraint_list manage_copy(__isl_keep isl_constraint_list *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_constraint_list_get_ctx(ptr); - ptr = isl_constraint_list_copy(ptr); - if (!ptr) - throw exception::create_from_last_error(ctx); - return constraint_list(ptr); -} - -constraint_list::constraint_list() - : ptr(nullptr) {} - -constraint_list::constraint_list(const isl::constraint_list &obj) - : ptr(obj.copy()) -{ - if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_constraint_list_get_ctx(obj.ptr)); -} - -constraint_list::constraint_list(__isl_take isl_constraint_list *ptr) - : ptr(ptr) {} - -constraint_list::constraint_list(isl::constraint el) -{ - if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_from_constraint(el.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -constraint_list::constraint_list(isl::ctx ctx, int n) -{ - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_alloc(ctx.release(), n); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} - -constraint_list &constraint_list::operator=(isl::constraint_list obj) { - std::swap(this->ptr, obj.ptr); - return *this; -} - -constraint_list::~constraint_list() { - if (ptr) - isl_constraint_list_free(ptr); -} - -__isl_give isl_constraint_list *constraint_list::copy() const & { - return isl_constraint_list_copy(ptr); -} - -__isl_keep isl_constraint_list *constraint_list::get() const { - return ptr; -} - -__isl_give isl_constraint_list *constraint_list::release() { - isl_constraint_list *tmp = ptr; - ptr = nullptr; - return tmp; -} - -bool constraint_list::is_null() const { - return ptr == nullptr; -} -constraint_list::operator bool() const -{ - return !is_null(); -} - - - -isl::ctx constraint_list::get_ctx() const { - return isl::ctx(isl_constraint_list_get_ctx(ptr)); -} - -isl::constraint_list constraint_list::add(isl::constraint el) const -{ - if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_add(copy(), el.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::constraint_list constraint_list::concat(isl::constraint_list list2) const -{ - if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_concat(copy(), list2.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::constraint_list constraint_list::drop(unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_drop(copy(), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -void constraint_list::foreach(const std::function &fn) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - struct fn_data { - std::function func; - std::exception_ptr eptr; - } fn_data = { fn }; - auto fn_lambda = [](isl_constraint *arg_0, void *arg_1) -> isl_stat { - auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); - return isl_stat_ok; - } catch (...) { - data->eptr = std::current_exception(); - return isl_stat_error; - } - }; - auto res = isl_constraint_list_foreach(get(), fn_lambda, &fn_data); - if (fn_data.eptr) - std::rethrow_exception(fn_data.eptr); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return void(res); -} - -isl::constraint constraint_list::get_at(int index) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_get_at(get(), index); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::constraint_list constraint_list::reverse() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_reverse(copy()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -int constraint_list::size() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_constraint_list_size(get()); - return res; -} - -// implementations for isl::fixed_box -isl::fixed_box manage(__isl_take isl_fixed_box *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return fixed_box(ptr); -} -isl::fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_fixed_box_get_ctx(ptr); - ptr = isl_fixed_box_copy(ptr); - if (!ptr) - throw exception::create_from_last_error(ctx); - return fixed_box(ptr); -} - -fixed_box::fixed_box() - : ptr(nullptr) {} - -fixed_box::fixed_box(const isl::fixed_box &obj) - : ptr(obj.copy()) -{ - if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_fixed_box_get_ctx(obj.ptr)); -} - -fixed_box::fixed_box(__isl_take isl_fixed_box *ptr) - : ptr(ptr) {} - - -fixed_box &fixed_box::operator=(isl::fixed_box obj) { - std::swap(this->ptr, obj.ptr); - return *this; -} - -fixed_box::~fixed_box() { - if (ptr) - isl_fixed_box_free(ptr); -} - -__isl_give isl_fixed_box *fixed_box::copy() const & { - return isl_fixed_box_copy(ptr); -} - -__isl_keep isl_fixed_box *fixed_box::get() const { - return ptr; -} - -__isl_give isl_fixed_box *fixed_box::release() { - isl_fixed_box *tmp = ptr; - ptr = nullptr; - return tmp; -} - -bool fixed_box::is_null() const { - return ptr == nullptr; -} -fixed_box::operator bool() const -{ - return !is_null(); -} - - - -isl::ctx fixed_box::get_ctx() const { - return isl::ctx(isl_fixed_box_get_ctx(ptr)); -} - -isl::multi_aff fixed_box::get_offset() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_fixed_box_get_offset(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_val fixed_box::get_size() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_fixed_box_get_size(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::space fixed_box::get_space() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_fixed_box_get_space(get()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -bool fixed_box::is_valid() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_fixed_box_is_valid(get()); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -// implementations for isl::id -isl::id manage(__isl_take isl_id *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - return id(ptr); -} -isl::id manage_copy(__isl_keep isl_id *ptr) { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = isl_id_get_ctx(ptr); - ptr = isl_id_copy(ptr); - if (!ptr) - throw exception::create_from_last_error(ctx); - return id(ptr); -} - -id::id() - : ptr(nullptr) {} - -id::id(const isl::id &obj) - : ptr(obj.copy()) -{ - if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_id_get_ctx(obj.ptr)); -} - -id::id(__isl_take isl_id *ptr) - : ptr(ptr) {} - -id::id(isl::ctx ctx, const std::string &str) -{ - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_id_read_from_str(ctx.release(), str.c_str()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} - -id &id::operator=(isl::id obj) { - std::swap(this->ptr, obj.ptr); - return *this; -} - -id::~id() { - if (ptr) - isl_id_free(ptr); -} - -__isl_give isl_id *id::copy() const & { - return isl_id_copy(ptr); +__isl_give isl_id *id::copy() const & { + return isl_id_copy(ptr); } __isl_keep isl_id *id::get() const { @@ -9005,74 +8417,77 @@ std::string id::to_str() const { } -isl::ctx id::get_ctx() const { - return isl::ctx(isl_id_get_ctx(ptr)); +ctx id::get_ctx() const { + return ctx(isl_id_get_ctx(ptr)); } std::string id::get_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_get_name(get()); std::string tmp(res); return tmp; } // implementations for isl::id_list -isl::id_list manage(__isl_take isl_id_list *ptr) { +id_list manage(__isl_take isl_id_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return id_list(ptr); } -isl::id_list manage_copy(__isl_keep isl_id_list *ptr) { +id_list manage_copy(__isl_keep isl_id_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_id_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_id_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return id_list(ptr); } id_list::id_list() : ptr(nullptr) {} -id_list::id_list(const isl::id_list &obj) - : ptr(obj.copy()) +id_list::id_list(const id_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_id_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_id_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } id_list::id_list(__isl_take isl_id_list *ptr) : ptr(ptr) {} -id_list::id_list(isl::id el) +id_list::id_list(id el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_from_id(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -id_list::id_list(isl::ctx ctx, int n) +id_list::id_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -id_list &id_list::operator=(isl::id_list obj) { +id_list &id_list::operator=(id_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -9106,62 +8521,62 @@ id_list::operator bool() const -isl::ctx id_list::get_ctx() const { - return isl::ctx(isl_id_list_get_ctx(ptr)); +ctx id_list::get_ctx() const { + return ctx(isl_id_list_get_ctx(ptr)); } -isl::id_list id_list::add(isl::id el) const +id_list id_list::add(id el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::concat(isl::id_list list2) const +id_list id_list::concat(id_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::drop(unsigned int first, unsigned int n) const +id_list id_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void id_list::foreach(const std::function &fn) const +void id_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_id *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -9170,89 +8585,92 @@ void id_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::id id_list::get_at(int index) const +id id_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list id_list::reverse() const +id_list id_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int id_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_id_list_size(get()); return res; } // implementations for isl::local_space -isl::local_space manage(__isl_take isl_local_space *ptr) { +local_space manage(__isl_take isl_local_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return local_space(ptr); } -isl::local_space manage_copy(__isl_keep isl_local_space *ptr) { +local_space manage_copy(__isl_keep isl_local_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_local_space_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_local_space_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return local_space(ptr); } local_space::local_space() : ptr(nullptr) {} -local_space::local_space(const isl::local_space &obj) - : ptr(obj.copy()) +local_space::local_space(const local_space &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_local_space_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_local_space_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } local_space::local_space(__isl_take isl_local_space *ptr) : ptr(ptr) {} -local_space::local_space(isl::space dim) +local_space::local_space(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_from_space(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -local_space &local_space::operator=(isl::local_space obj) { +local_space &local_space::operator=(local_space obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -9290,255 +8708,255 @@ inline bool operator==(const local_space& C1, const local_space& C2) { -isl::ctx local_space::get_ctx() const { - return isl::ctx(isl_local_space_get_ctx(ptr)); +ctx local_space::get_ctx() const { + return ctx(isl_local_space_get_ctx(ptr)); } -isl::local_space local_space::domain() const +local_space local_space::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::flatten_domain() const +local_space local_space::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::flatten_range() const +local_space local_space::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::from_domain() const +local_space local_space::from_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_from_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff local_space::get_div(int pos) const +aff local_space::get_div(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_get_div(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space local_space::get_space() const +space local_space::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::intersect(isl::local_space ls2) const +local_space local_space::intersect(local_space ls2) const { if (!ptr || ls2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_intersect(copy(), ls2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool local_space::is_equal(const isl::local_space &ls2) const +bool local_space::is_equal(const local_space &ls2) const { if (!ptr || ls2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_equal(get(), ls2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool local_space::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool local_space::is_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_is_set(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::basic_map local_space::lifting() const +basic_map local_space::lifting() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_lifting(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::range() const +local_space local_space::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::local_space local_space::wrap() const +local_space local_space::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_local_space_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::map -isl::map manage(__isl_take isl_map *ptr) { +map manage(__isl_take isl_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return map(ptr); } -isl::map manage_copy(__isl_keep isl_map *ptr) { +map manage_copy(__isl_keep isl_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return map(ptr); } map::map() : ptr(nullptr) {} -map::map(const isl::map &obj) - : ptr(obj.copy()) +map::map(const map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } map::map(__isl_take isl_map *ptr) : ptr(ptr) {} -map::map(isl::ctx ctx, const std::string &str) +map::map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::basic_map bmap) +map::map(basic_map bmap) { if (bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bmap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_basic_map(bmap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::set domain, isl::set range) +map::map(set domain, set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::aff aff) +map::map(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map::map(isl::multi_aff maff) +map::map(multi_aff maff) { if (maff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = maff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_multi_aff(maff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map &map::operator=(isl::map obj) { +map &map::operator=(map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -9590,291 +9008,278 @@ std::string map::to_str() const { } -isl::ctx map::get_ctx() const { - return isl::ctx(isl_map_get_ctx(ptr)); -} - -isl::map map::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +ctx map::get_ctx() const { + return ctx(isl_map_get_ctx(ptr)); } -isl::basic_map map::affine_hull() const +basic_map map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::apply_domain(isl::map map2) const +map map::apply_domain(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_apply_domain(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::apply_range(isl::map map2) const +map map::apply_range(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_apply_range(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool map::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool map::can_range_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_range_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool map::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::map map::coalesce() const +map map::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::complement() const +map map::complement() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_complement(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::compute_divs() const +map map::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::curry() const +map map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::deltas() const +set map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::detect_equalities() const +map map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::domain() const +set map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_factor_domain() const +map map::domain_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_factor_range() const +map map::domain_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_map() const +map map::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::domain_product(isl::map map2) const +map map::domain_product(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_domain_product(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::empty(isl::space space) +map map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten() const +map map::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten_domain() const +map map::flatten_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::flatten_range() const +map map::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void map::foreach_basic_map(const std::function &fn) const +void map::foreach_basic_map(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -9883,643 +9288,652 @@ void map::foreach_basic_map(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::map map::from(isl::pw_multi_aff pma) +map map::from(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from_domain(isl::set set) +map map::from(union_map umap) { - if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_domain(set.release()); + if (umap.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = umap.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_from_union_map(umap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from_range(isl::set set) +map map::from_domain(set set) { if (set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = set.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_range(set.release()); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_from_domain(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::from_union_map(isl::union_map umap) +map map::from_range(set set) { - if (umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = umap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_map_from_union_map(umap.release()); + if (set.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = set.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_from_range(set.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map_list map::get_basic_map_list() const +basic_map_list map::get_basic_map_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_basic_map_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::fixed_box map::get_range_simple_fixed_box_hull() const +fixed_box map::get_range_simple_fixed_box_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_range_simple_fixed_box_hull(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::stride_info map::get_range_stride_info(int pos) const +stride_info map::get_range_stride_info(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_get_range_stride_info(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space map::get_space() const +id map::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_get_space(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id map::get_tuple_id(enum isl::dim_type type) const +space map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::gist(isl::map context) const +map map::gist(map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::gist_domain(isl::set context) const +map map::gist_domain(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_gist_domain(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::identity(isl::space dim) +map map::identity(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_identity(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect(isl::map map2) const +map map::intersect(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_domain(isl::set set) const +map map::intersect_domain(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_domain(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_params(isl::set params) const +map map::intersect_params(set params) const { if (!ptr || params.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::intersect_range(isl::set set) const +map map::intersect_range(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_intersect_range(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool map::is_bijective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_bijective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool map::is_disjoint(const isl::map &map2) const +bool map::is_disjoint(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_disjoint(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool map::is_equal(const isl::map &map2) const +bool map::is_equal(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_equal(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool map::is_injective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_injective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool map::is_single_valued() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_single_valued(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool map::is_strict_subset(const isl::map &map2) const +bool map::is_strict_subset(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_strict_subset(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool map::is_subset(const isl::map &map2) const +bool map::is_subset(const map &map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_is_subset(get(), map2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::map map::lexmax() const +map map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::lexmin() const +map map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int map::n_basic_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_n_basic_map(get()); return res; } -isl::set map::params() const +set map::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::polyhedral_hull() const +basic_map map::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::preimage_domain(isl::multi_aff ma) const +map map::preimage_domain(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_preimage_domain_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::preimage_range(isl::multi_aff ma) const +map map::preimage_range(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_preimage_range_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::range() const +set map::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_curry() const +map map::range_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_factor_domain() const +map map::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_factor_range() const +map map::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_map() const +map map::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::range_product(isl::map map2) const +map map::range_product(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_range_product(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::reverse() const +map map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::sample() const +basic_map map::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::set_tuple_id(enum isl::dim_type type, isl::id id) const +map map::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_map_set_tuple_id(copy(), static_cast(type), id.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::simple_hull() const +basic_map map::simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::subtract(isl::map map2) const +map map::subtract(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_subtract(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::sum(isl::map map2) const +map map::sum(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_sum(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::uncurry() const +map map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::unite(isl::map map2) const +map map::unite(map map2) const { if (!ptr || map2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_union(copy(), map2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map map::universe(isl::space space) +map map::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_map map::unshifted_simple_hull() const +basic_map map::unshifted_simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_unshifted_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set map::wrap() const +set map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +map map::zip() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_map_zip(copy()); + if (!res) + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::map_list -isl::map_list manage(__isl_take isl_map_list *ptr) { +map_list manage(__isl_take isl_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return map_list(ptr); } -isl::map_list manage_copy(__isl_keep isl_map_list *ptr) { +map_list manage_copy(__isl_keep isl_map_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_map_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_map_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return map_list(ptr); } map_list::map_list() : ptr(nullptr) {} -map_list::map_list(const isl::map_list &obj) - : ptr(obj.copy()) +map_list::map_list(const map_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_map_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_map_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } map_list::map_list(__isl_take isl_map_list *ptr) : ptr(ptr) {} -map_list::map_list(isl::map el) +map_list::map_list(map el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_from_map(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map_list::map_list(isl::ctx ctx, int n) +map_list::map_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -map_list &map_list::operator=(isl::map_list obj) { +map_list &map_list::operator=(map_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -10553,62 +9967,62 @@ map_list::operator bool() const -isl::ctx map_list::get_ctx() const { - return isl::ctx(isl_map_list_get_ctx(ptr)); +ctx map_list::get_ctx() const { + return ctx(isl_map_list_get_ctx(ptr)); } -isl::map_list map_list::add(isl::map el) const +map_list map_list::add(map el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::concat(isl::map_list list2) const +map_list map_list::concat(map_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::drop(unsigned int first, unsigned int n) const +map_list map_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void map_list::foreach(const std::function &fn) const +void map_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -10617,109 +10031,111 @@ void map_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::map map_list::get_at(int index) const +map map_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list map_list::reverse() const +map_list map_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int map_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_map_list_size(get()); return res; } // implementations for isl::multi_aff -isl::multi_aff manage(__isl_take isl_multi_aff *ptr) { +multi_aff manage(__isl_take isl_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_aff(ptr); } -isl::multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) { +multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_aff(ptr); } multi_aff::multi_aff() : ptr(nullptr) {} -multi_aff::multi_aff(const isl::multi_aff &obj) - : ptr(obj.copy()) +multi_aff::multi_aff(const multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_aff::multi_aff(__isl_take isl_multi_aff *ptr) : ptr(ptr) {} -multi_aff::multi_aff(isl::space space, isl::aff_list list) +multi_aff::multi_aff(ctx ctx, const std::string &str) +{ + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str()); + if (!res) + exception::throw_last_error(ctx); + ptr = res; +} +multi_aff::multi_aff(space space, aff_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_from_aff_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_aff::multi_aff(isl::aff aff) +multi_aff::multi_aff(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -multi_aff::multi_aff(isl::ctx ctx, const std::string &str) -{ - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str()); - if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_aff &multi_aff::operator=(isl::multi_aff obj) { +multi_aff &multi_aff::operator=(multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -10767,513 +10183,488 @@ std::string multi_aff::to_str() const { } -isl::ctx multi_aff::get_ctx() const { - return isl::ctx(isl_multi_aff_get_ctx(ptr)); +ctx multi_aff::get_ctx() const { + return ctx(isl_multi_aff_get_ctx(ptr)); } -isl::multi_aff multi_aff::add(isl::multi_aff multi2) const +multi_aff multi_aff::add(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::align_params(isl::space model) const +multi_aff multi_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::domain_map(isl::space space) +multi_aff multi_aff::domain_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_domain_map(space.release()); if (!res) - throw exception::create_from_last_error(ctx); - return manage(res); -} - -isl::multi_aff multi_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::factor_domain() const +multi_aff multi_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::factor_range() const +multi_aff multi_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::flat_range_product(isl::multi_aff multi2) const +multi_aff multi_aff::flat_range_product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::flatten_range() const +multi_aff multi_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::floor() const +multi_aff multi_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::from_range() const +multi_aff multi_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff multi_aff::get_aff(int pos) const +aff multi_aff::get_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::aff_list multi_aff::get_aff_list() const +aff_list multi_aff::get_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_aff::get_domain_space() const +space multi_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_aff::get_space() const +id multi_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_get_space(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_aff::get_tuple_id(enum isl::dim_type type) const +space multi_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_aff::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::multi_aff multi_aff::identity(isl::space space) +multi_aff multi_aff::identity(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_identity(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::mod(isl::multi_val mv) const +multi_aff multi_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::neg() const +multi_aff multi_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::product(isl::multi_aff multi2) const +multi_aff multi_aff::product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::pullback(isl::multi_aff ma2) const +multi_aff multi_aff::pullback(multi_aff ma2) const { if (!ptr || ma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_factor_domain() const +multi_aff multi_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_factor_range() const +multi_aff multi_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_map(isl::space space) +multi_aff multi_aff::range_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_map(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_product(isl::multi_aff multi2) const +multi_aff multi_aff::range_product(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::range_splice(unsigned int pos, isl::multi_aff multi2) const +multi_aff multi_aff::range_splice(unsigned int pos, multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::reset_tuple_id(enum isl::dim_type type) const +multi_aff multi_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_aff multi_aff::reset_user() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale(isl::val v) const +multi_aff multi_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale(isl::multi_val mv) const +multi_aff multi_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale_down(isl::val v) const +multi_aff multi_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::scale_down(isl::multi_val mv) const +multi_aff multi_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::set_aff(int pos, isl::aff el) const +multi_aff multi_aff::set_aff(int pos, aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_set_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const +multi_aff multi_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_aff_set_tuple_id(copy(), static_cast(type), id.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_size(get()); return res; } -isl::multi_aff multi_aff::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_aff multi2) const +multi_aff multi_aff::splice(unsigned int in_pos, unsigned int out_pos, multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const +multi_aff multi_aff::sub(multi_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_aff multi_aff::zero(isl::space space) +multi_aff multi_aff::wrapped_range_map(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_aff_wrapped_range_map(space.release()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); +} + +multi_aff multi_aff::zero(space space) +{ + if (space.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_id -isl::multi_id manage(__isl_take isl_multi_id *ptr) { +multi_id manage(__isl_take isl_multi_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_id(ptr); } -isl::multi_id manage_copy(__isl_keep isl_multi_id *ptr) { +multi_id manage_copy(__isl_keep isl_multi_id *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_id_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_id_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_id(ptr); } multi_id::multi_id() : ptr(nullptr) {} -multi_id::multi_id(const isl::multi_id &obj) - : ptr(obj.copy()) +multi_id::multi_id(const multi_id &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_id_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_id_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_id::multi_id(__isl_take isl_multi_id *ptr) : ptr(ptr) {} -multi_id::multi_id(isl::space space, isl::id_list list) +multi_id::multi_id(space space, id_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_from_id_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_id &multi_id::operator=(isl::multi_id obj) { +multi_id &multi_id::operator=(multi_id obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -11307,301 +10698,301 @@ multi_id::operator bool() const -isl::ctx multi_id::get_ctx() const { - return isl::ctx(isl_multi_id_get_ctx(ptr)); +ctx multi_id::get_ctx() const { + return ctx(isl_multi_id_get_ctx(ptr)); } -isl::multi_id multi_id::align_params(isl::space model) const +multi_id multi_id::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::factor_domain() const +multi_id multi_id::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::factor_range() const +multi_id multi_id::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::flat_range_product(isl::multi_id multi2) const +multi_id multi_id::flat_range_product(multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::flatten_range() const +multi_id multi_id::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::from_range() const +multi_id multi_id::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_id::get_domain_space() const +space multi_id::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_id::get_id(int pos) const +id multi_id::get_id(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_id(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id_list multi_id::get_id_list() const +id_list multi_id::get_id_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_id_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_id::get_space() const +space multi_id::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_factor_domain() const +multi_id multi_id::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_factor_range() const +multi_id multi_id::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_product(isl::multi_id multi2) const +multi_id multi_id::range_product(multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::range_splice(unsigned int pos, isl::multi_id multi2) const +multi_id multi_id::range_splice(unsigned int pos, multi_id multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::reset_user() const +multi_id multi_id::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_id multi_id::set_id(int pos, isl::id el) const +multi_id multi_id::set_id(int pos, id el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_set_id(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_id::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_id_size(get()); return res; } // implementations for isl::multi_pw_aff -isl::multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) { +multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_pw_aff(ptr); } -isl::multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) { +multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_pw_aff(ptr); } multi_pw_aff::multi_pw_aff() : ptr(nullptr) {} -multi_pw_aff::multi_pw_aff(const isl::multi_pw_aff &obj) - : ptr(obj.copy()) +multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr) : ptr(ptr) {} -multi_pw_aff::multi_pw_aff(isl::space space, isl::pw_aff_list list) +multi_pw_aff::multi_pw_aff(space space, pw_aff_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_aff_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::multi_aff ma) +multi_pw_aff::multi_pw_aff(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::pw_aff pa) +multi_pw_aff::multi_pw_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::pw_multi_aff pma) +multi_pw_aff::multi_pw_aff(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff::multi_pw_aff(isl::ctx ctx, const std::string &str) +multi_pw_aff::multi_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_pw_aff &multi_pw_aff::operator=(isl::multi_pw_aff obj) { +multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -11653,579 +11044,540 @@ std::string multi_pw_aff::to_str() const { } -isl::ctx multi_pw_aff::get_ctx() const { - return isl::ctx(isl_multi_pw_aff_get_ctx(ptr)); +ctx multi_pw_aff::get_ctx() const { + return ctx(isl_multi_pw_aff_get_ctx(ptr)); } -isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::add(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::align_params(isl::space model) const +multi_pw_aff multi_pw_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set multi_pw_aff::domain() const +set multi_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_pw_aff multi_pw_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::factor_domain() const +multi_pw_aff multi_pw_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::factor_range() const +multi_pw_aff multi_pw_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::flat_range_product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::flat_range_product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::flatten_range() const +multi_pw_aff multi_pw_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::from_range() const +multi_pw_aff multi_pw_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_pw_aff::get_domain_space() const +space multi_pw_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff multi_pw_aff::get_pw_aff(int pos) const +pw_aff multi_pw_aff::get_pw_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_pw_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list multi_pw_aff::get_pw_aff_list() const +pw_aff_list multi_pw_aff::get_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_get_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_pw_aff::get_space() const +id multi_pw_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_get_space(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_pw_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_pw_aff::get_tuple_id(enum isl::dim_type type) const +space multi_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_pw_aff::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::multi_pw_aff multi_pw_aff::identity(isl::space space) +multi_pw_aff multi_pw_aff::identity(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_identity(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool multi_pw_aff::is_equal(const isl::multi_pw_aff &mpa2) const +bool multi_pw_aff::is_equal(const multi_pw_aff &mpa2) const { if (!ptr || mpa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_is_equal(get(), mpa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::multi_pw_aff multi_pw_aff::mod(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::neg() const +multi_pw_aff multi_pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_aff ma) const +multi_pw_aff multi_pw_aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::pw_multi_aff pma) const +multi_pw_aff multi_pw_aff::pullback(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_pw_aff mpa2) const +multi_pw_aff multi_pw_aff::pullback(multi_pw_aff mpa2) const { if (!ptr || mpa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_factor_domain() const +multi_pw_aff multi_pw_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_factor_range() const +multi_pw_aff multi_pw_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_product(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::range_product(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::range_splice(unsigned int pos, isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::range_splice(unsigned int pos, multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_pw_aff multi_pw_aff::reset_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::reset_user() const +multi_pw_aff multi_pw_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale(isl::val v) const +multi_pw_aff multi_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale_down(isl::val v) const +multi_pw_aff multi_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::scale_down(isl::multi_val mv) const +multi_pw_aff multi_pw_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::set_pw_aff(int pos, isl::pw_aff el) const +multi_pw_aff multi_pw_aff::set_pw_aff(int pos, pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_set_pw_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const +multi_pw_aff multi_pw_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_pw_aff_set_tuple_id(copy(), static_cast(type), id.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_pw_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_pw_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_size(get()); return res; } -isl::multi_pw_aff multi_pw_aff::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::splice(unsigned int in_pos, unsigned int out_pos, multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::sub(isl::multi_pw_aff multi2) const +multi_pw_aff multi_pw_aff::sub(multi_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_pw_aff multi_pw_aff::zero(isl::space space) +multi_pw_aff multi_pw_aff::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_pw_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_union_pw_aff -isl::multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) { +multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_union_pw_aff(ptr); } -isl::multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) { +multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_union_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_union_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_union_pw_aff(ptr); } multi_union_pw_aff::multi_union_pw_aff() : ptr(nullptr) {} -multi_union_pw_aff::multi_union_pw_aff(const isl::multi_union_pw_aff &obj) - : ptr(obj.copy()) +multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_union_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr) : ptr(ptr) {} -multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list) -{ - if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa) +multi_union_pw_aff::multi_union_pw_aff(union_pw_aff upa) { if (upa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa) +multi_union_pw_aff::multi_union_pw_aff(multi_pw_aff mpa) { if (mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = mpa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_val mv) +multi_union_pw_aff::multi_union_pw_aff(union_set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::union_set domain, isl::multi_aff ma) +multi_union_pw_aff::multi_union_pw_aff(union_set domain, multi_aff ma) { if (domain.is_null() || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_multi_aff_on_domain(domain.release(), ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); + ptr = res; +} +multi_union_pw_aff::multi_union_pw_aff(space space, union_pw_aff_list list) +{ + if (space.is_null() || list.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = space.get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release()); + if (!res) + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str) +multi_union_pw_aff::multi_union_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_union_pw_aff &multi_union_pw_aff::operator=(isl::multi_union_pw_aff obj) { +multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -12273,571 +11625,572 @@ std::string multi_union_pw_aff::to_str() const { } -isl::ctx multi_union_pw_aff::get_ctx() const { - return isl::ctx(isl_multi_union_pw_aff_get_ctx(ptr)); +ctx multi_union_pw_aff::get_ctx() const { + return ctx(isl_multi_union_pw_aff_get_ctx(ptr)); } -isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::add(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::align_params(isl::space model) const +multi_union_pw_aff multi_union_pw_aff::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::apply(isl::multi_aff ma) const +multi_union_pw_aff multi_union_pw_aff::apply(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_apply_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::apply(isl::pw_multi_aff pma) const +multi_union_pw_aff multi_union_pw_aff::apply(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_apply_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set multi_union_pw_aff::domain() const +union_set multi_union_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_pw_aff multi_union_pw_aff::extract_multi_pw_aff(isl::space space) const +multi_pw_aff multi_union_pw_aff::extract_multi_pw_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_extract_multi_pw_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::factor_domain() const +multi_union_pw_aff multi_union_pw_aff::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::factor_range() const +multi_union_pw_aff multi_union_pw_aff::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::flat_range_product(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::flat_range_product(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::flatten_range() const +multi_union_pw_aff multi_union_pw_aff::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::floor() const +multi_union_pw_aff multi_union_pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::from_range() const +multi_union_pw_aff multi_union_pw_aff::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::from_union_map(isl::union_map umap) +multi_union_pw_aff multi_union_pw_aff::from_union_map(union_map umap) { if (umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = umap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_from_union_map(umap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_union_pw_aff::get_domain_space() const +space multi_union_pw_aff::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_union_pw_aff::get_space() const +id multi_union_pw_aff::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_get_space(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_union_pw_aff::get_tuple_id(enum isl::dim_type type) const +space multi_union_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff multi_union_pw_aff::get_union_pw_aff(int pos) const +union_pw_aff multi_union_pw_aff::get_union_pw_aff(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_union_pw_aff(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list multi_union_pw_aff::get_union_pw_aff_list() const +union_pw_aff_list multi_union_pw_aff::get_union_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_get_union_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const +multi_union_pw_aff multi_union_pw_aff::gist(union_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_union_pw_aff::has_tuple_id(enum isl::dim_type type) const +multi_union_pw_aff multi_union_pw_aff::intersect_domain(union_set uset) const { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + if (!ptr || uset.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const +multi_union_pw_aff multi_union_pw_aff::intersect_params(set params) const { - if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release()); + if (!ptr || params.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_union_pw_aff::involves_param(const isl::id &id) const +bool multi_union_pw_aff::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); +} + +multi_val multi_union_pw_aff::max_multi_val() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_max_multi_val(copy()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::mod(isl::multi_val mv) const +multi_val multi_union_pw_aff::min_multi_val() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_min_multi_val(copy()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); +} + +multi_union_pw_aff multi_union_pw_aff::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::neg() const +multi_union_pw_aff multi_union_pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::pullback(isl::union_pw_multi_aff upma) const +multi_union_pw_aff multi_union_pw_aff::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_factor_domain() const +multi_union_pw_aff multi_union_pw_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_factor_range() const +multi_union_pw_aff multi_union_pw_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_product(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::range_product(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::range_splice(unsigned int pos, isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::range_splice(unsigned int pos, multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::reset_tuple_id(enum isl::dim_type type) const +multi_union_pw_aff multi_union_pw_aff::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_union_pw_aff multi_union_pw_aff::reset_user() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::val v) const +multi_union_pw_aff multi_union_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::multi_val mv) const +multi_union_pw_aff multi_union_pw_aff::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::val v) const +multi_union_pw_aff multi_union_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const +multi_union_pw_aff multi_union_pw_aff::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::set_tuple_id(enum isl::dim_type type, isl::id id) const +multi_union_pw_aff multi_union_pw_aff::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_union_pw_aff_set_tuple_id(copy(), static_cast(type), id.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_union_pw_aff_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::set_union_pw_aff(int pos, isl::union_pw_aff el) const +multi_union_pw_aff multi_union_pw_aff::set_union_pw_aff(int pos, union_pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_set_union_pw_aff(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_union_pw_aff::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_size(get()); return res; } -isl::multi_union_pw_aff multi_union_pw_aff::sub(isl::multi_union_pw_aff multi2) const +multi_union_pw_aff multi_union_pw_aff::sub(multi_union_pw_aff multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::union_add(isl::multi_union_pw_aff mupa2) const +multi_union_pw_aff multi_union_pw_aff::union_add(multi_union_pw_aff mupa2) const { if (!ptr || mupa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff multi_union_pw_aff::zero(isl::space space) +multi_union_pw_aff multi_union_pw_aff::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set multi_union_pw_aff::zero_union_set() const +union_set multi_union_pw_aff::zero_union_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_union_pw_aff_zero_union_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::multi_val -isl::multi_val manage(__isl_take isl_multi_val *ptr) { +multi_val manage(__isl_take isl_multi_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return multi_val(ptr); } -isl::multi_val manage_copy(__isl_keep isl_multi_val *ptr) { +multi_val manage_copy(__isl_keep isl_multi_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_multi_val_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_multi_val_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return multi_val(ptr); } multi_val::multi_val() : ptr(nullptr) {} -multi_val::multi_val(const isl::multi_val &obj) - : ptr(obj.copy()) +multi_val::multi_val(const multi_val &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_multi_val_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_multi_val_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } multi_val::multi_val(__isl_take isl_multi_val *ptr) : ptr(ptr) {} -multi_val::multi_val(isl::space space, isl::val_list list) +multi_val::multi_val(space space, val_list list) { if (space.is_null() || list.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_from_val_list(space.release(), list.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -multi_val &multi_val::operator=(isl::multi_val obj) { +multi_val &multi_val::operator=(multi_val obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -12885,450 +12238,416 @@ std::string multi_val::to_str() const { } -isl::ctx multi_val::get_ctx() const { - return isl::ctx(isl_multi_val_get_ctx(ptr)); +ctx multi_val::get_ctx() const { + return ctx(isl_multi_val_get_ctx(ptr)); } -isl::multi_val multi_val::add(isl::multi_val multi2) const +multi_val multi_val::add(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_add(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::align_params(isl::space model) const +multi_val multi_val::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::drop_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const +multi_val multi_val::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_drop_dims(copy(), static_cast(type), first, n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_val multi_val::factor_domain() const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::factor_range() const +multi_val multi_val::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::flat_range_product(isl::multi_val multi2) const +multi_val multi_val::flat_range_product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_flat_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::flatten_range() const +multi_val multi_val::flatten_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_flatten_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::from_range() const +multi_val multi_val::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_val::get_domain_space() const +space multi_val::get_domain_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_domain_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space multi_val::get_space() const +id multi_val::get_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_get_space(get()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_val_get_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id multi_val::get_tuple_id(enum isl::dim_type type) const +space multi_val::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_val_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val multi_val::get_val(int pos) const +val multi_val::get_val(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_val(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list multi_val::get_val_list() const +val_list multi_val::get_val_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_get_val_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool multi_val::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::multi_val multi_val::mod(isl::multi_val mv) const +multi_val multi_val::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_mod_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::neg() const +multi_val multi_val::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::product(isl::multi_val multi2) const +multi_val multi_val::product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_factor_domain() const +multi_val multi_val::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_factor_range() const +multi_val multi_val::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_product(isl::multi_val multi2) const +multi_val multi_val::range_product(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_product(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::range_splice(unsigned int pos, isl::multi_val multi2) const +multi_val multi_val::range_splice(unsigned int pos, multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_range_splice(copy(), pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::multi_val multi_val::reset_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_reset_tuple_id(copy(), static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::reset_user() const +multi_val multi_val::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale(isl::val v) const +multi_val multi_val::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale(isl::multi_val mv) const +multi_val multi_val::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale_down(isl::val v) const +multi_val multi_val::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::scale_down(isl::multi_val mv) const +multi_val multi_val::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_scale_down_multi_val(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::set_tuple_id(enum isl::dim_type type, isl::id id) const +multi_val multi_val::set_range_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_multi_val_set_tuple_id(copy(), static_cast(type), id.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_multi_val_set_range_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::set_val(int pos, isl::val el) const +multi_val multi_val::set_val(int pos, val el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_set_val(copy(), pos, el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int multi_val::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_size(get()); return res; } -isl::multi_val multi_val::splice(unsigned int in_pos, unsigned int out_pos, isl::multi_val multi2) const +multi_val multi_val::splice(unsigned int in_pos, unsigned int out_pos, multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_splice(copy(), in_pos, out_pos, multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::sub(isl::multi_val multi2) const +multi_val multi_val::sub(multi_val multi2) const { if (!ptr || multi2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_sub(copy(), multi2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_val multi_val::zero(isl::space space) +multi_val multi_val::zero(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_multi_val_zero(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::point -isl::point manage(__isl_take isl_point *ptr) { +point manage(__isl_take isl_point *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return point(ptr); } -isl::point manage_copy(__isl_keep isl_point *ptr) { +point manage_copy(__isl_keep isl_point *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_point_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_point_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return point(ptr); } point::point() : ptr(nullptr) {} -point::point(const isl::point &obj) - : ptr(obj.copy()) +point::point(const point &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_point_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_point_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } point::point(__isl_take isl_point *ptr) : ptr(ptr) {} -point::point(isl::space dim) +point::point(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_zero(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -point &point::operator=(isl::point obj) { +point &point::operator=(point obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -13376,123 +12695,112 @@ std::string point::to_str() const { } -isl::ctx point::get_ctx() const { - return isl::ctx(isl_point_get_ctx(ptr)); +ctx point::get_ctx() const { + return ctx(isl_point_get_ctx(ptr)); } -isl::space point::get_space() const +space point::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool point::is_void() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_point_is_void(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } // implementations for isl::pw_aff -isl::pw_aff manage(__isl_take isl_pw_aff *ptr) { +pw_aff manage(__isl_take isl_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_aff(ptr); } -isl::pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) { +pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_aff(ptr); } pw_aff::pw_aff() : ptr(nullptr) {} -pw_aff::pw_aff(const isl::pw_aff &obj) - : ptr(obj.copy()) +pw_aff::pw_aff(const pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_aff::pw_aff(__isl_take isl_pw_aff *ptr) : ptr(ptr) {} -pw_aff::pw_aff(isl::aff aff) +pw_aff::pw_aff(aff aff) { if (aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = aff.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_from_aff(aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::local_space ls) +pw_aff::pw_aff(local_space ls) { if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_zero_on_domain(ls.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::local_space ls, enum isl::dim_type type, unsigned int pos) -{ - if (ls.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - auto ctx = ls.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_aff_var_on_domain(ls.release(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(ctx); - ptr = res; -} -pw_aff::pw_aff(isl::set domain, isl::val v) +pw_aff::pw_aff(set domain, val v) { if (domain.is_null() || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_val_on_domain(domain.release(), v.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff::pw_aff(isl::ctx ctx, const std::string &str) +pw_aff::pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff &pw_aff::operator=(isl::pw_aff obj) { +pw_aff &pw_aff::operator=(pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -13544,122 +12852,122 @@ std::string pw_aff::to_str() const { } -isl::ctx pw_aff::get_ctx() const { - return isl::ctx(isl_pw_aff_get_ctx(ptr)); +ctx pw_aff::get_ctx() const { + return ctx(isl_pw_aff_get_ctx(ptr)); } -isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const +pw_aff pw_aff::add(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_add(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::ceil() const +pw_aff pw_aff::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const +pw_aff pw_aff::cond(pw_aff pwaff_true, pw_aff pwaff_false) const { if (!ptr || pwaff_true.is_null() || pwaff_false.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::div(isl::pw_aff pa2) const +pw_aff pw_aff::div(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_div(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::domain() const +set pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::eq_map(isl::pw_aff pa2) const +map pw_aff::eq_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_eq_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::eq_set(isl::pw_aff pwaff2) const +set pw_aff::eq_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_eq_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::floor() const +pw_aff pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_aff::foreach_piece(const std::function &fn) const +void pw_aff::foreach_piece(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, isl_aff *arg_1, void *arg_2) -> isl_stat { auto *data = static_cast(arg_2); - try { - (data->func)(isl::manage(arg_0), isl::manage(arg_1)); + ISL_CPP_TRY { + (data->func)(manage(arg_0), manage(arg_1)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -13668,433 +12976,460 @@ void pw_aff::foreach_piece(const std::function &fn) co if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set pw_aff::ge_set(isl::pw_aff pwaff2) const +set pw_aff::ge_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ge_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space pw_aff::get_space() const +space pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::gt_map(isl::pw_aff pa2) const +map pw_aff::gt_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_gt_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::gt_set(isl::pw_aff pwaff2) const +set pw_aff::gt_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_gt_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::intersect_domain(isl::set set) const +pw_aff pw_aff::intersect_domain(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_intersect_domain(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::intersect_params(isl::set set) const +pw_aff pw_aff::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool pw_aff::involves_dims(enum isl::dim_type type, unsigned int first, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_aff_involves_dims(get(), static_cast(type), first, n); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - bool pw_aff::involves_nan() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_involves_nan(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool pw_aff::is_cst() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_is_cst(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool pw_aff::is_equal(const isl::pw_aff &pa2) const +bool pw_aff::is_equal(const pw_aff &pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_is_equal(get(), pa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::set pw_aff::le_set(isl::pw_aff pwaff2) const +set pw_aff::le_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_le_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map pw_aff::lt_map(isl::pw_aff pa2) const +map pw_aff::lt_map(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_lt_map(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::lt_set(isl::pw_aff pwaff2) const +set pw_aff::lt_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_lt_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::max(isl::pw_aff pwaff2) const +pw_aff pw_aff::max(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_max(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::min(isl::pw_aff pwaff2) const +pw_aff pw_aff::min(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_min(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::mod(isl::val mod) const +pw_aff pw_aff::mod(val mod) const { if (!ptr || mod.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_mod_val(copy(), mod.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::mul(isl::pw_aff pwaff2) const +pw_aff pw_aff::mul(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_mul(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int pw_aff::n_piece() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_n_piece(get()); return res; } -isl::set pw_aff::ne_set(isl::pw_aff pwaff2) const +set pw_aff::ne_set(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_ne_set(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::neg() const +pw_aff pw_aff::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_aff::params() const +set pw_aff::nonneg_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_aff_nonneg_set(copy()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); +} + +set pw_aff::params() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +set pw_aff::pos_set() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_aff_pos_set(copy()); + if (!res) + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::project_domain_on_params() const +pw_aff pw_aff::project_domain_on_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_project_domain_on_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::multi_aff ma) const +pw_aff pw_aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::pw_multi_aff pma) const +pw_aff pw_aff::pullback(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::pullback(isl::multi_pw_aff mpa) const +pw_aff pw_aff::pullback(multi_pw_aff mpa) const { if (!ptr || mpa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::scale(isl::val v) const +pw_aff pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::scale_down(isl::val f) const +pw_aff pw_aff::scale_down(val f) const { if (!ptr || f.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_scale_down_val(copy(), f.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::sub(isl::pw_aff pwaff2) const +pw_aff pw_aff::sub(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_sub(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::tdiv_q(isl::pw_aff pa2) const +pw_aff pw_aff::tdiv_q(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_tdiv_q(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::tdiv_r(isl::pw_aff pa2) const +pw_aff pw_aff::tdiv_r(pw_aff pa2) const { if (!ptr || pa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_tdiv_r(copy(), pa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const +pw_aff pw_aff::union_add(pw_aff pwaff2) const { if (!ptr || pwaff2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_union_add(copy(), pwaff2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +set pw_aff::zero_set() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_aff_zero_set(copy()); + if (!res) + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::pw_aff_list -isl::pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) { +pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_aff_list(ptr); } -isl::pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) { +pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_aff_list(ptr); } pw_aff_list::pw_aff_list() : ptr(nullptr) {} -pw_aff_list::pw_aff_list(const isl::pw_aff_list &obj) - : ptr(obj.copy()) +pw_aff_list::pw_aff_list(const pw_aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_aff_list::pw_aff_list(__isl_take isl_pw_aff_list *ptr) : ptr(ptr) {} -pw_aff_list::pw_aff_list(isl::pw_aff el) +pw_aff_list::pw_aff_list(pw_aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_from_pw_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff_list::pw_aff_list(isl::ctx ctx, int n) +pw_aff_list::pw_aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_aff_list &pw_aff_list::operator=(isl::pw_aff_list obj) { +pw_aff_list &pw_aff_list::operator=(pw_aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14128,62 +13463,62 @@ pw_aff_list::operator bool() const -isl::ctx pw_aff_list::get_ctx() const { - return isl::ctx(isl_pw_aff_list_get_ctx(ptr)); +ctx pw_aff_list::get_ctx() const { + return ctx(isl_pw_aff_list_get_ctx(ptr)); } -isl::pw_aff_list pw_aff_list::add(isl::pw_aff el) const +pw_aff_list pw_aff_list::add(pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::concat(isl::pw_aff_list list2) const +pw_aff_list pw_aff_list::concat(pw_aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const +pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_aff_list::foreach(const std::function &fn) const +void pw_aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -14192,133 +13527,133 @@ void pw_aff_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::pw_aff pw_aff_list::get_at(int index) const +pw_aff pw_aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff_list pw_aff_list::reverse() const +pw_aff_list pw_aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int pw_aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_aff_list_size(get()); return res; } // implementations for isl::pw_multi_aff -isl::pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) { +pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return pw_multi_aff(ptr); } -isl::pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) { +pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_pw_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_pw_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return pw_multi_aff(ptr); } pw_multi_aff::pw_multi_aff() : ptr(nullptr) {} -pw_multi_aff::pw_multi_aff(const isl::pw_multi_aff &obj) - : ptr(obj.copy()) +pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_pw_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_pw_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr) : ptr(ptr) {} -pw_multi_aff::pw_multi_aff(isl::multi_aff ma) +pw_multi_aff::pw_multi_aff(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::pw_aff pa) +pw_multi_aff::pw_multi_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::set domain, isl::multi_val mv) +pw_multi_aff::pw_multi_aff(set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::map map) +pw_multi_aff::pw_multi_aff(map map) { if (map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = map.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_from_map(map.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff::pw_multi_aff(isl::ctx ctx, const std::string &str) +pw_multi_aff::pw_multi_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -pw_multi_aff &pw_multi_aff::operator=(isl::pw_multi_aff obj) { +pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14370,62 +13705,62 @@ std::string pw_multi_aff::to_str() const { } -isl::ctx pw_multi_aff::get_ctx() const { - return isl::ctx(isl_pw_multi_aff_get_ctx(ptr)); +ctx pw_multi_aff::get_ctx() const { + return ctx(isl_pw_multi_aff_get_ctx(ptr)); } -isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::add(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_add(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set pw_multi_aff::domain() const +set pw_multi_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::flat_range_product(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::flat_range_product(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void pw_multi_aff::foreach_piece(const std::function &fn) const +void pw_multi_aff::foreach_piece(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, isl_multi_aff *arg_1, void *arg_2) -> isl_stat { auto *data = static_cast(arg_2); - try { - (data->func)(isl::manage(arg_0), isl::manage(arg_1)); + ISL_CPP_TRY { + (data->func)(manage(arg_0), manage(arg_1)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -14434,267 +13769,269 @@ void pw_multi_aff::foreach_piece(const std::function(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_multi_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::identity(isl::space space) +pw_multi_aff pw_multi_aff::identity(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_identity(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool pw_multi_aff::is_equal(const isl::pw_multi_aff &pma2) const +bool pw_multi_aff::is_equal(const pw_multi_aff &pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_is_equal(get(), pma2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } int pw_multi_aff::n_piece() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_n_piece(get()); return res; } -isl::pw_multi_aff pw_multi_aff::product(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::product(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_product(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::project_domain_on_params() const +pw_multi_aff pw_multi_aff::project_domain_on_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_project_domain_on_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::pullback(isl::multi_aff ma) const +pw_multi_aff pw_multi_aff::pullback(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_pullback_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::pullback(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::pullback(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_pullback_pw_multi_aff(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::range_factor_domain() const +pw_multi_aff pw_multi_aff::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::range_factor_range() const +pw_multi_aff pw_multi_aff::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::range_product(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::range_product(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_range_product(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::scale_down_val(isl::val v) const +pw_multi_aff pw_multi_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_multi_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::scale_val(isl::val v) const +pw_multi_aff pw_multi_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_pw_multi_aff_scale_val(copy(), v.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::set_pw_aff(unsigned int pos, isl::pw_aff pa) const +pw_multi_aff pw_multi_aff::set_pw_aff(unsigned int pos, pw_aff pa) const { if (!ptr || pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_set_pw_aff(copy(), pos, pa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff pw_multi_aff::union_add(isl::pw_multi_aff pma2) const +pw_multi_aff pw_multi_aff::union_add(pw_multi_aff pma2) const { if (!ptr || pma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_pw_multi_aff_union_add(copy(), pma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::schedule -isl::schedule manage(__isl_take isl_schedule *ptr) { +schedule manage(__isl_take isl_schedule *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return schedule(ptr); } -isl::schedule manage_copy(__isl_keep isl_schedule *ptr) { +schedule manage_copy(__isl_keep isl_schedule *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_schedule_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_schedule_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return schedule(ptr); } schedule::schedule() : ptr(nullptr) {} -schedule::schedule(const isl::schedule &obj) - : ptr(obj.copy()) +schedule::schedule(const schedule &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_schedule_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_schedule_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } schedule::schedule(__isl_take isl_schedule *ptr) : ptr(ptr) {} -schedule::schedule(isl::ctx ctx, const std::string &str) +schedule::schedule(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -schedule &schedule::operator=(isl::schedule obj) { +schedule &schedule::operator=(schedule obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14742,172 +14079,175 @@ std::string schedule::to_str() const { } -isl::ctx schedule::get_ctx() const { - return isl::ctx(isl_schedule_get_ctx(ptr)); +ctx schedule::get_ctx() const { + return ctx(isl_schedule_get_ctx(ptr)); } -isl::schedule schedule::from_domain(isl::union_set domain) +schedule schedule::from_domain(union_set domain) { if (domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_from_domain(domain.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set schedule::get_domain() const +union_set schedule::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule::get_map() const +union_map schedule::get_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_map(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule::get_root() const +schedule_node schedule::get_root() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_get_root(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::insert_partial_schedule(isl::multi_union_pw_aff partial) const +schedule schedule::insert_partial_schedule(multi_union_pw_aff partial) const { if (!ptr || partial.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_insert_partial_schedule(copy(), partial.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool schedule::plain_is_equal(const isl::schedule &schedule2) const +bool schedule::plain_is_equal(const schedule &schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_plain_is_equal(get(), schedule2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const +schedule schedule::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::reset_user() const +schedule schedule::reset_user() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_reset_user(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::sequence(isl::schedule schedule2) const +schedule schedule::sequence(schedule schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_sequence(copy(), schedule2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule schedule::set(isl::schedule schedule2) const +schedule schedule::set(schedule schedule2) const { if (!ptr || schedule2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_set(copy(), schedule2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::schedule_constraints -isl::schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) { +schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return schedule_constraints(ptr); } -isl::schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) { +schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_schedule_constraints_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_schedule_constraints_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return schedule_constraints(ptr); } schedule_constraints::schedule_constraints() : ptr(nullptr) {} -schedule_constraints::schedule_constraints(const isl::schedule_constraints &obj) - : ptr(obj.copy()) +schedule_constraints::schedule_constraints(const schedule_constraints &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_schedule_constraints_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_schedule_constraints_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr) : ptr(ptr) {} -schedule_constraints::schedule_constraints(isl::ctx ctx, const std::string &str) +schedule_constraints::schedule_constraints(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -schedule_constraints &schedule_constraints::operator=(isl::schedule_constraints obj) { +schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -14955,248 +14295,251 @@ std::string schedule_constraints::to_str() const { } -isl::ctx schedule_constraints::get_ctx() const { - return isl::ctx(isl_schedule_constraints_get_ctx(ptr)); +ctx schedule_constraints::get_ctx() const { + return ctx(isl_schedule_constraints_get_ctx(ptr)); } -isl::schedule schedule_constraints::compute_schedule() const +schedule schedule_constraints::compute_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_compute_schedule(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_coincidence() const +union_map schedule_constraints::get_coincidence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_coincidence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_conditional_validity() const +union_map schedule_constraints::get_conditional_validity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_conditional_validity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_conditional_validity_condition() const +union_map schedule_constraints::get_conditional_validity_condition() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_conditional_validity_condition(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set schedule_constraints::get_context() const +set schedule_constraints::get_context() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_context(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set schedule_constraints::get_domain() const +union_set schedule_constraints::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff schedule_constraints::get_prefix() const +multi_union_pw_aff schedule_constraints::get_prefix() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_prefix(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_proximity() const +union_map schedule_constraints::get_proximity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_proximity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_constraints::get_validity() const +union_map schedule_constraints::get_validity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_get_validity(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::intersect_domain(isl::union_set domain) const +schedule_constraints schedule_constraints::intersect_domain(union_set domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_intersect_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::on_domain(isl::union_set domain) +schedule_constraints schedule_constraints::on_domain(union_set domain) { if (domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_on_domain(domain.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_coincidence(isl::union_map coincidence) const +schedule_constraints schedule_constraints::set_coincidence(union_map coincidence) const { if (!ptr || coincidence.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_conditional_validity(isl::union_map condition, isl::union_map validity) const +schedule_constraints schedule_constraints::set_conditional_validity(union_map condition, union_map validity) const { if (!ptr || condition.is_null() || validity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_context(isl::set context) const +schedule_constraints schedule_constraints::set_context(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_context(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_prefix(isl::multi_union_pw_aff prefix) const +schedule_constraints schedule_constraints::set_prefix(multi_union_pw_aff prefix) const { if (!ptr || prefix.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_prefix(copy(), prefix.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_proximity(isl::union_map proximity) const +schedule_constraints schedule_constraints::set_proximity(union_map proximity) const { if (!ptr || proximity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_constraints schedule_constraints::set_validity(isl::union_map validity) const +schedule_constraints schedule_constraints::set_validity(union_map validity) const { if (!ptr || validity.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_constraints_set_validity(copy(), validity.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::schedule_node -isl::schedule_node manage(__isl_take isl_schedule_node *ptr) { +schedule_node manage(__isl_take isl_schedule_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return schedule_node(ptr); } -isl::schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) { +schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_schedule_node_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_schedule_node_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return schedule_node(ptr); } schedule_node::schedule_node() : ptr(nullptr) {} -schedule_node::schedule_node(const isl::schedule_node &obj) - : ptr(obj.copy()) +schedule_node::schedule_node(const schedule_node &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_schedule_node_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_schedule_node_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } schedule_node::schedule_node(__isl_take isl_schedule_node *ptr) : ptr(ptr) {} -schedule_node &schedule_node::operator=(isl::schedule_node obj) { +schedule_node &schedule_node::operator=(schedule_node obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -15252,8 +14595,7 @@ template bool schedule_node::isa() { if (is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return isl_schedule_node_get_type(get()) == T::type; } template @@ -15262,74 +14604,74 @@ T schedule_node::as() return isa() ? T(copy()) : T(); } -isl::ctx schedule_node::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::schedule_node schedule_node::ancestor(int generation) const +schedule_node schedule_node::ancestor(int generation) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_ancestor(copy(), generation); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::child(int pos) const +schedule_node schedule_node::child(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_child(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::cut() const +schedule_node schedule_node::cut() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_cut(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::schedule_node schedule_node::del() const +schedule_node schedule_node::del() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_delete(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool schedule_node::every_descendant(const std::function &test) const +bool schedule_node::every_descendant(const std::function &test) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct test_data { - std::function func; + std::function func; std::exception_ptr eptr; } test_data = { test }; auto test_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -15338,38 +14680,38 @@ bool schedule_node::every_descendant(const std::function &fn) const +void schedule_node::foreach_descendant_top_down(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -15378,380 +14720,378 @@ void schedule_node::foreach_descendant_top_down(const std::function &fn) const +schedule_node schedule_node::map_descendant_bottom_up(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_schedule_node * { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage(arg_0)); return ret.release(); - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return NULL; } @@ -15760,89 +15100,89 @@ isl::schedule_node schedule_node::map_descendant_bottom_up(const std::functionptr, obj.ptr); return *this; } @@ -15887,234 +15227,306 @@ std::string schedule_node_band::to_str() const { } -isl::ctx schedule_node_band::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_band::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_band::get_ast_build_options() const +union_set schedule_node_band::get_ast_build_options() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_ast_build_options(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set schedule_node_band::get_ast_isolate_option() const +set schedule_node_band::get_ast_isolate_option() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_ast_isolate_option(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::multi_union_pw_aff schedule_node_band::get_partial_schedule() const +multi_union_pw_aff schedule_node_band::get_partial_schedule() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_partial_schedule(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_node_band::get_partial_schedule_union_map() const +union_map schedule_node_band::get_partial_schedule_union_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_partial_schedule_union_map(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool schedule_node_band::get_permutable() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_permutable(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::space schedule_node_band::get_space() const +space schedule_node_band::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool schedule_node_band::member_get_coincident(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_member_get_coincident(get(), pos); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -isl::schedule_node_band schedule_node_band::member_set_ast_loop_type(int pos, enum isl::ast_loop_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, static_cast(type)); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); -} - -isl::schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return bool(res); } -isl::schedule_node_band schedule_node_band::member_set_isolate_ast_loop_type(int pos, enum isl::ast_loop_type type) const +schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::mod(isl::multi_val mv) const +schedule_node_band schedule_node_band::mod(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_mod(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } unsigned int schedule_node_band::n_member() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_n_member(get()); return res; } -isl::schedule_node_band schedule_node_band::scale(isl::multi_val mv) const +schedule_node_band schedule_node_band::scale(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_scale(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::scale_down(isl::multi_val mv) const +schedule_node_band schedule_node_band::scale_down(multi_val mv) const { if (!ptr || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_scale_down(copy(), mv.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::set_ast_build_options(isl::union_set options) const +schedule_node_band schedule_node_band::set_ast_build_options(union_set options) const { if (!ptr || options.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_set_ast_build_options(copy(), options.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::set_permutable(int permutable) const +schedule_node_band schedule_node_band::set_permutable(int permutable) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_set_permutable(copy(), permutable); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::shift(isl::multi_union_pw_aff shift) const +schedule_node_band schedule_node_band::shift(multi_union_pw_aff shift) const { if (!ptr || shift.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_shift(copy(), shift.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::split(int pos) const +schedule_node_band schedule_node_band::split(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_split(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); } -isl::schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const +schedule_node_band schedule_node_band::tile(multi_val sizes) const { if (!ptr || sizes.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_band_tile(copy(), sizes.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res).as(); + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_default(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_default); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_atomic(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_atomic); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_unroll(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_unroll); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); +} + +schedule_node_band schedule_node_band::member_set_isolate_ast_loop_separate(int pos) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_schedule_node_band_member_set_isolate_ast_loop_type(copy(), pos, isl_ast_loop_separate); + if (!res) + exception::throw_last_error(ctx); + return manage(res).as(); } // implementations for isl::schedule_node_context @@ -16122,7 +15534,7 @@ isl::schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const schedule_node_context::schedule_node_context() : schedule_node() {} -schedule_node_context::schedule_node_context(const isl::schedule_node_context &obj) +schedule_node_context::schedule_node_context(const schedule_node_context &obj) : schedule_node(obj) { } @@ -16131,7 +15543,7 @@ schedule_node_context::schedule_node_context(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_context &schedule_node_context::operator=(isl::schedule_node_context obj) { +schedule_node_context &schedule_node_context::operator=(schedule_node_context obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16158,19 +15570,19 @@ std::string schedule_node_context::to_str() const { } -isl::ctx schedule_node_context::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_context::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::set schedule_node_context::get_context() const +set schedule_node_context::get_context() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_context_get_context(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16179,7 +15591,7 @@ isl::set schedule_node_context::get_context() const schedule_node_domain::schedule_node_domain() : schedule_node() {} -schedule_node_domain::schedule_node_domain(const isl::schedule_node_domain &obj) +schedule_node_domain::schedule_node_domain(const schedule_node_domain &obj) : schedule_node(obj) { } @@ -16188,7 +15600,7 @@ schedule_node_domain::schedule_node_domain(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_domain &schedule_node_domain::operator=(isl::schedule_node_domain obj) { +schedule_node_domain &schedule_node_domain::operator=(schedule_node_domain obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16215,19 +15627,19 @@ std::string schedule_node_domain::to_str() const { } -isl::ctx schedule_node_domain::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_domain::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_domain::get_domain() const +union_set schedule_node_domain::get_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_domain_get_domain(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16236,7 +15648,7 @@ isl::union_set schedule_node_domain::get_domain() const schedule_node_expansion::schedule_node_expansion() : schedule_node() {} -schedule_node_expansion::schedule_node_expansion(const isl::schedule_node_expansion &obj) +schedule_node_expansion::schedule_node_expansion(const schedule_node_expansion &obj) : schedule_node(obj) { } @@ -16245,7 +15657,7 @@ schedule_node_expansion::schedule_node_expansion(__isl_take isl_schedule_node *p : schedule_node(ptr) {} -schedule_node_expansion &schedule_node_expansion::operator=(isl::schedule_node_expansion obj) { +schedule_node_expansion &schedule_node_expansion::operator=(schedule_node_expansion obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16272,31 +15684,31 @@ std::string schedule_node_expansion::to_str() const { } -isl::ctx schedule_node_expansion::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_expansion::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_pw_multi_aff schedule_node_expansion::get_contraction() const +union_pw_multi_aff schedule_node_expansion::get_contraction() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_expansion_get_contraction(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map schedule_node_expansion::get_expansion() const +union_map schedule_node_expansion::get_expansion() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_expansion_get_expansion(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16305,7 +15717,7 @@ isl::union_map schedule_node_expansion::get_expansion() const schedule_node_extension::schedule_node_extension() : schedule_node() {} -schedule_node_extension::schedule_node_extension(const isl::schedule_node_extension &obj) +schedule_node_extension::schedule_node_extension(const schedule_node_extension &obj) : schedule_node(obj) { } @@ -16314,7 +15726,7 @@ schedule_node_extension::schedule_node_extension(__isl_take isl_schedule_node *p : schedule_node(ptr) {} -schedule_node_extension &schedule_node_extension::operator=(isl::schedule_node_extension obj) { +schedule_node_extension &schedule_node_extension::operator=(schedule_node_extension obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16341,19 +15753,19 @@ std::string schedule_node_extension::to_str() const { } -isl::ctx schedule_node_extension::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_extension::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_map schedule_node_extension::get_extension() const +union_map schedule_node_extension::get_extension() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_extension_get_extension(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16362,7 +15774,7 @@ isl::union_map schedule_node_extension::get_extension() const schedule_node_filter::schedule_node_filter() : schedule_node() {} -schedule_node_filter::schedule_node_filter(const isl::schedule_node_filter &obj) +schedule_node_filter::schedule_node_filter(const schedule_node_filter &obj) : schedule_node(obj) { } @@ -16371,7 +15783,7 @@ schedule_node_filter::schedule_node_filter(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_filter &schedule_node_filter::operator=(isl::schedule_node_filter obj) { +schedule_node_filter &schedule_node_filter::operator=(schedule_node_filter obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16398,19 +15810,19 @@ std::string schedule_node_filter::to_str() const { } -isl::ctx schedule_node_filter::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_filter::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::union_set schedule_node_filter::get_filter() const +union_set schedule_node_filter::get_filter() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_filter_get_filter(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16419,7 +15831,7 @@ isl::union_set schedule_node_filter::get_filter() const schedule_node_guard::schedule_node_guard() : schedule_node() {} -schedule_node_guard::schedule_node_guard(const isl::schedule_node_guard &obj) +schedule_node_guard::schedule_node_guard(const schedule_node_guard &obj) : schedule_node(obj) { } @@ -16428,7 +15840,7 @@ schedule_node_guard::schedule_node_guard(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_guard &schedule_node_guard::operator=(isl::schedule_node_guard obj) { +schedule_node_guard &schedule_node_guard::operator=(schedule_node_guard obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16455,19 +15867,19 @@ std::string schedule_node_guard::to_str() const { } -isl::ctx schedule_node_guard::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_guard::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::set schedule_node_guard::get_guard() const +set schedule_node_guard::get_guard() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_guard_get_guard(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16476,7 +15888,7 @@ isl::set schedule_node_guard::get_guard() const schedule_node_leaf::schedule_node_leaf() : schedule_node() {} -schedule_node_leaf::schedule_node_leaf(const isl::schedule_node_leaf &obj) +schedule_node_leaf::schedule_node_leaf(const schedule_node_leaf &obj) : schedule_node(obj) { } @@ -16485,7 +15897,7 @@ schedule_node_leaf::schedule_node_leaf(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_leaf &schedule_node_leaf::operator=(isl::schedule_node_leaf obj) { +schedule_node_leaf &schedule_node_leaf::operator=(schedule_node_leaf obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16512,8 +15924,8 @@ std::string schedule_node_leaf::to_str() const { } -isl::ctx schedule_node_leaf::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_leaf::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } @@ -16522,7 +15934,7 @@ isl::ctx schedule_node_leaf::get_ctx() const { schedule_node_mark::schedule_node_mark() : schedule_node() {} -schedule_node_mark::schedule_node_mark(const isl::schedule_node_mark &obj) +schedule_node_mark::schedule_node_mark(const schedule_node_mark &obj) : schedule_node(obj) { } @@ -16531,7 +15943,7 @@ schedule_node_mark::schedule_node_mark(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_mark &schedule_node_mark::operator=(isl::schedule_node_mark obj) { +schedule_node_mark &schedule_node_mark::operator=(schedule_node_mark obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16558,19 +15970,19 @@ std::string schedule_node_mark::to_str() const { } -isl::ctx schedule_node_mark::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_mark::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } -isl::id schedule_node_mark::get_id() const +id schedule_node_mark::get_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_schedule_node_mark_get_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } @@ -16579,7 +15991,7 @@ isl::id schedule_node_mark::get_id() const schedule_node_sequence::schedule_node_sequence() : schedule_node() {} -schedule_node_sequence::schedule_node_sequence(const isl::schedule_node_sequence &obj) +schedule_node_sequence::schedule_node_sequence(const schedule_node_sequence &obj) : schedule_node(obj) { } @@ -16588,7 +16000,7 @@ schedule_node_sequence::schedule_node_sequence(__isl_take isl_schedule_node *ptr : schedule_node(ptr) {} -schedule_node_sequence &schedule_node_sequence::operator=(isl::schedule_node_sequence obj) { +schedule_node_sequence &schedule_node_sequence::operator=(schedule_node_sequence obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16615,8 +16027,8 @@ std::string schedule_node_sequence::to_str() const { } -isl::ctx schedule_node_sequence::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_sequence::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } @@ -16625,7 +16037,7 @@ isl::ctx schedule_node_sequence::get_ctx() const { schedule_node_set::schedule_node_set() : schedule_node() {} -schedule_node_set::schedule_node_set(const isl::schedule_node_set &obj) +schedule_node_set::schedule_node_set(const schedule_node_set &obj) : schedule_node(obj) { } @@ -16634,7 +16046,7 @@ schedule_node_set::schedule_node_set(__isl_take isl_schedule_node *ptr) : schedule_node(ptr) {} -schedule_node_set &schedule_node_set::operator=(isl::schedule_node_set obj) { +schedule_node_set &schedule_node_set::operator=(schedule_node_set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16661,76 +16073,78 @@ std::string schedule_node_set::to_str() const { } -isl::ctx schedule_node_set::get_ctx() const { - return isl::ctx(isl_schedule_node_get_ctx(ptr)); +ctx schedule_node_set::get_ctx() const { + return ctx(isl_schedule_node_get_ctx(ptr)); } // implementations for isl::set -isl::set manage(__isl_take isl_set *ptr) { +set manage(__isl_take isl_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return set(ptr); } -isl::set manage_copy(__isl_keep isl_set *ptr) { +set manage_copy(__isl_keep isl_set *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_set_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_set_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return set(ptr); } set::set() : ptr(nullptr) {} -set::set(const isl::set &obj) - : ptr(obj.copy()) +set::set(const set &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_set_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_set_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } set::set(__isl_take isl_set *ptr) : ptr(ptr) {} -set::set(isl::point pnt) +set::set(point pnt) { if (pnt.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pnt.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_point(pnt.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set::set(isl::ctx ctx, const std::string &str) +set::set(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set::set(isl::basic_set bset) +set::set(basic_set bset) { if (bset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_basic_set(bset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set &set::operator=(isl::set obj) { +set &set::operator=(set obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -16782,205 +16196,170 @@ std::string set::to_str() const { } -isl::ctx set::get_ctx() const { - return isl::ctx(isl_set_get_ctx(ptr)); -} - -isl::set set::add_constraint(isl::constraint constraint) const -{ - if (!ptr || constraint.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_add_constraint(copy(), constraint.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::set set::add_dims(enum isl::dim_type type, unsigned int n) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_add_dims(copy(), static_cast(type), n); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); +ctx set::get_ctx() const { + return ctx(isl_set_get_ctx(ptr)); } -isl::basic_set set::affine_hull() const +basic_set set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::align_params(isl::space model) const +set set::align_params(space model) const { if (!ptr || model.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_align_params(copy(), model.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::apply(isl::map map) const +set set::apply(map map) const { if (!ptr || map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_apply(copy(), map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::coalesce() const +set set::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::complement() const +set set::complement() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_complement(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::compute_divs() const +set set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::detect_equalities() const +set set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -unsigned int set::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_dim(get(), static_cast(type)); - return res; -} - -isl::pw_aff set::dim_max(int pos) const +pw_aff set::dim_max(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_dim_max(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff set::dim_min(int pos) const +pw_aff set::dim_min(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_dim_min(copy(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::empty(isl::space space) +set set::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::flatten() const +set set::flatten() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_flatten(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::flatten_map() const +map set::flatten_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_flatten_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void set::foreach_basic_set(const std::function &fn) const +void set::foreach_basic_set(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -16989,329 +16368,327 @@ void set::foreach_basic_set(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set set::from(isl::multi_aff ma) +set set::from(multi_aff ma) { if (ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = ma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_multi_aff(ma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::from_params() const +set set::from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::from_union_set(isl::union_set uset) +set set::from_union_set(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_from_union_set(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set_list set::get_basic_set_list() const +basic_set_list set::get_basic_set_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_basic_set_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space set::get_space() const +space set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::get_stride(int pos) const +val set::get_stride(int pos) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_stride(get(), pos); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::id set::get_tuple_id() const +id set::get_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } std::string set::get_tuple_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_get_tuple_name(get()); std::string tmp(res); return tmp; } -isl::set set::gist(isl::set context) const +set set::gist(set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool set::has_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_has_tuple_id(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool set::has_tuple_name() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_has_tuple_name(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::map set::identity() const +map set::identity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_identity(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::intersect(isl::set set2) const +set set::intersect(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_intersect(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::intersect_params(isl::set params) const +set set::intersect_params(set params) const { if (!ptr || params.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_intersect_params(copy(), params.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool set::involves_param(const isl::id &id) const +bool set::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool set::is_disjoint(const isl::set &set2) const +bool set::is_disjoint(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_disjoint(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool set::is_equal(const isl::set &set2) const +bool set::is_equal(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_equal(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool set::is_singleton() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_singleton(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool set::is_strict_subset(const isl::set &set2) const +bool set::is_strict_subset(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_strict_subset(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool set::is_subset(const isl::set &set2) const +bool set::is_subset(const set &set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_subset(get(), set2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool set::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::set set::lexmax() const +set set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::lexmin() const +set set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::max_val(const isl::aff &obj) const +val set::max_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_max_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val set::min_val(const isl::aff &obj) const +val set::min_val(const aff &obj) const { if (!ptr || obj.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_min_val(get(), obj.get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int set::n_basic_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_basic_set(get()); return res; } @@ -17319,9 +16696,9 @@ int set::n_basic_set() const unsigned int set::n_dim() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_dim(get()); return res; } @@ -17329,332 +16706,309 @@ unsigned int set::n_dim() const unsigned int set::n_param() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_n_param(get()); return res; } -isl::set set::nat_universe(isl::space dim) +set set::nat_universe(space dim) { if (dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = dim.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_nat_universe(dim.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::params() const +set set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::val set::plain_get_val_if_fixed(enum isl::dim_type type, unsigned int pos) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_plain_get_val_if_fixed(get(), static_cast(type), pos); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool set::plain_is_universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_plain_is_universe(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::basic_set set::polyhedral_hull() const +basic_set set::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::preimage_multi_aff(isl::multi_aff ma) const +set set::preimage_multi_aff(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_preimage_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::product(isl::set set2) const +set set::product(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_product(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::reset_tuple_id() const +set set::reset_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_reset_tuple_id(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::sample() const +basic_set set::sample() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_sample(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point set::sample_point() const +point set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::set set::set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_set_set_dim_id(copy(), static_cast(type), pos, id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::set_tuple_id(isl::id id) const +set set::set_tuple_id(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::set_tuple_name(const std::string &s) const +set set::set_tuple_name(const std::string &s) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_set_tuple_name(copy(), s.c_str()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::simple_hull() const +basic_set set::simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::subtract(isl::set set2) const +set set::subtract(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_subtract(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::unbind_params(isl::multi_id tuple) const +set set::unbind_params(multi_id tuple) const { if (!ptr || tuple.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unbind_params(copy(), tuple.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::unbind_params_insert_domain(isl::multi_id domain) const +map set::unbind_params_insert_domain(multi_id domain) const { if (!ptr || domain.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unbind_params_insert_domain(copy(), domain.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::unite(isl::set set2) const +set set::unite(set set2) const { if (!ptr || set2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_union(copy(), set2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set set::universe(isl::space space) +set set::universe(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_universe(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::basic_set set::unshifted_simple_hull() const +basic_set set::unshifted_simple_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unshifted_simple_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::unwrap() const +map set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map set::wrapped_domain_map() const +map set::wrapped_domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_wrapped_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::set_list -isl::set_list manage(__isl_take isl_set_list *ptr) { +set_list manage(__isl_take isl_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return set_list(ptr); } -isl::set_list manage_copy(__isl_keep isl_set_list *ptr) { +set_list manage_copy(__isl_keep isl_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return set_list(ptr); } set_list::set_list() : ptr(nullptr) {} -set_list::set_list(const isl::set_list &obj) - : ptr(obj.copy()) +set_list::set_list(const set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } set_list::set_list(__isl_take isl_set_list *ptr) : ptr(ptr) {} -set_list::set_list(isl::set el) +set_list::set_list(set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_from_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set_list::set_list(isl::ctx ctx, int n) +set_list::set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -set_list &set_list::operator=(isl::set_list obj) { +set_list &set_list::operator=(set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17688,62 +17042,62 @@ set_list::operator bool() const -isl::ctx set_list::get_ctx() const { - return isl::ctx(isl_set_list_get_ctx(ptr)); +ctx set_list::get_ctx() const { + return ctx(isl_set_list_get_ctx(ptr)); } -isl::set_list set_list::add(isl::set el) const +set_list set_list::add(set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::concat(isl::set_list list2) const +set_list set_list::concat(set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::drop(unsigned int first, unsigned int n) const +set_list set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void set_list::foreach(const std::function &fn) const +void set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -17752,101 +17106,105 @@ void set_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set set_list::get_at(int index) const +set set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::set_list set_list::reverse() const +set_list set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_set_list_size(get()); return res; } // implementations for isl::space -isl::space manage(__isl_take isl_space *ptr) { +space manage(__isl_take isl_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return space(ptr); } -isl::space manage_copy(__isl_keep isl_space *ptr) { +space manage_copy(__isl_keep isl_space *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_space_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_space_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return space(ptr); } space::space() : ptr(nullptr) {} -space::space(const isl::space &obj) - : ptr(obj.copy()) +space::space(const space &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_space_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_space_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } space::space(__isl_take isl_space *ptr) : ptr(ptr) {} -space::space(isl::ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out) +space::space(ctx ctx, unsigned int nparam, unsigned int n_in, unsigned int n_out) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_alloc(ctx.release(), nparam, n_in, n_out); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space::space(isl::ctx ctx, unsigned int nparam, unsigned int dim) +space::space(ctx ctx, unsigned int nparam, unsigned int dim) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_set_alloc(ctx.release(), nparam, dim); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space::space(isl::ctx ctx, unsigned int nparam) +space::space(ctx ctx, unsigned int nparam) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_params_alloc(ctx.release(), nparam); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -space &space::operator=(isl::space obj) { +space &space::operator=(space obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -17898,482 +17256,431 @@ std::string space::to_str() const { } -isl::ctx space::get_ctx() const { - return isl::ctx(isl_space_get_ctx(ptr)); +ctx space::get_ctx() const { + return ctx(isl_space_get_ctx(ptr)); +} + +space space::add_named_tuple_id_ui(id tuple_id, unsigned int dim) const +{ + if (!ptr || tuple_id.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim); + if (!res) + exception::throw_last_error(ctx); + return manage(res); } -isl::space space::add_param(isl::id id) const +space space::add_param(id id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_add_param_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); + return manage(res); +} + +space space::add_unnamed_tuple_ui(unsigned int dim) const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_space_add_unnamed_tuple_ui(copy(), dim); + if (!res) + exception::throw_last_error(ctx); return manage(res); } -isl::space space::align_params(isl::space dim2) const +space space::align_params(space dim2) const { if (!ptr || dim2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_align_params(copy(), dim2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool space::can_curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_can_curry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool space::can_uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_can_uncurry(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::space space::curry() const +space space::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -unsigned int space::dim(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_dim(get(), static_cast(type)); - return res; -} - -isl::space space::domain() const +space space::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::domain_map() const +space space::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::domain_product(isl::space right) const +space space::domain_product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_domain_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -int space::find_dim_by_name(enum isl::dim_type type, const std::string &name) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_find_dim_by_name(get(), static_cast(type), name.c_str()); - return res; -} - -isl::space space::from_domain() const +space space::from_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_from_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::from_range() const +space space::from_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_from_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -std::string space::get_dim_name(enum isl::dim_type type, unsigned int pos) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_get_dim_name(get(), static_cast(type), pos); - std::string tmp(res); - return tmp; -} - -isl::id space::get_tuple_id(enum isl::dim_type type) const +id space::get_map_range_tuple_id() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_get_tuple_id(get(), static_cast(type)); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_space_get_map_range_tuple_id(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool space::has_equal_params(const isl::space &space2) const +bool space::has_equal_params(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_equal_params(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool space::has_equal_tuples(const isl::space &space2) const +bool space::has_equal_tuples(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_equal_tuples(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool space::has_param(const isl::id &id) const +bool space::has_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_has_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; -} - -bool space::has_tuple_id(enum isl::dim_type type) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_has_tuple_id(get(), static_cast(type)); - if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool space::is_equal(const isl::space &space2) const +bool space::is_equal(const space &space2) const { if (!ptr || space2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_equal(get(), space2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool space::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool space::is_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_set(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool space::is_wrapping() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_is_wrapping(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::space space::map_from_domain_and_range(isl::space range) const +space space::map_from_domain_and_range(space range) const { if (!ptr || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_map_from_domain_and_range(copy(), range.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::map_from_set() const +space space::map_from_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_map_from_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::named_set_from_params_id(isl::id tuple_id, unsigned int dim) const -{ - if (!ptr || tuple_id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_named_set_from_params_id(copy(), tuple_id.release(), dim); - if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::space space::params() const +space space::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::product(isl::space right) const +space space::product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range() const +space space::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range_map() const +space space::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::range_product(isl::space right) const +space space::range_product(space right) const { if (!ptr || right.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_range_product(copy(), right.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::space space::set_dim_id(enum isl::dim_type type, unsigned int pos, isl::id id) const -{ - if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_set_dim_id(copy(), static_cast(type), pos, id.release()); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::set_from_params() const +space space::set_from_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_set_from_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::set_tuple_name(enum isl::dim_type type, const std::string &s) const +space space::set_set_tuple_id(id id) const { - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_set_tuple_name(copy(), static_cast(type), s.c_str()); + if (!ptr || id.is_null()) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_space_set_set_tuple_id(copy(), id.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::uncurry() const +space space::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); - return manage(res); -} - -isl::space space::unnamed_set_from_params(unsigned int dim) const -{ - if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_space_unnamed_set_from_params(copy(), dim); - if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::unwrap() const +space space::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space space::wrap() const +space space::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_space_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::stride_info -isl::stride_info manage(__isl_take isl_stride_info *ptr) { +stride_info manage(__isl_take isl_stride_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return stride_info(ptr); } -isl::stride_info manage_copy(__isl_keep isl_stride_info *ptr) { +stride_info manage_copy(__isl_keep isl_stride_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_stride_info_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_stride_info_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return stride_info(ptr); } stride_info::stride_info() : ptr(nullptr) {} -stride_info::stride_info(const isl::stride_info &obj) - : ptr(obj.copy()) +stride_info::stride_info(const stride_info &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_stride_info_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_stride_info_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } stride_info::stride_info(__isl_take isl_stride_info *ptr) : ptr(ptr) {} -stride_info &stride_info::operator=(isl::stride_info obj) { +stride_info &stride_info::operator=(stride_info obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18407,79 +17714,82 @@ stride_info::operator bool() const -isl::ctx stride_info::get_ctx() const { - return isl::ctx(isl_stride_info_get_ctx(ptr)); +ctx stride_info::get_ctx() const { + return ctx(isl_stride_info_get_ctx(ptr)); } -isl::aff stride_info::get_offset() const +aff stride_info::get_offset() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_stride_info_get_offset(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val stride_info::get_stride() const +val stride_info::get_stride() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_stride_info_get_stride(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_access_info -isl::union_access_info manage(__isl_take isl_union_access_info *ptr) { +union_access_info manage(__isl_take isl_union_access_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_access_info(ptr); } -isl::union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) { +union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_access_info_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_access_info_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_access_info(ptr); } union_access_info::union_access_info() : ptr(nullptr) {} -union_access_info::union_access_info(const isl::union_access_info &obj) - : ptr(obj.copy()) +union_access_info::union_access_info(const union_access_info &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_access_info_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_access_info_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_access_info::union_access_info(__isl_take isl_union_access_info *ptr) : ptr(ptr) {} -union_access_info::union_access_info(isl::union_map sink) +union_access_info::union_access_info(union_map sink) { if (sink.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = sink.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_from_sink(sink.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_access_info &union_access_info::operator=(isl::union_access_info obj) { +union_access_info &union_access_info::operator=(union_access_info obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18527,115 +17837,119 @@ std::string union_access_info::to_str() const { } -isl::ctx union_access_info::get_ctx() const { - return isl::ctx(isl_union_access_info_get_ctx(ptr)); +ctx union_access_info::get_ctx() const { + return ctx(isl_union_access_info_get_ctx(ptr)); } -isl::union_flow union_access_info::compute_flow() const +union_flow union_access_info::compute_flow() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_compute_flow(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_kill(isl::union_map kill) const +union_access_info union_access_info::set_kill(union_map kill) const { if (!ptr || kill.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_kill(copy(), kill.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_may_source(isl::union_map may_source) const +union_access_info union_access_info::set_may_source(union_map may_source) const { if (!ptr || may_source.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_may_source(copy(), may_source.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_must_source(isl::union_map must_source) const +union_access_info union_access_info::set_must_source(union_map must_source) const { if (!ptr || must_source.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_must_source(copy(), must_source.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_schedule(isl::schedule schedule) const +union_access_info union_access_info::set_schedule(schedule schedule) const { if (!ptr || schedule.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_schedule(copy(), schedule.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_access_info union_access_info::set_schedule_map(isl::union_map schedule_map) const +union_access_info union_access_info::set_schedule_map(union_map schedule_map) const { if (!ptr || schedule_map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_flow -isl::union_flow manage(__isl_take isl_union_flow *ptr) { +union_flow manage(__isl_take isl_union_flow *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_flow(ptr); } -isl::union_flow manage_copy(__isl_keep isl_union_flow *ptr) { +union_flow manage_copy(__isl_keep isl_union_flow *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_flow_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_flow_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_flow(ptr); } union_flow::union_flow() : ptr(nullptr) {} -union_flow::union_flow(const isl::union_flow &obj) - : ptr(obj.copy()) +union_flow::union_flow(const union_flow &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_flow_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_flow_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_flow::union_flow(__isl_take isl_union_flow *ptr) : ptr(ptr) {} -union_flow &union_flow::operator=(isl::union_flow obj) { +union_flow &union_flow::operator=(union_flow obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18683,147 +17997,149 @@ std::string union_flow::to_str() const { } -isl::ctx union_flow::get_ctx() const { - return isl::ctx(isl_union_flow_get_ctx(ptr)); +ctx union_flow::get_ctx() const { + return ctx(isl_union_flow_get_ctx(ptr)); } -isl::union_map union_flow::get_full_may_dependence() const +union_map union_flow::get_full_may_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_full_may_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_full_must_dependence() const +union_map union_flow::get_full_must_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_full_must_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_may_dependence() const +union_map union_flow::get_may_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_may_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_may_no_source() const +union_map union_flow::get_may_no_source() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_may_no_source(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_must_dependence() const +union_map union_flow::get_must_dependence() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_must_dependence(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_flow::get_must_no_source() const +union_map union_flow::get_must_no_source() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_flow_get_must_no_source(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_map -isl::union_map manage(__isl_take isl_union_map *ptr) { +union_map manage(__isl_take isl_union_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_map(ptr); } -isl::union_map manage_copy(__isl_keep isl_union_map *ptr) { +union_map manage_copy(__isl_keep isl_union_map *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_map_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_map_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_map(ptr); } union_map::union_map() : ptr(nullptr) {} -union_map::union_map(const isl::union_map &obj) - : ptr(obj.copy()) +union_map::union_map(const union_map &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_map_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_map_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_map::union_map(__isl_take isl_union_map *ptr) : ptr(ptr) {} -union_map::union_map(isl::basic_map bmap) +union_map::union_map(basic_map bmap) { if (bmap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = bmap.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_basic_map(bmap.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map::union_map(isl::map map) +union_map::union_map(map map) { if (map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = map.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_map(map.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map::union_map(isl::ctx ctx, const std::string &str) +union_map::union_map(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_map &union_map::operator=(isl::union_map obj) { +union_map &union_map::operator=(union_map obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -18875,291 +18191,290 @@ std::string union_map::to_str() const { } -isl::ctx union_map::get_ctx() const { - return isl::ctx(isl_union_map_get_ctx(ptr)); +ctx union_map::get_ctx() const { + return ctx(isl_union_map_get_ctx(ptr)); } -isl::union_map union_map::add_map(isl::map map) const +union_map union_map::add_map(map map) const { if (!ptr || map.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_add_map(copy(), map.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::affine_hull() const +union_map union_map::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::apply_domain(isl::union_map umap2) const +union_map union_map::apply_domain(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_apply_domain(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::apply_range(isl::union_map umap2) const +union_map union_map::apply_range(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_apply_range(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::coalesce() const +union_map union_map::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::compute_divs() const +union_map union_map::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::curry() const +union_map union_map::curry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_curry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::deltas() const +union_set union_map::deltas() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_deltas(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::detect_equalities() const +union_map union_map::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::domain() const +union_set union_map::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_factor_domain() const +union_map union_map::domain_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_factor_range() const +union_map union_map::domain_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_map() const +union_map union_map::domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const +union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_map_union_pw_multi_aff(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::domain_product(isl::union_map umap2) const +union_map union_map::domain_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_domain_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::empty(isl::space space) +union_map union_map::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::eq_at(isl::multi_union_pw_aff mupa) const +union_map union_map::eq_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::map union_map::extract_map(isl::space dim) const +map union_map::extract_map(space dim) const { if (!ptr || dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_extract_map(get(), dim.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::factor_domain() const +union_map union_map::factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::factor_range() const +union_map union_map::factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::fixed_power(isl::val exp) const +union_map union_map::fixed_power(val exp) const { if (!ptr || exp.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_fixed_power_val(copy(), exp.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::flat_range_product(isl::union_map umap2) const +union_map union_map::flat_range_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_flat_range_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_map::foreach_map(const std::function &fn) const +void union_map::foreach_map(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -19168,630 +18483,626 @@ void union_map::foreach_map(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_map union_map::from(isl::union_pw_multi_aff upma) +union_map union_map::from(union_pw_multi_aff upma) { if (upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_union_pw_multi_aff(upma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from(isl::multi_union_pw_aff mupa) +union_map union_map::from(multi_union_pw_aff mupa) { if (mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = mupa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_multi_union_pw_aff(mupa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_domain(isl::union_set uset) +union_map union_map::from_domain(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_domain(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_domain_and_range(isl::union_set domain, isl::union_set range) +union_map union_map::from_domain_and_range(union_set domain, union_set range) { if (domain.is_null() || range.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_domain_and_range(domain.release(), range.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::from_range(isl::union_set uset) +union_map union_map::from_range(union_set uset) { if (uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = uset.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_from_range(uset.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::map_list union_map::get_map_list() const +map_list union_map::get_map_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_get_map_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_map::get_space() const +space union_map::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist(isl::union_map context) const +union_map union_map::gist(union_map context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_domain(isl::union_set uset) const +union_map union_map::gist_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_params(isl::set set) const +union_map union_map::gist_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::gist_range(isl::union_set uset) const +union_map union_map::gist_range(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_gist_range(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect(isl::union_map umap2) const +union_map union_map::intersect(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_domain(isl::union_set uset) const +union_map union_map::intersect_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_params(isl::set set) const +union_map union_map::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::intersect_range(isl::union_set uset) const +union_map union_map::intersect_range(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_intersect_range(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } bool union_map::is_bijective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_bijective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool union_map::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_map::is_equal(const isl::union_map &umap2) const +bool union_map::is_equal(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_equal(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool union_map::is_injective() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_injective(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool union_map::is_single_valued() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_single_valued(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_map::is_strict_subset(const isl::union_map &umap2) const +bool union_map::is_strict_subset(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_strict_subset(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_map::is_subset(const isl::union_map &umap2) const +bool union_map::is_subset(const union_map &umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_is_subset(get(), umap2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::union_map union_map::lex_gt_at(isl::multi_union_pw_aff mupa) const +union_map union_map::lex_gt_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lex_gt_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lex_lt_at(isl::multi_union_pw_aff mupa) const +union_map union_map::lex_lt_at(multi_union_pw_aff mupa) const { if (!ptr || mupa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lex_lt_at_multi_union_pw_aff(copy(), mupa.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lexmax() const +union_map union_map::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::lexmin() const +union_map union_map::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_map::n_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_n_map(get()); return res; } -isl::union_map union_map::polyhedral_hull() const +union_map union_map::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::preimage_range_multi_aff(isl::multi_aff ma) const +union_map union_map::preimage_range_multi_aff(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_preimage_range_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::product(isl::union_map umap2) const +union_map union_map::product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::project_out_all_params() const +union_map union_map::project_out_all_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_project_out_all_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::range() const +union_set union_map::range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_factor_domain() const +union_map union_map::range_factor_domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_factor_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_factor_range() const +union_map union_map::range_factor_range() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_factor_range(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_map() const +union_map union_map::range_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::range_product(isl::union_map umap2) const +union_map union_map::range_product(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_range_product(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::reverse() const +union_map union_map::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract(isl::union_map umap2) const +union_map union_map::subtract(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract_domain(isl::union_set dom) const +union_map union_map::subtract_domain(union_set dom) const { if (!ptr || dom.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract_domain(copy(), dom.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::subtract_range(isl::union_set dom) const +union_map union_map::subtract_range(union_set dom) const { if (!ptr || dom.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_subtract_range(copy(), dom.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::uncurry() const +union_map union_map::uncurry() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_uncurry(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::unite(isl::union_map umap2) const +union_map union_map::unite(union_map umap2) const { if (!ptr || umap2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_union(copy(), umap2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::universe() const +union_map union_map::universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_universe(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_map::wrap() const +union_set union_map::wrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_wrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_map::zip() const +union_map union_map::zip() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_map_zip(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_pw_aff -isl::union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) { +union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_aff(ptr); } -isl::union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) { +union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_aff(ptr); } union_pw_aff::union_pw_aff() : ptr(nullptr) {} -union_pw_aff::union_pw_aff(const isl::union_pw_aff &obj) - : ptr(obj.copy()) +union_pw_aff::union_pw_aff(const union_pw_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr) : ptr(ptr) {} -union_pw_aff::union_pw_aff(isl::pw_aff pa) +union_pw_aff::union_pw_aff(pw_aff pa) { if (pa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_from_pw_aff(pa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::union_set domain, isl::val v) +union_pw_aff::union_pw_aff(union_set domain, val v) { if (domain.is_null() || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_val_on_domain(domain.release(), v.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::union_set domain, isl::aff aff) +union_pw_aff::union_pw_aff(union_set domain, aff aff) { if (domain.is_null() || aff.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_aff_on_domain(domain.release(), aff.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff::union_pw_aff(isl::ctx ctx, const std::string &str) +union_pw_aff::union_pw_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff &union_pw_aff::operator=(isl::union_pw_aff obj) { +union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -19839,99 +19150,98 @@ std::string union_pw_aff::to_str() const { } -isl::ctx union_pw_aff::get_ctx() const { - return isl::ctx(isl_union_pw_aff_get_ctx(ptr)); +ctx union_pw_aff::get_ctx() const { + return ctx(isl_union_pw_aff_get_ctx(ptr)); } -isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::add(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_add(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_aff::domain() const +union_set union_pw_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::empty(isl::space space) +union_pw_aff union_pw_aff::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff union_pw_aff::extract_on_domain(isl::space space) const +pw_aff union_pw_aff::extract_on_domain(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_extract_on_domain_space(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_aff union_pw_aff::extract_pw_aff(isl::space space) const +pw_aff union_pw_aff::extract_pw_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_extract_pw_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::floor() const +union_pw_aff union_pw_aff::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_aff::foreach_pw_aff(const std::function &fn) const +void union_pw_aff::foreach_pw_aff(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -19940,230 +19250,256 @@ void union_pw_aff::foreach_pw_aff(const std::function &fn) co if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::pw_aff_list union_pw_aff::get_pw_aff_list() const +pw_aff_list union_pw_aff::get_pw_aff_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_get_pw_aff_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_pw_aff::get_space() const +space union_pw_aff::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::intersect_domain(isl::union_set uset) const +union_pw_aff union_pw_aff::intersect_domain(union_set uset) const { if (!ptr || uset.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_intersect_domain(copy(), uset.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool union_pw_aff::involves_param(const isl::id &id) const +bool union_pw_aff::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); +} + +val union_pw_aff::max_val() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_union_pw_aff_max_val(copy()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); +} + +val union_pw_aff::min_val() const +{ + if (!ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_union_pw_aff_min_val(copy()); + if (!res) + exception::throw_last_error(ctx); + return manage(res); } -isl::union_pw_aff union_pw_aff::mod_val(isl::val f) const +union_pw_aff union_pw_aff::mod(val f) const { if (!ptr || f.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_mod_val(copy(), f.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_pw_aff::n_pw_aff() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_n_pw_aff(get()); return res; } -isl::union_pw_aff union_pw_aff::param_on_domain(isl::union_set domain, isl::id id) +union_pw_aff union_pw_aff::param_on_domain(union_set domain, id id) { if (domain.is_null() || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_param_on_domain_id(domain.release(), id.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool union_pw_aff::plain_is_equal(const isl::union_pw_aff &upa2) const +bool union_pw_aff::plain_is_equal(const union_pw_aff &upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_plain_is_equal(get(), upa2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const +union_pw_aff union_pw_aff::pullback(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::scale_down(isl::val v) const +union_pw_aff union_pw_aff::scale(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_aff_scale_down_val(copy(), v.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_union_pw_aff_scale_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::scale_val(isl::val v) const +union_pw_aff union_pw_aff::scale_down(val v) const { if (!ptr || v.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); - auto res = isl_union_pw_aff_scale_val(copy(), v.release()); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + auto res = isl_union_pw_aff_scale_down_val(copy(), v.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::sub(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::sub(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_sub(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff union_pw_aff::union_add(isl::union_pw_aff upa2) const +union_pw_aff union_pw_aff::union_add(union_pw_aff upa2) const { if (!ptr || upa2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_union_add(copy(), upa2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_aff::zero_union_set() const +union_set union_pw_aff::zero_union_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_zero_union_set(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_pw_aff_list -isl::union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) { +union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_aff_list(ptr); } -isl::union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) { +union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_aff_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_aff_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_aff_list(ptr); } union_pw_aff_list::union_pw_aff_list() : ptr(nullptr) {} -union_pw_aff_list::union_pw_aff_list(const isl::union_pw_aff_list &obj) - : ptr(obj.copy()) +union_pw_aff_list::union_pw_aff_list(const union_pw_aff_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_aff_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_aff_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_aff_list::union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr) : ptr(ptr) {} -union_pw_aff_list::union_pw_aff_list(isl::union_pw_aff el) +union_pw_aff_list::union_pw_aff_list(union_pw_aff el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_from_union_pw_aff(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, int n) +union_pw_aff_list::union_pw_aff_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_aff_list &union_pw_aff_list::operator=(isl::union_pw_aff_list obj) { +union_pw_aff_list &union_pw_aff_list::operator=(union_pw_aff_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -20197,62 +19533,62 @@ union_pw_aff_list::operator bool() const -isl::ctx union_pw_aff_list::get_ctx() const { - return isl::ctx(isl_union_pw_aff_list_get_ctx(ptr)); +ctx union_pw_aff_list::get_ctx() const { + return ctx(isl_union_pw_aff_list_get_ctx(ptr)); } -isl::union_pw_aff_list union_pw_aff_list::add(isl::union_pw_aff el) const +union_pw_aff_list union_pw_aff_list::add(union_pw_aff el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::concat(isl::union_pw_aff_list list2) const +union_pw_aff_list union_pw_aff_list::concat(union_pw_aff_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const +union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_aff_list::foreach(const std::function &fn) const +void union_pw_aff_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_union_pw_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20261,121 +19597,122 @@ void union_pw_aff_list::foreach(const std::function &fn if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_pw_aff union_pw_aff_list::get_at(int index) const +union_pw_aff union_pw_aff_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_aff_list union_pw_aff_list::reverse() const +union_pw_aff_list union_pw_aff_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_pw_aff_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_aff_list_size(get()); return res; } // implementations for isl::union_pw_multi_aff -isl::union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) { +union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_pw_multi_aff(ptr); } -isl::union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) { +union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_pw_multi_aff_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_pw_multi_aff_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_pw_multi_aff(ptr); } union_pw_multi_aff::union_pw_multi_aff() : ptr(nullptr) {} -union_pw_multi_aff::union_pw_multi_aff(const isl::union_pw_multi_aff &obj) - : ptr(obj.copy()) +union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_pw_multi_aff_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr) : ptr(ptr) {} -union_pw_multi_aff::union_pw_multi_aff(isl::pw_multi_aff pma) +union_pw_multi_aff::union_pw_multi_aff(pw_multi_aff pma) { if (pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = pma.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::union_set domain, isl::multi_val mv) +union_pw_multi_aff::union_pw_multi_aff(union_set domain, multi_val mv) { if (domain.is_null() || mv.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = domain.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_multi_val_on_domain(domain.release(), mv.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::ctx ctx, const std::string &str) +union_pw_multi_aff::union_pw_multi_aff(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff::union_pw_multi_aff(isl::union_pw_aff upa) +union_pw_multi_aff::union_pw_multi_aff(union_pw_aff upa) { if (upa.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = upa.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_pw_multi_aff &union_pw_multi_aff::operator=(isl::union_pw_multi_aff obj) { +union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -20423,74 +19760,74 @@ std::string union_pw_multi_aff::to_str() const { } -isl::ctx union_pw_multi_aff::get_ctx() const { - return isl::ctx(isl_union_pw_multi_aff_get_ctx(ptr)); +ctx union_pw_multi_aff::get_ctx() const { + return ctx(isl_union_pw_multi_aff_get_ctx(ptr)); } -isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const +union_pw_multi_aff union_pw_multi_aff::add(union_pw_multi_aff upma2) const { if (!ptr || upma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_add(copy(), upma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_pw_multi_aff::domain() const +union_set union_pw_multi_aff::domain() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_domain(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(isl::space space) const +pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(space space) const { if (!ptr || space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_extract_pw_multi_aff(get(), space.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_pw_multi_aff union_pw_multi_aff::flat_range_product(isl::union_pw_multi_aff upma2) const +union_pw_multi_aff union_pw_multi_aff::flat_range_product(union_pw_multi_aff upma2) const { if (!ptr || upma2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_pw_multi_aff::foreach_pw_multi_aff(const std::function &fn) const +void union_pw_multi_aff::foreach_pw_multi_aff(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_pw_multi_aff *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20499,195 +19836,194 @@ void union_pw_multi_aff::foreach_pw_multi_aff(const std::functionptr, obj.ptr); return *this; } @@ -20739,111 +20075,110 @@ std::string union_set::to_str() const { } -isl::ctx union_set::get_ctx() const { - return isl::ctx(isl_union_set_get_ctx(ptr)); +ctx union_set::get_ctx() const { + return ctx(isl_union_set_get_ctx(ptr)); } -isl::union_set union_set::add_set(isl::set set) const +union_set union_set::add_set(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_add_set(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::affine_hull() const +union_set union_set::affine_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_affine_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::apply(isl::union_map umap) const +union_set union_set::apply(union_map umap) const { if (!ptr || umap.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_apply(copy(), umap.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::coalesce() const +union_set union_set::coalesce() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_coalesce(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::compute_divs() const +union_set union_set::compute_divs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_compute_divs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::detect_equalities() const +union_set union_set::detect_equalities() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_detect_equalities(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::empty(isl::space space) +union_set union_set::empty(space space) { if (space.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = space.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_empty(space.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool union_set::every_set(const std::function &test) const +bool union_set::every_set(const std::function &test) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct test_data { - std::function func; + std::function func; std::exception_ptr eptr; } test_data = { test }; auto test_lambda = [](isl_set *arg_0, void *arg_1) -> isl_bool { auto *data = static_cast(arg_1); - try { - auto ret = (data->func)(isl::manage_copy(arg_0)); + ISL_CPP_TRY { + auto ret = (data->func)(manage_copy(arg_0)); return ret ? isl_bool_true : isl_bool_false; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_bool_error; } @@ -20852,38 +20187,38 @@ bool union_set::every_set(const std::function &test) const if (test_data.eptr) std::rethrow_exception(test_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return bool(res); } -isl::set union_set::extract_set(isl::space dim) const +set union_set::extract_set(space dim) const { if (!ptr || dim.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_extract_set(get(), dim.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_set::foreach_point(const std::function &fn) const +void union_set::foreach_point(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20892,26 +20227,26 @@ void union_set::foreach_point(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -void union_set::foreach_set(const std::function &fn) const +void union_set::foreach_set(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -20920,397 +20255,400 @@ void union_set::foreach_set(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::set_list union_set::get_set_list() const +set_list union_set::get_set_list() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_get_set_list(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::space union_set::get_space() const +space union_set::get_space() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_get_space(get()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::gist(isl::union_set context) const +union_set union_set::gist(union_set context) const { if (!ptr || context.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_gist(copy(), context.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::gist_params(isl::set set) const +union_set union_set::gist_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_gist_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::identity() const +union_map union_set::identity() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_identity(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::intersect(isl::union_set uset2) const +union_set union_set::intersect(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_intersect(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::intersect_params(isl::set set) const +union_set union_set::intersect_params(set set) const { if (!ptr || set.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_intersect_params(copy(), set.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool union_set::involves_param(const isl::id &id) const +bool union_set::involves_param(const id &id) const { if (!ptr || id.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_involves_param_id(get(), id.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_set::is_disjoint(const isl::union_set &uset2) const +bool union_set::is_disjoint(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_disjoint(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool union_set::is_empty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_empty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_set::is_equal(const isl::union_set &uset2) const +bool union_set::is_equal(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_equal(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool union_set::is_params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_params(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_set::is_strict_subset(const isl::union_set &uset2) const +bool union_set::is_strict_subset(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_strict_subset(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool union_set::is_subset(const isl::union_set &uset2) const +bool union_set::is_subset(const union_set &uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_is_subset(get(), uset2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::union_set union_set::lexmax() const +union_set union_set::lexmax() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_lexmax(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::lexmin() const +union_set union_set::lexmin() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_lexmin(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_set::n_set() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_n_set(get()); return res; } -isl::set union_set::params() const +set union_set::params() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_params(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::polyhedral_hull() const +union_set union_set::polyhedral_hull() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_polyhedral_hull(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::multi_aff ma) const +union_set union_set::preimage(multi_aff ma) const { if (!ptr || ma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_multi_aff(copy(), ma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::pw_multi_aff pma) const +union_set union_set::preimage(pw_multi_aff pma) const { if (!ptr || pma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::preimage(isl::union_pw_multi_aff upma) const +union_set union_set::preimage(union_pw_multi_aff upma) const { if (!ptr || upma.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::point union_set::sample_point() const +point union_set::sample_point() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_sample_point(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::subtract(isl::union_set uset2) const +union_set union_set::subtract(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_subtract(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::unite(isl::union_set uset2) const +union_set union_set::unite(union_set uset2) const { if (!ptr || uset2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_union(copy(), uset2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set union_set::universe() const +union_set union_set::universe() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_universe(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::unwrap() const +union_map union_set::unwrap() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_unwrap(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_map union_set::wrapped_domain_map() const +union_map union_set::wrapped_domain_map() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_wrapped_domain_map(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::union_set_list -isl::union_set_list manage(__isl_take isl_union_set_list *ptr) { +union_set_list manage(__isl_take isl_union_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return union_set_list(ptr); } -isl::union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) { +union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_union_set_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_union_set_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return union_set_list(ptr); } union_set_list::union_set_list() : ptr(nullptr) {} -union_set_list::union_set_list(const isl::union_set_list &obj) - : ptr(obj.copy()) +union_set_list::union_set_list(const union_set_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_union_set_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_union_set_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } union_set_list::union_set_list(__isl_take isl_union_set_list *ptr) : ptr(ptr) {} -union_set_list::union_set_list(isl::union_set el) +union_set_list::union_set_list(union_set el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_from_union_set(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_set_list::union_set_list(isl::ctx ctx, int n) +union_set_list::union_set_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -union_set_list &union_set_list::operator=(isl::union_set_list obj) { +union_set_list &union_set_list::operator=(union_set_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -21344,62 +20682,62 @@ union_set_list::operator bool() const -isl::ctx union_set_list::get_ctx() const { - return isl::ctx(isl_union_set_list_get_ctx(ptr)); +ctx union_set_list::get_ctx() const { + return ctx(isl_union_set_list_get_ctx(ptr)); } -isl::union_set_list union_set_list::add(isl::union_set el) const +union_set_list union_set_list::add(union_set el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::concat(isl::union_set_list list2) const +union_set_list union_set_list::concat(union_set_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::drop(unsigned int first, unsigned int n) const +union_set_list union_set_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void union_set_list::foreach(const std::function &fn) const +void union_set_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_union_set *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -21408,93 +20746,97 @@ void union_set_list::foreach(const std::function &fn) cons if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::union_set union_set_list::get_at(int index) const +union_set union_set_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::union_set_list union_set_list::reverse() const +union_set_list union_set_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int union_set_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_union_set_list_size(get()); return res; } // implementations for isl::val -isl::val manage(__isl_take isl_val *ptr) { +val manage(__isl_take isl_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return val(ptr); } -isl::val manage_copy(__isl_keep isl_val *ptr) { +val manage_copy(__isl_keep isl_val *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_val_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_val_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return val(ptr); } val::val() : ptr(nullptr) {} -val::val(const isl::val &obj) - : ptr(obj.copy()) +val::val(const val &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_val_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_val_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } val::val(__isl_take isl_val *ptr) : ptr(ptr) {} -val::val(isl::ctx ctx, const std::string &str) +val::val(ctx ctx, const std::string &str) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_read_from_str(ctx.release(), str.c_str()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val::val(isl::ctx ctx, long i) +val::val(ctx ctx, long i) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_int_from_si(ctx.release(), i); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val &val::operator=(isl::val obj) { +val &val::operator=(val obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -21542,134 +20884,134 @@ std::string val::to_str() const { } -isl::ctx val::get_ctx() const { - return isl::ctx(isl_val_get_ctx(ptr)); +ctx val::get_ctx() const { + return ctx(isl_val_get_ctx(ptr)); } -isl::val val::abs() const +val val::abs() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_abs(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::abs_eq(const isl::val &v2) const +bool val::abs_eq(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_abs_eq(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::val val::add(isl::val v2) const +val val::add(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_add(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::ceil() const +val val::ceil() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ceil(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int val::cmp_si(long i) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_cmp_si(get(), i); return res; } -isl::val val::div(isl::val v2) const +val val::div(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_div(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::eq(const isl::val &v2) const +bool val::eq(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_eq(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::val val::floor() const +val val::floor() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_floor(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::gcd(isl::val v2) const +val val::gcd(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_gcd(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::ge(const isl::val &v2) const +bool val::ge(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ge(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } long val::get_den_si() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_get_den_si(get()); return res; } @@ -21677,430 +21019,433 @@ long val::get_den_si() const long val::get_num_si() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_get_num_si(get()); return res; } -bool val::gt(const isl::val &v2) const +bool val::gt(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_gt(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::val val::infty(isl::ctx ctx) +val val::infty(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_infty(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::inv() const +val val::inv() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_inv(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -bool val::is_divisible_by(const isl::val &v2) const +bool val::is_divisible_by(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_divisible_by(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_infty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_infty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_int() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_int(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_nan() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nan(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_neg(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_neginfty() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_neginfty(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_negone() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_negone(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_nonneg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nonneg(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_nonpos() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_nonpos(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_one() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_one(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_pos() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_pos(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_rat() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_rat(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } bool val::is_zero() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_is_zero(get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool val::le(const isl::val &v2) const +bool val::le(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_le(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -bool val::lt(const isl::val &v2) const +bool val::lt(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_lt(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::val val::max(isl::val v2) const +val val::max(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_max(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::min(isl::val v2) const +val val::min(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_min(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::mod(isl::val v2) const +val val::mod(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_mod(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::mul(isl::val v2) const +val val::mul(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_mul(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::nan(isl::ctx ctx) +val val::nan(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_nan(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -bool val::ne(const isl::val &v2) const +bool val::ne(const val &v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_ne(get(), v2.get()); if (res < 0) - throw exception::create_from_last_error(get_ctx()); - return res; + exception::throw_last_error(ctx); + return bool(res); } -isl::val val::neg() const +val val::neg() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_neg(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::neginfty(isl::ctx ctx) +val val::neginfty(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_neginfty(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::negone(isl::ctx ctx) +val val::negone(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_negone(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::one(isl::ctx ctx) +val val::one(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_one(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } int val::sgn() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_sgn(get()); return res; } -isl::val val::sub(isl::val v2) const +val val::sub(val v2) const { if (!ptr || v2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_sub(copy(), v2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::trunc() const +val val::trunc() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_trunc(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val val::zero(isl::ctx ctx) +val val::zero(ctx ctx) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_zero(ctx.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return manage(res); } // implementations for isl::val_list -isl::val_list manage(__isl_take isl_val_list *ptr) { +val_list manage(__isl_take isl_val_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); return val_list(ptr); } -isl::val_list manage_copy(__isl_keep isl_val_list *ptr) { +val_list manage_copy(__isl_keep isl_val_list *ptr) { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = isl_val_list_get_ctx(ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); ptr = isl_val_list_copy(ptr); if (!ptr) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); return val_list(ptr); } val_list::val_list() : ptr(nullptr) {} -val_list::val_list(const isl::val_list &obj) - : ptr(obj.copy()) +val_list::val_list(const val_list &obj) + : ptr(nullptr) { + if (!obj.ptr) + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = isl_val_list_get_ctx(obj.ptr); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); + ptr = obj.copy(); if (obj.ptr && !ptr) - throw exception::create_from_last_error(isl_val_list_get_ctx(obj.ptr)); + exception::throw_last_error(ctx); } val_list::val_list(__isl_take isl_val_list *ptr) : ptr(ptr) {} -val_list::val_list(isl::val el) +val_list::val_list(val el) { if (el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); + exception::throw_invalid("NULL input", __FILE__, __LINE__); auto ctx = el.get_ctx(); - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_from_val(el.release()); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val_list::val_list(isl::ctx ctx, int n) +val_list::val_list(ctx ctx, int n) { - options_scoped_set_on_error saved_on_error(ctx, ISL_ON_ERROR_CONTINUE); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_alloc(ctx.release(), n); if (!res) - throw exception::create_from_last_error(ctx); + exception::throw_last_error(ctx); ptr = res; } -val_list &val_list::operator=(isl::val_list obj) { +val_list &val_list::operator=(val_list obj) { std::swap(this->ptr, obj.ptr); return *this; } @@ -22134,62 +21479,62 @@ val_list::operator bool() const -isl::ctx val_list::get_ctx() const { - return isl::ctx(isl_val_list_get_ctx(ptr)); +ctx val_list::get_ctx() const { + return ctx(isl_val_list_get_ctx(ptr)); } -isl::val_list val_list::add(isl::val el) const +val_list val_list::add(val el) const { if (!ptr || el.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_add(copy(), el.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::concat(isl::val_list list2) const +val_list val_list::concat(val_list list2) const { if (!ptr || list2.is_null()) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_concat(copy(), list2.release()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::drop(unsigned int first, unsigned int n) const +val_list val_list::drop(unsigned int first, unsigned int n) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_drop(copy(), first, n); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -void val_list::foreach(const std::function &fn) const +void val_list::foreach(const std::function &fn) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); struct fn_data { - std::function func; + std::function func; std::exception_ptr eptr; } fn_data = { fn }; auto fn_lambda = [](isl_val *arg_0, void *arg_1) -> isl_stat { auto *data = static_cast(arg_1); - try { - (data->func)(isl::manage(arg_0)); + ISL_CPP_TRY { + (data->func)(manage(arg_0)); return isl_stat_ok; - } catch (...) { + } ISL_CPP_CATCH_ALL { data->eptr = std::current_exception(); return isl_stat_error; } @@ -22198,40 +21543,40 @@ void val_list::foreach(const std::function &fn) const if (fn_data.eptr) std::rethrow_exception(fn_data.eptr); if (res < 0) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return void(res); } -isl::val val_list::get_at(int index) const +val val_list::get_at(int index) const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_get_at(get(), index); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } -isl::val_list val_list::reverse() const +val_list val_list::reverse() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_reverse(copy()); if (!res) - throw exception::create_from_last_error(get_ctx()); + exception::throw_last_error(ctx); return manage(res); } int val_list::size() const { if (!ptr) - throw isl::exception::create(isl_error_invalid, - "NULL input", __FILE__, __LINE__); - options_scoped_set_on_error saved_on_error(get_ctx(), ISL_ON_ERROR_CONTINUE); + exception::throw_invalid("NULL input", __FILE__, __LINE__); + auto ctx = get_ctx(); + options_scoped_set_on_error saved_on_error(ctx, exception::on_error); auto res = isl_val_list_size(get()); return res; } diff --git a/isl_interface/include/isl/stdint.h b/isl_interface/include/isl/stdint.h new file mode 100644 index 000000000..923608de9 --- /dev/null +++ b/isl_interface/include/isl/stdint.h @@ -0,0 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## +// Mock version of isl/stdint.h for use in parsing the isl headers. +// Assume C99 and simply include stdint.h. +#include diff --git a/isl_interface/isl/stdint.h b/isl_interface/isl/stdint.h deleted file mode 100644 index 5a397d191..000000000 --- a/isl_interface/isl/stdint.h +++ /dev/null @@ -1,3 +0,0 @@ -// Mock version of isl/stdint.h for use in parsing the isl headers. -// Assume C99 and simply include stdint.h. -#include diff --git a/isl_interface/isl_config.h b/isl_interface/isl_config.h index 8c4c30a65..71655eb48 100644 --- a/isl_interface/isl_config.h +++ b/isl_interface/isl_config.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## // Mock version of isl's isl_config.h configuration file. // extract_interface.cc expects this file to contain all // the required defines, but in TC they are set using diff --git a/python/benchmarks/caffe2_benchmark.py b/python/benchmarks/caffe2_benchmark.py deleted file mode 100644 index 22593240a..000000000 --- a/python/benchmarks/caffe2_benchmark.py +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (c) 2018-present, Facebook, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## - -#!/usr/bin/env python3 - -import argparse -import numpy as np -import os -import tensor_comprehensions as tc - -from caffe2.python import core, dyndep, workspace, utils - - -CONDA_PREFIX = os.environ.get("CONDA_PREFIX") -if CONDA_PREFIX: - tc_c2_lib = os.path.join(CONDA_PREFIX, "lib/libtc_c2.so") -else: - dyndep.InitOpsLibrary("@/tc/tc:tc_c2") - -FC_LANG = """ - def func_fc(float(B,M) I, float(N,M) W1, float(N) B1) -> (O1) { - O1(b, n) +=! I(b, r_m) * W1(n, r_m) - O1(b, n) = O1(b, n) + B1(n) - } -""" - - -def GetArgumentParser(): - parser = argparse.ArgumentParser( - description="Caffe2 benchmark. Extra args will be passed to Caffe2") - parser.add_argument("--batch_size", type=int, default=32, - help="The batch size.") - parser.add_argument("--input_dim", type=int, default=512, - help="The input dense dimension.") - parser.add_argument("--output_dim", type=int, default=128, - help="The input dense dimension.") - parser.add_argument("--num_runs", type=int, default=1000, - help="how many times to run each op") - parser.add_argument("--tuner_cache_file", type=str, - default="tuner_cache", - help="File to store tuned mapping options") - parser.add_argument("--tuner_devices", type=str, - default="0", - help="String representation of gpus to use for tuning (e.g. \"0,1\")") - parser.add_argument("--tuner_threads", type=int, default=10, - help="String representation of gpus to use for tuning (e.g. \"0,1\")") - parser.add_argument("--tuner_gen_generations", type=int, default=10, - help="Number of iterations to tune") - parser.add_argument("--tuner_gen_pop_size", type=int, default=50, - help="Population size for each tuning iteration") - return parser - - -def main(): - parser = GetArgumentParser() - args, extra_args = parser.parse_known_args() - - core.GlobalInit([ - 'tc_bench', - '--caffe2_logging_operator_dyno_sampling_rate=0', - '--tuner_devices=' + args.tuner_devices, - '--caffe2_simple_net_benchmark_run_whole_net=0', - ] + extra_args) - mapping_options = tune(args) - compare_fcs( - args.batch_size, - args.input_dim, - args.output_dim, - args.num_runs, - mapping_options, - ) - - -@utils.debug -def tune(args): - fc = tc.define(FC_LANG, name="func_fc") - options = fc.autotune( - (args.batch_size, args.input_dim), - (args.output_dim, args.input_dim), - (args.output_dim,), - cache = args.tuner_cache_file, - threads = args.tuner_threads, - generations = args.tuner_gen_generations, - pop_size = args.tuner_gen_pop_size, - ) - print(options.toString()) - return options - - -@utils.debug -def compare_fcs(B, M, N, num_runs, mapping_options=None): - X = np.random.rand(B, M).astype(np.float32) - 0.5 - W = np.random.rand(N, M).astype(np.float32) - 0.5 - b = np.random.rand(N).astype(np.float32) - 0.5 - - with core.DeviceScope(core.DeviceOption(1)): - workspace.FeedBlob("X", X) - workspace.FeedBlob("W", W) - workspace.FeedBlob("b", b) - - net = core.Net("test") - - with core.DeviceScope(core.DeviceOption(1)): - net.FC(["X", "W", "b"], "Y_baseline") - net.TcOp( - ["X", "W", "b"], "Y_TC", - tc_def=FC_LANG, - tc_name="func_fc", - mapping_options=( - mapping_options.serialize() if mapping_options else None), - check_sizes=True, - ) - - workspace.CreateNet(net) - workspace.RunNet(net) - - baseline_value = workspace.blobs["Y_baseline"] - tc_value = workspace.blobs["Y_TC"] - np.testing.assert_allclose( - baseline_value, - tc_value, - rtol=1e-4, - atol=1e-4, - ) - - runtimes = workspace.BenchmarkNet( - net.Name(), - 0, # warmpup was already done - num_runs, - True, # run individual ops - )[1:] - - print(runtimes) - - -if __name__ == '__main__': - main() diff --git a/python/benchmarks/python_overhead.py b/python/benchmarks/python_overhead.py index cf354ca72..694f5fbd1 100644 --- a/python/benchmarks/python_overhead.py +++ b/python/benchmarks/python_overhead.py @@ -111,7 +111,9 @@ def matmul_bgrad(float(M,N) A, float(M,K) d_C) -> (d_B) { tuner_config) cache = MappingOptionsCache(cache_file.name) top10 = cache.load(mm, "matmul", (A, B), 10) - assert top1.__str__() == top10[0].__str__() + assert top1.__str__() == top10[0].__str__(), ( + "Expected {}\nGot {}\nTop10 are {}".format( + top1, top10[0], "\n".join(opt for opt in top10))) # Compile and run with the new options compilation_cache.compile("matmul", (A, B), top1) diff --git a/python/examples/masked_conv.py b/python/examples/masked_conv.py new file mode 100644 index 000000000..a8f4faded --- /dev/null +++ b/python/examples/masked_conv.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +import tensor_comprehensions as tc + +import argparse +import torch +import torch.nn as nn +import torch.nn.functional as functional + +torch.backends.cudnn.benchmark = True + + +def GetArgumentParser(): + parser = argparse.ArgumentParser( + description='Lengths Cosine Coherence benchmark.' + ) + parser.add_argument( + '--tuner_threads', type=int, default=16, + help='Number of CPU tuning threads.', + ) + parser.add_argument( + '--tuner_generations', type=int, default=25, + help='Number of tuning generations.', + ) + parser.add_argument( + '--tuner_pop_size', type=int, default=100, + help='Number candidates per tuning generations.', + ) + parser.add_argument( + '--tuner_number_elites', type=int, default=5, + help='Number of best tuning candidates that survive each generation.', + ) + parser.add_argument( + '--tuner_devices', type=str, default='0', + help='Comma separated list of tuning devices.', + ) + parser.add_argument( + '--tuner_cache_file', + type=str, + default='/tmp/cache_condensenet', + help='File to store tuned mapping options', + ) + return parser + + +parser = GetArgumentParser() +args, extra_args = parser.parse_known_args() + + +############################################################################### +# TC equivalent converting control-flow to data dependencies +############################################################################### +MASKED_CONVOLVE = ''' +def masked_convolve(float(B, C, H, W) Input, + float(F, C, K, K) Weights, + uint8(F, C) Mask) -> (Output) { + Output(b, f, h, w) +=! (Mask(f, r_c) == 1) ? + fmax(0.0, Input(b, r_c, h + r_k1, w + r_k2)) * + Weights(f, r_c, r_k1, r_k2) : + 0.0 +} +''' + +############################################################################### +# Implicit compilation and tuning behavior +############################################################################### +tuner_config = ( + tc.TunerConfig() + .threads(args.tuner_threads) + .generations(args.tuner_generations) + .pop_size(args.tuner_pop_size) + .number_elites(args.tuner_number_elites) + .devices(args.tuner_devices)) +reinforce_list = [''] + + +def generate_options(tc_str: str, + entry_point: str, + *inputs: torch.Tensor) -> tc.MappingOptions: + global reinforce + + # TODO: comment the line below which serves the purpose of not blowing up + # CI time + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + if entry_point == 'make_idx': + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + loaded = tc.make_load_from_cache_options_factory(args.tuner_cache_file)( + tc_str, entry_point, *inputs) + + if loaded is None or entry_point in reinforce_list or '*' in reinforce_list: + start = loaded if loaded is not None else 'naive' + return tc.make_autotuned_options_factory( + starting_options=start, + tuner_config=tuner_config, + cache_filename=args.tuner_cache_file, + store_to_cache=True,)(tc_str, entry_point, *inputs) + + assert loaded is not None, 'None found' + + return loaded + + +############################################################################### +# Define the TC for MASKED_CONVOLVE +############################################################################### +TC = tc.define(MASKED_CONVOLVE, generate_options) + +############################################################################### +# Run with implicit compilation and tuning +############################################################################### + +# sizes: +H, W, C, B, F, K = 56, 56, 128, 32, 32, 1 + +# Pytorch: +conv = nn.Conv2d(C, F, K, 1, 0, 1, groups=1, bias=False).cuda() +relu = nn.ReLU(inplace=True).cuda() +input_data = torch.zeros(B, C, H, W).cuda(non_blocking=True) +mask = torch.randn(F, C, K, K).gt_(0.).cuda(non_blocking=True) +torch.cuda.synchronize() + +weight = conv.weight * mask +rectified_input = relu(input_data) +output = functional.conv2d(rectified_input, weight, None, conv.stride, + conv.padding, conv.dilation, 1) + +# TC: +InputData = input_data +Weights = conv.weight +Mask = mask.view(F, C).byte() +torch.cuda.synchronize() +Output = TC.masked_convolve(InputData, Weights, Mask) + + +############################################################################### +# Check +############################################################################### +tc.assert_almost_equal( + output.cpu(), + Output.cpu(), + input_data.cpu(), conv.weight.cpu(), mask.cpu(), + operations=C * K * K, + precision=1e-7) + +print('SUCCESS') diff --git a/python/examples/min_distance.py b/python/examples/min_distance.py index c85639e44..7e6e59c44 100644 --- a/python/examples/min_distance.py +++ b/python/examples/min_distance.py @@ -103,9 +103,9 @@ def argmin_1d(float(N) S, int32(D) MinIdx) -> (min_idx) { T = tc.define(lang, tc.make_naive_options_factory()) S = T.reduce_codes(luts_t, codes_t) -V = T.min_2d(S.view((D, N / D))) +V = T.min_2d(S.view((D, N // D))) v = T.min_1d(V) -MinIdx = T.argmin_2d(S.view((D, N / D)), v) +MinIdx = T.argmin_2d(S.view((D, N // D)), v) min_idx = T.argmin_1d(S, MinIdx) print("minval: {} minidx: {}".format(v, min_idx)) @@ -159,8 +159,8 @@ def argmin_1d(float(K, N) S, int32(K, D) MinIdx2) -> (MinIdx) { T = tc.define(lang, tc.make_naive_options_factory()) S = T.reduce_codes(luts_t, codes_t) -V2 = T.min_2d(S.view((K, D, N / D))) +V2 = T.min_2d(S.view((K, D, N // D))) V = T.min_1d(V2) -MinIdx2 = T.argmin_2d(S.view((K, D, N / D)), V) +MinIdx2 = T.argmin_2d(S.view((K, D, N // D)), V) MinIdx = T.argmin_1d(S, MinIdx2) print("minval: {} minidx: {}".format(V, MinIdx)) diff --git a/python/examples/tum.py b/python/examples/tum.py new file mode 100644 index 000000000..e7a807bdc --- /dev/null +++ b/python/examples/tum.py @@ -0,0 +1,300 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +import tensor_comprehensions as tc + +import argparse +import numpy as np +import torch + +def GetArgumentParser(): + parser = argparse.ArgumentParser( + description='Lengths Cosine Coherence benchmark.' + ) + parser.add_argument( + '--num_segs', type=int, default=4, help='The number of segments.' + ) + parser.add_argument( + '--seg_length', type=int, default=100, help='The length of each segment.' + ) + parser.add_argument( + '--num_of_channels', type=int, default=128, help='The dimension of embeddings.' + ) + parser.add_argument( + '--pos_dist', type=int, default=0, help='The positive window size.' + ) + parser.add_argument( + '--neg_dist', type=int, default=0, help='The negative window size.' + ) + + parser.add_argument( + '--tuner_threads', type=int, default=16, help='Number of CPU tuning threads.' + ) + parser.add_argument( + '--tuner_generations', type=int, default=25, help='Number of tuning generations.' + ) + parser.add_argument( + '--tuner_pop_size', type=int, default=100, help='Number candidates per tuning generations.' + ) + parser.add_argument( + '--tuner_number_elites', type=int, default=5, help='Number of best tuning candidates that survive each generation.' + ) + parser.add_argument( + '--tuner_devices', type=str, default='0', help='Comma separated list of tuning devices.' + ) + parser.add_argument( + '--tuner_cache_file', + type=str, + default='/tmp/cache_tum', + help='File to store tuned mapping options', + ) + return parser + + +parser = GetArgumentParser() +args, extra_args = parser.parse_known_args() + +############################################################################### +# Reference python impl +############################################################################### +def reference(D, L): + R = np.zeros(shape=(L.size,), dtype=D.dtype) + Normed_DATA = D * 0 + Norm_of_Vector = np.zeros(shape=(D.shape[0],), dtype=D.dtype) + POS_C = np.zeros(shape=(L.size,), dtype=np.long) + NEG_C = np.zeros(shape=(L.size,), dtype=np.long) + line = 0 + kEps = 1e-12 + + def dot(a, b): + return np.sum(a * b) + + for i in range(D.shape[0]): + Norm_of_Vector[i] = dot(D[i], D[i]) + Normed_DATA[i] = D[i] / np.sqrt(max(Norm_of_Vector[i], kEps)) + + for g in range(L.size): + if L[g] <= 1: + line += L[g] + continue + pos_res = 0 + neg_res = 0 + for i in range(L[g] - 1): + for j in range(i + 1, L[g]): + sqrt_norm = np.sqrt( + max(Norm_of_Vector[line + i], kEps) + * max(Norm_of_Vector[line + j], kEps) + ) + if args.pos_dist == 0 or j - i <= args.pos_dist: + pos_res += dot(D[line + i], D[line + j]) / sqrt_norm + POS_C[g] += 1 + if args.neg_dist > 0 and j - i >= args.neg_dist: + neg_res += dot(D[line + i], D[line + j]) / sqrt_norm + NEG_C[g] += 1 + pos_res = 0 if POS_C[g] < 1 else pos_res / POS_C[g] + neg_res = 0 if NEG_C[g] < 1 else neg_res / NEG_C[g] + R[g] = pos_res - neg_res + line += L[g] + return [R, Normed_DATA, Norm_of_Vector, POS_C, NEG_C] + +############################################################################### +# TC equivalent converting control-flow to data dependencies +############################################################################### +LENGTHS_COSINE_COHERENCE = ''' +# TODO: this is just a scan but currently implemented as K reductions +def make_idx(int32(K) Segments) -> (Idx) { + Idx(k) +=! (r_k < k) ? Segments(r_k) : 0 where k in 0:K+1 +} +def make_alpha(int32(KP1) Idx, int32(MAX_L) SegmentsMetaData) -> (Alpha) { + # Triangular compute + Alpha(k, max_l_1, max_l_2) = (max_l_1 >= max_l_2) ? 0.0 : + # This computes an approximation using the maximal segment length + (( == 0 || fabs(float(max_l_1 - max_l_2)) <= float()) ? 1.0 : + ( == 0 && fabs(float(max_l_1 - max_l_2)) >= float()) ? -1.0 : 0.0) + * + # Filter against the true value of Idx + ((Idx(k) + max_l_1 < Idx(k + 1) && Idx(k) + max_l_2 < Idx(k + 1)) + ? 1.0 : 0.0) + where k in 0:KP1-1, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} +def make_counts(float(K, MAX_L, MAX_L) Alpha, int32(MAX_L) SegmentsMetaData) + -> (PosCount, NegCount, tmpPos, tmpNeg) +{ + # Triangular compute + # tmp is necessary for reasonable performance with the current mapper + # because we don't yet support 2-D reductions + # Note that in practice, tmp also gives strictly more parallelism and + # allows exploiting 2 levels or thread parallelism (doall and reduction) or + # (in the future when block syncrhonization is supported) 1 level of block + # parallelism without cross-block reductions. + tmpPos(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + (Alpha(k, max_l_1, r_max_l_2) > 0.0) ? 1.0 : 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, r_max_l_2 in 0:MAX_L + PosCount(k) +=! tmpPos(k, max_l_1) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L + + # Triangular compute + # tmp is necessary because we don't yet support 2-D reductions + # But in practice, tmp also gives strictly more parallelism and allows + # exploiting blocks without cross-block reductions + tmpNeg(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + (Alpha(k, max_l_1, r_max_l_2) < 0.0) ? 1.0 : 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, r_max_l_2 in 0:MAX_L + NegCount(k) +=! tmpNeg(k, max_l_1) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L +} +def make_beta(float(K, MAX_L, MAX_L) Alpha, + float(K) PosCount, + float(K) NegCount, + int32(MAX_L) SegmentsMetaData) -> (Beta) +{ + Beta(k, max_l_1, max_l_2) = (max_l_1 >= max_l_2) ? 0.0 : + (Alpha(k, max_l_1, max_l_2) == 1.0) ? 1.0 / float(PosCount(k)) : + (Alpha(k, max_l_1, max_l_2) == -1.0) ? -1.0 / float(NegCount(k)) : + 0.0 + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} + +def normalize(float(N, C) Input) -> (NormData, Square) { + Square(n) +=! Input(n, r_c) * Input(n, r_c) + NormData(n, c) = Input(n, c) / sqrt(Square(n) + 1e-12) +} +def dots(float(N, C) NormData, int32(KP1) Idx, float(K, MAX_L, MAX_L) Beta) -> (Dots) { + # Triangular compute + Dots(k, max_l_1, max_l_2) +=! (max_l_1 >= max_l_2) ? 0.0 : + # Avoid out of bounds Idx computations + ((Idx(k) + max_l_1 >= Idx(k + 1) || Idx(k) + max_l_2 >= Idx(k + 1)) ? + 0.0 : + NormData(Idx(k) + max_l_1, r_c) * NormData(Idx(k) + max_l_2, r_c)) + # TODO: annotation should not be needed + where k in 0:K, max_l_1 in 0:MAX_L, max_l_2 in 0:MAX_L +} +def result(float(K, MAX_L, MAX_L) Beta, float(K, MAX_L, MAX_L) Dots) -> (O, tmpO) { + # Triangular compute + # tmp is necessary because we don't yet support 2-D reductions + # But in practice, tmp also gives strictly more parallelism and allows + # exploiting blocks without cross-block reductions + tmpO(k, max_l_1) +=! (max_l_1 >= r_max_l_2) ? 0.0 : + Dots(k, max_l_1, r_max_l_2) * Beta(k, max_l_1, r_max_l_2) + O(k) +=! tmpO(k, max_l_1) +} +''' + +############################################################################### +# Implicit compilation and tuning behavior +############################################################################### +tuner_config = ( + tc.TunerConfig() + .threads(args.tuner_threads) + .generations(args.tuner_generations) + .pop_size(args.tuner_pop_size) + .number_elites(args.tuner_number_elites) + .devices(args.tuner_devices)) + +# This function is used for reinforcing tuning +# 1. make_idx is small and does not get tuned or saved, just using naive +# options on it is fine; +# 2. if we find an option in the cache, use it either as is or as starting +# point for reinforcement, depending on whether the entry_point is in the +# reinforcement list; +# 3. dots will benefit from being reinforced a few times (reaching 90us on P100) +reinforce_list = [''] +def generate_options(tc_str: str, + entry_point: str, + *inputs: torch.Tensor) -> tc.MappingOptions: + global reinforce + + # TODO: comment the line below which serves the purpose of not blowing up + # CI time + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + if entry_point == 'make_idx': + return tc.make_naive_options_factory()(tc_str, entry_point, *inputs) + + loaded = tc.make_load_from_cache_options_factory(args.tuner_cache_file)( + tc_str, entry_point, *inputs) + + if loaded is None or entry_point in reinforce_list or '*' in reinforce_list: + start = loaded if loaded is not None else 'naive' + return tc.make_autotuned_options_factory( + starting_options=start, + tuner_config=tuner_config, + cache_filename=args.tuner_cache_file, + store_to_cache=True,)(tc_str, entry_point, *inputs) + + assert loaded is not None, 'None found' + + return loaded + + +############################################################################### +# Define the TC for LENGTHS_COSINE_COHERENCE, use +############################################################################### +TC = tc.define( + (LENGTHS_COSINE_COHERENCE + .replace('', str(args.pos_dist)) + .replace('', str(args.neg_dist))), + generate_options, +) + +############################################################################### +# Run with implicit compilation and tuning +############################################################################### +# Input(N x C) random floats is partitioned into K buckets each of length L(K) +# We then sum within each bucket (with a positive-pair / negative-pair twist) +# This first impl uses the max bucket length and makes the computation dense +InputData = torch.randn( + args.num_segs * args.seg_length, args.num_of_channels, device='cuda') +# Assume all segments of same length for now +Segments = torch.ones(args.num_segs, dtype=torch.int, device='cuda').fill_(args.seg_length) + +Idx = TC.make_idx(Segments) +SegmentsMetaData = torch.ones((torch.max(Segments)[0],), dtype=torch.int, device='cuda') +Alpha = TC.make_alpha(Idx, SegmentsMetaData) +PosCount, NegCount, _1, _2 = TC.make_counts(Alpha, SegmentsMetaData) +Beta = TC.make_beta(Alpha, PosCount, NegCount, SegmentsMetaData) +NormData, Square = TC.normalize(InputData) +Dots = TC.dots(NormData, Idx, Beta) +Output, _ = TC.result(Beta, Dots) + +R, Normed_DATA, Norm_of_Vector, POS_C, NEG_C = ( + reference(InputData.cpu().numpy(), Segments.cpu().numpy())) + +############################################################################### +# Check +############################################################################### +tc.assert_almost_equal( + PosCount.cpu(), + torch.from_numpy(POS_C).float(), + torch.from_numpy(POS_C).float(), + precision=0) +tc.assert_almost_equal( + NegCount.cpu(), + torch.from_numpy(NEG_C).float(), + torch.from_numpy(NEG_C).float(), + precision=0) +tc.assert_almost_equal( + Output.cpu(), + torch.from_numpy(R), + Dots.cpu(), + Beta.cpu(), + operations=SegmentsMetaData.size(0) * (SegmentsMetaData.size(0) + 1) // 2, +) + +print('SUCCESS, maxdiff={}'.format((Output.cpu() - torch.from_numpy(R)).abs().max())) diff --git a/python/tests/test_caffe2.py b/python/tests/test_caffe2.py index 61eda3428..ad26ead5f 100644 --- a/python/tests/test_caffe2.py +++ b/python/tests/test_caffe2.py @@ -18,6 +18,7 @@ import hypothesis.strategies as st import caffe2.python.hypothesis_test_util as hu import tensor_comprehensions as tc +import torch from hypothesis import given, settings from caffe2.python import core, dyndep @@ -33,9 +34,6 @@ def matmul(float(M,N) A, float(N,K) B) -> (output) { output(m, k) +=! A(m, r_n) * B(r_n, k) } -""" - -MATMUL_GRAD_LANG = """ def matmul_grad(float(M, N) A, float(N, K) B, float(M, K) d_O) -> (d_A, d_B) { d_A(m, n) +=! d_O(m, r_k) * B(n, r_k) d_B(n, k) +=! d_O(r_m, k) * A(r_m, n) @@ -61,7 +59,7 @@ def ref(X, W): "TcOp", ["X", "Y"], "out", tc_def=MATMUL_LANG, tc_name="matmul", - tc_grad_def=MATMUL_GRAD_LANG, + tc_grad_def=MATMUL_LANG, tc_grad_name="matmul_grad", inputs_used_by_gradient=[0, 1], output_gradients_used_by_gradient=[0], @@ -91,24 +89,23 @@ def ref(X, W): **hu.gcs_gpu_only) @settings(max_examples=2) def test_matmul_tune_and_run(self, n, m, k, seed, gc, dc): - matmul = tc.define(MATMUL_LANG, name="matmul") - matmul_grad = tc.define(MATMUL_GRAD_LANG, name="matmul_grad") - - mapping_options = matmul.autotune( - (n, k), (k, m), - generations=3, - threads=32, - pop_size=2, - tuner_min_launch_total_threads=1, - ) - - grad_mapping_options = matmul_grad.autotune( - (n, k), (k, m), (n, m), - generations=1, - threads=32, - pop_size=2, - tuner_min_launch_total_threads=1, - ) + tuner = tc.Tuner(MATMUL_LANG) + tuner_config = ( + tc.TunerConfig().generations(3).threads(32).pop_size(2) + .tuner_min_launch_total_threads(1)) + matmul_top1 = tuner.tune( + 'matmul', + (torch.randn(n, k, device='cuda'), + torch.randn(k, m, device='cuda')), + tc.MappingOptions('naive'), + tuner_config) + matmul_grad_top1 = tuner.tune( + 'matmul_grad', + (torch.randn(n, k, device='cuda'), + torch.randn(k, m, device='cuda'), + torch.randn(n, m, device='cuda')), + tc.MappingOptions('naive'), + tuner_config) X = np.random.rand(m, k).astype(np.float32) W = np.random.rand(k, n).astype(np.float32) @@ -120,13 +117,13 @@ def ref(X, W): "TcOp", ["X", "Y"], "out", tc_def=MATMUL_LANG, tc_name="matmul", - tc_grad_def=MATMUL_GRAD_LANG, + tc_grad_def=MATMUL_LANG, tc_grad_name="matmul_grad", inputs_used_by_gradient=[0, 1], output_gradients_used_by_gradient=[0], inputs_to_compute_gradients_of=[0, 1], - mapping_options=mapping_options.serialize(), - grad_mapping_options=grad_mapping_options.serialize(), + mapping_options=matmul_top1.serialize(), + grad_mapping_options=matmul_grad_top1.serialize(), ) self.assertReferenceChecks( diff --git a/python/tests/test_tc.py b/python/tests/test_tc.py index 3633f60d6..0fd546f00 100644 --- a/python/tests/test_tc.py +++ b/python/tests/test_tc.py @@ -59,7 +59,7 @@ def test_mapping_options(self): .outerScheduleFusionStrategy("Preserve3Coincident")) # - # Simple TC example with explicit 'naive' compilation + # Simple TC example with explicit 'naive' compilation with nvrtc (default) # def test_tc(self): A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') @@ -72,6 +72,40 @@ def test_tc(self): C = add(A, B) tc.assert_almost_equal(C, torch.add(A, B), A, B) + # + # Simple TC example with explicit 'naive' compilation with llvm + # + def test_tc_llvm(self): + A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') + tc.cuda_compiler('llvm') + add = tc.compile( + "def add(float(N) A, float(N) B) -> (C) { C(i) = A(i) + B(i) }", + "add", + 'naive', + A, B, + ) + # Reset the cuda compiler back to nvrtc + tc.cuda_compiler('nvrtc') + C = add(A, B) + tc.assert_almost_equal(C, torch.add(A, B), A, B) + + # + # Simple TC example with explicit 'naive' compilation with nvcc + # + def test_tc_nvcc(self): + A, B = torch.randn(100, device='cuda'), torch.randn(100, device='cuda') + tc.cuda_compiler('nvcc') + add = tc.compile( + "def add(float(N) A, float(N) B) -> (C) { C(i) = A(i) + B(i) }", + "add", + 'naive', + A, B, + ) + # Reset the cuda compiler back to nvrtc + tc.cuda_compiler('nvrtc') + C = add(A, B) + tc.assert_almost_equal(C, torch.add(A, B), A, B) + # # Simple TC example without fallback but with tuning starting from # MappingOptions('naive') diff --git a/setup.py b/setup.py index 4150a94c2..8d579c957 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## from setuptools import setup, Extension, distutils, Command, find_packages import setuptools.command.install import setuptools.command.develop diff --git a/tc/aten/aten_autotuner-inl.h b/tc/aten/aten_autotuner-inl.h index 65dd55a8d..76e46097b 100644 --- a/tc/aten/aten_autotuner-inl.h +++ b/tc/aten/aten_autotuner-inl.h @@ -53,6 +53,7 @@ ATenAutotuner::tune( const std::string& tcName, const std::vector& inputs, const std::vector& baseMappings, + size_t topK, const tc::autotune::TuningParameterFixer& fixedParams) { // TODO: some checks that inputs memory lives on the proper Backend device @@ -91,6 +92,7 @@ ATenAutotuner::tune( rawInputsPerDevice, rawOutputsPerDevice, baseMappings, + topK, fixedParams); } } // namespace aten diff --git a/tc/aten/aten_autotuner.h b/tc/aten/aten_autotuner.h index d3c8e39f3..d586c3888 100644 --- a/tc/aten/aten_autotuner.h +++ b/tc/aten/aten_autotuner.h @@ -80,6 +80,7 @@ class ATenAutotuner : public tc::autotune::Autotuner { const std::string& tcEntryPoint, const std::vector& inputs, const std::vector& baseMappings, + size_t topK = 1, const tc::autotune::TuningParameterFixer& fixedParams = {}); protected: diff --git a/tc/aten/aten_compiler-inl.h b/tc/aten/aten_compiler-inl.h index 8f64dec12..5817dc1e2 100644 --- a/tc/aten/aten_compiler-inl.h +++ b/tc/aten/aten_compiler-inl.h @@ -32,10 +32,11 @@ std::unique_ptr compile( const std::string& tc, const std::string& entryPoint, const std::vector& inputs, - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { auto inputDLTensors = makeDLConstTensors(inputs); return tc::compile( - tc, entryPoint, extractRawPtrs(inputDLTensors), options); + tc, entryPoint, extractRawPtrs(inputDLTensors), options, compilerOptions); } template diff --git a/tc/aten/aten_compiler.h b/tc/aten/aten_compiler.h index 724fb8b28..626384eda 100644 --- a/tc/aten/aten_compiler.h +++ b/tc/aten/aten_compiler.h @@ -22,6 +22,7 @@ #include "tc/aten/aten.h" #include "tc/core/tensor.h" #include "tc/core/utils/time.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace aten { @@ -57,7 +58,8 @@ std::unique_ptr compile( const std::string& tc, const std::string& entryPoint, const std::vector& inputs, - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given an executor resulting from compiling a TC, run the TC and fill the /// outputs vector with the results. The output vector must have as many diff --git a/tc/autotuner/autotuner-inl.h b/tc/autotuner/autotuner-inl.h index 875aafbdc..816cfee5f 100644 --- a/tc/autotuner/autotuner-inl.h +++ b/tc/autotuner/autotuner-inl.h @@ -15,6 +15,7 @@ */ #include #include +#include #include #include @@ -28,6 +29,7 @@ #include "tc/core/tensor.h" #include "tc/core/utils/math.h" #include "tc/lang/canonicalize.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace autotune { @@ -48,8 +50,6 @@ TuningHarness::TuningHarness( baseMapping_(baseMapping), inputs_(inputs), outputs_(outputs), - bestTime_(Duration::max()), - bestMappingOptions_(baseMapping), optionsCache_(optionsCache) {} template @@ -67,13 +67,6 @@ void TuningHarness::stopAfterCurrentIteration() { stopRequested_ = true; } -template -const typename Backend::MappingOptionsType& -TuningHarness::bestMappingOptions() const { - std::lock_guard lock(bestTimeMutex_); - return bestMappingOptions_; -} - #define LOG_LINE_BY_LINE(GSTREAM, ISTREAM) \ for (std::string line; std::getline(ISTREAM, line);) { \ LOG(GSTREAM) << line; \ @@ -82,6 +75,9 @@ TuningHarness::bestMappingOptions() const { template template void TuningHarness::doCompile(SearchStrategy& searchStrategy) { + CompilerOptions supressWarningsOptions; + supressWarningsOptions.emitWarnings = false; + // Atomically fetch and add the next job until there are no jobs left while (true) { auto current = currentCompilationJob_.fetch_add(1); @@ -100,8 +96,8 @@ void TuningHarness::doCompile(SearchStrategy& searchStrategy) { LOG(INFO) << "[COMPILE] Start compilation @:" << current; LOG_LINE_BY_LINE(INFO, ssInfo); } - pExecutor = - tc::compile(tcTree_, inputs_.begin()->second, options); + pExecutor = tc::detail::compile( + tcTree_, inputs_.begin()->second, options, supressWarningsOptions); LOG_IF(INFO, FLAGS_debug_tuner) << "[COMPILE] Done compilation"; } catch (const std::exception& e) { LOG(WARNING) << "[TUNER][COMPILE] failed compilation: " << e.what(); @@ -180,11 +176,14 @@ void TuningHarness::doEvaluate( std::vector runtimes{Duration::max()}; try { - Duration bestTimeSoFar(Duration::max()); - { - std::lock_guard lock(bestTimeMutex_); - bestTimeSoFar = bestTime_; - } + auto vBest = optionsCache_->getTopKEntries( + lang::canonicalTc(tcTree_), + makeTensorInfoVector(inputs), + makeTensorInfoVector(outputs), + Backend::backendString(), + 1); + Duration bestTimeSoFar = + (vBest.size() > 0) ? vBest[0].second : Duration::max(); auto prune = detail::skipExecutionOrWarmup( *pExecutor, outputs, inputs, bestTimeSoFar); if (prune) { @@ -234,15 +233,6 @@ void TuningHarness::doEvaluate( Backend::backendString(), options, prof); - - // Save best time under lock - { - std::lock_guard lock(bestTimeMutex_); - if (prof < bestTime_) { - bestTime_ = prof; - bestMappingOptions_ = options; - } - } } // end while } @@ -310,7 +300,14 @@ void TuningHarness::runOneIteration( LOG(INFO) << "[TUNER][ITERATION LOG] best option so far:"; std::stringstream ssInfo; typename Backend::MappingOptionsCppPrinter infoPrinter(ssInfo); - infoPrinter << bestMappingOptions(); + auto vBest = optionsCache_->getTopKOptions( + lang::canonicalTc(tcTree_), + makeTensorInfoVector(inputs_.begin()->second), + makeTensorInfoVector(outputs_.begin()->second), + Backend::backendString(), + 1); + TC_CHECK_GT(vBest.size(), 0u); + infoPrinter << vBest[0]; LOG_LINE_BY_LINE(INFO, ssInfo); } searchStrategy.updateParameters(); @@ -356,10 +353,12 @@ size_t largestDim(const std::vector& inputs) { return (*maxElement)->ndim; } -// Creates well-chosen parameter sizes to match the input shapes. -void setupTuningParameters( +// Creates well-chosen generic parameter sizes to match the input shapes. +template +inline std::pair> +setupGenericTuningParametersAndGetRange( const std::vector& inputs, - TuningConfiguration& configuration) { + const std::vector& baseMappings) { TC_CHECK_GE(inputs.size(), 1u); auto range = inputDivisorsAndPowers2(inputs); // 0 is a valid tiling annotation and signals no tiling of that dimension @@ -367,13 +366,48 @@ void setupTuningParameters( auto nTilesDim = largestDim(inputs) + 1; auto tileRange = range; tileRange.push_back(0); + + TuningConfiguration configuration; configuration.tilingParams.setRange(nTilesDim, tileRange); - configuration.blockParams.setRange(range, "b"); - configuration.gridParams.setRange(range, "g"); configuration.unrollFactor = RangeParameter(powers2(FLAGS_tuner_max_unroll_size), "unroll"); + + return {configuration, range}; +} + +// Creates well-chosen parameter sizes to match the input shapes. +inline TuningConfiguration setupTuningParameters( + const std::vector& inputs, + const std::vector& baseMappings) { + std::vector range; + TuningConfiguration configuration; + std::tie(configuration, range) = + setupGenericTuningParametersAndGetRange(inputs, baseMappings); + auto blockRange = range; + auto gridRange = range; + + for (const auto& baseMapping : baseMappings) { + blockRange = + mergeVectors(std::move(blockRange), baseMapping.block.extractVector()); + gridRange = + mergeVectors(std::move(gridRange), baseMapping.grid.extractVector()); + } + + configuration.blockParams.setRange(blockRange, "b"); + configuration.gridParams.setRange(gridRange, "g"); configuration.privateDepth = RangeParameter({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "pdepth"); + configuration.sharedDepth = + RangeParameter({0, 1, 2, 3, 4, 5, 6, 7}, "sdepth"); + + return configuration; +} + +// Creates well-chosen parameter sizes to match the input shapes. +inline TuningConfiguration setupTuningParameters( + const std::vector& inputs, + const std::vector& baseMappings) { + return setupGenericTuningParametersAndGetRange(inputs, baseMappings).first; } } // namespace @@ -389,15 +423,16 @@ Autotuner::tune( const std::unordered_map>& inputs, std::unordered_map>& outputs, const std::vector& baseMappings, + size_t topK, const TuningParameterFixer& fixedParams) { std::map tcEntryPointMap(tc::detail::parse(tc)); TC_CHECK_EQ(tcEntryPointMap.count(tcEntryPoint), 1u) << "Error looking up " << tcEntryPoint; // Initialize a model configuration - TuningConfiguration modelConfiguration; TC_CHECK_GE(inputs.size(), 1u); - setupTuningParameters(inputs.begin()->second, modelConfiguration); + auto modelConfiguration = + setupTuningParameters(inputs.begin()->second, baseMappings); modelConfiguration.fixParameters(fixedParams); // Create initial configs based on options + model configuration @@ -474,7 +509,12 @@ Autotuner::tune( std::rethrow_exception(tuningHarnessThreadEx); } - return {tuningHarness.bestMappingOptions()}; + return optionsCache->getTopKOptions( + lang::canonicalTc(tcEntryPointMap.at(tcEntryPoint)), + makeTensorInfoVector(inputs.begin()->second), + makeTensorInfoVector(outputs.begin()->second), + Backend::backendString(), + topK); } } // namespace autotune } // namespace tc diff --git a/tc/autotuner/autotuner.h b/tc/autotuner/autotuner.h index 056bfb325..c7d610d75 100644 --- a/tc/autotuner/autotuner.h +++ b/tc/autotuner/autotuner.h @@ -67,9 +67,6 @@ class TuningHarness { /// TODO: we should detect when we come from python and exit properly in C++. void stopAfterCurrentIteration(); - /// Under lock, returns the best mapping options found so far - const MappingOptionsType& bestMappingOptions() const; - private: /// Traverse one iteration of candidates in parallel and evaluate their /// runtimes @@ -92,7 +89,6 @@ class TuningHarness { /// This way it is easy to implement multi-threaded termination by just /// taking an atomic counter and pushing/popping the queues under lock until /// we have evaluated searchStrategy->population.size() compilation results. - mutable std::mutex bestTimeMutex_; std::mutex executorsMutex_; std::atomic_bool stopRequested_; std::atomic_size_t currentCompilationJob_; @@ -112,10 +108,6 @@ class TuningHarness { const std::unordered_map> inputs_; std::unordered_map> outputs_; - // results - Duration bestTime_; - MappingOptionsType bestMappingOptions_; - // backing options cache std::shared_ptr> optionsCache_; }; @@ -165,6 +157,7 @@ class Autotuner { inputs, std::unordered_map>& outputs, const std::vector& baseMapping, + size_t topK = 1, const TuningParameterFixer& fixedParams = TuningParameterFixer()); public: diff --git a/tc/autotuner/options_cache-inl.h b/tc/autotuner/options_cache-inl.h index 7ef3ffee9..e1ee14d28 100644 --- a/tc/autotuner/options_cache-inl.h +++ b/tc/autotuner/options_cache-inl.h @@ -28,6 +28,7 @@ #include "tc/core/check.h" #include "tc/core/compiler.h" +#include "tc/core/functional.h" #include "tc/core/tensor.h" #include "tc/core/utils/math.h" #include "tc/core/utils/time.h" @@ -235,8 +236,8 @@ std::vector> sortedOptions( } // namespace detail template -std::vector -OptionsCache::getTopKOptions( +std::vector> +OptionsCache::getTopKEntries( const lang::CanonicalTcString& tc, const std::vector& inputs, const std::vector& outputs, @@ -249,15 +250,32 @@ OptionsCache::getTopKOptions( if (sorted.size() == 0u) { return {}; } - std::vector res; - res.reserve(K); + std::vector> res; + res.reserve(std::min(K, sorted.size())); for (size_t i = 0; i < std::min(K, sorted.size()); ++i) { - res.push_back(sorted[i].mappingOptions); + res.push_back(std::make_pair(sorted[i].mappingOptions, sorted[i].median)); } ++numberSuccessfulRetrievals; return res; } +template +std::vector +OptionsCache::getTopKOptions( + const lang::CanonicalTcString& tc, + const std::vector& inputs, + const std::vector& outputs, + const std::string& backendStr, + size_t K) const { + auto vBest = getTopKEntries(tc, inputs, outputs, backendStr, K); + using ReturnType = typename Backend::MappingOptionsType; + using ValueType = typename decltype(vBest)::value_type; + std::function map = [](ValueType in) { + return in.first; + }; + return tc::functional::Map(map, vBest); +} + template std::unordered_set OptionsCache::getKeys() const { diff --git a/tc/autotuner/options_cache.h b/tc/autotuner/options_cache.h index 7bf061d8d..e4f6eeaee 100644 --- a/tc/autotuner/options_cache.h +++ b/tc/autotuner/options_cache.h @@ -132,6 +132,19 @@ struct OptionsCache { /// particular TC/inputs/outputs/device. Note that the result may be empty /// (in particular if problem size is small and pruning threshold is too high /// for the problem size). + /// \returns a vector of pair + std::vector> + getTopKEntries( + const lang::CanonicalTcString& tc, + const std::vector& inputs, + const std::vector& outputs, + const std::string& backendStr, + size_t K) const; + + /// Returns the top-K mapping options that have the best median runtime for a + /// particular TC/inputs/outputs/device. Note that the result may be empty + /// (in particular if problem size is small and pruning threshold is too high + /// for the problem size). /// \returns a vector of mapping options std::vector getTopKOptions( const lang::CanonicalTcString& tc, diff --git a/tc/autotuner/parameters.cc b/tc/autotuner/parameters.cc index b44dbf757..dca35cc50 100644 --- a/tc/autotuner/parameters.cc +++ b/tc/autotuner/parameters.cc @@ -240,6 +240,7 @@ void TuningConfiguration::applyToParameters( useReadOnlyCache.apply(f); matchLibraryCalls.apply(f); privateDepth.apply(f); + sharedDepth.apply(f); } bool TuningConfiguration::isValid() const { @@ -275,6 +276,7 @@ std::vector TuningConfiguration::collectParameters() { params.emplace_back(useReadOnlyCache); params.emplace_back(matchLibraryCalls); params.emplace_back(privateDepth); + params.emplace_back(sharedDepth); return params; } @@ -306,6 +308,7 @@ void TuningConfiguration::fromCudaMappingOptions( unrollCopyShared.selectValue(options.proto().unroll_copy_shared()); useReadOnlyCache.selectValue(options.proto().use_readonly_cache()); privateDepth.selectFromValue(options.proto().private_depth()); + sharedDepth.selectFromValue(options.proto().shared_depth()); } void TuningConfiguration::fromCpuMappingOptions( @@ -335,6 +338,7 @@ void TuningConfiguration::applyToCudaMappingOptions( options.unrollCopyShared(unrollCopyShared.value()); options.useReadOnlyCache(useReadOnlyCache.value()); options.privateDepth(privateDepth.value()); + options.sharedDepth(sharedDepth.value()); } void TuningConfiguration::applyToCpuMappingOptions( diff --git a/tc/autotuner/parameters.h b/tc/autotuner/parameters.h index e08133b44..ad080a3a1 100644 --- a/tc/autotuner/parameters.h +++ b/tc/autotuner/parameters.h @@ -191,6 +191,7 @@ class TuningConfiguration { BoolParameter useReadOnlyCache; BoolParameter matchLibraryCalls; RangeParameter privateDepth; + RangeParameter sharedDepth; private: std::vector> validators_; @@ -229,6 +230,7 @@ class TuningParameterFixer { llvm::Optional useReadOnlyCache; llvm::Optional matchLibraryCalls; llvm::Optional privateDepth; + llvm::Optional sharedDepth; friend class TuningConfiguration; }; diff --git a/tc/benchmarks/benchmark_fixture.h b/tc/benchmarks/benchmark_fixture.h index 3bf0997c1..36a4f19db 100644 --- a/tc/benchmarks/benchmark_fixture.h +++ b/tc/benchmarks/benchmark_fixture.h @@ -188,7 +188,7 @@ struct Benchmark : public ::testing::Test { geneticAutotuneATen(tc); auto bestOptions = [&]() { auto options = geneticAutotuneATen.tune( - kernelName, inputs, {baseMapping}, fixedParams); + kernelName, inputs, {baseMapping}, 1, fixedParams); TC_CHECK_GE(options.size(), 1u) << "Benchmark mode: at least one " << "options expected"; return options[0]; diff --git a/tc/benchmarks/scripts/8.0.sh b/tc/benchmarks/scripts/8.0.sh index 369a01c6f..625bbe255 100755 --- a/tc/benchmarks/scripts/8.0.sh +++ b/tc/benchmarks/scripts/8.0.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash module avail diff --git a/tc/benchmarks/scripts/9.0.sh b/tc/benchmarks/scripts/9.0.sh index 340f51acc..6b253aa36 100755 --- a/tc/benchmarks/scripts/9.0.sh +++ b/tc/benchmarks/scripts/9.0.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash module avail diff --git a/tc/benchmarks/scripts/autotuner_parallel.sh b/tc/benchmarks/scripts/autotuner_parallel.sh index 07b351a2b..c34965933 100755 --- a/tc/benchmarks/scripts/autotuner_parallel.sh +++ b/tc/benchmarks/scripts/autotuner_parallel.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #!/bin/sh #SBATCH -J TensorComprehensions # A single job name for the array diff --git a/tc/benchmarks/scripts/report.sh b/tc/benchmarks/scripts/report.sh index 00863f111..5d4f3a00e 100755 --- a/tc/benchmarks/scripts/report.sh +++ b/tc/benchmarks/scripts/report.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash [ -z "$BACKEND" ] && echo "Need to set BACKEND (P100 or V100)" && exit 1; diff --git a/tc/core/CMakeLists.txt b/tc/core/CMakeLists.txt index d4e47ddee..504dea4e6 100644 --- a/tc/core/CMakeLists.txt +++ b/tc/core/CMakeLists.txt @@ -34,6 +34,7 @@ add_library( polyhedral/scop.cc polyhedral/separation.cc polyhedral/unroll.cc + polyhedral/utils.cc ) target_include_directories(tc_core PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( @@ -43,9 +44,9 @@ target_link_libraries( glog ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM + tc_isl tc_lang tc_version tc_proto @@ -76,13 +77,13 @@ add_library( polyhedral/codegen_llvm.cc polyhedral/llvm_jit.cc + polyhedral/cpu/mapped_scop.cc ) target_include_directories(tc_core_cpu PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( tc_core_cpu ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM tc_lang @@ -120,16 +121,15 @@ add_library( ${TC_CUDA_CROSS_COMPILE_FILES} ) -# Unsets CUDA_HOME to compile without SDK +# Sets NO_CUDA_SDK to compile without SDK set_target_properties(tc_core_cuda_no_sdk PROPERTIES COMPILE_FLAGS - "${CMAKE_CXX_FLAGS} -UCUDA_HOME -Wl,--no-undefined") + "${CMAKE_CXX_FLAGS} -DNO_CUDA_SDK") target_include_directories(tc_core_cuda_no_sdk PUBLIC ${LLVM_INCLUDE_DIRS}) target_link_libraries( tc_core_cuda_no_sdk ${HALIDE_LIBRARIES} - ${ISL_LIBRARIES} -lLLVM tc_lang @@ -174,7 +174,6 @@ if (WITH_CUDA) ${CUDA_curand_LIBRARY} ${CUDA_LIBRARIES} ${CUDA_NVRTC_LIBRARIES} - ${ISL_LIBRARIES} tc_lang tc_version diff --git a/tc/core/check.h b/tc/core/check.h index e9f54ae19..90b7243b8 100644 --- a/tc/core/check.h +++ b/tc/core/check.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## #pragma once #include diff --git a/tc/core/compiler-inl.h b/tc/core/compiler-inl.h index 40dd53e2f..1ffbafc2b 100644 --- a/tc/core/compiler-inl.h +++ b/tc/core/compiler-inl.h @@ -37,25 +37,30 @@ std::unique_ptr compile( const std::string& entryPoint, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { auto parsedTcs = detail::parse(tc); TC_CHECK_EQ(parsedTcs.count(entryPoint), 1u) << "attempting to access undefined function " << entryPoint; - return compile(parsedTcs[entryPoint], inputs, options); + return detail::compile( + parsedTcs[entryPoint], inputs, options, compilerOptions); } +namespace detail { template std::unique_ptr compile( lang::TreeRef tcDefinition, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options) { + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions) { using CompilationResultType = typename Backend::CompilationResultType; auto inputsInfo = makeTensorInfoVector(inputs); - auto outputsInfo = detail::inferOutputTensorInfo(tcDefinition, inputs); - auto halideComponents = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tcDefinition); + auto outputsInfo = + detail::inferOutputTensorInfo(tcDefinition, inputs, compilerOptions); + auto halideComponents = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tcDefinition, compilerOptions); detail::checkInputsCompliant(halideComponents, inputs); auto tcName = lang::Def(tcDefinition).name().name(); @@ -69,4 +74,5 @@ std::unique_ptr compile( new typename Backend::ExecutorType( inputsInfo, outputsInfo, halideComponents, compilationResult)); } +} // namespace detail } // namespace tc diff --git a/tc/core/compiler.cc b/tc/core/compiler.cc index 2e9a3e868..bade3a1e3 100644 --- a/tc/core/compiler.cc +++ b/tc/core/compiler.cc @@ -24,16 +24,19 @@ #include "tc/core/halide_utils.h" #include "tc/core/tensor.h" #include "tc/lang/canonicalize.h" +#include "tc/utils/compiler_options.h" namespace tc { std::vector inferOutputTensorInfo( const std::string& tc, const std::string& entryPoint, - const std::vector inputs) { + const std::vector inputs, + const CompilerOptions& compilerOptions) { auto parsedTcs = detail::parse(tc); TC_CHECK_EQ(parsedTcs.count(entryPoint), 1u) << "attempting to access undefined function " << entryPoint; - return tc::detail::inferOutputTensorInfo(parsedTcs[entryPoint], inputs); + return tc::detail::inferOutputTensorInfo( + parsedTcs[entryPoint], inputs, compilerOptions); } namespace detail { @@ -101,9 +104,11 @@ void checkInputsCompliant( std::vector inferOutputTensorInfo( lang::TreeRef tcDefinition, - const std::vector inputs) { + const std::vector inputs, + const CompilerOptions& compilerOptions) { return tc::inferOutputTensorInfo( - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tcDefinition), + tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tcDefinition, compilerOptions), inputs); } diff --git a/tc/core/compiler.h b/tc/core/compiler.h index 8b9619b07..2696f7d31 100644 --- a/tc/core/compiler.h +++ b/tc/core/compiler.h @@ -22,6 +22,7 @@ #include "tc/core/mapping_options.h" #include "tc/core/tensor.h" #include "tc/lang/tree.h" +#include "tc/utils/compiler_options.h" /** * This provides a simple functional-style C++ API with multi-backend @@ -62,8 +63,9 @@ namespace tc { /// "entryPoint", this function compiles a new TcExecutor for the specified /// Backend. For now, contiguous output sizes are inferred given input sizes. /// If you need another kernel for another entryPoint or other inputs or -// other options then just compile another TcExecutor; because atm we fully -/// JIT specialize on all sizes. +/// other options then just compile another TcExecutor; because atm we fully +/// JIT specialize on all sizes. General compilation options (warnings, debug +/// info) are provided in "compilerOptions". /// \returns a new TcExecutor on which the run method can be called to run /// entryPoint template @@ -72,7 +74,8 @@ std::unique_ptr compile( const std::string& entryPoint, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given a TC representation as a TC + TC function name entryPoint and a list /// of input tensors that match the definition in the TC function definition @@ -85,7 +88,8 @@ std::unique_ptr compile( std::vector inferOutputTensorInfo( const std::string& tc, const std::string& entryPoint, - const std::vector inputs); + const std::vector inputs, + const CompilerOptions& compilerOptions = CompilerOptions()); namespace detail { /// Given a TC representation, this parses the TC functions into a map of @@ -105,7 +109,8 @@ std::unique_ptr compile( lang::TreeRef tcDefinition, const std::vector& inputs, /* TODO: in the future also pass outputs for stride and alignment info */ - const typename Backend::MappingOptionsType& options); + const typename Backend::MappingOptionsType& options, + const CompilerOptions& compilerOptions = CompilerOptions()); /// Given a TC representation as a TreeRef and a list of input tensors that /// match the definition in the TC function definition (in positional order), @@ -116,7 +121,8 @@ std::unique_ptr compile( /// performing output shape validation. std::vector inferOutputTensorInfo( lang::TreeRef tcDefinition, - const std::vector inputs); + const std::vector inputs, + const CompilerOptions& compilerOptions = CompilerOptions()); } // namespace detail } // namespace tc diff --git a/tc/core/cuda/cuda.h b/tc/core/cuda/cuda.h index 70406f6a4..a9fe1383a 100644 --- a/tc/core/cuda/cuda.h +++ b/tc/core/cuda/cuda.h @@ -15,13 +15,15 @@ */ #pragma once -#ifndef CUDA_HOME -#error "CUDA_HOME must be defined" -#endif // CUDA_HOME +#include "tc/tc_config.h" -#ifndef CUB_HOME -#error "CUB_HOME must be defined" -#endif // CUB_HOME +#ifndef TC_CUDA_INCLUDE_DIR +#error "TC_CUDA_INCLUDE_DIR must be defined" +#endif // TC_CUDA_INCLUDE_DIR + +#ifndef TC_CUB_INCLUDE_DIR +#error "TC_CUB_INCLUDE_DIR must be defined" +#endif // TC_CUB_INCLUDE_DIR #include #include diff --git a/tc/core/cuda/cuda_libraries.h b/tc/core/cuda/cuda_libraries.h index c2fdb1de8..217d275f9 100644 --- a/tc/core/cuda/cuda_libraries.h +++ b/tc/core/cuda/cuda_libraries.h @@ -31,22 +31,11 @@ namespace code { namespace c { constexpr auto types = R"C( +#ifndef __CUDACC_RTC__ // Can't include system dependencies with NVRTC // Can't include cuda_fp16.h with NVRTC due to transitive system dependencies -// #include - -// Halide type handling -typedef char int8; -typedef short int16; -typedef int int32; -typedef long int64; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned long uint64; -// typedef half float16; -typedef float float32; -typedef double float64; +#include +#endif )C"; constexpr auto defines = R"C( @@ -56,103 +45,14 @@ constexpr auto defines = R"C( constexpr auto warpSyncFunctions = R"C( // Before CUDA 9, syncwarp is a noop since warps are always synchronized. -#if __CUDACC_VER_MAJOR__ < 9 -__device__ void __syncwarp(unsigned mask = 0xFFFFFFFF) {} +#if (!defined(__clang__) && __CUDACC_VER_MAJOR__ < 9) || \ + ( defined(__clang__) && CUDA_VERSION < 9000) +inline __device__ void __syncwarp(unsigned mask = 0xFFFFFFFF) {} #endif )C"; constexpr auto mathFunctionDecl = R"C( - -// BEGIN MATH FUNCTIONS FROM CUDA -float acosf ( float x ); -float acoshf ( float x ); -float asinf ( float x ); -float asinhf ( float x ); -float atan2f ( float y, float x ); -float atanf ( float x ); -float atanhf ( float x ); -float cbrtf ( float x ); -float ceilf ( float x ); -float copysignf ( float x, float y ); -float cosf ( float x ); -float coshf ( float x ); -float cospif ( float x ); -float cyl_bessel_i0f ( float x ); -float cyl_bessel_i1f ( float x ); -float erfcf ( float x ); -float erfcinvf ( float y ); -float erfcxf ( float x ); -float erff ( float x ); -float erfinvf ( float y ); -float exp10f ( float x ); -float exp2f ( float x ); -float expf ( float x ); -float expm1f ( float x ); -float fabsf ( float x ); -float fdimf ( float x, float y ); -float fdividef ( float x, float y ); -float floorf ( float x ); -float fmaf ( float x, float y, float z ); -float fmaxf ( float x, float y ); -float fminf ( float x, float y ); -float fmodf ( float x, float y ); -//float frexpf ( float x, int* nptr ); -float hypotf ( float x, float y ); -//int ilogbf ( float x ); -//__RETURN_TYPE isfinite ( float a ); -//__RETURN_TYPE isinf ( float a ); -//__RETURN_TYPE isnan ( float a ); -float j0f ( float x ); -float j1f ( float x ); -//float jnf ( int n, float x ); -//float ldexpf ( float x, int exp ); -float lgammaf ( float x ); -//long long int llrintf ( float x ); -//long long int llroundf ( float x ); -float log10f ( float x ); -float log1pf ( float x ); -float log2f ( float x ); -float logbf ( float x ); -float logf ( float x ); -//long int lrintf ( float x ); -//long int lroundf ( float x ); -//float modff ( float x, float* iptr ); -//float nanf ( const char* tagp ); -//float nearbyintf ( float x ); -float nextafterf ( float x, float y ); -float norm3df ( float a, float b, float c ); -float norm4df ( float a, float b, float c, float d ); -float normcdff ( float y ); -float normcdfinvf ( float y ); -//float normf ( int dim, const float* a ); -float powf ( float x, float y ); -float rcbrtf ( float x ); -float remainderf ( float x, float y ); -//float remquof ( float x, float y, int* quo ); -float rhypotf ( float x, float y ); -//float rintf ( float x ); -float rnorm3df ( float a, float b, float c ); -float rnorm4df ( float a, float b, float c, float d ); -//float rnormf ( int dim, const float* a ); -float roundf ( float x ); -float rsqrtf ( float x ); -//float scalblnf ( float x, long int n ); -//float scalbnf ( float x, int n ); -//__RETURN_TYPE signbit ( float a ); -//void sincosf ( float x, float* sptr, float* cptr ); -//void sincospif ( float x, float* sptr, float* cptr ); -float sinf ( float x ); -float sinhf ( float x ); -float sinpif ( float x ); -float sqrtf ( float x ); -float tanf ( float x ); -float tanhf ( float x ); -float tgammaf ( float x ); -float truncf ( float x ); -float y0f ( float x ); -float y1f ( float x ); -//float ynf ( int n, float x ); -// END MATH FUNCTIONS FROM CUDA +#include \"math_functions.hpp\" )C"; } // namespace c @@ -313,7 +213,12 @@ struct SegmentedReducer { constexpr auto cubBlockReduce = R"CUDA( +#if __CUDACC_RTC__ #include "cub/nvrtc_cub.cuh" +#else +#include +#include "cub/cub.cuh" +#endif namespace __tc { @@ -335,7 +240,7 @@ inline __device__ void CubReduceAlongXPowerOf2(T* dest, T val) { } #define POWEROF2(X) \ - ((X) & ((X) - 1) == 0) + (((X) & ((X) - 1)) == 0) template inline __device__ void CubReduceAlongX(T* dest, T val) { diff --git a/tc/core/cuda/cuda_mapping_options.cc b/tc/core/cuda/cuda_mapping_options.cc index 49b2f24fd..09d7edf8c 100644 --- a/tc/core/cuda/cuda_mapping_options.cc +++ b/tc/core/cuda/cuda_mapping_options.cc @@ -294,6 +294,11 @@ CudaMappingOptions& CudaMappingOptions::privateDepth(uint32_t depth) { return *this; } +CudaMappingOptions& CudaMappingOptions::sharedDepth(uint32_t depth) { + ownedProto_.set_shared_depth(depth); + return *this; +} + CudaMappingOptions& CudaMappingOptions::mapToThreads( const std::string& commaSeparatedSizes) { auto sizes = parseCommaSeparatedIntegers(commaSeparatedSizes); diff --git a/tc/core/cuda/cuda_mapping_options.h b/tc/core/cuda/cuda_mapping_options.h index df53ffb43..aa8530307 100644 --- a/tc/core/cuda/cuda_mapping_options.h +++ b/tc/core/cuda/cuda_mapping_options.h @@ -196,6 +196,7 @@ class CudaMappingOptions { CudaMappingOptions& unrollCopyShared(bool b); CudaMappingOptions& useReadOnlyCache(bool b); CudaMappingOptions& privateDepth(uint32_t depth); + CudaMappingOptions& sharedDepth(uint32_t depth); ///@} /// Static constructors for predefined strategies. diff --git a/tc/core/cuda/cuda_mapping_options_cpp_printer.cc b/tc/core/cuda/cuda_mapping_options_cpp_printer.cc index a64900492..9ffa95bcc 100644 --- a/tc/core/cuda/cuda_mapping_options_cpp_printer.cc +++ b/tc/core/cuda/cuda_mapping_options_cpp_printer.cc @@ -39,6 +39,7 @@ CudaMappingOptionsCppPrinter& operator<<( "maxSharedMemory", cudaOptions.proto().max_shared_memory()); } prn.printValueOption("privateDepth", cudaOptions.proto().private_depth()); + prn.printValueOption("sharedDepth", cudaOptions.proto().shared_depth()); prn.endStmt(); return prn; } diff --git a/tc/core/cuda/cuda_rtc.cc b/tc/core/cuda/cuda_rtc.cc index 9ed0ffd1e..9121704da 100644 --- a/tc/core/cuda/cuda_rtc.cc +++ b/tc/core/cuda/cuda_rtc.cc @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include +#include +#include +#include #include #include #include @@ -60,23 +64,20 @@ void checkOrCreateContext() { } } -std::unique_ptr CudaRTCFunction::Compile( - const std::string& name, - const std::string& source) { - std::unique_ptr res(new CudaRTCFunction()); - res->specializedName = name; - res->cleared_ = false; - - if (FLAGS_debug_tc_mapper) { - LOG(INFO) << "NVRTC function source:\n" << source; +namespace { +static void checkedSystemCall( + const std::string& cmd, + const std::vector& args) { + std::stringstream command; + command << cmd << " "; + for (const auto& s : args) { + command << s << " "; } - // Actually do the compiling. - nvrtcProgram prog; - TC_NVRTC_CHECK( - nvrtcCreateProgram(&prog, source.c_str(), nullptr, 0, nullptr, nullptr)); + TC_CHECK_EQ(std::system(command.str().c_str()), 0) << command.str(); +} - // Get the architecture of the current device. - int device, minor, major; +static std::tuple getCudaArchitecture() { + int device, major, minor; CUdevice deviceHandle; TC_CUDA_RUNTIMEAPI_ENFORCE(cudaGetDevice(&device)); TC_CUDA_DRIVERAPI_ENFORCE(cuDeviceGet(&deviceHandle, device)); @@ -84,6 +85,135 @@ std::unique_ptr CudaRTCFunction::Compile( &major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, deviceHandle)); TC_CUDA_DRIVERAPI_ENFORCE(cuDeviceGetAttribute( &minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, deviceHandle)); + return std::tuple(device, major, minor); +} + +static std::string llvmCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + std::string pat("/tmp/cudaXXXXXX"); + std::vector ifn(pat.begin(), pat.end()); + TC_CHECK_GE(mkstemp(ifn.data()), 0); // string.c_str is const char* + std::string inputFileName(ifn.begin(), ifn.end()); + // cstdio's std::remove to delete files + tc::ScopeGuard sgi([&]() { std::remove(inputFileName.c_str()); }); + { + std::ofstream ostream(inputFileName, std::ios::binary); + ostream << source; + } + + std::string arch = "sm_" + std::to_string(major) + std::to_string(minor); + std::string outputClangFile = inputFileName + "-clang.ll"; + std::string outputLinkFile = inputFileName + "-link.ll"; + std::string outputOptFile = inputFileName + "-opt.ll"; + std::string outputPtxFile = inputFileName + ".s"; + tc::ScopeGuard sgo([&]() { + // cstdio's std::remove to delete files + std::remove(outputClangFile.c_str()); + std::remove(outputLinkFile.c_str()); + std::remove(outputOptFile.c_str()); + std::remove(outputPtxFile.c_str()); + }); + + // Compile + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/clang++", + {"-x cuda " + inputFileName, + "--cuda-device-only", + std::string("--cuda-gpu-arch=") + arch, + std::string("--cuda-path=") + TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUB_INCLUDE_DIR), + tc::FLAGS_llvm_flags, + "-nocudalib", + "-S", + "-emit-llvm", + "-o " + outputClangFile}); + + // Link libdevice before opt + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/llvm-link ", + {outputClangFile, + std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + + "/nvvm/libdevice/libdevice.*.bc", + "-S", + "-o " + outputLinkFile}); + + // Opt + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/opt", + {"-internalize", + std::string("-internalize-public-api-list=") + name, + "-nvvm-reflect", + "-O3", + outputLinkFile, + "-S", + std::string("-o ") + outputOptFile}); + + // Ptx + checkedSystemCall( + std::string(TC_STRINGIFY(TC_LLVM_BIN_DIR)) + "/llc", + {std::string("-mcpu=") + arch, + outputOptFile, + std::string("-o ") + outputPtxFile}); + + std::ifstream stream(outputPtxFile); + return std::string( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator()); +} + +static std::string nvccCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + std::string pat("/tmp/cudaXXXXXX"); + std::vector ifn(pat.begin(), pat.end()); + TC_CHECK_GE(mkstemp(ifn.data()), 0); // string.c_str is const char* + std::string inputFileName(ifn.begin(), ifn.end()); + // cstdio's std::remove to delete files + tc::ScopeGuard sgi([&]() { std::remove(inputFileName.c_str()); }); + { + std::ofstream ostream(inputFileName, std::ios::binary); + ostream << source; + } + + std::string arch = "sm_" + std::to_string(major) + std::to_string(minor); + std::string outputPtxFile = inputFileName + ".ptx"; + // cstdio's std::remove to delete files + tc::ScopeGuard sgo([&]() { std::remove(outputPtxFile.c_str()); }); + + checkedSystemCall( + std::string(TC_STRINGIFY(TC_CUDA_TOOLKIT_ROOT_DIR)) + "/bin/nvcc", + {"-x cu", + inputFileName, + std::string("--gpu-architecture=") + arch, + "--ptx", + std::string("-I") + TC_STRINGIFY(TC_CUDA_INCLUDE_DIR), + std::string("-I") + TC_STRINGIFY(TC_CUB_INCLUDE_DIR), + tc::FLAGS_nvcc_flags, + std::string("-o ") + outputPtxFile}); + + std::ifstream stream(outputPtxFile); + return std::string( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator()); +} + +static std::string nvrtcCompile( + const std::string& name, + const std::string& source) { + int device, major, minor; + std::tie(device, major, minor) = getCudaArchitecture(); + + nvrtcProgram prog; + TC_NVRTC_CHECK( + nvrtcCreateProgram(&prog, source.c_str(), nullptr, 0, nullptr, nullptr)); std::stringstream arch_param; arch_param << "--gpu-architecture=compute_" << major << minor; @@ -91,8 +221,10 @@ std::unique_ptr CudaRTCFunction::Compile( // Compile the program. const char* nvrtc_debug_opts[] = {"-G", "-lineinfo"}; - std::string cudaHome = std::string("-I ") + std::string(CUDA_HOME); - std::string cubHome = std::string("-I ") + std::string(CUB_HOME); + std::string cudaHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUDA_INCLUDE_DIR)); + std::string cubHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUB_INCLUDE_DIR)); std::vector nvrtcts = {arch.c_str(), "--use_fast_math", "-std=c++11", @@ -123,14 +255,37 @@ std::unique_ptr CudaRTCFunction::Compile( } size_t ptx_size; TC_NVRTC_CHECK(nvrtcGetPTXSize(prog, &ptx_size)); - res->nvrtc_ptx = std::vector(ptx_size); - TC_NVRTC_CHECK(nvrtcGetPTX(prog, res->nvrtc_ptx.data())); + std::vector res(ptx_size); + TC_NVRTC_CHECK(nvrtcGetPTX(prog, res.data())); TC_NVRTC_CHECK(nvrtcDestroyProgram(&prog)); + return std::string(res.begin(), res.end()); +} +} // namespace + +std::unique_ptr CudaRTCFunction::Compile( + const std::string& name, + const std::string& source) { + std::unique_ptr res(new CudaRTCFunction()); + res->specializedName = name; + res->cleared_ = false; + if (FLAGS_debug_tc_mapper) { + LOG(INFO) << "NVRTC function source:\n" << source; + } + if (FLAGS_cuda_compiler == "nvrtc") { + res->ptx = nvrtcCompile(name, source); + } else if (FLAGS_cuda_compiler == "llvm") { + res->ptx = llvmCompile(name, source); + } else if (FLAGS_cuda_compiler == "nvcc") { + res->ptx = nvccCompile(name, source); + } else { + CHECK(false) << "Unknown CUDA compiler: " << FLAGS_cuda_compiler; + } if (FLAGS_dump_ptx) { - LOG(INFO) << "PTX:\n" << std::string(res->nvrtc_ptx.data()); + LOG(INFO) << "PTX:\n" << res->ptx; } return res; } + namespace { template @@ -162,8 +317,11 @@ Duration CudaRTCFunction::Launch( // This call to cudaDeviceSynchronize implicitly creates a new context if // one is not bound to the current CPU. checkOrCreateContext(); - TC_CUDA_DRIVERAPI_ENFORCE( - cuModuleLoadDataEx(&module, nvrtc_ptx.data(), 0, 0, 0)); + auto res = cuModuleLoadData(&module, ptx.c_str()); + if (res != CUDA_SUCCESS) { + LOG(ERROR) << "Invalid PTX: " << ptx; + } + TC_CUDA_DRIVERAPI_ENFORCE(res); perGpuModule_.emplace(dev, module); TC_CUDA_DRIVERAPI_ENFORCE( cuModuleGetFunction(&function, module, specializedName.c_str())); diff --git a/tc/core/cuda/cuda_rtc.h b/tc/core/cuda/cuda_rtc.h index 4aa5e831f..9363f8a86 100644 --- a/tc/core/cuda/cuda_rtc.h +++ b/tc/core/cuda/cuda_rtc.h @@ -65,7 +65,7 @@ class CudaRTCFunction { mutable std::unordered_map perGpuModule_; mutable std::unordered_map perGpuKernel_; std::string specializedName; - std::vector nvrtc_ptx; + std::string ptx; bool cleared_; }; diff --git a/tc/core/cuda/cuda_tc_executor.cc b/tc/core/cuda/cuda_tc_executor.cc index cf27d5f29..d18723921 100644 --- a/tc/core/cuda/cuda_tc_executor.cc +++ b/tc/core/cuda/cuda_tc_executor.cc @@ -86,7 +86,7 @@ CudaCompilationResult CudaBackend::compileWithTcMapper( // Now we can build stuff auto mappedScop = - polyhedral::MappedScop::makeWithOuterBlockInnerThreadStrategy( + polyhedral::cuda::MappedScop::makeWithOuterBlockInnerThreadStrategy( std::move(scop), options); LOG_IF(INFO, FLAGS_debug_tc_mapper) << "Mapped schedule:" << std::endl << *(mappedScop->schedule()); diff --git a/tc/core/flags.cc b/tc/core/flags.cc index 9942a3732..a5dc9e438 100644 --- a/tc/core/flags.cc +++ b/tc/core/flags.cc @@ -38,6 +38,20 @@ DEFINE_bool( DEFINE_bool(dump_cuda, false, "Print the generated source"); DEFINE_bool(dump_ptx, false, "Dump the generated PTX"); +// PTX generation +DEFINE_string( + cuda_compiler, + "nvrtc", + "which compiler to use to emit ptx: nvrtc, llvm, nvcc (default [nvrtc])"); +DEFINE_string( + llvm_flags, + "-std=c++11 -O3 -ffast-math", + "compiler flags to set when llvm is used"); +DEFINE_string( + nvcc_flags, + "-std=c++11 -ptx --use_fast_math", + "compiler flags to set when nvcc is used"); + // CPU codegen options DEFINE_bool(llvm_dump_before_opt, false, "Print IR before optimization"); DEFINE_bool(llvm_dump_after_opt, false, "Print IR after optimization"); diff --git a/tc/core/flags.h b/tc/core/flags.h index c748759a4..38739a2da 100644 --- a/tc/core/flags.h +++ b/tc/core/flags.h @@ -31,6 +31,11 @@ DECLARE_bool(debug_tuner); DECLARE_bool(dump_cuda); DECLARE_bool(dump_ptx); +// ptx generation +DECLARE_string(cuda_compiler); +DECLARE_string(llvm_flags); +DECLARE_string(nvcc_flags); + // llvm codegen DECLARE_bool(llvm_dump_before_opt); DECLARE_bool(llvm_dump_after_opt); diff --git a/tc/core/polyhedral/functional.h b/tc/core/functional.h similarity index 99% rename from tc/core/polyhedral/functional.h rename to tc/core/functional.h index ed8117b1f..c92ddcef0 100644 --- a/tc/core/polyhedral/functional.h +++ b/tc/core/functional.h @@ -21,7 +21,6 @@ #include namespace tc { -namespace polyhedral { namespace functional { template @@ -178,5 +177,4 @@ R MapReduce(std::function fun, const std::vector& vec) { } } // namespace functional -} // namespace polyhedral } // namespace tc diff --git a/tc/core/gpu.h b/tc/core/gpu.h index cdacc05a3..6846304fd 100644 --- a/tc/core/gpu.h +++ b/tc/core/gpu.h @@ -15,9 +15,11 @@ */ #pragma once +#include "tc/tc_config.h" + // Conditionally include CUDA-specific headers. This file should compile even // without them. -#ifdef CUDA_HOME +#if TC_WITH_CUDA #include "tc/core/cuda/cuda.h" #endif @@ -27,7 +29,7 @@ namespace tc { /// The call is forwarded to the appropriate GPU driver (CUDA in particular). /// If a thread has no associated GPU device, return 0. inline size_t querySharedMemorySize() { -#ifdef CUDA_HOME +#if TC_WITH_CUDA && !defined(NO_CUDA_SDK) return CudaGPUInfo::GPUInfo().SharedMemorySize(); #else return 0; diff --git a/tc/core/halide2isl.cc b/tc/core/halide2isl.cc index 31c670983..cb46434ba 100644 --- a/tc/core/halide2isl.cc +++ b/tc/core/halide2isl.cc @@ -24,6 +24,7 @@ #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" #include "tc/core/polyhedral/schedule_tree.h" +#include "tc/core/polyhedral/utils.h" #include "tc/core/tc2halide.h" namespace tc { @@ -259,7 +260,8 @@ isl::map extractAccess( isl::space paramSpace = domain.paramSpace; isl::id tensorID(paramSpace.get_ctx(), tensor); - auto tensorSpace = paramSpace.named_set_from_params_id(tensorID, args.size()); + auto tensorTuple = constructTensorTuple(paramSpace, tensorID, args.size()); + auto tensorSpace = tensorTuple.get_space(); // Start with a totally unconstrained set - every point in // the allocation could be accessed. @@ -275,9 +277,10 @@ isl::map extractAccess( // The coordinate written to in the range ... auto rangePoint = identity.get_aff(i); // ... equals the coordinate accessed as a function of the parameters. - auto domainPoint = halide2isl::makeIslAffFromExpr(tensorSpace, args[i]); + auto domainPoint = halide2isl::makeIslAffFromExpr(paramSpace, args[i]); if (!domainPoint.is_null()) { - access = access.intersect(isl::pw_aff(domainPoint).eq_set(rangePoint)); + domainPoint = domainPoint.unbind_params_insert_domain(tensorTuple); + access = access.intersect(domainPoint.eq_set(rangePoint)); } } @@ -289,8 +292,8 @@ isl::map extractAccess( std::string tag = "__tc_ref_" + std::to_string(accesses->size()); isl::id tagID(domain.paramSpace.get_ctx(), tag); accesses->emplace(op, tagID); - isl::space domainSpace = map.get_space().domain(); - isl::space tagSpace = domainSpace.params().named_set_from_params_id(tagID, 0); + auto domainSpace = map.get_space().domain(); + auto tagSpace = domainSpace.params().add_named_tuple_id_ui(tagID, 0); domainSpace = domainSpace.product(tagSpace).unwrap(); map = map.preimage_domain(isl::multi_aff::domain_map(domainSpace)); @@ -367,7 +370,7 @@ static isl::multi_aff mapToOther( list = list.add(aff); } auto domainSpace = iterationDomain.tuple.get_space(); - auto space = domainSpace.params().named_set_from_params_id(id, list.size()); + auto space = domainSpace.params().add_named_tuple_id_ui(id, list.size()); space = domainSpace.product(space).unwrap(); return isl::multi_aff(space, list); } @@ -525,7 +528,7 @@ isl::schedule makeScheduleTreeHelper( isl::id id(set.get_ctx(), kStatementLabel + std::to_string(stmtIndex)); statements->emplace(id, op); auto tupleSpace = isl::space(set.get_ctx(), 0); - tupleSpace = tupleSpace.named_set_from_params_id(id, outer.size()); + tupleSpace = tupleSpace.add_named_tuple_id_ui(id, outer.size()); IterationDomain iterationDomain; iterationDomain.paramSpace = set.get_space(); iterationDomain.tuple = isl::multi_id(tupleSpace, outer); diff --git a/tc/core/mapping_options.cc b/tc/core/mapping_options.cc index 01f776c7c..20d4456c4 100644 --- a/tc/core/mapping_options.cc +++ b/tc/core/mapping_options.cc @@ -70,46 +70,6 @@ MappingOptionsView& MappingOptionsView::tile( // namespace callbacks { -// The ILP in basic set has the following dimensions: -// - sum of positive and negative parts of the dependence distance bound -// - constant term of the dependence distance bound -// - sum of parameter coefficients -// - sum of positive and negative parts of schedule coefficients -// - for each statement (in the order of id_list) -// - pairs of values representing schedule coefficients, in the order -// opposite to their order in the respective domain -// - parameter coefficients -// - constant term of the schedule -// Schedule coefficients are represented as a pair of non-negative -// dimensions (c_1 = c_1^+ - c_1^-), where the negative part comes first. -// XXX: FRAGILE! the order depends on the internal operation of the isl -// scheduler, which may change. This description is based on git-708721f. - -__isl_give isl_basic_set* AddPositiveCoefficientConstraints( - __isl_take isl_basic_set* lp, - int n_param, - int, - __isl_keep isl_id_list* stmt_ids, - int* node_n_params, - int* node_n_dims, - void*) { - int offset = 4 + 2 * n_param; - int n_node = isl_id_list_n_id(stmt_ids); - auto ilp = isl::manage(lp); - auto space = ilp.get_local_space(); - auto c = isl::constraint::alloc_equality(space); - for (int i = 0; i < n_node; ++i) { - for (int j = 0; j < 2 * node_n_dims[i]; j += 2) { - c = c.set_coefficient_si(isl::dim_type::set, offset + j, -1); - } - offset += 2 * node_n_dims[i] + node_n_params[i] + 1; - } - c = c.set_constant_si(0); - ilp = ilp.add_constraint(c); - - return ilp.release(); -} - // Fusion decisions. // These callbacks are called from the cluster merging process inside isl // scheduler. Current version of this process is two-stage. First, it diff --git a/tc/core/mapping_options.h b/tc/core/mapping_options.h index 8e28cf39f..4c2eeb723 100644 --- a/tc/core/mapping_options.h +++ b/tc/core/mapping_options.h @@ -365,15 +365,6 @@ class MappingOptions { }; namespace callbacks { -__isl_give isl_basic_set* AddPositiveCoefficientConstraints( - __isl_take isl_basic_set* lp, - int n_param, - int dim, - __isl_keep isl_id_list* stmt_ids, - int* node_n_params, - int* node_n_dims, - void*); - isl_bool FuseAllPreserve3Coincident( __isl_take isl_union_map* original_schedule, __isl_take isl_union_map* updated_schedule, diff --git a/tc/core/polyhedral/codegen_llvm.cc b/tc/core/polyhedral/codegen_llvm.cc index d3ce32de3..c87289d1f 100644 --- a/tc/core/polyhedral/codegen_llvm.cc +++ b/tc/core/polyhedral/codegen_llvm.cc @@ -47,10 +47,6 @@ #error LLVM_VERSION_MAJOR not set #endif -#ifdef TAPIR_VERSION_MAJOR -#include "llvm/Transforms/Tapir/CilkABI.h" -#endif - using namespace Halide; namespace tc { @@ -61,9 +57,6 @@ using IteratorMapType = std::unordered_map; using IteratorMapsType = std::unordered_map; -using IteratorLLVMValueMapType = - std::unordered_map; - using StmtSubscriptExprMapType = std::unordered_map, isl::IslIdIslHash>; @@ -77,24 +70,6 @@ int64_t toSInt(isl::val v) { return v.get_num_si(); } -llvm::Value* getLLVMConstantSignedInt64(int64_t v) { - return llvm::ConstantInt::get(llvm::Type::getInt64Ty(llvmCtx), v, true); -} - -int64_t IslExprToSInt(isl::ast_expr e) { - auto intExpr = e.as(); - TC_CHECK(intExpr); - return toSInt(intExpr.get_val()); -} - -int64_t islIdToInt(isl::ast_expr_id e, isl::set context) { - auto space = context.get_space(); - isl::aff param(isl::aff::param_on_domain_space(space, e.get_id())); - auto p = context.sample_point(); - TC_CHECK(context.is_equal(p)); - return toSInt(param.eval(p)); -} - int64_t getTensorSize(isl::set context, const Halide::Expr& e) { // isl will take care of substituting parameter values if they are known and // simplifying the expression. @@ -113,74 +88,19 @@ std::vector getTensorSizesWithoutLeadingDim( for (int d = 1; d < dims; ++d) { Halide::Expr extent = t.parameter().extent_constraint(d); TC_CHECK(extent.defined()) - << "Undefined extent on input/output tensor. Forward bounds inference should have set these\n"; + << "Undefined extent on input/output tensor. " + << "Forward bounds inference should have set these\n"; sizes.push_back(getTensorSize(context, extent)); } return sizes; } -class IslAstExprInterpeter { - isl::set context_; - - public: - IslAstExprInterpeter(isl::set context) : context_(context){}; - - int64_t interpret(isl::ast_expr e) { - if (auto intExpr = e.as()) { - return IslExprToSInt(intExpr); - } else if (auto idExpr = e.as()) { - return islIdToInt(idExpr, context_); - } else if (auto opExpr = e.as()) { - return interpretOp(opExpr); - } else { - TC_CHECK(false) << "NYI"; - return 0; // avoid warning - } - }; - - private: - int64_t interpretOp(isl::ast_expr_op e) { - switch (e.get_n_arg()) { - case 1: - return interpretUnaryOp(e); - case 2: - return interpretBinaryOp(e); - default: - TC_CHECK(false) << "NYI: " << e; - return 0; // avoid warning - } - } - - int64_t interpretBinaryOp(isl::ast_expr_op e) { - auto left = interpret(e.get_arg(0)); - auto right = interpret(e.get_arg(1)); - if (e.as()) { - return left + right; - } else if (e.as()) { - return left - right; - } else { - TC_CHECK(false) << "NYI: " << e; - return 0; // avoid warning - } - } - - int64_t interpretUnaryOp(isl::ast_expr_op e) { - auto val = interpret(e.get_arg(0)); - if (e.as()) { - return -val; - } else { - TC_CHECK(false) << "NYI"; - return 0; // avoid warning - } - } -}; - static constexpr int kOptLevel = 3; class CodeGen_TC : public Halide::Internal::CodeGen_X86 { public: const IteratorMapType* iteratorMap_; - CodeGen_TC(Target t) : CodeGen_X86(t) {} + CodeGen_TC(Target t) : CodeGen_X86(t), iteratorMap_(nullptr) {} using CodeGen_X86::codegen; using CodeGen_X86::llvm_type_of; @@ -217,10 +137,10 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { return std::move(module); } - // Convert an isl AST expression into an llvm::Value. - // Only expressions that consist of a pure identifier or - // a pure integer constant are currently supported. - llvm::Value* getValue(isl::ast_expr expr); + Halide::Expr makeHalideExpr(isl::ast_expr expr); + llvm::Value* codegen(isl::ast_expr expr) { + return codegen(makeHalideExpr(expr)); + } protected: using CodeGen_X86::visit; @@ -243,8 +163,17 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { } } + // The type of Variables in TC come in 2 flavors: + // 1. the ones for which we explicitly registered LLVMIR with sym_push + // (i.e. the Halide way). + // 2. the ones coming from an isl::ast_build which need to be translated + // through the iteratorMap_, void visit(const Halide::Internal::Variable* op) override { - value = getValue(iteratorMap_->at(op->name)); + if ((value = sym_get(op->name, false))) { + return; + } + TC_CHECK(iteratorMap_) << "IteratorMap must be set"; + value = codegen(iteratorMap_->at(op->name)); // Generate code for type casting if necessary. llvm::Type* ty = llvm_type_of(op->type); @@ -284,9 +213,6 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { llvm::PassManagerBuilder b; b.OptLevel = kOptLevel; -#ifdef TAPIR_VERSION_MAJOR - b.tapirTarget = new llvm::CilkABI(); -#endif b.Inliner = llvm::createFunctionInliningPass(b.OptLevel, 0, false); b.LoopVectorize = true; b.SLPVectorize = true; @@ -312,15 +238,56 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 { } }; -llvm::Value* CodeGen_TC::getValue(isl::ast_expr expr) { +// For now we always generate int32 for induction variables and integer +// constants. Note that we may soon need to also support int64. +Halide::Expr CodeGen_TC::makeHalideExpr(isl::ast_expr expr) { if (auto idExpr = expr.as()) { - return sym_get(idExpr.get_id().get_name()); + return Halide::Internal::Variable::make( + Halide::Int(32), idExpr.get_id().get_name()); } else if (auto intExpr = expr.as()) { - return getLLVMConstantSignedInt64(toSInt(intExpr.get_val())); - } else { - LOG(FATAL) << "NYI"; - return nullptr; + return Halide::Internal::IntImm::make( + Halide::Int(32), toSInt(intExpr.get_val())); + } else if (auto op = expr.as()) { +#define MAKE_UN_OP(ISL_TYPE, HALIDE_TYPE) \ + if (auto ty = op.as()) { \ + return HALIDE_TYPE::make(makeHalideExpr(op.get_arg(0))); \ + } + +#define MAKE_BIN_OP(ISL_TYPE, HALIDE_TYPE) \ + if (auto ty = op.as()) { \ + return HALIDE_TYPE::make( \ + makeHalideExpr(op.get_arg(0)), makeHalideExpr(op.get_arg(1))); \ + } + + // Minus in Halide is done with a binary operator, this is a special case + // for us. + if (auto ty = op.as()) { + auto a = makeHalideExpr(op.get_arg(0)); + auto zero = Halide::Internal::make_zero(a.type()); + return Halide::Internal::Sub::make(zero, a); + } + + // clang-format off + MAKE_BIN_OP(isl::ast_op_eq, Halide::Internal::EQ); + MAKE_BIN_OP(isl::ast_op_le, Halide::Internal::LE); + MAKE_BIN_OP(isl::ast_op_lt, Halide::Internal::LT); + MAKE_BIN_OP(isl::ast_op_ge, Halide::Internal::GE); + MAKE_BIN_OP(isl::ast_op_gt, Halide::Internal::GT); + MAKE_BIN_OP(isl::ast_op_and, Halide::Internal::And); + MAKE_BIN_OP(isl::ast_op_or, Halide::Internal::Or); + MAKE_BIN_OP(isl::ast_op_min, Halide::Internal::Min); + MAKE_BIN_OP(isl::ast_op_max, Halide::Internal::Max); + MAKE_BIN_OP(isl::ast_op_add, Halide::Internal::Add); + MAKE_BIN_OP(isl::ast_op_sub, Halide::Internal::Sub); + MAKE_BIN_OP(isl::ast_op_mul, Halide::Internal::Mul); + // clang-format on + +#undef MAKE_UN_OP +#undef MAKE_BIN_OP } + + LOG(FATAL) << "NYI: " << expr; + return Halide::Internal::IntImm::make(Halide::Int(32), 0); } class LLVMCodegen { @@ -347,6 +314,13 @@ class LLVMCodegen { } } + void collectParams(const std::vector& params) { + for (const auto& p : params) { + args_.emplace_back(halide_cg.llvm_type_of(p.type())); + argNames_.emplace_back(p.name()); + } + } + public: LLVMCodegen( const Scop& scop, @@ -364,9 +338,12 @@ class LLVMCodegen { halide_cg.init_module(); } - void createSignature( + // This creates a signature of the form: + // input_data_types, output_data_types, parameters + llvm::BasicBlock* createSignature( const std::vector& inputs, const std::vector& outputs, + const std::vector& params, const std::string& fname) { auto size = inputs.size() + outputs.size(); args_.reserve(size); @@ -374,6 +351,7 @@ class LLVMCodegen { collectInputs(inputs); collectOutputs(outputs); + collectParams(params); auto* functionType = llvm::FunctionType::get(llvm::Type::getVoidTy(llvmCtx), args_, false); @@ -391,67 +369,54 @@ class LLVMCodegen { arg.setName(argNames_.at(idx++)); } - for (auto it = function->arg_begin(), end = function->arg_end(); it != end; + // Only pointer arguments can be NoAlias and NonNull + for (auto it = function->arg_begin(), + end = function->arg_begin() + inputs.size() + outputs.size(); + it != end; ++it) { it->addAttr(llvm::Attribute::NoAlias); it->addAttr(llvm::Attribute::NonNull); } + // Only input arguments are ReadOnly for (auto it = function->arg_begin(), end = it + inputs.size(); it != end; ++it) { it->addAttr(llvm::Attribute::ReadOnly); } - auto entryBB_ = llvm::BasicBlock::Create(llvmCtx, "entry", function); - halide_cg.get_builder().SetInsertPoint(entryBB_); + return llvm::BasicBlock::Create(llvmCtx, "entry", function); } - void CodeGen(isl::ast_node node) { - emitAst(node); - halide_cg.get_builder().CreateRetVoid(); - - if (llvm::verifyModule(*halide_cg.get_module())) { - LOG(ERROR) << str(); - llvm::verifyModule(*halide_cg.get_module(), &llvm::outs()); - throw std::runtime_error("LLVM generated module is invalid."); - } - } - - llvm::BasicBlock* emitAst(isl::ast_node node) { + // This is the main entry point to emit pieces of LLVM IR + // LLVM IR insertion is stateful, configured by SetInsertPoint + // We make this an explicit parameter to avoid implicit conventions + // All TC IR builder methods take an explicit insertionPoint. + // The invariant in all emit* (except for emitAst) is that: + // TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + llvm::BasicBlock* emitAst( + isl::ast_node node, + llvm::BasicBlock* insertionPoint) { + halide_cg.get_builder().SetInsertPoint(insertionPoint); if (auto forNode = node.as()) { - return emitFor(forNode); + return emitFor(forNode, insertionPoint); } else if (auto userNode = node.as()) { - return emitStmt(userNode); + return emitStmt(userNode, insertionPoint); } else if (auto blockNode = node.as()) { - return emitBlock(blockNode); + llvm::BasicBlock* curBB = insertionPoint; + for (auto child : blockNode.get_children()) { + curBB = emitAst(child, curBB); + } + return curBB; } else { - if (node.as()) { - LOG(FATAL) << "NYI if node: " << node << std::endl; + if (auto cond = node.as()) { + return emitIf(cond, insertionPoint); } else { LOG(FATAL) << "NYI " << node << std::endl; } - return static_cast(nullptr); // avoid warning } + return nullptr; } private: - llvm::BasicBlock* emitBlock(isl::ast_node_block node) { - auto* function = halide_cg.get_builder().GetInsertBlock()->getParent(); - auto* currBB = llvm::BasicBlock::Create(llvmCtx, "block_exit", function); - halide_cg.get_builder().CreateBr(currBB); - halide_cg.get_builder().SetInsertPoint(currBB); - - for (auto child : node.get_children()) { - currBB = emitAst(child); - halide_cg.get_builder().SetInsertPoint(currBB); - } - - auto* exit = llvm::BasicBlock::Create(llvmCtx, "block_exit", function); - halide_cg.get_builder().SetInsertPoint(currBB); - halide_cg.get_builder().CreateBr(exit); - halide_cg.get_builder().SetInsertPoint(exit); - return exit; - } - llvm::Type* makePtrToArrayType( llvm::Type* baseTy, const std::vector& sizes) { @@ -464,30 +429,48 @@ class LLVMCodegen { return arrTy->getPointerTo(); } - llvm::BasicBlock* emitFor(isl::ast_node_for node) { - IteratorLLVMValueMapType iterPHIs; + llvm::BasicBlock* emitIf( + isl::ast_node_if node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + auto* function = insertionPoint->getParent(); + + llvm::Value* condVal = halide_cg.codegen(node.get_cond()); + auto* thenBB = llvm::BasicBlock::Create(llvmCtx, "then", function); + // Recursively emit "then" in a new thenBB + auto innerBB = emitAst(node.get_then(), thenBB); + + // outer -> thenBB + halide_cg.get_builder().SetInsertPoint(insertionPoint); + // outer ---------> if_exit + // TODO: When we support "else", go to elseBB instead of exit + auto* exit = llvm::BasicBlock::Create(llvmCtx, "if_exit", function); + halide_cg.get_builder().CreateCondBr(condVal, thenBB, exit); + + // then -> if_exit + halide_cg.get_builder().SetInsertPoint(innerBB); + halide_cg.get_builder().CreateBr(exit); + + // Else is often empty in the absence of full tile extraction + if (node.has_else()) { + LOG(FATAL) << "NYI: else conditional branch"; + return exit; + } + + return exit; + } - auto* incoming = halide_cg.get_builder().GetInsertBlock(); - auto* function = incoming->getParent(); + llvm::BasicBlock* emitFor( + isl::ast_node_for node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); + auto* function = insertionPoint->getParent(); auto* headerBB = llvm::BasicBlock::Create(llvmCtx, "loop_header", function); auto* loopBodyBB = llvm::BasicBlock::Create(llvmCtx, "loop_body", function); auto* loopLatchBB = llvm::BasicBlock::Create(llvmCtx, "loop_latch", function); auto* loopExitBB = llvm::BasicBlock::Create(llvmCtx, "loop_exit", function); - bool parallel = node.is_coincident(); - llvm::Value* SyncRegion = nullptr; - -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - SyncRegion = halide_cg.get_builder().CreateCall( - llvm::Intrinsic::getDeclaration( - function->getParent(), llvm::Intrinsic::syncregion_start), - {}, - "syncreg"); - } -#endif - halide_cg.get_builder().CreateBr(headerBB); llvm::PHINode* phi = nullptr; @@ -495,86 +478,41 @@ class LLVMCodegen { // Loop Header { - auto initVal = IslExprToSInt(node.get_init()); + auto initVal = halide_cg.codegen(node.get_init()); halide_cg.get_builder().SetInsertPoint(headerBB); phi = halide_cg.get_builder().CreatePHI( - llvm::Type::getInt64Ty(llvmCtx), 2, iterator.get_name()); + initVal->getType(), 2, iterator.get_name()); halide_cg.sym_push(iterator.get_name(), phi); - phi->addIncoming(getLLVMConstantSignedInt64(initVal), incoming); - - auto cond_expr = node.get_cond().as(); - TC_CHECK(cond_expr.as() or cond_expr.as()) - << "I only know how to codegen lt and le"; - auto condLHS = cond_expr.get_arg(0).as(); - TC_CHECK(condLHS); - TC_CHECK_EQ(condLHS.get_id(), iterator); - - IslAstExprInterpeter i(scop_.context()); - auto condRHSVal = i.interpret(cond_expr.get_arg(1)); - - auto cond = [&]() { - auto constant = getLLVMConstantSignedInt64(condRHSVal); - if (cond_expr.as()) { - return halide_cg.get_builder().CreateICmpSLT(phi, constant); - } else if (cond_expr.as()) { - return halide_cg.get_builder().CreateICmpSLE(phi, constant); - } else { - TC_CHECK(false) << "NYI"; - return static_cast(nullptr); // avoid warning - } - }(); + phi->addIncoming(initVal, insertionPoint); + + auto cond = halide_cg.codegen(node.get_cond()); halide_cg.get_builder().CreateCondBr(cond, loopBodyBB, loopExitBB); } // Create Body { - halide_cg.get_builder().SetInsertPoint(loopBodyBB); - -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - auto* detachedBB = - llvm::BasicBlock::Create(llvmCtx, "det.achd", function); - halide_cg.get_builder().CreateDetach( - detachedBB, loopLatchBB, SyncRegion); - halide_cg.get_builder().SetInsertPoint(detachedBB); - } -#endif - auto* currentBB = emitAst(node.get_body()); + auto* currentBB = emitAst(node.get_body(), loopBodyBB); halide_cg.get_builder().SetInsertPoint(currentBB); - - if (parallel) { -#ifdef TAPIR_VERSION_MAJOR - halide_cg.get_builder().CreateReattach(loopLatchBB, SyncRegion); -#endif - } else { - halide_cg.get_builder().CreateBr(loopLatchBB); - } + halide_cg.get_builder().CreateBr(loopLatchBB); } // Create Latch { halide_cg.get_builder().SetInsertPoint(loopLatchBB); - auto incVal = IslExprToSInt(node.get_inc()); + auto incVal = halide_cg.codegen(node.get_inc()); phi->addIncoming( - halide_cg.get_builder().CreateAdd( - phi, getLLVMConstantSignedInt64(incVal)), - loopLatchBB); + halide_cg.get_builder().CreateAdd(phi, incVal), loopLatchBB); halide_cg.get_builder().CreateBr(headerBB); } - halide_cg.get_builder().SetInsertPoint(loopExitBB); halide_cg.sym_pop(iterator.get_name()); -#ifdef TAPIR_VERSION_MAJOR - if (parallel) { - auto* syncBB = llvm::BasicBlock::Create(llvmCtx, "synced", function); - halide_cg.get_builder().CreateSync(syncBB, SyncRegion); - halide_cg.get_builder().SetInsertPoint(syncBB); - } -#endif - return halide_cg.get_builder().GetInsertBlock(); + return loopExitBB; } - llvm::BasicBlock* emitStmt(isl::ast_node_user node) { + llvm::BasicBlock* emitStmt( + isl::ast_node_user node, + llvm::BasicBlock* insertionPoint) { + TC_CHECK_EQ(halide_cg.get_builder().GetInsertBlock(), insertionPoint); isl::ast_expr_op usrExp = node.get_expr().as(); auto id = usrExp.get_arg(0).as().get_id(); auto provide = scop_.halide.statements.at(id); @@ -586,16 +524,19 @@ class LLVMCodegen { const auto& subscripts = stmtSubscripts_.at(id); llvm::SmallVector subscriptValues; + halide_cg.iteratorMap_ = &iteratorMaps_.at(id); for (const auto& subscript : subscripts) { - subscriptValues.push_back(halide_cg.getValue(subscript)); + subscriptValues.push_back(halide_cg.codegen(subscript)); } auto destAddr = halide_cg.get_builder().CreateInBoundsGEP( halide_cg.sym_get(arrayName), subscriptValues); - halide_cg.iteratorMap_ = &iteratorMaps_.at(id); llvm::Value* rhs = halide_cg.codegen(op->values[0]); halide_cg.get_builder().CreateStore(rhs, destAddr); + // We must return halide_cg.get_builder().GetInsertBlock() because + // Halide does not adhere to our conventions and when it emits multiple + // blocks things may go haywire. return halide_cg.get_builder().GetInsertBlock(); } @@ -632,7 +573,7 @@ isl::ast_node collectIteratorMaps( TC_CHECK(user); auto expr = user.get_expr().as(); auto schedule = build.get_schedule(); - auto scheduleMap = isl::map::from_union_map(schedule); + auto scheduleMap = isl::map::from(schedule); auto stmtId = expr.get_arg(0).as().get_id(); TC_CHECK_EQ(0u, iteratorMaps.count(stmtId)) << "entry exists: " << stmtId; @@ -686,8 +627,18 @@ std::unique_ptr emitLLVMKernel( cg.halide_cg.get_module()->setDataLayout(dataLayout); cg.halide_cg.get_module()->setTargetTriple( llvm::EngineBuilder().selectTarget()->getTargetTriple().str()); - cg.createSignature(scop.halide.inputs, scop.halide.outputs, specializedName); - cg.CodeGen(islCg.astNode); + auto entry = cg.createSignature( + scop.halide.inputs, + scop.halide.outputs, + scop.halide.params, + specializedName); + auto exit = cg.emitAst(islCg.astNode, entry); + cg.halide_cg.get_builder().SetInsertPoint(exit); + cg.halide_cg.get_builder().CreateRetVoid(); + + TC_CHECK(!llvm::verifyModule(*cg.halide_cg.get_module())) + << "LLVM generated module is invalid." << cg.str().c_str(); + cg.halide_cg.optimize_module(); return cg.halide_cg.move_module(); } diff --git a/tc/core/polyhedral/cpu/mapped_scop.cc b/tc/core/polyhedral/cpu/mapped_scop.cc new file mode 100644 index 000000000..a44d89923 --- /dev/null +++ b/tc/core/polyhedral/cpu/mapped_scop.cc @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "tc/core/polyhedral/cpu/mapped_scop.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "tc/core/check.h" +#include "tc/core/flags.h" +#include "tc/core/functional.h" +#include "tc/core/polyhedral/codegen_llvm.h" +#include "tc/core/polyhedral/exceptions.h" +#include "tc/core/polyhedral/llvm_jit.h" +#include "tc/core/polyhedral/schedule_transforms.h" +#include "tc/core/polyhedral/schedule_utils.h" +#include "tc/core/polyhedral/scop.h" + +#include + +namespace tc { +namespace polyhedral { +namespace cpu { + +std::unique_ptr MappedScop::codegen( + const std::string& specializedName) const { + std::unique_ptr jit(new Jit()); + jit->codegenScop(specializedName, *scop_); + return jit; +} + +std::unique_ptr MappedScop::makeSequential( + std::unique_ptr&& scopUPtr, + const CpuMappingOptions& cpuOptions) { + using namespace polyhedral::detail; + + const auto& generic = cpuOptions.generic; + auto mappedScop = std::unique_ptr( + new MappedScop(std::move(scopUPtr), generic.proto.unroll())); + auto& scop = mappedScop->scop_; + + // 1a. Optionally specialize before scheduling... + if (generic.proto.fix_parameters_before_scheduling()) { + scop->specializeToContext(); + } + + // 2. Schedule + scop = Scop::makeScheduled(*scop, generic.outerScheduleOptions); + + // 3. Tile + TC_CHECK_LT(0u, generic.tiling.size()) + << "Must pass tile vector with >= 1 tile sizes"; + auto outerBand = scop->tileOuterBand(generic.tiling); + + // 4. Optionally reschedule if point loops need a different strategy than + // tile loops + if (generic.outerScheduleOptions != generic.intraTileScheduleOptions) { + scop->reschedule(outerBand->child({0}), generic.intraTileScheduleOptions); + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "After intra-tile rescheduling:" << std::endl + << *mappedScop->schedule(); + } + + // 1b. ...or after rescheduling + if (!generic.proto.fix_parameters_before_scheduling()) { + scop->specializeToContext(); + } + + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "After sequential strategy:" << std::endl + << *mappedScop->schedule(); + + return mappedScop; +} + +} // namespace cpu +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/polyhedral/cpu/mapped_scop.h b/tc/core/polyhedral/cpu/mapped_scop.h new file mode 100644 index 000000000..9a41e0765 --- /dev/null +++ b/tc/core/polyhedral/cpu/mapped_scop.h @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include +#include +#include +#include + +#include "tc/core/cpu/cpu_mapping_options.h" +#include "tc/core/polyhedral/llvm_jit.h" +#include "tc/core/polyhedral/scop.h" +#include "tc/core/tensor.h" +#include "tc/external/isl.h" + +namespace tc { +namespace polyhedral { +namespace cpu { + +class MappedScop { + private: + MappedScop(std::unique_ptr&& scop, uint64_t unroll_) + : scop_(std::move(scop)), unroll(unroll_) {} + + public: + static std::unique_ptr makeSequential( + std::unique_ptr&& scopUPtr, + const CpuMappingOptions& mappingOptions); + + // Fix the values of the specified parameters in the context + // to the corresponding specified values. + template + void fixParameters(const std::unordered_map& sizes) { + scop_->fixParameters(sizes); + } + + // Generate code at the current state of transformation provided a + // name for the generated function. + std::unique_ptr codegen(const std::string& specializedName) const; + + // Accessors.. + // Const accessor to schedule of underlying Scop. + inline const detail::ScheduleTree* schedule() const { + return scop_->scheduleRoot(); + } + // Reference to underlying scop, no ownership transfer intended. + inline const Scop& scop() const { + return *scop_; + } + inline Scop& scop() { + return *scop_; + } + + private: + std::unique_ptr scop_; + + public: + const uint64_t unroll; +}; + +} // namespace cpu +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/polyhedral/cuda/codegen.cc b/tc/core/polyhedral/cuda/codegen.cc index dede76d5d..606cd235c 100644 --- a/tc/core/polyhedral/cuda/codegen.cc +++ b/tc/core/polyhedral/cuda/codegen.cc @@ -31,14 +31,51 @@ #include "tc/core/polyhedral/memory_promotion.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" +#include "tc/core/polyhedral/scop.h" using namespace std; +using tc::polyhedral::detail::ScheduleTreeContext; +using tc::polyhedral::detail::ScheduleTreeDomain; +using tc::polyhedral::detail::toIslSchedule; + namespace tc { namespace polyhedral { +namespace cuda { namespace { +static std::string halideTypeString(const Halide::Type& t) { + if (t.is_bool()) { + return "bool"; + } else if (t.is_int() && t.bits() == 8) { + return "char"; + } else if (t.is_int() && t.bits() == 16) { + return "short"; + } else if (t.is_int() && t.bits() == 32) { + return "int"; + } else if (t.is_int() && t.bits() == 64) { + return "long"; + } else if (t.is_uint() && t.bits() == 8) { + return "unsigned char"; + } else if (t.is_uint() && t.bits() == 16) { + return "unsigned short"; + } else if (t.is_uint() && t.bits() == 32) { + return "unsigned int"; + } else if (t.is_uint() && t.bits() == 64) { + return "unsigned long"; + } else if (t.is_float() && t.bits() == 16) { + return "half"; + } else if (t.is_float() && t.bits() == 32) { + return "float"; + } else if (t.is_float() && t.bits() == 64) { + return "double"; + } + std::stringstream ss; + ss << t; + return ss.str(); +} + struct WS { static thread_local int n; WS() { @@ -102,7 +139,7 @@ vector emitParams(const Scop& scop) { // Halide params. One of these two vectors will be empty. for (auto p : scop.halide.params) { stringstream ss; - ss << p.type() << " " << p.name(); + ss << halideTypeString(p.type()) << " " << p.name(); res.push_back(ss.str()); } return res; @@ -113,7 +150,7 @@ string emitTypedTensorName( Halide::OutputImageParam t, bool constInput = false) { stringstream ss; - ss << (constInput ? "const " : "") << t.type() << "* " + ss << (constInput ? "const " : "") << halideTypeString(t.type()) << "* " << makePointerName(t.name()); return ss.str(); } @@ -195,11 +232,11 @@ void emitTensorView( ssViewType << "[" << extent << "]"; } ss << ws.tab(); - ss << (constInput ? "const " : "") << p.type() << " (*" << p.name() << ")" - << ssViewType.str(); + ss << (constInput ? "const " : "") << halideTypeString(p.type()) << " (*" + << p.name() << ")" << ssViewType.str(); ss << " = "; - ss << "reinterpret_cast<" << (constInput ? "const " : "") << p.type() - << " (*)" << ssViewType.str() << ">"; + ss << "reinterpret_cast<" << (constInput ? "const " : "") + << halideTypeString(p.type()) << " (*)" << ssViewType.str() << ">"; ss << "(" << makePointerName(p.name()) << ")"; ss << ";"; ss << endl; @@ -438,7 +475,7 @@ void emitRegisterAccess( void emitGlobalAccess( isl::multi_pw_aff access, const CodegenStatementContext& context) { - LdgWrapper ldgWrapper(context, access.get_tuple_id(isl::dim_type::out)); + LdgWrapper ldgWrapper(context, access.get_range_tuple_id()); emitAccess(access, context); } } // namespace @@ -554,8 +591,8 @@ isl::multi_aff makeMultiAffAccess( << "cannot build subscript aff for a scalar"; auto domainSpace = findDomainSpaceById(context); - auto tensorSpace = domainSpace.params().named_set_from_params_id( - tensorId, subscripts.size()); + auto tensorSpace = + domainSpace.params().add_named_tuple_id_ui(tensorId, subscripts.size()); auto space = domainSpace.map_from_domain_and_range(tensorSpace); auto ma = isl::multi_aff::zero(space); @@ -581,8 +618,7 @@ void emitHalideExpr( class EmitHalide : public Halide::Internal::IRPrinter { using Halide::Internal::IRPrinter::visit; void visit(const Halide::Internal::Variable* op) { - auto pwAff = tc::polyhedral::detail::makeAffFromMappedExpr( - Halide::Expr(op), context); + auto pwAff = detail::makeAffFromMappedExpr(Halide::Expr(op), context); auto expr = context.build().expr_from(pwAff); auto s = expr.to_C_str(); if (!is_identifier_or_nonnegative_integer(expr)) { @@ -596,14 +632,28 @@ void emitHalideExpr( } else if ( op->call_type == Halide::Internal::Call::CallType::Halide || op->call_type == Halide::Internal::Call::CallType::Image) { - tc::polyhedral::detail::emitMappedTensorAccess( - op->name, op, op->args, context); + detail::emitMappedTensorAccess(op->name, op, op->args, context); } else if (op->is_intrinsic(tc2halide::kReductionUpdate)) { op->args[0].accept(this); } else { IRPrinter::visit(op); } } + void visit(const Halide::Internal::IntImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::UIntImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::FloatImm* op) { + context.ss << "(" << halideTypeString(op->type) << ")" << op->value; + } + void visit(const Halide::Internal::Cast* op) { + context.ss << "(" << halideTypeString(op->type) << ")"; + context.ss << "("; + op->value.accept(this); + context.ss << ")"; + } // TODO: handle casts const CodegenStatementContext& context; const map& substitutions; @@ -674,11 +724,10 @@ void emitMappedTensorAccess( auto access = makeMultiAffAccess(tensorId, subscripts, context); // MA :: D -> O auto promotion = promotionInfo.group->promotion(); // MA :: [S -> O] -> P - promotion = promotion.set_tuple_id(isl::dim_type::out, promotionInfo.groupId); + promotion = promotion.set_range_tuple_id(promotionInfo.groupId); auto iteratorMap = context.iteratorMap(); // PMA :: A -> D - auto schedule = - isl::map::from_union_map(promotionInfo.outerSchedule.intersect_domain( - context.domain())); // map :: D -> S + auto schedule = isl::map::from(promotionInfo.outerSchedule.intersect_domain( + context.domain())); // map :: D -> S TC_CHECK(schedule.is_single_valued()) << "expected single-valued schedule, got " << schedule; @@ -720,7 +769,7 @@ void emitTmpDecl(stringstream& ss, const Scop& scop) { auto updateId = kvp.second; auto provide = scop.halide.statements.at(updateId).as(); - ss << provide->values[0].type() << " " + ss << halideTypeString(provide->values[0].type()) << " " << makeReductionTmpName(updateId, scop) << ";" << endl; } } @@ -745,7 +794,7 @@ void emitPromotedArrayViewsHalide(stringstream& ss, const Scop& scop) { if (p.second.kind == Scop::PromotedDecl::Kind::SharedMem) { ss << "__shared__ "; } - ss << t << " " << viewName; + ss << halideTypeString(t) << " " << viewName; for (auto s : p.second.sizes) { ss << "[" << s << "]"; } @@ -785,8 +834,8 @@ string emitCudaKernel( const std::string& specializedName, const MappedScop& mscop) { // Expecting a schedule with domain root and context first child. - TC_CHECK(mscop.schedule()->as()); - TC_CHECK(mscop.schedule()->child({0})->as()); + TC_CHECK(mscop.schedule()->as()); + TC_CHECK(mscop.schedule()->child({0})->as()); const auto& scop = mscop.scop(); // Make a map of the specialized scalar parameter values @@ -814,7 +863,7 @@ string emitCudaKernel( auto expr = user.get_expr().as(); auto stmtId = expr.get_arg(0).as().get_id(); auto schedule = build.get_schedule(); - auto scheduleMap = isl::map::from_union_map(schedule); + auto scheduleMap = isl::map::from(schedule); auto nodeId = isl::id( node.get_ctx(), @@ -830,7 +879,7 @@ string emitCudaKernel( return collectIteratorMaps(n, b, &nodeInfoMap); }; - auto schedule = detail::toIslSchedule(mscop.schedule()); + auto schedule = toIslSchedule(mscop.schedule()); auto astBuild = isl::ast_build(schedule.get_ctx()); astBuild = astBuild.set_at_each_domain(collect); auto root = mscop.schedule(); @@ -844,5 +893,6 @@ string emitCudaKernel( return ss.str(); } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/codegen.h b/tc/core/polyhedral/cuda/codegen.h index d2d0a8955..7ae34b4dc 100644 --- a/tc/core/polyhedral/cuda/codegen.h +++ b/tc/core/polyhedral/cuda/codegen.h @@ -26,6 +26,7 @@ namespace tc { namespace polyhedral { +namespace cuda { struct CodegenContext; struct CodegenStatementContext; @@ -114,7 +115,7 @@ struct CodegenStatementContext : CodegenContext { return this->nodeInfoMap.at(astNodeId).build; } isl::id statementId() const { - return this->iteratorMap().get_tuple_id(isl::dim_type::out); + return this->iteratorMap().get_range_tuple_id(); } isl::set domain() const { return isl::map::from(this->iteratorMap()).range(); @@ -146,5 +147,6 @@ std::string emitCudaKernel( const std::string& specializedName, const MappedScop& scop); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/mapped_scop.cc b/tc/core/polyhedral/cuda/mapped_scop.cc index 95a401596..930c92aa3 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.cc +++ b/tc/core/polyhedral/cuda/mapped_scop.cc @@ -26,13 +26,13 @@ #include "tc/core/check.h" #include "tc/core/cuda/cuda_libraries.h" #include "tc/core/flags.h" +#include "tc/core/functional.h" #include "tc/core/gpu.h" #include "tc/core/polyhedral/cuda/codegen.h" #include "tc/core/polyhedral/cuda/mapping_types.h" #include "tc/core/polyhedral/cuda/memory_promotion_heuristic.h" #include "tc/core/polyhedral/cuda/tighten_launch_bounds.h" #include "tc/core/polyhedral/exceptions.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/schedule_transforms.h" #include "tc/core/polyhedral/schedule_tree_matcher.h" #include "tc/core/polyhedral/schedule_utils.h" @@ -43,15 +43,47 @@ #include +using tc::polyhedral::detail::ScheduleTree; +using tc::polyhedral::detail::ScheduleTreeBand; +using tc::polyhedral::detail::ScheduleTreeContext; +using tc::polyhedral::detail::ScheduleTreeSequence; + namespace tc { namespace polyhedral { +namespace cuda { namespace { +/* + * Check if the minimum of any affine function in "list" is strictly + * positive on "domain" and, if so, print a warning. + * The functions in "list" are used for mapping to block/thread identifiers. + * If the minimum is strictly positive, then this means some + * identifiers do nothing in the corresponding subtree. + * Note that tightenLaunchBounds (if extended to consider + * the minimal value of the mapping) may not help much because + * those identifiers may get used in other parts of the tree. + * Furthermore, at that point it is too late to change the mapping. + * + * Also double check that the minimum is non-negative. + * This should always be the case since the affine functions in "list" + * are all the result of a modulo operation. + * A value of NaN means that the domain is empty. + */ +static void checkMinimum(isl::union_set domain, isl::union_pw_aff_list list) { + for (auto upa : list) { + upa = upa.intersect_domain(domain); + auto min = upa.min_val(); + TC_CHECK(min.is_nonneg()) << "mapping to negative block/thread" << min; + LOG_IF(WARNING, min.is_pos()) + << "Opportunity for shifting mapping -> min:" << min; + } +} + template inline void throwIfHasPattern( ScheduleTreeMatcher matcher, - const detail::ScheduleTree* root) { + const ScheduleTree* root) { auto candidates = match(matcher, root); if (candidates.size() > 0) { std::stringstream ss; @@ -61,7 +93,7 @@ inline void throwIfHasPattern( } } -void validate(const detail::ScheduleTree* root) { +void validate(const ScheduleTree* root) { throwIfHasPattern( filter( [](isl::union_set uset) { return !uset || uset.is_empty(); }, any()), @@ -72,7 +104,7 @@ void validate(const detail::ScheduleTree* root) { root); } -bool anyNonCoincidentMember(const detail::ScheduleTreeBand* band) { +bool anyNonCoincidentMember(const ScheduleTreeBand* band) { return band->nOuterCoincident() < band->nMember(); } @@ -103,15 +135,14 @@ const CudaDim& mappingSize(const MappedScop* mscop) { // Return a pointer to the updated node (below the inserted filter) // for call chaining purposes. template -detail::ScheduleTree* MappedScop::map( - detail::ScheduleTree* tree, - isl::union_pw_aff_list list) { +ScheduleTree* MappedScop::map(ScheduleTree* tree, isl::union_pw_aff_list list) { size_t nToMap = list.size(); const auto& extent = mappingSize(this).view; TC_CHECK_LE(nToMap, extent.size()) << "dimension overflow"; auto root = scop_->scheduleRoot(); - auto domain = activeDomainPoints(root, tree).universe(); + auto domain = activeDomainPoints(root, tree); + auto universe = domain.universe(); std::vector idList; auto affList = isl::union_pw_aff_list(list.get_ctx(), 0); @@ -119,7 +150,7 @@ detail::ScheduleTree* MappedScop::map( auto id = MappingTypeId::makeId(i); auto upa = list.get_at(i); TC_CHECK_NE(extent[i], 0u) << "NYI: mapping to 0"; - upa = upa.mod_val(isl::val(tree->ctx_, extent[i])); + upa = upa.mod(isl::val(tree->ctx_, extent[i])); affList = affList.add(upa); idList.emplace_back(id); } @@ -127,20 +158,20 @@ detail::ScheduleTree* MappedScop::map( for (size_t i = nToMap; i < extent.size(); ++i) { auto id = MappingTypeId::makeId(i); affList = affList.add( - isl::union_pw_aff(domain, isl::val::zero(domain.get_ctx()))); + isl::union_pw_aff(universe, isl::val::zero(domain.get_ctx()))); idList.emplace_back(id); } - auto mapping = detail::ScheduleTree::makeMapping(idList, affList); + checkMinimum(domain, affList); + + auto mapping = ScheduleTree::makeMapping(idList, affList); tree = insertNodeAbove(root, tree, std::move(mapping))->child({0}); return tree; } -detail::ScheduleTree* MappedScop::mapBlocksForward( - detail::ScheduleTree* band, - size_t nToMap) { - auto bandNode = band->as(); +ScheduleTree* MappedScop::mapBlocksForward(ScheduleTree* band, size_t nToMap) { + auto bandNode = band->as(); TC_CHECK(bandNode) << "expected a band, got " << *band; auto list = bandNode->mupa_.get_union_pw_aff_list(); @@ -151,7 +182,7 @@ detail::ScheduleTree* MappedScop::mapBlocksForward( // Uses as many blockSizes elements as outer coincident dimensions in the // outermost band void MappedScop::mapToBlocksAndScaleBand( - detail::ScheduleTree* band, + ScheduleTree* band, std::vector tileSizes) { using namespace tc::polyhedral::detail; @@ -176,16 +207,13 @@ namespace { * the remaining thread identifiers starting at "begin" to zero. * Add a marker underneath that marks the subtree that is thread specific. */ -void fixThreadsBelow( - MappedScop& mscop, - detail::ScheduleTree* tree, - size_t begin) { +void fixThreadsBelow(MappedScop& mscop, ScheduleTree* tree, size_t begin) { size_t end = mscop.numThreads.view.size(); if (begin == end) { return; } - auto band = detail::ScheduleTree::makeEmptyBand(mscop.scop().scheduleRoot()); + auto band = ScheduleTree::makeEmptyBand(mscop.scop().scheduleRoot()); auto bandTree = insertNodeBelow(tree, std::move(band)); mscop.mapThreadsBackward(bandTree); } @@ -197,10 +225,7 @@ void fixThreadsBelow( * Anything that depends on an update statement is ordered after * the update statements. Anything else is ordered before. */ -bool separatedOut( - Scop& scop, - detail::ScheduleTree* tree, - isl::union_set updates) { +bool separatedOut(Scop& scop, ScheduleTree* tree, isl::union_set updates) { auto domain = activeDomainPoints(scop.scheduleRoot(), tree); auto other = domain.subtract(updates); if (other.is_empty()) { @@ -225,7 +250,7 @@ bool separatedOut( } // namespace -bool MappedScop::detectReductions(detail::ScheduleTree* tree) { +bool MappedScop::detectReductions(ScheduleTree* tree) { // Do not bother with reductions if block is of size 1 in the x direction. if (numThreads.view.size() == 0 || numThreads.view[0] == 1) { return false; @@ -235,7 +260,7 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) { for (auto c : tree->children()) { found |= detectReductions(c); } - auto band = tree->as(); + auto band = tree->as(); // Nested reductions are not currently supported. if (!band || found) { return found; @@ -285,7 +310,7 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) { return true; } -bool MappedScop::needReductionSeparation(const detail::ScheduleTree* st) { +bool MappedScop::needReductionSeparation(const ScheduleTree* st) { if (reductionBandUpdates_.count(st) != 1) { return false; } @@ -294,9 +319,9 @@ bool MappedScop::needReductionSeparation(const detail::ScheduleTree* st) { } isl::multi_union_pw_aff MappedScop::reductionMapSchedule( - const detail::ScheduleTree* st) { + const ScheduleTree* st) { TC_CHECK(reductionBandUpdates_.count(st) == 1); - auto reductionBand = st->as(); + auto reductionBand = st->as(); TC_CHECK(reductionBand); auto nMember = reductionBand->nMember(); @@ -308,7 +333,7 @@ isl::multi_union_pw_aff MappedScop::reductionMapSchedule( return reductionBand->memberRange(first, nMappedThreads); } -detail::ScheduleTree* MappedScop::separateReduction(detail::ScheduleTree* st) { +ScheduleTree* MappedScop::separateReduction(ScheduleTree* st) { auto reduction = st; // This function either separates full blocks (if needed) or // disables the reduction handling. @@ -357,23 +382,22 @@ detail::ScheduleTree* MappedScop::separateReduction(detail::ScheduleTree* st) { return st->ancestor(root, 2); } -detail::ScheduleTree* MappedScop::mapThreadsBackward( - detail::ScheduleTree* band) { - auto bandNode = band->as(); +ScheduleTree* MappedScop::mapThreadsBackward(ScheduleTree* band) { + auto bandNode = band->as(); TC_CHECK(bandNode); auto nMember = bandNode->nMember(); auto nToMap = std::min(nMember, numThreads.view.size()); TC_CHECK_LE(nToMap, 3u) << "mapping to too many threads"; auto ctx = band->ctx_; - insertNodeBelow(band, detail::ScheduleTree::makeThreadSpecificMarker(ctx)); + insertNodeBelow(band, ScheduleTree::makeThreadSpecificMarker(ctx)); auto list = bandNode->mupa_.get_union_pw_aff_list().reverse(); list = list.drop(nToMap, list.size() - nToMap); return map(band, list); } -size_t MappedScop::mapToThreads(detail::ScheduleTree* band) { +size_t MappedScop::mapToThreads(ScheduleTree* band) { using namespace tc::polyhedral::detail; auto bandNode = band->as(); @@ -444,17 +468,15 @@ namespace { * That is, assuming "st" is a sequence node, does the last child * need to be protected from the next iteration of the first child? */ -bool hasOuterSequentialMember( - const detail::ScheduleTree* root, - detail::ScheduleTree* st) { +bool hasOuterSequentialMember(const ScheduleTree* root, ScheduleTree* st) { auto ancestors = st->ancestors(root); std::reverse(ancestors.begin(), ancestors.end()); for (auto a : ancestors) { - auto band = a->as(); + auto band = a->as(); if (band && band->nMember() > band->nOuterCoincident()) { return true; } - if (a->as()) { + if (a->as()) { return false; } } @@ -485,8 +507,8 @@ isl::multi_aff constructThreadToWarp( const Block& block) { auto space = isl::space(ctx, 0); auto id = isl::id(ctx, kBlock); - auto blockSpace = space.named_set_from_params_id(id, block.view.size()); - auto warpSpace = space.named_set_from_params_id(isl::id(ctx, kWarp), 1); + auto blockSpace = space.add_named_tuple_id_ui(id, block.view.size()); + auto warpSpace = space.add_named_tuple_id_ui(isl::id(ctx, kWarp), 1); auto aff = isl::aff::zero_on_domain(blockSpace); auto nThread = block.view.size(); @@ -503,7 +525,7 @@ isl::multi_aff constructThreadToWarp( } // namespace isl::multi_union_pw_aff MappedScop::threadMappingSchedule( - const detail::ScheduleTree* tree) const { + const ScheduleTree* tree) const { std::vector ids; for (size_t i = 0; i < numThreads.view.size(); ++i) { ids.emplace_back(mapping::ThreadId::makeId(i)); @@ -513,7 +535,7 @@ isl::multi_union_pw_aff MappedScop::threadMappingSchedule( } isl::multi_union_pw_aff MappedScop::blockMappingSchedule( - const detail::ScheduleTree* tree) const { + const ScheduleTree* tree) const { std::vector ids; for (size_t i = 0; i < numBlocks.view.size(); ++i) { ids.emplace_back(mapping::BlockId::makeId(i)); @@ -523,8 +545,8 @@ isl::multi_union_pw_aff MappedScop::blockMappingSchedule( } Scop::SyncLevel MappedScop::findBestSync( - detail::ScheduleTree* st1, - detail::ScheduleTree* st2, + ScheduleTree* st1, + ScheduleTree* st2, isl::multi_union_pw_aff domainToThread, isl::multi_union_pw_aff domainToWarp) { // Active points in the two schedule trees @@ -542,9 +564,9 @@ Scop::SyncLevel MappedScop::findBestSync( TC_CHECK_LE(1u, scop_->scheduleRoot()->children().size()); auto contextSt = scop_->scheduleRoot()->children()[0]; - auto contextElem = contextSt->as(); + auto contextElem = contextSt->as(); TC_CHECK(nullptr != contextElem); - dependences = dependences.intersect_params(contextElem->context_); + dependences = dependences.intersect_params(contextElem->context_.params()); if (dependences.is_subset(dependences.eq_at(domainToThread))) { return Scop::SyncLevel::None; @@ -704,8 +726,8 @@ std::vector> MappedScop::findBestSyncConfigInSeq( return solutionWithBestBegining; } -void MappedScop::insertBestSyncInSeq(detail::ScheduleTree* seq) { - TC_CHECK(seq->as()); +void MappedScop::insertBestSyncInSeq(ScheduleTree* seq) { + TC_CHECK(seq->as()); auto children = seq->children(); auto nChildren = children.size(); @@ -767,7 +789,7 @@ void MappedScop::insertBestSyncInSeq(detail::ScheduleTree* seq) { // the next iteration of the first child if there may be such // a next iteration that is not already covered by synchronization // on an outer node. -size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { +size_t MappedScop::mapInnermostBandsToThreads(ScheduleTree* st) { if (needReductionSeparation(st)) { st = separateReduction(st); } @@ -779,7 +801,7 @@ size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { } auto n = nChildren > 0 ? *std::max_element(nInner.begin(), nInner.end()) : 0; if (nChildren > 1) { - auto needSync = st->as() && n > 0; + auto needSync = st->as() && n > 0; if (n > 0) { for (size_t i = 0; i < nChildren; ++i) { fixThreadsBelow(*this, children[i], nInner[i]); @@ -790,7 +812,7 @@ size_t MappedScop::mapInnermostBandsToThreads(detail::ScheduleTree* st) { } } - if (auto band = st->as()) { + if (auto band = st->as()) { if (n == 0) { // If children were not mapped to threads, the current band can be mapped. // First, map the coincidence and reduction dimension to threads. @@ -840,7 +862,7 @@ void MappedScop::insertMappingContext() { {TX, TX.mappingSize(block)}, {TY, TY.mappingSize(block)}, {TZ, TZ.mappingSize(block)}}; - auto space = scop.domain().universe().get_space(); + auto space = scop.domain().get_space(); auto mappingContext = makeParameterContext( space, mappingIdsWithSizes.begin(), mappingIdsWithSizes.end()); updateTopLevelContext(scop.scheduleRoot(), mappingContext.from_params()); @@ -877,7 +899,7 @@ std::unique_ptr makeSpecializedMappedScop( tc::Grid grid = mappedScop.numBlocks; tc::Block block = mappedScop.numThreads; - std::tie(grid, block) = tightenLaunchBounds(*scop, grid, block); + std::tie(grid, block) = tightenLaunchBounds(mappedScop, grid, block); auto res = MappedScop::makeMappedScop( std::move(scop), grid, @@ -928,8 +950,8 @@ std::tuple MappedScop::codegen( // Split out a single reduction tile (in the directions other than // the reduction) and insert reduction synchronizations outside this tile. // Return a pointer to the split off tile. -detail::ScheduleTree* MappedScop::splitOutReductionTileAndInsertSyncs( - detail::ScheduleTree* band) { +ScheduleTree* MappedScop::splitOutReductionTileAndInsertSyncs( + ScheduleTree* band) { using namespace polyhedral::detail; size_t n = numThreads.view.size(); @@ -1020,8 +1042,9 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( LOG_IF(INFO, FLAGS_debug_tc_mapper) << "After mapping to blocks:" << std::endl << *mappedScop->schedule(); - // 8. Promote to shared memory below the loops mapped to blocks. - // This may split the outer band, so find the new outer band after promotion. + // 8. Promote to shared memory. + // If shared promotion depth is specified in the mapping options, use the + // specified value. Otherwise, promote below the loops mapped to blocks. if (cudaOptions.proto().use_shared_memory()) { size_t sharedMemorySize = cudaOptions.proto().has_max_shared_memory() ? cudaOptions.proto().max_shared_memory() @@ -1040,29 +1063,24 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( sharedMemorySize -= reductionMemoryRequirement; } - auto band = outerBand->as(); - LOG_IF(WARNING, FLAGS_debug_tc_mapper && band->nMember() == 0) - << "Aborting memory promotion because outer band has 0 members (NYI)"; - if (band->nMember() > 0 && sharedMemorySize > 0) { + if (sharedMemorySize > 0) { LOG_IF( WARNING, cudaOptions.proto().unroll_copy_shared() && !generic.proto.has_unroll()) << "requested to unroll copies to shared memory without providing the unroll size"; - promoteGreedilyAtDepth( + auto depth = cudaOptions.proto().has_shared_depth() + ? cudaOptions.proto().shared_depth() + : std::min( + outerBand->as()->nOuterCoincident(), + mappedScop->numBlocks.view.size()); + promoteToSharedAtDepth( *mappedScop, - std::min(band->nOuterCoincident(), mappedScop->numBlocks.view.size()), + depth, sharedMemorySize, cudaOptions.proto().unroll_copy_shared() && generic.proto.has_unroll()); - - auto bands = ScheduleTree::collectDFSPreorder( - scop->scheduleRoot(), ScheduleTreeType::Band); - if (bands.size() == 0) { // Sanity check. - throw NoBandsException("no bands after promotion"); - } - outerBand = bands[0]; } } @@ -1078,5 +1096,6 @@ std::unique_ptr MappedScop::makeWithOuterBlockInnerThreadStrategy( return mappedScop; } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/mapped_scop.h b/tc/core/polyhedral/cuda/mapped_scop.h index 79399ae35..47aef39c6 100644 --- a/tc/core/polyhedral/cuda/mapped_scop.h +++ b/tc/core/polyhedral/cuda/mapped_scop.h @@ -30,6 +30,11 @@ namespace tc { namespace polyhedral { +namespace detail { +class ScheduleTree; +} // namespace detail + +namespace cuda { // Scop associated with fixed block and grid dimensions. // @@ -256,5 +261,7 @@ class MappedScop { // about the detected reduction. std::map reductionBandUpdates_; }; + +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc index b7b85fb95..928ee904a 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.cc @@ -33,6 +33,7 @@ namespace tc { namespace polyhedral { +namespace cuda { namespace { // Map global<->shared copy bands to threads, starting from the innermost @@ -132,60 +133,6 @@ std::vector collectBranchMarkers(T root, T node) { return findThreadSpecificMarkers(node); } -/* - * Transform schedule bands into a union_map. - * Takes all partial schedules at leaves as MUPAs (without accounting for - * intermediate non-band nodes), intersects - * their domain with the filters between the root and the - * current leaves and transforms them into union maps. - * Mapping filters are ignored. - */ -isl::union_map fullSchedule(const detail::ScheduleTree* root) { - using namespace tc::polyhedral::detail; - - if (!root->as()) { - throw promotion::PromotionLogicError("expected root to be a domain node"); - } - - std::function isLeaf = - [](const ScheduleTree* tree) { return tree->numChildren() == 0; }; - - // Find all innermost nodes. - auto leaves = functional::Filter(isLeaf, ScheduleTree::collect(root)); - - // Take a union of partial schedules of the innermost nodes. Because they - // are innermost, the partial schedule can no longer be affected by deeper - // nodes and hence is full. - auto schedule = isl::union_map::empty( - root->as()->domain_.get_space()); - for (auto node : leaves) { - auto domain = root->as()->domain_; - auto prefixMupa = prefixScheduleMupa(root, node); - if (auto band = node->as()) { - prefixMupa = prefixMupa.flat_range_product(band->mupa_); - } - - auto pathToRoot = node->ancestors(root); - pathToRoot.push_back(node); - for (auto n : pathToRoot) { - if (auto filterNode = n->as()) { - domain = domain.intersect(filterNode->filter_); - } - } - - prefixMupa = prefixMupa.intersect_domain(domain); - - schedule = schedule.unite(isl::union_map::from(prefixMupa)); - if (!schedule.is_single_valued()) { - std::stringstream ss; - ss << "schedules must be single-valued " << schedule << std::endl - << *root; - throw promotion::PromotionLogicError(ss.str()); - } - } - return schedule; -} - /* * Check if a reference group features reuse within the "outer" schedule. * In particular, check that for some given point in the outer schedule and @@ -264,8 +211,7 @@ const detail::ScheduleTree* findThreadMappingAncestor( bool promotionImprovesCoalescing( const detail::ScheduleTree* root, const detail::ScheduleTree* node, - const TensorReferenceGroup& group, - isl::union_map schedule) { + const TensorReferenceGroup& group) { auto originalAccesses = group.originalAccesses(); auto tensorDim = group.approximation.dim(); @@ -279,8 +225,9 @@ bool promotionImprovesCoalescing( auto depth = marker->scheduleDepth(root); auto activePoints = activeDomainPoints(root, mapping); auto localAccesses = originalAccesses.intersect_domain(activePoints); + auto schedule = prefixSchedule(root, marker); auto scheduledAccesses = localAccesses.apply_domain(schedule); - for (auto access : isl::UnionAsVector(scheduledAccesses)) { + for (auto access : scheduledAccesses.get_map_list()) { auto scheduleSpace = access.get_space().domain(); auto tensorSpace = access.get_space().range(); auto elementToNext = makeNextElementMap(tensorSpace, tensorDim - 1); @@ -383,8 +330,8 @@ bool accessSubscriptsAreUnrolledLoops( } } - auto space = isl::space(leaf->ctx_, 0, unrolledDims.size()) - .align_params(subdomain.get_space()); + auto space = + subdomain.get_space().add_unnamed_tuple_ui(unrolledDims.size()); auto unrolledDimsMupa = isl::multi_union_pw_aff(space, unrolledDims); // It is possible that no loops are unrolled, in which case @@ -484,129 +431,126 @@ std::vector bandsSplitAfterDepth( } /* - * For every place in the schedule tree where schedule depth (i.e., the number - * of preceding band members) is "depth", promote tensor reference groups to - * shared memory. Split bands if necessary to insert promotions. - * - * Use at most "maxMemory" bytes. If a groups does not fit the remaining - * memory, do not promote it and keep looking for a smaller group. - * - * Only promote if the tensor elements referenced by the group are reused or - * accessed in a non-coalesced way. + * Check if "node" or any of its ancestors until "root" are thread mappings. */ -void promoteToSharedGreedy( - Scop& scop, - const Block& block, - size_t depth, - size_t maxMemory) { - using namespace tc::polyhedral::detail; - - if (depth == 0) { - throw promotion::PromotionNYI("promotion before any band"); +bool isInThreadMappedScope( + const detail::ScheduleTree* root, + const detail::ScheduleTree* node) { + auto ancestors = node->ancestors(root); + ancestors.push_back(node); + for (auto ancestor : ancestors) { + if (isMappingTo(ancestor)) { + return true; + } } + return false; +} +/* + * Promote to shared memory in "scop" below "node". Use at most + * "remainingMemory" bytes, and update the variable to reflect the amount of + * available shared memory remaining after promotion. + */ +void promoteToSharedBelow( + Scop& scop, + detail::ScheduleTree* node, + size_t& remainingMemory) { auto root = scop.scheduleRoot(); - // 1. Collect all bands with a member located at the given depth in the - // overall schedule. Make sure this is the last member of the band by - // splitting off the subsequent members into a different band. - auto bands = bandsContainingScheduleDepth(root, depth); - bands = bandsSplitAfterDepth(bands, root, depth); + // Promotion to shared below threads does not make sense because the computed + // groups would be specific to threads thus not benefiting from coalescing or + // inter-thread communication through shared memory (use registers instead). + if (isInThreadMappedScope(root, node)) { + throw promotion::IncorrectScope( + "shared memory promotion below thread mapping"); + } + // Children of a sequence/set band must be filters, but promotion would + // insert an extension node. + if (node->as() || + node->as()) { + throw promotion::IncorrectScope("cannot promote below a sequence/set node"); + } - // 2. Compute full schedule without mapping filters. The filters would make - // it impossible to test for coalescing by incrementing a member of a band as - // only the values divisible by grid or block size pass through the filter. - auto fullSched = fullSchedule(root); + auto partialSched = partialSchedule(root, node); + auto mapping = collectMappingsTo(scop); - // 3. For each band that ends at "depth", take decisions about promotion - // immediately below it in the tree. In particular, promote if the - // approximated footprint fits into the remaining memory, and the reference - // group either features reuse or is accessed in a non-coalesced way, or - // both. - size_t remainingMemory = maxMemory; - for (auto bandNode : bands) { - auto activePoints = activeDomainPoints(root, bandNode); - auto partialSched = partialSchedule(root, bandNode); - - auto groupMap = TensorReferenceGroup::accessedWithin( - partialSched.intersect_domain(activePoints), scop.body); - // Pure affine schedule without (mapping) filters. - auto partialSchedMupa = partialScheduleMupa(root, bandNode); - - // Prepare groups for sorting, to have specified order necessary for - // reproducibility and tests. - using TensorGroupList = std::pair; - std::vector groupLists( - std::make_move_iterator(groupMap.begin()), - std::make_move_iterator(groupMap.end())); - - // Computes the total number of references in all groups. - auto refsCount = [](const TensorGroupsInfo& info) { - size_t refs = 0; - for (auto const& group : info) { - refs += group->referenceIds().size(); - } - return refs; - }; + auto groupMap = TensorReferenceGroup::accessedWithin( + partialSched.intersect_domain(mapping), scop.body); + // Pure affine schedule without (mapping) filters. + auto partialSchedMupa = partialScheduleMupa(root, node); + + // Prepare groups for sorting, to have specified order necessary for + // reproducibility and tests. + using TensorGroupList = std::pair; + std::vector groupLists( + std::make_move_iterator(groupMap.begin()), + std::make_move_iterator(groupMap.end())); + + // Computes the total number of references in all groups. + auto refsCount = [](const TensorGroupsInfo& info) { + size_t refs = 0; + for (auto const& group : info) { + refs += group->referenceIds().size(); + } + return refs; + }; - // Sort by the total number of references, then by name. Because names are - // guarenteed to be unique, the order is total. + // Sort by the total number of references, then by name. Because names are + // guarenteed to be unique, the order is total. + std::sort( + groupLists.begin(), + groupLists.end(), + [refsCount](const TensorGroupList& l1, const TensorGroupList& l2) { + auto r1 = refsCount(l1.second); + auto r2 = refsCount(l2.second); + return r1 == r2 ? l1.first.get_name() < l2.first.get_name() : r1 < r2; + }); + for (auto& tensorGroups : groupLists) { + auto tensorId = tensorGroups.first; + // Sort the reference groups to prioritize groups with more references as + // they are more likely to benefit from promotion. std::sort( - groupLists.begin(), - groupLists.end(), - [refsCount](const TensorGroupList& l1, const TensorGroupList& l2) { - auto r1 = refsCount(l1.second); - auto r2 = refsCount(l2.second); - return r1 == r2 ? l1.first.get_name() < l2.first.get_name() : r1 < r2; + tensorGroups.second.begin(), + tensorGroups.second.end(), + [refsCount]( + const std::unique_ptr& group1, + const std::unique_ptr& group2) { + return group1->referenceIds().size() > group2->referenceIds().size(); }); - for (auto& tensorGroups : groupLists) { - auto tensorId = tensorGroups.first; - // Sort the reference groups to prioritize groups with more references as - // they are more likely to benefit from promotion. - std::sort( - tensorGroups.second.begin(), - tensorGroups.second.end(), - [refsCount]( - const std::unique_ptr& group1, - const std::unique_ptr& group2) { - return group1->referenceIds().size() > - group2->referenceIds().size(); - }); - - for (auto& group : tensorGroups.second) { - auto sizes = group->approximationSizes(); - if (sizes.size() == 0) { - throw promotion::PromotionLogicError("cannot promote a scalar"); - } - if (sizes.back() % 2 == 0) { - sizes.back() += 1; - } - auto nApproximationElements = std::accumulate( - sizes.begin(), sizes.end(), 1, std::multiplies()); - size_t memoryRequirement = - nApproximationElements * scop.findArgument(tensorId).type().bytes(); - if (memoryRequirement > remainingMemory) { - continue; - } - // Do not promote if the group features no reuse and is accessed in a - // coalesced way. - if (!hasReuseWithin(*group, partialSchedMupa) && - !promotionImprovesCoalescing(root, bandNode, *group, fullSched)) { - continue; - } - scop.promoteGroup( - Scop::PromotedDecl::Kind::SharedMem, - tensorId, - std::move(group), - bandNode, - partialSched, - true); - remainingMemory -= memoryRequirement; + for (auto& group : tensorGroups.second) { + auto sizes = group->approximationSizes(); + if (sizes.size() == 0) { + throw promotion::PromotionLogicError("cannot promote a scalar"); + } + if (sizes.back() % 2 == 0) { + sizes.back() += 1; + } + auto nApproximationElements = std::accumulate( + sizes.begin(), sizes.end(), 1, std::multiplies()); + size_t memoryRequirement = + nApproximationElements * scop.findArgument(tensorId).type().bytes(); + if (memoryRequirement > remainingMemory) { + continue; } + // Do not promote if the group features no reuse and is accessed in a + // coalesced way. + if (!hasReuseWithin(*group, partialSchedMupa) && + !promotionImprovesCoalescing(root, node, *group)) { + continue; + } + + scop.promoteGroup( + Scop::PromotedDecl::Kind::SharedMem, + tensorId, + std::move(group), + node, + partialSched, + true); + remainingMemory -= memoryRequirement; } - scop.insertSyncsAroundCopies(bandNode); } + scop.insertSyncsAroundCopies(node); } /* @@ -619,16 +563,55 @@ inline bool isThreadMappedBand(const detail::ScheduleTree* tree) { } } // namespace -void promoteGreedilyAtDepth( +/* + * For every place in the schedule tree where schedule depth (i.e., the number + * of preceding band members) is "depth", promote tensor reference groups to + * shared memory if there is no thread mapping above this place. Split bands + * if necessary to insert promotions. + * + * Use at most "maxMemory" bytes. If a groups does not fit the remaining + * memory, do not promote it and keep looking for a smaller group. + * + * Only promote if the tensor elements referenced by the group are reused or + * accessed in a non-coalesced way. + * + * If "unrollCopies" is set, use the unroll factor from "mscop" to unroll the + * loops that copy values from global to shared memory and back. + */ +void promoteToSharedAtDepth( MappedScop& mscop, size_t depth, - size_t sharedMemorySize, + size_t maxMemory, bool unrollCopies) { - // 1. Promote using heuristic. - promoteToSharedGreedy( - mscop.scop(), mscop.numThreads, depth, sharedMemorySize); + using namespace tc::polyhedral::detail; + + auto& scop = mscop.scop(); + auto root = scop.scheduleRoot(); + + // 1. Collect all bands with a member located at the given depth in the + // overall schedule. Make sure this is the last member of the band by + // splitting off the subsequent members into a different band. + auto bands = bandsContainingScheduleDepth(root, depth); + bands = bandsSplitAfterDepth(bands, root, depth); + + // 2. For each band that ends at "depth", take decisions about promotion + // immediately below it in the tree. In particular, promote if the + // approximated footprint fits into the remaining memory, and the reference + // group either features reuse or is accessed in a non-coalesced way, or + // both. Do not promote if the band node is located below the thread mapping + // as promotion to shared is not allowed in this context. + size_t remainingMemory = maxMemory; + for (auto bandNode : bands) { + if (isInThreadMappedScope(root, bandNode)) { + LOG_IF(INFO, FLAGS_debug_tc_mapper) + << "not promoting subtree to shared because it is below " + << "a thread mapping node"; + continue; + } + promoteToSharedBelow(scop, bandNode, remainingMemory); + } - // 2. Map copies to shared, state by copy + // 3. Map copies to shared. mapCopiesToThreads(mscop, unrollCopies); } @@ -778,5 +761,6 @@ void promoteToRegistersAtDepth(MappedScop& mscop, size_t depth) { } } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h index 2c2ca895d..2dc264949 100644 --- a/tc/core/polyhedral/cuda/memory_promotion_heuristic.h +++ b/tc/core/polyhedral/cuda/memory_promotion_heuristic.h @@ -22,21 +22,20 @@ namespace tc { namespace polyhedral { -class MappedScop; class Scop; namespace detail { class ScheduleTree; } +namespace cuda { +class MappedScop; + // In the given mapped scop "mscop", // promote to shared memory at "depth" until "sharedMemorySize" is used. // Map copies between global and shared memory to threads and unroll those // copies if "unrollCopies" is set, using the options in "mscop". -// "threadIdxXScheduleDepthState" contains the schedule depth at which the -// computation was mapped to thread x and is used to check whether the global -// memory is accessed in a coalesced way. -void promoteGreedilyAtDepth( +void promoteToSharedAtDepth( MappedScop& scop, std::size_t depth, std::size_t sharedMemorySize, @@ -46,5 +45,6 @@ void promoteToRegistersBelow(MappedScop& mscop, detail::ScheduleTree* scope); void promoteToRegistersAtDepth(MappedScop& scop, std::size_t depth); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc index 9dd87a2a1..5c8581120 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.cc +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.cc @@ -17,81 +17,29 @@ #include "tc/core/polyhedral/cuda/tighten_launch_bounds.h" #include "tc/core/check.h" +#include "tc/core/polyhedral/cuda/mapped_scop.h" #include "tc/core/polyhedral/cuda/mapping_types.h" #include "tc/core/polyhedral/exceptions.h" -#include "tc/core/polyhedral/functional.h" -#include "tc/core/polyhedral/schedule_tree.h" -#include "tc/core/polyhedral/schedule_utils.h" namespace tc { namespace polyhedral { +namespace cuda { namespace { -// This returns the (inclusive) range of the mapping parameter "mappingId" -// within the context "mappingContext". -// This range corresponds to the blocks/threads active at the particular -// location in the tree where this mapping is active. -// -// This is used to tighten the kernel to only launch on the necessary amount -// of resources. -// -// When the range is unbounded on the right, we return the maximal positive -// range (0, max_size_t). This needs to be intersected with launch bounds to -// obtain the proper finite range. -// Otherwise, the range is asserted bounded on the left and to lie in the -// positive half of the integer axis. -std::pair rangeOfMappingParameter( - isl::set mappingContext, - mapping::MappingId mappingId) { - if (!mappingContext.involves_param(mappingId)) { - return std::make_pair(0, std::numeric_limits::max()); - } - auto space = mappingContext.get_space(); - isl::aff a(isl::aff::param_on_domain_space(space, mappingId)); - auto max = mappingContext.max_val(a); - if (max.is_nan() || max.is_infty()) { - return std::make_pair(0, std::numeric_limits::max()); - } - TC_CHECK(max.is_int()) << max.to_str(); - TC_CHECK(max.is_nonneg()) << max.to_str(); - auto min = mappingContext.min_val(a); - TC_CHECK(min.is_int()) << max.to_str(); - TC_CHECK(min.is_nonneg()) << max.to_str(); - - return std::make_pair( - static_cast(min.get_num_si()), - static_cast(max.get_num_si())); -} - /* - * Compute the maximal value attained by the mapping parameter "id". + * Return the mapping to MappingTypeId, i.e, either the mapping to blocks or + * the mapping to threads. */ -template -size_t maxValue(const Scop& scop, const MappingIdType& id) { - using namespace polyhedral::detail; - - auto root = scop.scheduleRoot(); - auto params = scop.context(); - size_t sizetMax = std::numeric_limits::max(); - size_t max = 0; - size_t min = sizetMax; - auto filters = root->collect(root, ScheduleTreeType::Mapping); - filters = functional::Filter(isMappingTo, filters); - for (auto p : filters) { - auto mappingNode = p->as(); - auto active = activeDomainPoints(root, p).intersect_params(params); - active = active.intersect(mappingNode->filter_); - auto range = rangeOfMappingParameter(active.params(), id); - min = std::min(min, range.first); - max = std::max(max, range.second); - } - // Ignore min for now but there is a future possibility for shifting - LOG_IF(WARNING, min > 0) - << "Opportunity for tightening launch bounds with shifting -> min:" - << min; - TC_CHECK(max < sizetMax) << "missing mapping to " << id << "\n" << *root; - TC_CHECK(min < sizetMax) << "missing mapping to " << id << " type\n" << *root; - // Inclusive range needs + 1 to translate to sizes - return max + 1; +template +static isl::multi_union_pw_aff mappingSchedule(const MappedScop& mscop); +template <> +isl::multi_union_pw_aff mappingSchedule( + const MappedScop& mscop) { + return mscop.blockMappingSchedule(mscop.schedule()); +} +template <> +isl::multi_union_pw_aff mappingSchedule( + const MappedScop& mscop) { + return mscop.threadMappingSchedule(mscop.schedule()); } /* @@ -99,11 +47,20 @@ size_t maxValue(const Scop& scop, const MappingIdType& id) { * by the tightened, actual, launch bounds used in practice. */ template -Size launchBounds(const Scop& scop, Size size) { +Size launchBounds(const MappedScop& mscop, Size size) { Size tightened; + auto params = mscop.scop().context(); + auto mapping = mappingSchedule(mscop); + mapping = mapping.intersect_params(params); + auto max = mapping.max_multi_val(); + for (size_t i = 0; i < size.view.size(); ++i) { - tightened.view[i] = maxValue(scop, MappingIdType::makeId(i)); + auto maxVal = max.get_val(i); + TC_CHECK(maxVal.is_int()) << maxVal; + TC_CHECK(maxVal.is_nonneg()) << maxVal; + // Inclusive range needs + 1 to translate to sizes + tightened.view[i] = maxVal.get_num_si() + 1; } return tightened; @@ -115,12 +72,13 @@ Size launchBounds(const Scop& scop, Size size) { // computes the tightened, actual, launch bounds used in practice after // specialization of the ScheduleTree. std::pair tightenLaunchBounds( - const Scop& scop, + const MappedScop& mscop, const tc::Grid& grid, const tc::Block& block) { return std::make_pair( - launchBounds(scop, grid), - launchBounds(scop, block)); + launchBounds(mscop, grid), + launchBounds(mscop, block)); } +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/cuda/tighten_launch_bounds.h b/tc/core/polyhedral/cuda/tighten_launch_bounds.h index 89be0a8ad..e32f92db7 100644 --- a/tc/core/polyhedral/cuda/tighten_launch_bounds.h +++ b/tc/core/polyhedral/cuda/tighten_launch_bounds.h @@ -16,13 +16,15 @@ #pragma once #include "tc/core/cuda/cuda_mapping_options.h" -#include "tc/core/polyhedral/scop.h" +#include "tc/core/polyhedral/cuda/mapped_scop.h" namespace tc { namespace polyhedral { +namespace cuda { std::pair tightenLaunchBounds( - const Scop& scop, + const MappedScop& mscop, const tc::Grid& grid, const tc::Block& block); +} // namespace cuda } // namespace polyhedral } // namespace tc diff --git a/tc/core/polyhedral/llvm_jit.cc b/tc/core/polyhedral/llvm_jit.cc index 98937b0d4..ef80fb6dc 100644 --- a/tc/core/polyhedral/llvm_jit.cc +++ b/tc/core/polyhedral/llvm_jit.cc @@ -34,80 +34,12 @@ using namespace llvm; -// Parse through ldconfig to find the path of a particular -// shared library. This is an unfortunate way to have to -// find it, but I couldn't immediately find something in -// imported libraries that would resolve this for us. -std::string find_library_path(std::string library) { - std::string command = "ldconfig -p | grep " + library + " | grep x86-64"; - - FILE* fpipe = popen(command.c_str(), "r"); - - if (fpipe == nullptr) { - throw std::runtime_error("Failed to popen()"); - } - - std::string output; - char buffer[512]; - - while (1) { - int charactersRead = fread(buffer, 1, sizeof(buffer), fpipe); - if (charactersRead == 0) - break; - output += std::string(buffer, charactersRead); - } - pclose(fpipe); - - auto idx = output.rfind("=> "); - if (idx == std::string::npos) { - throw std::runtime_error("Failed locate library: " + library); - } - output = output.substr(idx + 3); - if (output.length() > 0 && output[output.length() - 1] == '\n') { - output = output.substr(0, output.length() - 1); - } - return output; -} - namespace tc { -#if LLVM_VERSION_MAJOR <= 6 Jit::Jit() - : TM_(EngineBuilder().selectTarget()), - DL_(TM_->createDataLayout()), - objectLayer_([]() { return std::make_shared(); }), - compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) { - std::string err; - - auto path = find_library_path("libcilkrts.so"); - sys::DynamicLibrary::LoadLibraryPermanently(path.c_str(), &err); - if (err != "") { - throw std::runtime_error("Failed to find cilkrts: " + err); - } -} - -void Jit::addModule(std::shared_ptr M) { - M->setTargetTriple(TM_->getTargetTriple().str()); - auto Resolver = orc::createLambdaResolver( - [&](const std::string& Name) { - if (auto Sym = compileLayer_.findSymbol(Name, false)) - return Sym; - return JITSymbol(nullptr); - }, - [](const std::string& Name) { - if (auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name)) - return JITSymbol(SymAddr, JITSymbolFlags::Exported); - return JITSymbol(nullptr); - }); - - auto res = compileLayer_.addModule(M, std::move(Resolver)); - TC_CHECK(res) << "Failed to jit compile."; -} -#else -Jit::Jit() - : SSP(), - ES(SSP), + : ES(), Resolver(llvm::orc::createLegacyLookupResolver( + ES, [this](const std::string& Name) -> JITSymbol { if (auto Sym = compileLayer_.findSymbol(Name, false)) return Sym; @@ -127,26 +59,14 @@ Jit::Jit() return llvm::orc::RTDyldObjectLinkingLayer::Resources{ std::make_shared(), Resolver}; }), - compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) { - std::string err; - - sys::DynamicLibrary::LoadLibraryPermanently(nullptr, &err); - if (err != "") { - throw std::runtime_error("Failed to find cilkrts: " + err); - } -} + compileLayer_(objectLayer_, orc::SimpleCompiler(*TM_)) {} -// Note that this copy may cause tapir tests to fail -// However, this code will never use tapir code -// and once the LLVM API churn stops, will be modified -// to be properly compatable. void Jit::addModule(std::shared_ptr M) { M->setTargetTriple(TM_->getTargetTriple().str()); auto K = ES.allocateVModule(); llvm::Error res = compileLayer_.addModule(K, CloneModule(*M)); TC_CHECK(!res) << "Failed to jit compile."; } -#endif std::shared_ptr Jit::codegenScop( const std::string& specializedName, diff --git a/tc/core/polyhedral/llvm_jit.h b/tc/core/polyhedral/llvm_jit.h index 2326dde55..75031d106 100644 --- a/tc/core/polyhedral/llvm_jit.h +++ b/tc/core/polyhedral/llvm_jit.h @@ -34,7 +34,6 @@ class Scop; class Jit { private: #if LLVM_VERSION_MAJOR > 6 - llvm::orc::SymbolStringPool SSP; llvm::orc::ExecutionSession ES; std::shared_ptr Resolver; #endif diff --git a/tc/core/polyhedral/memory_promotion.cc b/tc/core/polyhedral/memory_promotion.cc index bc01dad86..37656f09a 100644 --- a/tc/core/polyhedral/memory_promotion.cc +++ b/tc/core/polyhedral/memory_promotion.cc @@ -25,6 +25,7 @@ #include "tc/core/polyhedral/exceptions.h" #include "tc/core/polyhedral/schedule_tree.h" #include "tc/core/polyhedral/scop.h" +#include "tc/core/polyhedral/utils.h" #include "tc/external/isl.h" namespace tc { @@ -87,8 +88,8 @@ std::unique_ptr TensorReferenceGroup::makeSingleton( isl::map scopedAccess, AccessType type) { auto ref = std::unique_ptr(new TensorReference); - auto refId = scopedAccess.get_space().domain().unwrap().get_tuple_id( - isl::dim_type::out); + auto refId = + scopedAccess.get_space().domain().unwrap().get_map_range_tuple_id(); scopedAccess = scopedAccess.domain_factor_domain(); ref->originalAccess = originalAccess.domain_factor_domain(); ref->scopedAccess = scopedAccess; @@ -217,7 +218,7 @@ isl::union_map referenceOriginalAccessesImpl( throw promotion::GroupingError("no references in the group"); } auto accesses = isl::union_map::empty( - group.references.front()->originalAccess.get_space()); + group.references.front()->originalAccess.get_space().params()); for (const auto& ref : group.references) { if (ref->type != type) { @@ -285,7 +286,7 @@ void addSingletonReferenceGroup( AccessType type) { auto scopedUnionAccess = isl::union_map(access.curry()); scopedUnionAccess = scopedUnionAccess.apply_domain(schedule); - auto scopedAccess = isl::map::from_union_map(scopedUnionAccess); + auto scopedAccess = isl::map::from(scopedUnionAccess); scopedAccess = scopedAccess.uncurry(); tensorGroups[targetTensor].push_back( TensorReferenceGroup::makeSingleton(access, scopedAccess, type)); @@ -301,12 +302,12 @@ void addSingletonReferenceGroups( // use currying to isolate the D part before intersecting with the domain // Compute initial groups with single reference per group. std::unordered_set unapproximatable; - for (auto a : isl::UnionAsVector(accesses)) { + for (auto a : accesses.get_map_list()) { if (isl::union_map(a.curry()).intersect_domain(domain).is_empty()) { continue; } - auto tensorId = a.get_tuple_id(isl::dim_type::out); + auto tensorId = a.get_range_tuple_id(); if (unapproximatable.count(tensorId) != 0) { continue; } @@ -409,17 +410,20 @@ namespace { // context of the scop. isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) { auto halideParameter = scop.findArgument(tensorId).parameter(); - auto space = scop.domain().get_space().params(); + auto space = scop.domain().get_space(); auto nDim = halideParameter.dimensions(); - space = space.named_set_from_params_id(tensorId, nDim); + auto tensorTuple = constructTensorTuple(space, tensorId, nDim); + auto tensorSpace = tensorTuple.get_space(); - auto tensorElements = isl::set::universe(space); - auto identity = isl::multi_aff::identity(space.range().map_from_set()); + auto tensorElements = isl::set::universe(tensorSpace); + auto identity = isl::multi_aff::identity(tensorSpace.map_from_set()); for (int i = 0; i < nDim; ++i) { auto minAff = halide2isl::makeIslAffFromExpr( space, halideParameter.min_constraint(i)); auto extentAff = halide2isl::makeIslAffFromExpr( space, halideParameter.extent_constraint(i)); + minAff = minAff.unbind_params_insert_domain(tensorTuple); + extentAff = extentAff.unbind_params_insert_domain(tensorTuple); auto aff = identity.get_aff(i); tensorElements = tensorElements & (minAff <= isl::aff_set(aff)) & (isl::aff_set(aff) < (minAff + extentAff)); @@ -449,7 +453,7 @@ isl::multi_aff dropDummyTensorDimensions( } } - space = addRange(space, list.size()); + space = space.add_unnamed_tuple_ui(list.size()); return isl::multi_aff(space, list); } @@ -474,21 +478,20 @@ ScheduleTree* insertCopiesUnder( // Take the set of all tensor elements. auto tensorElements = tensorElementsSet(scop, tensorId); - auto promotion = - isl::map(group.promotion()).set_tuple_id(isl::dim_type::out, groupId); + auto promotion = isl::map(group.promotion()).set_range_tuple_id(groupId); auto promotionSpace = promotion.get_space(); auto identityCopySchedule = isl::multi_aff::identity(promotionSpace.range().map_from_set()); - identityCopySchedule = - identityCopySchedule.pullback(isl::multi_aff::range_map(promotionSpace)); // Only iterate over significant tensor dimensions. auto decl = scop.promotedDecl(groupId); identityCopySchedule = dropDummyTensorDimensions(identityCopySchedule, decl); - auto readSchedule = isl::multi_union_pw_aff( - identityCopySchedule.set_tuple_id(isl::dim_type::in, readId)); - auto writeSchedule = isl::multi_union_pw_aff( - identityCopySchedule.set_tuple_id(isl::dim_type::in, writeId)); + auto readSpace = promotionSpace.wrap().set_set_tuple_id(readId); + auto writeSpace = promotionSpace.wrap().set_set_tuple_id(writeId); + auto readSchedule = isl::multi_union_pw_aff(identityCopySchedule.pullback( + isl::multi_aff::wrapped_range_map(readSpace))); + auto writeSchedule = isl::multi_union_pw_aff(identityCopySchedule.pullback( + isl::multi_aff::wrapped_range_map(writeSpace))); auto readBandNode = ScheduleTree::makeBand(readSchedule); auto writeBandNode = ScheduleTree::makeBand(writeSchedule); @@ -508,18 +511,17 @@ ScheduleTree* insertCopiesUnder( auto promotedFootprint = group.promotedFootprint().set_tuple_id(groupId); auto scheduleUniverse = isl::set::universe(promotionSpace.domain().unwrap().domain()); - auto arrayId = - promotionSpace.domain().unwrap().get_tuple_id(isl::dim_type::out); + auto arrayId = promotionSpace.domain().unwrap().get_map_range_tuple_id(); auto approximatedRead = group.approximateScopedAccesses().intersect_range(tensorElements).wrap(); approximatedRead = approximatedRead.product(promotedFootprint); - auto readExtension = extension.intersect_range(approximatedRead) - .set_tuple_id(isl::dim_type::out, readId); + auto readExtension = + extension.intersect_range(approximatedRead).set_range_tuple_id(readId); auto writtenElements = group.scopedWrites().intersect_range(tensorElements).wrap(); writtenElements = writtenElements.product(promotedFootprint); - auto writeExtension = extension.intersect_range(writtenElements) - .set_tuple_id(isl::dim_type::out, writeId); + auto writeExtension = + extension.intersect_range(writtenElements).set_range_tuple_id(writeId); auto readFilterNode = ScheduleTree::makeFilter( isl::set::universe(readExtension.get_space().range()), diff --git a/tc/core/polyhedral/schedule_isl_conversion.cc b/tc/core/polyhedral/schedule_isl_conversion.cc index 22e1532e1..2b01979b9 100644 --- a/tc/core/polyhedral/schedule_isl_conversion.cc +++ b/tc/core/polyhedral/schedule_isl_conversion.cc @@ -171,8 +171,7 @@ isl::schedule_node insert(isl::schedule_node node, const ScheduleTree* st) { } for (size_t i = 0; i < band->unroll_.size(); ++i) { if (band->unroll_[i]) { - bandNode = - bandNode.member_set_ast_loop_type(i, isl::ast_loop_type::unroll); + bandNode = bandNode.member_set_ast_loop_unroll(i); } } node = bandNode; @@ -237,12 +236,14 @@ namespace { std::unique_ptr fromIslScheduleNodeBand( isl::schedule_node_band b) { - auto res = ScheduleTreeBand::fromMultiUnionPwAff(b.get_partial_schedule()); - res->permutable_ = b.get_permutable(); - for (size_t i = 0; i < b.n_member(); ++i) { - res->coincident_[i] = b.member_get_coincident(i); + auto n = b.n_member(); + std::vector coincident(n, false); + std::vector unroll(n, false); + for (size_t i = 0; i < n; ++i) { + coincident[i] = b.member_get_coincident(i); } - return res; + return ScheduleTreeBand::make( + b.get_partial_schedule(), b.get_permutable(), coincident, unroll); } std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { @@ -251,19 +252,19 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { return fromIslScheduleNodeBand(band); } else if (auto context = node.as()) { auto c = context.get_context(); - return std::unique_ptr(new ScheduleTreeContext(c)); + return ScheduleTreeContext::make(c); } else if (auto domain = node.as()) { auto c = domain.get_domain(); - return std::unique_ptr(new ScheduleTreeDomain(c)); + return ScheduleTreeDomain::make(c); } else if (auto expansion = node.as()) { LOG(FATAL) << "expansion nodes not supported"; return nullptr; } else if (auto extension = node.as()) { auto e = extension.get_extension(); - return std::unique_ptr(new ScheduleTreeExtension(e)); + return ScheduleTreeExtension::make(e); } else if (auto filter = node.as()) { auto f = filter.get_filter(); - return std::unique_ptr(new ScheduleTreeFilter(f)); + return ScheduleTreeFilter::make(f); } else if (auto guard = node.as()) { LOG(FATAL) << "guard nodes not supported"; return nullptr; @@ -274,9 +275,9 @@ std::unique_ptr elemFromIslScheduleNode(isl::schedule_node node) { LOG(FATAL) << "ScheduleTree::make called on explicit leaf"; return nullptr; } else if (node.isa()) { - return std::unique_ptr(new ScheduleTreeSequence(ctx)); + return ScheduleTreeSequence::make(ctx); } else if (node.isa()) { - return std::unique_ptr(new ScheduleTreeSet(ctx)); + return ScheduleTreeSet::make(ctx); } LOG(FATAL) << "NYI: ScheduleTree from type: " << isl_schedule_node_get_type(node.get()); diff --git a/tc/core/polyhedral/schedule_print.cc b/tc/core/polyhedral/schedule_print.cc index fd5aba15d..c1a4ac5da 100644 --- a/tc/core/polyhedral/schedule_print.cc +++ b/tc/core/polyhedral/schedule_print.cc @@ -87,26 +87,6 @@ ostream_joiner make_ostream_joiner(std::ostream& os, const char* delimiter) { } // namespace -std::ostream& operator<<(std::ostream& os, isl::ast_loop_type lt) { - WS w; - os << "type("; - if (lt == isl::ast_loop_type::error) { - os << "error"; - } else if (lt == isl::ast_loop_type::_default) { - os << "default"; - } else if (lt == isl::ast_loop_type::atomic) { - os << "atomic"; - } else if (lt == isl::ast_loop_type::unroll) { - os << "unroll"; - } else if (lt == isl::ast_loop_type::separate) { - os << "separate"; - } else { - LOG(FATAL) << "NYI: print type: " << static_cast(lt); - } - os << ")"; - return os; -} - std::ostream& operator<<(std::ostream& os, detail::ScheduleTreeType nt) { WS w; os << w.tab() << "type("; diff --git a/tc/core/polyhedral/schedule_transforms.cc b/tc/core/polyhedral/schedule_transforms.cc index 85f062860..2aee2e095 100644 --- a/tc/core/polyhedral/schedule_transforms.cc +++ b/tc/core/polyhedral/schedule_transforms.cc @@ -30,7 +30,7 @@ #include "tc/core/check.h" #include "tc/core/constants.h" -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/schedule_tree_elem.h" #include "tc/core/polyhedral/schedule_tree_matcher.h" @@ -229,10 +229,10 @@ ScheduleTree* bandTile( if (ts[i]) { upa = upa.scale_down(isl::val(st->ctx_, ts[i])).floor(); if (tileOptions & TileOptions::ScaleTileLoops) { - upa = upa.scale_val(isl::val(st->ctx_, ts[i])); + upa = upa.scale(isl::val(st->ctx_, ts[i])); } } else { - upa = upa.scale_val(isl::val(st->ctx_, ts[i])); + upa = upa.scale(isl::val(st->ctx_, ts[i])); } band.mupa_ = band.mupa_.set_union_pw_aff(i, upa); } @@ -286,11 +286,10 @@ ScheduleTree* insertTopLevelEmptyBand(ScheduleTree* root) { void updateTopLevelContext(detail::ScheduleTree* root, isl::set context) { if (!matchOne(tc::polyhedral::domain(tc::polyhedral::context(any())), root)) { - root->appendChild(ScheduleTree::makeContext( - isl::set::universe(context.get_space()), root->detachChildren())); + root->appendChild( + ScheduleTree::makeContext(context, root->detachChildren())); } - auto contextElem = const_cast( - root->child({0})->as()); + auto contextElem = root->child({0})->as(); TC_CHECK(contextElem) << "Expected domain(context(any()))"; contextElem->context_ = contextElem->context_ & context; } @@ -366,7 +365,7 @@ detail::ScheduleTree* insertEmptyExtensionAbove( isl::map labelExtension(ScheduleTree* root, ScheduleTree* tree, isl::id id) { auto prefix = prefixScheduleMupa(root, tree); auto scheduleSpace = prefix.get_space(); - auto space = scheduleSpace.params().named_set_from_params_id(id, 0); + auto space = scheduleSpace.params().add_named_tuple_id_ui(id, 0); auto extensionSpace = scheduleSpace.map_from_domain_and_range(space); return isl::map::universe(extensionSpace); } @@ -551,7 +550,7 @@ bool canOrder( } // Create an ordering schedule function first -> 0; second -> 1. auto ctx = dependences.get_ctx(); - auto space = isl::space(ctx, 0).unnamed_set_from_params(1); + auto space = isl::space(ctx, 0).add_unnamed_tuple_ui(1); auto zero = isl::multi_val::zero(space); auto one = zero.set_val(0, isl::val::one(ctx)); auto order = isl::multi_union_pw_aff(first, zero); diff --git a/tc/core/polyhedral/schedule_transforms.h b/tc/core/polyhedral/schedule_transforms.h index 258d2736a..add33d7f2 100644 --- a/tc/core/polyhedral/schedule_transforms.h +++ b/tc/core/polyhedral/schedule_transforms.h @@ -21,7 +21,7 @@ #include #include -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/options.h" #include "tc/core/polyhedral/schedule_tree.h" @@ -109,7 +109,7 @@ detail::ScheduleTree* insertTopLevelEmptyBand(detail::ScheduleTree* root); // Update the top-level context node by intersecting it with "context". The // top-level context node must be located directly under the root of the tree. -// If there is no such node, insert one with universe context first. +// If there is no such node, insert one first. void updateTopLevelContext(detail::ScheduleTree* root, isl::set context); // In a tree starting at "root", insert a sequence node with diff --git a/tc/core/polyhedral/schedule_tree.cc b/tc/core/polyhedral/schedule_tree.cc index d75b479cf..c17c2542a 100644 --- a/tc/core/polyhedral/schedule_tree.cc +++ b/tc/core/polyhedral/schedule_tree.cc @@ -29,7 +29,7 @@ #include "tc/core/check.h" #include "tc/core/constants.h" -#include "tc/core/polyhedral/functional.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/schedule_tree_elem.h" #include "tc/core/scope_guard.h" #include "tc/external/isl.h" @@ -122,31 +122,6 @@ vector ancestorsInSubTree( } return res; } - -static std::unique_ptr makeElem(const ScheduleTree& st) { -#define ELEM_MAKE_CASE(CLASS) \ - else if (st.type_ == CLASS::NodeType) { \ - return std::unique_ptr(new CLASS(static_cast(st))); \ - } - - if (st.type_ == detail::ScheduleTreeType::None) { - LOG(FATAL) << "Hit Error node!"; - } - ELEM_MAKE_CASE(ScheduleTreeBand) - ELEM_MAKE_CASE(ScheduleTreeContext) - ELEM_MAKE_CASE(ScheduleTreeDomain) - ELEM_MAKE_CASE(ScheduleTreeExtension) - ELEM_MAKE_CASE(ScheduleTreeFilter) - ELEM_MAKE_CASE(ScheduleTreeMapping) - ELEM_MAKE_CASE(ScheduleTreeSequence) - ELEM_MAKE_CASE(ScheduleTreeSet) - ELEM_MAKE_CASE(ScheduleTreeThreadSpecificMarker) - -#undef ELEM_MAKE_CASE - - LOG(FATAL) << "NYI: ScheduleTree from type: " << static_cast(st.type_); - return nullptr; -} } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -163,7 +138,7 @@ ScheduleTree::ScheduleTree(const ScheduleTree& st) } ScheduleTreeUPtr ScheduleTree::makeScheduleTree(const ScheduleTree& tree) { - return makeElem(tree); + return tree.clone(); } ScheduleTree* ScheduleTree::child(const vector& positions) { @@ -226,8 +201,10 @@ size_t ScheduleTree::scheduleDepth(const ScheduleTree* relativeRoot) const { std::unique_ptr ScheduleTree::makeBand( isl::multi_union_pw_aff mupa, std::vector&& children) { - auto res = ScheduleTreeBand::fromMultiUnionPwAff(mupa); - res->appendChildren(std::move(children)); + std::vector coincident(mupa.size(), false); + std::vector unroll(mupa.size(), false); + auto res = ScheduleTreeBand::make( + mupa, false, coincident, unroll, std::move(children)); return res; } @@ -243,25 +220,19 @@ ScheduleTreeUPtr ScheduleTree::makeEmptyBand(const ScheduleTree* root) { std::unique_ptr ScheduleTree::makeDomain( isl::union_set domain, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeDomain(domain)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeDomain::make(domain, std::move(children)); } std::unique_ptr ScheduleTree::makeContext( isl::set context, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeContext(context)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeContext::make(context, std::move(children)); } std::unique_ptr ScheduleTree::makeFilter( isl::union_set filter, std::vector&& children) { - auto res = std::unique_ptr(new ScheduleTreeFilter(filter)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeFilter::make(filter, std::move(children)); } std::unique_ptr ScheduleTree::makeMappingUnsafe( @@ -278,28 +249,19 @@ std::unique_ptr ScheduleTree::makeMappingUnsafe( TC_CHECK_EQ(mappedIds.size(), mapping.size()) << "some id is used more than once in the mapping"; auto ctx = mappedIds[0].get_ctx(); - auto res = - std::unique_ptr(new ScheduleTreeMapping(ctx, mapping)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeMapping::make(ctx, mapping, std::move(children)); } std::unique_ptr ScheduleTree::makeExtension( isl::union_map extension, std::vector&& children) { - auto res = - std::unique_ptr(new ScheduleTreeExtension(extension)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeExtension::make(extension, std::move(children)); } std::unique_ptr ScheduleTree::makeThreadSpecificMarker( isl::ctx ctx, std::vector&& children) { - auto res = - std::unique_ptr(new ScheduleTreeThreadSpecificMarker(ctx)); - res->appendChildren(std::move(children)); - return res; + return ScheduleTreeThreadSpecificMarker::make(ctx, std::move(children)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/tc/core/polyhedral/schedule_tree.h b/tc/core/polyhedral/schedule_tree.h index 0dad0723c..403dd0210 100644 --- a/tc/core/polyhedral/schedule_tree.h +++ b/tc/core/polyhedral/schedule_tree.h @@ -401,11 +401,11 @@ struct ScheduleTree { "Arguments must be rvalue references to ScheduleTreeUPtr"); auto ctx = arg->ctx_; - auto res = new T(ctx); - flattenSequenceOrSet(res); + auto res = T::make(ctx); + flattenSequenceOrSet(res.get()); res->appendChildren( vectorFromArgs(std::forward(arg), std::forward(args)...)); - return ScheduleTreeUPtr(res); + return res; } // Make a (deep) copy of "tree". @@ -465,6 +465,10 @@ struct ScheduleTree { // Note that this function does _not_ output the child trees. virtual std::ostream& write(std::ostream& os) const = 0; + // Clone the current node. + // Note that this function does _not_ clone the child trees. + virtual ScheduleTreeUPtr clone() const = 0; + // // Data members // diff --git a/tc/core/polyhedral/schedule_tree_elem.cc b/tc/core/polyhedral/schedule_tree_elem.cc index fa77f9452..816df26f8 100644 --- a/tc/core/polyhedral/schedule_tree_elem.cc +++ b/tc/core/polyhedral/schedule_tree_elem.cc @@ -37,17 +37,176 @@ namespace tc { namespace polyhedral { namespace detail { -std::unique_ptr ScheduleTreeBand::fromMultiUnionPwAff( - isl::multi_union_pw_aff mupa) { +std::unique_ptr ScheduleTreeContext::make( + isl::set context, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeContext(context)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeContext::make( + const ScheduleTreeContext* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeContext(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeDomain::make( + isl::union_set domain, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeDomain(domain)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeDomain::make( + const ScheduleTreeDomain* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeDomain(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeExtension::make( + isl::union_map extension, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeExtension(extension)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeExtension::make( + const ScheduleTreeExtension* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeExtension(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeFilter::make( + isl::union_set filter, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeFilter(filter)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeFilter::make( + const ScheduleTreeFilter* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeFilter(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeMapping::make( + isl::ctx ctx, + const ScheduleTreeMapping::Mapping& mapping, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeMapping(ctx, mapping)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeMapping::make( + const ScheduleTreeMapping* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeMapping(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +ScheduleTreeMapping::ScheduleTreeMapping( + isl::ctx ctx, + const ScheduleTreeMapping::Mapping& mapping) + : ScheduleTree(ctx, {}, NodeType), mapping(mapping) { + TC_CHECK_GT(mapping.size(), 0u) << "empty mapping filter"; + + auto domain = mapping.cbegin()->second.domain(); + for (auto& kvp : mapping) { + TC_CHECK(domain.is_equal(kvp.second.domain())); + } + filter_ = domain.universe(); + for (auto& kvp : mapping) { + auto upa = kvp.second; + auto id = kvp.first; + // Create mapping filter by equating the + // parameter mappedIds[i] to the "i"-th affine function. + upa = upa.sub(isl::union_pw_aff::param_on_domain(domain.universe(), id)); + filter_ = filter_.intersect(upa.zero_union_set()); + } +} + +std::unique_ptr ScheduleTreeSequence::make( + isl::ctx ctx, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeSequence(ctx)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeSequence::make( + const ScheduleTreeSequence* tree, + std::vector&& children) { + auto res = + std::unique_ptr(new ScheduleTreeSequence(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeSet::make( + isl::ctx ctx, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeSet(ctx)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeSet::make( + const ScheduleTreeSet* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeSet(*tree)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr ScheduleTreeBand::make( + isl::multi_union_pw_aff mupa, + bool permutable, + std::vector coincident, + std::vector unroll, + std::vector&& children) { + TC_CHECK_EQ(static_cast(mupa.size()), coincident.size()); + TC_CHECK_EQ(static_cast(mupa.size()), unroll.size()); isl::ctx ctx(mupa.get_ctx()); std::unique_ptr band(new ScheduleTreeBand(ctx)); + band->permutable_ = permutable; band->mupa_ = mupa.floor(); - size_t n = band->mupa_.size(); - band->coincident_ = vector(n, false); - band->unroll_ = vector(n, false); + band->coincident_ = coincident; + band->unroll_ = unroll; + band->appendChildren(std::move(children)); return band; } +std::unique_ptr ScheduleTreeBand::make( + const ScheduleTreeBand* tree, + std::vector&& children) { + auto res = std::unique_ptr(new ScheduleTreeBand(*tree)); + res->appendChildren(std::move(children)); + return res; +} + // Return the number of scheduling dimensions in the band size_t ScheduleTreeBand::nMember() const { size_t res = mupa_.size(); @@ -74,9 +233,9 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { auto nBegin = nMember(); auto list = mupa_.get_union_pw_aff_list(); - auto space = mupa_.get_space().domain(); + auto space = mupa_.get_space().params(); list = list.drop(pos, n); - space = addRange(space, list.size()); + space = space.add_unnamed_tuple_ui(list.size()); mupa_ = isl::multi_union_pw_aff(space, list); std::copy( @@ -92,7 +251,7 @@ void ScheduleTreeBand::drop(size_t pos, size_t n) { isl::multi_union_pw_aff ScheduleTreeBand::memberRange(size_t first, size_t n) const { auto list = mupa_.get_union_pw_aff_list(); - auto space = addRange(mupa_.get_space().domain(), n); + auto space = mupa_.get_space().params().add_unnamed_tuple_ui(n); auto end = first + n; TC_CHECK_LE(end, nMember()); list = list.drop(end, nMember() - end); @@ -100,6 +259,26 @@ isl::multi_union_pw_aff ScheduleTreeBand::memberRange(size_t first, size_t n) return isl::multi_union_pw_aff(space, list); } +std::unique_ptr +ScheduleTreeThreadSpecificMarker::make( + isl::ctx ctx, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeThreadSpecificMarker(ctx)); + res->appendChildren(std::move(children)); + return res; +} + +std::unique_ptr +ScheduleTreeThreadSpecificMarker::make( + const ScheduleTreeThreadSpecificMarker* tree, + std::vector&& children) { + auto res = std::unique_ptr( + new ScheduleTreeThreadSpecificMarker(*tree)); + res->appendChildren(std::move(children)); + return res; +} + bool ScheduleTreeBand::operator==(const ScheduleTreeBand& other) const { if (permutable_ != other.permutable_) { return false; diff --git a/tc/core/polyhedral/schedule_tree_elem.h b/tc/core/polyhedral/schedule_tree_elem.h index 77507de50..5d782049d 100644 --- a/tc/core/polyhedral/schedule_tree_elem.h +++ b/tc/core/polyhedral/schedule_tree_elem.h @@ -31,110 +31,187 @@ namespace polyhedral { namespace detail { struct ScheduleTreeContext : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Context; - isl::set context_; + + private: ScheduleTreeContext() = delete; - ScheduleTreeContext(const ScheduleTreeContext& eb) - : ScheduleTree(eb), context_(eb.context_) {} explicit ScheduleTreeContext(isl::set s) : ScheduleTree(s.get_ctx(), {}, NodeType), context_(s) {} + ScheduleTreeContext(const ScheduleTreeContext& eb) + : ScheduleTree(eb), context_(eb.context_) {} + + public: virtual ~ScheduleTreeContext() override {} + + static std::unique_ptr make( + isl::set context, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeContext* tree, + std::vector&& children = {}); + bool operator==(const ScheduleTreeContext& other) const; bool operator!=(const ScheduleTreeContext& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } + + public: + isl::set context_; }; struct ScheduleTreeDomain : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Domain; - isl::union_set domain_; + + private: ScheduleTreeDomain() = delete; - ScheduleTreeDomain(const ScheduleTreeDomain& eb) - : ScheduleTree(eb), domain_(eb.domain_) {} explicit ScheduleTreeDomain(isl::union_set us) : ScheduleTree(us.get_ctx(), {}, NodeType), domain_(us) {} + ScheduleTreeDomain(const ScheduleTreeDomain& eb) + : ScheduleTree(eb), domain_(eb.domain_) {} + + public: virtual ~ScheduleTreeDomain() override {} + + static std::unique_ptr make( + isl::union_set domain, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeDomain* tree, + std::vector&& children = {}); + bool operator==(const ScheduleTreeDomain& other) const; bool operator!=(const ScheduleTreeDomain& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } + + public: + isl::union_set domain_; }; struct ScheduleTreeExtension : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Extension; - isl::union_map extension_; + + private: ScheduleTreeExtension() = delete; - ScheduleTreeExtension(const ScheduleTreeExtension& eb) - : ScheduleTree(eb), extension_(eb.extension_) {} explicit ScheduleTreeExtension(isl::union_map m) : ScheduleTree(m.get_ctx(), {}, NodeType), extension_(m) {} + ScheduleTreeExtension(const ScheduleTreeExtension& eb) + : ScheduleTree(eb), extension_(eb.extension_) {} + + public: virtual ~ScheduleTreeExtension() override {} + + static std::unique_ptr make( + isl::union_map extension, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeExtension* tree, + std::vector&& children = {}); + bool operator==(const ScheduleTreeExtension& other) const; bool operator!=(const ScheduleTreeExtension& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } + + public: + isl::union_map extension_; }; struct ScheduleTreeFilter : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Filter; - isl::union_set filter_; + + private: ScheduleTreeFilter() = delete; - ScheduleTreeFilter(const ScheduleTreeFilter& eb) - : ScheduleTree(eb), filter_(eb.filter_) {} explicit ScheduleTreeFilter(isl::union_set s) : ScheduleTree(s.get_ctx(), {}, NodeType), filter_(s) {} + ScheduleTreeFilter(const ScheduleTreeFilter& eb) + : ScheduleTree(eb), filter_(eb.filter_) {} + + public: virtual ~ScheduleTreeFilter() override {} + bool operator==(const ScheduleTreeFilter& other) const; bool operator!=(const ScheduleTreeFilter& other) const { return !(*this == other); } + + static std::unique_ptr make( + isl::union_set filter, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeFilter* tree, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } + + public: + isl::union_set filter_; }; struct ScheduleTreeMapping : public ScheduleTree { + public: using Mapping = std::unordered_map< mapping::MappingId, isl::union_pw_aff, typename mapping::MappingId::Hash>; + static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Mapping; + + private: ScheduleTreeMapping() = delete; + ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping); ScheduleTreeMapping(const ScheduleTreeMapping& eb) : ScheduleTree(eb), mapping(eb.mapping), filter_(eb.filter_) {} - ScheduleTreeMapping(isl::ctx ctx, const Mapping& mapping) - : ScheduleTree(ctx, {}, NodeType), - mapping(mapping), - filter_(isl::union_set()) { - TC_CHECK_GT(mapping.size(), 0u) << "empty mapping filter"; - - auto domain = mapping.cbegin()->second.domain(); - for (auto& kvp : mapping) { - TC_CHECK(domain.is_equal(kvp.second.domain())); - } - filter_ = domain.universe(); - for (auto& kvp : mapping) { - auto upa = kvp.second; - auto id = kvp.first; - // Create mapping filter by equating the - // parameter mappedIds[i] to the "i"-th affine function. - upa = upa.sub(isl::union_pw_aff::param_on_domain(domain.universe(), id)); - filter_ = filter_.intersect(upa.zero_union_set()); - } - } + + public: virtual ~ScheduleTreeMapping() override {} + bool operator==(const ScheduleTreeMapping& other) const; bool operator!=(const ScheduleTreeMapping& other) const { return !(*this == other); } + + static std::unique_ptr make( + isl::ctx ctx, + const Mapping& mapping, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeMapping* tree, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } + public: // Mapping from identifiers to affine functions on domain elements. const Mapping mapping; // Assignment of the affine functions to the identifiers as parameters. @@ -142,59 +219,104 @@ struct ScheduleTreeMapping : public ScheduleTree { }; struct ScheduleTreeSequence : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Sequence; + + private: explicit ScheduleTreeSequence(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} ScheduleTreeSequence(const ScheduleTreeSequence& eb) : ScheduleTree(eb) {} + + public: virtual ~ScheduleTreeSequence() override {} + bool operator==(const ScheduleTreeSequence& other) const; bool operator!=(const ScheduleTreeSequence& other) const { return !(*this == other); } + + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeSequence* tree, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; struct ScheduleTreeSet : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::Set; + + private: explicit ScheduleTreeSet(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} ScheduleTreeSet(const ScheduleTreeSet& eb) : ScheduleTree(eb) {} + + public: virtual ~ScheduleTreeSet() override {} + bool operator==(const ScheduleTreeSet& other) const; bool operator!=(const ScheduleTreeSet& other) const { return !(*this == other); } + + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeSet* tree, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; struct ScheduleTreeBand : public ScheduleTree { private: explicit ScheduleTreeBand(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} - - public: - static constexpr detail::ScheduleTreeType NodeType = - detail::ScheduleTreeType::Band; - ScheduleTreeBand(const ScheduleTreeBand& eb) : ScheduleTree(eb), permutable_(eb.permutable_), mupa_(eb.mupa_), coincident_(eb.coincident_), unroll_(eb.unroll_) {} + + public: + static constexpr detail::ScheduleTreeType NodeType = + detail::ScheduleTreeType::Band; + virtual ~ScheduleTreeBand() override {} + bool operator==(const ScheduleTreeBand& other) const; bool operator!=(const ScheduleTreeBand& other) const { return !(*this == other); } + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } - // First replace "mupa" by its greatest integer part to ensure that the + // Make a schedule node band from partial schedule. + // Replace "mupa" by its greatest integer part to ensure that the // schedule is always integral. - // The band is not marked permutable, the dimensions are not marked - // coincident and are not marked for unrolling. - static std::unique_ptr fromMultiUnionPwAff( - isl::multi_union_pw_aff mupa); + static std::unique_ptr make( + isl::multi_union_pw_aff mupa, + bool permutable, + std::vector coincident, + std::vector unroll, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeBand* tree, + std::vector&& children = {}); // Return the number of scheduling dimensions in the band size_t nMember() const; @@ -227,18 +349,37 @@ struct ScheduleTreeBand : public ScheduleTree { * underneath the innermost band member mapped to threads. */ struct ScheduleTreeThreadSpecificMarker : public ScheduleTree { + public: static constexpr detail::ScheduleTreeType NodeType = detail::ScheduleTreeType::ThreadSpecificMarker; + + private: explicit ScheduleTreeThreadSpecificMarker(isl::ctx ctx) : ScheduleTree(ctx, {}, NodeType) {} + ScheduleTreeThreadSpecificMarker(const ScheduleTreeThreadSpecificMarker& tree) + : ScheduleTree(tree) {} + + public: virtual ~ScheduleTreeThreadSpecificMarker() override {} + bool operator==(const ScheduleTreeThreadSpecificMarker& other) const { return true; } bool operator!=(const ScheduleTreeThreadSpecificMarker& other) const { return !(*this == other); } + + static std::unique_ptr make( + isl::ctx ctx, + std::vector&& children = {}); + static std::unique_ptr make( + const ScheduleTreeThreadSpecificMarker* tree, + std::vector&& children = {}); + virtual std::ostream& write(std::ostream& os) const override; + virtual ScheduleTreeUPtr clone() const override { + return make(this); + } }; bool elemEquals( @@ -246,7 +387,6 @@ bool elemEquals( const ScheduleTree* e2, detail::ScheduleTreeType type); -std::ostream& operator<<(std::ostream& os, isl::ast_loop_type lt); std::ostream& operator<<(std::ostream& os, detail::ScheduleTreeType nt); std::ostream& operator<<( std::ostream& os, diff --git a/tc/core/polyhedral/schedule_utils.cc b/tc/core/polyhedral/schedule_utils.cc index 72b4256a2..37a1a7d96 100644 --- a/tc/core/polyhedral/schedule_utils.cc +++ b/tc/core/polyhedral/schedule_utils.cc @@ -188,14 +188,6 @@ vector collectScheduleTreesPath( namespace { -template -vector reversed(const vector& vec) { - vector result; - result.reserve(vec.size()); - result.insert(result.begin(), vec.rbegin(), vec.rend()); - return result; -} - template vector filterType(const vector& vec) { vector result; @@ -216,20 +208,6 @@ T foldl(const vector vec, Func op, T init = T()) { return value; } -template -ostream& operator<<(ostream& os, const vector& v) { - os << "["; - bool first = true; - for (auto const& ve : v) { - if (!first) { - os << ", "; - } - os << ve; - first = true; - } - os << "]"; - return os; -} } // namespace isl::multi_union_pw_aff infixScheduleMupa( @@ -280,7 +258,7 @@ isl::multi_union_pw_aff extractDomainToIds( auto space = isl::space(tree->ctx_, 0); auto empty = isl::union_set::empty(space); - space = space.named_set_from_params_id(tupleId, ids.size()); + space = space.add_named_tuple_id_ui(tupleId, ids.size()); auto zero = isl::multi_val::zero(space); auto domainToIds = isl::multi_union_pw_aff(empty, zero); diff --git a/tc/core/polyhedral/scop.cc b/tc/core/polyhedral/scop.cc index dcca86fe8..41cc17448 100644 --- a/tc/core/polyhedral/scop.cc +++ b/tc/core/polyhedral/scop.cc @@ -24,9 +24,9 @@ #include #include "tc/core/check.h" +#include "tc/core/functional.h" #include "tc/core/halide2isl.h" #include "tc/core/polyhedral/body.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/memory_promotion.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" @@ -34,6 +34,7 @@ #include "tc/core/polyhedral/schedule_utils.h" #include "tc/core/scope_guard.h" #include "tc/core/tc2halide.h" +#include "tc/utils/compiler_options.h" using namespace std; @@ -50,7 +51,7 @@ ScopUPtr Scop::makeScop( halide2isl::SymbolTable sym = halide2isl::makeSymbolTable(components); - isl::space paramSpace = halide2isl::makeParamSpace(ctx, sym.params); + auto paramSpace = halide2isl::makeParamSpace(ctx, sym.params); ScopUPtr scop(new Scop()); scop->halide.params = sym.params; @@ -69,12 +70,18 @@ ScopUPtr Scop::makeScop( return scop; } -ScopUPtr Scop::makeScop(isl::ctx ctx, const string& tc) { - return makeScop(ctx, tc2halide::translate(ctx, tc)); +ScopUPtr Scop::makeScop( + isl::ctx ctx, + const string& tc, + const CompilerOptions& compilerOptions) { + return makeScop(ctx, tc2halide::translate(ctx, tc, compilerOptions)); } -ScopUPtr Scop::makeScop(isl::ctx ctx, const lang::TreeRef& treeRef) { - return makeScop(ctx, tc2halide::translate(ctx, treeRef)); +ScopUPtr Scop::makeScop( + isl::ctx ctx, + const lang::TreeRef& treeRef, + const CompilerOptions& compilerOptions) { + return makeScop(ctx, tc2halide::translate(ctx, treeRef, compilerOptions)); } isl::union_set& Scop::domainRef() { @@ -327,12 +334,6 @@ isl::schedule_constraints makeScheduleConstraints( // Set up "add_schedule_constraints" and "merge_callback" // depending on the scheduler options. isl_schedule_constraints* sc = constraints.release(); - { - if (schedulerOptions.proto.positive_orthant()) { - sc = isl_schedule_constraints_set_custom_constraint_callback( - sc, callbacks::AddPositiveCoefficientConstraints, nullptr); - } - } { auto fusionStrategy = schedulerOptions.proto.fusion_strategy(); if (fusionStrategy == FusionStrategy::Max) { @@ -385,6 +386,7 @@ std::unique_ptr Scop::computeSchedule( auto wasSerializingSccs = isl_options_get_schedule_serialize_sccs(ctx.get()); auto wasUnit = isl_options_get_schedule_unit_max_var_coefficient_sum(ctx.get()); + auto wasNonNeg = isl_options_get_schedule_nonneg_var_coefficient(ctx.get()); isl_options_set_schedule_whole_component(ctx.get(), 0); if (schedulerOptions.proto.fusion_strategy() == FusionStrategy::Min) { isl_options_set_schedule_serialize_sccs(ctx.get(), 1); @@ -392,10 +394,14 @@ std::unique_ptr Scop::computeSchedule( if (!schedulerOptions.proto.allow_skewing()) { isl_options_set_schedule_unit_max_var_coefficient_sum(ctx.get(), 1); } + if (schedulerOptions.proto.positive_orthant()) { + isl_options_set_schedule_nonneg_var_coefficient(ctx.get(), 1); + } tc::ScopeGuard islOptionsResetter([&]() { isl_options_set_schedule_whole_component(ctx.get(), usedWholeComponent); isl_options_set_schedule_serialize_sccs(ctx.get(), wasSerializingSccs); isl_options_set_schedule_unit_max_var_coefficient_sum(ctx.get(), wasUnit); + isl_options_set_schedule_nonneg_var_coefficient(ctx.get(), wasNonNeg); }); return detail::fromIslSchedule(constraints.compute_schedule()); diff --git a/tc/core/polyhedral/scop.h b/tc/core/polyhedral/scop.h index d9822f895..b8d9c7982 100644 --- a/tc/core/polyhedral/scop.h +++ b/tc/core/polyhedral/scop.h @@ -32,6 +32,7 @@ #include "tc/core/tc2halide.h" #include "tc/core/tensor.h" #include "tc/external/isl.h" +#include "tc/utils/compiler_options.h" namespace tc { namespace polyhedral { @@ -40,8 +41,6 @@ namespace polyhedral { using ReductionDimSet = std::set; class TensorReferenceGroup; -class MappedScop; - struct Scop { private: Scop() {} @@ -56,11 +55,15 @@ struct Scop { // Halide IR is constructed and made a member by setting halideComponents. // These operations are grouped and scheduled in a halide::Stmt which becomes // the unit from which the scop is constructed. - static std::unique_ptr makeScop(isl::ctx ctx, const std::string& tc); + static std::unique_ptr makeScop( + isl::ctx ctx, + const std::string& tc, + const CompilerOptions& compilerOptions = CompilerOptions()); static std::unique_ptr makeScop( isl::ctx ctx, - const lang::TreeRef& treeRef); + const lang::TreeRef& treeRef, + const CompilerOptions& compilerOptions = CompilerOptions()); // Clone a Scop static std::unique_ptr makeScop(const Scop& scop) { @@ -68,7 +71,9 @@ struct Scop { res->parameterValues = scop.parameterValues; res->halide = scop.halide; res->body = scop.body; - res->dependences = scop.dependences; + if (scop.dependences) { + res->dependences = scop.dependences; + } res->scheduleTreeUPtr = detail::ScheduleTree::makeScheduleTree(*scop.scheduleTreeUPtr); res->treeSyncUpdateMap = scop.treeSyncUpdateMap; @@ -131,7 +136,7 @@ struct Scop { isl::set makeContext( const std::unordered_map& sizes = std::unordered_map()) const { - auto s = domain().get_space().params(); + auto s = domain().get_space(); return makeSpecializationSet(s, sizes); } diff --git a/tc/core/polyhedral/unroll.cc b/tc/core/polyhedral/unroll.cc index c9cf0c895..e90e78f16 100644 --- a/tc/core/polyhedral/unroll.cc +++ b/tc/core/polyhedral/unroll.cc @@ -55,7 +55,7 @@ isl::val relativeRange(isl::union_map fixed, isl::union_pw_aff f) { umap = umap.range_product(umap); umap = umap.range().unwrap(); umap = umap.project_out_all_params(); - auto delta = isl::map::from_union_map(umap).deltas(); + auto delta = isl::map::from(umap).deltas(); auto hull = delta.simple_hull(); auto stride = isl::set(hull).get_stride(0); hull = isl::set(hull).polyhedral_hull(); @@ -94,13 +94,14 @@ isl::val boundInstancesAndMarkUnroll( auto n = band->nMember(); auto list = partial.get_union_pw_aff_list(); - auto space = partial.get_space().domain(); + auto space = partial.get_space().params(); for (int i = n - 1; i >= 0; --i) { auto member = partial.get_union_pw_aff(i); auto outerMap = prefix; if (i > 0) { list = list.drop(i, 1); - auto outer = isl::multi_union_pw_aff(addRange(space, list.size()), list); + auto outerSpace = space.add_unnamed_tuple_ui(list.size()); + auto outer = isl::multi_union_pw_aff(outerSpace, list); outerMap = outerMap.flat_range_product(isl::union_map::from(outer)); } bound = bound.mul(relativeRange(outerMap, member)); diff --git a/tc/core/polyhedral/utils.cc b/tc/core/polyhedral/utils.cc new file mode 100644 index 000000000..80cf11f78 --- /dev/null +++ b/tc/core/polyhedral/utils.cc @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "tc/core/polyhedral/utils.h" + +namespace tc { +namespace polyhedral { + +/* Construct a tuple representing the tensor with identifier "tensorId" and + * dimension "dim" from the parameter space "paramSpace", + * without any specific names for the indices, from the perspective + * of the user. + * Since some names are required, use names of the form "__tc_tensor_arg*". + */ +isl::multi_id +constructTensorTuple(isl::space paramSpace, isl::id tensorId, size_t dim) { + auto tensorSpace = paramSpace.add_named_tuple_id_ui(tensorId, dim); + isl::id_list tensorArgs(paramSpace.get_ctx(), 0); + for (size_t i = 0; i < dim; ++i) { + auto name = std::string("__tc_tensor_arg") + std::to_string(i); + tensorArgs = tensorArgs.add(isl::id(paramSpace.get_ctx(), name)); + } + return isl::multi_id(tensorSpace, tensorArgs); +} + +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/polyhedral/utils.h b/tc/core/polyhedral/utils.h new file mode 100644 index 000000000..459bca648 --- /dev/null +++ b/tc/core/polyhedral/utils.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "tc/external/isl.h" + +namespace tc { +namespace polyhedral { + +/* Construct a tuple representing the tensor with identifier "tensorId" and + * dimension "dim" from the parameter space "paramSpace", + * without any specific names for the indices. + */ +isl::multi_id +constructTensorTuple(isl::space paramSpace, isl::id tensorId, size_t dim); + +} // namespace polyhedral +} // namespace tc diff --git a/tc/core/tc2halide.cc b/tc/core/tc2halide.cc index 379add821..3e95233ef 100644 --- a/tc/core/tc2halide.cc +++ b/tc/core/tc2halide.cc @@ -20,6 +20,7 @@ #include "tc/core/tc2halide.h" #include "tc/lang/parser.h" #include "tc/lang/sema.h" +#include "tc/utils/compiler_options.h" namespace tc2halide { @@ -270,7 +271,7 @@ void forwardBoundsInference( const std::vector& exprs, const FunctionBounds& bounds, const lang::TreeRef& comprehension, - bool throwWarnings, + const tc::CompilerOptions& compilerOptions, Scope* solution) { class CreateConstraints : public IRVisitor { using IRVisitor::visit; @@ -488,10 +489,10 @@ void forwardBoundsInference( lang::ErrorReport err(comprehension); err << "Required precondition will not be checked at runtime: " << remaining; - if (throwWarnings) { + if (compilerOptions.throwWarnings) { throw err; } else { - warn(err); + warn(err, compilerOptions); } } } @@ -509,7 +510,7 @@ Expr reductionUpdate(Expr e) { void translateComprehension( const lang::Comprehension& comprehension, const map& params, - bool throwWarnings, + const tc::CompilerOptions& compilerOptions, map* funcs, FunctionBounds* bounds) { Function f; @@ -670,7 +671,7 @@ void translateComprehension( // Infer the rest all_exprs.push_back(rhs); forwardBoundsInference( - all_exprs, *bounds, comprehension, throwWarnings, &solution); + all_exprs, *bounds, comprehension, compilerOptions, &solution); // TODO: What if subsequent updates have incompatible bounds // (e.g. an in-place stencil)?. The .bound directive will use the @@ -754,7 +755,9 @@ void translateComprehension( } // Translate a semantically checked TC def to HalideComponents struct. -HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { +HalideComponents translateDef( + const lang::Def& def, + const tc::CompilerOptions& compilerOptions) { map funcs; HalideComponents components; components.def = def; @@ -765,7 +768,7 @@ HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { } for (auto c : def.statements()) { translateComprehension( - c, components.params, throwWarnings, &funcs, &bounds); + c, components.params, compilerOptions, &funcs, &bounds); } vector outputs; for (auto p : def.returns()) { @@ -906,19 +909,24 @@ HalideComponents translateDef(const lang::Def& def, bool throwWarnings) { } } // namespace -HalideComponents -translate(isl::ctx ctx, const lang::TreeRef& treeRef, bool throwWarnings) { +HalideComponents translate( + isl::ctx ctx, + const lang::TreeRef& treeRef, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { LOG_IF(INFO, tc::FLAGS_debug_halide) << treeRef; return translateDef( - lang::Def(lang::Sema().checkFunction(treeRef)), throwWarnings); + lang::Def(lang::Sema(compilerOptions).checkFunction(treeRef)), + compilerOptions); } // NOTE: there is no guarantee here that the tc string has only one def. It // could have many defs. Only first def will be converted in that case. -HalideComponents -translate(isl::ctx ctx, const std::string& tc, bool throwWarnings) { +HalideComponents translate( + isl::ctx ctx, + const std::string& tc, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { LOG_IF(INFO, tc::FLAGS_debug_halide) << tc; - return translate(ctx, lang::Parser(tc).parseFunction(), throwWarnings); + return translate(ctx, lang::Parser(tc).parseFunction(), compilerOptions); } } // namespace tc2halide diff --git a/tc/core/tc2halide.h b/tc/core/tc2halide.h index aab822072..02eb24442 100644 --- a/tc/core/tc2halide.h +++ b/tc/core/tc2halide.h @@ -20,6 +20,7 @@ #include "tc/external/isl.h" #include "tc/lang/tree.h" #include "tc/lang/tree_views.h" +#include "tc/utils/compiler_options.h" namespace tc2halide { @@ -44,15 +45,19 @@ struct HalideComponents { Halide::Internal::Call::ConstString kReductionUpdate = "ReductionUpdate"; // Translate a TC parse tree into equivalent Halide imperative IR with -// a naive schedule. +// a naive schedule. Additional options, such as how to treat warnings, are +// passed in as "compilerOptions". HalideComponents translate( isl::ctx ctx, const lang::TreeRef& treeRef, - bool throwWarnings = false); + const tc::CompilerOptions& compilerOptions); // Translate TC source into equivalent Halide imperative IR with a -// naive schedule. -HalideComponents -translate(isl::ctx ctx, const std::string& tc, bool throwWarnings = false); +// naive schedule. Additional options, such as how to treat warnings, are +// passed in as "compilerOptions". +HalideComponents translate( + isl::ctx ctx, + const std::string& tc, + const tc::CompilerOptions& compilerOptions); } // namespace tc2halide diff --git a/tc/core/utils/type_traits.h b/tc/core/utils/type_traits.h index 5a93d0c8f..9ce4f3e54 100644 --- a/tc/core/utils/type_traits.h +++ b/tc/core/utils/type_traits.h @@ -1,3 +1,17 @@ +// Copyright (c) 2017-present, Facebook, Inc. +// # +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// # +// http://www.apache.org/licenses/LICENSE-2.0 +// # +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ############################################################################## #include namespace tc { diff --git a/tc/external/detail/islpp-inl.h b/tc/external/detail/islpp-inl.h index a6c621945..8ce3579f9 100644 --- a/tc/external/detail/islpp-inl.h +++ b/tc/external/detail/islpp-inl.h @@ -20,6 +20,16 @@ namespace isl { /////////////////////////////////////////////////////////////////////////////// // Operations on isl::aff to perform arithmetic and create/combine with sets /////////////////////////////////////////////////////////////////////////////// +template +inline auto operator*(isl::val V, T A) -> decltype(A.scale(V)) { + return A.scale(V); +} + +template +inline auto operator*(T A, isl::val V) -> decltype(A.scale(V)) { + return V * A; +} + inline isl::aff operator*(int i, isl::aff A) { isl::val V(isl::val(A.get_ctx(), i)); return A * V; @@ -29,46 +39,37 @@ inline isl::aff operator*(isl::aff A, int i) { return i * A; } -inline isl::aff operator*(isl::val V, isl::aff A) { - return A.scale(V); -} - -inline isl::aff operator*(isl::aff A, isl::val V) { - return V * A; -} - inline isl::aff operator/(isl::aff A, int i) { return A.scale_down(isl::val(A.get_ctx(), i)); } -inline isl::aff operator+(int i, isl::aff A) { - isl::ctx ctx = A.get_ctx(); - return A + isl::val(ctx, i); +template +inline T operator+(int i, T A) { + return A.add_constant_si(i); } -inline isl::aff operator+(isl::aff A, isl::val v) { - isl::aff T(isl::local_space(A.get_space().domain()), v); - return A.add(T); +template +inline auto operator+(T A, isl::val v) -> decltype(A.add_constant(v)) { + return A.add_constant(v); } inline isl::aff operator+(isl::val v, isl::aff A) { return A + v; } -inline isl::aff operator+(isl::aff A, isl::aff B) { - return A.add(B); -} - -inline isl::aff operator+(isl::aff A, int i) { +template +inline auto operator+(T A, int i) -> decltype(A.add_constant_si(i)) { return i + A; } -inline isl::aff operator-(isl::aff A, int i) { +template +inline auto operator-(T A, int i) -> decltype(A.add_constant_si(i)) { return A + (-i); } -inline isl::aff operator-(int i, isl::aff A) { - return (A + (-i)).neg(); +template +inline auto operator-(int i, T A) -> decltype(A.add_constant_si(i)) { + return i + A.neg(); } inline isl::set operator>=(isl::aff_set A, isl::val v) { @@ -188,17 +189,14 @@ inline isl::map operator<=(isl::aff_map A, isl::aff B) { /////////////////////////////////////////////////////////////////////////////// // Operations on isl::multi_aff /////////////////////////////////////////////////////////////////////////////// -inline isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right) { +template +inline auto operator/(S left, T right) -> decltype(left.scale_down(right)) { return left.scale_down(right); } /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::union_set /////////////////////////////////////////////////////////////////////////////// -inline isl::set operator&(isl::set S1, isl::set S2) { - return S1.intersect(S2); -} - inline isl::union_set operator&(isl::union_set S1, isl::set S2) { return S1.intersect(isl::union_set(S2)); } @@ -207,10 +205,6 @@ inline isl::union_set operator&(isl::set S1, isl::union_set S2) { return S2 & S1; } -inline isl::union_set operator&(isl::union_set S1, isl::union_set S2) { - return S1.intersect(S2); -} - /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::point /////////////////////////////////////////////////////////////////////////////// diff --git a/tc/external/detail/islpp.h b/tc/external/detail/islpp.h index 11f487a94..612957080 100644 --- a/tc/external/detail/islpp.h +++ b/tc/external/detail/islpp.h @@ -35,11 +35,21 @@ namespace isl { // the official ISL C++ bindings. // +template +inline T operator+(T a, T b) { + return a.add(b); +} + template inline T operator-(T a, T b) { return a.sub(b); } +template +inline T operator&(T S1, T S2) { + return S1.intersect(S2); +} + inline isl::val operator*(isl::val l, isl::val r) { return l.mul(r); } @@ -52,10 +62,6 @@ inline isl::val operator*(long i, isl::val v) { return v * i; } -inline isl::val operator+(isl::val l, isl::val r) { - return l.add(r); -} - inline isl::val operator+(isl::val v, long i) { return v.add(isl::val(v.get_ctx(), i)); } @@ -117,20 +123,11 @@ inline bool operator!=(isl::val v1, isl::val v2) { /////////////////////////////////////////////////////////////////////////////// isl::aff operator*(int i, isl::aff A); isl::aff operator*(isl::aff A, int i); -isl::aff operator*(isl::aff A, isl::val V); -isl::aff operator*(isl::val V, isl::aff A); isl::aff operator/(isl::aff A, int i); -isl::aff operator+(int i, isl::aff A); -isl::aff operator+(isl::aff A, isl::aff B); -isl::aff operator+(isl::aff A, int i); -isl::aff operator+(isl::aff A, isl::val v); isl::aff operator+(isl::val v, isl::aff A); -isl::aff operator-(isl::aff A, int i); -isl::aff operator-(int i, isl::aff A); - // Thin wrapper around aff to disambiguate types for operators and avoid case // where return type overloading occurs struct aff_set { @@ -176,18 +173,11 @@ isl::map operator<=(isl::aff_map A, isl::aff B); isl::map operator>(isl::aff_map A, isl::aff B); isl::map operator<(isl::aff_map A, isl::aff B); -/////////////////////////////////////////////////////////////////////////////// -// Operations on isl::multi_aff -/////////////////////////////////////////////////////////////////////////////// -isl::multi_aff operator/(isl::multi_aff left, isl::multi_val right); - /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::union_set /////////////////////////////////////////////////////////////////////////////// -isl::set operator&(isl::set S1, isl::set S2); isl::union_set operator&(isl::union_set S1, isl::set S2); isl::union_set operator&(isl::set S1, isl::union_set S2); -isl::union_set operator&(isl::union_set S1, isl::union_set S2); /////////////////////////////////////////////////////////////////////////////// // Operations on isl::set and isl::point @@ -281,13 +271,6 @@ inline bool operator!=(const isl::id& id1, const isl::id& id2) { // Helper functions /////////////////////////////////////////////////////////////////////////////// -// Given a set space, construct a map space with the input as domain and -// a range of the given size. -inline isl::space addRange(isl::space space, unsigned dim) { - auto range = space.params().unnamed_set_from_params(dim); - return space.map_from_domain_and_range(range); -} - // Given a space and a list of values, this returns the corresponding multi_val. template isl::multi_val makeMultiVal(isl::space s, const std::vector& vals) { diff --git a/tc/lang/error_report.h b/tc/lang/error_report.h index c710eb965..d7864fa60 100644 --- a/tc/lang/error_report.h +++ b/tc/lang/error_report.h @@ -16,6 +16,7 @@ #pragma once #include "tc/lang/tree.h" +#include "tc/utils/compiler_options.h" namespace lang { @@ -42,8 +43,12 @@ struct ErrorReport : public std::exception { mutable std::string the_message; }; -inline void warn(const ErrorReport& err) { - std::cerr << "WARNING: " << err.what(); +inline void warn( + const ErrorReport& err, + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) { + if (compilerOptions.emitWarnings) { + std::cerr << "WARNING: " << err.what(); + } } template diff --git a/tc/lang/sema.h b/tc/lang/sema.h index 3426c0208..8f8305679 100644 --- a/tc/lang/sema.h +++ b/tc/lang/sema.h @@ -21,6 +21,7 @@ #include "tc/lang/error_report.h" #include "tc/lang/tree.h" #include "tc/lang/tree_views.h" +#include "tc/utils/compiler_options.h" namespace lang { @@ -170,7 +171,9 @@ static inline TreeRef match_types(TreeRef a, TreeRef b) { /// variable objects. /// - checks that input variables are readonly. struct Sema { - std::unordered_map expr_to_type; + explicit Sema( + const tc::CompilerOptions& compilerOptions = tc::CompilerOptions()) + : compilerOptions(compilerOptions) {} TreeRef typeOfExpr(TreeRef ref) { if (expr_to_type.count(ref) == 0) { @@ -558,7 +561,7 @@ struct Sema { << " is not pre-initialized before calling the TC function," << " consider using the !-suffixed reduction operator " << tk << "! instead of " << tk; - warn(err); + warn(err, compilerOptions); } auto type = TensorType::create( @@ -707,7 +710,12 @@ struct Sema { // allowed std::unordered_set live_input_names; + std::unordered_map expr_to_type; + std::unordered_set inputParameters; std::unordered_set nonTemporaries; + + // TC compilation flow options. + tc::CompilerOptions compilerOptions; }; } // namespace lang diff --git a/tc/lang/test_expected/annotate.expected b/tc/lang/test_expected/annotate.expected index 937d7b75c..1cade9f62 100644 --- a/tc/lang/test_expected/annotate.expected +++ b/tc/lang/test_expected/annotate.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/builtins.expected b/tc/lang/test_expected/builtins.expected index ec8252c49..fdce29896 100644 --- a/tc/lang/test_expected/builtins.expected +++ b/tc/lang/test_expected/builtins.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/comments.expected b/tc/lang/test_expected/comments.expected index 0ca85db9e..7a6d7ac19 100644 --- a/tc/lang/test_expected/comments.expected +++ b/tc/lang/test_expected/comments.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/comprehension.expected b/tc/lang/test_expected/comprehension.expected index 0d6ca1947..35e694055 100644 --- a/tc/lang/test_expected/comprehension.expected +++ b/tc/lang/test_expected/comprehension.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (comprehension (ident R) (list (ident i) (ident j)) diff --git a/tc/lang/test_expected/convolution.expected b/tc/lang/test_expected/convolution.expected index b71d1758d..5b26581ef 100644 --- a/tc/lang/test_expected/convolution.expected +++ b/tc/lang/test_expected/convolution.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident conv) (list diff --git a/tc/lang/test_expected/function.expected b/tc/lang/test_expected/function.expected index 11b008e99..f60e13aa1 100644 --- a/tc/lang/test_expected/function.expected +++ b/tc/lang/test_expected/function.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (apply (ident foo) (list diff --git a/tc/lang/test_expected/indirect.expected b/tc/lang/test_expected/indirect.expected index 2a9da760d..f47d5e806 100644 --- a/tc/lang/test_expected/indirect.expected +++ b/tc/lang/test_expected/indirect.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/lexer.expected b/tc/lang/test_expected/lexer.expected index c9a2d19e0..dc542fbf0 100644 --- a/tc/lang/test_expected/lexer.expected +++ b/tc/lang/test_expected/lexer.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## FOUND 'min' min min+max 1.4 .3 3 3. ~~~ <--- HERE diff --git a/tc/lang/test_expected/lexer2.expected b/tc/lang/test_expected/lexer2.expected index 457f1f5cc..201bb50d1 100644 --- a/tc/lang/test_expected/lexer2.expected +++ b/tc/lang/test_expected/lexer2.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## min ~~~... <--- HERE 4.63 diff --git a/tc/lang/test_expected/math.expected b/tc/lang/test_expected/math.expected index 700d8d7d8..2b99f71a3 100644 --- a/tc/lang/test_expected/math.expected +++ b/tc/lang/test_expected/math.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (- (+ (+ diff --git a/tc/lang/test_expected/maxeq.expected b/tc/lang/test_expected/maxeq.expected index fbdfc865b..ea2c55f34 100644 --- a/tc/lang/test_expected/maxeq.expected +++ b/tc/lang/test_expected/maxeq.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/scalar.expected b/tc/lang/test_expected/scalar.expected index f1d381fca..d803a403c 100644 --- a/tc/lang/test_expected/scalar.expected +++ b/tc/lang/test_expected/scalar.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident fun) (list diff --git a/tc/lang/test_expected/sema-env.expected b/tc/lang/test_expected/sema-env.expected index d052a9d32..8a35c4d00 100644 --- a/tc/lang/test_expected/sema-env.expected +++ b/tc/lang/test_expected/sema-env.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## B: (int32) H: (int32) IP: (int32) diff --git a/tc/lang/test_expected/sema.expected b/tc/lang/test_expected/sema.expected index 720bb14ec..8d8d11b5a 100644 --- a/tc/lang/test_expected/sema.expected +++ b/tc/lang/test_expected/sema.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (def (ident conv) (list diff --git a/tc/lang/test_expected/statement.expected b/tc/lang/test_expected/statement.expected index c3750c25d..ad60f1ae3 100644 --- a/tc/lang/test_expected/statement.expected +++ b/tc/lang/test_expected/statement.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (comprehension (ident output) (list diff --git a/tc/lang/test_expected/trinary.expected b/tc/lang/test_expected/trinary.expected index 7efa23aba..5f52899aa 100644 --- a/tc/lang/test_expected/trinary.expected +++ b/tc/lang/test_expected/trinary.expected @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## (? (ident a) (const 3 (int32)) diff --git a/tc/proto/CMakeLists.txt b/tc/proto/CMakeLists.txt index 71e37e468..ba3980b93 100644 --- a/tc/proto/CMakeLists.txt +++ b/tc/proto/CMakeLists.txt @@ -58,16 +58,10 @@ function(tc_protobuf_generate_cpp_py output_dir srcs_var hdrs_var python_var) set(${python_var} ${${python_var}} PARENT_SCOPE) endfunction() -tc_protobuf_generate_cpp_py(${PROJECT_SOURCE_DIR}/tc/proto PROTO_SRCS PROTO_HDRS PROTO_PY mapping_options.proto compcache.proto) +tc_protobuf_generate_cpp_py(${CMAKE_CURRENT_BINARY_DIR} PROTO_SRCS PROTO_HDRS PROTO_PY mapping_options.proto compcache.proto) add_library(tc_proto SHARED ${PROTO_SRCS} ${PROTO_HDRS}) target_link_libraries(tc_proto ${PROTOBUF_LIBRARIES}) target_include_directories(tc_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_HDRS}) install(TARGETS tc_proto DESTINATION lib) -# "Install" to source_dir/tensor_comprehensions for easy inclusion in python -# package with setuptools. Without this, setuptools is hell. -install(PROGRAMS ${PROTO_PY} - DESTINATION ${PROJECT_SOURCE_DIR}/tensor_comprehensions) -install(PROGRAMS mapping_options.proto compcache.proto - DESTINATION ${PROJECT_SOURCE_DIR}/tensor_comprehensions) diff --git a/tc/proto/compcache.proto b/tc/proto/compcache.proto index 5bc615118..3fe815ac6 100644 --- a/tc/proto/compcache.proto +++ b/tc/proto/compcache.proto @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# syntax = "proto2"; import "mapping_options.proto"; diff --git a/tc/proto/mapping_options.proto b/tc/proto/mapping_options.proto index f99a91071..4b7572424 100644 --- a/tc/proto/mapping_options.proto +++ b/tc/proto/mapping_options.proto @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# syntax = "proto2"; package tc; @@ -72,6 +86,8 @@ message CudaMappingOptionsProto { required bool use_readonly_cache = 8; // Depth of promotion to private memory, ignored if use_private_memory is false. optional uint32 private_depth = 9; + // Depth of promotion to shared memory, ignored if use_shared_memory is false. + optional uint32 shared_depth = 10; } message CpuMappingOptionsProto { diff --git a/tc/tc_config.h.in b/tc/tc_config.h.in new file mode 100644 index 000000000..4eba10fe3 --- /dev/null +++ b/tc/tc_config.h.in @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#define TC_STRINGIFY_INNER(s) #s +#define TC_STRINGIFY(s) TC_STRINGIFY_INNER(s) + +// clang-format off +#define TC_DIR @TC_DIR@ +#define TC_WITH_CUDA @TC_WITH_CUDA@ +#define TC_CUDA_TOOLKIT_ROOT_DIR @TC_CUDA_TOOLKIT_ROOT_DIR@ +#define TC_CUDA_INCLUDE_DIR @TC_CUDA_INCLUDE_DIR@ +#define TC_CUB_INCLUDE_DIR @TC_CUB_INCLUDE_DIR@ +#define TC_LLVM_BIN_DIR @TC_LLVM_BIN_DIR@ +// clang-format on diff --git a/tc/utils/compiler_options.h b/tc/utils/compiler_options.h new file mode 100644 index 000000000..7519bf51e --- /dev/null +++ b/tc/utils/compiler_options.h @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +namespace tc { + +/// Container class for TC compiler options. +/// Unlike MappingOptions, these do not affect the behavior of the polyhedral +/// mapper but the general flow of the TC compilation, for example whether +/// syntax warnings should be generated when parsing TC definitions. +/// +/// This class intends to replace the uses of flags (aka global variables) +/// scattered around the codebae. +class CompilerOptions { + public: + /// Explicitly-default constructor. All member variables must have a default + /// assigned value. + CompilerOptions() = default; + + /// Print syntactic warnings. + bool emitWarnings = true; + /// Treat warnings in TC to Halide conversion as exceptions. + bool throwWarnings = false; +}; + +} // namespace tc diff --git a/tc/version/version.cc.in b/tc/version/version.cc.in index d8e221496..97bb73e4a 100644 --- a/tc/version/version.cc.in +++ b/tc/version/version.cc.in @@ -1,3 +1,17 @@ +/* Copyright (c) 2017-present, Facebook, Inc. +/* +/* Licensed under the Apache License, Version 2.0 (the "License"); +/* you may not use this file except in compliance with the License. +/* You may obtain a copy of the License at +/* +/* http://www.apache.org/licenses/LICENSE-2.0 +/* +/* Unless required by applicable law or agreed to in writing, software +/* distributed under the License is distributed on an "AS IS" BASIS, +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/* See the License for the specific language governing permissions and +/* limitations under the License. +/* ############################################################################# #include namespace tc { diff --git a/tensor_comprehensions/__init__.py b/tensor_comprehensions/__init__.py index fb097ac28..ddd755876 100644 --- a/tensor_comprehensions/__init__.py +++ b/tensor_comprehensions/__init__.py @@ -28,6 +28,10 @@ from tensor_comprehensions.tclib import debug_tc_mapper from tensor_comprehensions.tclib import debug_tuner from tensor_comprehensions.tclib import dump_cuda +from tensor_comprehensions.tclib import dump_ptx +from tensor_comprehensions.tclib import cuda_compiler +from tensor_comprehensions.tclib import llvm_flags +from tensor_comprehensions.tclib import nvcc_flags from tensor_comprehensions.tclib import CompilationCache from tensor_comprehensions.tclib import MappingOptions @@ -604,6 +608,10 @@ def make_autograd(forward_fun: Callable[[Iterable[torch.Tensor]], Iterable[torch 'debug_tc_mapper', 'debug_tuner', 'dump_cuda', + 'dump_ptx', + 'cuda_compiler', + 'llvm_flags', + 'nvcc_flags', # Functions exposed by the tclib 'compile', 'autotune', diff --git a/tensor_comprehensions/pybinds/tclib.cc b/tensor_comprehensions/pybinds/tclib.cc index c4b6e8ec6..a18fb4ca7 100644 --- a/tensor_comprehensions/pybinds/tclib.cc +++ b/tensor_comprehensions/pybinds/tclib.cc @@ -33,6 +33,7 @@ #include "tc/core/cuda/cuda_backend.h" #include "tc/core/cuda/cuda_tc_executor.h" #include "tc/core/flags.h" +#include "tc/core/functional.h" #include "tc/core/tensor.h" #include "tc/lang/canonicalize.h" @@ -437,6 +438,25 @@ PYBIND11_MODULE(tclib, m) { tc::FLAGS_debug_tuner = debug_tuner; }); m.def("dump_cuda", [](bool dump_cuda) { tc::FLAGS_dump_cuda = dump_cuda; }); + m.def("dump_ptx", [](bool dump_ptx) { tc::FLAGS_dump_ptx = dump_ptx; }); + m.def( + "cuda_compiler", + [](const std::string& cuda_compiler) { + tc::FLAGS_cuda_compiler = cuda_compiler; + }, + gflags::DescribeOneFlag( + gflags::GetCommandLineFlagInfoOrDie("cuda_compiler")) + .c_str()); + m.def( + "llvm_flags", + [](const std::string& llvm_flags) { tc::FLAGS_llvm_flags = llvm_flags; }, + gflags::DescribeOneFlag(gflags::GetCommandLineFlagInfoOrDie("llvm_flags")) + .c_str()); + m.def( + "nvcc_flags", + [](const std::string& nvcc_flags) { tc::FLAGS_nvcc_flags = nvcc_flags; }, + gflags::DescribeOneFlag(gflags::GetCommandLineFlagInfoOrDie("nvcc_flags")) + .c_str()); // Access the names of the defs in a TC string m.def("parse_defs", [](const std::string& tc) { diff --git a/test.sh b/test.sh index 93bb521f0..ca846e150 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -e diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5c5f62e35..5f18be9c6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -63,19 +63,6 @@ target_link_libraries( tc_core_cpu tc_lang tc_aten pthread) -if (WITH_TAPIR) - add_executable(test_mapper_tapir test_mapper_tapir.cc) - add_test(test_mapper_tapir test_mapper_tapir) - target_link_libraries( - test_mapper_tapir - - ${GTEST_LIBRARIES} - ${ATEN_LIBRARIES} - -lLLVM - - tc_core_cpu tc_lang tc_aten pthread) -endif() - ################################################################################ # Lang tests ################################################################################ diff --git a/test/caffe2/test_harness-inl.h b/test/caffe2/test_harness-inl.h index 581d4f936..5bedaa916 100644 --- a/test/caffe2/test_harness-inl.h +++ b/test/caffe2/test_harness-inl.h @@ -69,8 +69,11 @@ caffe2::Tensor GetNamedTensor( caffe2::Workspace& ws, const std::string& name) { // Resolved dynamically - return caffe2::Tensor( - ws.GetBlob(name)->Get()); + auto& t = ws.GetBlob(name)->Get(); + caffe2::Tensor res; + res.ResizeLike(t); + res.ShareData(t); + return res; } // helper functions to construct an ATen tensor from a caffe2 tensor diff --git a/test/cuda/test_autotuner.cc b/test/cuda/test_autotuner.cc index 71e36a30a..07f9e2c5b 100644 --- a/test/cuda/test_autotuner.cc +++ b/test/cuda/test_autotuner.cc @@ -72,7 +72,8 @@ struct ATenCompilationUnitTest : public ::testing::Test { if (FLAGS_no_memory_promotion) { fix.fixUseSharedMemory(false).fixUsePrivateMemory(false); } - auto options = geneticAutotuneATen.tune(name, inputs, {baseMapping}, fix); + auto options = geneticAutotuneATen.tune( + name, inputs, {baseMapping}, std::numeric_limits::max(), fix); if (options.size() > 0) { return options[0]; } diff --git a/test/cuda/test_basic_gpu.cc b/test/cuda/test_basic_gpu.cc index 4b856820e..d2545ff3f 100644 --- a/test/cuda/test_basic_gpu.cc +++ b/test/cuda/test_basic_gpu.cc @@ -51,7 +51,8 @@ std::vector jitCompile( std::string arch = arch_param.str(); // Compile the program. - std::string cudaHome = std::string("-I ") + std::string(CUDA_HOME); + std::string cudaHome = + std::string("-I ") + std::string(TC_STRINGIFY(TC_CUDA_INCLUDE_DIR)); std::vector nvrtcts = {arch.c_str(), "--use_fast_math", "-std=c++11", @@ -99,13 +100,15 @@ void loadUnload(const std::string& ptx) { TEST(BasicGpuTest, Nvrtc) { TC_CUDA_RUNTIMEAPI_ENFORCE(cudaFree(0)); - auto PTX = jitCompile(R"CUDA( + auto PTX = jitCompile( + R"CUDA( extern "C" { __global__ void foo(int N) { assert(N == 1); } -})CUDA", {"-G"}); +})CUDA", + {"-G"}); std::string ptx(PTX.data()); loadUnload(ptx); @@ -114,7 +117,7 @@ __global__ void foo(int N) } TEST(BasicGpuTest, CubReduce) { - std::string path(CUB_HOME); + std::string path(TC_STRINGIFY(TC_CUB_INCLUDE_DIR)); std::string include = std::string("-I ") + path; auto PTX = jitCompile( R"CUDA( @@ -153,15 +156,12 @@ namespace { // Mark the function argument as __restrict__ depending on the flag. std::string makeFuncWithOptionalRestrict(bool useRestrict) { std::stringstream ss; - ss << R"CUDA(typedef float float32; -extern "C" { -)CUDA"; ss - << (useRestrict ? "__global__ void func(float32* __restrict__ pO2) {" - : "__global__ void func(float32* pO2) {"); + << (useRestrict ? "__global__ void func(float* __restrict__ pO2) {" + : "__global__ void func(float* pO2) {"); ss << R"CUDA(int b0 = blockIdx.x; int t0 = threadIdx.x; - float32 (*O2)[2] = reinterpret_cast(pO2); + float (*O2)[2] = reinterpret_cast(pO2); O2[b0][t0] = 0.000000f; // S1 __syncthreads(); if (t0 == 0) { @@ -171,7 +171,6 @@ extern "C" { } __syncthreads(); O2[b0][t0] = fmax(O2[b0][t0], 0); // S3 -} })CUDA"; return ss.str(); } diff --git a/test/cuda/test_tc_mapper.cc b/test/cuda/test_tc_mapper.cc index a1f303bd7..feab7685d 100644 --- a/test/cuda/test_tc_mapper.cc +++ b/test/cuda/test_tc_mapper.cc @@ -327,8 +327,8 @@ def tensoraddstrided(float(N, M) I0_view, float(N, M) I1_view) -> (O) { auto res = Check(TC, name, options, inputs, checkFun); // This test should be modified when strided tensors are handled std::string expected = - "const float32 (*I0_view)[64] = " - "reinterpret_cast(pI0_view)"; + "const float (*I0_view)[64] = " + "reinterpret_cast(pI0_view)"; ASSERT_NE(std::string::npos, res.second.find(expected)) << "In resulting code:\n" << res.second << "\nfound unexpected: " << expected; diff --git a/test/test_core.cc b/test/test_core.cc index f2686e4e7..b0bc8e5b2 100644 --- a/test/test_core.cc +++ b/test/test_core.cc @@ -32,6 +32,7 @@ #include "tc/lang/error_report.h" #include "tc/library/copy.h" #include "tc/library/matmul.h" +#include "tc/utils/compiler_options.h" using namespace std; @@ -60,8 +61,8 @@ dtype { struct GenericHalideCoreTest : public ::testing::Test { void CheckC(const std::string& tc, const std::vector& expected) { auto curPos = std::string::npos; - auto halide = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + auto halide = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto res = tc::halideCodegenC(halide.stmt); for (const auto& e : expected) { auto newPos = res.find(e); @@ -243,16 +244,13 @@ struct TC2Isl : public ::testing::Test { DLConstTensorUPtr in = makeDLConstTensor(ti); // Must reuse the same ctx or memleaks ensue! - tc2halide::HalideComponents comps = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + tc2halide::HalideComponents comps = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto scop = polyhedral::Scop::makeScop(isl::with_exceptions::globalIslCtx(), comps); polyhedral::detail::validateSchedule(scop->scheduleRoot()); // Just check no crashes auto outputs = inferOutputTensorInfo(comps, {in.get()}); - // Check schedule construction equality - auto scheduleHalide = polyhedral::detail::fromIslSchedule( - polyhedral::detail::toIslSchedule(scop->scheduleRoot()).reset_user()); } }; diff --git a/test/test_cuda_mapper.cc b/test/test_cuda_mapper.cc index dbfc4f345..bd9f304a7 100644 --- a/test/test_cuda_mapper.cc +++ b/test/test_cuda_mapper.cc @@ -27,9 +27,9 @@ #include "tc/core/constants.h" #include "tc/core/cuda/cuda_libraries.h" #include "tc/core/cuda/cuda_mapping_options.h" +#include "tc/core/functional.h" #include "tc/core/polyhedral/cuda/codegen.h" #include "tc/core/polyhedral/cuda/mapped_scop.h" -#include "tc/core/polyhedral/functional.h" #include "tc/core/polyhedral/mapping_types.h" #include "tc/core/polyhedral/schedule_isl_conversion.h" #include "tc/core/polyhedral/schedule_transforms.h" @@ -44,13 +44,14 @@ using namespace std; using namespace tc; using namespace tc::polyhedral; +using namespace tc::polyhedral::cuda; using namespace tc::polyhedral::detail; struct PolyhedralMapperTest : public ::testing::Test { std::unique_ptr Prepare(std::string tc) { auto ctx = isl::with_exceptions::globalIslCtx(); // Build the SCoP corresponding to the Tc - return Scop::makeScop(ctx, tc); + return Scop::makeScop(ctx, tc, CompilerOptions()); } std::unique_ptr PrepareAndJoinBands(std::string tc) { @@ -132,7 +133,7 @@ struct PolyhedralMapperTest : public ::testing::Test { auto schedule = scop.scheduleRoot(); auto schedule2 = ScheduleTree::makeScheduleTree(*schedule); // make a copy bandTile(schedule->child({0}), tileSizes, tileOptions); - auto scheduleISLPP = fromIslSchedule(toIslSchedule(schedule).reset_user()); + auto scheduleISLPP = fromIslSchedule(toIslSchedule(schedule)); { auto ctx = isl::with_exceptions::globalIslCtx(); @@ -142,7 +143,7 @@ struct PolyhedralMapperTest : public ::testing::Test { schedule2->child({0})->as()->mupa_.get_space(), tileSizes); islNode = islNode.as().tile(mv); - auto scheduleISL = fromIslSchedule(islNode.get_schedule().reset_user()); + auto scheduleISL = fromIslSchedule(islNode.get_schedule()); ASSERT_TRUE(*scheduleISL == *scheduleISLPP) << *scheduleISL << "\nVS\n" << *scheduleISLPP; @@ -365,9 +366,9 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { std::string expected( R"RES(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*C)[M] = reinterpret_cast(pC); - const float32 (*A)[M] = reinterpret_cast(pA); - const float32 (*B)[M] = reinterpret_cast(pB); + float (*C)[M] = reinterpret_cast(pC); + const float (*A)[M] = reinterpret_cast(pA); + const float (*B)[M] = reinterpret_cast(pB); for (int c1 = 16 * b1; c1 < M; c1 += 4096) { if (M >= t0 + c1 + 1) { C[(t1 + 16 * b0)][(t0 + c1)] = (A[(t1 + 16 * b0)][(t0 + c1)] + B[(t1 + 16 * b0)][(t0 + c1)]); @@ -400,16 +401,16 @@ def fun(float(N, N, N, N) A, float(N, N) B, float(N, N) C, float(N, N) D) std::string expected( R"RES(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O1)[N] = reinterpret_cast(pO1); - float32 (*O2)[N] = reinterpret_cast(pO2); - float32 (*O3)[N] = reinterpret_cast(pO3); - const float32 (*A)[N][N][N] = reinterpret_cast(pA); - const float32 (*B)[N] = reinterpret_cast(pB); - const float32 (*C)[N] = reinterpret_cast(pC); - const float32 (*D)[N] = reinterpret_cast(pD); + float (*O1)[N] = reinterpret_cast(pO1); + float (*O2)[N] = reinterpret_cast(pO2); + float (*O3)[N] = reinterpret_cast(pO3); + const float (*A)[N][N][N] = reinterpret_cast(pA); + const float (*B)[N] = reinterpret_cast(pB); + const float (*C)[N] = reinterpret_cast(pC); + const float (*D)[N] = reinterpret_cast(pD); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < N; c1 += 1) { - O1[c0][c1] = 0.000000f; + O1[c0][c1] = (float)0.000000; } } for (int c0 = 0; c0 < N; c0 += 1) { @@ -449,14 +450,14 @@ def fun(float(N, N) A) -> (O) auto res = std::get<0>(mscop->codegen(specializedName)); string expected( - R"RES(__global__ void kernel_anon(int32 N, float32* pO, const float32* pA) { + R"RES(__global__ void kernel_anon(int N, float* pO, const float* pA) { int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[N] = reinterpret_cast(pO); - const float32 (*A)[N] = reinterpret_cast(pA); + float (*O)[N] = reinterpret_cast(pO); + const float (*A)[N] = reinterpret_cast(pA); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < N; c1 += 1) { - O[c0][c1] = (((A[c0][c1] + float32(c0)) + float32(c1)) + float32(N)); + O[c0][c1] = (((A[c0][c1] + (float)(c0)) + (float)(c1)) + (float)(N)); } } } @@ -478,13 +479,13 @@ def fun(float(N, N) A, float(N, N) B, float(N) C) -> (O) auto res = std::get<0>(mscop->codegen(specializedName)); string expected = - R"RES(__global__ void kernel_anon(int32 N, float32* pO, const float32* pA, const float32* pB, const float32* pC) { + R"RES(__global__ void kernel_anon(int N, float* pO, const float* pA, const float* pB, const float* pC) { int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[512] = reinterpret_cast(pO); - const float32 (*A)[512] = reinterpret_cast(pA); - const float32 (*B)[512] = reinterpret_cast(pB); - const float32 (*C) = reinterpret_cast(pC); + float (*O)[512] = reinterpret_cast(pO); + const float (*A)[512] = reinterpret_cast(pA); + const float (*B)[512] = reinterpret_cast(pB); + const float (*C) = reinterpret_cast(pC); for (int c0 = 0; c0 <= 511; c0 += 1) { for (int c1 = 0; c1 <= 511; c1 += 1) { O[c0][c1] = (nextafter(C[c0], exp(A[c0][c1])) + log(B[c1][c0])); @@ -499,13 +500,13 @@ def fun(float(N, N) A, float(N, N) B, float(N) C) -> (O) constexpr auto kExpectedMatmul_64_64_64 = R"CUDA(int b0 = blockIdx.x; int b1 = blockIdx.y; int b2 = blockIdx.z; int t0 = threadIdx.x; int t1 = threadIdx.y; int t2 = threadIdx.z; - float32 (*O)[64] = reinterpret_cast(pO); - const float32 (*A)[64] = reinterpret_cast(pA); - const float32 (*B)[64] = reinterpret_cast(pB); + float (*O)[64] = reinterpret_cast(pO); + const float (*A)[64] = reinterpret_cast(pA); + const float (*B)[64] = reinterpret_cast(pB); for (int c0 = 0; c0 <= 63; c0 += 16) { for (int c1 = 0; c1 <= 63; c1 += 16) { for (int c2 = t1; c2 <= 15; c2 += 8) { - O[(c0 + c2)][(t0 + c1)] = 0.000000f; + O[(c0 + c2)][(t0 + c1)] = (float)0.000000; for (int c4 = 0; c4 <= 63; c4 += 1) { O[(c0 + c2)][(t0 + c1)] = (O[(c0 + c2)][(t0 + c1)] + (A[(c0 + c2)][c4]*B[c4][(t0 + c1)])); } diff --git a/test/test_cuda_mapper_memory_promotion.cc b/test/test_cuda_mapper_memory_promotion.cc index 2b1b08fa9..0fb7405b8 100644 --- a/test/test_cuda_mapper_memory_promotion.cc +++ b/test/test_cuda_mapper_memory_promotion.cc @@ -30,6 +30,7 @@ using namespace std; using namespace tc; using namespace tc::polyhedral; +using namespace tc::polyhedral::cuda; namespace { int npoints(isl::set s) { @@ -46,7 +47,7 @@ class TestMapper : public ::testing::Test { const CudaMappingOptions& mappingOptions, std::unordered_map problemSizes) { auto ctx = isl::with_exceptions::globalIslCtx(); - auto scop = Scop::makeScop(ctx, tc); + auto scop = Scop::makeScop(ctx, tc, CompilerOptions()); scop = Scop::makeSpecializedScop(*scop, problemSizes); scop->specializeToContext(); return MappedScop::makeWithOuterBlockInnerThreadStrategy( @@ -113,9 +114,9 @@ def fun(float(N,M,K,L) A, float(N,M,K,L) B) -> (C) { }; TEST_F(Sum4D, CodeOuterBand) { - auto declarations = {"__shared__ float32 _A_0[16][16][16][16];", - "__shared__ float32 _B_0[16][16][16][16];", - "__shared__ float32 _C_0[16][16][16][16];"}; + auto declarations = {"__shared__ float _A_0[16][16][16][16];", + "__shared__ float _B_0[16][16][16][16];", + "__shared__ float _C_0[16][16][16][16];"}; auto copyA = "_A_0[c4][c5][c6][c7] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][c3 + c7];"; @@ -161,9 +162,9 @@ TEST_F(Sum4D, CodeOuterBand) { * promoteEverythingAt does not call mapCopiesToThreads. */ TEST_F(Sum4D, CodeAboveThreadMapping) { - auto declarations = {"__shared__ float32 _A_0[16][16][16][16];", - "__shared__ float32 _B_0[16][16][16][16];", - "__shared__ float32 _C_0[16][16][16][16];"}; + auto declarations = {"__shared__ float _A_0[16][16][16][16];", + "__shared__ float _B_0[16][16][16][16];", + "__shared__ float _C_0[16][16][16][16];"}; auto copyA = "_A_0[c4][c5][c6][c7] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][c3 + c7]"; auto copyB = @@ -204,9 +205,9 @@ TEST_F(Sum4D, CodeAboveThreadMapping) { } TEST_F(Sum4D, CodeInnerBand) { - auto declarations = {"__shared__ float32 _C_0[1][1][1][1];", - "__shared__ float32 _A_0[1][1][1][1];", - "__shared__ float32 _B_0[1][1][1][1];"}; + auto declarations = {"__shared__ float _C_0[1][1][1][1];", + "__shared__ float _A_0[1][1][1][1];", + "__shared__ float _B_0[1][1][1][1];"}; auto copyA = "_A_0[0][0][0][0] = A[16 * b0 + c4][16 * b1 + c5][c2 + c6][t0 + c3];"; auto copyB = @@ -273,7 +274,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { EXPECT_EQ(groups.size(), 3u); - isl::space tileSpace = isl::space(ctx, 0).unnamed_set_from_params(2); + isl::space tileSpace = isl::space(ctx, 0).add_unnamed_tuple_ui(2); auto tileZero = isl::set::from(isl::multi_aff::zero(tileSpace)); // Must have groups for these tensors, in arbitrary order. @@ -392,7 +393,7 @@ def fun(float(N, M) A) -> (B, C) { size_t maxSharedMemory) { auto mscop = prepareScop( tc, {{"N", problemSize1}, {"M", problemSize2}}, {tileSize1, tileSize2}); - promoteGreedilyAtDepth(*mscop, depth, maxSharedMemory, false); + promoteToSharedAtDepth(*mscop, depth, maxSharedMemory, false); return mscop; } }; @@ -437,14 +438,14 @@ TEST_F(MapperMemoryPromotionRAW, fitAtOuterDepths) { << "expected one reference group to be promoted"; } -TEST_F(MapperMemoryPromotionRAW, throwIfCopiesBelowThreads) { - EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 3, 8192), - promotion::PromotionBelowThreadsException); +TEST_F(MapperMemoryPromotionRAW, noSharedPromotionBelowThreads) { + auto mscop1 = makeWithSharedGreedy(42, 40, 64, 64, 3, 8192); + EXPECT_EQ(mscop1->scop().promotedDecls().size(), 0u) + << "expected no promotion below threads"; - EXPECT_THROW( - makeWithSharedGreedy(42, 40, 64, 64, 4, 8192), - promotion::PromotionBelowThreadsException); + auto mscop2 = makeWithSharedGreedy(42, 40, 64, 64, 4, 8192); + EXPECT_EQ(mscop2->scop().promotedDecls().size(), 0u) + << "expected no promotion below threads"; } class MatMulBias : public TestMapper { @@ -473,9 +474,9 @@ def fun(float(N,K) A, float(K,M) B, float(N,M) C) -> (O) { } void expectNoABCPromotion(const std::string& code) { - auto aDeclPos = code.find(" float32 _A_0"); - auto bDeclPos = code.find(" float32 _B_0"); - auto cDeclPos = code.find(" float32 _C_0"); + auto aDeclPos = code.find(" float _A_0"); + auto bDeclPos = code.find(" float _B_0"); + auto cDeclPos = code.find(" float _C_0"); EXPECT_TRUE(aDeclPos == std::string::npos) << "tensor A promoted to register but has elements accessed " << "by multiple threads"; @@ -487,7 +488,7 @@ def fun(float(N,K) A, float(K,M) B, float(N,M) C) -> (O) { } void expectFourOElementsPromoted(const std::string& code) { - auto oDeclPos = code.find("float32 _O_0[4][1];"); + auto oDeclPos = code.find("float _O_0[4][1];"); EXPECT_TRUE(oDeclPos != std::string::npos) << "expected O to be promoted to registers"; @@ -541,7 +542,7 @@ TEST_F(MatMulBias, RegisterPromotion) { .usePrivateMemory(true); auto code = emitCode({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); - auto declPos = code.find("float32 _O_0"); + auto declPos = code.find("float _O_0"); auto copyToPos = code.find("_O_0[0][0] = O[32 * b0 + c3][t0 + 32 * b1]", declPos + 1); auto copyFromPos = @@ -570,7 +571,7 @@ TEST_F(MatMulBias, RegisterPromotionSharedPreference) { auto code = emitCode({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); - auto declPos = code.find("float32 _O_0[1][1]"); + auto declPos = code.find("float _O_0[1][1]"); EXPECT_TRUE(declPos == std::string::npos) << "not expected promotion to register because promoted to shared"; @@ -606,7 +607,7 @@ TEST_F(MatMulBias, RegistersAtRootNotEnoughUnroll) { auto mscop = prepare({{"N", 42}, {"M", 56}, {"K", 37}}, mappingOptions); promoteToRegistersBelow(*mscop, mscop->scop().scheduleRoot()); auto code = emitCode(mscop); - auto oDeclPos = code.find("float32 _O_0;"); + auto oDeclPos = code.find("float _O_0;"); EXPECT_TRUE(oDeclPos == std::string::npos) << "not expected O to be promoted to registers"; diff --git a/test/test_inference.cc b/test/test_inference.cc index 004df7143..0d596c6ca 100644 --- a/test/test_inference.cc +++ b/test/test_inference.cc @@ -22,11 +22,14 @@ using namespace std; using namespace lang; +using tc::CompilerOptions; struct InferenceTest : public ::testing::Test { void Check(const string& tc, const string& expected) { - auto halideComponents = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc, true); + CompilerOptions compilerOptions; + compilerOptions.throwWarnings = true; + auto halideComponents = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, compilerOptions); stringstream ss; // Ordered map for repro diff --git a/test/test_lang.cc b/test/test_lang.cc index c1c2b1902..0dfcfb841 100644 --- a/test/test_lang.cc +++ b/test/test_lang.cc @@ -26,6 +26,7 @@ #include "tc/lang/parser.h" #include "tc/lang/sema.h" #include "tc/lang/tc_format.h" +#include "tc/tc_config.h" using namespace lang; @@ -34,7 +35,7 @@ using namespace lang; #endif const std::string expected_file_path = - std::string(TC_DIR) + "/tc/lang/test_expected/"; + std::string(TC_STRINGIFY(TC_DIR)) + "/tc/lang/test_expected/"; static inline void barf(const char* fmt, ...) { char msg[2048]; diff --git a/test/test_mapper_llvm.cc b/test/test_mapper_llvm.cc index 8a051b426..4e14ab45e 100644 --- a/test/test_mapper_llvm.cc +++ b/test/test_mapper_llvm.cc @@ -23,6 +23,7 @@ #include "tc/core/cpu/cpu_mapping_options.h" #include "tc/core/cpu/cpu_tc_executor.h" #include "tc/core/polyhedral/codegen_llvm.h" +#include "tc/core/polyhedral/cpu/mapped_scop.h" #include "tc/core/polyhedral/llvm_jit.h" #include "tc/core/polyhedral/scop.h" #include "tc/core/scope_guard.h" @@ -47,17 +48,23 @@ def fun(float(N, M) A, float(N, M) B) -> (C) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - - Jit jit; - jit.codegenScop("kernel_anon", *scop); - auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("kernel_anon"); + auto mscop = cpu::MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("kernel_anon"); + auto fptr = reinterpret_cast( + pJit->getSymbolAddress("kernel_anon")); at::Tensor A = at::CPU(at::kFloat).rand({N, M}); at::Tensor B = at::CPU(at::kFloat).rand({N, M}); at::Tensor C = at::CPU(at::kFloat).rand({N, M}); at::Tensor Cc = A + B; - fptr(A.data(), B.data(), C.data()); + auto orderedParameters = mscop->scop().getParameterValues(); + fptr( + A.data(), + B.data(), + C.data(), + orderedParameters[0], + orderedParameters[1]); checkRtol(Cc - C, {A, B}, N * M); } @@ -82,6 +89,21 @@ TEST(LLVMCodegen, MultiStmt) { auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"L", L}}); + auto mscop = cpu::MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("kernel_anon"); + auto fptr = reinterpret_cast(pJit->getSymbolAddress("kernel_anon")); at::Tensor A = at::CPU(at::kFloat).rand({N, M, K, L}); at::Tensor B = at::CPU(at::kFloat).rand({N, M}); @@ -93,11 +115,7 @@ TEST(LLVMCodegen, MultiStmt) { at::Tensor O1c = at::CPU(at::kFloat).rand({N, M}); at::Tensor O2c = at::CPU(at::kFloat).rand({N, M}); at::Tensor O3c = at::CPU(at::kFloat).rand({N, M}); - - Jit jit; - jit.codegenScop("kernel_anon", *scop); - auto fptr = (void (*)(float*, float*, float*, float*, float*, float*, float*)) - jit.getSymbolAddress("kernel_anon"); + auto orderedParameters = mscop->scop().getParameterValues(); fptr( A.data(), B.data(), @@ -105,7 +123,11 @@ TEST(LLVMCodegen, MultiStmt) { D.data(), O1.data(), O2.data(), - O3.data()); + O3.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3]); for (int c0 = 0; c0 < N; c0 += 1) { for (int c1 = 0; c1 < M; c1 += 1) { @@ -144,21 +166,30 @@ def batch_matmul(float(B, N, M) X, float(B, M, K) Y) -> (Z) { Z(b, n, k) +=! X(b, n, r_m) * Y(b, r_m, k) } )"; - at::Tensor X = at::CPU(at::kFloat).rand({B, N, M}); - at::Tensor Y = at::CPU(at::kFloat).rand({B, M, K}); - at::Tensor O = X.bmm(Y); - at::Tensor Oc = at::CPU(at::kFloat).zeros_like(O); - auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( *scop, {{"N", N}, {"M", M}, {"K", K}, {"B", B}}); - - Jit jit; - jit.codegenScop("batch_matmul", *scop); + auto mscop = cpu::MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("batch_matmul"); auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("batch_matmul"); - fptr(X.data(), Y.data(), Oc.data()); + reinterpret_cast( + pJit->getSymbolAddress("batch_matmul")); + + at::Tensor X = at::CPU(at::kFloat).rand({B, N, M}); + at::Tensor Y = at::CPU(at::kFloat).rand({B, M, K}); + at::Tensor O = X.bmm(Y); + at::Tensor Oc = at::CPU(at::kFloat).zeros_like(O); + auto orderedParameters = mscop->scop().getParameterValues(); + fptr( + X.data(), + Y.data(), + Oc.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3]); checkRtol(O - Oc, {Y, X}, M, 3e-7); } @@ -178,11 +209,6 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) } )"; - at::Tensor I = at::CPU(at::kFloat).rand({NN, C, H, W}); - at::Tensor W1 = at::CPU(at::kFloat).rand({O, C, KH, KW}); - at::Tensor B = at::CPU(at::kFloat).rand({O}); - at::Tensor expected = at::conv2d(I, W1, B); - auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop( @@ -194,12 +220,28 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) {"W", W}, {"KW", KW}, {"C", C}}); - - Jit jit; - jit.codegenScop("convolution", *scop); - auto fptr = - (void (*)(float*, float*, float*, float*, float*))jit.getSymbolAddress( - "convolution"); + auto mscop = cpu::MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("convolution"); + auto fptr = reinterpret_cast(pJit->getSymbolAddress("convolution")); + + auto orderedParameters = mscop->scop().getParameterValues(); + at::Tensor I = at::CPU(at::kFloat).rand({NN, C, H, W}); + at::Tensor W1 = at::CPU(at::kFloat).rand({O, C, KH, KW}); + at::Tensor B = at::CPU(at::kFloat).rand({O}); + at::Tensor expected = at::conv2d(I, W1, B); at::Tensor tmp = at::CPU(at::kFloat).zeros_like(expected); at::Tensor output = at::CPU(at::kFloat).zeros_like(expected); @@ -208,7 +250,14 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1) W1.data(), B.data(), tmp.data(), - output.data()); + output.data(), + orderedParameters[0], + orderedParameters[1], + orderedParameters[2], + orderedParameters[3], + orderedParameters[4], + orderedParameters[5], + orderedParameters[6]); TC_CHECK_EQ(output.ndimension(), 4); checkRtol(output - expected, {I, W1, B}, C * KH * KW, 1e-6); } @@ -225,11 +274,13 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { auto ctx = isl::with_exceptions::globalIslCtx(); auto scop = polyhedral::Scop::makeScop(ctx, tc); scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); + auto mscop = cpu::MappedScop::makeSequential( + std::move(scop), CpuMappingOptions::makeNaiveMappingOptions()); + auto pJit = mscop->codegen("concat"); + auto fptr = reinterpret_cast( + pJit->getSymbolAddress("concat")); - Jit jit; - jit.codegenScop("concat", *scop); - auto fptr = (void (*)(float*, float*, float*))jit.getSymbolAddress("concat"); - + auto orderedParameters = mscop->scop().getParameterValues(); at::Tensor A = at::CPU(at::kFloat).rand({M, N}); at::Tensor B = at::CPU(at::kFloat).rand({M, N}); at::Tensor O1 = at::CPU(at::kFloat).rand({N, 2, M}); @@ -241,7 +292,12 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) { O1c[n][1][m] = B[m][n]; } } - fptr(A.data(), B.data(), O1.data()); + fptr( + A.data(), + B.data(), + O1.data(), + orderedParameters[0], + orderedParameters[1]); checkRtol(O1c - O1, {A, B}, N * M); } diff --git a/test/test_mapper_tapir.cc b/test/test_mapper_tapir.cc deleted file mode 100644 index 1fd405c71..000000000 --- a/test/test_mapper_tapir.cc +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2017-present, Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include -#include - -#include "tc/aten/aten.h" -#include "tc/core/cpu/cpu_tc_executor.h" -#include "tc/core/mapping_options.h" -#include "tc/core/polyhedral/codegen_llvm.h" -#include "tc/core/polyhedral/llvm_jit.h" -#include "tc/core/polyhedral/scop.h" -#include "tc/core/scope_guard.h" - -#include "test_harness_aten.h" - -using namespace std; - -using namespace tc; -using namespace tc::polyhedral; -using namespace tc::polyhedral::detail; - -TEST(TapirCodegen, BasicParallel) { - string tc = R"TC( -def fun(float(N, M) A, float(N, M) B) -> (C) { - C(n, m) = A(n, m) + B(n, m) -} -)TC"; - auto N = 40; - auto M = 24; - - auto ctx = isl::with_exceptions::globalIslCtx(); - auto scop = polyhedral::Scop::makeScop(ctx, tc); - scop = Scop::makeSpecializedScop(*scop, {{"N", N}, {"M", M}}); - SchedulerOptionsProto sop; - SchedulerOptionsView sov(sop); - scop = Scop::makeScheduled(*scop, sov); - Jit jit; - auto mod = jit.codegenScop("kernel_anon", *scop); - auto fn = mod->getFunction("kernel_anon"); - - std::set calledFunctions; - for (llvm::inst_iterator I = llvm::inst_begin(fn), E = llvm::inst_end(fn); - I != E; - ++I) { - if (llvm::CallInst* c = llvm::dyn_cast(&*I)) { - if (auto called = c->getCalledFunction()) { - calledFunctions.insert(called->getName()); - } - } - } - - ASSERT_NE(0u, calledFunctions.count("__cilkrts_get_tls_worker")); - ASSERT_NE(0u, calledFunctions.count("__cilkrts_bind_thread_1")); - ASSERT_NE(0u, calledFunctions.count("llvm.stacksave")); - ASSERT_NE(0u, calledFunctions.count("__cilkrts_sync")); - - auto fptr = - (void (*)(float*, float*, float*))jit.getSymbolAddress("kernel_anon"); - - at::Tensor A = at::CPU(at::kFloat).rand({N, M}); - at::Tensor B = at::CPU(at::kFloat).rand({N, M}); - at::Tensor C = at::CPU(at::kFloat).rand({N, M}); - at::Tensor Cc = A + B; - fptr(A.data(), B.data(), C.data()); - - checkRtol(Cc - C, {A, B}, N * M); -} - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - ::gflags::ParseCommandLineFlags(&argc, &argv, true); - ::google::InitGoogleLogging(argv[0]); - initialize_llvm(); - return RUN_ALL_TESTS(); -} diff --git a/test/test_tc2halide.cc b/test/test_tc2halide.cc index 12dfdf7b8..1a326c060 100644 --- a/test/test_tc2halide.cc +++ b/test/test_tc2halide.cc @@ -32,8 +32,8 @@ using namespace std; struct TC2Isl : public ::testing::Test { void SetUp() {} void Check(const string& tc) { - auto halide = - tc2halide::translate(isl::with_exceptions::globalIslCtx(), tc); + auto halide = tc2halide::translate( + isl::with_exceptions::globalIslCtx(), tc, CompilerOptions()); auto scop = polyhedral::Scop::makeScop( isl::with_exceptions::globalIslCtx(), halide); auto scheduleHalide = scop->scheduleRoot(); diff --git a/test_cpu.sh b/test_cpu.sh index 3efcb5311..01f8a39a0 100755 --- a/test_cpu.sh +++ b/test_cpu.sh @@ -1,3 +1,17 @@ +# Copyright (c) 2017-present, Facebook, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## #! /bin/bash set -e diff --git a/third-party/islpp b/third-party/islpp index 74bfaa242..96fef8767 160000 --- a/third-party/islpp +++ b/third-party/islpp @@ -1 +1 @@ -Subproject commit 74bfaa24280c341c33db2f457d72f55326577b1c +Subproject commit 96fef8767ee8823d0316e040c827c78b28802ce9