initial import of isl 0.26.

this enables additional optimisations in GCC.  from the README:

isl is a thread-safe C library for manipulating sets and relations
of integer points bounded by affine constraints.  The descriptions of
the sets and relations may involve both parameters and existentially
quantified variables.  All computations are performed in exact integer
arithmetic using GMP.

isl is released under the MIT license, but depends on the LGPL GMP
library.
This commit is contained in:
mrg 2023-12-29 22:07:40 +00:00
parent e81d63576b
commit f9ed56a6e9
1368 changed files with 461142 additions and 0 deletions

71
external/mit/isl/dist/AUTHORS vendored Normal file
View File

@ -0,0 +1,71 @@
isl was written by
Sven Verdoolaege
2006-2007 Leiden Institute of Advanced Computer Science
Universiteit Leiden
Niels Bohrweg 1
2333 CA Leiden
The Netherlands
2008-2009 K.U.Leuven
Departement Computerwetenschappen
Celestijnenlaan 200A
B-3001 Leuven
Belgium
2010-2011 INRIA Saclay - Ile-de-France
Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod
91893 Orsay
France
2011-2012 consultant for Leiden Institute of Advanced Computer Science
2012-2014 Ecole Normale Superieure
45 rue d'Ulm, 75230 Paris
France
2014-2015 INRIA Rocquencourt
Domaine de Voluceau - Rocquencourt, B.P. 105
78153 Le Chesnay
France
2015-2022 Polly Labs
2018-2021 Cerebras Systems
175 S San Antonio Rd
Los Altos, CA
USA
2021-2022 Cerebras Systems
1237 E Arques Ave
Sunnyvale, CA
USA
Contributions by
Mythri Alle
Riyadh Baghdadi
Serge Belyshev
Basile Clement
Albert Cohen
Ray Donnelly
Johannes Doerfert
Andi Drebes
Ron Estrin
Clement Foyer
Armin Groesslinger
Tobias Grosser
Frederik Harwath
Alexandre Isoard
Andreas Kloeckner
Michael Kruse
Manjunath Kudlur
Alexander Matz
Chielo Newctle
Riccardo Mori
Sebastian Pop
Louis-Noel Pouchet
Benoit Pradelle
Uday Bondhugula
Andreas Simbuerger
Tianjiao Sun
Malhar Thakkar
Sergei Trofimovich
Miheer Vaidya
Sven van Haastregt
Matt Whitlock
Oleksandr Zinenko
The merge sort implementation was written by Jeffrey Stedfast.

267
external/mit/isl/dist/ChangeLog vendored Normal file
View File

@ -0,0 +1,267 @@
version: 0.26
date: Sat Apr 1 05:10:53 PM CEST 2023
changes:
- fix inherited overloaded methods in Python bindings
- decompose topological sort of clusters in incremental scheduler
- improved isl_pw_aff_list_{min,max}
- add some convenience functions
- more exports to (templated C++) bindings
- slightly improved conversion from binary relation to function
---
version: 0.25
date: Sat 02 Jul 2022 11:14:57 AM CEST
changes:
- support (type safe) user object on id in bindings
- more exports to (templated C++) bindings
- add some convenience functions
---
version: 0.24
date: Sun 25 Apr 2021 03:56:37 PM CEST
changes:
- improved (C++) bindings (inherit methods, renamed exports)
- initial templated C++ bindings
- detect bounds on constant polynomials as tight
---
version: 0.23
date: Sun 01 Nov 2020 02:41:20 PM CET
changes:
- minor improvements to coalescing
- use build compiler to build extract_interface
- add some convenience functions
- ignore parameters in isl_union_* hash tables
---
version: 0.22.1
date: Sun Jan 12 10:48:18 CET 2020
changes:
- fix error handling
---
version: 0.22
date: Fri Nov 1 18:39:30 CET 2019
changes:
- require C++11 to generate bindings
- improved bindings
- scheduler fix involving fixed dimensions
- accept ranges in tuples during parsing
- add some convenience functions
---
version: 0.21
date: Sat Mar 9 15:25:29 CET 2019
changes:
- preliminary C++ bindings
- use incremental scheduler by default
- introduce isl_size type
- rename isl_ast_op_type to isl_ast_expr_op_type
- fix coalescing bugs
- use isl_bool to return extra boolean argument
---
version: 0.20
date: Sat Jul 21 18:10:08 CEST 2018
changes:
- keep track of domain in 0D isl_multi_pw_aff and isl_multi_union_pw_aff
- add isl_aff_eval and isl_pw_aff_eval
- add fixed-size rectangular box hull
---
version: 0.19
date: Sat Mar 3 10:44:49 CET 2018
changes:
- minor improvements to coalescing
- minor improvement to parametric integer programming
- try harder to avoid large coefficients in scheduler
- support kill accesses in dependence analysis
- drop deprecated isl_int
- drop deprecated band forests
- drop deprecated functions
---
version: 0.18
date: Sun Dec 18 11:01:58 CET 2016
changes:
- improve elimination of redundant existentially quantified variables
- improve coalescing
- improve parametric integer programming
- preserve isolate option in isl_schedule_node_band_split
- print AST nodes in YAML format
- minor improvements to Python bindings
---
version: 0.17.1
date: Fri May 6 12:02:48 CEST 2016
changes:
- fix bug in coalescing treatment
---
version: 0.17
date: Tue May 3 14:26:43 CEST 2016
changes:
- optionally combine SCCs incrementally in scheduler
- optionally maximize coincidence in scheduler
- optionally avoid loop coalescing in scheduler
- fix handling of nested integer divisions
- optionally detect min/max expressions during AST generation
- minor AST generator improvements
- simplify stride constraints
- improve support for expansions in schedule trees
---
version: 0.16.1
date: Thu Jan 14 18:08:06 CET 2016
changes:
- fix bug in simplification
---
version: 0.16
date: Tue Jan 12 09:56:16 CET 2016
changes:
- add 32 bit integer optimization for IMath
- minor AST generator improvements
- add isl_union_flow_get_full_{may,must}_dependence
- minor improvements to Python bindings
- minor improvements to set and map printing
---
version: 0.15
date: Thu Jun 11 12:45:33 CEST 2015
changes:
- improve coalescing
- add isl_union_access_info_compute_flow
- add mark nodes in AST
- add isl_union_pw_aff and isl_multi_union_pw_aff
- add schedule trees
- deprecate band forests
- deprecate separation_class AST generation option
- introduce isl_bool and isl_stat types
---
version: 0.14.1
date: Thu Apr 9 12:57:23 CEST 2015
changes:
- fix bug in affine expression normalization
- fix handling of conditional validity constraints
---
version: 0.14
date: Sat Oct 25 16:08:47 CEST 2014
changes:
- support IMath as an optional replacement for GMP
- minor AST generator improvements
---
version: 0.13
date: Mon Apr 14 11:08:45 CEST 2014
changes:
- deprecate isl_int
- improved support for multi piecewise quasi-affine expressions
- allow the user to impose a bound on the number of low-level operations
- add isl_id_to_ast_expr and isl_id_to_pw_aff
- add isl_schedule_constraints
- hide internal structure of isl_vec
- remove support for piplib
---
version: 0.12.2
date: Sun Jan 12 12:09:46 CET 2014
changes:
- MinGW-w64 build fix
- fix simplification bug
---
version: 0.12.1
date: Wed Jul 24 12:54:46 CEST 2013
changes:
- handle malloc returning NULL on zero-size allocation
- fix regression in AST generator
---
version: 0.12
date: Sun Jun 23 20:23:05 CEST 2013
changes:
- add isl_val abstraction
---
version: 0.11.2
date: Tue Apr 9 18:45:10 CEST 2013
changes:
- make code generation output the same on Solaris
- fix some hard to trigger bugs
---
version: 0.11.1
date: Mon Dec 10 11:55:30 CET 2012
changes:
- add LICENSE file to distribution
- make code generation output independent of endianness
---
version: 0.11
date: Mon Dec 3 08:17:18 CET 2012
changes:
- change license from LGPL 2.1 to MIT
- add support for multi piecewise quasi-affine expressions
- add code generation
- various minor bug fixes
---
version: 0.10
date: Sun Jun 3 18:00:16 CEST 2012
changes:
- support for interaction with dependence analysis
- add public API for vectors
- improved support for (piecewise) multi quasi-affine expressions
- various minor bug fixes
---
version: 0.09
date: Sat Dec 17 18:19:26 CET 2011
changes:
- improved argument parsing
- hide internal structure of isl_options
- improved support for parameter sets
- configurable scheduling
---
version: 0.08
date: Fri Oct 21 12:36:20 CEST 2011
changes:
- improved parsing
- drop isl_div abstraction
- rename isl_dim to isl_space
- |-
explicitly differentiate between spaces of maps,
sets and parameter sets
- add support for identifiers
- add support for (piecewise) multi quasi-affine expressions
- preliminary Python bindings
---
version: 0.07
date: Tue Jul 12 19:34:51 CEST 2011
changes:
- hide internal structures of isl_div and isl_constraint
- preliminary scheduling
- add support for local spaces and (piecewise) quasi-affine expressions
---
version: 0.06
date: Fri Mar 18 15:59:16 CET 2011
changes:
- improved parsing
- consistency changes in API
- hide internal structure of isl_ctx
---
version: 0.05.1
date: Wed Jan 5 10:21:42 CET 2011
changes:
- fix simple symmetry detection in parametric integer programming
---
version: 0.05
date: Thu Dec 23 17:03:14 CET 2010
changes:
- rename header files from isl_header.h to isl/header.h
- add higher level interface for dependence analysis
- improved argument parsing
- optionally triangulate domains during Bernstein expansion
- support extended PolyLib format
- hide internal structure of some data types
- improved coalescing
- add simple symmetry detection in parametric integer programming
---
version: 0.04
date: Fri Sep 10 12:57:50 CEST 2010
changes:
- rename isl_pw_qpolynomial_fold_add
- add isl_map_apply_pw_qpolynomial_fold
- support named and nested spaces
- support union sets and maps
- add public API for matrices
---
version: 0.03
date: Tue Jun 29 13:16:46 CEST 2010
changes:
- new printing functions
- support for "may" accesses in dependence analysis
- improved coalescing
- improved transitive closure
- fix several hard to trigger bugs
- improved argument parsing
- support parametric vertex enumeration for barvinok
- optionally use Bernstein expansion to compute bounds

1
external/mit/isl/dist/GIT_HEAD_ID vendored Normal file
View File

@ -0,0 +1 @@
isl-0.26

19
external/mit/isl/dist/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

719
external/mit/isl/dist/Makefile.am vendored Normal file
View File

@ -0,0 +1,719 @@
if HAVE_CLANG
if HAVE_CXX11
MAYBE_INTERFACE = interface
FORCE:
interface/extract_interface$(BUILD_EXEEXT): FORCE
$(MAKE) $(AM_MAKEFLAGS) -C interface extract_interface$(BUILD_EXEEXT)
endif
endif
SUBDIRS = . $(MAYBE_INTERFACE) doc
DIST_SUBDIRS = $(MAYBE_INTERFACE) doc
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = nostdinc subdir-objects
lib_LTLIBRARIES = libisl.la
noinst_PROGRAMS = isl_test isl_polyhedron_sample isl_pip \
isl_polyhedron_minimize isl_polytope_scan \
isl_polyhedron_detect_equalities \
isl_polyhedron_remove_redundant_equalities isl_cat \
isl_closure isl_bound isl_schedule isl_codegen isl_test_int \
isl_flow isl_flow_cmp isl_schedule_cmp
TESTS = isl_test codegen_test.sh pip_test.sh bound_test.sh isl_test_int \
flow_test.sh schedule_test.sh
if HAVE_CPP_ISL_H
CPP_H = include/isl/cpp.h include/isl/typed_cpp.h
if HAVE_CXX11
noinst_PROGRAMS += isl_test2 isl_test_cpp
TESTS += isl_test2 isl_test_cpp isl_test_cpp_failed.sh
endif
if HAVE_CXX17
noinst_PROGRAMS += isl_test_cpp17 isl_test_cpp17-checked
TESTS += isl_test_cpp17 isl_test_cpp17-checked
endif
endif
if HAVE_CLANG
if HAVE_CXX11
noinst_PROGRAMS += isl_test_cpp-checked isl_test_cpp-checked-conversion
TESTS += isl_test_cpp-checked isl_test_cpp-checked-conversion
if HAVE_PYTHON
TESTS += isl_test_python.py
noinst_PYTHON = interface/isl.py
isl_test_python.py: interface/isl.py libisl.la
endif
endif
endif
TEST_EXTENSIONS = .py
AM_TESTS_ENVIRONMENT = \
export PYTHONPATH=interface; \
export ISL_DYLD_LIBRARY_PATH=.libs; \
export LD_LIBRARY_PATH=".libs:$(LD_LIBRARY_PATH)";
PY_LOG_COMPILER = $(PYTHON)
if IMATH_FOR_MP
MP_SRC = \
isl_imath.c \
isl_imath.h \
isl_int_imath.h \
imath_wrap/gmp_compat.h \
imath_wrap/imath.h \
imath_wrap/imrat.h \
imath_wrap/wrap.h \
imath_wrap/gmp_compat.c \
imath_wrap/imath.c \
imath_wrap/imrat.c
noinst_PROGRAMS += isl_test_imath
TESTS += isl_test_imath
if SMALL_INT_OPT
MP_SRC += isl_int_sioimath.h \
isl_int_sioimath.c \
isl_val_sioimath.c
else
MP_SRC += isl_val_imath.c
endif
MP_INCLUDE_H =
endif
if GMP_FOR_MP
if NEED_GET_MEMORY_FUNCTIONS
GET_MEMORY_FUNCTIONS=mp_get_memory_functions.c
endif
MP_SRC = \
$(GET_MEMORY_FUNCTIONS) \
isl_int_gmp.h \
isl_gmp.c \
isl_val_gmp.c
MP_INCLUDE_H = include/isl/val_gmp.h
endif
includes = -I. -I$(srcdir) -I$(srcdir)/include -Iinclude/
AM_CPPFLAGS = $(includes) @MP_CPPFLAGS@
AM_CFLAGS = @WARNING_FLAGS@ @MP_CFLAGS@
libisl_la_SOURCES = \
$(MP_SRC) \
isl_aff.c \
isl_aff_map.c \
isl_aff_private.h \
isl_affine_hull.c \
isl_arg.c \
isl_ast.c \
isl_ast_private.h \
isl_ast_build.c \
isl_ast_build_private.h \
isl_ast_build_expr.c \
isl_ast_build_expr.h \
isl_ast_codegen.c \
isl_ast_graft.c \
isl_ast_graft_private.h \
isl_basis_reduction.h \
basis_reduction_tab.c \
isl_bernstein.c \
isl_bernstein.h \
isl_blk.c \
isl_blk.h \
isl_bound.c \
isl_bound.h \
isl_box.c \
isl_coalesce.c \
isl_constraint.c \
isl_constraint_private.h \
isl_convex_hull.c \
isl_ctx.c \
isl_ctx_private.h \
isl_deprecated.c \
isl_dim_map.h \
isl_dim_map.c \
isl_equalities.c \
isl_equalities.h \
isl_factorization.c \
isl_factorization.h \
isl_farkas.c \
isl_ffs.c \
isl_flow.c \
isl_fold.c \
isl_hash.c \
isl_hash_private.h \
isl_id_to_ast_expr.c \
isl_id_to_id.c \
isl_id_to_pw_aff.c \
isl_ilp.c \
isl_ilp_private.h \
isl_input.c \
isl_int.h \
isl_list_private.h \
isl_local_private.h \
isl_local.h \
isl_local.c \
isl_local_space_private.h \
isl_local_space.c \
isl_lp.c \
isl_lp_private.h \
isl_map.c \
isl_map_list.c \
isl_map_simplify.c \
isl_map_subtract.c \
isl_map_private.h \
isl_map_to_basic_set.c \
isl_mat.c \
isl_mat_private.h \
isl_morph.c \
isl_morph.h \
isl_id.c \
isl_id_private.h \
isl_obj.c \
isl_options.c \
isl_options_private.h \
isl_output.c \
isl_output_private.h \
isl_point_private.h \
isl_point.c \
isl_polynomial_private.h \
isl_polynomial.c \
isl_printer_private.h \
isl_printer.c \
print.c \
isl_range.c \
isl_range.h \
isl_reordering.c \
isl_reordering.h \
isl_sample.h \
isl_sample.c \
isl_scan.c \
isl_scan.h \
isl_schedule.c \
isl_schedule_band.c \
isl_schedule_band.h \
isl_schedule_node.c \
isl_schedule_node_private.h \
isl_schedule_read.c \
isl_schedule_tree.c \
isl_schedule_tree.h \
isl_schedule_private.h \
isl_schedule_constraints.c \
isl_schedule_constraints.h \
isl_scheduler.c \
isl_scheduler.h \
isl_scheduler_clustering.c \
isl_scheduler_clustering.h \
isl_scheduler_scc.c \
isl_scheduler_scc.h \
isl_set_list.c \
isl_sort.c \
isl_sort.h \
isl_space.c \
isl_space_private.h \
isl_stream.c \
isl_stream_private.h \
isl_seq.c \
isl_seq.h \
isl_set_to_ast_graft_list.c \
isl_set_to_ast_graft_list.h \
isl_stride.c \
isl_tab.c \
isl_tab.h \
isl_tab_pip.c \
isl_tarjan.c \
isl_tarjan.h \
isl_transitive_closure.c \
isl_union_map.c \
isl_union_map_private.h \
isl_union_set_private.h \
isl_val.c \
isl_val_private.h \
isl_vec_private.h \
isl_vec.c \
isl_version.c \
isl_vertices_private.h \
isl_vertices.c \
isl_yaml.h
libisl_la_LIBADD = @MP_LIBS@
libisl_la_LDFLAGS = -version-info @versioninfo@ \
@MP_LDFLAGS@
isl_test_LDFLAGS = @MP_LDFLAGS@
isl_test_LDADD = libisl.la @MP_LIBS@
isl_test2_SOURCES = \
isl_test2.cc \
include/isl/cpp.h
isl_test2_LDFLAGS = @MP_LDFLAGS@
isl_test2_LDADD = libisl.la @MP_LIBS@
isl_test_int_LDFLAGS = @MP_LDFLAGS@
isl_test_int_LDADD = libisl.la @MP_LIBS@
if IMATH_FOR_MP
isl_test_imath_LDFLAGS = @MP_LDFLAGS@
isl_test_imath_LDADD = libisl.la @MP_LIBS@
endif
isl_polyhedron_sample_LDADD = libisl.la
isl_polyhedron_sample_SOURCES = \
polyhedron_sample.c
isl_pip_LDFLAGS = @MP_LDFLAGS@
isl_pip_LDADD = libisl.la @MP_LIBS@
isl_pip_SOURCES = \
pip.c
isl_schedule_LDFLAGS = @MP_LDFLAGS@
isl_schedule_LDADD = libisl.la @MP_LIBS@
isl_schedule_SOURCES = \
schedule.c
isl_schedule_cmp_LDFLAGS = @MP_LDFLAGS@
isl_schedule_cmp_LDADD = libisl.la @MP_LIBS@
isl_schedule_cmp_SOURCES = \
schedule_cmp.c
isl_flow_LDFLAGS = @MP_LDFLAGS@
isl_flow_LDADD = libisl.la @MP_LIBS@
isl_flow_SOURCES = \
flow.c
isl_flow_cmp_LDFLAGS = @MP_LDFLAGS@
isl_flow_cmp_LDADD = libisl.la @MP_LIBS@
isl_flow_cmp_SOURCES = \
flow_cmp.c
isl_codegen_LDFLAGS = @MP_LDFLAGS@
isl_codegen_LDADD = libisl.la @MP_LIBS@
isl_codegen_SOURCES = \
codegen.c
isl_bound_LDFLAGS = @MP_LDFLAGS@
isl_bound_LDADD = libisl.la @MP_LIBS@
isl_bound_SOURCES = \
bound.c
isl_polyhedron_minimize_LDFLAGS = @MP_LDFLAGS@
isl_polyhedron_minimize_LDADD = libisl.la @MP_LIBS@
isl_polyhedron_minimize_SOURCES = \
polyhedron_minimize.c
isl_polytope_scan_LDADD = libisl.la
isl_polytope_scan_SOURCES = \
polytope_scan.c
isl_polyhedron_detect_equalities_LDADD = libisl.la
isl_polyhedron_detect_equalities_SOURCES = \
polyhedron_detect_equalities.c
isl_polyhedron_remove_redundant_equalities_LDADD = libisl.la
isl_polyhedron_remove_redundant_equalities_SOURCES = \
polyhedron_remove_redundant_equalities.c
isl_cat_LDADD = libisl.la
isl_cat_SOURCES = \
cat.c
isl_closure_LDADD = libisl.la
isl_closure_SOURCES = \
closure.c
isl_test_cpp_CPPFLAGS = $(AM_CPPFLAGS) -UCOMPILE_ERROR
isl_test_cpp_SOURCES = \
isl_test_cpp.cc \
include/isl/cpp.h
isl_test_cpp_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp_LDADD = libisl.la @MP_LIBS@
# This program is not meant to be compiled by default.
# In fact it is meant not to be compilable.
# It is identical to isl_test_cpp, except that it gets compiled
# with the COMPILE_ERROR flag set.
EXTRA_PROGRAMS = isl_test_cpp_failed
isl_test_cpp_failed_CPPFLAGS = $(AM_CPPFLAGS) -DCOMPILE_ERROR
isl_test_cpp_failed_SOURCES = \
isl_test_cpp.cc \
include/isl/cpp.h
isl_test_cpp_failed_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp_failed_LDADD = libisl.la @MP_LIBS@
isl_test_cpp17_SOURCES = \
isl_test_cpp17.cc \
include/isl/cpp.h
isl_test_cpp17_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp17_LDADD = libisl.la @MP_LIBS@
isl_test_cpp_checked_SOURCES = \
isl_test_cpp-checked.cc \
include/isl/cpp-checked.h
isl_test_cpp_checked_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp_checked_LDADD = libisl.la @MP_LIBS@
isl_test_cpp17_checked_SOURCES = \
isl_test_cpp17-checked.cc \
include/isl/cpp.h
isl_test_cpp17_checked_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp17_checked_LDADD = libisl.la @MP_LIBS@
isl_test_cpp_checked_conversion_SOURCES = \
isl_test_cpp-checked-conversion.cc \
include/isl/cpp-checked-conversion.h
isl_test_cpp_checked_conversion_LDFLAGS = @MP_LDFLAGS@
isl_test_cpp_checked_conversion_LDADD = libisl.la @MP_LIBS@
# dummy library that captures the dependencies on all headers
# that are relevant for the bindings
noinst_LIBRARIES = libdep.a
libdep_a_SOURCES = dep.c
if HAVE_CLANG
if HAVE_CXX11
interface/isldlname.py: libisl.la
$(AM_V_GEN) $(GREP) dlname $< | $(SED) -e 's/dlname/isl_dlname/' > $@
interface/isl.py: interface/extract_interface$(BUILD_EXEEXT) libdep.a \
python/isl.py.top interface/isldlname.py
(cat interface/isldlname.py $(srcdir)/python/isl.py.top && \
interface/extract_interface$(BUILD_EXEEXT) --language=python \
$(includes) $(srcdir)/all.h) \
> $@ || (rm $@ && false)
include/isl/cpp.h: interface/extract_interface$(BUILD_EXEEXT) libdep.a \
cpp/cpp.h.top cpp/cpp.h.bot
$(MKDIR_P) "include/isl" && \
(cat $(srcdir)/cpp/cpp.h.top $(srcdir)/all.h && \
interface/extract_interface$(BUILD_EXEEXT) --language=cpp \
$(includes) $(srcdir)/all.h && \
cat $(srcdir)/cpp/cpp.h.bot) \
> $@ || (rm $@ && false)
include/isl/cpp-checked.h: interface/extract_interface$(BUILD_EXEEXT) libdep.a \
cpp/cpp-checked.h.top cpp/cpp-checked.h.bot
$(MKDIR_P) "include/isl" && \
(cat $(srcdir)/cpp/cpp-checked.h.top $(srcdir)/all.h && \
interface/extract_interface$(BUILD_EXEEXT) \
--language=cpp-checked \
$(includes) $(srcdir)/all.h && \
cat $(srcdir)/cpp/cpp-checked.h.bot) \
> $@ || (rm $@ && false)
include/isl/cpp-checked-conversion.h: \
interface/extract_interface$(BUILD_EXEEXT) \
libdep.a \
cpp/cpp-checked-conversion.h.top \
cpp/cpp-checked-conversion.h.bot
$(MKDIR_P) "include/isl" && \
(cat $(srcdir)/cpp/cpp-checked-conversion.h.top && \
interface/extract_interface$(BUILD_EXEEXT) \
--language=cpp-checked-conversion \
$(includes) $(srcdir)/all.h && \
cat $(srcdir)/cpp/cpp-checked-conversion.h.bot) \
> $@ || (rm $@ && false)
include/isl/typed_cpp.h: interface/extract_interface$(BUILD_EXEEXT) \
libdep.a cpp/typed_cpp.h.top cpp/typed_cpp.h.bot
$(MKDIR_P) "include/isl" && \
(cat $(srcdir)/cpp/typed_cpp.h.top && \
interface/extract_interface$(BUILD_EXEEXT) \
--language=template-cpp \
$(includes) $(srcdir)/all.h && \
cat $(srcdir)/cpp/typed_cpp.h.bot) \
> $@ || (rm $@ && false)
endif
endif
nodist_pkginclude_HEADERS = \
include/isl/stdint.h
pkginclude_HEADERS = \
$(CPP_H) \
$(MP_INCLUDE_H) \
include/isl/aff.h \
include/isl/aff_type.h \
include/isl/arg.h \
include/isl/ast.h \
include/isl/ast_type.h \
include/isl/ast_build.h \
include/isl/constraint.h \
include/isl/ctx.h \
include/isl/fixed_box.h \
include/isl/flow.h \
include/isl/id.h \
include/isl/id_type.h \
include/isl/id_to_ast_expr.h \
include/isl/id_to_id.h \
include/isl/id_to_pw_aff.h \
include/isl/ilp.h \
include/isl/hash.h \
include/isl/hmap.h \
include/isl/hmap_templ.c \
include/isl/list.h \
include/isl/local_space.h \
include/isl/lp.h \
include/isl/mat.h \
include/isl/map.h \
include/isl/map_to_basic_set.h \
include/isl/map_type.h \
include/isl/maybe.h \
include/isl/maybe_ast_expr.h \
include/isl/maybe_basic_set.h \
include/isl/maybe_id.h \
include/isl/maybe_pw_aff.h \
include/isl/maybe_templ.h \
include/isl/multi.h \
include/isl/obj.h \
include/isl/options.h \
include/isl/point.h \
include/isl/polynomial.h \
include/isl/polynomial_type.h \
include/isl/printer.h \
include/isl/printer_type.h \
include/isl/schedule.h \
include/isl/schedule_node.h \
include/isl/schedule_type.h \
include/isl/set.h \
include/isl/set_type.h \
include/isl/space.h \
include/isl/space_type.h \
include/isl/stream.h \
include/isl/stride_info.h \
include/isl/union_map.h \
include/isl/union_map_type.h \
include/isl/union_set.h \
include/isl/union_set_type.h \
include/isl/val.h \
include/isl/val_type.h \
include/isl/vec.h \
include/isl/version.h \
include/isl/vertices.h
if HAVE_CLANG
if HAVE_CXX11
CPP_INTERFACES = \
include/isl/cpp.h \
include/isl/cpp-checked.h \
include/isl/cpp-checked-conversion.h \
include/isl/typed_cpp.h
endif
endif
BUILT_SOURCES = gitversion.h $(CPP_INTERFACES)
CLEANFILES = \
gitversion.h \
interface/isldlname.py \
interface/isl.py \
interface/isl.pyc \
interface/__pycache__/*.pyc \
$(CPP_INTERFACES)
DISTCLEANFILES = \
isl-uninstalled.sh \
isl-uninstalled.pc \
isl.pc \
isl.pc.in \
include/isl/stdint.h
EXTRA_DIST = \
LICENSE \
isl_config_post.h \
isl_aff_lex_templ.c \
isl_align_params_templ.c \
isl_align_params_bin_templ.c \
isl_ast_node_set_field_templ.c \
basis_reduction_templ.c \
isl_bind_domain_templ.c \
bset_to_bmap.c \
bset_from_bmap.c \
isl_check_named_params_templ.c \
check_parse_fail_test_templ.c \
check_reparse_templ.c \
check_reparse_test_templ.c \
check_single_reference_templ.c \
check_type_range_templ.c \
isl_copy_tuple_id_templ.c \
isl_domain_factor_templ.c \
isl_drop_unused_params_templ.c \
extract_key.c \
isl_from_range_templ.c \
isl_ilp_opt_fn_val_templ.c \
isl_ilp_opt_multi_val_templ.c \
isl_ilp_opt_val_templ.c \
has_single_reference_templ.c \
isl_insert_domain_templ.c \
isl_list_macro.h \
isl_list_templ.c \
isl_list_templ.h \
isl_list_read_templ.c \
isl_list_read_yaml_templ.c \
isl_map_bound_templ.c \
isl_map_lexopt_templ.c \
isl_maybe_ast_graft_list.h \
isl_maybe_map.h \
isl_multi_macro.h \
isl_multi_bind_templ.c \
isl_multi_explicit_domain.c \
isl_multi_pw_aff_explicit_domain.c \
isl_multi_union_pw_aff_explicit_domain.c \
isl_multi_no_explicit_domain.c \
isl_multi_no_domain_templ.c \
isl_multi_templ.c \
isl_multi_templ.h \
isl_multi_add_constant_templ.c \
isl_multi_align_set.c \
isl_multi_align_union_set.c \
isl_multi_apply_templ.c \
isl_multi_apply_explicit_domain_templ.c \
isl_multi_apply_no_explicit_domain_templ.c \
isl_multi_apply_set_explicit_domain_templ.c \
isl_multi_apply_set_no_explicit_domain_templ.c \
isl_multi_apply_union_set_explicit_domain_templ.c \
isl_multi_arith_templ.c \
isl_multi_bin_val_templ.c \
isl_multi_bind_domain_templ.c \
isl_multi_check_domain_templ.c \
isl_multi_cmp.c \
isl_multi_coalesce.c \
isl_multi_dim_id_templ.c \
isl_multi_dims.c \
isl_multi_domain_templ.c \
isl_multi_domain_reverse_templ.c \
isl_multi_floor.c \
isl_multi_from_base_templ.c \
isl_multi_from_tuple_templ.c \
isl_multi_gist.c \
isl_multi_hash.c \
isl_multi_insert_domain_templ.c \
isl_multi_intersect.c \
isl_multi_identity_templ.c \
isl_multi_locals_templ.c \
isl_multi_min_max_templ.c \
isl_multi_move_dims_templ.c \
isl_multi_nan_templ.c \
isl_multi_param_templ.c \
isl_multi_product_templ.c \
isl_multi_pw_aff_pullback_templ.c \
isl_multi_read_no_explicit_domain_templ.c \
isl_multi_splice_templ.c \
isl_multi_tuple_id_templ.c \
isl_multi_un_op_templ.c \
isl_multi_unbind_params_templ.c \
isl_multi_union_add_templ.c \
isl_multi_zero_templ.c \
isl_multi_zero_space_templ.c \
isl_opt_mpa_templ.c \
opt_type.h \
print_templ.c \
print_templ_yaml.c \
print_yaml_field_templ.c \
isl_power_templ.c \
isl_project_out_all_params_templ.c \
isl_project_out_param_templ.c \
isl_pw_macro.h \
isl_pw_templ.c \
isl_pw_templ.h \
isl_pw_add_constant_templ.c \
isl_pw_add_constant_multi_val_templ.c \
isl_pw_add_constant_val_templ.c \
isl_pw_add_disjoint_templ.c \
isl_pw_bind_domain_templ.c \
isl_pw_domain_reverse_templ.c \
isl_pw_eval.c \
isl_pw_fix_templ.c \
isl_pw_from_range_templ.c \
isl_pw_hash.c \
isl_pw_insert_dims_templ.c \
isl_pw_insert_domain_templ.c \
isl_pw_lift_templ.c \
isl_pw_locals_templ.c \
isl_pw_morph_templ.c \
isl_pw_move_dims_templ.c \
isl_pw_neg_templ.c \
isl_pw_opt_templ.c \
isl_pw_print_templ.c \
isl_pw_pullback_templ.c \
isl_pw_range_tuple_id_templ.c \
isl_pw_scale_templ.c \
isl_pw_split_dims_templ.c \
isl_pw_sub_templ.c \
isl_pw_un_op_templ.c \
isl_pw_union_opt.c \
isl_read_from_str_templ.c \
read_in_string_templ.c \
set_to_map.c \
set_from_map.c \
set_list_from_map_list_inl.c \
isl_stream_read_pw_with_params_templ.c \
isl_stream_read_with_params_templ.c \
isl_tab_lexopt_templ.c \
isl_test_list_templ.c \
isl_test_plain_equal_templ.c \
isl_type_check_equal_space_templ.c \
isl_type_check_match_range_multi_val.c \
isl_type_has_equal_space_bin_templ.c \
isl_type_has_equal_space_templ.c \
isl_type_has_space_templ.c \
isl_unbind_params_templ.c \
uset_to_umap.c \
uset_from_umap.c \
isl_union_macro.h \
isl_union_templ.c \
isl_union_single.c \
isl_union_multi.c \
isl_union_domain_reverse_templ.c \
isl_union_eval.c \
isl_union_locals_templ.c \
isl_union_map_lex_templ.c \
isl_union_neg.c \
isl_union_print_templ.c \
isl_union_pw_templ.c \
isl_union_sub_templ.c \
libisl-gdb.py \
doc/CodingStyle \
doc/SubmittingPatches \
doc/implementation.tex \
doc/isl.bib \
doc/mypod2latex \
doc/manual.tex \
doc/reading.tex \
doc/user.pod \
imath/gmp_compat.c \
imath/gmp_compat.h \
imath/imath.c \
imath/imath.h \
imath/imrat.c \
imath/imrat.h \
all.h \
cpp \
python \
isl_test_cpp-generic.cc \
isl_test_cpp_failed.sh \
isl_test_cpp17-generic.cc \
isl_test_python.py \
test_inputs
dist-hook:
echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID
(cd doc; make manual.pdf)
cp doc/manual.pdf $(distdir)/doc/
pkgconfigdir=$(pkgconfig_libdir)
pkgconfig_DATA = $(pkgconfig_libfile)
gitversion.h: @GIT_HEAD@
$(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@
install-data-local: $(srcdir)/libisl-gdb.py
@libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
$(builddir)/libisl.la`; \
case $$libisl in \
'') echo Cannot find isl library name. GDB bindings not installed.;; \
*) echo $(INSTALL_DATA) $(srcdir)/libisl-gdb.py \
$(DESTDIR)$(libdir)/$$libisl-gdb.py; \
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"; \
$(INSTALL_DATA) $(srcdir)/libisl-gdb.py \
$(DESTDIR)$(libdir)/$$libisl-gdb.py; \
esac
uninstall-local:
@libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
$(builddir)/libisl.la`; \
if test -n "$${libisl}"; then \
rm -f $(DESTDIR)$(libdir)/$$libisl-gdb.py; \
fi

3165
external/mit/isl/dist/Makefile.in vendored Normal file

File diff suppressed because it is too large Load Diff

53
external/mit/isl/dist/README vendored Normal file
View File

@ -0,0 +1,53 @@
isl is a thread-safe C library for manipulating sets and relations
of integer points bounded by affine constraints. The descriptions of
the sets and relations may involve both parameters and existentially
quantified variables. All computations are performed in exact integer
arithmetic using GMP.
isl is released under the MIT license, but depends on the LGPL GMP
library.
Minimal compilation instructions:
./configure
make
make install
If you are taking the source from the git repository, then you first
need to do
git clone git://repo.or.cz/isl.git
./autogen.sh
For more information, see doc/user.pod or the generated documentation.
New releases are announced on http://groups.google.com/group/isl-announce
If you use isl, you can let me know by stacking
https://www.openhub.net/p/isl on Open Hub.
For bug reports, feature requests and questions,
contact http://groups.google.com/group/isl-development
Whenever you report a bug, please mention the exact version of isl
that you are using (output of "./isl_cat --version"). If you are unable
to compile isl, then report the git version (output of "git describe")
or the version included in the name of the tarball.
If you use isl for your research, you are invited do cite
the following paper and/or the paper(s) describing the specific
operations you use.
@incollection{Verdoolaege2010isl,
author = {Verdoolaege, Sven},
title = {isl: An Integer Set Library for the Polyhedral Model},
booktitle = {Mathematical Software - ICMS 2010},
series = {Lecture Notes in Computer Science},
editor = {Fukuda, Komei and Hoeven, Joris and Joswig, Michael and
Takayama, Nobuki},
publisher = {Springer},
isbn = {978-3-642-15581-9},
pages = {299-302},
volume = {6327},
year = {2010}
}

1533
external/mit/isl/dist/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

15
external/mit/isl/dist/all.h vendored Normal file
View File

@ -0,0 +1,15 @@
#include <isl/id.h>
#include <isl/id_to_id.h>
#include <isl/space.h>
#include <isl/val.h>
#include <isl/aff.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/ilp.h>
#include <isl/union_set.h>
#include <isl/union_map.h>
#include <isl/flow.h>
#include <isl/schedule.h>
#include <isl/schedule_node.h>
#include <isl/ast_build.h>
#include <isl/fixed_box.h>

View File

@ -0,0 +1,293 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#include <assert.h>
#include <isl_map_private.h>
#include <isl_seq.h>
#include "isl_tab.h"
#include <isl_int.h>
#include <isl_config.h>
struct tab_lp {
struct isl_ctx *ctx;
struct isl_vec *row;
struct isl_tab *tab;
struct isl_tab_undo **stack;
isl_int *obj;
isl_int opt;
isl_int opt_denom;
isl_int tmp;
isl_int tmp2;
int neq;
unsigned dim;
/* number of constraints in initial product tableau */
int con_offset;
/* objective function has fixed or no integer value */
int is_fixed;
};
#ifdef USE_GMP_FOR_MP
#define GBR_type mpq_t
#define GBR_init(v) mpq_init(v)
#define GBR_clear(v) mpq_clear(v)
#define GBR_set(a,b) mpq_set(a,b)
#define GBR_set_ui(a,b) mpq_set_ui(a,b,1)
#define GBR_mul(a,b,c) mpq_mul(a,b,c)
#define GBR_lt(a,b) (mpq_cmp(a,b) < 0)
#define GBR_is_zero(a) (mpq_sgn(a) == 0)
#define GBR_numref(a) mpq_numref(a)
#define GBR_denref(a) mpq_denref(a)
#define GBR_floor(a,b) mpz_fdiv_q(a,GBR_numref(b),GBR_denref(b))
#define GBR_ceil(a,b) mpz_cdiv_q(a,GBR_numref(b),GBR_denref(b))
#define GBR_set_num_neg(a, b) mpz_neg(GBR_numref(*a), b);
#define GBR_set_den(a, b) mpz_set(GBR_denref(*a), b);
#endif /* USE_GMP_FOR_MP */
#ifdef USE_IMATH_FOR_MP
#include <imrat.h>
#define GBR_type mp_rat
#define GBR_init(v) v = mp_rat_alloc()
#define GBR_clear(v) mp_rat_free(v)
#define GBR_set(a,b) mp_rat_copy(b,a)
#define GBR_set_ui(a,b) mp_rat_set_uvalue(a,b,1)
#define GBR_mul(a,b,c) mp_rat_mul(b,c,a)
#define GBR_lt(a,b) (mp_rat_compare(a,b) < 0)
#define GBR_is_zero(a) (mp_rat_compare_zero(a) == 0)
#ifdef USE_SMALL_INT_OPT
#define GBR_numref(a) isl_sioimath_encode_big(mp_rat_numer_ref(a))
#define GBR_denref(a) isl_sioimath_encode_big(mp_rat_denom_ref(a))
#define GBR_floor(a, b) isl_sioimath_fdiv_q((a), GBR_numref(b), GBR_denref(b))
#define GBR_ceil(a, b) isl_sioimath_cdiv_q((a), GBR_numref(b), GBR_denref(b))
#define GBR_set_num_neg(a, b) \
do { \
isl_sioimath_scratchspace_t scratch; \
impz_neg(mp_rat_numer_ref(*a), \
isl_sioimath_bigarg_src(*b, &scratch));\
} while (0)
#define GBR_set_den(a, b) \
do { \
isl_sioimath_scratchspace_t scratch; \
impz_set(mp_rat_denom_ref(*a), \
isl_sioimath_bigarg_src(*b, &scratch));\
} while (0)
#else /* USE_SMALL_INT_OPT */
#define GBR_numref(a) mp_rat_numer_ref(a)
#define GBR_denref(a) mp_rat_denom_ref(a)
#define GBR_floor(a,b) impz_fdiv_q(a,GBR_numref(b),GBR_denref(b))
#define GBR_ceil(a,b) impz_cdiv_q(a,GBR_numref(b),GBR_denref(b))
#define GBR_set_num_neg(a, b) impz_neg(GBR_numref(*a), b)
#define GBR_set_den(a, b) impz_set(GBR_denref(*a), b)
#endif /* USE_SMALL_INT_OPT */
#endif /* USE_IMATH_FOR_MP */
static struct tab_lp *init_lp(struct isl_tab *tab);
static void set_lp_obj(struct tab_lp *lp, isl_int *row, int dim);
static int solve_lp(struct tab_lp *lp);
static void get_obj_val(struct tab_lp* lp, GBR_type *F);
static void delete_lp(struct tab_lp *lp);
static int add_lp_row(struct tab_lp *lp, isl_int *row, int dim);
static void get_alpha(struct tab_lp* lp, int row, GBR_type *alpha);
static int del_lp_row(struct tab_lp *lp) WARN_UNUSED;
static int cut_lp_to_hyperplane(struct tab_lp *lp, isl_int *row);
#define GBR_LP struct tab_lp
#define GBR_lp_init(P) init_lp(P)
#define GBR_lp_set_obj(lp, obj, dim) set_lp_obj(lp, obj, dim)
#define GBR_lp_solve(lp) solve_lp(lp)
#define GBR_lp_get_obj_val(lp, F) get_obj_val(lp, F)
#define GBR_lp_delete(lp) delete_lp(lp)
#define GBR_lp_next_row(lp) lp->neq
#define GBR_lp_add_row(lp, row, dim) add_lp_row(lp, row, dim)
#define GBR_lp_get_alpha(lp, row, alpha) get_alpha(lp, row, alpha)
#define GBR_lp_del_row(lp) del_lp_row(lp)
#define GBR_lp_is_fixed(lp) (lp)->is_fixed
#define GBR_lp_cut(lp, obj) cut_lp_to_hyperplane(lp, obj)
#include "basis_reduction_templ.c"
/* Set up a tableau for the Cartesian product of bset with itself.
* This could be optimized by first setting up a tableau for bset
* and then performing the Cartesian product on the tableau.
*/
static struct isl_tab *gbr_tab(struct isl_tab *tab, struct isl_vec *row)
{
unsigned dim;
struct isl_tab *prod;
if (!tab || !row)
return NULL;
dim = tab->n_var;
prod = isl_tab_product(tab, tab);
if (isl_tab_extend_cons(prod, 3 * dim + 1) < 0) {
isl_tab_free(prod);
return NULL;
}
return prod;
}
static struct tab_lp *init_lp(struct isl_tab *tab)
{
struct tab_lp *lp = NULL;
if (!tab)
return NULL;
lp = isl_calloc_type(tab->mat->ctx, struct tab_lp);
if (!lp)
return NULL;
isl_int_init(lp->opt);
isl_int_init(lp->opt_denom);
isl_int_init(lp->tmp);
isl_int_init(lp->tmp2);
lp->dim = tab->n_var;
lp->ctx = tab->mat->ctx;
isl_ctx_ref(lp->ctx);
lp->stack = isl_alloc_array(lp->ctx, struct isl_tab_undo *, lp->dim);
lp->row = isl_vec_alloc(lp->ctx, 1 + 2 * lp->dim);
if (!lp->row)
goto error;
lp->tab = gbr_tab(tab, lp->row);
if (!lp->tab)
goto error;
lp->con_offset = lp->tab->n_con;
lp->obj = NULL;
lp->neq = 0;
return lp;
error:
delete_lp(lp);
return NULL;
}
static void set_lp_obj(struct tab_lp *lp, isl_int *row, int dim)
{
lp->obj = row;
}
static int solve_lp(struct tab_lp *lp)
{
enum isl_lp_result res;
unsigned flags = 0;
lp->is_fixed = 0;
isl_int_set_si(lp->row->el[0], 0);
isl_seq_cpy(lp->row->el + 1, lp->obj, lp->dim);
isl_seq_neg(lp->row->el + 1 + lp->dim, lp->obj, lp->dim);
if (lp->neq)
flags = ISL_TAB_SAVE_DUAL;
res = isl_tab_min(lp->tab, lp->row->el, lp->ctx->one,
&lp->opt, &lp->opt_denom, flags);
isl_int_mul_ui(lp->opt_denom, lp->opt_denom, 2);
if (isl_int_abs_lt(lp->opt, lp->opt_denom)) {
struct isl_vec *sample = isl_tab_get_sample_value(lp->tab);
if (!sample)
return -1;
isl_seq_inner_product(lp->obj, sample->el + 1, lp->dim, &lp->tmp);
isl_seq_inner_product(lp->obj, sample->el + 1 + lp->dim, lp->dim, &lp->tmp2);
isl_int_cdiv_q(lp->tmp, lp->tmp, sample->el[0]);
isl_int_fdiv_q(lp->tmp2, lp->tmp2, sample->el[0]);
if (isl_int_ge(lp->tmp, lp->tmp2))
lp->is_fixed = 1;
isl_vec_free(sample);
}
isl_int_divexact_ui(lp->opt_denom, lp->opt_denom, 2);
if (res < 0)
return -1;
if (res != isl_lp_ok)
isl_die(lp->ctx, isl_error_internal,
"unexpected missing (bounded) solution", return -1);
return 0;
}
/* The current objective function has a fixed (or no) integer value.
* Cut the tableau to the hyperplane that fixes this value in
* both halves of the tableau.
* Return 1 if the resulting tableau is empty.
*/
static int cut_lp_to_hyperplane(struct tab_lp *lp, isl_int *row)
{
enum isl_lp_result res;
isl_int_set_si(lp->row->el[0], 0);
isl_seq_cpy(lp->row->el + 1, row, lp->dim);
isl_seq_clr(lp->row->el + 1 + lp->dim, lp->dim);
res = isl_tab_min(lp->tab, lp->row->el, lp->ctx->one,
&lp->tmp, NULL, 0);
if (res != isl_lp_ok)
return -1;
isl_int_neg(lp->row->el[0], lp->tmp);
if (isl_tab_add_eq(lp->tab, lp->row->el) < 0)
return -1;
isl_seq_cpy(lp->row->el + 1 + lp->dim, row, lp->dim);
isl_seq_clr(lp->row->el + 1, lp->dim);
if (isl_tab_add_eq(lp->tab, lp->row->el) < 0)
return -1;
lp->con_offset += 2;
return lp->tab->empty;
}
static void get_obj_val(struct tab_lp* lp, GBR_type *F)
{
GBR_set_num_neg(F, lp->opt);
GBR_set_den(F, lp->opt_denom);
}
static void delete_lp(struct tab_lp *lp)
{
if (!lp)
return;
isl_int_clear(lp->opt);
isl_int_clear(lp->opt_denom);
isl_int_clear(lp->tmp);
isl_int_clear(lp->tmp2);
isl_vec_free(lp->row);
free(lp->stack);
isl_tab_free(lp->tab);
isl_ctx_deref(lp->ctx);
free(lp);
}
static int add_lp_row(struct tab_lp *lp, isl_int *row, int dim)
{
lp->stack[lp->neq] = isl_tab_snap(lp->tab);
isl_int_set_si(lp->row->el[0], 0);
isl_seq_cpy(lp->row->el + 1, row, lp->dim);
isl_seq_neg(lp->row->el + 1 + lp->dim, row, lp->dim);
if (isl_tab_add_valid_eq(lp->tab, lp->row->el) < 0)
return -1;
return lp->neq++;
}
static void get_alpha(struct tab_lp* lp, int row, GBR_type *alpha)
{
row += lp->con_offset;
GBR_set_num_neg(alpha, lp->tab->dual->el[1 + row]);
GBR_set_den(alpha, lp->tab->dual->el[0]);
}
static int del_lp_row(struct tab_lp *lp)
{
lp->neq--;
return isl_tab_rollback(lp->tab, lp->stack[lp->neq]);
}

View File

@ -0,0 +1,355 @@
/*
* Copyright 2006-2007 Universiteit Leiden
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, Leiden Institute of Advanced Computer Science,
* Universiteit Leiden, Niels Bohrweg 1, 2333 CA Leiden, The Netherlands
* and K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A,
* B-3001 Leuven, Belgium
*/
#include <stdlib.h>
#include <isl_ctx_private.h>
#include <isl_map_private.h>
#include <isl_vec_private.h>
#include <isl_options_private.h>
#include "isl_basis_reduction.h"
static void save_alpha(GBR_LP *lp, int first, int n, GBR_type *alpha)
{
int i;
for (i = 0; i < n; ++i)
GBR_lp_get_alpha(lp, first + i, &alpha[i]);
}
/* Compute a reduced basis for the set represented by the tableau "tab".
* tab->basis, which must be initialized by the calling function to an affine
* unimodular basis, is updated to reflect the reduced basis.
* The first tab->n_zero rows of the basis (ignoring the constant row)
* are assumed to correspond to equalities and are left untouched.
* tab->n_zero is updated to reflect any additional equalities that
* have been detected in the first rows of the new basis.
* The final tab->n_unbounded rows of the basis are assumed to correspond
* to unbounded directions and are also left untouched.
* In particular this means that the remaining rows are assumed to
* correspond to bounded directions.
*
* This function implements the algorithm described in
* "An Implementation of the Generalized Basis Reduction Algorithm
* for Integer Programming" of Cook el al. to compute a reduced basis.
* We use \epsilon = 1/4.
*
* If ctx->opt->gbr_only_first is set, the user is only interested
* in the first direction. In this case we stop the basis reduction when
* the width in the first direction becomes smaller than 2.
*/
struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab)
{
unsigned dim;
struct isl_ctx *ctx;
struct isl_mat *B;
int i;
GBR_LP *lp = NULL;
GBR_type F_old, alpha, F_new;
int row;
isl_int tmp;
struct isl_vec *b_tmp;
GBR_type *F = NULL;
GBR_type *alpha_buffer[2] = { NULL, NULL };
GBR_type *alpha_saved;
GBR_type F_saved;
int use_saved = 0;
isl_int mu[2];
GBR_type mu_F[2];
GBR_type two;
GBR_type one;
int empty = 0;
int fixed = 0;
int fixed_saved = 0;
int mu_fixed[2];
int n_bounded;
int gbr_only_first;
if (!tab)
return NULL;
if (tab->empty)
return tab;
ctx = tab->mat->ctx;
gbr_only_first = ctx->opt->gbr_only_first;
dim = tab->n_var;
B = tab->basis;
if (!B)
return tab;
n_bounded = dim - tab->n_unbounded;
if (n_bounded <= tab->n_zero + 1)
return tab;
isl_int_init(tmp);
isl_int_init(mu[0]);
isl_int_init(mu[1]);
GBR_init(alpha);
GBR_init(F_old);
GBR_init(F_new);
GBR_init(F_saved);
GBR_init(mu_F[0]);
GBR_init(mu_F[1]);
GBR_init(two);
GBR_init(one);
b_tmp = isl_vec_alloc(ctx, dim);
if (!b_tmp)
goto error;
F = isl_alloc_array(ctx, GBR_type, n_bounded);
alpha_buffer[0] = isl_alloc_array(ctx, GBR_type, n_bounded);
alpha_buffer[1] = isl_alloc_array(ctx, GBR_type, n_bounded);
alpha_saved = alpha_buffer[0];
if (!F || !alpha_buffer[0] || !alpha_buffer[1])
goto error;
for (i = 0; i < n_bounded; ++i) {
GBR_init(F[i]);
GBR_init(alpha_buffer[0][i]);
GBR_init(alpha_buffer[1][i]);
}
GBR_set_ui(two, 2);
GBR_set_ui(one, 1);
lp = GBR_lp_init(tab);
if (!lp)
goto error;
i = tab->n_zero;
GBR_lp_set_obj(lp, B->row[1+i]+1, dim);
ctx->stats->gbr_solved_lps++;
if (GBR_lp_solve(lp) < 0)
goto error;
GBR_lp_get_obj_val(lp, &F[i]);
if (GBR_lt(F[i], one)) {
if (!GBR_is_zero(F[i])) {
empty = GBR_lp_cut(lp, B->row[1+i]+1);
if (empty)
goto done;
GBR_set_ui(F[i], 0);
}
tab->n_zero++;
}
do {
if (i+1 == tab->n_zero) {
GBR_lp_set_obj(lp, B->row[1+i+1]+1, dim);
ctx->stats->gbr_solved_lps++;
if (GBR_lp_solve(lp) < 0)
goto error;
GBR_lp_get_obj_val(lp, &F_new);
fixed = GBR_lp_is_fixed(lp);
GBR_set_ui(alpha, 0);
} else if (use_saved) {
row = GBR_lp_next_row(lp);
GBR_set(F_new, F_saved);
fixed = fixed_saved;
GBR_set(alpha, alpha_saved[i]);
} else {
row = GBR_lp_add_row(lp, B->row[1+i]+1, dim);
GBR_lp_set_obj(lp, B->row[1+i+1]+1, dim);
ctx->stats->gbr_solved_lps++;
if (GBR_lp_solve(lp) < 0)
goto error;
GBR_lp_get_obj_val(lp, &F_new);
fixed = GBR_lp_is_fixed(lp);
GBR_lp_get_alpha(lp, row, &alpha);
if (i > 0)
save_alpha(lp, row-i, i, alpha_saved);
if (GBR_lp_del_row(lp) < 0)
goto error;
}
GBR_set(F[i+1], F_new);
GBR_floor(mu[0], alpha);
GBR_ceil(mu[1], alpha);
if (isl_int_eq(mu[0], mu[1]))
isl_int_set(tmp, mu[0]);
else {
int j;
for (j = 0; j <= 1; ++j) {
isl_int_set(tmp, mu[j]);
isl_seq_combine(b_tmp->el,
ctx->one, B->row[1+i+1]+1,
tmp, B->row[1+i]+1, dim);
GBR_lp_set_obj(lp, b_tmp->el, dim);
ctx->stats->gbr_solved_lps++;
if (GBR_lp_solve(lp) < 0)
goto error;
GBR_lp_get_obj_val(lp, &mu_F[j]);
mu_fixed[j] = GBR_lp_is_fixed(lp);
if (i > 0)
save_alpha(lp, row-i, i, alpha_buffer[j]);
}
if (GBR_lt(mu_F[0], mu_F[1]))
j = 0;
else
j = 1;
isl_int_set(tmp, mu[j]);
GBR_set(F_new, mu_F[j]);
fixed = mu_fixed[j];
alpha_saved = alpha_buffer[j];
}
isl_seq_combine(B->row[1+i+1]+1, ctx->one, B->row[1+i+1]+1,
tmp, B->row[1+i]+1, dim);
if (i+1 == tab->n_zero && fixed) {
if (!GBR_is_zero(F[i+1])) {
empty = GBR_lp_cut(lp, B->row[1+i+1]+1);
if (empty)
goto done;
GBR_set_ui(F[i+1], 0);
}
tab->n_zero++;
}
GBR_set(F_old, F[i]);
use_saved = 0;
/* mu_F[0] = 4 * F_new; mu_F[1] = 3 * F_old */
GBR_set_ui(mu_F[0], 4);
GBR_mul(mu_F[0], mu_F[0], F_new);
GBR_set_ui(mu_F[1], 3);
GBR_mul(mu_F[1], mu_F[1], F_old);
if (GBR_lt(mu_F[0], mu_F[1])) {
B = isl_mat_swap_rows(B, 1 + i, 1 + i + 1);
if (i > tab->n_zero) {
use_saved = 1;
GBR_set(F_saved, F_new);
fixed_saved = fixed;
if (GBR_lp_del_row(lp) < 0)
goto error;
--i;
} else {
GBR_set(F[tab->n_zero], F_new);
if (gbr_only_first && GBR_lt(F[tab->n_zero], two))
break;
if (fixed) {
if (!GBR_is_zero(F[tab->n_zero])) {
empty = GBR_lp_cut(lp, B->row[1+tab->n_zero]+1);
if (empty)
goto done;
GBR_set_ui(F[tab->n_zero], 0);
}
tab->n_zero++;
}
}
} else {
GBR_lp_add_row(lp, B->row[1+i]+1, dim);
++i;
}
} while (i < n_bounded - 1);
if (0) {
done:
if (empty < 0) {
error:
isl_mat_free(B);
B = NULL;
}
}
GBR_lp_delete(lp);
if (alpha_buffer[1])
for (i = 0; i < n_bounded; ++i) {
GBR_clear(F[i]);
GBR_clear(alpha_buffer[0][i]);
GBR_clear(alpha_buffer[1][i]);
}
free(F);
free(alpha_buffer[0]);
free(alpha_buffer[1]);
isl_vec_free(b_tmp);
GBR_clear(alpha);
GBR_clear(F_old);
GBR_clear(F_new);
GBR_clear(F_saved);
GBR_clear(mu_F[0]);
GBR_clear(mu_F[1]);
GBR_clear(two);
GBR_clear(one);
isl_int_clear(tmp);
isl_int_clear(mu[0]);
isl_int_clear(mu[1]);
tab->basis = B;
return tab;
}
/* Compute an affine form of a reduced basis of the given basic
* non-parametric set, which is assumed to be bounded and not
* include any integer divisions.
* The first column and the first row correspond to the constant term.
*
* If the input contains any equalities, we first create an initial
* basis with the equalities first. Otherwise, we start off with
* the identity matrix.
*/
__isl_give isl_mat *isl_basic_set_reduced_basis(__isl_keep isl_basic_set *bset)
{
struct isl_mat *basis;
struct isl_tab *tab;
if (isl_basic_set_check_no_locals(bset) < 0 ||
isl_basic_set_check_no_params(bset) < 0)
return NULL;
tab = isl_tab_from_basic_set(bset, 0);
if (!tab)
return NULL;
if (bset->n_eq == 0)
tab->basis = isl_mat_identity(bset->ctx, 1 + tab->n_var);
else {
isl_mat *eq;
isl_size nvar = isl_basic_set_dim(bset, isl_dim_all);
if (nvar < 0)
goto error;
eq = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq,
1, nvar);
eq = isl_mat_left_hermite(eq, 0, NULL, &tab->basis);
tab->basis = isl_mat_lin_to_aff(tab->basis);
tab->n_zero = bset->n_eq;
isl_mat_free(eq);
}
tab = isl_tab_compute_reduced_basis(tab);
if (!tab)
return NULL;
basis = isl_mat_copy(tab->basis);
isl_tab_free(tab);
return basis;
error:
isl_tab_free(tab);
return NULL;
}

289
external/mit/isl/dist/bound.c vendored Normal file
View File

@ -0,0 +1,289 @@
#include <assert.h>
#include <isl/stream.h>
#include <isl_map_private.h>
#include <isl/polynomial.h>
#include <isl_scan.h>
#include <isl/val.h>
#include <isl/options.h>
struct bound_options {
struct isl_options *isl;
unsigned verify;
int print_all;
int continue_on_error;
};
ISL_ARGS_START(struct bound_options, bound_options_args)
ISL_ARG_CHILD(struct bound_options, isl, "isl", &isl_options_args,
"isl options")
ISL_ARG_BOOL(struct bound_options, verify, 'T', "verify", 0, NULL)
ISL_ARG_BOOL(struct bound_options, print_all, 'A', "print-all", 0, NULL)
ISL_ARG_BOOL(struct bound_options, continue_on_error, '\0', "continue-on-error", 0, NULL)
ISL_ARGS_END
ISL_ARG_DEF(bound_options, struct bound_options, bound_options_args)
static __isl_give isl_set *set_bounds(__isl_take isl_set *set)
{
isl_size nparam;
int i, r;
isl_point *pt, *pt2;
isl_set *box;
nparam = isl_set_dim(set, isl_dim_param);
if (nparam < 0)
return isl_set_free(set);
r = nparam >= 8 ? 5 : nparam >= 5 ? 15 : 50;
pt = isl_set_sample_point(isl_set_copy(set));
pt2 = isl_point_copy(pt);
for (i = 0; i < nparam; ++i) {
pt = isl_point_add_ui(pt, isl_dim_param, i, r);
pt2 = isl_point_sub_ui(pt2, isl_dim_param, i, r);
}
box = isl_set_box_from_points(pt, pt2);
return isl_set_intersect(set, box);
}
struct verify_point_bound {
struct bound_options *options;
int stride;
int n;
int exact;
int error;
isl_pw_qpolynomial_fold *pwf;
isl_pw_qpolynomial_fold *bound;
};
static isl_stat verify_point(__isl_take isl_point *pnt, void *user)
{
int i;
isl_size nparam;
struct verify_point_bound *vpb = (struct verify_point_bound *) user;
isl_val *v;
isl_ctx *ctx;
isl_pw_qpolynomial_fold *pwf;
isl_val *bound = NULL;
isl_val *opt = NULL;
isl_set *dom = NULL;
isl_printer *p;
const char *minmax;
isl_bool bounded;
int sign;
int ok;
FILE *out = vpb->options->print_all ? stdout : stderr;
vpb->n--;
if (1) {
minmax = "ub";
sign = 1;
} else {
minmax = "lb";
sign = -1;
}
ctx = isl_point_get_ctx(pnt);
p = isl_printer_to_file(ctx, out);
pwf = isl_pw_qpolynomial_fold_copy(vpb->pwf);
nparam = isl_pw_qpolynomial_fold_dim(pwf, isl_dim_param);
if (nparam < 0)
pwf = isl_pw_qpolynomial_fold_free(pwf);
for (i = 0; i < nparam; ++i) {
v = isl_point_get_coordinate_val(pnt, isl_dim_param, i);
pwf = isl_pw_qpolynomial_fold_fix_val(pwf, isl_dim_param, i, v);
}
bound = isl_pw_qpolynomial_fold_eval(
isl_pw_qpolynomial_fold_copy(vpb->bound),
isl_point_copy(pnt));
dom = isl_pw_qpolynomial_fold_domain(isl_pw_qpolynomial_fold_copy(pwf));
bounded = isl_set_is_bounded(dom);
if (bounded < 0)
goto error;
if (!bounded)
opt = isl_pw_qpolynomial_fold_eval(
isl_pw_qpolynomial_fold_copy(pwf),
isl_set_sample_point(isl_set_copy(dom)));
else if (sign > 0)
opt = isl_pw_qpolynomial_fold_max(isl_pw_qpolynomial_fold_copy(pwf));
else
opt = isl_pw_qpolynomial_fold_min(isl_pw_qpolynomial_fold_copy(pwf));
if (vpb->exact && bounded)
ok = isl_val_eq(opt, bound);
else if (sign > 0)
ok = isl_val_le(opt, bound);
else
ok = isl_val_le(bound, opt);
if (ok < 0)
goto error;
if (vpb->options->print_all || !ok) {
p = isl_printer_print_str(p, minmax);
p = isl_printer_print_str(p, "(");
for (i = 0; i < nparam; ++i) {
if (i)
p = isl_printer_print_str(p, ", ");
v = isl_point_get_coordinate_val(pnt, isl_dim_param, i);
p = isl_printer_print_val(p, v);
isl_val_free(v);
}
p = isl_printer_print_str(p, ") = ");
p = isl_printer_print_val(p, bound);
p = isl_printer_print_str(p, ", ");
p = isl_printer_print_str(p, bounded ? "opt" : "sample");
p = isl_printer_print_str(p, " = ");
p = isl_printer_print_val(p, opt);
if (ok)
p = isl_printer_print_str(p, ". OK");
else
p = isl_printer_print_str(p, ". NOT OK");
p = isl_printer_end_line(p);
} else if ((vpb->n % vpb->stride) == 0) {
p = isl_printer_print_str(p, "o");
p = isl_printer_flush(p);
}
if (0) {
error:
ok = 0;
}
isl_pw_qpolynomial_fold_free(pwf);
isl_val_free(bound);
isl_val_free(opt);
isl_point_free(pnt);
isl_set_free(dom);
isl_printer_free(p);
if (!ok)
vpb->error = 1;
if (vpb->options->continue_on_error)
ok = 1;
return (vpb->n >= 1 && ok) ? isl_stat_ok : isl_stat_error;
}
static int check_solution(__isl_take isl_pw_qpolynomial_fold *pwf,
__isl_take isl_pw_qpolynomial_fold *bound, int exact,
struct bound_options *options)
{
struct verify_point_bound vpb;
isl_int count, max;
isl_set *dom;
isl_set *context;
int i, r, n;
dom = isl_pw_qpolynomial_fold_domain(isl_pw_qpolynomial_fold_copy(pwf));
context = isl_set_params(isl_set_copy(dom));
context = isl_set_remove_divs(context);
context = set_bounds(context);
isl_int_init(count);
isl_int_init(max);
isl_int_set_si(max, 200);
r = isl_set_count_upto(context, max, &count);
assert(r >= 0);
n = isl_int_get_si(count);
isl_int_clear(max);
isl_int_clear(count);
vpb.options = options;
vpb.pwf = pwf;
vpb.bound = bound;
vpb.n = n;
vpb.stride = n > 70 ? 1 + (n + 1)/70 : 1;
vpb.error = 0;
vpb.exact = exact;
if (!options->print_all) {
for (i = 0; i < vpb.n; i += vpb.stride)
printf(".");
printf("\r");
fflush(stdout);
}
isl_set_foreach_point(context, verify_point, &vpb);
isl_set_free(context);
isl_set_free(dom);
isl_pw_qpolynomial_fold_free(pwf);
isl_pw_qpolynomial_fold_free(bound);
if (!options->print_all)
printf("\n");
if (vpb.error) {
fprintf(stderr, "Check failed !\n");
return -1;
}
return 0;
}
int main(int argc, char **argv)
{
isl_ctx *ctx;
isl_pw_qpolynomial_fold *copy;
isl_pw_qpolynomial_fold *pwf;
isl_stream *s;
struct isl_obj obj;
struct bound_options *options;
isl_bool exact;
int r = 0;
options = bound_options_new_with_defaults();
assert(options);
argc = bound_options_parse(options, argc, argv, ISL_ARG_ALL);
ctx = isl_ctx_alloc_with_options(&bound_options_args, options);
s = isl_stream_new_file(ctx, stdin);
obj = isl_stream_read_obj(s);
if (obj.type == isl_obj_pw_qpolynomial)
pwf = isl_pw_qpolynomial_fold_from_pw_qpolynomial(isl_fold_max,
obj.v);
else if (obj.type == isl_obj_pw_qpolynomial_fold)
pwf = obj.v;
else {
obj.type->free(obj.v);
isl_die(ctx, isl_error_invalid, "invalid input", goto error);
}
if (options->verify)
copy = isl_pw_qpolynomial_fold_copy(pwf);
pwf = isl_pw_qpolynomial_fold_bound(pwf, &exact);
pwf = isl_pw_qpolynomial_fold_coalesce(pwf);
if (options->verify) {
r = check_solution(copy, pwf, exact, options);
} else {
if (!exact)
printf("# NOT exact\n");
isl_pw_qpolynomial_fold_print(pwf, stdout, 0);
fprintf(stdout, "\n");
isl_pw_qpolynomial_fold_free(pwf);
}
error:
isl_stream_free(s);
isl_ctx_free(ctx);
return r;
}

36
external/mit/isl/dist/bound_test.sh.in vendored Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
EXEEXT=@EXEEXT@
srcdir=@srcdir@
BOUND_TESTS="\
basicLinear2.pwqp \
basicLinear.pwqp \
basicTestParameterPosNeg.pwqp \
basicTest.pwqp \
devos.pwqp \
equality1.pwqp \
equality2.pwqp \
equality3.pwqp \
equality4.pwqp \
equality5.pwqp \
faddeev.pwqp \
linearExample.pwqp \
neg.pwqp \
philippe3vars3pars.pwqp \
philippe3vars.pwqp \
philippeNeg.pwqp \
philippePolynomialCoeff1P.pwqp \
philippePolynomialCoeff.pwqp \
philippe.pwqp \
product.pwqp \
split.pwqp \
test3Deg3Var.pwqp \
toplas.pwqp \
unexpanded.pwqp"
for i in $BOUND_TESTS; do
echo $i;
./isl_bound$EXEEXT -T --bound=bernstein < $srcdir/test_inputs/$i || exit
./isl_bound$EXEEXT -T --bound=range < $srcdir/test_inputs/$i || exit
done

View File

@ -0,0 +1,8 @@
#include <isl/map_type.h>
/* Return the basic set that was treated as the basic map "bmap".
*/
static __isl_give isl_basic_set *bset_from_bmap(__isl_take isl_basic_map *bmap)
{
return (isl_basic_set *) bmap;
}

10
external/mit/isl/dist/bset_to_bmap.c vendored Normal file
View File

@ -0,0 +1,10 @@
#include <isl/map_type.h>
/* Treat "bset" as a basic map.
* Internally, isl_basic_set is defined to isl_basic_map, so in practice,
* this function performs a redundant cast.
*/
static __isl_give isl_basic_map *bset_to_bmap(__isl_take isl_basic_set *bset)
{
return (isl_basic_map *) bset;
}

69
external/mit/isl/dist/cat.c vendored Normal file
View File

@ -0,0 +1,69 @@
#include <assert.h>
#include <isl/obj.h>
#include <isl/printer.h>
#include <isl/stream.h>
#include <isl/options.h>
struct isl_arg_choice cat_format[] = {
{"isl", ISL_FORMAT_ISL},
{"omega", ISL_FORMAT_OMEGA},
{"polylib", ISL_FORMAT_POLYLIB},
{"ext-polylib", ISL_FORMAT_EXT_POLYLIB},
{"latex", ISL_FORMAT_LATEX},
{"C", ISL_FORMAT_C},
{0}
};
struct isl_arg_choice cat_yaml_style[] = {
{ "block", ISL_YAML_STYLE_BLOCK },
{ "flow", ISL_YAML_STYLE_FLOW },
{ 0 }
};
struct cat_options {
struct isl_options *isl;
unsigned format;
unsigned yaml_style;
};
ISL_ARGS_START(struct cat_options, cat_options_args)
ISL_ARG_CHILD(struct cat_options, isl, "isl", &isl_options_args, "isl options")
ISL_ARG_CHOICE(struct cat_options, format, 0, "format", \
cat_format, ISL_FORMAT_ISL, "output format")
ISL_ARG_CHOICE(struct cat_options, yaml_style, 0, "yaml-style", \
cat_yaml_style, ISL_YAML_STYLE_BLOCK, "output YAML style")
ISL_ARGS_END
ISL_ARG_DEF(cat_options, struct cat_options, cat_options_args)
int main(int argc, char **argv)
{
struct isl_ctx *ctx;
isl_stream *s;
struct isl_obj obj;
struct cat_options *options;
isl_printer *p;
options = cat_options_new_with_defaults();
assert(options);
argc = cat_options_parse(options, argc, argv, ISL_ARG_ALL);
ctx = isl_ctx_alloc_with_options(&cat_options_args, options);
s = isl_stream_new_file(ctx, stdin);
obj = isl_stream_read_obj(s);
isl_stream_free(s);
p = isl_printer_to_file(ctx, stdout);
p = isl_printer_set_output_format(p, options->format);
p = isl_printer_set_yaml_style(p, options->yaml_style);
p = obj.type->print(p, obj.v);
p = isl_printer_end_line(p);
isl_printer_free(p);
obj.type->free(obj.v);
isl_ctx_free(ctx);
return 0;
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2021 Cerebras Systems
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege,
* Cerebras Systems, 1237 E Arques Ave, Sunnyvale, CA, USA
*/
#define xCAT(A,B) A ## B
#define CAT(A,B) xCAT(A,B)
#undef TYPE
#define TYPE CAT(isl_,BASE)
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
#undef TESTS
#define TESTS CAT(parse_,CAT(BASE,_fail_tests))
/* Test parsing of objects of type TYPE
* that are expected to fail.
*/
static isl_stat FN(check,TESTS)(isl_ctx *ctx)
{
int i, n;
int on_error;
on_error = isl_options_get_on_error(ctx);
isl_options_set_on_error(ctx, ISL_ON_ERROR_CONTINUE);
n = ARRAY_SIZE(TESTS);
for (i = 0; i < n; ++i) {
TYPE *obj;
obj = FN(TYPE,read_from_str)(ctx, TESTS[i]);
FN(TYPE,free)(obj);
if (obj)
break;
}
isl_options_set_on_error(ctx, on_error);
if (i < n)
isl_die(ctx, isl_error_unknown,
"parsing not expected to succeed",
return isl_stat_error);
return isl_stat_ok;
}

View File

@ -0,0 +1,32 @@
#define xCAT(A,B) A ## B
#define CAT(A,B) xCAT(A,B)
#undef TYPE
#define TYPE CAT(isl_,BASE)
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
/* Check that printing "obj" and parsing the output results
* in the same expression.
*/
static isl_stat FN(check_reparse,BASE)(isl_ctx *ctx,
__isl_take TYPE *obj)
{
char *str;
isl_bool equal;
TYPE *obj2;
str = FN(TYPE,to_str)(obj);
obj2 = FN(TYPE,read_from_str)(ctx, str);
free(str);
equal = FN(TYPE,plain_is_equal)(obj, obj2);
FN(TYPE,free)(obj);
FN(TYPE,free)(obj2);
if (equal < 0)
return isl_stat_error;
if (!equal)
isl_die(ctx, isl_error_unknown,
"parsed function not equal to original",
return isl_stat_error);
return isl_stat_ok;
}

View File

@ -0,0 +1,29 @@
#define xCAT(A,B) A ## B
#define CAT(A,B) xCAT(A,B)
#undef TYPE
#define TYPE CAT(isl_,BASE)
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
#undef TESTS
#define TESTS CAT(reparse_,CAT(BASE,_tests))
/* Test parsing of objects of type TYPE by printing
* the expressions and checking that parsing the output results
* in the same expression.
* Do this for a set of expressions parsed from strings.
*/
static isl_stat FN(check,TESTS)(isl_ctx *ctx)
{
int i;
for (i = 0; i < ARRAY_SIZE(TESTS); ++i) {
TYPE *obj;
obj = FN(TYPE,read_from_str)(ctx, TESTS[i]);
if (FN(check_reparse,BASE)(ctx, obj) < 0)
return isl_stat_error;
}
return isl_stat_ok;
}

View File

@ -0,0 +1,19 @@
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
/* Check that "obj" has a single reference.
* That is, check that "obj" can be changed inplace.
*/
isl_stat FN(TYPE,check_single_reference)(__isl_keep TYPE *obj)
{
isl_bool single;
single = FN(TYPE,has_single_reference)(obj);
if (single < 0)
return isl_stat_error;
if (!single)
isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
"object should have a single reference",
return isl_stat_error);
return isl_stat_ok;
}

View File

@ -0,0 +1,20 @@
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
/* Check that there are "n" dimensions of type "type" starting at "first"
* in "obj".
*/
isl_stat FN(TYPE,check_range)(__isl_keep TYPE *obj,
enum isl_dim_type type, unsigned first, unsigned n)
{
isl_size dim;
dim = FN(TYPE,dim)(obj, type);
if (dim < 0)
return isl_stat_error;
if (first + n > dim || first + n < first)
isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
"position or range out of bounds",
return isl_stat_error);
return isl_stat_ok;
}

39
external/mit/isl/dist/closure.c vendored Normal file
View File

@ -0,0 +1,39 @@
#include <assert.h>
#include <isl/map.h>
#include <isl/options.h>
int main(int argc, char **argv)
{
struct isl_ctx *ctx;
struct isl_map *map;
struct isl_options *options;
isl_printer *p;
isl_bool exact;
options = isl_options_new_with_defaults();
assert(options);
argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL);
ctx = isl_ctx_alloc_with_options(&isl_options_args, options);
p = isl_printer_to_file(ctx, stdout);
map = isl_map_read_from_file(ctx, stdin);
map = isl_map_transitive_closure(map, &exact);
if (!exact)
p = isl_printer_print_str(p, "# NOT exact\n");
p = isl_printer_print_map(p, map);
p = isl_printer_end_line(p);
map = isl_map_compute_divs(map);
map = isl_map_coalesce(map);
p = isl_printer_print_str(p, "# coalesced\n");
p = isl_printer_print_map(p, map);
p = isl_printer_end_line(p);
isl_map_free(map);
isl_printer_free(p);
isl_ctx_free(ctx);
return 0;
}

249
external/mit/isl/dist/codegen.c vendored Normal file
View File

@ -0,0 +1,249 @@
/*
* Copyright 2012,2014 Ecole Normale Superieure
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege,
* Ecole Normale Superieure, 45 rue dUlm, 75230 Paris, France
*/
/* This program prints an AST that scans the domain elements of
* the domain of a given schedule in the order specified by
* the schedule tree or by their image(s) in the schedule map.
*
* The input consists of either a schedule tree or
* a sequence of three sets/relations.
* - a schedule map
* - a context
* - a relation describing AST generation options
*/
#include <assert.h>
#include <stdlib.h>
#include <isl/ast.h>
#include <isl/ast_build.h>
#include <isl/options.h>
#include <isl/space.h>
#include <isl/set.h>
#include <isl/union_set.h>
#include <isl/union_map.h>
#include <isl/stream.h>
#include <isl/schedule_node.h>
struct options {
struct isl_options *isl;
unsigned atomic;
unsigned separate;
};
ISL_ARGS_START(struct options, options_args)
ISL_ARG_CHILD(struct options, isl, "isl", &isl_options_args, "isl options")
ISL_ARG_BOOL(struct options, atomic, 0, "atomic", 0,
"globally set the atomic option")
ISL_ARG_BOOL(struct options, separate, 0, "separate", 0,
"globally set the separate option")
ISL_ARGS_END
ISL_ARG_DEF(cg_options, struct options, options_args)
ISL_ARG_CTX_DEF(cg_options, struct options, options_args)
/* Return a universal, 1-dimensional set with the given name.
*/
static __isl_give isl_union_set *universe(isl_ctx *ctx, const char *name)
{
isl_space *space;
space = isl_space_set_alloc(ctx, 0, 1);
space = isl_space_set_tuple_name(space, isl_dim_set, name);
return isl_union_set_from_set(isl_set_universe(space));
}
/* Set the "name" option for the entire schedule domain.
*/
static __isl_give isl_union_map *set_universe(__isl_take isl_union_map *opt,
__isl_keep isl_union_map *schedule, const char *name)
{
isl_ctx *ctx;
isl_union_set *domain, *target;
isl_union_map *option;
ctx = isl_union_map_get_ctx(opt);
domain = isl_union_map_range(isl_union_map_copy(schedule));
domain = isl_union_set_universe(domain);
target = universe(ctx, name);
option = isl_union_map_from_domain_and_range(domain, target);
opt = isl_union_map_union(opt, option);
return opt;
}
/* Update the build options based on the user-specified options.
*
* If the --separate or --atomic options were specified, then
* we clear any separate or atomic options that may already exist in "opt".
*/
static __isl_give isl_ast_build *set_options(__isl_take isl_ast_build *build,
__isl_take isl_union_map *opt, struct options *options,
__isl_keep isl_union_map *schedule)
{
if (options->separate || options->atomic) {
isl_ctx *ctx;
isl_union_set *target;
ctx = isl_union_map_get_ctx(schedule);
target = universe(ctx, "separate");
opt = isl_union_map_subtract_range(opt, target);
target = universe(ctx, "atomic");
opt = isl_union_map_subtract_range(opt, target);
}
if (options->separate)
opt = set_universe(opt, schedule, "separate");
if (options->atomic)
opt = set_universe(opt, schedule, "atomic");
build = isl_ast_build_set_options(build, opt);
return build;
}
/* Construct an AST in case the schedule is specified by a union map.
*
* We read the context and the options from "s" and construct the AST.
*/
static __isl_give isl_ast_node *construct_ast_from_union_map(
__isl_take isl_union_map *schedule, __isl_keep isl_stream *s)
{
isl_set *context;
isl_union_map *options_map;
isl_ast_build *build;
isl_ast_node *tree;
struct options *options;
options = isl_ctx_peek_cg_options(isl_stream_get_ctx(s));
context = isl_stream_read_set(s);
options_map = isl_stream_read_union_map(s);
build = isl_ast_build_from_context(context);
build = set_options(build, options_map, options, schedule);
tree = isl_ast_build_node_from_schedule_map(build, schedule);
isl_ast_build_free(build);
return tree;
}
/* If "node" is a band node, then replace the AST build options
* by "options".
*/
static __isl_give isl_schedule_node *node_set_options(
__isl_take isl_schedule_node *node, void *user)
{
enum isl_ast_loop_type *type = user;
int i;
isl_size n;
if (isl_schedule_node_get_type(node) != isl_schedule_node_band)
return node;
n = isl_schedule_node_band_n_member(node);
if (n < 0)
return isl_schedule_node_free(node);
for (i = 0; i < n; ++i)
node = isl_schedule_node_band_member_set_ast_loop_type(node,
i, *type);
return node;
}
/* Replace the AST build options on all band nodes if requested
* by the user.
*/
static __isl_give isl_schedule *schedule_set_options(
__isl_take isl_schedule *schedule, struct options *options)
{
enum isl_ast_loop_type type;
if (!options->separate && !options->atomic)
return schedule;
type = options->separate ? isl_ast_loop_separate : isl_ast_loop_atomic;
schedule = isl_schedule_map_schedule_node_bottom_up(schedule,
&node_set_options, &type);
return schedule;
}
/* Construct an AST in case the schedule is specified by a schedule tree.
*/
static __isl_give isl_ast_node *construct_ast_from_schedule(
__isl_take isl_schedule *schedule)
{
isl_ast_build *build;
isl_ast_node *tree;
struct options *options;
options = isl_ctx_peek_cg_options(isl_schedule_get_ctx(schedule));
build = isl_ast_build_alloc(isl_schedule_get_ctx(schedule));
schedule = schedule_set_options(schedule, options);
tree = isl_ast_build_node_from_schedule(build, schedule);
isl_ast_build_free(build);
return tree;
}
/* Read an object from stdin.
* If it is a (union) map, then assume an input specified by
* schedule map, context and options and construct an AST from
* those elements
* If it is a schedule object, then construct the AST from the schedule.
*/
int main(int argc, char **argv)
{
isl_ctx *ctx;
isl_stream *s;
isl_ast_node *tree = NULL;
struct options *options;
isl_printer *p;
struct isl_obj obj;
int r = EXIT_SUCCESS;
options = cg_options_new_with_defaults();
assert(options);
ctx = isl_ctx_alloc_with_options(&options_args, options);
isl_options_set_ast_build_detect_min_max(ctx, 1);
isl_options_set_ast_print_outermost_block(ctx, 0);
argc = cg_options_parse(options, argc, argv, ISL_ARG_ALL);
s = isl_stream_new_file(ctx, stdin);
obj = isl_stream_read_obj(s);
if (obj.v == NULL) {
r = EXIT_FAILURE;
} else if (obj.type == isl_obj_map) {
isl_union_map *umap;
umap = isl_union_map_from_map(obj.v);
tree = construct_ast_from_union_map(umap, s);
} else if (obj.type == isl_obj_union_map) {
tree = construct_ast_from_union_map(obj.v, s);
} else if (obj.type == isl_obj_schedule) {
tree = construct_ast_from_schedule(obj.v);
} else {
obj.type->free(obj.v);
isl_die(ctx, isl_error_invalid, "unknown input",
r = EXIT_FAILURE);
}
isl_stream_free(s);
p = isl_printer_to_file(ctx, stdout);
p = isl_printer_set_output_format(p, ISL_FORMAT_C);
p = isl_printer_print_ast_node(p, tree);
isl_printer_free(p);
isl_ast_node_free(tree);
isl_ctx_free(ctx);
return r;
}

View File

@ -0,0 +1,30 @@
#!/bin/sh
EXEEXT=@EXEEXT@
srcdir=@srcdir@
failed=0
for i in $srcdir/test_inputs/codegen/*.st \
$srcdir/test_inputs/codegen/cloog/*.st; do
echo $i;
base=`basename $i .st`
test=test-$base.c
dir=`dirname $i`
ref=$dir/$base.c
(./isl_codegen$EXEEXT < $i > $test &&
diff -uw $ref $test && rm $test) || failed=1
done
for i in $srcdir/test_inputs/codegen/*.in \
$srcdir/test_inputs/codegen/omega/*.in \
$srcdir/test_inputs/codegen/pldi2012/*.in; do
echo $i;
base=`basename $i .in`
test=test-$base.c
dir=`dirname $i`
ref=$dir/$base.c
(./isl_codegen$EXEEXT < $i > $test &&
diff -uw $ref $test && rm $test) || failed=1
done
test $failed -eq 0 || exit

348
external/mit/isl/dist/compile vendored Executable file
View File

@ -0,0 +1,348 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1754
external/mit/isl/dist/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1890
external/mit/isl/dist/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

28573
external/mit/isl/dist/configure vendored Executable file

File diff suppressed because it is too large Load Diff

147
external/mit/isl/dist/configure.ac vendored Normal file
View File

@ -0,0 +1,147 @@
AC_INIT([isl], [0.26], [isl-development@googlegroups.com])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_SUBST(versioninfo)
versioninfo=26:0:3
if test "x$prefix" != "xNONE"; then
prefix_wd=`cd $prefix && pwd`
srcdir_wd=`cd $srcdir && pwd`
wd=`pwd`
if test "x$prefix_wd" = "x$srcdir_wd"; then
AC_MSG_ERROR(Installation in source directory not supported)
fi
if test "x$prefix_wd" = "x$wd"; then
AC_MSG_ERROR(Installation in build directory not supported)
fi
fi
AC_PROG_CC
AC_PROG_CXX
AX_PROG_CC_FOR_BUILD
AX_CC_MAXOPT
AX_GCC_WARN_UNUSED_RESULT
AX_C___ATTRIBUTE__
AX_CXX_COMPILE_STDCXX_11_NO_OVERRIDE
AX_CXX_COMPILE_STDCXX_17([], [optional])
AC_PROG_GREP
LT_INIT
AC_PROG_SED
AM_PATH_PYTHON([3.6], [], [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
AC_CHECK_PROG(CYGPATH, cygpath, cygpath, [])
AC_CHECK_PROG(PERL, perl, perl, [])
AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
AC_SUBST(OS_SRCDIR)
if test "$host_os" = "mingw32" -a -n "$CYGPATH"; then
OS_SRCDIR=`$CYGPATH -m "$srcdir"`
else
OS_SRCDIR="$srcdir"
fi
AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML")
AX_CREATE_STDINT_H(include/isl/stdint.h)
AC_ARG_WITH([int],
[AS_HELP_STRING([--with-int=gmp|imath|imath-32],
[Which package to use to represent
multi-precision integers [default=gmp]])],
[], [with_int=gmp])
case "$with_int" in
gmp|imath|imath-32)
;;
*)
AC_MSG_ERROR(
[bad value ${withval} for --with-int (use gmp, imath or imath-32)])
esac
AC_SUBST(MP_CPPFLAGS)
AC_SUBST(MP_CFLAGS)
AC_SUBST(MP_LDFLAGS)
AC_SUBST(MP_LIBS)
case "$with_int" in
gmp)
AX_DETECT_GMP
;;
imath|imath-32)
AX_DETECT_IMATH
;;
esac
if test "x$with_int" = "ximath-32" -a "x$GCC" = "xyes"; then
MP_CFLAGS="-std=gnu99 $MP_CFLAGS"
fi
AM_CONDITIONAL(IMATH_FOR_MP, test x$with_int = ximath -o x$with_int = ximath-32)
AM_CONDITIONAL(GMP_FOR_MP, test x$with_int = xgmp)
AM_CONDITIONAL(HAVE_CXX11, test "x$HAVE_CXX11" = "x1")
AM_CONDITIONAL(HAVE_CXX17, test "x$HAVE_CXX17" = "x1")
AM_CONDITIONAL(SMALL_INT_OPT, test "x$with_int" = "ximath-32")
AS_IF([test "x$with_int" = "ximath-32"], [
AC_DEFINE([USE_SMALL_INT_OPT], [], [Use small integer optimization])
])
AC_CHECK_DECLS(ffs,[],[],[#include <strings.h>])
AC_CHECK_DECLS(__builtin_ffs,[],[],[])
AC_CHECK_DECLS([_BitScanForward],[],[],[#include <intrin.h>])
if test "x$ac_cv_have_decl_ffs" = xno -a \
"x$ac_cv_have_decl___builtin_ffs" = xno -a \
"x$ac_cv_have_decl__BitScanForward" = xno; then
AC_MSG_ERROR([No ffs implementation found])
fi
AC_CHECK_DECLS([strcasecmp,strncasecmp],[],[],[#include <strings.h>])
AC_CHECK_DECLS([_stricmp,_strnicmp],[],[],[#include <string.h>])
if test "x$ac_cv_have_decl_strcasecmp" = xno -a \
"x$ac_cv_have_decl__stricmp" = xno; then
AC_MSG_ERROR([No strcasecmp implementation found])
fi
if test "x$ac_cv_have_decl_strncasecmp" = xno -a \
"x$ac_cv_have_decl__strnicmp" = xno; then
AC_MSG_ERROR([No strncasecmp implementation found])
fi
AC_CHECK_DECLS([snprintf,_snprintf],[],[],[#include <stdio.h>])
if test "x$ac_cv_have_decl_snprintf" = xno -a \
"x$ac_cv_have_decl__snprintf" = xno; then
AC_MSG_ERROR([No snprintf implementation found])
fi
AX_SUBMODULE(clang,system|no,no)
AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
AM_CONDITIONAL(HAVE_CPP_ISL_H,
[(test $with_clang = system -a "x$HAVE_CXX11" = "x1") || \
test -f $srcdir/include/isl/cpp.h])
AX_SET_WARNING_FLAGS
AC_SUBST(WARNING_FLAGS)
PACKAGE_CFLAGS="$MP_CPPFLAGS"
PACKAGE_LDFLAGS="$MP_LDFLAGS"
PACKAGE_LIBS="-lisl $MP_LIBS"
AX_CREATE_PKGCONFIG_INFO
AX_DETECT_GIT_HEAD
AH_BOTTOM([#include <isl_config_post.h>])
AC_CONFIG_HEADERS(isl_config.h)
AC_CONFIG_FILES(isl_srcdir.c)
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(doc/Makefile)
if test $with_clang = system; then
AC_CONFIG_SUBDIRS(interface)
fi
AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
AC_CONFIG_FILES([flow_test.sh], [chmod +x flow_test.sh])
AC_CONFIG_FILES([schedule_test.sh], [chmod +x schedule_test.sh])
AC_OUTPUT

View File

@ -0,0 +1,2 @@
#endif /* ISL_CPP_CHECKED_CONVERSION */

View File

@ -0,0 +1,14 @@
/// These are automatically generated conversions between
/// the default and the checked C++ bindings for isl.
///
/// isl is a library for computing with integer sets and maps described by
/// Presburger formulas. On top of this, isl provides various tools for
/// polyhedral compilation, ranging from dependence analysis over scheduling
/// to AST generation.
#ifndef ISL_CPP_CHECKED_CONVERSION
#define ISL_CPP_CHECKED_CONVERSION
#include <isl/cpp.h>
#include <isl/cpp-checked.h>

View File

@ -0,0 +1,2 @@
#endif /* ISL_CPP_CHECKED */

View File

@ -0,0 +1,200 @@
/// These are automatically generated checked C++ bindings for isl.
///
/// isl is a library for computing with integer sets and maps described by
/// Presburger formulas. On top of this, isl provides various tools for
/// polyhedral compilation, ranging from dependence analysis over scheduling
/// to AST generation.
#ifndef ISL_CPP_CHECKED
#define ISL_CPP_CHECKED
#include <stdio.h>
#include <stdlib.h>
#include <functional>
#include <memory>
#include <ostream>
#include <string>
#include <type_traits>
#if __cplusplus >= 201703L
#include <any>
#include <optional>
#endif
namespace isl {
namespace checked {
#define ISLPP_STRINGIZE_(X) #X
#define ISLPP_STRINGIZE(X) ISLPP_STRINGIZE_(X)
#define ISLPP_ASSERT(test, message) \
do { \
if (test) \
break; \
fputs("Assertion \"" #test "\" failed at " __FILE__ \
":" ISLPP_STRINGIZE(__LINE__) "\n " message "\n", \
stderr); \
abort(); \
} while (0)
/* Class used to check that isl::checked::boolean,
* isl::checked::stat and isl::checked::size values are checked for errors.
*/
struct checker {
bool checked = false;
~checker() {
ISLPP_ASSERT(checked, "IMPLEMENTATION ERROR: Unchecked state");
}
};
class boolean {
private:
mutable std::shared_ptr<checker> check = std::make_shared<checker>();
isl_bool val;
friend boolean manage(isl_bool val);
boolean(isl_bool val): val(val) {}
public:
static boolean error() {
return boolean(isl_bool_error);
}
boolean()
: val(isl_bool_error) {}
/* implicit */ boolean(bool val)
: val(val ? isl_bool_true : isl_bool_false) {}
isl_bool release() {
auto tmp = val;
val = isl_bool_error;
check->checked = true;
return tmp;
}
bool is_error() const { check->checked = true; return val == isl_bool_error; }
bool is_false() const { check->checked = true; return val == isl_bool_false; }
bool is_true() const { check->checked = true; return val == isl_bool_true; }
explicit operator bool() const {
ISLPP_ASSERT(check->checked, "IMPLEMENTATION ERROR: Unchecked error state");
ISLPP_ASSERT(!is_error(), "IMPLEMENTATION ERROR: Unhandled error state");
return is_true();
}
boolean negate() {
if (val == isl_bool_true)
val = isl_bool_false;
else if (val == isl_bool_false)
val = isl_bool_true;
return *this;
}
boolean operator!() const {
return boolean(*this).negate();
}
};
inline boolean manage(isl_bool val) {
return boolean(val);
}
class ctx {
isl_ctx *ptr;
public:
/* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
isl_ctx *release() {
auto tmp = ptr;
ptr = nullptr;
return tmp;
}
isl_ctx *get() {
return ptr;
}
#if __cplusplus >= 201703L
static void free_user(void *user) {
std::any *p = static_cast<std::any *>(user);
delete p;
}
#endif
};
/* Class encapsulating an isl_stat value.
*/
class stat {
private:
mutable std::shared_ptr<checker> check = std::make_shared<checker>();
isl_stat val;
friend stat manage(isl_stat val);
stat(isl_stat val) : val(val) {}
public:
static stat ok() {
return stat(isl_stat_ok);
}
static stat error() {
return stat(isl_stat_error);
}
stat() : val(isl_stat_error) {}
isl_stat release() {
check->checked = true;
return val;
}
bool is_error() const {
check->checked = true;
return val == isl_stat_error;
}
bool is_ok() const {
check->checked = true;
return val == isl_stat_ok;
}
};
inline stat manage(isl_stat val)
{
return stat(val);
}
/* Class encapsulating an isl_size value.
*/
class size {
private:
mutable std::shared_ptr<checker> check = std::make_shared<checker>();
isl_size val;
friend size manage(isl_size val);
size(isl_size val) : val(val) {}
public:
size() : val(isl_size_error) {}
isl_size release() {
auto tmp = val;
val = isl_size_error;
check->checked = true;
return tmp;
}
bool is_error() const {
check->checked = true;
return val == isl_size_error;
}
explicit operator unsigned() const {
ISLPP_ASSERT(check->checked,
"IMPLEMENTATION ERROR: Unchecked error state");
ISLPP_ASSERT(!is_error(),
"IMPLEMENTATION ERROR: Unhandled error state");
return val;
}
};
inline size manage(isl_size val)
{
return size(val);
}
}
} // namespace isl

2
external/mit/isl/dist/cpp/cpp.h.bot vendored Normal file
View File

@ -0,0 +1,2 @@
#endif /* ISL_CPP */

267
external/mit/isl/dist/cpp/cpp.h.top vendored Normal file
View File

@ -0,0 +1,267 @@
/// These are automatically generated C++ bindings for isl.
///
/// isl is a library for computing with integer sets and maps described by
/// Presburger formulas. On top of this, isl provides various tools for
/// polyhedral compilation, ranging from dependence analysis over scheduling
/// to AST generation.
#ifndef ISL_CPP
#define ISL_CPP
#include <isl/ctx.h>
#include <isl/options.h>
#include <functional>
#include <memory>
#include <ostream>
#include <stdexcept>
#include <string>
#include <type_traits>
#if __cplusplus >= 201703L
#include <any>
#include <optional>
#endif
/* 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 {
isl_ctx *ptr;
public:
/* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
isl_ctx *release() {
auto tmp = ptr;
ptr = nullptr;
return tmp;
}
isl_ctx *get() {
return ptr;
}
#if __cplusplus >= 201703L
static void free_user(void *user) {
std::any *p = static_cast<std::any *>(user);
delete p;
}
#endif
};
/* 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
* to ensure that the copy constructor and the assignment operator
* do not throw any exceptions.
*/
class exception : public std::exception {
std::shared_ptr<std::string> what_str;
protected:
inline exception(const char *what_arg, const char *msg,
const char *file, int line);
public:
exception() {}
exception(const char *what_arg) {
what_str = std::make_shared<std::string>(what_arg);
}
static inline void throw_error(enum isl_error error, const char *msg,
const char *file, int line);
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_error(isl_error_invalid, msg, file, line);
}
static inline void throw_last_error(ctx ctx);
};
/* Create an exception of a type described by "what_arg", with
* error message "msg" in line "line" of file "file".
*
* Create a string holding the what() return value that
* corresponds to what isl would have printed.
* If no error message or no error file was set, then use "what_arg" instead.
*/
exception::exception(const char *what_arg, const char *msg, const char *file,
int line)
{
if (!msg || !file)
what_str = std::make_shared<std::string>(what_arg);
else
what_str = std::make_shared<std::string>(std::string(file) +
":" + std::to_string(line) + ": " + msg);
}
class exception_abort : public exception {
friend exception;
exception_abort(const char *msg, const char *file, int line) :
exception("execution aborted", msg, file, line) {}
};
class exception_alloc : public exception {
friend exception;
exception_alloc(const char *msg, const char *file, int line) :
exception("memory allocation failure", msg, file, line) {}
};
class exception_unknown : public exception {
friend exception;
exception_unknown(const char *msg, const char *file, int line) :
exception("unknown failure", msg, file, line) {}
};
class exception_internal : public exception {
friend exception;
exception_internal(const char *msg, const char *file, int line) :
exception("internal error", msg, file, line) {}
};
class exception_invalid : public exception {
friend exception;
exception_invalid(const char *msg, const char *file, int line) :
exception("invalid argument", msg, file, line) {}
};
class exception_quota : public exception {
friend exception;
exception_quota(const char *msg, const char *file, int line) :
exception("quota exceeded", msg, file, line) {}
};
class exception_unsupported : public exception {
friend exception;
exception_unsupported(const char *msg, const char *file, int line) :
exception("unsupported operation", msg, file, line) {}
};
/* Throw an exception of the class that corresponds to "error", with
* error message "msg" in line "line" of file "file".
*
* isl_error_none is treated as an invalid error type.
*/
void exception::throw_error(enum isl_error error, const char *msg,
const char *file, int line)
{
switch (error) {
case isl_error_none:
break;
case isl_error_abort: throw exception_abort(msg, file, line);
case isl_error_alloc: throw exception_alloc(msg, file, line);
case isl_error_unknown: throw exception_unknown(msg, file, line);
case isl_error_internal: throw exception_internal(msg, file, line);
case isl_error_invalid: throw exception_invalid(msg, file, line);
case isl_error_quota: throw exception_quota(msg, file, line);
case isl_error_unsupported:
throw exception_unsupported(msg, file, line);
}
throw exception_invalid("invalid error type", file, line);
}
/* Throw an exception corresponding to the last error on "ctx" and
* reset the error.
*
* If "ctx" is NULL or if it is not in an error state at the start,
* then an invalid argument exception is thrown.
*/
void exception::throw_last_error(ctx ctx)
{
enum isl_error error;
const char *msg, *file;
int line;
error = isl_ctx_last_error(ctx.get());
msg = isl_ctx_last_error_msg(ctx.get());
file = isl_ctx_last_error_file(ctx.get());
line = isl_ctx_last_error_line(ctx.get());
isl_ctx_reset_error(ctx.get());
throw_error(error, msg, file, line);
}
#else
#include <stdio.h>
#include <stdlib.h>
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();
}
/* Throw 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.
*/
class options_scoped_set_on_error {
isl_ctx *ctx;
int saved_on_error;
public:
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);
}
~options_scoped_set_on_error() {
isl_options_set_on_error(ctx, saved_on_error);
}
};
} // namespace isl

View File

@ -0,0 +1,5 @@
} // namespace typed
} // namespace isl
#endif /* ISL_TYPED_CPP */

View File

@ -0,0 +1,21 @@
/// These are automatically generated templated C++ bindings for isl.
///
/// isl is a library for computing with integer sets and maps described by
/// Presburger formulas. On top of this, isl provides various tools for
/// polyhedral compilation, ranging from dependence analysis over scheduling
/// to AST generation.
#ifndef ISL_TYPED_CPP
#define ISL_TYPED_CPP
#include <type_traits>
#include <isl/cpp.h>
namespace isl {
namespace typed {
template <typename Domain, typename Range>
struct pair {};
struct Anonymous;

1
external/mit/isl/dist/dep.c vendored Normal file
View File

@ -0,0 +1 @@
#include "all.h"

791
external/mit/isl/dist/depcomp vendored Executable file
View File

@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

42
external/mit/isl/dist/doc/CodingStyle vendored Normal file
View File

@ -0,0 +1,42 @@
This document describes some aspects of the coding style of isl,
which is similar to that of the linux kernel and git.
The general rule is to use the same style as that of the surrounding code.
More specific rules:
- every line should have at most 80 columns
- use tabs for indentation, where a tab counts for 8 characters
- use single spaces around binary operators such as '+', '-', '=', '!='
- no space after unary operators such as '!'
- use a single space after a comma and a semicolon
(except at the end of a line)
- no space between function name and arguments
- use a single space after control keywords such as if, for and while
- use a single space between the type of a cast and the value
that is being cast
- no whitespace at the end of a line
- opening brace of a function is placed on a new line
- opening brace of other blocks stays on the same line
- the body of a control statement is placed on the next line(s)
- an else appears on the same line as the closing brace of
the then branch, if there is such a closing brace
- if either the then or the else branch of an if has braces,
then they both have braces
- no parentheses around argument of return keyword
- use only C style comments (/* ... */)
- no comments inside function bodies;
if some part of a function deserves additional comments, then
extract it out into a separate function first
- no #ifs inside function bodies
- variables are declared at the start of a block, before any
other statements
There are some exceptions to the general rule of using
the same style as the surrounding code, most notably
when the surrounding code is very old.
In particular, an "isl_space" used to be called "isl_dim" and
some variables of this type are still called "dim" or some variant thereof.
New variables of this type should be called "space" or a more specific name.
Some old functions do not have memory management annotations yet.
All new functions should have memory management annotations,
whenever appropriate

32
external/mit/isl/dist/doc/Makefile.am vendored Normal file
View File

@ -0,0 +1,32 @@
CLEANFILES = \
manual.toc \
manual.bbl \
version.tex \
user.tex \
manual.pdf \
manual.aux \
manual.out \
manual.blg \
manual.log \
manual.brf \
manual.bcf \
manual.run.xml
if GENERATE_DOC
export TEXINPUTS := $(srcdir):$(TEXINPUTS)
export BIBINPUTS := $(srcdir):$(BIBINPUTS)
export BSTINPUTS := $(srcdir):$(BSTINPUTS)
user.tex: user.pod
$(PERL) $(srcdir)/mypod2latex $< $@
manual.pdf: manual.tex user.tex $(srcdir)/implementation.tex reading.tex
(cd ..; echo "@GIT_HEAD_VERSION@") > version.tex
$(PDFLATEX) $<
biber manual
$(PDFLATEX) $<
$(PDFLATEX) $<
user.html: user.pod
(cd ..; echo "@GIT_HEAD_VERSION@") > version
$(POD2HTML) --infile=$< --outfile=$@ --title="Integer Set Library: Manual [version `cat version`]"
endif

532
external/mit/isl/dist/doc/Makefile.in vendored Normal file
View File

@ -0,0 +1,532 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \
$(top_srcdir)/m4/ax_cc_maxopt.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \
$(top_srcdir)/m4/ax_create_stdint_h.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11_no_override.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_17.m4 \
$(top_srcdir)/m4/ax_detect_git_head.m4 \
$(top_srcdir)/m4/ax_detect_gmp.m4 \
$(top_srcdir)/m4/ax_detect_imath.m4 \
$(top_srcdir)/m4/ax_gcc_archflag.m4 \
$(top_srcdir)/m4/ax_gcc_warn_unused_result.m4 \
$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
$(top_srcdir)/m4/ax_prog_cc_for_build.m4 \
$(top_srcdir)/m4/ax_set_warning_flags.m4 \
$(top_srcdir)/m4/ax_submodule.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/isl_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_EXEEXT = @BUILD_EXEEXT@
BUILD_OBJEXT = @BUILD_OBJEXT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CCDEPMODE_FOR_BUILD = @CCDEPMODE_FOR_BUILD@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CPP_FOR_BUILD = @CPP_FOR_BUILD@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GIT_HEAD = @GIT_HEAD@
GIT_HEAD_ID = @GIT_HEAD_ID@
GIT_HEAD_VERSION = @GIT_HEAD_VERSION@
GREP = @GREP@
HAVE_CXX11 = @HAVE_CXX11@
HAVE_CXX17 = @HAVE_CXX17@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MP_CFLAGS = @MP_CFLAGS@
MP_CPPFLAGS = @MP_CPPFLAGS@
MP_LDFLAGS = @MP_LDFLAGS@
MP_LIBS = @MP_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_SRCDIR = @OS_SRCDIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDFLATEX = @PDFLATEX@
PERL = @PERL@
POD2HTML = @POD2HTML@
PRTDIAG = @PRTDIAG@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARNING_FLAGS = @WARNING_FLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfig_libdir = @pkgconfig_libdir@
pkgconfig_libfile = @pkgconfig_libfile@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
versioninfo = @versioninfo@
CLEANFILES = \
manual.toc \
manual.bbl \
version.tex \
user.tex \
manual.pdf \
manual.aux \
manual.out \
manual.blg \
manual.log \
manual.brf \
manual.bcf \
manual.run.xml
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
@GENERATE_DOC_TRUE@export TEXINPUTS := $(srcdir):$(TEXINPUTS)
@GENERATE_DOC_TRUE@export BIBINPUTS := $(srcdir):$(BIBINPUTS)
@GENERATE_DOC_TRUE@export BSTINPUTS := $(srcdir):$(BSTINPUTS)
@GENERATE_DOC_TRUE@user.tex: user.pod
@GENERATE_DOC_TRUE@ $(PERL) $(srcdir)/mypod2latex $< $@
@GENERATE_DOC_TRUE@manual.pdf: manual.tex user.tex $(srcdir)/implementation.tex reading.tex
@GENERATE_DOC_TRUE@ (cd ..; echo "@GIT_HEAD_VERSION@") > version.tex
@GENERATE_DOC_TRUE@ $(PDFLATEX) $<
@GENERATE_DOC_TRUE@ biber manual
@GENERATE_DOC_TRUE@ $(PDFLATEX) $<
@GENERATE_DOC_TRUE@ $(PDFLATEX) $<
@GENERATE_DOC_TRUE@user.html: user.pod
@GENERATE_DOC_TRUE@ (cd ..; echo "@GIT_HEAD_VERSION@") > version
@GENERATE_DOC_TRUE@ $(POD2HTML) --infile=$< --outfile=$@ --title="Integer Set Library: Manual [version `cat version`]"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,53 @@
[Mostly copied from git's SubmittingPatches]
Commits:
- make commits of logical units
- check for unnecessary whitespace with "git diff --check"
before committing
- do not check in commented out code or unneeded files
- the first line of the commit message should be a short
description and should skip the full stop
- the body should provide a meaningful commit message, which
includes motivation for the change, and contrasts
its implementation with previous behaviour
- the lines of this body should have at most 76 columns
- if you want your work included in isl.git, add a
"Signed-off-by: Your Name <you@example.com>" line to the
commit message (or just use the option "-s" when
committing) to confirm that you agree to the Developer's
Certificate of Origin
- make sure that you have tests for the bug you are fixing
- make sure that the test suite passes after your commit
Patch:
- use "git format-patch -M" to create the patch
- do not PGP sign your patch
- send a single patch per mail, e.g., using git-send-email(1)
- do not attach your patch, but read in the mail
body, unless you cannot teach your mailer to
leave the formatting of the patch alone.
- be careful doing cut & paste into your mailer, not to
corrupt whitespaces.
- provide additional information (which is unsuitable for
the commit message) between the "---" and the diffstat
- if you change, add, or remove a command line option or
make some other user interface change, the associated
documentation should be updated as well.
- if your name is not writable in ASCII, make sure that
you send off a message in the correct encoding.
- send the patch to the development mailing list
(isl-development@googlegroups.com). If you use
git-send-email(1), please test it first by sending email
to yourself.
Revisions:
- add the revision number inside square brackets to
the subject line (e.g., use --subject-prefix='PATCH v2'
when creating the patch)
- recall the major issues discovered during the previous
review and explain how you addressed them or why you
disagree. Do so either in a cover letter, between the
"---" and the diffstat or in a separate message.

File diff suppressed because it is too large Load Diff

485
external/mit/isl/dist/doc/isl.bib vendored Normal file
View File

@ -0,0 +1,485 @@
@inproceedings{Kelly1996closure,
author = {Wayne Kelly and
William Pugh and
Evan Rosser and
Tatiana Shpeisman},
title = {Transitive Closure of Infinite Graphs and Its Applications},
pages = {126-140},
editor = {Chua-Huang Huang and
P. Sadayappan and
Utpal Banerjee and
David Gelernter and
Alexandru Nicolau and
David A. Padua},
booktitle = {Languages and Compilers for Parallel Computing, 8th International
Workshop, LCPC'95, Columbus, Ohio, USA, August 10-12, 1995,
Proceedings},
publisher = {Springer},
series = {Lecture Notes in Computer Science},
volume = {1033},
year = {1996},
isbn = {3-540-60765-X},
doi = "10.1007/BFb0014196",
}
@inproceedings{Beletska2009,
author = {Beletska, Anna and Barthou, Denis and Bielecki, Wlodzimierz and Cohen, Albert},
title = {Computing the Transitive Closure of a Union of Affine Integer Tuple Relations},
booktitle = {COCOA '09: Proceedings of the 3rd International Conference on Combinatorial Optimization and Applications},
year = {2009},
isbn = {978-3-642-02025-4},
pages = {98--109},
location = {Huangshan, China},
doi = {10.1007/978-3-642-02026-1_9},
publisher = {Springer-Verlag},
address = {Berlin, Heidelberg},
}
@book{Schrijver1986,
author = "Schrijver, Alexander",
title = "Theory of Linear and Integer Programming",
publisher = "John Wiley \& Sons",
year = 1986
}
@article{Tarjan1972,
author = {Tarjan, Robert},
journal = {SIAM Journal on Computing},
number = {2},
pages = {146--160},
publisher = {SIAM},
title = {Depth-First Search and Linear Graph Algorithms},
volume = {1},
year = {1972},
doi = "10.1137/0201010",
}
@TechReport{ Omega_calc,
author = "Wayne Kelly and Vadim Maslov and William Pugh and Evan Rosser and Tatiana Shpeisman and Dave Wonnacott",
title = "The {Omega} Calculator and Library",
month = nov,
institution = "University of Maryland",
year = 1996
}
@TechReport{ Omega_lib,
author = "Wayne Kelly and Vadim Maslov and William Pugh and Evan Rosser and Tatiana Shpeisman and Dave Wonnacott",
title = "The {Omega} Library",
month = nov,
institution = "University of Maryland",
year = 1996
}
@unpublished{Verdoolaege2009isl,
author = "Verdoolaege, Sven",
title = "An integer set library for program analysis",
note = "Advances in the Theory of Integer Linear Optimization and its Extensions,AMS 2009 Spring Western Section Meeting, San Francisco, California, 25-26 April 2009",
month = Apr,
year = "2009",
url = "https://lirias.kuleuven.be/handle/123456789/228373",
}
@article{Barthou2000MSE,
author = {Barthou, Denis and Cohen, Albert and Collard, Jean-Fran\c{c}ois},
title = {Maximal Static Expansion},
journal = {Int. J. Parallel Program.},
volume = {28},
number = {3},
year = {2000},
issn = {0885-7458},
pages = {213--243},
doi = {10.1023/A:1007500431910},
publisher = {Kluwer Academic Publishers},
address = {Norwell, MA, USA},
}
@article{ Feautrier88parametric,
author = "P. Feautrier",
title = "Parametric Integer Programming",
journal = "RAIRO Recherche Op\'erationnelle",
volume = "22",
number = "3",
pages = "243--268",
year = "1988",
}
@Article{ Fea91,
author = {Feautrier, P.},
title = {Dataflow analysis of array and scalar references},
journal = {International Journal of Parallel Programming},
year = {1991},
OPTkey = {},
volume = {20},
number = {1},
OPTmonth = {},
pages = {23--53},
OPTnote = {},
OPTannote = {},
doi = "10.1007/BF01407931",
}
@INPROCEEDINGS{BouletRe98,
AUTHOR = {Pierre Boulet and Xavier Redon},
TITLE = {Communication Pre-evaluation in {HPF}},
BOOKTITLE = {EUROPAR'98},
PAGES = {263--272},
YEAR = 1998,
VOLUME = 1470,
series = {Lecture Notes in Computer Science},
PUBLISHER = {Springer-Verlag, Berlin},
ABSTRACT = { Parallel computers are difficult to program efficiently. We believe
that a good way to help programmers write efficient programs is to
provide them with tools that show them how their programs behave on
a parallel computer. Data distribution is the major performance
factor of data-parallel programs and so automatic data layout for
HPF programs has been studied by many researchers recently. The
communication volume induced by a data distribution is a good
estimator of the efficiency of this data distribution.
We present here a symbolic method to compute the communication
volume generated by a given data distribution during the program
writing phase (before compilation). We stay machine-independent to
assure portability. Our goal is to help the programmer understand
the data movements its program generates and thus find a good data
distribution. Our method is based on parametric polyhedral
computations. It can be applied to a large class of regular codes.},
doi = "10.1007/BFb0057861",
}
@INPROCEEDINGS {Verdoolaege2005experiences,
AUTHOR = "Verdoolaege, Sven and Beyls, Kristof and Bruynooghe, Maurice and Catthoor, Francky",
TITLE = {{E}xperiences with enumeration of integer projections of parametric polytopes},
BOOKTITLE = {{P}roceedings of 14th {I}nternational {C}onference on {C}ompiler {C}onstruction, {E}dinburgh, {S}cotland},
YEAR = {2005},
EDITOR = {Bodik, R.},
VOLUME = 3443,
pages = "91-105",
series = "Lecture Notes in Computer Science",
publisher = "Springer-Verlag",
address = "Berlin",
doi = "10.1007/b107108",
}
@article{Detlefs2005simplify,
author = {David Detlefs and Greg Nelson and James B. Saxe},
title = {Simplify: a theorem prover for program checking},
journal = {J. ACM},
volume = {52},
number = {3},
year = {2005},
issn = {0004-5411},
pages = {365--473},
doi = {10.1145/1066100.1066102},
publisher = {ACM},
address = {New York, NY, USA},
}
@phdthesis{Nelson1980phd,
author = {Charles Gregory Nelson},
title = {Techniques for program verification},
year = {1980},
order_no = {AAI8011683},
school = {Stanford University},
address = {Stanford, CA, USA},
}
@article{Woods2003short,
year = 2003,
Journal = "J. Amer. Math. Soc.",
volume = 16,
pages = "957--979",
month = apr,
title = {{Short rational generating functions for lattice point
problems}},
author = {Alexander Barvinok and Kevin Woods},
doi = "10.1090/S0894-0347-03-00428-4",
}
@misc{barvinok-0.22,
author = {Sven Verdoolaege},
title = {{\texttt{barvinok}}, version 0.22},
howpublished = {Available from \url{https://barvinok.sourceforge.io/}},
year = 2006
}
@inproceedings{DeLoera2004Three,
title = "Three Kinds of Integer Programming Algorithms based on Barvinok's Rational Functions",
author = "De Loera, J. A. and D. Haws and R. Hemmecke and P. Huggins and R. Yoshida",
booktitle = "Integer Programming and Combinatorial Optimization: 10th International IPCO Conference",
year = "2004",
month = jan,
series = "Lecture Notes in Computer Science",
Volume = 3064,
Pages = "244-255",
doi = "10.1007/978-3-540-25960-2_19",
}
@TechReport{Feautrier02,
author = {P. Feautrier and J. Collard and C. Bastoul},
title = {Solving systems of affine (in)equalities},
institution = {PRiSM, Versailles University},
year = 2002
}
@article{ Feautrier92multi,
author = "Paul Feautrier",
title = "Some Efficient Solutions to the Affine Scheduling Problem. {P}art {II}. Multidimensional Time",
journal = "International Journal of Parallel Programming",
volume = "21",
number = "6",
pages = "389--420",
year = "1992",
month = dec,
url = "citeseer.nj.nec.com/article/feautrier92some.html",
doi = "10.1007/BF01379404",
}
@misc{Bygde2010licentiate,
author = {Stefan Bygde},
title = {Static {WCET} Analysis based on Abstract Interpretation and Counting of Elements},
month = {March},
year = {2010},
howpublished = {Licentiate thesis},
publisher = {M{\"{a}}lardalen University Press},
url = {http://www.mrtc.mdh.se/index.php?choice=publications&id=2144},
}
@phdthesis{Meister2004PhD,
title = {Stating and Manipulating Periodicity in the Polytope Model. Applications to Program Analysis and Optimization},
author= {Beno\^it Meister},
school = {Universit\'e Louis Pasteur},
month = Dec,
year = {2004},
}
@inproceedings{Meister2008,
author = {Beno\^it Meister and Sven Verdoolaege},
title = {Polynomial Approximations in the Polytope Model: Bringing the Power
of Quasi-Polynomials to the Masses},
year = {2008},
booktitle = {Digest of the 6th Workshop on Optimization for DSP and Embedded Systems, ODES-6},
editor = "Jagadeesh Sankaran and Vander Aa, Tom",
month = apr,
}
@misc{Galea2009personal,
author = "Fran\c{c}ois Galea",
title = "personal communication",
year = 2009,
month = nov,
}
@misc{PPL,
author = "R. Bagnara and P. M. Hill and E. Zaffanella",
title = "The {Parma Polyhedra Library}",
howpublished = {\url{http://www.cs.unipr.it/ppl/}},
}
@TECHREPORT{Cook1991implementation,
AUTHOR={William Cook and Thomas Rutherford and Herbert E. Scarf and David F. Shallcross},
TITLE={An Implementation of the Generalized Basis Reduction Algorithm for Integer Programming},
YEAR=1991,
MONTH=Aug,
INSTITUTION={Cowles Foundation, Yale University},
TYPE={Cowles Foundation Discussion Papers},
NOTE={available at \url{http://ideas.repec.org/p/cwl/cwldpp/990.html}},
NUMBER={990},
}
@article{Karr1976affine,
author={ Michael Karr},
title={ Affine Relationships Among Variables of a Program },
journal={Acta Informatica},
Volume={6},
pages={133-151},
year={1976},
publisher={Springer-Verlag},
ignore={ },
doi = "10.1007/BF00268497",
}
@PhdThesis{Verhaegh1995PhD,
title = "Multidimensional Periodic Scheduling",
author = "Wim F. J. Verhaegh",
school = "Technische Universiteit Eindhoven",
year = 1995,
}
@INPROCEEDINGS{Seghir2006minimizing,
AUTHOR = "Rachid Seghir and Vincent Loechner",
TITLE = {Memory Optimization by Counting Points in Integer Transformations of Parametric Polytopes},
BOOKTITLE = {{P}roceedings of the {I}nternational {C}onference on {C}ompilers, {A}rchitectures, and {S}ynthesis for {E}mbedded Systems, CASES 2006, {S}eoul, {K}orea},
month = oct,
YEAR = {2006},
doi = {10.1145/1176760.1176771},
}
@misc{DeSmet2010personal,
author = "De Smet, Sven",
title = "personal communication",
year = 2010,
month = apr,
}
@inproceedings{Verdoolaege2015impact,
author = {Verdoolaege, Sven},
title = {Integer Set Coalescing},
booktitle = {Proceedings of the 5th International Workshop on
Polyhedral Compilation Techniques},
year = 2015,
month = Jan,
address = {Amsterdam, The Netherlands},
abstract = {
In polyhedral compilation, various core concepts such as the set
of statement instances, the access relations, the dependences and
the schedule are represented or approximated using sets and binary
relations of sequences of integers bounded by (quasi-)affine constraints.
When these sets and relations are represented in disjunctive normal form,
it is important to keep the number of disjuncts small, both for efficiency
and to improve the computation of transitive closure overapproximations
and AST generation. This paper describes the set coalescing operation
of isl that looks for opportunities to combine several disjuncts into
a single disjunct without affecting the elements in the set. The main
purpose of the paper is to explain the various heuristics and to prove
their correctness.
},
doi = "10.13140/2.1.1313.6968",
}
@misc{Verdoolaege2016tutorial,
author = "Sven Verdoolaege",
title = "Presburger Formulas and Polyhedral Compilation",
year = 2016,
doi = "10.13140/RG.2.1.1174.6323",
}
@inproceedings{Verdoolaege2009equivalence,
author = "Sven Verdoolaege and Gerda Janssens and Maurice Bruynooghe",
title = "Equivalence checking of static affine programs using widening to handle recurrences",
booktitle = "Computer Aided Verification 21",
month = Jun,
year = 2009,
pages = "599--613",
publisher = "Springer",
doi = "10.1007/978-3-642-02658-4_44",
}
@incollection{Verdoolaege2010isl,
author = {Verdoolaege, Sven},
title = {isl: An Integer Set Library for the Polyhedral Model},
booktitle = {Mathematical Software - ICMS 2010},
series = {Lecture Notes in Computer Science},
editor = {Fukuda, Komei and Hoeven, Joris and Joswig, Michael and Takayama, Nobuki},
publisher = {Springer},
isbn = {},
pages = {299-302},
volume = {6327},
year = {2010},
doi = {10.1007/978-3-642-15582-6_49},
}
@incollection{Verdoolaege2010networks,
author = "Verdoolaege, Sven",
title = "Polyhedral process networks",
editor = "Bhattacharrya, Shuvra and Deprettere, Ed and Leupers, Rainer and Takala, Jarmo",
publisher = "Springer",
year = "2010",
doi = "10.1007/978-1-4419-6345-1\_{}33",
pages = "931--965",
booktitle = "Handbook of Signal Processing Systems",
url = "https://lirias.kuleuven.be/handle/123456789/235370",
doi = "10.1007/978-1-4419-6345-1_33",
}
@InProceedings{Verdoolaege2011iscc,
author = {Sven Verdoolaege},
title = {Counting Affine Calculator and Applications},
booktitle = { First International Workshop on Polyhedral Compilation Techniques (IMPACT'11)},
address = { Chamonix, France},
month = apr,
year = {2011},
doi = "10.13140/RG.2.1.2959.5601",
}
@inproceedings{Verdoolaege2011closure,
author = {Verdoolaege, Sven and Cohen, Albert and Beletska, Anna},
title = {Transitive Closures of Affine Integer Tuple Relations and Their Overapproximations},
booktitle = {Proceedings of the 18th International Conference on Static Analysis},
series = {SAS'11},
year = {2011},
isbn = {978-3-642-23701-0},
location = {Venice, Italy},
pages = {216--232},
numpages = {17},
acmid = {2041570},
publisher = {Springer-Verlag},
address = {Berlin, Heidelberg},
doi = "10.1007/978-3-642-23702-7_18",
}
@article{Verdoolaege2013PPCG,
title={Polyhedral parallel code generation for {CUDA}},
author={Verdoolaege, Sven and Juega, Juan Carlos and Cohen, Albert and G{\'o}mez, Jos{\'e} Ignacio and Tenllado, Christian and Catthoor, Francky},
journal = {ACM Trans. Archit. Code Optim.},
volume={9},
number={4},
pages={54},
year={2013},
publisher={ACM},
doi = {10.1145/2400682.2400713},
}
@inproceedings{Verdoolaege2014impact,
author = {Verdoolaege, Sven and Guelton, Serge and
Grosser, Tobias and Cohen, Albert},
title = {Schedule Trees},
booktitle = {Proceedings of the 4th International Workshop on Polyhedral Compilation Techniques},
year = 2014,
month = Jan,
address = {Vienna, Austria},
url = {https://acohen.gitlabpages.inria.fr/impact/impact2014/papers/impact2014-verdoolaege.pdf},
abstract = {
Schedules in the polyhedral model, both those that represent the original
execution order and those produced by scheduling algorithms, naturally have the
form of a tree. Generic schedule representations proposed in the literature
encode this tree structure such that it is only implicitly available.
Following the internal representation of isl , we propose to represent
schedules as explicit trees and further extend the concept by introducing
different kinds of nodes. We compare our schedule trees to other
representations in detail and illustrate how they have been successfully used
to simplify the implementation of a non-trivial polyhedral compiler.
},
DOI = {10.13140/RG.2.1.4475.6001},
}
@article{Grosser2015AST,
author = "Tobias Grosser and Sven Verdoolaege and Albert Cohen",
title = "Polyhedral {AST} generation is more than scanning polyhedra",
journal = "ACM Transactions on Programming Languages and Systems",
issue_date = {August 2015},
volume = {37},
number = {4},
month = jul,
year = {2015},
issn = {0164-0925},
pages = {12:1--12:50},
articleno = {12},
numpages = {50},
url = {http://doi.acm.org/10.1145/2743016},
doi = {10.1145/2743016},
acmid = {2743016},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {Polyhedral compilation, Presburger relations, code generation, index set splitting, unrolling},
}
@inproceedings{Verdoolaege2016reordering,
author = {Sven Verdoolaege and Albert Cohen},
title = "Live-Range Reordering",
booktitle = {Proceedings of the sixth International Workshop on
Polyhedral Compilation Techniques},
year = 2016,
month = Jan,
address = {Prague, Czech Republic},
doi = "10.13140/RG.2.1.3272.9680",
}

BIN
external/mit/isl/dist/doc/manual.pdf vendored Normal file

Binary file not shown.

95
external/mit/isl/dist/doc/manual.tex vendored Normal file
View File

@ -0,0 +1,95 @@
\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[plainpages=false,pdfpagelabels,breaklinks]{hyperref}
\usepackage[backend=biber,isbn=false,url=false,doi=true,%
maxbibnames=99,style=authoryear,sortcites=true,sorting=nyt,backref=true,%
indexing=true,mincitenames=2,maxcitenames=2,datelabel=comp,dashed=false,%
useprefix=true]{biblatex}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{txfonts}
\usepackage{aliascnt}
\usepackage{tikz}
\usepackage{calc}
\usepackage[ruled]{algorithm2e}
\usetikzlibrary{matrix,fit,backgrounds,decorations.pathmorphing,positioning}
\usepackage{listings}
\addbibresource{isl.bib}
\renewbibmacro*{finentry}{\iflistundef{pageref}{}{\renewcommand{\finentrypunct}{}}\finentry}
\renewbibmacro*{pageref}{%
\iflistundef{pageref}
{}
{\setunit{\adddot\addspace}\printtext{%
\mbox{}\penalty100\hfill\hbox{[\printlist[pageref][-\value{listtotal}]{pageref}]}}}}
\lstset{basicstyle=\tt,flexiblecolumns=false}
\def\vec#1{\mathchoice{\mbox{\boldmath$\displaystyle\bf#1$}}
{\mbox{\boldmath$\textstyle\bf#1$}}
{\mbox{\boldmath$\scriptstyle\bf#1$}}
{\mbox{\boldmath$\scriptscriptstyle\bf#1$}}}
\providecommand{\fract}[1]{\left\{#1\right\}}
\providecommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\providecommand{\ceil}[1]{\left\lceil#1\right\rceil}
\def\sp#1#2{\langle #1, #2 \rangle}
\def\spv#1#2{\langle\vec #1,\vec #2\rangle}
\newtheorem{theorem}{Theorem}
\newaliascnt{example}{theorem}
\newtheorem{example}[example]{Example}
\newaliascnt{def}{theorem}
\newtheorem{definition}[def]{Definition}
\aliascntresetthe{example}
\aliascntresetthe{def}
\numberwithin{theorem}{section}
\numberwithin{def}{section}
\numberwithin{example}{section}
\newcommand{\algocflineautorefname}{Algorithm}
\newcommand{\exampleautorefname}{Example}
\newcommand{\lstnumberautorefname}{Line}
\renewcommand{\sectionautorefname}{Section}
\renewcommand{\subsectionautorefname}{Section}
\renewcommand{\algorithmautorefname}{Algorithm}
\DeclareFieldFormat{date}{\hypertarget{\thefield{entrykey}}{#1}}
\def\isl{\hyperlink{Verdoolaege2010isl}{\texttt{isl}}\xspace}
\def\Z{\mathbb{Z}}
\def\Q{\mathbb{Q}}
\def\pdom{\mathop{\rm pdom}\nolimits}
\def\domain{\mathop{\rm dom}\nolimits}
\def\range{\mathop{\rm ran}\nolimits}
\def\identity{\mathop{\rm Id}\nolimits}
\def\diff{\mathop{\Delta}\nolimits}
\providecommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\begin{document}
\title{Integer Set Library: Manual\\
\small Version: \input{version} }
\author{Sven Verdoolaege}
\maketitle
\tableofcontents
\chapter{User Manual}
\input{user}
\chapter{Implementation Details}
\input{implementation}
\chapter{Further Reading}
\input{reading}
\printbibliography
\end{document}

14
external/mit/isl/dist/doc/mypod2latex vendored Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/perl
use strict;
use Pod::LaTeX;
my ($in, $out) = @ARGV;
my $parser = new Pod::LaTeX(
AddPreamble => 0,
AddPostamble => 0,
LevelNoNum => 5,
);
$parser->parse_from_file($in, $out);

46
external/mit/isl/dist/doc/reading.tex vendored Normal file
View File

@ -0,0 +1,46 @@
\textcite{Verdoolaege2016tutorial} describes the concepts behind
\isl in some detail, mainly focusing on Presburger formulas,
but also including some information on polyhedral compilation,
especially on dependence analysis.
Individual aspects of \isl are described in the following publications.
\begin{itemize}
\item
\textcite{Verdoolaege2009equivalence} introduce \isl as a library
for manipulating sets of integers defined by linear inequalities and
integer divisions that is used in their equivalence checker.
\item
\textcite{Verdoolaege2010isl} provides a more detailed description
of \isl at the time and still stands as the official reference for
\isl. However, many features were only added later on and one or
more of the publications below may be more appropriate as
a reference to these features.
\item
\textcite[Section 5.1]{Verdoolaege2010networks} provides some
details on the dataflow analysis step, but also see
\textcite[Chapter 6]{Verdoolaege2016tutorial} and
\textcite{Verdoolaege2016reordering} for a more recent treatment.
\item The concepts of structured and named spaces and the manipulation
of sets containing elements in different spaces were introduced
by \textcite{Verdoolaege2011iscc}.
\item The transitive closure operation is described
by \textcite{Verdoolaege2011closure}.
\item The scheduler is briefly described by
\textcite[Section 6.2]{Verdoolaege2013PPCG} and
\textcite[Section 2.4]{Verdoolaege2016reordering}.
\item Schedule trees started out as ``trees of bands''
\parencite[Section 6.2]{Verdoolaege2013PPCG}, were formally
introduced by \textcite{Verdoolaege2014impact}, and were
slightly refined by \textcite{Grosser2015AST}.
\item The coalescing operation is described by
\textcite{Verdoolaege2015impact}.
\item The AST generator is described by \textcite{Grosser2015AST}.
\end{itemize}

13117
external/mit/isl/dist/doc/user.pod vendored Normal file

File diff suppressed because it is too large Load Diff

62
external/mit/isl/dist/extract_key.c vendored Normal file
View File

@ -0,0 +1,62 @@
/*
* Copyright 2013 Ecole Normale Superieure
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege,
* Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
*/
#include <string.h>
/* Extract a mapping key from the token "tok".
* Return KEY_ERROR on error, i.e., if "tok" does not
* correspond to any known key.
*/
static KEY KEY_EXTRACT(__isl_keep isl_stream *s, struct isl_token *tok)
{
isl_bool has_string;
char *name;
KEY key;
isl_ctx *ctx;
has_string = isl_token_has_str(tok);
if (has_string < 0)
return KEY_ERROR;
if (!has_string) {
isl_stream_error(s, tok, "expecting key");
return KEY_ERROR;
}
ctx = isl_stream_get_ctx(s);
name = isl_token_get_str(ctx, tok);
if (!name)
return KEY_ERROR;
for (key = 0; key < KEY_END; ++key) {
if (KEY_STR[key] && !strcmp(name, KEY_STR[key]))
break;
}
free(name);
if (key >= KEY_END)
isl_die(ctx, isl_error_invalid, "unknown key",
return KEY_ERROR);
return key;
}
/* Read a key from "s" and return the corresponding enum.
* Return KEY_ERROR on error, i.e., if the first token
* on the stream does not correspond to any known key.
*/
static KEY KEY_GET(__isl_keep isl_stream *s)
{
struct isl_token *tok;
KEY key;
tok = isl_stream_next_token(s);
key = KEY_EXTRACT(s, tok);
isl_token_free(tok);
return key;
}

44
external/mit/isl/dist/flow.c vendored Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright 2017 Sven Verdoolaege
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege.
*/
/* This program takes an isl_union_access_info object as input and
* prints the corresponding dependences.
*/
#include <isl/options.h>
#include <isl/printer.h>
#include <isl/union_map.h>
#include <isl/flow.h>
#include <isl/schedule.h>
int main(int argc, char **argv)
{
isl_ctx *ctx;
isl_printer *p;
isl_union_access_info *access;
isl_union_flow *flow;
struct isl_options *options;
options = isl_options_new_with_defaults();
argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL);
ctx = isl_ctx_alloc_with_options(&isl_options_args, options);
access = isl_union_access_info_read_from_file(ctx, stdin);
flow = isl_union_access_info_compute_flow(access);
p = isl_printer_to_file(ctx, stdout);
p = isl_printer_set_yaml_style(p, ISL_YAML_STYLE_BLOCK);
p = isl_printer_print_union_flow(p, flow);
isl_printer_free(p);
isl_union_flow_free(flow);
isl_ctx_free(ctx);
return 0;
}

136
external/mit/isl/dist/flow_cmp.c vendored Normal file
View File

@ -0,0 +1,136 @@
/*
* Copyright 2017 Sven Verdoolaege
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege.
*/
#include <stdlib.h>
#include <isl/arg.h>
#include <isl/options.h>
#include <isl/union_map.h>
#include <isl/stream.h>
struct options {
struct isl_options *isl;
char *flow1;
char *flow2;
};
ISL_ARGS_START(struct options, options_args)
ISL_ARG_CHILD(struct options, isl, "isl", &isl_options_args, "isl options")
ISL_ARG_ARG(struct options, flow1, "flow1", NULL)
ISL_ARG_ARG(struct options, flow2, "flow2", NULL)
ISL_ARGS_END
ISL_ARG_DEF(options, struct options, options_args)
static void die(const char *msg)
{
fprintf(stderr, "%s\n", msg);
exit(EXIT_FAILURE);
}
static FILE *open_or_die(const char *filename)
{
FILE *file;
file = fopen(filename, "r");
if (!file) {
fprintf(stderr, "Unable to open %s\n", filename);
exit(EXIT_FAILURE);
}
return file;
}
#undef BASE
#define BASE union_map
#include "read_in_string_templ.c"
/* Given two YAML descriptions of isl_union_flow objects, check whether
* they are equivalent.
* Return EXIT_SUCCESS if they are and EXIT_FAILURE if they are not
* or if anything else went wrong.
*
* The descriptions are checked field by field, meaning that the fields
* are expected to appear in the same order in both inputs.
*/
int main(int argc, char **argv)
{
isl_bool more;
isl_ctx *ctx;
struct options *options;
FILE *input1, *input2;
isl_stream *s1, *s2;
options = options_new_with_defaults();
if (!options)
return EXIT_FAILURE;
ctx = isl_ctx_alloc_with_options(&options_args, options);
argc = options_parse(options, argc, argv, ISL_ARG_ALL);
input1 = open_or_die(options->flow1);
input2 = open_or_die(options->flow2);
s1 = isl_stream_new_file(ctx, input1);
s2 = isl_stream_new_file(ctx, input2);
if (isl_stream_yaml_read_start_mapping(s1) < 0)
isl_die(ctx, isl_error_unknown, "arg1 not a YAML mapping",
return EXIT_FAILURE);
if (isl_stream_yaml_read_start_mapping(s2) < 0)
isl_die(ctx, isl_error_unknown, "arg2 not a YAML mapping",
return EXIT_FAILURE);
while ((more = isl_stream_yaml_next(s1)) == isl_bool_true) {
isl_bool more2;
isl_bool equal;
isl_union_map *umap1, *umap2;
more2 = isl_stream_yaml_next(s2);
if (more2 < 0)
return EXIT_FAILURE;
if (!more2)
isl_die(ctx, isl_error_unknown, "arg2 shorter",
return EXIT_FAILURE);
if (isl_stream_eat(s1, ISL_TOKEN_IDENT) < 0)
return EXIT_FAILURE;
if (isl_stream_eat(s2, ISL_TOKEN_IDENT) < 0)
return EXIT_FAILURE;
more = isl_stream_yaml_next(s1);
more2 = isl_stream_yaml_next(s2);
if (more < 0 || more2 < 0)
return EXIT_FAILURE;
if (!more || !more2)
isl_die(ctx, isl_error_unknown, "missing value",
return EXIT_FAILURE);
umap1 = read_union_map(s1);
umap2 = read_union_map(s2);
equal = isl_union_map_is_equal(umap1, umap2);
isl_union_map_free(umap1);
isl_union_map_free(umap2);
if (equal < 0)
return EXIT_FAILURE;
if (!equal)
die("field not equal");
}
if (more < 0)
return EXIT_FAILURE;
if (isl_stream_yaml_read_end_mapping(s1) < 0)
return EXIT_FAILURE;
if (isl_stream_yaml_read_end_mapping(s2) < 0)
return EXIT_FAILURE;
isl_stream_free(s1);
isl_stream_free(s2);
fclose(input1);
fclose(input2);
isl_ctx_free(ctx);
return EXIT_SUCCESS;
}

18
external/mit/isl/dist/flow_test.sh.in vendored Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
EXEEXT=@EXEEXT@
srcdir=@srcdir@
failed=0
for i in $srcdir/test_inputs/flow/*.ai; do
echo $i;
base=`basename $i .ai`
test=test-$base.flow
dir=`dirname $i`
ref=$dir/$base.flow
(./isl_flow$EXEEXT < $i > $test &&
./isl_flow_cmp$EXEEXT $ref $test && rm $test) || failed=1
done
test $failed -eq 0 || exit

View File

@ -0,0 +1,12 @@
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
/* Does "obj" have a single reference?
* That is, can "obj" be changed inplace?
*/
isl_bool FN(TYPE,has_single_reference)(__isl_keep TYPE *obj)
{
if (!obj)
return isl_bool_error;
return obj->ref == 1;
}

823
external/mit/isl/dist/imath/gmp_compat.c vendored Normal file
View File

@ -0,0 +1,823 @@
/*
Name: gmp_compat.c
Purpose: Provide GMP compatiable routines for imath library
Author: David Peixotto
Copyright (c) 2012 Qualcomm Innovation Center, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "gmp_compat.h"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#else
#include <sys/types.h>
#endif
#ifdef NDEBUG
#define CHECK(res) (res)
#else
#define CHECK(res) assert(((res) == MP_OK) && "expected MP_OK")
#endif
/* *(signed char *)&endian_test will thus either be:
* 0b00000001 = 1 on big-endian
* 0b11111111 = -1 on little-endian */
static const uint16_t endian_test = 0x1FF;
#define HOST_ENDIAN (*(signed char *)&endian_test)
/*************************************************************************
*
* Functions with direct translations
*
*************************************************************************/
/* gmp: mpq_clear */
void GMPQAPI(clear)(mp_rat x) { mp_rat_clear(x); }
/* gmp: mpq_cmp */
int GMPQAPI(cmp)(mp_rat op1, mp_rat op2) { return mp_rat_compare(op1, op2); }
/* gmp: mpq_init */
void GMPQAPI(init)(mp_rat x) { CHECK(mp_rat_init(x)); }
/* gmp: mpq_mul */
void GMPQAPI(mul)(mp_rat product, mp_rat multiplier, mp_rat multiplicand) {
CHECK(mp_rat_mul(multiplier, multiplicand, product));
}
/* gmp: mpq_set */
void GMPQAPI(set)(mp_rat rop, mp_rat op) { CHECK(mp_rat_copy(op, rop)); }
/* gmp: mpz_abs */
void GMPZAPI(abs)(mp_int rop, mp_int op) { CHECK(mp_int_abs(op, rop)); }
/* gmp: mpz_add */
void GMPZAPI(add)(mp_int rop, mp_int op1, mp_int op2) {
CHECK(mp_int_add(op1, op2, rop));
}
/* gmp: mpz_clear */
void GMPZAPI(clear)(mp_int x) { mp_int_clear(x); }
/* gmp: mpz_cmp_si */
int GMPZAPI(cmp_si)(mp_int op1, long op2) {
return mp_int_compare_value(op1, op2);
}
/* gmp: mpz_cmpabs */
int GMPZAPI(cmpabs)(mp_int op1, mp_int op2) {
return mp_int_compare_unsigned(op1, op2);
}
/* gmp: mpz_cmp */
int GMPZAPI(cmp)(mp_int op1, mp_int op2) { return mp_int_compare(op1, op2); }
/* gmp: mpz_init */
void GMPZAPI(init)(mp_int x) { CHECK(mp_int_init(x)); }
/* gmp: mpz_mul */
void GMPZAPI(mul)(mp_int rop, mp_int op1, mp_int op2) {
CHECK(mp_int_mul(op1, op2, rop));
}
/* gmp: mpz_neg */
void GMPZAPI(neg)(mp_int rop, mp_int op) { CHECK(mp_int_neg(op, rop)); }
/* gmp: mpz_set_si */
void GMPZAPI(set_si)(mp_int rop, long op) { CHECK(mp_int_set_value(rop, op)); }
/* gmp: mpz_set */
void GMPZAPI(set)(mp_int rop, mp_int op) { CHECK(mp_int_copy(op, rop)); }
/* gmp: mpz_sub */
void GMPZAPI(sub)(mp_int rop, mp_int op1, mp_int op2) {
CHECK(mp_int_sub(op1, op2, rop));
}
/* gmp: mpz_swap */
void GMPZAPI(swap)(mp_int rop1, mp_int rop2) { mp_int_swap(rop1, rop2); }
/* gmp: mpq_sgn */
int GMPQAPI(sgn)(mp_rat op) { return mp_rat_compare_zero(op); }
/* gmp: mpz_sgn */
int GMPZAPI(sgn)(mp_int op) { return mp_int_compare_zero(op); }
/* gmp: mpq_set_ui */
void GMPQAPI(set_ui)(mp_rat rop, unsigned long op1, unsigned long op2) {
CHECK(mp_rat_set_uvalue(rop, op1, op2));
}
/* gmp: mpz_set_ui */
void GMPZAPI(set_ui)(mp_int rop, unsigned long op) {
CHECK(mp_int_set_uvalue(rop, op));
}
/* gmp: mpq_den_ref */
mp_int GMPQAPI(denref)(mp_rat op) { return mp_rat_denom_ref(op); }
/* gmp: mpq_num_ref */
mp_int GMPQAPI(numref)(mp_rat op) { return mp_rat_numer_ref(op); }
/* gmp: mpq_canonicalize */
void GMPQAPI(canonicalize)(mp_rat op) { CHECK(mp_rat_reduce(op)); }
/*
* Functions that can be implemented as a combination of imath functions
*/
/* gmp: mpz_addmul */
/* gmp: rop = rop + (op1 * op2) */
void GMPZAPI(addmul)(mp_int rop, mp_int op1, mp_int op2) {
mpz_t tempz;
mp_int temp = &tempz;
mp_int_init(temp);
CHECK(mp_int_mul(op1, op2, temp));
CHECK(mp_int_add(rop, temp, rop));
mp_int_clear(temp);
}
/* gmp: mpz_divexact */
/* gmp: only produces correct results when d divides n */
void GMPZAPI(divexact)(mp_int q, mp_int n, mp_int d) {
CHECK(mp_int_div(n, d, q, NULL));
}
/* gmp: mpz_divisible_p */
/* gmp: return 1 if d divides n, 0 otherwise */
/* gmp: 0 is considered to divide only 0 */
int GMPZAPI(divisible_p)(mp_int n, mp_int d) {
/* variables to hold remainder */
mpz_t rz;
mp_int r = &rz;
int r_is_zero;
/* check for d = 0 */
int n_is_zero = mp_int_compare_zero(n) == 0;
int d_is_zero = mp_int_compare_zero(d) == 0;
if (d_is_zero) return n_is_zero;
/* return true if remainder is 0 */
CHECK(mp_int_init(r));
CHECK(mp_int_div(n, d, NULL, r));
r_is_zero = mp_int_compare_zero(r) == 0;
mp_int_clear(r);
return r_is_zero;
}
/* gmp: mpz_submul */
/* gmp: rop = rop - (op1 * op2) */
void GMPZAPI(submul)(mp_int rop, mp_int op1, mp_int op2) {
mpz_t tempz;
mp_int temp = &tempz;
mp_int_init(temp);
CHECK(mp_int_mul(op1, op2, temp));
CHECK(mp_int_sub(rop, temp, rop));
mp_int_clear(temp);
}
/* gmp: mpz_add_ui */
void GMPZAPI(add_ui)(mp_int rop, mp_int op1, unsigned long op2) {
mpz_t tempz;
mp_int temp = &tempz;
CHECK(mp_int_init_uvalue(temp, op2));
CHECK(mp_int_add(op1, temp, rop));
mp_int_clear(temp);
}
/* gmp: mpz_divexact_ui */
/* gmp: only produces correct results when d divides n */
void GMPZAPI(divexact_ui)(mp_int q, mp_int n, unsigned long d) {
mpz_t tempz;
mp_int temp = &tempz;
CHECK(mp_int_init_uvalue(temp, d));
CHECK(mp_int_div(n, temp, q, NULL));
mp_int_clear(temp);
}
/* gmp: mpz_mul_ui */
void GMPZAPI(mul_ui)(mp_int rop, mp_int op1, unsigned long op2) {
mpz_t tempz;
mp_int temp = &tempz;
CHECK(mp_int_init_uvalue(temp, op2));
CHECK(mp_int_mul(op1, temp, rop));
mp_int_clear(temp);
}
/* gmp: mpz_pow_ui */
/* gmp: 0^0 = 1 */
void GMPZAPI(pow_ui)(mp_int rop, mp_int base, unsigned long exp) {
mpz_t tempz;
mp_int temp = &tempz;
/* check for 0^0 */
if (exp == 0 && mp_int_compare_zero(base) == 0) {
CHECK(mp_int_set_value(rop, 1));
return;
}
/* rop = base^exp */
CHECK(mp_int_init_uvalue(temp, exp));
CHECK(mp_int_expt_full(base, temp, rop));
mp_int_clear(temp);
}
/* gmp: mpz_sub_ui */
void GMPZAPI(sub_ui)(mp_int rop, mp_int op1, unsigned long op2) {
mpz_t tempz;
mp_int temp = &tempz;
CHECK(mp_int_init_uvalue(temp, op2));
CHECK(mp_int_sub(op1, temp, rop));
mp_int_clear(temp);
}
/*************************************************************************
*
* Functions with different behavior in corner cases
*
*************************************************************************/
/* gmp: mpz_gcd */
void GMPZAPI(gcd)(mp_int rop, mp_int op1, mp_int op2) {
int op1_is_zero = mp_int_compare_zero(op1) == 0;
int op2_is_zero = mp_int_compare_zero(op2) == 0;
if (op1_is_zero && op2_is_zero) {
mp_int_zero(rop);
return;
}
CHECK(mp_int_gcd(op1, op2, rop));
}
/* gmp: mpz_get_str */
char *GMPZAPI(get_str)(char *str, int radix, mp_int op) {
int i, r, len;
/* Support negative radix like gmp */
r = radix;
if (r < 0) r = -r;
/* Compute the length of the string needed to hold the int */
len = mp_int_string_len(op, r);
if (str == NULL) {
str = malloc(len);
}
/* Convert to string using imath function */
CHECK(mp_int_to_string(op, r, str, len));
/* Change case to match gmp */
for (i = 0; i < len - 1; i++) {
if (radix < 0) {
str[i] = toupper(str[i]);
} else {
str[i] = tolower(str[i]);
}
}
return str;
}
/* gmp: mpq_get_str */
char *GMPQAPI(get_str)(char *str, int radix, mp_rat op) {
int i, r, len;
/* Only print numerator if it is a whole number */
if (mp_int_compare_value(mp_rat_denom_ref(op), 1) == 0)
return GMPZAPI(get_str)(str, radix, mp_rat_numer_ref(op));
/* Support negative radix like gmp */
r = radix;
if (r < 0) r = -r;
/* Compute the length of the string needed to hold the int */
len = mp_rat_string_len(op, r);
if (str == NULL) {
str = malloc(len);
}
/* Convert to string using imath function */
CHECK(mp_rat_to_string(op, r, str, len));
/* Change case to match gmp */
for (i = 0; i < len; i++) {
if (radix < 0) {
str[i] = toupper(str[i]);
} else {
str[i] = tolower(str[i]);
}
}
return str;
}
/* gmp: mpz_set_str */
int GMPZAPI(set_str)(mp_int rop, char *str, int base) {
mp_result res = mp_int_read_string(rop, base, str);
return ((res == MP_OK) ? 0 : -1);
}
/* gmp: mpq_set_str */
int GMPQAPI(set_str)(mp_rat rop, char *s, int base) {
char *slash;
char *str;
mp_result resN;
mp_result resD;
int res = 0;
/* Copy string to temporary storage so we can modify it below */
str = malloc(strlen(s) + 1);
strcpy(str, s);
/* Properly format the string as an int by terminating at the / */
slash = strchr(str, '/');
if (slash) *slash = '\0';
/* Parse numerator */
resN = mp_int_read_string(mp_rat_numer_ref(rop), base, str);
/* Parse denominator if given or set to 1 if not */
if (slash) {
resD = mp_int_read_string(mp_rat_denom_ref(rop), base, slash + 1);
} else {
resD = mp_int_set_uvalue(mp_rat_denom_ref(rop), 1);
}
/* Return failure if either parse failed */
if (resN != MP_OK || resD != MP_OK) {
res = -1;
}
free(str);
return res;
}
static unsigned long get_long_bits(mp_int op) {
/* Deal with integer that does not fit into unsigned long. We want to grab
* the least significant digits that will fit into the long. Read the digits
* into the long starting at the most significant digit that fits into a
* long. The long is shifted over by MP_DIGIT_BIT before each digit is added.
*
* The shift is decomposed into two steps (following the pattern used in the
* rest of the imath library) to accommodate architectures that don't deal
* well with 32-bit shifts.
*/
mp_size digits_to_copy =
(sizeof(unsigned long) + sizeof(mp_digit) - 1) / sizeof(mp_digit);
if (digits_to_copy > MP_USED(op)) {
digits_to_copy = MP_USED(op);
}
mp_digit *digits = MP_DIGITS(op);
unsigned long out = 0;
for (int i = digits_to_copy - 1; i >= 0; i--) {
out <<= (MP_DIGIT_BIT / 2);
out <<= (MP_DIGIT_BIT / 2);
out |= digits[i];
}
return out;
}
/* gmp: mpz_get_ui */
unsigned long GMPZAPI(get_ui)(mp_int op) {
unsigned long out;
/* Try a standard conversion that fits into an unsigned long */
mp_result res = mp_int_to_uint(op, &out);
if (res == MP_OK) return out;
/* Abort the try if we don't have a range error in the conversion.
* The range error indicates that the value cannot fit into a long. */
CHECK(res == MP_RANGE ? MP_OK : MP_RANGE);
if (res != MP_RANGE) return 0;
return get_long_bits(op);
}
/* gmp: mpz_get_si */
long GMPZAPI(get_si)(mp_int op) {
long out;
unsigned long uout;
int long_msb;
/* Try a standard conversion that fits into a long */
mp_result res = mp_int_to_int(op, &out);
if (res == MP_OK) return out;
/* Abort the try if we don't have a range error in the conversion.
* The range error indicates that the value cannot fit into a long. */
CHECK(res == MP_RANGE ? MP_OK : MP_RANGE);
if (res != MP_RANGE) return 0;
/* get least significant bits into an unsigned long */
uout = get_long_bits(op);
/* clear the top bit */
long_msb = (sizeof(unsigned long) * 8) - 1;
uout &= (~(1UL << long_msb));
/* convert to negative if needed based on sign of op */
if (MP_SIGN(op) == MP_NEG) {
uout = 0 - uout;
}
out = (long)uout;
return out;
}
/* gmp: mpz_lcm */
void GMPZAPI(lcm)(mp_int rop, mp_int op1, mp_int op2) {
int op1_is_zero = mp_int_compare_zero(op1) == 0;
int op2_is_zero = mp_int_compare_zero(op2) == 0;
if (op1_is_zero || op2_is_zero) {
mp_int_zero(rop);
return;
}
CHECK(mp_int_lcm(op1, op2, rop));
CHECK(mp_int_abs(rop, rop));
}
/* gmp: mpz_mul_2exp */
/* gmp: allow big values for op2 when op1 == 0 */
void GMPZAPI(mul_2exp)(mp_int rop, mp_int op1, unsigned long op2) {
if (mp_int_compare_zero(op1) == 0)
mp_int_zero(rop);
else
CHECK(mp_int_mul_pow2(op1, op2, rop));
}
/*
* Functions needing expanded functionality
*/
/* [Note]Overview of division implementation
All division operations (N / D) compute q and r such that
N = q * D + r, with 0 <= abs(r) < abs(d)
The q and r values are not uniquely specified by N and D. To specify which q
and r values should be used, GMP implements three different rounding modes
for integer division:
ceiling - round q twords +infinity, r has opposite sign as d
floor - round q twords -infinity, r has same sign as d
truncate - round q twords zero, r has same sign as n
The imath library only supports truncate as a rounding mode. We need to
implement the other rounding modes in terms of truncating division. We first
perform the division in trucate mode and then adjust q accordingly. Once we
know q, we can easily compute the correct r according the the formula above
by computing:
r = N - q * D
The main task is to compute q. We can compute the correct q from a trucated
version as follows.
For ceiling rounding mode, if q is less than 0 then the truncated rounding
mode is the same as the ceiling rounding mode. If q is greater than zero
then we need to round q up by one because the truncated version was rounded
down to zero. If q equals zero then check to see if the result of the
divison is positive. A positive result needs to increment q to one.
For floor rounding mode, if q is greater than 0 then the trucated rounding
mode is the same as the floor rounding mode. If q is less than zero then we
need to round q down by one because the trucated mode rounded q up by one
twords zero. If q is zero then we need to check to see if the result of the
division is negative. A negative result needs to decrement q to negative
one.
*/
/* gmp: mpz_cdiv_q */
void GMPZAPI(cdiv_q)(mp_int q, mp_int n, mp_int d) {
mpz_t rz;
mp_int r = &rz;
int qsign, rsign, nsign, dsign;
CHECK(mp_int_init(r));
/* save signs before division because q can alias with n or d */
nsign = mp_int_compare_zero(n);
dsign = mp_int_compare_zero(d);
/* truncating division */
CHECK(mp_int_div(n, d, q, r));
/* see: [Note]Overview of division implementation */
qsign = mp_int_compare_zero(q);
rsign = mp_int_compare_zero(r);
if (qsign > 0) { /* q > 0 */
if (rsign != 0) { /* r != 0 */
CHECK(mp_int_add_value(q, 1, q));
}
} else if (qsign == 0) { /* q == 0 */
if (rsign != 0) { /* r != 0 */
if ((nsign > 0 && dsign > 0) || (nsign < 0 && dsign < 0)) {
CHECK(mp_int_set_value(q, 1));
}
}
}
mp_int_clear(r);
}
/* gmp: mpz_fdiv_q */
void GMPZAPI(fdiv_q)(mp_int q, mp_int n, mp_int d) {
mpz_t rz;
mp_int r = &rz;
int qsign, rsign, nsign, dsign;
CHECK(mp_int_init(r));
/* save signs before division because q can alias with n or d */
nsign = mp_int_compare_zero(n);
dsign = mp_int_compare_zero(d);
/* truncating division */
CHECK(mp_int_div(n, d, q, r));
/* see: [Note]Overview of division implementation */
qsign = mp_int_compare_zero(q);
rsign = mp_int_compare_zero(r);
if (qsign < 0) { /* q < 0 */
if (rsign != 0) { /* r != 0 */
CHECK(mp_int_sub_value(q, 1, q));
}
} else if (qsign == 0) { /* q == 0 */
if (rsign != 0) { /* r != 0 */
if ((nsign < 0 && dsign > 0) || (nsign > 0 && dsign < 0)) {
CHECK(mp_int_set_value(q, -1));
}
}
}
mp_int_clear(r);
}
/* gmp: mpz_fdiv_r */
void GMPZAPI(fdiv_r)(mp_int r, mp_int n, mp_int d) {
mpz_t qz;
mpz_t tempz;
mpz_t orig_dz;
mpz_t orig_nz;
mp_int q = &qz;
mp_int temp = &tempz;
mp_int orig_d = &orig_dz;
mp_int orig_n = &orig_nz;
CHECK(mp_int_init(q));
CHECK(mp_int_init(temp));
/* Make a copy of n in case n and d in case they overlap with q */
CHECK(mp_int_init_copy(orig_d, d));
CHECK(mp_int_init_copy(orig_n, n));
/* floor division */
GMPZAPI(fdiv_q)(q, n, d);
/* see: [Note]Overview of division implementation */
/* n = q * d + r ==> r = n - q * d */
mp_int_mul(q, orig_d, temp);
mp_int_sub(orig_n, temp, r);
mp_int_clear(q);
mp_int_clear(temp);
mp_int_clear(orig_d);
mp_int_clear(orig_n);
}
/* gmp: mpz_tdiv_q */
void GMPZAPI(tdiv_q)(mp_int q, mp_int n, mp_int d) {
/* truncating division*/
CHECK(mp_int_div(n, d, q, NULL));
}
/* gmp: mpz_fdiv_q_ui */
unsigned long GMPZAPI(fdiv_q_ui)(mp_int q, mp_int n, unsigned long d) {
mpz_t tempz;
mp_int temp = &tempz;
mpz_t rz;
mp_int r = &rz;
mpz_t orig_nz;
mp_int orig_n = &orig_nz;
unsigned long rl;
CHECK(mp_int_init_uvalue(temp, d));
CHECK(mp_int_init(r));
/* Make a copy of n in case n and q overlap */
CHECK(mp_int_init_copy(orig_n, n));
/* use floor division mode to compute q and r */
GMPZAPI(fdiv_q)(q, n, temp);
GMPZAPI(fdiv_r)(r, orig_n, temp);
CHECK(mp_int_to_uint(r, &rl));
mp_int_clear(temp);
mp_int_clear(r);
mp_int_clear(orig_n);
return rl;
}
/* gmp: mpz_export */
void *GMPZAPI(export)(void *rop, size_t *countp, int order, size_t size,
int endian, size_t nails, mp_int op) {
size_t i, j;
size_t num_used_bytes;
size_t num_words, num_missing_bytes;
ssize_t word_offset;
unsigned char *dst;
mp_digit *src;
int src_bits;
/* We do not have a complete implementation. Assert to ensure our
* restrictions are in place.
*/
assert(nails == 0 && "Do not support non-full words");
assert(endian == 1 || endian == 0 || endian == -1);
assert(order == 1 || order == -1);
/* Test for zero */
if (mp_int_compare_zero(op) == 0) {
if (countp) *countp = 0;
return rop;
}
/* Calculate how many words we need */
num_used_bytes = mp_int_unsigned_len(op);
num_words = (num_used_bytes + (size - 1)) / size; /* ceil division */
assert(num_used_bytes > 0);
/* Check to see if we will have missing bytes in the last word.
Missing bytes can only occur when the size of words we output is
greater than the size of words used internally by imath. The number of
missing bytes is the number of bytes needed to fill out the last word. If
this number is greater than the size of a single mp_digit, then we need to
pad the word with extra zeros. Otherwise, the missing bytes can be filled
directly from the zeros in the last digit in the number.
*/
num_missing_bytes = (size * num_words) - num_used_bytes;
assert(num_missing_bytes < size);
/* Allocate space for the result if needed */
if (rop == NULL) {
rop = malloc(num_words * size);
}
if (endian == 0) {
endian = HOST_ENDIAN;
}
/* Initialize dst and src pointers */
dst = (unsigned char *)rop + (order >= 0 ? (num_words - 1) * size : 0) +
(endian >= 0 ? size - 1 : 0);
src = MP_DIGITS(op);
src_bits = MP_DIGIT_BIT;
word_offset = (endian >= 0 ? size : -size) + (order < 0 ? size : -size);
for (i = 0; i < num_words; i++) {
for (j = 0; j < size && i * size + j < num_used_bytes; j++) {
if (src_bits == 0) {
++src;
src_bits = MP_DIGIT_BIT;
}
*dst = (*src >> (MP_DIGIT_BIT - src_bits)) & 0xFF;
src_bits -= 8;
dst -= endian;
}
for (; j < size; j++) {
*dst = 0;
dst -= endian;
}
dst += word_offset;
}
if (countp) *countp = num_words;
return rop;
}
/* gmp: mpz_import */
void GMPZAPI(import)(mp_int rop, size_t count, int order, size_t size,
int endian, size_t nails, const void *op) {
mpz_t tmpz;
mp_int tmp = &tmpz;
size_t total_size;
size_t num_digits;
ssize_t word_offset;
const unsigned char *src;
mp_digit *dst;
int dst_bits;
size_t i, j;
if (count == 0 || op == NULL) return;
/* We do not have a complete implementation. Assert to ensure our
* restrictions are in place. */
assert(nails == 0 && "Do not support non-full words");
assert(endian == 1 || endian == 0 || endian == -1);
assert(order == 1 || order == -1);
if (endian == 0) {
endian = HOST_ENDIAN;
}
/* Compute number of needed digits by ceil division */
total_size = count * size;
num_digits = (total_size + sizeof(mp_digit) - 1) / sizeof(mp_digit);
/* Init temporary */
mp_int_init_size(tmp, num_digits);
for (i = 0; i < num_digits; i++) tmp->digits[i] = 0;
/* Copy bytes */
src = (const unsigned char *)op + (order >= 0 ? (count - 1) * size : 0) +
(endian >= 0 ? size - 1 : 0);
dst = MP_DIGITS(tmp);
dst_bits = 0;
word_offset = (endian >= 0 ? size : -size) + (order < 0 ? size : -size);
for (i = 0; i < count; i++) {
for (j = 0; j < size; j++) {
if (dst_bits == MP_DIGIT_BIT) {
++dst;
dst_bits = 0;
}
*dst |= ((mp_digit)*src) << dst_bits;
dst_bits += 8;
src -= endian;
}
src += word_offset;
}
tmp->used = num_digits;
/* Remove leading zeros from number */
{
mp_size uz_ = tmp->used;
mp_digit *dz_ = MP_DIGITS(tmp) + uz_ - 1;
while (uz_ > 1 && (*dz_-- == 0)) --uz_;
tmp->used = uz_;
}
/* Copy to destination */
mp_int_copy(tmp, rop);
mp_int_clear(tmp);
}
/* gmp: mpz_sizeinbase */
size_t GMPZAPI(sizeinbase)(mp_int op, int base) {
mp_result res;
size_t size;
/* If op == 0, return 1 */
if (mp_int_compare_zero(op) == 0) return 1;
/* Compute string length in base */
res = mp_int_string_len(op, base);
CHECK((res > 0) == MP_OK);
/* Now adjust the final size by getting rid of string artifacts */
size = res;
/* subtract one for the null terminator */
size -= 1;
/* subtract one for the negative sign */
if (mp_int_compare_zero(op) < 0) size -= 1;
return size;
}

229
external/mit/isl/dist/imath/gmp_compat.h vendored Normal file
View File

@ -0,0 +1,229 @@
/*
Name: gmp_compat.h
Purpose: Provide GMP compatiable routines for imath library
Author: David Peixotto
Copyright (c) 2012 Qualcomm Innovation Center, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef IMATH_GMP_COMPAT_H_
#define IMATH_GMP_COMPAT_H_
#include "imath.h"
#include "imrat.h"
#include <stddef.h>
#define GMPZAPI(fun) impz_ ## fun
#define GMPQAPI(fun) impq_ ## fun
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
*
* Functions with direct translations
*
*************************************************************************/
/* gmp: mpq_clear */
void GMPQAPI(clear)(mp_rat x);
/* gmp: mpq_cmp */
int GMPQAPI(cmp)(mp_rat op1, mp_rat op2);
/* gmp: mpq_init */
void GMPQAPI(init)(mp_rat x);
/* gmp: mpq_mul */
void GMPQAPI(mul)(mp_rat product, mp_rat multiplier, mp_rat multiplicand);
/* gmp: mpq_set */
void GMPQAPI(set)(mp_rat rop, mp_rat op);
/* gmp: mpz_abs */
void GMPZAPI(abs)(mp_int rop, mp_int op);
/* gmp: mpz_add */
void GMPZAPI(add)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_clear */
void GMPZAPI(clear)(mp_int x);
/* gmp: mpz_cmp_si */
int GMPZAPI(cmp_si)(mp_int op1, long op2);
/* gmp: mpz_cmpabs */
int GMPZAPI(cmpabs)(mp_int op1, mp_int op2);
/* gmp: mpz_cmp */
int GMPZAPI(cmp)(mp_int op1, mp_int op2);
/* gmp: mpz_init */
void GMPZAPI(init)(mp_int x);
/* gmp: mpz_mul */
void GMPZAPI(mul)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_neg */
void GMPZAPI(neg)(mp_int rop, mp_int op);
/* gmp: mpz_set_si */
void GMPZAPI(set_si)(mp_int rop, long op);
/* gmp: mpz_set */
void GMPZAPI(set)(mp_int rop, mp_int op);
/* gmp: mpz_sub */
void GMPZAPI(sub)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_swap */
void GMPZAPI(swap)(mp_int rop1, mp_int rop2);
/* gmp: mpq_sgn */
int GMPQAPI(sgn)(mp_rat op);
/* gmp: mpz_sgn */
int GMPZAPI(sgn)(mp_int op);
/* gmp: mpq_set_ui */
void GMPQAPI(set_ui)(mp_rat rop, unsigned long op1, unsigned long op2);
/* gmp: mpz_set_ui */
void GMPZAPI(set_ui)(mp_int rop, unsigned long op);
/* gmp: mpq_den_ref */
mp_int GMPQAPI(denref)(mp_rat op);
/* gmp: mpq_num_ref */
mp_int GMPQAPI(numref)(mp_rat op);
/* gmp: mpq_canonicalize */
void GMPQAPI(canonicalize)(mp_rat op);
/*************************************************************************
*
* Functions that can be implemented as a combination of imath functions
*
*************************************************************************/
/* gmp: mpz_addmul */
void GMPZAPI(addmul)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_divexact */
void GMPZAPI(divexact)(mp_int q, mp_int n, mp_int d);
/* gmp: mpz_divisible_p */
int GMPZAPI(divisible_p)(mp_int n, mp_int d);
/* gmp: mpz_submul */
void GMPZAPI(submul)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_add_ui */
void GMPZAPI(add_ui)(mp_int rop, mp_int op1, unsigned long op2);
/* gmp: mpz_divexact_ui */
void GMPZAPI(divexact_ui)(mp_int q, mp_int n, unsigned long d);
/* gmp: mpz_mul_ui */
void GMPZAPI(mul_ui)(mp_int rop, mp_int op1, unsigned long op2);
/* gmp: mpz_pow_ui */
void GMPZAPI(pow_ui)(mp_int rop, mp_int base, unsigned long exp);
/* gmp: mpz_sub_ui */
void GMPZAPI(sub_ui)(mp_int rop, mp_int op1, unsigned long op2);
/* gmp: mpz_fdiv_q_ui */
unsigned long GMPZAPI(fdiv_q_ui)(mp_int q, mp_int n, unsigned long d);
/* gmp: mpz_sizeinbase */
size_t GMPZAPI(sizeinbase)(mp_int op, int base);
/*************************************************************************
*
* Functions with different behavior in corner cases
*
*************************************************************************/
/* gmp: mpz_gcd */
/* gmp: When op1 = 0 and op2 = 0, return 0.*/
void GMPZAPI(gcd)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_get_str */
/* gmp: If str is NULL then allocate space using the default allocator. */
char* GMPZAPI(get_str)(char *str, int radix, mp_int op);
/* gmp: mpq_get_str */
/* gmp: If str is NULL then allocate space using the default allocator. */
/* gmp: If value is a whole number do not print denomenator. */
/* TODO: Need to handle 0 values better. GMP prints 0/4 instead of 0.*/
char* GMPQAPI(get_str)(char *str, int radix, mp_rat op);
/* gmp: mpz_set_str */
/* gmp: Allow and ignore spaces in string. */
int GMPZAPI(set_str)(mp_int rop, char *str, int base);
/* gmp: mpq_set_str */
int GMPQAPI(set_str)(mp_rat rop, char *str, int base);
/* gmp: mpz_get_ui */
/* gmp: Return least significant bits if value is too big for a long. */
unsigned long GMPZAPI(get_ui)(mp_int op);
/* gmp: mpz_get_si */
/* gmp: Return least significant bits if value is too bit for a long. */
/* gmp: If value is too big for long, return the least significant
(8*sizeof(long)-1) bits from the op and set the sign bit according to
the sign of the op. */
long GMPZAPI(get_si)(mp_int op);
/* gmp: mpz_lcm */
/* gmp: When op1 = 0 or op2 = 0, return 0.*/
/* gmp: The resutl of lcm(a,b) is always positive. */
void GMPZAPI(lcm)(mp_int rop, mp_int op1, mp_int op2);
/* gmp: mpz_mul_2exp */
/* gmp: allow big values for op2 when op1 == 0 */
void GMPZAPI(mul_2exp)(mp_int rop, mp_int op1, unsigned long op2);
/*************************************************************************
*
* Functions needing expanded functionality
*
*************************************************************************/
/* gmp: mpz_cdiv_q */
void GMPZAPI(cdiv_q)(mp_int q, mp_int n, mp_int d);
/* gmp: mpz_fdiv_q */
void GMPZAPI(fdiv_q)(mp_int q, mp_int n, mp_int d);
/* gmp: mpz_fdiv_r */
void GMPZAPI(fdiv_r)(mp_int r, mp_int n, mp_int d);
/* gmp: mpz_tdiv_q */
void GMPZAPI(tdiv_q)(mp_int q, mp_int n, mp_int d);
/* gmp: mpz_export */
void* GMPZAPI(export)(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int op);
/* gmp: mpz_import */
void GMPZAPI(import)(mp_int rop, size_t count, int order, size_t size, int endian, size_t nails, const void* op);
#ifdef __cplusplus
}
#endif
#endif /* end IMATH_GMP_COMPAT_H_ */

2780
external/mit/isl/dist/imath/imath.c vendored Normal file

File diff suppressed because it is too large Load Diff

421
external/mit/isl/dist/imath/imath.h vendored Normal file
View File

@ -0,0 +1,421 @@
/*
Name: imath.h
Purpose: Arbitrary precision integer arithmetic routines.
Author: M. J. Fromberger
Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef IMATH_H_
#define IMATH_H_
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char mp_sign;
typedef unsigned int mp_size;
typedef int mp_result;
typedef long mp_small; /* must be a signed type */
typedef unsigned long mp_usmall; /* must be an unsigned type */
/* Build with words as uint64_t by default. */
#ifdef USE_32BIT_WORDS
typedef uint16_t mp_digit;
typedef uint32_t mp_word;
# define MP_DIGIT_MAX (UINT16_MAX * 1UL)
# define MP_WORD_MAX (UINT32_MAX * 1UL)
#else
typedef uint32_t mp_digit;
typedef uint64_t mp_word;
# define MP_DIGIT_MAX (UINT32_MAX * UINT64_C(1))
# define MP_WORD_MAX (UINT64_MAX)
#endif
typedef struct {
mp_digit single;
mp_digit* digits;
mp_size alloc;
mp_size used;
mp_sign sign;
} mpz_t, *mp_int;
static inline mp_digit* MP_DIGITS(mp_int Z) { return Z->digits; }
static inline mp_size MP_ALLOC(mp_int Z) { return Z->alloc; }
static inline mp_size MP_USED(mp_int Z) { return Z->used; }
static inline mp_sign MP_SIGN(mp_int Z) { return Z->sign; }
extern const mp_result MP_OK;
extern const mp_result MP_FALSE;
extern const mp_result MP_TRUE;
extern const mp_result MP_MEMORY;
extern const mp_result MP_RANGE;
extern const mp_result MP_UNDEF;
extern const mp_result MP_TRUNC;
extern const mp_result MP_BADARG;
extern const mp_result MP_MINERR;
#define MP_DIGIT_BIT (sizeof(mp_digit) * CHAR_BIT)
#define MP_WORD_BIT (sizeof(mp_word) * CHAR_BIT)
#define MP_SMALL_MIN LONG_MIN
#define MP_SMALL_MAX LONG_MAX
#define MP_USMALL_MAX ULONG_MAX
#define MP_MIN_RADIX 2
#define MP_MAX_RADIX 36
/** Sets the default number of digits allocated to an `mp_int` constructed by
`mp_int_init_size()` with `prec == 0`. Allocations are rounded up to
multiples of this value. `MP_DEFAULT_PREC` is the default value. Requires
`ndigits > 0`. */
void mp_int_default_precision(mp_size ndigits);
/** Sets the number of digits below which multiplication will use the standard
quadratic "schoolbook" multiplication algorithm rather than Karatsuba-Ofman.
Requires `ndigits >= sizeof(mp_word)`. */
void mp_int_multiply_threshold(mp_size ndigits);
/** A sign indicating a (strictly) negative value. */
extern const mp_sign MP_NEG;
/** A sign indicating a zero or positive value. */
extern const mp_sign MP_ZPOS;
/** Reports whether `z` is odd, having remainder 1 when divided by 2. */
static inline bool mp_int_is_odd(mp_int z) { return (z->digits[0] & 1) != 0; }
/** Reports whether `z` is even, having remainder 0 when divided by 2. */
static inline bool mp_int_is_even(mp_int z) { return (z->digits[0] & 1) == 0; }
/** Initializes `z` with 1-digit precision and sets it to zero. This function
cannot fail unless `z == NULL`. */
mp_result mp_int_init(mp_int z);
/** Allocates a fresh zero-valued `mpz_t` on the heap, returning NULL in case
of error. The only possible error is out-of-memory. */
mp_int mp_int_alloc(void);
/** Initializes `z` with at least `prec` digits of storage, and sets it to
zero. If `prec` is zero, the default precision is used. In either case the
size is rounded up to the nearest multiple of the word size. */
mp_result mp_int_init_size(mp_int z, mp_size prec);
/** Initializes `z` to be a copy of an already-initialized value in `old`. The
new copy does not share storage with the original. */
mp_result mp_int_init_copy(mp_int z, mp_int old);
/** Initializes `z` to the specified signed `value` at default precision. */
mp_result mp_int_init_value(mp_int z, mp_small value);
/** Initializes `z` to the specified unsigned `value` at default precision. */
mp_result mp_int_init_uvalue(mp_int z, mp_usmall uvalue);
/** Sets `z` to the value of the specified signed `value`. */
mp_result mp_int_set_value(mp_int z, mp_small value);
/** Sets `z` to the value of the specified unsigned `value`. */
mp_result mp_int_set_uvalue(mp_int z, mp_usmall uvalue);
/** Releases the storage used by `z`. */
void mp_int_clear(mp_int z);
/** Releases the storage used by `z` and also `z` itself.
This should only be used for `z` allocated by `mp_int_alloc()`. */
void mp_int_free(mp_int z);
/** Replaces the value of `c` with a copy of the value of `a`. No new memory is
allocated unless `a` has more significant digits than `c` has allocated. */
mp_result mp_int_copy(mp_int a, mp_int c);
/** Swaps the values and storage between `a` and `c`. */
void mp_int_swap(mp_int a, mp_int c);
/** Sets `z` to zero. The allocated storage of `z` is not changed. */
void mp_int_zero(mp_int z);
/** Sets `c` to the absolute value of `a`. */
mp_result mp_int_abs(mp_int a, mp_int c);
/** Sets `c` to the additive inverse (negation) of `a`. */
mp_result mp_int_neg(mp_int a, mp_int c);
/** Sets `c` to the sum of `a` and `b`. */
mp_result mp_int_add(mp_int a, mp_int b, mp_int c);
/** Sets `c` to the sum of `a` and `value`. */
mp_result mp_int_add_value(mp_int a, mp_small value, mp_int c);
/** Sets `c` to the difference of `a` less `b`. */
mp_result mp_int_sub(mp_int a, mp_int b, mp_int c);
/** Sets `c` to the difference of `a` less `value`. */
mp_result mp_int_sub_value(mp_int a, mp_small value, mp_int c);
/** Sets `c` to the product of `a` and `b`. */
mp_result mp_int_mul(mp_int a, mp_int b, mp_int c);
/** Sets `c` to the product of `a` and `value`. */
mp_result mp_int_mul_value(mp_int a, mp_small value, mp_int c);
/** Sets `c` to the product of `a` and `2^p2`. Requires `p2 >= 0`. */
mp_result mp_int_mul_pow2(mp_int a, mp_small p2, mp_int c);
/** Sets `c` to the square of `a`. */
mp_result mp_int_sqr(mp_int a, mp_int c);
/** Sets `q` and `r` to the quotent and remainder of `a / b`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned
to `0 <= r < b`.
Either of `q` or `r` may be NULL, but not both, and `q` and `r` may not
point to the same value. */
mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r);
/** Sets `q` and `*r` to the quotent and remainder of `a / value`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned to
`0 <= *r < b`. Either of `q` or `r` may be NULL. */
mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small *r);
/** Sets `q` and `r` to the quotient and remainder of `a / 2^p2`. This is a
special case for division by powers of two that is more efficient than
using ordinary division. Note that `mp_int_div()` will automatically handle
this case, this function is for cases where you have only the exponent. */
mp_result mp_int_div_pow2(mp_int a, mp_small p2, mp_int q, mp_int r);
/** Sets `c` to the remainder of `a / m`.
The remainder is pinned to `0 <= c < m`. */
mp_result mp_int_mod(mp_int a, mp_int m, mp_int c);
/** Sets `c` to the value of `a` raised to the `b` power.
It returns `MP_RANGE` if `b < 0`. */
mp_result mp_int_expt(mp_int a, mp_small b, mp_int c);
/** Sets `c` to the value of `a` raised to the `b` power.
It returns `MP_RANGE` if `b < 0`. */
mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c);
/** Sets `c` to the value of `a` raised to the `b` power.
It returns `MP_RANGE`) if `b < 0`. */
mp_result mp_int_expt_full(mp_int a, mp_int b, mp_int c);
/** Sets `*r` to the remainder of `a / value`.
The remainder is pinned to `0 <= r < value`. */
static inline
mp_result mp_int_mod_value(mp_int a, mp_small value, mp_small* r) {
return mp_int_div_value(a, value, 0, r);
}
/** Returns the comparator of `a` and `b`. */
int mp_int_compare(mp_int a, mp_int b);
/** Returns the comparator of the magnitudes of `a` and `b`, disregarding their
signs. Neither `a` nor `b` is modified by the comparison. */
int mp_int_compare_unsigned(mp_int a, mp_int b);
/** Returns the comparator of `z` and zero. */
int mp_int_compare_zero(mp_int z);
/** Returns the comparator of `z` and the signed value `v`. */
int mp_int_compare_value(mp_int z, mp_small v);
/** Returns the comparator of `z` and the unsigned value `uv`. */
int mp_int_compare_uvalue(mp_int z, mp_usmall uv);
/** Reports whether `a` is divisible by `v`. */
bool mp_int_divisible_value(mp_int a, mp_small v);
/** Returns `k >= 0` such that `z` is `2^k`, if such a `k` exists. If no such
`k` exists, the function returns -1. */
int mp_int_is_pow2(mp_int z);
/** Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`.
It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */
mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c);
/** Sets `c` to the value of `a` raised to the `value` power, modulo `m`.
It returns `MP_RANGE` if `value < 0` or `MP_UNDEF` if `m == 0`. */
mp_result mp_int_exptmod_evalue(mp_int a, mp_small value, mp_int m, mp_int c);
/** Sets `c` to the value of `value` raised to the `b` power, modulo `m`.
It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */
mp_result mp_int_exptmod_bvalue(mp_small value, mp_int b, mp_int m, mp_int c);
/** Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`,
given a precomputed reduction constant `mu` defined for Barrett's modular
reduction algorithm.
It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */
mp_result mp_int_exptmod_known(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c);
/** Sets `c` to the reduction constant for Barrett reduction by modulus `m`.
Requires that `c` and `m` point to distinct locations. */
mp_result mp_int_redux_const(mp_int m, mp_int c);
/** Sets `c` to the multiplicative inverse of `a` modulo `m`, if it exists.
The least non-negative representative of the congruence class is computed.
It returns `MP_UNDEF` if the inverse does not exist, or `MP_RANGE` if `a ==
0` or `m <= 0`. */
mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c);
/** Sets `c` to the greatest common divisor of `a` and `b`.
It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`
and `b` are both zero. */
mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c);
/** Sets `c` to the greatest common divisor of `a` and `b`, and sets `x` and
`y` to values satisfying Bezout's identity `gcd(a, b) = ax + by`.
It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`
and `b` are both zero. */
mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c, mp_int x, mp_int y);
/** Sets `c` to the least common multiple of `a` and `b`.
It returns `MP_UNDEF` if the LCM is undefined, such as for example if `a`
and `b` are both zero. */
mp_result mp_int_lcm(mp_int a, mp_int b, mp_int c);
/** Sets `c` to the greatest integer not less than the `b`th root of `a`,
using Newton's root-finding algorithm.
It returns `MP_UNDEF` if `a < 0` and `b` is even. */
mp_result mp_int_root(mp_int a, mp_small b, mp_int c);
/** Sets `c` to the greatest integer not less than the square root of `a`.
This is a special case of `mp_int_root()`. */
static inline
mp_result mp_int_sqrt(mp_int a, mp_int c) { return mp_int_root(a, 2, c); }
/** Returns `MP_OK` if `z` is representable as `mp_small`, else `MP_RANGE`.
If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */
mp_result mp_int_to_int(mp_int z, mp_small *out);
/** Returns `MP_OK` if `z` is representable as `mp_usmall`, or `MP_RANGE`.
If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */
mp_result mp_int_to_uint(mp_int z, mp_usmall *out);
/** Converts `z` to a zero-terminated string of characters in the specified
`radix`, writing at most `limit` characters to `str` including the
terminating NUL value. A leading `-` is used to indicate a negative value.
Returns `MP_TRUNC` if `limit` was to small to write all of `z`.
Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_int_to_string(mp_int z, mp_size radix, char *str, int limit);
/** Reports the minimum number of characters required to represent `z` as a
zero-terminated string in the given `radix`.
Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_int_string_len(mp_int z, mp_size radix);
/** Reads a string of ASCII digits in the specified `radix` from the zero
terminated `str` provided into `z`. For values of `radix > 10`, the letters
`A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect
to case.
Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a
sign flag. Processing stops when a NUL or any other character out of range
for a digit in the given radix is encountered.
If the whole string was consumed, `MP_OK` is returned; otherwise
`MP_TRUNC`. is returned.
Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_int_read_string(mp_int z, mp_size radix, const char *str);
/** Reads a string of ASCII digits in the specified `radix` from the zero
terminated `str` provided into `z`. For values of `radix > 10`, the letters
`A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect
to case.
Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a
sign flag. Processing stops when a NUL or any other character out of range
for a digit in the given radix is encountered.
If the whole string was consumed, `MP_OK` is returned; otherwise
`MP_TRUNC`. is returned. If `end` is not NULL, `*end` is set to point to
the first unconsumed byte of the input string (the NUL byte if the whole
string was consumed). This emulates the behavior of the standard C
`strtol()` function.
Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **end);
/** Returns the number of significant bits in `z`. */
mp_result mp_int_count_bits(mp_int z);
/** Converts `z` to 2's complement binary, writing at most `limit` bytes into
the given `buf`. Returns `MP_TRUNC` if the buffer limit was too small to
contain the whole value. If this occurs, the contents of buf will be
effectively garbage, as the function uses the buffer as scratch space.
The binary representation of `z` is in base-256 with digits ordered from
most significant to least significant (network byte ordering). The
high-order bit of the first byte is set for negative values, clear for
non-negative values.
As a result, non-negative values will be padded with a leading zero byte if
the high-order byte of the base-256 magnitude is set. This extra byte is
accounted for by the `mp_int_binary_len()` function. */
mp_result mp_int_to_binary(mp_int z, unsigned char *buf, int limit);
/** Reads a 2's complement binary value from `buf` into `z`, where `len` is the
length of the buffer. The contents of `buf` may be overwritten during
processing, although they will be restored when the function returns. */
mp_result mp_int_read_binary(mp_int z, unsigned char *buf, int len);
/** Returns the number of bytes to represent `z` in 2's complement binary. */
mp_result mp_int_binary_len(mp_int z);
/** Converts the magnitude of `z` to unsigned binary, writing at most `limit`
bytes into the given `buf`. The sign of `z` is ignored, but `z` is not
modified. Returns `MP_TRUNC` if the buffer limit was too small to contain
the whole value. If this occurs, the contents of `buf` will be effectively
garbage, as the function uses the buffer as scratch space during
conversion.
The binary representation of `z` is in base-256 with digits ordered from
most significant to least significant (network byte ordering). */
mp_result mp_int_to_unsigned(mp_int z, unsigned char *buf, int limit);
/** Reads an unsigned binary value from `buf` into `z`, where `len` is the
length of the buffer. The contents of `buf` are not modified during
processing. */
mp_result mp_int_read_unsigned(mp_int z, unsigned char *buf, int len);
/** Returns the number of bytes required to represent `z` as an unsigned binary
value in base 256. */
mp_result mp_int_unsigned_len(mp_int z);
/** Returns a pointer to a brief, human-readable, zero-terminated string
describing `res`. The returned string is statically allocated and must not
be freed by the caller. */
const char *mp_error_string(mp_result res);
#ifdef __cplusplus
}
#endif
#endif /* end IMATH_H_ */

940
external/mit/isl/dist/imath/imrat.c vendored Normal file
View File

@ -0,0 +1,940 @@
/*
Name: imrat.c
Purpose: Arbitrary precision rational arithmetic routines.
Author: M. J. Fromberger
Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "imrat.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define MP_NUMER_SIGN(Q) (MP_NUMER_P(Q)->sign)
#define MP_DENOM_SIGN(Q) (MP_DENOM_P(Q)->sign)
#define TEMP(K) (temp + (K))
#define SETUP(E, C) \
do { \
if ((res = (E)) != MP_OK) goto CLEANUP; \
++(C); \
} while (0)
/* Reduce the given rational, in place, to lowest terms and canonical form.
Zero is represented as 0/1, one as 1/1. Signs are adjusted so that the sign
of the numerator is definitive. */
static mp_result s_rat_reduce(mp_rat r);
/* Common code for addition and subtraction operations on rationals. */
static mp_result s_rat_combine(mp_rat a, mp_rat b, mp_rat c,
mp_result (*comb_f)(mp_int, mp_int, mp_int));
mp_result mp_rat_init(mp_rat r) {
mp_result res;
if ((res = mp_int_init(MP_NUMER_P(r))) != MP_OK) return res;
if ((res = mp_int_init(MP_DENOM_P(r))) != MP_OK) {
mp_int_clear(MP_NUMER_P(r));
return res;
}
return mp_int_set_value(MP_DENOM_P(r), 1);
}
mp_rat mp_rat_alloc(void) {
mp_rat out = malloc(sizeof(*out));
if (out != NULL) {
if (mp_rat_init(out) != MP_OK) {
free(out);
return NULL;
}
}
return out;
}
mp_result mp_rat_reduce(mp_rat r) { return s_rat_reduce(r); }
mp_result mp_rat_init_size(mp_rat r, mp_size n_prec, mp_size d_prec) {
mp_result res;
if ((res = mp_int_init_size(MP_NUMER_P(r), n_prec)) != MP_OK) {
return res;
}
if ((res = mp_int_init_size(MP_DENOM_P(r), d_prec)) != MP_OK) {
mp_int_clear(MP_NUMER_P(r));
return res;
}
return mp_int_set_value(MP_DENOM_P(r), 1);
}
mp_result mp_rat_init_copy(mp_rat r, mp_rat old) {
mp_result res;
if ((res = mp_int_init_copy(MP_NUMER_P(r), MP_NUMER_P(old))) != MP_OK) {
return res;
}
if ((res = mp_int_init_copy(MP_DENOM_P(r), MP_DENOM_P(old))) != MP_OK)
mp_int_clear(MP_NUMER_P(r));
return res;
}
mp_result mp_rat_set_value(mp_rat r, mp_small numer, mp_small denom) {
mp_result res;
if (denom == 0) return MP_UNDEF;
if ((res = mp_int_set_value(MP_NUMER_P(r), numer)) != MP_OK) {
return res;
}
if ((res = mp_int_set_value(MP_DENOM_P(r), denom)) != MP_OK) {
return res;
}
return s_rat_reduce(r);
}
mp_result mp_rat_set_uvalue(mp_rat r, mp_usmall numer, mp_usmall denom) {
mp_result res;
if (denom == 0) return MP_UNDEF;
if ((res = mp_int_set_uvalue(MP_NUMER_P(r), numer)) != MP_OK) {
return res;
}
if ((res = mp_int_set_uvalue(MP_DENOM_P(r), denom)) != MP_OK) {
return res;
}
return s_rat_reduce(r);
}
void mp_rat_clear(mp_rat r) {
mp_int_clear(MP_NUMER_P(r));
mp_int_clear(MP_DENOM_P(r));
}
void mp_rat_free(mp_rat r) {
assert(r != NULL);
if (r->num.digits != NULL) mp_rat_clear(r);
free(r);
}
mp_result mp_rat_numer(mp_rat r, mp_int z) {
return mp_int_copy(MP_NUMER_P(r), z);
}
mp_int mp_rat_numer_ref(mp_rat r) { return MP_NUMER_P(r); }
mp_result mp_rat_denom(mp_rat r, mp_int z) {
return mp_int_copy(MP_DENOM_P(r), z);
}
mp_int mp_rat_denom_ref(mp_rat r) { return MP_DENOM_P(r); }
mp_sign mp_rat_sign(mp_rat r) { return MP_NUMER_SIGN(r); }
mp_result mp_rat_copy(mp_rat a, mp_rat c) {
mp_result res;
if ((res = mp_int_copy(MP_NUMER_P(a), MP_NUMER_P(c))) != MP_OK) {
return res;
}
res = mp_int_copy(MP_DENOM_P(a), MP_DENOM_P(c));
return res;
}
void mp_rat_zero(mp_rat r) {
mp_int_zero(MP_NUMER_P(r));
mp_int_set_value(MP_DENOM_P(r), 1);
}
mp_result mp_rat_abs(mp_rat a, mp_rat c) {
mp_result res;
if ((res = mp_int_abs(MP_NUMER_P(a), MP_NUMER_P(c))) != MP_OK) {
return res;
}
res = mp_int_abs(MP_DENOM_P(a), MP_DENOM_P(c));
return res;
}
mp_result mp_rat_neg(mp_rat a, mp_rat c) {
mp_result res;
if ((res = mp_int_neg(MP_NUMER_P(a), MP_NUMER_P(c))) != MP_OK) {
return res;
}
res = mp_int_copy(MP_DENOM_P(a), MP_DENOM_P(c));
return res;
}
mp_result mp_rat_recip(mp_rat a, mp_rat c) {
mp_result res;
if (mp_rat_compare_zero(a) == 0) return MP_UNDEF;
if ((res = mp_rat_copy(a, c)) != MP_OK) return res;
mp_int_swap(MP_NUMER_P(c), MP_DENOM_P(c));
/* Restore the signs of the swapped elements */
{
mp_sign tmp = MP_NUMER_SIGN(c);
MP_NUMER_SIGN(c) = MP_DENOM_SIGN(c);
MP_DENOM_SIGN(c) = tmp;
}
return MP_OK;
}
mp_result mp_rat_add(mp_rat a, mp_rat b, mp_rat c) {
return s_rat_combine(a, b, c, mp_int_add);
}
mp_result mp_rat_sub(mp_rat a, mp_rat b, mp_rat c) {
return s_rat_combine(a, b, c, mp_int_sub);
}
mp_result mp_rat_mul(mp_rat a, mp_rat b, mp_rat c) {
mp_result res;
if ((res = mp_int_mul(MP_NUMER_P(a), MP_NUMER_P(b), MP_NUMER_P(c))) != MP_OK)
return res;
if (mp_int_compare_zero(MP_NUMER_P(c)) != 0) {
res = mp_int_mul(MP_DENOM_P(a), MP_DENOM_P(b), MP_DENOM_P(c));
if (res != MP_OK) {
return res;
}
}
return s_rat_reduce(c);
}
mp_result mp_rat_div(mp_rat a, mp_rat b, mp_rat c) {
mp_result res = MP_OK;
if (mp_rat_compare_zero(b) == 0) return MP_UNDEF;
if (c == a || c == b) {
mpz_t tmp;
if ((res = mp_int_init(&tmp)) != MP_OK) return res;
if ((res = mp_int_mul(MP_NUMER_P(a), MP_DENOM_P(b), &tmp)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_mul(MP_DENOM_P(a), MP_NUMER_P(b), MP_DENOM_P(c))) !=
MP_OK) {
goto CLEANUP;
}
res = mp_int_copy(&tmp, MP_NUMER_P(c));
CLEANUP:
mp_int_clear(&tmp);
} else {
if ((res = mp_int_mul(MP_NUMER_P(a), MP_DENOM_P(b), MP_NUMER_P(c))) !=
MP_OK) {
return res;
}
if ((res = mp_int_mul(MP_DENOM_P(a), MP_NUMER_P(b), MP_DENOM_P(c))) !=
MP_OK) {
return res;
}
}
if (res != MP_OK) {
return res;
} else {
return s_rat_reduce(c);
}
}
mp_result mp_rat_add_int(mp_rat a, mp_int b, mp_rat c) {
mpz_t tmp;
mp_result res;
if ((res = mp_int_init_copy(&tmp, b)) != MP_OK) {
return res;
}
if ((res = mp_int_mul(&tmp, MP_DENOM_P(a), &tmp)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_rat_copy(a, c)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_add(MP_NUMER_P(c), &tmp, MP_NUMER_P(c))) != MP_OK) {
goto CLEANUP;
}
res = s_rat_reduce(c);
CLEANUP:
mp_int_clear(&tmp);
return res;
}
mp_result mp_rat_sub_int(mp_rat a, mp_int b, mp_rat c) {
mpz_t tmp;
mp_result res;
if ((res = mp_int_init_copy(&tmp, b)) != MP_OK) {
return res;
}
if ((res = mp_int_mul(&tmp, MP_DENOM_P(a), &tmp)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_rat_copy(a, c)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_sub(MP_NUMER_P(c), &tmp, MP_NUMER_P(c))) != MP_OK) {
goto CLEANUP;
}
res = s_rat_reduce(c);
CLEANUP:
mp_int_clear(&tmp);
return res;
}
mp_result mp_rat_mul_int(mp_rat a, mp_int b, mp_rat c) {
mp_result res;
if ((res = mp_rat_copy(a, c)) != MP_OK) {
return res;
}
if ((res = mp_int_mul(MP_NUMER_P(c), b, MP_NUMER_P(c))) != MP_OK) {
return res;
}
return s_rat_reduce(c);
}
mp_result mp_rat_div_int(mp_rat a, mp_int b, mp_rat c) {
mp_result res;
if (mp_int_compare_zero(b) == 0) {
return MP_UNDEF;
}
if ((res = mp_rat_copy(a, c)) != MP_OK) {
return res;
}
if ((res = mp_int_mul(MP_DENOM_P(c), b, MP_DENOM_P(c))) != MP_OK) {
return res;
}
return s_rat_reduce(c);
}
mp_result mp_rat_expt(mp_rat a, mp_small b, mp_rat c) {
mp_result res;
/* Special cases for easy powers. */
if (b == 0) {
return mp_rat_set_value(c, 1, 1);
} else if (b == 1) {
return mp_rat_copy(a, c);
}
/* Since rationals are always stored in lowest terms, it is not necessary to
reduce again when raising to an integer power. */
if ((res = mp_int_expt(MP_NUMER_P(a), b, MP_NUMER_P(c))) != MP_OK) {
return res;
}
return mp_int_expt(MP_DENOM_P(a), b, MP_DENOM_P(c));
}
int mp_rat_compare(mp_rat a, mp_rat b) {
/* Quick check for opposite signs. Works because the sign of the numerator
is always definitive. */
if (MP_NUMER_SIGN(a) != MP_NUMER_SIGN(b)) {
if (MP_NUMER_SIGN(a) == MP_ZPOS) {
return 1;
} else {
return -1;
}
} else {
/* Compare absolute magnitudes; if both are positive, the answer stands,
otherwise it needs to be reflected about zero. */
int cmp = mp_rat_compare_unsigned(a, b);
if (MP_NUMER_SIGN(a) == MP_ZPOS) {
return cmp;
} else {
return -cmp;
}
}
}
int mp_rat_compare_unsigned(mp_rat a, mp_rat b) {
/* If the denominators are equal, we can quickly compare numerators without
multiplying. Otherwise, we actually have to do some work. */
if (mp_int_compare_unsigned(MP_DENOM_P(a), MP_DENOM_P(b)) == 0) {
return mp_int_compare_unsigned(MP_NUMER_P(a), MP_NUMER_P(b));
}
else {
mpz_t temp[2];
mp_result res;
int cmp = INT_MAX, last = 0;
/* t0 = num(a) * den(b), t1 = num(b) * den(a) */
SETUP(mp_int_init_copy(TEMP(last), MP_NUMER_P(a)), last);
SETUP(mp_int_init_copy(TEMP(last), MP_NUMER_P(b)), last);
if ((res = mp_int_mul(TEMP(0), MP_DENOM_P(b), TEMP(0))) != MP_OK ||
(res = mp_int_mul(TEMP(1), MP_DENOM_P(a), TEMP(1))) != MP_OK) {
goto CLEANUP;
}
cmp = mp_int_compare_unsigned(TEMP(0), TEMP(1));
CLEANUP:
while (--last >= 0) {
mp_int_clear(TEMP(last));
}
return cmp;
}
}
int mp_rat_compare_zero(mp_rat r) { return mp_int_compare_zero(MP_NUMER_P(r)); }
int mp_rat_compare_value(mp_rat r, mp_small n, mp_small d) {
mpq_t tmp;
mp_result res;
int out = INT_MAX;
if ((res = mp_rat_init(&tmp)) != MP_OK) {
return out;
}
if ((res = mp_rat_set_value(&tmp, n, d)) != MP_OK) {
goto CLEANUP;
}
out = mp_rat_compare(r, &tmp);
CLEANUP:
mp_rat_clear(&tmp);
return out;
}
bool mp_rat_is_integer(mp_rat r) {
return (mp_int_compare_value(MP_DENOM_P(r), 1) == 0);
}
mp_result mp_rat_to_ints(mp_rat r, mp_small *num, mp_small *den) {
mp_result res;
if ((res = mp_int_to_int(MP_NUMER_P(r), num)) != MP_OK) {
return res;
}
res = mp_int_to_int(MP_DENOM_P(r), den);
return res;
}
mp_result mp_rat_to_string(mp_rat r, mp_size radix, char *str, int limit) {
/* Write the numerator. The sign of the rational number is written by the
underlying integer implementation. */
mp_result res;
if ((res = mp_int_to_string(MP_NUMER_P(r), radix, str, limit)) != MP_OK) {
return res;
}
/* If the value is zero, don't bother writing any denominator */
if (mp_int_compare_zero(MP_NUMER_P(r)) == 0) {
return MP_OK;
}
/* Locate the end of the numerator, and make sure we are not going to exceed
the limit by writing a slash. */
int len = strlen(str);
char *start = str + len;
limit -= len;
if (limit == 0) return MP_TRUNC;
*start++ = '/';
limit -= 1;
return mp_int_to_string(MP_DENOM_P(r), radix, start, limit);
}
mp_result mp_rat_to_decimal(mp_rat r, mp_size radix, mp_size prec,
mp_round_mode round, char *str, int limit) {
mpz_t temp[3];
mp_result res;
int last = 0;
SETUP(mp_int_init_copy(TEMP(last), MP_NUMER_P(r)), last);
SETUP(mp_int_init(TEMP(last)), last);
SETUP(mp_int_init(TEMP(last)), last);
/* Get the unsigned integer part by dividing denominator into the absolute
value of the numerator. */
mp_int_abs(TEMP(0), TEMP(0));
if ((res = mp_int_div(TEMP(0), MP_DENOM_P(r), TEMP(0), TEMP(1))) != MP_OK) {
goto CLEANUP;
}
/* Now: T0 = integer portion, unsigned;
T1 = remainder, from which fractional part is computed. */
/* Count up leading zeroes after the radix point. */
int zprec = (int)prec;
int lead_0;
for (lead_0 = 0; lead_0 < zprec && mp_int_compare(TEMP(1), MP_DENOM_P(r)) < 0;
++lead_0) {
if ((res = mp_int_mul_value(TEMP(1), radix, TEMP(1))) != MP_OK) {
goto CLEANUP;
}
}
/* Multiply remainder by a power of the radix sufficient to get the right
number of significant figures. */
if (zprec > lead_0) {
if ((res = mp_int_expt_value(radix, zprec - lead_0, TEMP(2))) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_mul(TEMP(1), TEMP(2), TEMP(1))) != MP_OK) {
goto CLEANUP;
}
}
if ((res = mp_int_div(TEMP(1), MP_DENOM_P(r), TEMP(1), TEMP(2))) != MP_OK) {
goto CLEANUP;
}
/* Now: T1 = significant digits of fractional part;
T2 = leftovers, to use for rounding.
At this point, what we do depends on the rounding mode. The default is
MP_ROUND_DOWN, for which everything is as it should be already.
*/
switch (round) {
int cmp;
case MP_ROUND_UP:
if (mp_int_compare_zero(TEMP(2)) != 0) {
if (prec == 0) {
res = mp_int_add_value(TEMP(0), 1, TEMP(0));
} else {
res = mp_int_add_value(TEMP(1), 1, TEMP(1));
}
}
break;
case MP_ROUND_HALF_UP:
case MP_ROUND_HALF_DOWN:
if ((res = mp_int_mul_pow2(TEMP(2), 1, TEMP(2))) != MP_OK) {
goto CLEANUP;
}
cmp = mp_int_compare(TEMP(2), MP_DENOM_P(r));
if (round == MP_ROUND_HALF_UP) cmp += 1;
if (cmp > 0) {
if (prec == 0) {
res = mp_int_add_value(TEMP(0), 1, TEMP(0));
} else {
res = mp_int_add_value(TEMP(1), 1, TEMP(1));
}
}
break;
case MP_ROUND_DOWN:
break; /* No action required */
default:
return MP_BADARG; /* Invalid rounding specifier */
}
if (res != MP_OK) {
goto CLEANUP;
}
/* The sign of the output should be the sign of the numerator, but if all the
displayed digits will be zero due to the precision, a negative shouldn't
be shown. */
char *start = str;
int left = limit;
if (MP_NUMER_SIGN(r) == MP_NEG && (mp_int_compare_zero(TEMP(0)) != 0 ||
mp_int_compare_zero(TEMP(1)) != 0)) {
*start++ = '-';
left -= 1;
}
if ((res = mp_int_to_string(TEMP(0), radix, start, left)) != MP_OK) {
goto CLEANUP;
}
int len = strlen(start);
start += len;
left -= len;
if (prec == 0) goto CLEANUP;
*start++ = '.';
left -= 1;
if (left < zprec + 1) {
res = MP_TRUNC;
goto CLEANUP;
}
memset(start, '0', lead_0 - 1);
left -= lead_0;
start += lead_0 - 1;
res = mp_int_to_string(TEMP(1), radix, start, left);
CLEANUP:
while (--last >= 0) mp_int_clear(TEMP(last));
return res;
}
mp_result mp_rat_string_len(mp_rat r, mp_size radix) {
mp_result d_len = 0;
mp_result n_len = mp_int_string_len(MP_NUMER_P(r), radix);
if (mp_int_compare_zero(MP_NUMER_P(r)) != 0) {
d_len = mp_int_string_len(MP_DENOM_P(r), radix);
}
/* Though simplistic, this formula is correct. Space for the sign flag is
included in n_len, and the space for the NUL that is counted in n_len
counts for the separator here. The space for the NUL counted in d_len
counts for the final terminator here. */
return n_len + d_len;
}
mp_result mp_rat_decimal_len(mp_rat r, mp_size radix, mp_size prec) {
int f_len;
int z_len = mp_int_string_len(MP_NUMER_P(r), radix);
if (prec == 0) {
f_len = 1; /* terminator only */
} else {
f_len = 1 + prec + 1; /* decimal point, digits, terminator */
}
return z_len + f_len;
}
mp_result mp_rat_read_string(mp_rat r, mp_size radix, const char *str) {
return mp_rat_read_cstring(r, radix, str, NULL);
}
mp_result mp_rat_read_cstring(mp_rat r, mp_size radix, const char *str,
char **end) {
mp_result res;
char *endp;
if ((res = mp_int_read_cstring(MP_NUMER_P(r), radix, str, &endp)) != MP_OK &&
(res != MP_TRUNC)) {
return res;
}
/* Skip whitespace between numerator and (possible) separator */
while (isspace((unsigned char)*endp)) {
++endp;
}
/* If there is no separator, we will stop reading at this point. */
if (*endp != '/') {
mp_int_set_value(MP_DENOM_P(r), 1);
if (end != NULL) *end = endp;
return res;
}
++endp; /* skip separator */
if ((res = mp_int_read_cstring(MP_DENOM_P(r), radix, endp, end)) != MP_OK) {
return res;
}
/* Make sure the value is well-defined */
if (mp_int_compare_zero(MP_DENOM_P(r)) == 0) {
return MP_UNDEF;
}
/* Reduce to lowest terms */
return s_rat_reduce(r);
}
/* Read a string and figure out what format it's in. The radix may be supplied
as zero to use "default" behaviour.
This function will accept either a/b notation or decimal notation.
*/
mp_result mp_rat_read_ustring(mp_rat r, mp_size radix, const char *str,
char **end) {
char *endp = "";
mp_result res;
if (radix == 0) radix = 10; /* default to decimal input */
res = mp_rat_read_cstring(r, radix, str, &endp);
if (res == MP_TRUNC && *endp == '.') {
res = mp_rat_read_cdecimal(r, radix, str, &endp);
}
if (end != NULL) *end = endp;
return res;
}
mp_result mp_rat_read_decimal(mp_rat r, mp_size radix, const char *str) {
return mp_rat_read_cdecimal(r, radix, str, NULL);
}
mp_result mp_rat_read_cdecimal(mp_rat r, mp_size radix, const char *str,
char **end) {
mp_result res;
mp_sign osign;
char *endp;
while (isspace((unsigned char)*str)) ++str;
switch (*str) {
case '-':
osign = MP_NEG;
break;
default:
osign = MP_ZPOS;
}
if ((res = mp_int_read_cstring(MP_NUMER_P(r), radix, str, &endp)) != MP_OK &&
(res != MP_TRUNC)) {
return res;
}
/* This needs to be here. */
(void)mp_int_set_value(MP_DENOM_P(r), 1);
if (*endp != '.') {
if (end != NULL) *end = endp;
return res;
}
/* If the character following the decimal point is whitespace or a sign flag,
we will consider this a truncated value. This special case is because
mp_int_read_string() will consider whitespace or sign flags to be valid
starting characters for a value, and we do not want them following the
decimal point.
Once we have done this check, it is safe to read in the value of the
fractional piece as a regular old integer.
*/
++endp;
if (*endp == '\0') {
if (end != NULL) *end = endp;
return MP_OK;
} else if (isspace((unsigned char)*endp) || *endp == '-' || *endp == '+') {
return MP_TRUNC;
} else {
mpz_t frac;
mp_result save_res;
char *save = endp;
int num_lz = 0;
/* Make a temporary to hold the part after the decimal point. */
if ((res = mp_int_init(&frac)) != MP_OK) {
return res;
}
if ((res = mp_int_read_cstring(&frac, radix, endp, &endp)) != MP_OK &&
(res != MP_TRUNC)) {
goto CLEANUP;
}
/* Save this response for later. */
save_res = res;
if (mp_int_compare_zero(&frac) == 0) goto FINISHED;
/* Discard trailing zeroes (somewhat inefficiently) */
while (mp_int_divisible_value(&frac, radix)) {
if ((res = mp_int_div_value(&frac, radix, &frac, NULL)) != MP_OK) {
goto CLEANUP;
}
}
/* Count leading zeros after the decimal point */
while (save[num_lz] == '0') {
++num_lz;
}
/* Find the least power of the radix that is at least as large as the
significant value of the fractional part, ignoring leading zeroes. */
(void)mp_int_set_value(MP_DENOM_P(r), radix);
while (mp_int_compare(MP_DENOM_P(r), &frac) < 0) {
if ((res = mp_int_mul_value(MP_DENOM_P(r), radix, MP_DENOM_P(r))) !=
MP_OK) {
goto CLEANUP;
}
}
/* Also shift by enough to account for leading zeroes */
while (num_lz > 0) {
if ((res = mp_int_mul_value(MP_DENOM_P(r), radix, MP_DENOM_P(r))) !=
MP_OK) {
goto CLEANUP;
}
--num_lz;
}
/* Having found this power, shift the numerator leftward that many, digits,
and add the nonzero significant digits of the fractional part to get the
result. */
if ((res = mp_int_mul(MP_NUMER_P(r), MP_DENOM_P(r), MP_NUMER_P(r))) !=
MP_OK) {
goto CLEANUP;
}
{ /* This addition needs to be unsigned. */
MP_NUMER_SIGN(r) = MP_ZPOS;
if ((res = mp_int_add(MP_NUMER_P(r), &frac, MP_NUMER_P(r))) != MP_OK) {
goto CLEANUP;
}
MP_NUMER_SIGN(r) = osign;
}
if ((res = s_rat_reduce(r)) != MP_OK) goto CLEANUP;
/* At this point, what we return depends on whether reading the fractional
part was truncated or not. That information is saved from when we
called mp_int_read_string() above. */
FINISHED:
res = save_res;
if (end != NULL) *end = endp;
CLEANUP:
mp_int_clear(&frac);
return res;
}
}
/* Private functions for internal use. Make unchecked assumptions about format
and validity of inputs. */
static mp_result s_rat_reduce(mp_rat r) {
mpz_t gcd;
mp_result res = MP_OK;
if (mp_int_compare_zero(MP_NUMER_P(r)) == 0) {
mp_int_set_value(MP_DENOM_P(r), 1);
return MP_OK;
}
/* If the greatest common divisor of the numerator and denominator is greater
than 1, divide it out. */
if ((res = mp_int_init(&gcd)) != MP_OK) return res;
if ((res = mp_int_gcd(MP_NUMER_P(r), MP_DENOM_P(r), &gcd)) != MP_OK) {
goto CLEANUP;
}
if (mp_int_compare_value(&gcd, 1) != 0) {
if ((res = mp_int_div(MP_NUMER_P(r), &gcd, MP_NUMER_P(r), NULL)) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_div(MP_DENOM_P(r), &gcd, MP_DENOM_P(r), NULL)) != MP_OK) {
goto CLEANUP;
}
}
/* Fix up the signs of numerator and denominator */
if (MP_NUMER_SIGN(r) == MP_DENOM_SIGN(r)) {
MP_NUMER_SIGN(r) = MP_DENOM_SIGN(r) = MP_ZPOS;
} else {
MP_NUMER_SIGN(r) = MP_NEG;
MP_DENOM_SIGN(r) = MP_ZPOS;
}
CLEANUP:
mp_int_clear(&gcd);
return res;
}
static mp_result s_rat_combine(mp_rat a, mp_rat b, mp_rat c,
mp_result (*comb_f)(mp_int, mp_int, mp_int)) {
mp_result res;
/* Shortcut when denominators are already common */
if (mp_int_compare(MP_DENOM_P(a), MP_DENOM_P(b)) == 0) {
if ((res = (comb_f)(MP_NUMER_P(a), MP_NUMER_P(b), MP_NUMER_P(c))) !=
MP_OK) {
return res;
}
if ((res = mp_int_copy(MP_DENOM_P(a), MP_DENOM_P(c))) != MP_OK) {
return res;
}
return s_rat_reduce(c);
} else {
mpz_t temp[2];
int last = 0;
SETUP(mp_int_init_copy(TEMP(last), MP_NUMER_P(a)), last);
SETUP(mp_int_init_copy(TEMP(last), MP_NUMER_P(b)), last);
if ((res = mp_int_mul(TEMP(0), MP_DENOM_P(b), TEMP(0))) != MP_OK) {
goto CLEANUP;
}
if ((res = mp_int_mul(TEMP(1), MP_DENOM_P(a), TEMP(1))) != MP_OK) {
goto CLEANUP;
}
if ((res = (comb_f)(TEMP(0), TEMP(1), MP_NUMER_P(c))) != MP_OK) {
goto CLEANUP;
}
res = mp_int_mul(MP_DENOM_P(a), MP_DENOM_P(b), MP_DENOM_P(c));
CLEANUP:
while (--last >= 0) {
mp_int_clear(TEMP(last));
}
if (res == MP_OK) {
return s_rat_reduce(c);
} else {
return res;
}
}
}
/* Here there be dragons */

270
external/mit/isl/dist/imath/imrat.h vendored Normal file
View File

@ -0,0 +1,270 @@
/*
Name: imrat.h
Purpose: Arbitrary precision rational arithmetic routines.
Author: M. J. Fromberger
Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef IMRAT_H_
#define IMRAT_H_
#include <stdbool.h>
#include "imath.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
mpz_t num; /* Numerator */
mpz_t den; /* Denominator, <> 0 */
} mpq_t, *mp_rat;
/* Return a pointer to the numerator. */
static inline mp_int MP_NUMER_P(mp_rat Q) { return &(Q->num); }
/* Return a pointer to the denominator. */
static inline mp_int MP_DENOM_P(mp_rat Q) { return &(Q->den); }
/* Rounding constants */
typedef enum {
MP_ROUND_DOWN,
MP_ROUND_HALF_UP,
MP_ROUND_UP,
MP_ROUND_HALF_DOWN
} mp_round_mode;
/** Initializes `r` with 1-digit precision and sets it to zero. This function
cannot fail unless `r` is NULL. */
mp_result mp_rat_init(mp_rat r);
/** Allocates a fresh zero-valued `mpq_t` on the heap, returning NULL in case
of error. The only possible error is out-of-memory. */
mp_rat mp_rat_alloc(void);
/** Reduces `r` in-place to lowest terms and canonical form.
Zero is represented as 0/1, one as 1/1, and signs are adjusted so that the
sign of the value is carried by the numerator. */
mp_result mp_rat_reduce(mp_rat r);
/** Initializes `r` with at least `n_prec` digits of storage for the numerator
and `d_prec` digits of storage for the denominator, and value zero.
If either precision is zero, the default precision is used, rounded up to
the nearest word size. */
mp_result mp_rat_init_size(mp_rat r, mp_size n_prec, mp_size d_prec);
/** Initializes `r` to be a copy of an already-initialized value in `old`. The
new copy does not share storage with the original. */
mp_result mp_rat_init_copy(mp_rat r, mp_rat old);
/** Sets the value of `r` to the ratio of signed `numer` to signed `denom`. It
returns `MP_UNDEF` if `denom` is zero. */
mp_result mp_rat_set_value(mp_rat r, mp_small numer, mp_small denom);
/** Sets the value of `r` to the ratio of unsigned `numer` to unsigned
`denom`. It returns `MP_UNDEF` if `denom` is zero. */
mp_result mp_rat_set_uvalue(mp_rat r, mp_usmall numer, mp_usmall denom);
/** Releases the storage used by `r`. */
void mp_rat_clear(mp_rat r);
/** Releases the storage used by `r` and also `r` itself.
This should only be used for `r` allocated by `mp_rat_alloc()`. */
void mp_rat_free(mp_rat r);
/** Sets `z` to a copy of the numerator of `r`. */
mp_result mp_rat_numer(mp_rat r, mp_int z);
/** Returns a pointer to the numerator of `r`. */
mp_int mp_rat_numer_ref(mp_rat r);
/** Sets `z` to a copy of the denominator of `r`. */
mp_result mp_rat_denom(mp_rat r, mp_int z);
/** Returns a pointer to the denominator of `r`. */
mp_int mp_rat_denom_ref(mp_rat r);
/** Reports the sign of `r`. */
mp_sign mp_rat_sign(mp_rat r);
/** Sets `c` to a copy of the value of `a`. No new memory is allocated unless a
term of `a` has more significant digits than the corresponding term of `c`
has allocated. */
mp_result mp_rat_copy(mp_rat a, mp_rat c);
/** Sets `r` to zero. The allocated storage of `r` is not changed. */
void mp_rat_zero(mp_rat r);
/** Sets `c` to the absolute value of `a`. */
mp_result mp_rat_abs(mp_rat a, mp_rat c);
/** Sets `c` to the absolute value of `a`. */
mp_result mp_rat_neg(mp_rat a, mp_rat c);
/** Sets `c` to the reciprocal of `a` if the reciprocal is defined.
It returns `MP_UNDEF` if `a` is zero. */
mp_result mp_rat_recip(mp_rat a, mp_rat c);
/** Sets `c` to the sum of `a` and `b`. */
mp_result mp_rat_add(mp_rat a, mp_rat b, mp_rat c);
/** Sets `c` to the difference of `a` less `b`. */
mp_result mp_rat_sub(mp_rat a, mp_rat b, mp_rat c);
/** Sets `c` to the product of `a` and `b`. */
mp_result mp_rat_mul(mp_rat a, mp_rat b, mp_rat c);
/** Sets `c` to the ratio `a / b` if that ratio is defined.
It returns `MP_UNDEF` if `b` is zero. */
mp_result mp_rat_div(mp_rat a, mp_rat b, mp_rat c);
/** Sets `c` to the sum of `a` and integer `b`. */
mp_result mp_rat_add_int(mp_rat a, mp_int b, mp_rat c);
/** Sets `c` to the difference of `a` less integer `b`. */
mp_result mp_rat_sub_int(mp_rat a, mp_int b, mp_rat c);
/** Sets `c` to the product of `a` and integer `b`. */
mp_result mp_rat_mul_int(mp_rat a, mp_int b, mp_rat c);
/** Sets `c` to the ratio `a / b` if that ratio is defined.
It returns `MP_UNDEF` if `b` is zero. */
mp_result mp_rat_div_int(mp_rat a, mp_int b, mp_rat c);
/** Sets `c` to the value of `a` raised to the `b` power.
It returns `MP_RANGE` if `b < 0`. */
mp_result mp_rat_expt(mp_rat a, mp_small b, mp_rat c);
/** Returns the comparator of `a` and `b`. */
int mp_rat_compare(mp_rat a, mp_rat b);
/** Returns the comparator of the magnitudes of `a` and `b`, disregarding their
signs. Neither `a` nor `b` is modified by the comparison. */
int mp_rat_compare_unsigned(mp_rat a, mp_rat b);
/** Returns the comparator of `r` and zero. */
int mp_rat_compare_zero(mp_rat r);
/** Returns the comparator of `r` and the signed ratio `n / d`.
It returns `MP_UNDEF` if `d` is zero. */
int mp_rat_compare_value(mp_rat r, mp_small n, mp_small d);
/** Reports whether `r` is an integer, having canonical denominator 1. */
bool mp_rat_is_integer(mp_rat r);
/** Reports whether the numerator and denominator of `r` can be represented as
small signed integers, and if so stores the corresponding values to `num`
and `den`. It returns `MP_RANGE` if either cannot be so represented. */
mp_result mp_rat_to_ints(mp_rat r, mp_small *num, mp_small *den);
/** Converts `r` to a zero-terminated string of the format `"n/d"` with `n` and
`d` in the specified radix and writing no more than `limit` bytes to the
given output buffer `str`. The output of the numerator includes a sign flag
if `r` is negative. Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_rat_to_string(mp_rat r, mp_size radix, char *str, int limit);
/** Converts the value of `r` to a string in decimal-point notation with the
specified radix, writing no more than `limit` bytes of data to the given
output buffer. It generates `prec` digits of precision, and requires
`MP_MIN_RADIX <= radix <= MP_MAX_RADIX`.
Ratios usually must be rounded when they are being converted for output as
a decimal value. There are four rounding modes currently supported:
MP_ROUND_DOWN
Truncates the value toward zero.
Example: 12.009 to 2dp becomes 12.00
MP_ROUND_UP
Rounds the value away from zero:
Example: 12.001 to 2dp becomes 12.01, but
12.000 to 2dp remains 12.00
MP_ROUND_HALF_DOWN
Rounds the value to nearest digit, half goes toward zero.
Example: 12.005 to 2dp becomes 12.00, but
12.006 to 2dp becomes 12.01
MP_ROUND_HALF_UP
Rounds the value to nearest digit, half rounds upward.
Example: 12.005 to 2dp becomes 12.01, but
12.004 to 2dp becomes 12.00
*/
mp_result mp_rat_to_decimal(mp_rat r, mp_size radix, mp_size prec,
mp_round_mode round, char *str, int limit);
/** Reports the minimum number of characters required to represent `r` as a
zero-terminated string in the given `radix`.
Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */
mp_result mp_rat_string_len(mp_rat r, mp_size radix);
/** Reports the length in bytes of the buffer needed to convert `r` using the
`mp_rat_to_decimal()` function with the specified `radix` and `prec`. The
buffer size estimate may slightly exceed the actual required capacity. */
mp_result mp_rat_decimal_len(mp_rat r, mp_size radix, mp_size prec);
/** Sets `r` to the value represented by a zero-terminated string `str` in the
format `"n/d"` including a sign flag. It returns `MP_UNDEF` if the encoded
denominator has value zero. */
mp_result mp_rat_read_string(mp_rat r, mp_size radix, const char *str);
/** Sets `r` to the value represented by a zero-terminated string `str` in the
format `"n/d"` including a sign flag. It returns `MP_UNDEF` if the encoded
denominator has value zero. If `end` is not NULL then `*end` is set to
point to the first unconsumed character in the string, after parsing.
*/
mp_result mp_rat_read_cstring(mp_rat r, mp_size radix, const char *str,
char **end);
/** Sets `r` to the value represented by a zero-terminated string `str` having
one of the following formats, each with an optional leading sign flag:
n : integer format, e.g. "123"
n/d : ratio format, e.g., "-12/5"
z.ffff : decimal format, e.g., "1.627"
It returns `MP_UNDEF` if the effective denominator is zero. If `end` is not
NULL then `*end` is set to point to the first unconsumed character in the
string, after parsing.
*/
mp_result mp_rat_read_ustring(mp_rat r, mp_size radix, const char *str,
char **end);
/** Sets `r` to the value represented by a zero-terminated string `str` in the
format `"z.ffff"` including a sign flag. It returns `MP_UNDEF` if the
effective denominator. */
mp_result mp_rat_read_decimal(mp_rat r, mp_size radix, const char *str);
/** Sets `r` to the value represented by a zero-terminated string `str` in the
format `"z.ffff"` including a sign flag. It returns `MP_UNDEF` if the
effective denominator. If `end` is not NULL then `*end` is set to point to
the first unconsumed character in the string, after parsing. */
mp_result mp_rat_read_cdecimal(mp_rat r, mp_size radix, const char *str,
char **end);
#ifdef __cplusplus
}
#endif
#endif /* IMRAT_H_ */

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/gmp_compat.c"

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/gmp_compat.h"

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/imath.c"

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/imath.h"

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/imrat.c"

View File

@ -0,0 +1,2 @@
#include "wrap.h"
#include "../imath/imrat.h"

171
external/mit/isl/dist/imath_wrap/wrap.h vendored Normal file
View File

@ -0,0 +1,171 @@
#ifndef ISL_IMATH_WRAP
#define ISL_IMATH_WRAP
#define MP_BADARG ISL_MP_BADARG
#define MP_FALSE ISL_MP_FALSE
#define MP_MEMORY ISL_MP_MEMORY
#define MP_MINERR ISL_MP_MINERR
#define MP_NEG ISL_MP_NEG
#define MP_OK ISL_MP_OK
#define MP_RANGE ISL_MP_RANGE
#define MP_TRUE ISL_MP_TRUE
#define MP_TRUNC ISL_MP_TRUNC
#define MP_UNDEF ISL_MP_UNDEF
#define MP_ZPOS ISL_MP_ZPOS
#define impq_canonicalize isl_impq_canonicalize
#define impq_clear isl_impq_clear
#define impq_cmp isl_impq_cmp
#define impq_denref isl_impq_denref
#define impq_get_str isl_impq_get_str
#define impq_init isl_impq_init
#define impq_mul isl_impq_mul
#define impq_numref isl_impq_numref
#define impq_set isl_impq_set
#define impq_set_str isl_impq_set_str
#define impq_set_ui isl_impq_set_ui
#define impq_sgn isl_impq_sgn
#define impz_abs isl_impz_abs
#define impz_add isl_impz_add
#define impz_addmul isl_impz_addmul
#define impz_add_ui isl_impz_add_ui
#define impz_cdiv_q isl_impz_cdiv_q
#define impz_clear isl_impz_clear
#define impz_cmp isl_impz_cmp
#define impz_cmpabs isl_impz_cmpabs
#define impz_cmp_si isl_impz_cmp_si
#define impz_divexact isl_impz_divexact
#define impz_divexact_ui isl_impz_divexact_ui
#define impz_divisible_p isl_impz_divisible_p
#define impz_export isl_impz_export
#define impz_fdiv_q isl_impz_fdiv_q
#define impz_fdiv_r isl_impz_fdiv_r
#define impz_gcd isl_impz_gcd
#define impz_get_si isl_impz_get_si
#define impz_get_str isl_impz_get_str
#define impz_get_ui isl_impz_get_ui
#define impz_import isl_impz_import
#define impz_init isl_impz_init
#define impz_lcm isl_impz_lcm
#define impz_mul isl_impz_mul
#define impz_mul_2exp isl_impz_mul_2exp
#define impz_mul_ui isl_impz_mul_ui
#define impz_neg isl_impz_neg
#define impz_pow_ui isl_impz_pow_ui
#define impz_set isl_impz_set
#define impz_set_si isl_impz_set_si
#define impz_set_str isl_impz_set_str
#define impz_set_ui isl_impz_set_ui
#define impz_sgn isl_impz_sgn
#define impz_sizeinbase isl_impz_sizeinbase
#define impz_sub isl_impz_sub
#define impz_submul isl_impz_submul
#define impz_sub_ui isl_impz_sub_ui
#define impz_swap isl_impz_swap
#define impz_tdiv_q isl_impz_tdiv_q
#define mp_error_string isl_mp_error_string
#define mp_int_abs isl_mp_int_abs
#define mp_int_add isl_mp_int_add
#define mp_int_add_value isl_mp_int_add_value
#define mp_int_alloc isl_mp_int_alloc
#define mp_int_binary_len isl_mp_int_binary_len
#define mp_int_clear isl_mp_int_clear
#define mp_int_compare isl_mp_int_compare
#define mp_int_compare_unsigned isl_mp_int_compare_unsigned
#define mp_int_compare_uvalue isl_mp_int_compare_uvalue
#define mp_int_compare_value isl_mp_int_compare_value
#define mp_int_compare_zero isl_mp_int_compare_zero
#define mp_int_copy isl_mp_int_copy
#define mp_int_count_bits isl_mp_int_count_bits
#define mp_int_div isl_mp_int_div
#define mp_int_divisible_value isl_mp_int_divisible_value
#define mp_int_div_pow2 isl_mp_int_div_pow2
#define mp_int_div_value isl_mp_int_div_value
#define mp_int_egcd isl_mp_int_egcd
#define mp_int_expt isl_mp_int_expt
#define mp_int_expt_full isl_mp_int_expt_full
#define mp_int_exptmod isl_mp_int_exptmod
#define mp_int_exptmod_bvalue isl_mp_int_exptmod_bvalue
#define mp_int_exptmod_evalue isl_mp_int_exptmod_evalue
#define mp_int_exptmod_known isl_mp_int_exptmod_known
#define mp_int_expt_value isl_mp_int_expt_value
#define mp_int_free isl_mp_int_free
#define mp_int_gcd isl_mp_int_gcd
#define mp_int_init isl_mp_int_init
#define mp_int_init_copy isl_mp_int_init_copy
#define mp_int_init_size isl_mp_int_init_size
#define mp_int_init_uvalue isl_mp_int_init_uvalue
#define mp_int_init_value isl_mp_int_init_value
#define mp_int_invmod isl_mp_int_invmod
#define mp_int_is_pow2 isl_mp_int_is_pow2
#define mp_int_lcm isl_mp_int_lcm
#define mp_int_mod isl_mp_int_mod
#define mp_int_mul isl_mp_int_mul
#define mp_int_mul_pow2 isl_mp_int_mul_pow2
#define mp_int_mul_value isl_mp_int_mul_value
#define mp_int_neg isl_mp_int_neg
#define mp_int_read_binary isl_mp_int_read_binary
#define mp_int_read_cstring isl_mp_int_read_cstring
#define mp_int_read_string isl_mp_int_read_string
#define mp_int_read_unsigned isl_mp_int_read_unsigned
#define mp_int_redux_const isl_mp_int_redux_const
#define mp_int_root isl_mp_int_root
#define mp_int_set_uvalue isl_mp_int_set_uvalue
#define mp_int_set_value isl_mp_int_set_value
#define mp_int_sqr isl_mp_int_sqr
#define mp_int_string_len isl_mp_int_string_len
#define mp_int_sub isl_mp_int_sub
#define mp_int_sub_value isl_mp_int_sub_value
#define mp_int_swap isl_mp_int_swap
#define mp_int_to_binary isl_mp_int_to_binary
#define mp_int_to_int isl_mp_int_to_int
#define mp_int_to_string isl_mp_int_to_string
#define mp_int_to_uint isl_mp_int_to_uint
#define mp_int_to_unsigned isl_mp_int_to_unsigned
#define mp_int_unsigned_len isl_mp_int_unsigned_len
#define mp_int_zero isl_mp_int_zero
#define mp_rat_abs isl_mp_rat_abs
#define mp_rat_add isl_mp_rat_add
#define mp_rat_add_int isl_mp_rat_add_int
#define mp_rat_alloc isl_mp_rat_alloc
#define mp_rat_clear isl_mp_rat_clear
#define mp_rat_compare isl_mp_rat_compare
#define mp_rat_compare_unsigned isl_mp_rat_compare_unsigned
#define mp_rat_compare_value isl_mp_rat_compare_value
#define mp_rat_compare_zero isl_mp_rat_compare_zero
#define mp_rat_copy isl_mp_rat_copy
#define mp_rat_decimal_len isl_mp_rat_decimal_len
#define mp_rat_denom isl_mp_rat_denom
#define mp_rat_denom_ref isl_mp_rat_denom_ref
#define mp_rat_div isl_mp_rat_div
#define mp_rat_div_int isl_mp_rat_div_int
#define mp_rat_expt isl_mp_rat_expt
#define mp_rat_free isl_mp_rat_free
#define mp_rat_init isl_mp_rat_init
#define mp_rat_init_copy isl_mp_rat_init_copy
#define mp_rat_init_size isl_mp_rat_init_size
#define mp_rat_is_integer isl_mp_rat_is_integer
#define mp_rat_mul isl_mp_rat_mul
#define mp_rat_mul_int isl_mp_rat_mul_int
#define mp_rat_neg isl_mp_rat_neg
#define mp_rat_numer isl_mp_rat_numer
#define mp_rat_numer_ref isl_mp_rat_numer_ref
#define mp_rat_read_cdecimal isl_mp_rat_read_cdecimal
#define mp_rat_read_cstring isl_mp_rat_read_cstring
#define mp_rat_read_decimal isl_mp_rat_read_decimal
#define mp_rat_read_string isl_mp_rat_read_string
#define mp_rat_read_ustring isl_mp_rat_read_ustring
#define mp_rat_recip isl_mp_rat_recip
#define mp_rat_reduce isl_mp_rat_reduce
#define mp_rat_set_uvalue isl_mp_rat_set_uvalue
#define mp_rat_set_value isl_mp_rat_set_value
#define mp_rat_sign isl_mp_rat_sign
#define mp_rat_string_len isl_mp_rat_string_len
#define mp_rat_sub isl_mp_rat_sub
#define mp_rat_sub_int isl_mp_rat_sub_int
#define mp_rat_to_decimal isl_mp_rat_to_decimal
#define mp_rat_to_ints isl_mp_rat_to_ints
#define mp_rat_to_string isl_mp_rat_to_string
#define mp_rat_zero isl_mp_rat_zero
#endif

1516
external/mit/isl/dist/include/isl/aff.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
#ifndef ISL_AFF_TYPE_H
#define ISL_AFF_TYPE_H
#include <isl/list.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_subclass(isl_multi_aff) __isl_subclass(isl_pw_aff) isl_aff;
typedef struct isl_aff isl_aff;
ISL_DECLARE_EXPORTED_LIST_TYPE(aff)
struct __isl_subclass(isl_multi_pw_aff) __isl_subclass(isl_pw_multi_aff)
__isl_subclass(isl_union_pw_aff) isl_pw_aff;
typedef struct isl_pw_aff isl_pw_aff;
ISL_DECLARE_EXPORTED_LIST_TYPE(pw_aff)
struct __isl_subclass(isl_multi_union_pw_aff)
__isl_subclass(isl_union_pw_multi_aff) isl_union_pw_aff;
typedef struct isl_union_pw_aff isl_union_pw_aff;
ISL_DECLARE_EXPORTED_LIST_TYPE(union_pw_aff)
struct __isl_subclass(isl_multi_pw_aff) __isl_subclass(isl_pw_multi_aff)
isl_multi_aff;
typedef struct isl_multi_aff isl_multi_aff;
struct __isl_subclass(isl_multi_pw_aff) __isl_subclass(isl_union_pw_multi_aff)
isl_pw_multi_aff;
typedef struct isl_pw_multi_aff isl_pw_multi_aff;
ISL_DECLARE_EXPORTED_LIST_TYPE(pw_multi_aff)
struct __isl_export isl_union_pw_multi_aff;
typedef struct isl_union_pw_multi_aff isl_union_pw_multi_aff;
ISL_DECLARE_LIST_TYPE(union_pw_multi_aff)
struct __isl_subclass(isl_multi_union_pw_aff) isl_multi_pw_aff;
typedef struct isl_multi_pw_aff isl_multi_pw_aff;
struct __isl_export isl_multi_union_pw_aff;
typedef struct isl_multi_union_pw_aff isl_multi_union_pw_aff;
#if defined(__cplusplus)
}
#endif
#endif

325
external/mit/isl/dist/include/isl/arg.h vendored Normal file
View File

@ -0,0 +1,325 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_ARG_H
#define ISL_ARG_H
#include <stddef.h>
#include <stdlib.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct isl_arg_choice {
const char *name;
unsigned value;
};
struct isl_arg_flags {
const char *name;
unsigned mask;
unsigned value;
};
enum isl_arg_type {
isl_arg_end,
isl_arg_alias,
isl_arg_arg,
isl_arg_bool,
isl_arg_child,
isl_arg_choice,
isl_arg_flags,
isl_arg_footer,
isl_arg_int,
isl_arg_user,
isl_arg_long,
isl_arg_ulong,
isl_arg_str,
isl_arg_str_list,
isl_arg_version
};
struct isl_args;
struct isl_arg {
enum isl_arg_type type;
char short_name;
const char *long_name;
const char *argument_name;
#define ISL_ARG_OFFSET_NONE ((size_t) -1)
size_t offset;
const char *help_msg;
#define ISL_ARG_SINGLE_DASH (1 << 0)
#define ISL_ARG_BOOL_ARG (1 << 1)
#define ISL_ARG_HIDDEN (1 << 2)
unsigned flags;
union {
struct {
struct isl_arg_choice *choice;
unsigned default_value;
unsigned default_selected;
int (*set)(void *opt, unsigned val);
} choice;
struct {
struct isl_arg_flags *flags;
unsigned default_value;
} flags;
struct {
unsigned default_value;
int (*set)(void *opt, unsigned val);
} b;
struct {
int default_value;
} i;
struct {
long default_value;
long default_selected;
int (*set)(void *opt, long val);
} l;
struct {
unsigned long default_value;
} ul;
struct {
const char *default_value;
} str;
struct {
size_t offset_n;
} str_list;
struct {
struct isl_args *child;
} child;
struct {
void (*print_version)(void);
} version;
struct {
int (*init)(void*);
void (*clear)(void*);
} user;
} u;
};
struct isl_args {
size_t options_size;
struct isl_arg *args;
};
#define ISL_ARGS_START(s,name) \
struct isl_arg name ## LIST[]; \
struct isl_args name = { sizeof(s), name ## LIST }; \
struct isl_arg name ## LIST[] = {
#define ISL_ARGS_END \
{ isl_arg_end } };
#define ISL_ARG_ALIAS(l) { \
.type = isl_arg_alias, \
.long_name = l, \
},
#define ISL_ARG_ARG(st,f,a,d) { \
.type = isl_arg_arg, \
.argument_name = a, \
.offset = offsetof(st, f), \
.u = { .str = { .default_value = d } } \
},
#define ISL_ARG_FOOTER(h) { \
.type = isl_arg_footer, \
.help_msg = h, \
},
#define ISL_ARG_CHOICE(st,f,s,l,c,d,h) { \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = d, .set = NULL } } \
},
#define ISL_ARG_OPT_CHOICE(st,f,s,l,c,d,ds,h) { \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = ds, .set = NULL } } \
},
#define ISL_ARG_PHANTOM_USER_CHOICE_F(s,l,c,setter,d,h,fl) { \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = ISL_ARG_OFFSET_NONE, \
.help_msg = h, \
.flags = fl, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = d, .set = setter } } \
},
#define ISL_ARG_USER_OPT_CHOICE(st,f,s,l,c,setter,d,ds,h) { \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = ds, .set = setter } } \
},
#define _ISL_ARG_BOOL_F(o,s,l,setter,d,h,fl) { \
.type = isl_arg_bool, \
.short_name = s, \
.long_name = l, \
.offset = o, \
.help_msg = h, \
.flags = fl, \
.u = { .b = { .default_value = d, .set = setter } } \
},
#define ISL_ARG_BOOL_F(st,f,s,l,d,h,fl) \
_ISL_ARG_BOOL_F(offsetof(st, f),s,l,NULL,d,h,fl)
#define ISL_ARG_BOOL(st,f,s,l,d,h) \
ISL_ARG_BOOL_F(st,f,s,l,d,h,0)
#define ISL_ARG_PHANTOM_BOOL_F(s,l,setter,h,fl) \
_ISL_ARG_BOOL_F(ISL_ARG_OFFSET_NONE,s,l,setter,0,h,fl)
#define ISL_ARG_PHANTOM_BOOL(s,l,setter,h) \
ISL_ARG_PHANTOM_BOOL_F(s,l,setter,h,0)
#define ISL_ARG_INT_F(st,f,s,l,a,d,h,fl) { \
.type = isl_arg_int, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f), \
.help_msg = h, \
.flags = fl, \
.u = { .i = { .default_value = d } } \
},
#define ISL_ARG_INT(st,f,s,l,a,d,h) \
ISL_ARG_INT_F(st,f,s,l,a,d,h,0)
#define ISL_ARG_LONG(st,f,s,lo,d,h) { \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = d, \
.set = NULL } } \
},
#define ISL_ARG_USER_LONG(st,f,s,lo,setter,d,h) { \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = d, \
.set = setter } } \
},
#define ISL_ARG_OPT_LONG(st,f,s,lo,d,ds,h) { \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = ds, \
.set = NULL } } \
},
#define ISL_ARG_ULONG(st,f,s,l,d,h) { \
.type = isl_arg_ulong, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .ul = { .default_value = d } } \
},
#define ISL_ARG_STR_F(st,f,s,l,a,d,h,fl) { \
.type = isl_arg_str, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f), \
.help_msg = h, \
.flags = fl, \
.u = { .str = { .default_value = d } } \
},
#define ISL_ARG_STR(st,f,s,l,a,d,h) \
ISL_ARG_STR_F(st,f,s,l,a,d,h,0)
#define ISL_ARG_STR_LIST(st,f_n,f_l,s,l,a,h) { \
.type = isl_arg_str_list, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f_l), \
.help_msg = h, \
.u = { .str_list = { .offset_n = offsetof(st, f_n) } } \
},
#define _ISL_ARG_CHILD(o,l,c,h,fl) { \
.type = isl_arg_child, \
.long_name = l, \
.offset = o, \
.help_msg = h, \
.flags = fl, \
.u = { .child = { .child = c } } \
},
#define ISL_ARG_CHILD(st,f,l,c,h) \
_ISL_ARG_CHILD(offsetof(st, f),l,c,h,0)
#define ISL_ARG_GROUP_F(l,c,h,fl) \
_ISL_ARG_CHILD(ISL_ARG_OFFSET_NONE,l,c,h,fl)
#define ISL_ARG_GROUP(l,c,h) \
ISL_ARG_GROUP_F(l,c,h,0)
#define ISL_ARG_FLAGS(st,f,s,l,c,d,h) { \
.type = isl_arg_flags, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .flags = { .flags = c, .default_value = d } } \
},
#define ISL_ARG_USER(st,f,i,c) { \
.type = isl_arg_user, \
.offset = offsetof(st, f), \
.u = { .user = { .init = i, .clear = c} } \
},
#define ISL_ARG_VERSION(print) { \
.type = isl_arg_version, \
.u = { .version = { .print_version = print } } \
},
#define ISL_ARG_ALL (1 << 0)
#define ISL_ARG_SKIP_HELP (1 << 1)
void isl_args_set_defaults(struct isl_args *args, void *opt);
void isl_args_free(struct isl_args *args, void *opt);
int isl_args_parse(struct isl_args *args, int argc, char **argv, void *opt,
unsigned flags);
#define ISL_ARG_DECL(prefix,st,args) \
extern struct isl_args args; \
st *prefix ## _new_with_defaults(void); \
void prefix ## _free(st *opt); \
int prefix ## _parse(st *opt, int argc, char **argv, unsigned flags);
#define ISL_ARG_DEF(prefix,st,args) \
st *prefix ## _new_with_defaults() \
{ \
st *opt = (st *)calloc(1, sizeof(st)); \
if (opt) \
isl_args_set_defaults(&(args), opt); \
return opt; \
} \
\
void prefix ## _free(st *opt) \
{ \
isl_args_free(&(args), opt); \
} \
\
int prefix ## _parse(st *opt, int argc, char **argv, unsigned flags) \
{ \
return isl_args_parse(&(args), argc, argv, opt, flags); \
}
#if defined(__cplusplus)
}
#endif
#endif

252
external/mit/isl/dist/include/isl/ast.h vendored Normal file
View File

@ -0,0 +1,252 @@
#ifndef ISL_AST_H
#define ISL_AST_H
#include <isl/ctx.h>
#include <isl/ast_type.h>
#include <isl/id_type.h>
#include <isl/id_to_ast_expr.h>
#include <isl/val_type.h>
#include <isl/list.h>
#include <isl/printer.h>
#if defined(__cplusplus)
extern "C" {
#endif
isl_stat isl_options_set_ast_iterator_type(isl_ctx *ctx, const char *val);
const char *isl_options_get_ast_iterator_type(isl_ctx *ctx);
isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx, int val);
int isl_options_get_ast_always_print_block(isl_ctx *ctx);
isl_stat isl_options_set_ast_print_outermost_block(isl_ctx *ctx, int val);
int isl_options_get_ast_print_outermost_block(isl_ctx *ctx);
__isl_give isl_ast_expr *isl_ast_expr_from_val(__isl_take isl_val *v);
__isl_give isl_ast_expr *isl_ast_expr_from_id(__isl_take isl_id *id);
__isl_give isl_ast_expr *isl_ast_expr_neg(__isl_take isl_ast_expr *expr);
__isl_give isl_ast_expr *isl_ast_expr_add(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_sub(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_mul(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_div(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_pdiv_q(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_pdiv_r(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_and(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_and_then(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_or(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_or_else(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_le(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_lt(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_ge(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_gt(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_eq(__isl_take isl_ast_expr *expr1,
__isl_take isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_access(__isl_take isl_ast_expr *array,
__isl_take isl_ast_expr_list *indices);
__isl_give isl_ast_expr *isl_ast_expr_call(__isl_take isl_ast_expr *function,
__isl_take isl_ast_expr_list *arguments);
__isl_give isl_ast_expr *isl_ast_expr_address_of(__isl_take isl_ast_expr *expr);
__isl_give isl_ast_expr *isl_ast_expr_copy(__isl_keep isl_ast_expr *expr);
__isl_null isl_ast_expr *isl_ast_expr_free(__isl_take isl_ast_expr *expr);
isl_ctx *isl_ast_expr_get_ctx(__isl_keep isl_ast_expr *expr);
__isl_subclass(isl_ast_expr)
enum isl_ast_expr_type isl_ast_expr_get_type(__isl_keep isl_ast_expr *expr);
__isl_export
__isl_give isl_val *isl_ast_expr_int_get_val(__isl_keep isl_ast_expr *expr);
__isl_give isl_val *isl_ast_expr_get_val(__isl_keep isl_ast_expr *expr);
__isl_export
__isl_give isl_id *isl_ast_expr_id_get_id(__isl_keep isl_ast_expr *expr);
__isl_give isl_id *isl_ast_expr_get_id(__isl_keep isl_ast_expr *expr);
__isl_subclass(isl_ast_expr_op)
enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
__isl_keep isl_ast_expr *expr);
enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
__isl_keep isl_ast_expr *expr);
__isl_export
isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
__isl_export
__isl_give isl_ast_expr *isl_ast_expr_op_get_arg(__isl_keep isl_ast_expr *expr,
int pos);
__isl_give isl_ast_expr *isl_ast_expr_get_op_arg(__isl_keep isl_ast_expr *expr,
int pos);
__isl_give isl_ast_expr *isl_ast_expr_set_op_arg(__isl_take isl_ast_expr *expr,
int pos, __isl_take isl_ast_expr *arg);
isl_bool isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
__isl_keep isl_ast_expr *expr2);
__isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
__isl_take isl_ast_expr *expr, __isl_take isl_id_to_ast_expr *id2expr);
__isl_give isl_printer *isl_printer_print_ast_expr(__isl_take isl_printer *p,
__isl_keep isl_ast_expr *expr);
void isl_ast_expr_dump(__isl_keep isl_ast_expr *expr);
__isl_give char *isl_ast_expr_to_str(__isl_keep isl_ast_expr *expr);
__isl_export
__isl_give char *isl_ast_expr_to_C_str(__isl_keep isl_ast_expr *expr);
__isl_constructor
__isl_give isl_ast_node *isl_ast_node_user_from_expr(
__isl_take isl_ast_expr *expr);
__isl_give isl_ast_node *isl_ast_node_alloc_user(__isl_take isl_ast_expr *expr);
__isl_give isl_ast_node *isl_ast_node_copy(__isl_keep isl_ast_node *node);
__isl_null isl_ast_node *isl_ast_node_free(__isl_take isl_ast_node *node);
isl_ctx *isl_ast_node_get_ctx(__isl_keep isl_ast_node *node);
__isl_subclass(isl_ast_node)
enum isl_ast_node_type isl_ast_node_get_type(__isl_keep isl_ast_node *node);
__isl_give isl_ast_node *isl_ast_node_set_annotation(
__isl_take isl_ast_node *node, __isl_take isl_id *annotation);
__isl_give isl_id *isl_ast_node_get_annotation(__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_for_get_init(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_for_get_cond(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_for_get_inc(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_node *isl_ast_node_for_get_body(
__isl_keep isl_ast_node *node);
__isl_export
isl_bool isl_ast_node_for_is_degenerate(__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_if_get_cond(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_node *isl_ast_node_if_get_then_node(
__isl_keep isl_ast_node *node);
__isl_give isl_ast_node *isl_ast_node_if_get_then(
__isl_keep isl_ast_node *node);
__isl_export
isl_bool isl_ast_node_if_has_else_node(__isl_keep isl_ast_node *node);
isl_bool isl_ast_node_if_has_else(__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_node *isl_ast_node_if_get_else_node(
__isl_keep isl_ast_node *node);
__isl_give isl_ast_node *isl_ast_node_if_get_else(
__isl_keep isl_ast_node *node);
__isl_constructor
__isl_give isl_ast_node *isl_ast_node_block_from_children(
__isl_take isl_ast_node_list *list);
__isl_export
__isl_give isl_ast_node_list *isl_ast_node_block_get_children(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_id *isl_ast_node_mark_get_id(__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_node *isl_ast_node_mark_get_node(
__isl_keep isl_ast_node *node);
__isl_export
__isl_give isl_ast_expr *isl_ast_node_user_get_expr(
__isl_keep isl_ast_node *node);
isl_stat isl_ast_node_foreach_descendant_top_down(
__isl_keep isl_ast_node *node,
isl_bool (*fn)(__isl_keep isl_ast_node *node, void *user), void *user);
__isl_export
__isl_give isl_ast_node *isl_ast_node_map_descendant_bottom_up(
__isl_take isl_ast_node *node, __isl_give isl_ast_node *(*fn)(
__isl_take isl_ast_node *node, void *user), void *user);
__isl_give isl_printer *isl_printer_print_ast_node(__isl_take isl_printer *p,
__isl_keep isl_ast_node *node);
void isl_ast_node_dump(__isl_keep isl_ast_node *node);
__isl_give char *isl_ast_node_to_str(__isl_keep isl_ast_node *node);
__isl_give isl_ast_print_options *isl_ast_print_options_alloc(isl_ctx *ctx);
__isl_give isl_ast_print_options *isl_ast_print_options_copy(
__isl_keep isl_ast_print_options *options);
__isl_null isl_ast_print_options *isl_ast_print_options_free(
__isl_take isl_ast_print_options *options);
isl_ctx *isl_ast_print_options_get_ctx(
__isl_keep isl_ast_print_options *options);
__isl_give isl_ast_print_options *isl_ast_print_options_set_print_user(
__isl_take isl_ast_print_options *options,
__isl_give isl_printer *(*print_user)(__isl_take isl_printer *p,
__isl_take isl_ast_print_options *options,
__isl_keep isl_ast_node *node, void *user),
void *user);
__isl_give isl_ast_print_options *isl_ast_print_options_set_print_for(
__isl_take isl_ast_print_options *options,
__isl_give isl_printer *(*print_for)(__isl_take isl_printer *p,
__isl_take isl_ast_print_options *options,
__isl_keep isl_ast_node *node, void *user),
void *user);
isl_stat isl_options_set_ast_print_macro_once(isl_ctx *ctx, int val);
int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
isl_stat isl_ast_expr_foreach_ast_expr_op_type(__isl_keep isl_ast_expr *expr,
isl_stat (*fn)(enum isl_ast_expr_op_type type, void *user), void *user);
isl_stat isl_ast_expr_foreach_ast_op_type(__isl_keep isl_ast_expr *expr,
isl_stat (*fn)(enum isl_ast_expr_op_type type, void *user), void *user);
isl_stat isl_ast_node_foreach_ast_expr_op_type(__isl_keep isl_ast_node *node,
isl_stat (*fn)(enum isl_ast_expr_op_type type, void *user), void *user);
isl_stat isl_ast_node_foreach_ast_op_type(__isl_keep isl_ast_node *node,
isl_stat (*fn)(enum isl_ast_expr_op_type type, void *user), void *user);
__isl_give isl_printer *isl_ast_expr_op_type_set_print_name(
__isl_take isl_printer *p, enum isl_ast_expr_op_type type,
__isl_keep const char *name);
__isl_give isl_printer *isl_ast_op_type_set_print_name(
__isl_take isl_printer *p, enum isl_ast_expr_op_type type,
__isl_keep const char *name);
__isl_give isl_printer *isl_ast_expr_op_type_print_macro(
enum isl_ast_expr_op_type type, __isl_take isl_printer *p);
__isl_give isl_printer *isl_ast_op_type_print_macro(
enum isl_ast_expr_op_type type, __isl_take isl_printer *p);
__isl_give isl_printer *isl_ast_expr_print_macros(
__isl_keep isl_ast_expr *expr, __isl_take isl_printer *p);
__isl_give isl_printer *isl_ast_node_print_macros(
__isl_keep isl_ast_node *node, __isl_take isl_printer *p);
__isl_give isl_printer *isl_ast_node_print(__isl_keep isl_ast_node *node,
__isl_take isl_printer *p,
__isl_take isl_ast_print_options *options);
__isl_give isl_printer *isl_ast_node_for_print(__isl_keep isl_ast_node *node,
__isl_take isl_printer *p,
__isl_take isl_ast_print_options *options);
__isl_give isl_printer *isl_ast_node_if_print(__isl_keep isl_ast_node *node,
__isl_take isl_printer *p,
__isl_take isl_ast_print_options *options);
__isl_export
__isl_give char *isl_ast_node_to_C_str(__isl_keep isl_ast_node *node);
ISL_DECLARE_LIST_FN(ast_expr)
ISL_DECLARE_EXPORTED_LIST_FN(ast_node)
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,131 @@
#ifndef ISL_AST_BUILD_H
#define ISL_AST_BUILD_H
#include <isl/ctx.h>
#include <isl/set.h>
#include <isl/ast.h>
#include <isl/schedule.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_export isl_ast_build;
typedef struct isl_ast_build isl_ast_build;
isl_stat isl_options_set_ast_build_atomic_upper_bound(isl_ctx *ctx, int val);
int isl_options_get_ast_build_atomic_upper_bound(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx, int val);
int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_detect_min_max(isl_ctx *ctx, int val);
int isl_options_get_ast_build_detect_min_max(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_exploit_nested_bounds(isl_ctx *ctx, int val);
int isl_options_get_ast_build_exploit_nested_bounds(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_group_coscheduled(isl_ctx *ctx, int val);
int isl_options_get_ast_build_group_coscheduled(isl_ctx *ctx);
#define ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT 0
#define ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT 1
isl_stat isl_options_set_ast_build_separation_bounds(isl_ctx *ctx, int val);
int isl_options_get_ast_build_separation_bounds(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_scale_strides(isl_ctx *ctx, int val);
int isl_options_get_ast_build_scale_strides(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx, int val);
int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx, int val);
int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
isl_ctx *isl_ast_build_get_ctx(__isl_keep isl_ast_build *build);
__isl_constructor
__isl_give isl_ast_build *isl_ast_build_alloc(isl_ctx *ctx);
__isl_export
__isl_give isl_ast_build *isl_ast_build_from_context(__isl_take isl_set *set);
__isl_give isl_space *isl_ast_build_get_schedule_space(
__isl_keep isl_ast_build *build);
__isl_export
__isl_give isl_union_map *isl_ast_build_get_schedule(
__isl_keep isl_ast_build *build);
__isl_give isl_ast_build *isl_ast_build_restrict(
__isl_take isl_ast_build *build, __isl_take isl_set *set);
__isl_give isl_ast_build *isl_ast_build_copy(
__isl_keep isl_ast_build *build);
__isl_null isl_ast_build *isl_ast_build_free(
__isl_take isl_ast_build *build);
__isl_give isl_ast_build *isl_ast_build_set_options(
__isl_take isl_ast_build *build,
__isl_take isl_union_map *options);
__isl_give isl_ast_build *isl_ast_build_set_iterators(
__isl_take isl_ast_build *build,
__isl_take isl_id_list *iterators);
__isl_export
__isl_give isl_ast_build *isl_ast_build_set_at_each_domain(
__isl_take isl_ast_build *build,
__isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node,
__isl_keep isl_ast_build *build, void *user), void *user);
__isl_give isl_ast_build *isl_ast_build_set_before_each_for(
__isl_take isl_ast_build *build,
__isl_give isl_id *(*fn)(__isl_keep isl_ast_build *build,
void *user), void *user);
__isl_give isl_ast_build *isl_ast_build_set_after_each_for(
__isl_take isl_ast_build *build,
__isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node,
__isl_keep isl_ast_build *build, void *user), void *user);
__isl_give isl_ast_build *isl_ast_build_set_before_each_mark(
__isl_take isl_ast_build *build,
isl_stat (*fn)(__isl_keep isl_id *mark, __isl_keep isl_ast_build *build,
void *user), void *user);
__isl_give isl_ast_build *isl_ast_build_set_after_each_mark(
__isl_take isl_ast_build *build,
__isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node,
__isl_keep isl_ast_build *build, void *user), void *user);
__isl_give isl_ast_build *isl_ast_build_set_create_leaf(
__isl_take isl_ast_build *build,
__isl_give isl_ast_node *(*fn)(__isl_take isl_ast_build *build,
void *user), void *user);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_expr_from_set(
__isl_keep isl_ast_build *build, __isl_take isl_set *set);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
__isl_keep isl_ast_build *build, __isl_take isl_pw_aff *pa);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_access_from_pw_multi_aff(
__isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_access_from_multi_pw_aff(
__isl_keep isl_ast_build *build, __isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_call_from_pw_multi_aff(
__isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma);
__isl_overload
__isl_give isl_ast_expr *isl_ast_build_call_from_multi_pw_aff(
__isl_keep isl_ast_build *build, __isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_ast_node *isl_ast_build_node_from_schedule(
__isl_keep isl_ast_build *build, __isl_take isl_schedule *schedule);
__isl_export
__isl_give isl_ast_node *isl_ast_build_node_from_schedule_map(
__isl_keep isl_ast_build *build, __isl_take isl_union_map *schedule);
__isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
__isl_keep isl_ast_build *build, __isl_take isl_union_map *schedule);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,109 @@
#ifndef ISL_AST_TYPE_H
#define ISL_AST_TYPE_H
#include <isl/list.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_export isl_ast_expr;
typedef struct isl_ast_expr isl_ast_expr;
struct __isl_export isl_ast_node;
typedef struct isl_ast_node isl_ast_node;
enum isl_ast_expr_op_type {
isl_ast_expr_op_error = -1,
isl_ast_expr_op_and,
isl_ast_expr_op_and_then,
isl_ast_expr_op_or,
isl_ast_expr_op_or_else,
isl_ast_expr_op_max,
isl_ast_expr_op_min,
isl_ast_expr_op_minus,
isl_ast_expr_op_add,
isl_ast_expr_op_sub,
isl_ast_expr_op_mul,
isl_ast_expr_op_div,
isl_ast_expr_op_fdiv_q, /* Round towards -infty */
isl_ast_expr_op_pdiv_q, /* Dividend is non-negative */
isl_ast_expr_op_pdiv_r, /* Dividend is non-negative */
isl_ast_expr_op_zdiv_r, /* Result only compared against zero */
isl_ast_expr_op_cond,
isl_ast_expr_op_select,
isl_ast_expr_op_eq,
isl_ast_expr_op_le,
isl_ast_expr_op_lt,
isl_ast_expr_op_ge,
isl_ast_expr_op_gt,
isl_ast_expr_op_call,
isl_ast_expr_op_access,
isl_ast_expr_op_member,
isl_ast_expr_op_address_of
};
#define isl_ast_op_type isl_ast_expr_op_type
#define isl_ast_op_error isl_ast_expr_op_error
#define isl_ast_op_and isl_ast_expr_op_and
#define isl_ast_op_and_then isl_ast_expr_op_and_then
#define isl_ast_op_or isl_ast_expr_op_or
#define isl_ast_op_or_else isl_ast_expr_op_or_else
#define isl_ast_op_max isl_ast_expr_op_max
#define isl_ast_op_min isl_ast_expr_op_min
#define isl_ast_op_minus isl_ast_expr_op_minus
#define isl_ast_op_add isl_ast_expr_op_add
#define isl_ast_op_sub isl_ast_expr_op_sub
#define isl_ast_op_mul isl_ast_expr_op_mul
#define isl_ast_op_div isl_ast_expr_op_div
#define isl_ast_op_fdiv_q isl_ast_expr_op_fdiv_q
#define isl_ast_op_pdiv_q isl_ast_expr_op_pdiv_q
#define isl_ast_op_pdiv_r isl_ast_expr_op_pdiv_r
#define isl_ast_op_zdiv_r isl_ast_expr_op_zdiv_r
#define isl_ast_op_cond isl_ast_expr_op_cond
#define isl_ast_op_select isl_ast_expr_op_select
#define isl_ast_op_eq isl_ast_expr_op_eq
#define isl_ast_op_le isl_ast_expr_op_le
#define isl_ast_op_lt isl_ast_expr_op_lt
#define isl_ast_op_ge isl_ast_expr_op_ge
#define isl_ast_op_gt isl_ast_expr_op_gt
#define isl_ast_op_call isl_ast_expr_op_call
#define isl_ast_op_access isl_ast_expr_op_access
#define isl_ast_op_member isl_ast_expr_op_member
#define isl_ast_op_address_of isl_ast_expr_op_address_of
enum isl_ast_expr_type {
isl_ast_expr_error = -1,
isl_ast_expr_op,
isl_ast_expr_id,
isl_ast_expr_int
};
enum isl_ast_node_type {
isl_ast_node_error = -1,
isl_ast_node_for = 1,
isl_ast_node_if,
isl_ast_node_block,
isl_ast_node_mark,
isl_ast_node_user
};
enum isl_ast_loop_type {
isl_ast_loop_error = -1,
isl_ast_loop_default = 0,
isl_ast_loop_atomic,
isl_ast_loop_unroll,
isl_ast_loop_separate
};
struct isl_ast_print_options;
typedef struct isl_ast_print_options isl_ast_print_options;
ISL_DECLARE_LIST_TYPE(ast_expr)
ISL_DECLARE_EXPORTED_LIST_TYPE(ast_node)
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,148 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_CONSTRAINT_H
#define ISL_CONSTRAINT_H
#include <isl/local_space.h>
#include <isl/space_type.h>
#include <isl/aff_type.h>
#include <isl/set_type.h>
#include <isl/list.h>
#include <isl/val_type.h>
#include <isl/printer.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct isl_constraint;
typedef struct isl_constraint isl_constraint;
ISL_DECLARE_LIST(constraint)
isl_ctx *isl_constraint_get_ctx(__isl_keep isl_constraint *c);
__isl_give isl_constraint *isl_constraint_alloc_equality(
__isl_take isl_local_space *ls);
__isl_give isl_constraint *isl_constraint_alloc_inequality(
__isl_take isl_local_space *ls);
__isl_give isl_constraint *isl_equality_alloc(__isl_take isl_local_space *ls);
__isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_local_space *ls);
__isl_give isl_constraint *isl_constraint_copy(__isl_keep isl_constraint *c);
__isl_null isl_constraint *isl_constraint_free(__isl_take isl_constraint *c);
isl_size isl_basic_map_n_constraint(__isl_keep isl_basic_map *bmap);
isl_size isl_basic_set_n_constraint(__isl_keep isl_basic_set *bset);
isl_stat isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
isl_stat (*fn)(__isl_take isl_constraint *c, void *user), void *user);
isl_stat isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
isl_stat (*fn)(__isl_take isl_constraint *c, void *user), void *user);
__isl_give isl_constraint_list *isl_basic_map_get_constraint_list(
__isl_keep isl_basic_map *bmap);
__isl_give isl_constraint_list *isl_basic_set_get_constraint_list(
__isl_keep isl_basic_set *bset);
int isl_constraint_is_equal(__isl_keep isl_constraint *constraint1,
__isl_keep isl_constraint *constraint2);
isl_stat isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
enum isl_dim_type type, unsigned pos,
isl_stat (*fn)(__isl_take isl_constraint *lower,
__isl_take isl_constraint *upper,
__isl_take isl_basic_set *bset, void *user), void *user);
__isl_give isl_basic_map *isl_basic_map_add_constraint(
__isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
__isl_give isl_basic_set *isl_basic_set_add_constraint(
__isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
__isl_give isl_map *isl_map_add_constraint(__isl_take isl_map *map,
__isl_take isl_constraint *constraint);
__isl_give isl_set *isl_set_add_constraint(__isl_take isl_set *set,
__isl_take isl_constraint *constraint);
isl_bool isl_basic_map_has_defining_equality(
__isl_keep isl_basic_map *bmap, enum isl_dim_type type, int pos,
__isl_give isl_constraint **c);
isl_bool isl_basic_set_has_defining_equality(
struct isl_basic_set *bset, enum isl_dim_type type, int pos,
struct isl_constraint **constraint);
isl_bool isl_basic_set_has_defining_inequalities(
struct isl_basic_set *bset, enum isl_dim_type type, int pos,
struct isl_constraint **lower,
struct isl_constraint **upper);
__isl_give isl_space *isl_constraint_get_space(
__isl_keep isl_constraint *constraint);
__isl_give isl_local_space *isl_constraint_get_local_space(
__isl_keep isl_constraint *constraint);
isl_size isl_constraint_dim(__isl_keep isl_constraint *constraint,
enum isl_dim_type type);
isl_bool isl_constraint_involves_dims(__isl_keep isl_constraint *constraint,
enum isl_dim_type type, unsigned first, unsigned n);
const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint,
enum isl_dim_type type, unsigned pos);
__isl_give isl_val *isl_constraint_get_constant_val(
__isl_keep isl_constraint *constraint);
__isl_give isl_val *isl_constraint_get_coefficient_val(
__isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
__isl_give isl_constraint *isl_constraint_set_constant_si(
__isl_take isl_constraint *constraint, int v);
__isl_give isl_constraint *isl_constraint_set_constant_val(
__isl_take isl_constraint *constraint, __isl_take isl_val *v);
__isl_give isl_constraint *isl_constraint_set_coefficient_si(
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, int v);
__isl_give isl_constraint *isl_constraint_set_coefficient_val(
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, __isl_take isl_val *v);
__isl_give isl_aff *isl_constraint_get_div(__isl_keep isl_constraint *constraint,
int pos);
__isl_give isl_constraint *isl_constraint_negate(
__isl_take isl_constraint *constraint);
isl_bool isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
isl_bool isl_constraint_is_div_constraint(
__isl_keep isl_constraint *constraint);
isl_bool isl_constraint_is_lower_bound(__isl_keep isl_constraint *constraint,
enum isl_dim_type type, unsigned pos);
isl_bool isl_constraint_is_upper_bound(__isl_keep isl_constraint *constraint,
enum isl_dim_type type, unsigned pos);
__isl_give isl_basic_map *isl_basic_map_from_constraint(
__isl_take isl_constraint *constraint);
__isl_give isl_basic_set *isl_basic_set_from_constraint(
__isl_take isl_constraint *constraint);
__isl_give isl_aff *isl_constraint_get_bound(
__isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
__isl_give isl_aff *isl_constraint_get_aff(
__isl_keep isl_constraint *constraint);
__isl_give isl_constraint *isl_equality_from_aff(__isl_take isl_aff *aff);
__isl_give isl_constraint *isl_inequality_from_aff(__isl_take isl_aff *aff);
int isl_constraint_plain_cmp(__isl_keep isl_constraint *c1,
__isl_keep isl_constraint *c2);
int isl_constraint_cmp_last_non_zero(__isl_keep isl_constraint *c1,
__isl_keep isl_constraint *c2);
__isl_give isl_printer *isl_printer_print_constraint(__isl_take isl_printer *p,
__isl_keep isl_constraint *c);
void isl_constraint_dump(__isl_keep isl_constraint *c);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,707 @@
/// These are automatically generated conversions between
/// the default and the checked C++ bindings for isl.
///
/// isl is a library for computing with integer sets and maps described by
/// Presburger formulas. On top of this, isl provides various tools for
/// polyhedral compilation, ranging from dependence analysis over scheduling
/// to AST generation.
#ifndef ISL_CPP_CHECKED_CONVERSION
#define ISL_CPP_CHECKED_CONVERSION
#include <isl/cpp.h>
#include <isl/cpp-checked.h>
namespace isl {
checked::aff check(aff obj) {
return checked::manage(obj.copy());
}
aff uncheck(checked::aff obj) {
return manage(obj.copy());
}
checked::aff_list check(aff_list obj) {
return checked::manage(obj.copy());
}
aff_list uncheck(checked::aff_list obj) {
return manage(obj.copy());
}
checked::ast_build check(ast_build obj) {
return checked::manage(obj.copy());
}
ast_build uncheck(checked::ast_build obj) {
return manage(obj.copy());
}
checked::ast_expr check(ast_expr obj) {
return checked::manage(obj.copy());
}
ast_expr uncheck(checked::ast_expr obj) {
return manage(obj.copy());
}
checked::ast_expr_id check(ast_expr_id obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_id>();
}
ast_expr_id uncheck(checked::ast_expr_id obj) {
return manage(obj.copy()).as<ast_expr_id>();
}
checked::ast_expr_int check(ast_expr_int obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_int>();
}
ast_expr_int uncheck(checked::ast_expr_int obj) {
return manage(obj.copy()).as<ast_expr_int>();
}
checked::ast_expr_op check(ast_expr_op obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>();
}
ast_expr_op uncheck(checked::ast_expr_op obj) {
return manage(obj.copy()).as<ast_expr_op>();
}
checked::ast_expr_op_access check(ast_expr_op_access obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_access>();
}
ast_expr_op_access uncheck(checked::ast_expr_op_access obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_access>();
}
checked::ast_expr_op_add check(ast_expr_op_add obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_add>();
}
ast_expr_op_add uncheck(checked::ast_expr_op_add obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_add>();
}
checked::ast_expr_op_address_of check(ast_expr_op_address_of obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_address_of>();
}
ast_expr_op_address_of uncheck(checked::ast_expr_op_address_of obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_address_of>();
}
checked::ast_expr_op_and check(ast_expr_op_and obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_and>();
}
ast_expr_op_and uncheck(checked::ast_expr_op_and obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_and>();
}
checked::ast_expr_op_and_then check(ast_expr_op_and_then obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_and_then>();
}
ast_expr_op_and_then uncheck(checked::ast_expr_op_and_then obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_and_then>();
}
checked::ast_expr_op_call check(ast_expr_op_call obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_call>();
}
ast_expr_op_call uncheck(checked::ast_expr_op_call obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_call>();
}
checked::ast_expr_op_cond check(ast_expr_op_cond obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_cond>();
}
ast_expr_op_cond uncheck(checked::ast_expr_op_cond obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_cond>();
}
checked::ast_expr_op_div check(ast_expr_op_div obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_div>();
}
ast_expr_op_div uncheck(checked::ast_expr_op_div obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_div>();
}
checked::ast_expr_op_eq check(ast_expr_op_eq obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_eq>();
}
ast_expr_op_eq uncheck(checked::ast_expr_op_eq obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_eq>();
}
checked::ast_expr_op_fdiv_q check(ast_expr_op_fdiv_q obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_fdiv_q>();
}
ast_expr_op_fdiv_q uncheck(checked::ast_expr_op_fdiv_q obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_fdiv_q>();
}
checked::ast_expr_op_ge check(ast_expr_op_ge obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_ge>();
}
ast_expr_op_ge uncheck(checked::ast_expr_op_ge obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_ge>();
}
checked::ast_expr_op_gt check(ast_expr_op_gt obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_gt>();
}
ast_expr_op_gt uncheck(checked::ast_expr_op_gt obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_gt>();
}
checked::ast_expr_op_le check(ast_expr_op_le obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_le>();
}
ast_expr_op_le uncheck(checked::ast_expr_op_le obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_le>();
}
checked::ast_expr_op_lt check(ast_expr_op_lt obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_lt>();
}
ast_expr_op_lt uncheck(checked::ast_expr_op_lt obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_lt>();
}
checked::ast_expr_op_max check(ast_expr_op_max obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_max>();
}
ast_expr_op_max uncheck(checked::ast_expr_op_max obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_max>();
}
checked::ast_expr_op_member check(ast_expr_op_member obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_member>();
}
ast_expr_op_member uncheck(checked::ast_expr_op_member obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_member>();
}
checked::ast_expr_op_min check(ast_expr_op_min obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_min>();
}
ast_expr_op_min uncheck(checked::ast_expr_op_min obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_min>();
}
checked::ast_expr_op_minus check(ast_expr_op_minus obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_minus>();
}
ast_expr_op_minus uncheck(checked::ast_expr_op_minus obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_minus>();
}
checked::ast_expr_op_mul check(ast_expr_op_mul obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_mul>();
}
ast_expr_op_mul uncheck(checked::ast_expr_op_mul obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_mul>();
}
checked::ast_expr_op_or check(ast_expr_op_or obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_or>();
}
ast_expr_op_or uncheck(checked::ast_expr_op_or obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_or>();
}
checked::ast_expr_op_or_else check(ast_expr_op_or_else obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_or_else>();
}
ast_expr_op_or_else uncheck(checked::ast_expr_op_or_else obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_or_else>();
}
checked::ast_expr_op_pdiv_q check(ast_expr_op_pdiv_q obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_pdiv_q>();
}
ast_expr_op_pdiv_q uncheck(checked::ast_expr_op_pdiv_q obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_pdiv_q>();
}
checked::ast_expr_op_pdiv_r check(ast_expr_op_pdiv_r obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_pdiv_r>();
}
ast_expr_op_pdiv_r uncheck(checked::ast_expr_op_pdiv_r obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_pdiv_r>();
}
checked::ast_expr_op_select check(ast_expr_op_select obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_select>();
}
ast_expr_op_select uncheck(checked::ast_expr_op_select obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_select>();
}
checked::ast_expr_op_sub check(ast_expr_op_sub obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_sub>();
}
ast_expr_op_sub uncheck(checked::ast_expr_op_sub obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_sub>();
}
checked::ast_expr_op_zdiv_r check(ast_expr_op_zdiv_r obj) {
return checked::manage(obj.copy()).as<checked::ast_expr_op>().as<checked::ast_expr_op_zdiv_r>();
}
ast_expr_op_zdiv_r uncheck(checked::ast_expr_op_zdiv_r obj) {
return manage(obj.copy()).as<ast_expr_op>().as<ast_expr_op_zdiv_r>();
}
checked::ast_node check(ast_node obj) {
return checked::manage(obj.copy());
}
ast_node uncheck(checked::ast_node obj) {
return manage(obj.copy());
}
checked::ast_node_block check(ast_node_block obj) {
return checked::manage(obj.copy()).as<checked::ast_node_block>();
}
ast_node_block uncheck(checked::ast_node_block obj) {
return manage(obj.copy()).as<ast_node_block>();
}
checked::ast_node_for check(ast_node_for obj) {
return checked::manage(obj.copy()).as<checked::ast_node_for>();
}
ast_node_for uncheck(checked::ast_node_for obj) {
return manage(obj.copy()).as<ast_node_for>();
}
checked::ast_node_if check(ast_node_if obj) {
return checked::manage(obj.copy()).as<checked::ast_node_if>();
}
ast_node_if uncheck(checked::ast_node_if obj) {
return manage(obj.copy()).as<ast_node_if>();
}
checked::ast_node_list check(ast_node_list obj) {
return checked::manage(obj.copy());
}
ast_node_list uncheck(checked::ast_node_list obj) {
return manage(obj.copy());
}
checked::ast_node_mark check(ast_node_mark obj) {
return checked::manage(obj.copy()).as<checked::ast_node_mark>();
}
ast_node_mark uncheck(checked::ast_node_mark obj) {
return manage(obj.copy()).as<ast_node_mark>();
}
checked::ast_node_user check(ast_node_user obj) {
return checked::manage(obj.copy()).as<checked::ast_node_user>();
}
ast_node_user uncheck(checked::ast_node_user obj) {
return manage(obj.copy()).as<ast_node_user>();
}
checked::basic_map check(basic_map obj) {
return checked::manage(obj.copy());
}
basic_map uncheck(checked::basic_map obj) {
return manage(obj.copy());
}
checked::basic_set check(basic_set obj) {
return checked::manage(obj.copy());
}
basic_set uncheck(checked::basic_set obj) {
return manage(obj.copy());
}
checked::fixed_box check(fixed_box obj) {
return checked::manage(obj.copy());
}
fixed_box uncheck(checked::fixed_box obj) {
return manage(obj.copy());
}
checked::id check(id obj) {
return checked::manage(obj.copy());
}
id uncheck(checked::id obj) {
return manage(obj.copy());
}
checked::id_list check(id_list obj) {
return checked::manage(obj.copy());
}
id_list uncheck(checked::id_list obj) {
return manage(obj.copy());
}
checked::id_to_ast_expr check(id_to_ast_expr obj) {
return checked::manage(obj.copy());
}
id_to_ast_expr uncheck(checked::id_to_ast_expr obj) {
return manage(obj.copy());
}
checked::id_to_id check(id_to_id obj) {
return checked::manage(obj.copy());
}
id_to_id uncheck(checked::id_to_id obj) {
return manage(obj.copy());
}
checked::map check(map obj) {
return checked::manage(obj.copy());
}
map uncheck(checked::map obj) {
return manage(obj.copy());
}
checked::map_list check(map_list obj) {
return checked::manage(obj.copy());
}
map_list uncheck(checked::map_list obj) {
return manage(obj.copy());
}
checked::multi_aff check(multi_aff obj) {
return checked::manage(obj.copy());
}
multi_aff uncheck(checked::multi_aff obj) {
return manage(obj.copy());
}
checked::multi_id check(multi_id obj) {
return checked::manage(obj.copy());
}
multi_id uncheck(checked::multi_id obj) {
return manage(obj.copy());
}
checked::multi_pw_aff check(multi_pw_aff obj) {
return checked::manage(obj.copy());
}
multi_pw_aff uncheck(checked::multi_pw_aff obj) {
return manage(obj.copy());
}
checked::multi_union_pw_aff check(multi_union_pw_aff obj) {
return checked::manage(obj.copy());
}
multi_union_pw_aff uncheck(checked::multi_union_pw_aff obj) {
return manage(obj.copy());
}
checked::multi_val check(multi_val obj) {
return checked::manage(obj.copy());
}
multi_val uncheck(checked::multi_val obj) {
return manage(obj.copy());
}
checked::point check(point obj) {
return checked::manage(obj.copy());
}
point uncheck(checked::point obj) {
return manage(obj.copy());
}
checked::pw_aff check(pw_aff obj) {
return checked::manage(obj.copy());
}
pw_aff uncheck(checked::pw_aff obj) {
return manage(obj.copy());
}
checked::pw_aff_list check(pw_aff_list obj) {
return checked::manage(obj.copy());
}
pw_aff_list uncheck(checked::pw_aff_list obj) {
return manage(obj.copy());
}
checked::pw_multi_aff check(pw_multi_aff obj) {
return checked::manage(obj.copy());
}
pw_multi_aff uncheck(checked::pw_multi_aff obj) {
return manage(obj.copy());
}
checked::pw_multi_aff_list check(pw_multi_aff_list obj) {
return checked::manage(obj.copy());
}
pw_multi_aff_list uncheck(checked::pw_multi_aff_list obj) {
return manage(obj.copy());
}
checked::schedule check(schedule obj) {
return checked::manage(obj.copy());
}
schedule uncheck(checked::schedule obj) {
return manage(obj.copy());
}
checked::schedule_constraints check(schedule_constraints obj) {
return checked::manage(obj.copy());
}
schedule_constraints uncheck(checked::schedule_constraints obj) {
return manage(obj.copy());
}
checked::schedule_node check(schedule_node obj) {
return checked::manage(obj.copy());
}
schedule_node uncheck(checked::schedule_node obj) {
return manage(obj.copy());
}
checked::schedule_node_band check(schedule_node_band obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_band>();
}
schedule_node_band uncheck(checked::schedule_node_band obj) {
return manage(obj.copy()).as<schedule_node_band>();
}
checked::schedule_node_context check(schedule_node_context obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_context>();
}
schedule_node_context uncheck(checked::schedule_node_context obj) {
return manage(obj.copy()).as<schedule_node_context>();
}
checked::schedule_node_domain check(schedule_node_domain obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_domain>();
}
schedule_node_domain uncheck(checked::schedule_node_domain obj) {
return manage(obj.copy()).as<schedule_node_domain>();
}
checked::schedule_node_expansion check(schedule_node_expansion obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_expansion>();
}
schedule_node_expansion uncheck(checked::schedule_node_expansion obj) {
return manage(obj.copy()).as<schedule_node_expansion>();
}
checked::schedule_node_extension check(schedule_node_extension obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_extension>();
}
schedule_node_extension uncheck(checked::schedule_node_extension obj) {
return manage(obj.copy()).as<schedule_node_extension>();
}
checked::schedule_node_filter check(schedule_node_filter obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_filter>();
}
schedule_node_filter uncheck(checked::schedule_node_filter obj) {
return manage(obj.copy()).as<schedule_node_filter>();
}
checked::schedule_node_guard check(schedule_node_guard obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_guard>();
}
schedule_node_guard uncheck(checked::schedule_node_guard obj) {
return manage(obj.copy()).as<schedule_node_guard>();
}
checked::schedule_node_leaf check(schedule_node_leaf obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_leaf>();
}
schedule_node_leaf uncheck(checked::schedule_node_leaf obj) {
return manage(obj.copy()).as<schedule_node_leaf>();
}
checked::schedule_node_mark check(schedule_node_mark obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_mark>();
}
schedule_node_mark uncheck(checked::schedule_node_mark obj) {
return manage(obj.copy()).as<schedule_node_mark>();
}
checked::schedule_node_sequence check(schedule_node_sequence obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_sequence>();
}
schedule_node_sequence uncheck(checked::schedule_node_sequence obj) {
return manage(obj.copy()).as<schedule_node_sequence>();
}
checked::schedule_node_set check(schedule_node_set obj) {
return checked::manage(obj.copy()).as<checked::schedule_node_set>();
}
schedule_node_set uncheck(checked::schedule_node_set obj) {
return manage(obj.copy()).as<schedule_node_set>();
}
checked::set check(set obj) {
return checked::manage(obj.copy());
}
set uncheck(checked::set obj) {
return manage(obj.copy());
}
checked::set_list check(set_list obj) {
return checked::manage(obj.copy());
}
set_list uncheck(checked::set_list obj) {
return manage(obj.copy());
}
checked::space check(space obj) {
return checked::manage(obj.copy());
}
space uncheck(checked::space obj) {
return manage(obj.copy());
}
checked::union_access_info check(union_access_info obj) {
return checked::manage(obj.copy());
}
union_access_info uncheck(checked::union_access_info obj) {
return manage(obj.copy());
}
checked::union_flow check(union_flow obj) {
return checked::manage(obj.copy());
}
union_flow uncheck(checked::union_flow obj) {
return manage(obj.copy());
}
checked::union_map check(union_map obj) {
return checked::manage(obj.copy());
}
union_map uncheck(checked::union_map obj) {
return manage(obj.copy());
}
checked::union_pw_aff check(union_pw_aff obj) {
return checked::manage(obj.copy());
}
union_pw_aff uncheck(checked::union_pw_aff obj) {
return manage(obj.copy());
}
checked::union_pw_aff_list check(union_pw_aff_list obj) {
return checked::manage(obj.copy());
}
union_pw_aff_list uncheck(checked::union_pw_aff_list obj) {
return manage(obj.copy());
}
checked::union_pw_multi_aff check(union_pw_multi_aff obj) {
return checked::manage(obj.copy());
}
union_pw_multi_aff uncheck(checked::union_pw_multi_aff obj) {
return manage(obj.copy());
}
checked::union_set check(union_set obj) {
return checked::manage(obj.copy());
}
union_set uncheck(checked::union_set obj) {
return manage(obj.copy());
}
checked::union_set_list check(union_set_list obj) {
return checked::manage(obj.copy());
}
union_set_list uncheck(checked::union_set_list obj) {
return manage(obj.copy());
}
checked::val check(val obj) {
return checked::manage(obj.copy());
}
val uncheck(checked::val obj) {
return manage(obj.copy());
}
checked::val_list check(val_list obj) {
return checked::manage(obj.copy());
}
val_list uncheck(checked::val_list obj) {
return manage(obj.copy());
}
} // namespace isl
#endif /* ISL_CPP_CHECKED_CONVERSION */

File diff suppressed because it is too large Load Diff

30843
external/mit/isl/dist/include/isl/cpp.h vendored Normal file

File diff suppressed because it is too large Load Diff

265
external/mit/isl/dist/include/isl/ctx.h vendored Normal file
View File

@ -0,0 +1,265 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_CTX_H
#define ISL_CTX_H
#include <stdio.h>
#include <stdlib.h>
#include <isl/arg.h>
#ifndef __isl_give
#define __isl_give
#endif
#ifndef __isl_take
#define __isl_take
#endif
#ifndef __isl_keep
#define __isl_keep
#endif
#ifndef __isl_null
#define __isl_null
#endif
#ifndef __isl_export
#define __isl_export
#endif
#ifndef __isl_overload
#define __isl_overload
#endif
#ifndef __isl_constructor
#define __isl_constructor
#endif
#ifndef __isl_subclass
#define __isl_subclass(super)
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/* Nearly all isa functions require a struct isl_ctx allocated using
* isl_ctx_alloc. This ctx contains (or will contain) options that
* control the behavior of the library and some caches.
*
* An object allocated within a given ctx should never be used inside
* another ctx. Functions for moving objects from one ctx to another
* will be added as the need arises.
*
* A given context should only be used inside a single thread.
* A global context for synchronization between different threads
* as well as functions for moving a context to a different thread
* will be added as the need arises.
*
* If anything goes wrong (out of memory, failed assertion), then
* the library will currently simply abort. This will be made
* configurable in the future.
* Users of the library should expect functions that return
* a pointer to a structure, to return NULL, indicating failure.
* Any function accepting a pointer to a structure will treat
* a NULL argument as a failure, resulting in the function freeing
* the remaining structures (if any) and returning NULL itself
* (in case of pointer return type).
* The only exception is the isl_ctx argument, which should never be NULL.
*/
struct isl_stats {
long gbr_solved_lps;
};
enum isl_error {
isl_error_none = 0,
isl_error_abort,
isl_error_alloc,
isl_error_unknown,
isl_error_internal,
isl_error_invalid,
isl_error_quota,
isl_error_unsupported
};
typedef enum {
isl_stat_error = -1,
isl_stat_ok = 0
} isl_stat;
isl_stat isl_stat_non_null(void *obj);
typedef enum {
isl_bool_error = -1,
isl_bool_false = 0,
isl_bool_true = 1
} isl_bool;
isl_bool isl_bool_not(isl_bool b);
isl_bool isl_bool_ok(int b);
typedef int isl_size;
#define isl_size_error ((int) -1)
struct isl_ctx;
typedef struct isl_ctx isl_ctx;
/* Some helper macros */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define ISL_DEPRECATED __attribute__((__deprecated__))
#else
#define ISL_DEPRECATED
#endif
#define ISL_FL_INIT(l, f) (l) = (f) /* Specific flags location. */
#define ISL_FL_SET(l, f) ((l) |= (f))
#define ISL_FL_CLR(l, f) ((l) &= ~(f))
#define ISL_FL_ISSET(l, f) (!!((l) & (f)))
#define ISL_F_INIT(p, f) ISL_FL_INIT((p)->flags, f) /* Structure element flags. */
#define ISL_F_SET(p, f) ISL_FL_SET((p)->flags, f)
#define ISL_F_CLR(p, f) ISL_FL_CLR((p)->flags, f)
#define ISL_F_ISSET(p, f) ISL_FL_ISSET((p)->flags, f)
void *isl_malloc_or_die(isl_ctx *ctx, size_t size);
void *isl_calloc_or_die(isl_ctx *ctx, size_t nmemb, size_t size);
void *isl_realloc_or_die(isl_ctx *ctx, void *ptr, size_t size);
#define isl_alloc(ctx,type,size) ((type *)isl_malloc_or_die(ctx, size))
#define isl_calloc(ctx,type,size) ((type *)isl_calloc_or_die(ctx,\
1, size))
#define isl_realloc(ctx,ptr,type,size) ((type *)isl_realloc_or_die(ctx,\
ptr, size))
#define isl_alloc_type(ctx,type) isl_alloc(ctx,type,sizeof(type))
#define isl_calloc_type(ctx,type) isl_calloc(ctx,type,sizeof(type))
#define isl_realloc_type(ctx,ptr,type) isl_realloc(ctx,ptr,type,sizeof(type))
#define isl_alloc_array(ctx,type,n) isl_alloc(ctx,type,(n)*sizeof(type))
#define isl_calloc_array(ctx,type,n) ((type *)isl_calloc_or_die(ctx,\
n, sizeof(type)))
#define isl_realloc_array(ctx,ptr,type,n) \
isl_realloc(ctx,ptr,type,(n)*sizeof(type))
#define isl_die(ctx,errno,msg,code) \
do { \
isl_handle_error(ctx, errno, msg, __FILE__, __LINE__); \
code; \
} while (0)
void isl_handle_error(isl_ctx *ctx, enum isl_error error, const char *msg,
const char *file, int line);
#define isl_assert4(ctx,test,code,errno) \
do { \
if (test) \
break; \
isl_die(ctx, errno, "Assertion \"" #test "\" failed", code); \
} while (0)
#define isl_assert(ctx,test,code) \
isl_assert4(ctx,test,code,isl_error_unknown)
#define isl_min(a,b) ((a < b) ? (a) : (b))
/* struct isl_ctx functions */
struct isl_options *isl_ctx_options(isl_ctx *ctx);
isl_ctx *isl_ctx_alloc_with_options(struct isl_args *args,
__isl_take void *opt);
isl_ctx *isl_ctx_alloc(void);
void *isl_ctx_peek_options(isl_ctx *ctx, struct isl_args *args);
int isl_ctx_parse_options(isl_ctx *ctx, int argc, char **argv, unsigned flags);
void isl_ctx_ref(struct isl_ctx *ctx);
void isl_ctx_deref(struct isl_ctx *ctx);
void isl_ctx_free(isl_ctx *ctx);
void isl_ctx_abort(isl_ctx *ctx);
void isl_ctx_resume(isl_ctx *ctx);
int isl_ctx_aborted(isl_ctx *ctx);
void isl_ctx_set_max_operations(isl_ctx *ctx, unsigned long max_operations);
unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
void isl_ctx_reset_operations(isl_ctx *ctx);
#define ISL_ARG_CTX_DECL(prefix,st,args) \
st *isl_ctx_peek_ ## prefix(isl_ctx *ctx);
#define ISL_ARG_CTX_DEF(prefix,st,args) \
st *isl_ctx_peek_ ## prefix(isl_ctx *ctx) \
{ \
return (st *)isl_ctx_peek_options(ctx, &(args)); \
}
#define ISL_CTX_GET_INT_DEF(prefix,st,args,field) \
int prefix ## _get_ ## field(isl_ctx *ctx) \
{ \
st *options; \
options = isl_ctx_peek_ ## prefix(ctx); \
if (!options) \
isl_die(ctx, isl_error_invalid, \
"isl_ctx does not reference " #prefix, \
return -1); \
return options->field; \
}
#define ISL_CTX_SET_INT_DEF(prefix,st,args,field) \
isl_stat prefix ## _set_ ## field(isl_ctx *ctx, int val) \
{ \
st *options; \
options = isl_ctx_peek_ ## prefix(ctx); \
if (!options) \
isl_die(ctx, isl_error_invalid, \
"isl_ctx does not reference " #prefix, \
return isl_stat_error); \
options->field = val; \
return isl_stat_ok; \
}
#define ISL_CTX_GET_STR_DEF(prefix,st,args,field) \
const char *prefix ## _get_ ## field(isl_ctx *ctx) \
{ \
st *options; \
options = isl_ctx_peek_ ## prefix(ctx); \
if (!options) \
isl_die(ctx, isl_error_invalid, \
"isl_ctx does not reference " #prefix, \
return NULL); \
return options->field; \
}
#define ISL_CTX_SET_STR_DEF(prefix,st,args,field) \
isl_stat prefix ## _set_ ## field(isl_ctx *ctx, const char *val) \
{ \
st *options; \
options = isl_ctx_peek_ ## prefix(ctx); \
if (!options) \
isl_die(ctx, isl_error_invalid, \
"isl_ctx does not reference " #prefix, \
return isl_stat_error); \
if (!val) \
return isl_stat_error; \
free(options->field); \
options->field = strdup(val); \
if (!options->field) \
return isl_stat_error; \
return isl_stat_ok; \
}
#define ISL_CTX_GET_BOOL_DEF(prefix,st,args,field) \
ISL_CTX_GET_INT_DEF(prefix,st,args,field)
#define ISL_CTX_SET_BOOL_DEF(prefix,st,args,field) \
ISL_CTX_SET_INT_DEF(prefix,st,args,field)
#define ISL_CTX_GET_CHOICE_DEF(prefix,st,args,field) \
ISL_CTX_GET_INT_DEF(prefix,st,args,field)
#define ISL_CTX_SET_CHOICE_DEF(prefix,st,args,field) \
ISL_CTX_SET_INT_DEF(prefix,st,args,field)
enum isl_error isl_ctx_last_error(isl_ctx *ctx);
const char *isl_ctx_last_error_msg(isl_ctx *ctx);
const char *isl_ctx_last_error_file(isl_ctx *ctx);
int isl_ctx_last_error_line(isl_ctx *ctx);
void isl_ctx_reset_error(isl_ctx *ctx);
void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,46 @@
/*
* Use of this software is governed by the MIT license
*/
#ifndef ISL_FIXED_BOX_H
#define ISL_FIXED_BOX_H
#include <isl/ctx.h>
#include <isl/val_type.h>
#include <isl/space_type.h>
#include <isl/aff_type.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_export isl_fixed_box;
typedef struct isl_fixed_box isl_fixed_box;
isl_ctx *isl_fixed_box_get_ctx(__isl_keep isl_fixed_box *box);
__isl_export
__isl_give isl_space *isl_fixed_box_get_space(__isl_keep isl_fixed_box *box);
__isl_export
isl_bool isl_fixed_box_is_valid(__isl_keep isl_fixed_box *box);
__isl_export
__isl_give isl_multi_aff *isl_fixed_box_get_offset(
__isl_keep isl_fixed_box *box);
__isl_export
__isl_give isl_multi_val *isl_fixed_box_get_size(__isl_keep isl_fixed_box *box);
__isl_give isl_fixed_box *isl_fixed_box_copy(__isl_keep isl_fixed_box *box);
__isl_null isl_fixed_box *isl_fixed_box_free(__isl_take isl_fixed_box *box);
__isl_constructor
__isl_give isl_fixed_box *isl_fixed_box_read_from_str(isl_ctx *ctx,
const char *str);
__isl_give isl_printer *isl_printer_print_fixed_box(
__isl_take isl_printer *p, __isl_keep isl_fixed_box *box);
__isl_give char *isl_fixed_box_to_str(__isl_keep isl_fixed_box *box);
void isl_fixed_box_dump(__isl_keep isl_fixed_box *box);
#if defined(__cplusplus)
}
#endif
#endif

156
external/mit/isl/dist/include/isl/flow.h vendored Normal file
View File

@ -0,0 +1,156 @@
#ifndef ISL_FLOW_H
#define ISL_FLOW_H
#include <stdio.h>
#include <isl/set_type.h>
#include <isl/map_type.h>
#include <isl/union_set_type.h>
#include <isl/union_map_type.h>
#include <isl/schedule.h>
#include <isl/printer.h>
#if defined(__cplusplus)
extern "C" {
#endif
/* Let n (>= 0) be the number of iterators shared by first and second.
* If first precedes second textually return 2 * n + 1,
* otherwise return 2 * n.
*/
typedef int (*isl_access_level_before)(void *first, void *second);
struct isl_restriction;
typedef struct isl_restriction isl_restriction;
__isl_null isl_restriction *isl_restriction_free(
__isl_take isl_restriction *restr);
__isl_give isl_restriction *isl_restriction_empty(
__isl_take isl_map *source_map);
__isl_give isl_restriction *isl_restriction_none(
__isl_take isl_map *source_map);
__isl_give isl_restriction *isl_restriction_input(
__isl_take isl_set *source_restr, __isl_take isl_set *sink_restr);
__isl_give isl_restriction *isl_restriction_output(
__isl_take isl_set *source_restr);
isl_ctx *isl_restriction_get_ctx(__isl_keep isl_restriction *restr);
typedef __isl_give isl_restriction *(*isl_access_restrict)(
__isl_keep isl_map *source_map, __isl_keep isl_set *sink,
void *source_user, void *user);
struct isl_access_info;
typedef struct isl_access_info isl_access_info;
struct isl_flow;
typedef struct isl_flow isl_flow;
__isl_give isl_access_info *isl_access_info_alloc(__isl_take isl_map *sink,
void *sink_user, isl_access_level_before fn, int max_source);
__isl_give isl_access_info *isl_access_info_set_restrict(
__isl_take isl_access_info *acc, isl_access_restrict fn, void *user);
__isl_give isl_access_info *isl_access_info_add_source(
__isl_take isl_access_info *acc, __isl_take isl_map *source,
int must, void *source_user);
__isl_null isl_access_info *isl_access_info_free(
__isl_take isl_access_info *acc);
isl_ctx *isl_access_info_get_ctx(__isl_keep isl_access_info *acc);
__isl_give isl_flow *isl_access_info_compute_flow(__isl_take isl_access_info *acc);
isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
isl_stat (*fn)(__isl_take isl_map *dep, int must, void *dep_user,
void *user),
void *user);
__isl_give isl_map *isl_flow_get_no_source(__isl_keep isl_flow *deps, int must);
__isl_null isl_flow *isl_flow_free(__isl_take isl_flow *deps);
isl_ctx *isl_flow_get_ctx(__isl_keep isl_flow *deps);
struct __isl_export isl_union_access_info;
typedef struct isl_union_access_info isl_union_access_info;
struct __isl_export isl_union_flow;
typedef struct isl_union_flow isl_union_flow;
__isl_constructor
__isl_give isl_union_access_info *isl_union_access_info_from_sink(
__isl_take isl_union_map *sink);
__isl_export
__isl_give isl_union_access_info *isl_union_access_info_set_must_source(
__isl_take isl_union_access_info *access,
__isl_take isl_union_map *must_source);
__isl_export
__isl_give isl_union_access_info *isl_union_access_info_set_may_source(
__isl_take isl_union_access_info *access,
__isl_take isl_union_map *may_source);
__isl_export
__isl_give isl_union_access_info *isl_union_access_info_set_kill(
__isl_take isl_union_access_info *access,
__isl_take isl_union_map *kill);
__isl_export
__isl_give isl_union_access_info *isl_union_access_info_set_schedule(
__isl_take isl_union_access_info *access,
__isl_take isl_schedule *schedule);
__isl_export
__isl_give isl_union_access_info *isl_union_access_info_set_schedule_map(
__isl_take isl_union_access_info *access,
__isl_take isl_union_map *schedule_map);
__isl_give isl_union_access_info *isl_union_access_info_copy(
__isl_keep isl_union_access_info *access);
__isl_null isl_union_access_info *isl_union_access_info_free(
__isl_take isl_union_access_info *access);
isl_ctx *isl_union_access_info_get_ctx(
__isl_keep isl_union_access_info *access);
__isl_give isl_union_access_info *isl_union_access_info_read_from_file(
isl_ctx *ctx, FILE *input);
__isl_give isl_printer *isl_printer_print_union_access_info(
__isl_take isl_printer *p, __isl_keep isl_union_access_info *access);
__isl_give char *isl_union_access_info_to_str(
__isl_keep isl_union_access_info *access);
__isl_export
__isl_give isl_union_flow *isl_union_access_info_compute_flow(
__isl_take isl_union_access_info *access);
isl_ctx *isl_union_flow_get_ctx(__isl_keep isl_union_flow *flow);
__isl_give isl_union_flow *isl_union_flow_copy(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_must_dependence(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_may_dependence(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_full_must_dependence(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_full_may_dependence(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_must_no_source(
__isl_keep isl_union_flow *flow);
__isl_export
__isl_give isl_union_map *isl_union_flow_get_may_no_source(
__isl_keep isl_union_flow *flow);
__isl_null isl_union_flow *isl_union_flow_free(__isl_take isl_union_flow *flow);
__isl_give isl_printer *isl_printer_print_union_flow(
__isl_take isl_printer *p, __isl_keep isl_union_flow *flow);
__isl_give char *isl_union_flow_to_str(__isl_keep isl_union_flow *flow);
int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
__isl_take isl_union_map *must_source,
__isl_take isl_union_map *may_source,
__isl_take isl_union_map *schedule,
__isl_give isl_union_map **must_dep, __isl_give isl_union_map **may_dep,
__isl_give isl_union_map **must_no_source,
__isl_give isl_union_map **may_no_source);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,80 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_HASH_H
#define ISL_HASH_H
#include <stdlib.h>
#include <isl/stdint.h>
#include <isl/ctx.h>
#if defined(__cplusplus)
extern "C" {
#endif
#define isl_hash_init() (2166136261u)
#define isl_hash_byte(h,b) do { \
h *= 16777619; \
h ^= b; \
} while(0)
#define isl_hash_hash(h,h2) \
do { \
isl_hash_byte(h, (h2) & 0xFF); \
isl_hash_byte(h, ((h2) >> 8) & 0xFF); \
isl_hash_byte(h, ((h2) >> 16) & 0xFF); \
isl_hash_byte(h, ((h2) >> 24) & 0xFF); \
} while(0)
#define isl_hash_bits(h,bits) \
((bits) == 32) ? (h) : \
((bits) >= 16) ? \
((h) >> (bits)) ^ ((h) & (((uint32_t)1 << (bits)) - 1)) : \
(((h) >> (bits)) ^ (h)) & (((uint32_t)1 << (bits)) - 1)
uint32_t isl_hash_string(uint32_t hash, const char *s);
uint32_t isl_hash_mem(uint32_t hash, const void *p, size_t len);
#define isl_hash_builtin(h,l) isl_hash_mem(h, &l, sizeof(l))
struct isl_hash_table_entry
{
uint32_t hash;
void *data;
};
struct isl_hash_table {
int bits;
int n;
struct isl_hash_table_entry *entries;
};
struct isl_hash_table *isl_hash_table_alloc(struct isl_ctx *ctx, int min_size);
void isl_hash_table_free(struct isl_ctx *ctx, struct isl_hash_table *table);
int isl_hash_table_init(struct isl_ctx *ctx, struct isl_hash_table *table,
int min_size);
void isl_hash_table_clear(struct isl_hash_table *table);
extern struct isl_hash_table_entry *isl_hash_table_entry_none;
struct isl_hash_table_entry *isl_hash_table_find(struct isl_ctx *ctx,
struct isl_hash_table *table,
uint32_t key_hash,
isl_bool (*eq)(const void *entry, const void *val),
const void *val, int reserve);
isl_stat isl_hash_table_foreach(isl_ctx *ctx, struct isl_hash_table *table,
isl_stat (*fn)(void **entry, void *user), void *user);
isl_bool isl_hash_table_every(isl_ctx *ctx, struct isl_hash_table *table,
isl_bool (*test)(void **entry, void *user), void *user);
void isl_hash_table_remove(struct isl_ctx *ctx,
struct isl_hash_table *table,
struct isl_hash_table_entry *entry);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,73 @@
#include <isl/ctx.h>
#include <isl/maybe.h>
#include <isl/printer.h>
#if defined(__cplusplus)
extern "C" {
#endif
#define ISL_xCAT(A,B) A ## B
#define ISL_CAT(A,B) ISL_xCAT(A,B)
#define ISL_xFN(TYPE,NAME) TYPE ## _ ## NAME
#define ISL_FN(TYPE,NAME) ISL_xFN(TYPE,NAME)
struct __isl_export ISL_HMAP;
typedef struct ISL_HMAP ISL_HMAP;
__isl_constructor
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,alloc)(isl_ctx *ctx, int min_size);
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,copy)(__isl_keep ISL_HMAP *hmap);
__isl_null ISL_HMAP *ISL_FN(ISL_HMAP,free)(__isl_take ISL_HMAP *hmap);
isl_ctx *ISL_FN(ISL_HMAP,get_ctx)(__isl_keep ISL_HMAP *hmap);
__isl_give ISL_MAYBE(ISL_VAL) ISL_FN(ISL_HMAP,try_get)(
__isl_keep ISL_HMAP *hmap, __isl_keep ISL_KEY *key);
isl_bool ISL_FN(ISL_HMAP,has)(__isl_keep ISL_HMAP *hmap,
__isl_keep ISL_KEY *key);
__isl_give ISL_VAL *ISL_FN(ISL_HMAP,get)(__isl_keep ISL_HMAP *hmap,
__isl_take ISL_KEY *key);
__isl_export
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,set)(__isl_take ISL_HMAP *hmap,
__isl_take ISL_KEY *key, __isl_take ISL_VAL *val);
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,drop)(__isl_take ISL_HMAP *hmap,
__isl_take ISL_KEY *key);
isl_stat ISL_FN(ISL_HMAP,foreach)(__isl_keep ISL_HMAP *hmap,
isl_stat (*fn)(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val,
void *user),
void *user);
isl_bool ISL_FN(ISL_HMAP,every)(__isl_keep ISL_HMAP *hmap,
isl_bool (*test)(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val,
void *user),
void *user);
#ifdef ISL_HMAP_IS_EQUAL
__isl_export
isl_bool ISL_HMAP_IS_EQUAL(__isl_keep ISL_HMAP *hmap1,
__isl_keep ISL_HMAP *hmap2);
#endif
#ifdef ISL_HMAP_HAVE_READ_FROM_STR
__isl_constructor
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,read_from_str)(isl_ctx *ctx,
const char *str);
#endif
__isl_give char *ISL_FN(ISL_HMAP,to_str)(__isl_keep ISL_HMAP *hmap);
__isl_give isl_printer *ISL_FN(isl_printer_print,ISL_HMAP_SUFFIX)(
__isl_take isl_printer *p, __isl_keep ISL_HMAP *hmap);
void ISL_FN(ISL_HMAP,dump)(__isl_keep ISL_HMAP *hmap);
#undef ISL_xCAT
#undef ISL_CAT
#undef ISL_KEY
#undef ISL_VAL
#undef ISL_xFN
#undef ISL_FN
#undef ISL_xHMAP
#undef ISL_yHMAP
#undef ISL_HMAP
#if defined(__cplusplus)
}
#endif

View File

@ -0,0 +1,583 @@
/*
* Copyright 2011 INRIA Saclay
* Copyright 2013 Ecole Normale Superieure
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
* Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
* 91893 Orsay, France
* and Ecole Normale Superieure, 45 rue dUlm, 75230 Paris, France
*/
#include <isl/ctx.h>
#include <isl/hash.h>
#include <isl/stream.h>
#define ISL_xCAT(A,B) A ## B
#define ISL_CAT(A,B) ISL_xCAT(A,B)
#define ISL_xFN(TYPE,NAME) TYPE ## _ ## NAME
#define ISL_FN(TYPE,NAME) ISL_xFN(TYPE,NAME)
#define ISL_xS(TYPE1,TYPE2,NAME) struct isl_ ## TYPE1 ## _ ## TYPE2 ## _ ## NAME
#define ISL_yS(TYPE1,TYPE2,NAME) ISL_xS(TYPE1,TYPE2,NAME)
#define ISL_S(NAME) ISL_yS(ISL_KEY,ISL_VAL,NAME)
struct ISL_HMAP {
int ref;
isl_ctx *ctx;
struct isl_hash_table table;
};
ISL_S(pair) {
ISL_KEY *key;
ISL_VAL *val;
};
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,alloc)(isl_ctx *ctx, int min_size)
{
ISL_HMAP *hmap;
hmap = isl_calloc_type(ctx, ISL_HMAP);
if (!hmap)
return NULL;
hmap->ctx = ctx;
isl_ctx_ref(ctx);
hmap->ref = 1;
if (isl_hash_table_init(ctx, &hmap->table, min_size) < 0)
return ISL_FN(ISL_HMAP,free)(hmap);
return hmap;
}
static isl_stat free_pair(void **entry, void *user)
{
ISL_S(pair) *pair = *entry;
ISL_FN(ISL_KEY,free)(pair->key);
ISL_FN(ISL_VAL,free)(pair->val);
free(pair);
*entry = NULL;
return isl_stat_ok;
}
__isl_null ISL_HMAP *ISL_FN(ISL_HMAP,free)(__isl_take ISL_HMAP *hmap)
{
if (!hmap)
return NULL;
if (--hmap->ref > 0)
return NULL;
isl_hash_table_foreach(hmap->ctx, &hmap->table, &free_pair, NULL);
isl_hash_table_clear(&hmap->table);
isl_ctx_deref(hmap->ctx);
free(hmap);
return NULL;
}
isl_ctx *ISL_FN(ISL_HMAP,get_ctx)(__isl_keep ISL_HMAP *hmap)
{
return hmap ? hmap->ctx : NULL;
}
/* Add a mapping from "key" to "val" to the associative array
* pointed to by user.
*/
static isl_stat add_key_val(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val,
void *user)
{
ISL_HMAP **hmap = (ISL_HMAP **) user;
*hmap = ISL_FN(ISL_HMAP,set)(*hmap, key, val);
if (!*hmap)
return isl_stat_error;
return isl_stat_ok;
}
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,dup)(__isl_keep ISL_HMAP *hmap)
{
ISL_HMAP *dup;
if (!hmap)
return NULL;
dup = ISL_FN(ISL_HMAP,alloc)(hmap->ctx, hmap->table.n);
if (ISL_FN(ISL_HMAP,foreach)(hmap, &add_key_val, &dup) < 0)
return ISL_FN(ISL_HMAP,free)(dup);
return dup;
}
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,cow)(__isl_take ISL_HMAP *hmap)
{
if (!hmap)
return NULL;
if (hmap->ref == 1)
return hmap;
hmap->ref--;
return ISL_FN(ISL_HMAP,dup)(hmap);
}
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,copy)(__isl_keep ISL_HMAP *hmap)
{
if (!hmap)
return NULL;
hmap->ref++;
return hmap;
}
static isl_bool has_key(const void *entry, const void *c_key)
{
const ISL_S(pair) *pair = entry;
ISL_KEY *key = (ISL_KEY *) c_key;
return ISL_KEY_IS_EQUAL(pair->key, key);
}
/* If "hmap" contains a value associated to "key", then return
* (isl_bool_true, copy of value).
* Otherwise, return
* (isl_bool_false, NULL).
* If an error occurs, then return
* (isl_bool_error, NULL).
*/
__isl_give ISL_MAYBE(ISL_VAL) ISL_FN(ISL_HMAP,try_get)(
__isl_keep ISL_HMAP *hmap, __isl_keep ISL_KEY *key)
{
struct isl_hash_table_entry *entry;
ISL_S(pair) *pair;
uint32_t hash;
ISL_MAYBE(ISL_VAL) res = { isl_bool_false, NULL };
if (!hmap || !key)
goto error;
hash = ISL_FN(ISL_KEY,get_hash)(key);
entry = isl_hash_table_find(hmap->ctx, &hmap->table, hash,
&has_key, key, 0);
if (!entry)
goto error;
if (entry == isl_hash_table_entry_none)
return res;
pair = entry->data;
res.valid = isl_bool_true;
res.value = ISL_FN(ISL_VAL,copy)(pair->val);
if (!res.value)
res.valid = isl_bool_error;
return res;
error:
res.valid = isl_bool_error;
res.value = NULL;
return res;
}
/* If "hmap" contains a value associated to "key", then return
* isl_bool_true. Otherwise, return isl_bool_false.
* Return isl_bool_error on error.
*/
isl_bool ISL_FN(ISL_HMAP,has)(__isl_keep ISL_HMAP *hmap,
__isl_keep ISL_KEY *key)
{
ISL_MAYBE(ISL_VAL) res;
res = ISL_FN(ISL_HMAP,try_get)(hmap, key);
ISL_FN(ISL_VAL,free)(res.value);
return res.valid;
}
/* If "hmap" contains a value associated to "key", then return
* a copy of that value. Otherwise, return NULL.
* Return NULL on error.
*/
__isl_give ISL_VAL *ISL_FN(ISL_HMAP,get)(__isl_keep ISL_HMAP *hmap,
__isl_take ISL_KEY *key)
{
ISL_VAL *res;
res = ISL_FN(ISL_HMAP,try_get)(hmap, key).value;
ISL_FN(ISL_KEY,free)(key);
return res;
}
/* Remove the mapping between "key" and its associated value (if any)
* from "hmap".
*
* If "key" is not mapped to anything, then we leave "hmap" untouched"
*/
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,drop)(__isl_take ISL_HMAP *hmap,
__isl_take ISL_KEY *key)
{
struct isl_hash_table_entry *entry;
ISL_S(pair) *pair;
uint32_t hash;
if (!hmap || !key)
goto error;
hash = ISL_FN(ISL_KEY,get_hash)(key);
entry = isl_hash_table_find(hmap->ctx, &hmap->table, hash,
&has_key, key, 0);
if (!entry)
goto error;
if (entry == isl_hash_table_entry_none) {
ISL_FN(ISL_KEY,free)(key);
return hmap;
}
hmap = ISL_FN(ISL_HMAP,cow)(hmap);
if (!hmap)
goto error;
entry = isl_hash_table_find(hmap->ctx, &hmap->table, hash,
&has_key, key, 0);
ISL_FN(ISL_KEY,free)(key);
if (!entry)
return ISL_FN(ISL_HMAP,free)(hmap);
if (entry == isl_hash_table_entry_none)
isl_die(hmap->ctx, isl_error_internal,
"missing entry" , return ISL_FN(ISL_HMAP,free)(hmap));
pair = entry->data;
isl_hash_table_remove(hmap->ctx, &hmap->table, entry);
ISL_FN(ISL_KEY,free)(pair->key);
ISL_FN(ISL_VAL,free)(pair->val);
free(pair);
return hmap;
error:
ISL_FN(ISL_KEY,free)(key);
ISL_FN(ISL_HMAP,free)(hmap);
return NULL;
}
/* Add a mapping from "key" to "val" to "hmap".
* If "key" was already mapped to something else, then that mapping
* is replaced.
* If key happened to be mapped to "val" already, then we leave
* "hmap" untouched.
*/
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,set)(__isl_take ISL_HMAP *hmap,
__isl_take ISL_KEY *key, __isl_take ISL_VAL *val)
{
struct isl_hash_table_entry *entry;
ISL_S(pair) *pair;
uint32_t hash;
if (!hmap || !key || !val)
goto error;
hash = ISL_FN(ISL_KEY,get_hash)(key);
entry = isl_hash_table_find(hmap->ctx, &hmap->table, hash,
&has_key, key, 0);
if (!entry)
goto error;
if (entry != isl_hash_table_entry_none) {
isl_bool equal;
pair = entry->data;
equal = ISL_VAL_IS_EQUAL(pair->val, val);
if (equal < 0)
goto error;
if (equal) {
ISL_FN(ISL_KEY,free)(key);
ISL_FN(ISL_VAL,free)(val);
return hmap;
}
}
hmap = ISL_FN(ISL_HMAP,cow)(hmap);
if (!hmap)
goto error;
entry = isl_hash_table_find(hmap->ctx, &hmap->table, hash,
&has_key, key, 1);
if (!entry)
goto error;
if (entry->data) {
pair = entry->data;
ISL_FN(ISL_VAL,free)(pair->val);
pair->val = val;
ISL_FN(ISL_KEY,free)(key);
return hmap;
}
pair = isl_alloc_type(hmap->ctx, ISL_S(pair));
if (!pair)
goto error;
entry->data = pair;
pair->key = key;
pair->val = val;
return hmap;
error:
ISL_FN(ISL_KEY,free)(key);
ISL_FN(ISL_VAL,free)(val);
return ISL_FN(ISL_HMAP,free)(hmap);
}
/* Internal data structure for isl_*_to_*_foreach.
*
* fn is the function that should be called on each entry.
* user is the user-specified final argument to fn.
*/
ISL_S(foreach_data) {
isl_stat (*fn)(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val,
void *user);
void *user;
};
/* Call data->fn on a copy of the key and value in *entry.
*/
static isl_stat call_on_copy(void **entry, void *user)
{
ISL_S(pair) *pair = *entry;
ISL_S(foreach_data) *data = (ISL_S(foreach_data) *) user;
return data->fn(ISL_FN(ISL_KEY,copy)(pair->key),
ISL_FN(ISL_VAL,copy)(pair->val), data->user);
}
/* Call "fn" on each pair of key and value in "hmap".
*/
isl_stat ISL_FN(ISL_HMAP,foreach)(__isl_keep ISL_HMAP *hmap,
isl_stat (*fn)(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val,
void *user),
void *user)
{
ISL_S(foreach_data) data = { fn, user };
if (!hmap)
return isl_stat_error;
return isl_hash_table_foreach(hmap->ctx, &hmap->table,
&call_on_copy, &data);
}
/* Internal data structure for isl_*_to_*_every.
*
* "test" is the function that should be called on each entry,
* until any invocation returns isl_bool_false.
* "test_user" is the user-specified final argument to "test".
*/
ISL_S(every_data) {
isl_bool (*test)(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val,
void *user);
void *test_user;
};
/* Call data->test on the key and value in *entry.
*/
static isl_bool call_on_pair(void **entry, void *user)
{
ISL_S(pair) *pair = *entry;
ISL_S(every_data) *data = (ISL_S(every_data) *) user;
return data->test(pair->key, pair->val, data->test_user);
}
/* Does "test" succeed on every entry of "hmap"?
*/
isl_bool ISL_FN(ISL_HMAP,every)(__isl_keep ISL_HMAP *hmap,
isl_bool (*test)(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val,
void *user),
void *user)
{
ISL_S(every_data) data = { test, user };
if (!hmap)
return isl_bool_error;
return isl_hash_table_every(hmap->ctx, &hmap->table,
&call_on_pair, &data);
}
#ifdef ISL_HMAP_IS_EQUAL
/* Does "hmap" have an entry with key "key" and value "val"?
*/
static isl_bool has_entry(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val,
void *user)
{
ISL_HMAP *hmap = user;
ISL_MAYBE(ISL_VAL) maybe_val;
isl_bool equal;
maybe_val = ISL_FN(ISL_HMAP,try_get)(hmap, key);
if (maybe_val.valid < 0 || !maybe_val.valid)
return maybe_val.valid;
equal = ISL_VAL_IS_EQUAL(maybe_val.value, val);
ISL_FN(ISL_VAL,free)(maybe_val.value);
return equal;
}
/* Is "hmap1" (obviously) equal to "hmap2"?
*
* In particular, do the two associative arrays have
* the same number of entries and does every entry of the first
* also appear in the second?
*/
isl_bool ISL_HMAP_IS_EQUAL(__isl_keep ISL_HMAP *hmap1,
__isl_keep ISL_HMAP *hmap2)
{
if (!hmap1 || !hmap2)
return isl_bool_error;
if (hmap1 == hmap2)
return isl_bool_true;
if (hmap1->table.n != hmap2->table.n)
return isl_bool_false;
return ISL_FN(ISL_HMAP,every)(hmap1, &has_entry, hmap2);
}
#endif
/* Internal data structure for print_pair.
*
* p is the printer on which the associative array is being printed.
* first is set if the current key-value pair is the first to be printed.
*/
ISL_S(print_data) {
isl_printer *p;
int first;
};
/* Print the given key-value pair to data->p.
*/
static isl_stat print_pair(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val,
void *user)
{
ISL_S(print_data) *data = user;
if (!data->first)
data->p = isl_printer_print_str(data->p, ", ");
data->p = ISL_KEY_PRINT(data->p, key);
data->p = isl_printer_print_str(data->p, ": ");
data->p = ISL_VAL_PRINT(data->p, val);
data->first = 0;
ISL_FN(ISL_KEY,free)(key);
ISL_FN(ISL_VAL,free)(val);
return isl_stat_ok;
}
/* Print the associative array to "p".
*/
__isl_give isl_printer *ISL_FN(isl_printer_print,ISL_HMAP_SUFFIX)(
__isl_take isl_printer *p, __isl_keep ISL_HMAP *hmap)
{
ISL_S(print_data) data;
if (!p || !hmap)
return isl_printer_free(p);
p = isl_printer_print_str(p, "{");
data.p = p;
data.first = 1;
if (ISL_FN(ISL_HMAP,foreach)(hmap, &print_pair, &data) < 0)
data.p = isl_printer_free(data.p);
p = data.p;
p = isl_printer_print_str(p, "}");
return p;
}
void ISL_FN(ISL_HMAP,dump)(__isl_keep ISL_HMAP *hmap)
{
isl_printer *printer;
if (!hmap)
return;
printer = isl_printer_to_file(ISL_FN(ISL_HMAP,get_ctx)(hmap), stderr);
printer = ISL_FN(isl_printer_print,ISL_HMAP_SUFFIX)(printer, hmap);
printer = isl_printer_end_line(printer);
isl_printer_free(printer);
}
/* Return a string representation of "hmap".
*/
__isl_give char *ISL_FN(ISL_HMAP,to_str)(__isl_keep ISL_HMAP *hmap)
{
isl_printer *p;
char *s;
if (!hmap)
return NULL;
p = isl_printer_to_str(ISL_FN(ISL_HMAP,get_ctx)(hmap));
p = ISL_FN(isl_printer_print,ISL_HMAP_SUFFIX)(p, hmap);
s = isl_printer_get_str(p);
isl_printer_free(p);
return s;
}
#ifdef ISL_HMAP_HAVE_READ_FROM_STR
/* Read an associative array from "s".
* The input format corresponds to the way associative arrays are printed
* by isl_printer_print_*_to_*.
* In particular, each key-value pair is separated by a colon,
* the key-value pairs are separated by a comma and
* the entire associative array is surrounded by braces.
*/
__isl_give ISL_HMAP *ISL_FN(isl_stream_read,ISL_HMAP_SUFFIX)(isl_stream *s)
{
isl_ctx *ctx;
ISL_HMAP *hmap;
if (!s)
return NULL;
ctx = isl_stream_get_ctx(s);
hmap = ISL_FN(ISL_HMAP,alloc)(ctx, 0);
if (!hmap)
return NULL;
if (isl_stream_eat(s, '{') < 0)
return ISL_FN(ISL_HMAP,free)(hmap);
if (isl_stream_eat_if_available(s, '}'))
return hmap;
do {
ISL_KEY *key;
ISL_VAL *val = NULL;
key = ISL_KEY_READ(s);
if (isl_stream_eat(s, ':') >= 0)
val = ISL_VAL_READ(s);
hmap = ISL_FN(ISL_HMAP,set)(hmap, key, val);
if (!hmap)
return NULL;
} while (isl_stream_eat_if_available(s, ','));
if (isl_stream_eat(s, '}') < 0)
return ISL_FN(ISL_HMAP,free)(hmap);
return hmap;
}
/* Read an associative array from the string "str".
* The input format corresponds to the way associative arrays are printed
* by isl_printer_print_*_to_*.
* In particular, each key-value pair is separated by a colon,
* the key-value pairs are separated by a comma and
* the entire associative array is surrounded by braces.
*/
__isl_give ISL_HMAP *ISL_FN(ISL_HMAP,read_from_str)(isl_ctx *ctx,
const char *str)
{
ISL_HMAP *hmap;
isl_stream *s;
s = isl_stream_new_str(ctx, str);
if (!s)
return NULL;
hmap = ISL_FN(isl_stream_read,ISL_HMAP_SUFFIX)(s);
isl_stream_free(s);
return hmap;
}
#endif

55
external/mit/isl/dist/include/isl/id.h vendored Normal file
View File

@ -0,0 +1,55 @@
#ifndef ISL_ID_H
#define ISL_ID_H
#include <isl/ctx.h>
#include <isl/id_type.h>
#include <isl/list.h>
#include <isl/multi.h>
#include <isl/printer_type.h>
#include <isl/stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
ISL_DECLARE_EXPORTED_LIST_FN(id)
ISL_DECLARE_EXPORTED_LIST_FN_READ(id)
ISL_DECLARE_MULTI(id)
isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
uint32_t isl_id_get_hash(__isl_keep isl_id *id);
__isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
__isl_keep const char *name, void *user);
__isl_give isl_id *isl_id_copy(isl_id *id);
__isl_null isl_id *isl_id_free(__isl_take isl_id *id);
void *isl_id_get_user(__isl_keep isl_id *id);
__isl_export
__isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
__isl_give isl_id *isl_id_set_free_user(__isl_take isl_id *id,
void (*free_user)(void *user));
void (*isl_id_get_free_user(__isl_keep isl_id *id))(void *user);
__isl_constructor
__isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx, const char *str);
__isl_give char *isl_id_to_str(__isl_keep isl_id *id);
__isl_give isl_printer *isl_printer_print_id(__isl_take isl_printer *p,
__isl_keep isl_id *id);
void isl_id_dump(__isl_keep isl_id *id);
__isl_constructor
__isl_give isl_multi_id *isl_multi_id_read_from_str(isl_ctx *ctx,
const char *str);
__isl_give isl_printer *isl_printer_print_multi_id(__isl_take isl_printer *p,
__isl_keep isl_multi_id *mi);
void isl_multi_id_dump(__isl_keep isl_multi_id *mi);
__isl_give char *isl_multi_id_to_str(__isl_keep isl_multi_id *mi);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,22 @@
#ifndef ISL_ID_TO_AST_EXPR_H
#define ISL_ID_TO_AST_EXPR_H
#include <isl/id_type.h>
#include <isl/ast_type.h>
#include <isl/maybe_ast_expr.h>
#define ISL_KEY isl_id
#define ISL_VAL isl_ast_expr
#define ISL_HMAP_SUFFIX id_to_ast_expr
#define ISL_HMAP isl_id_to_ast_expr
#define ISL_HMAP_HAVE_READ_FROM_STR
#define ISL_HMAP_IS_EQUAL isl_id_to_ast_expr_is_equal
#include <isl/hmap.h>
#undef ISL_KEY
#undef ISL_VAL
#undef ISL_HMAP_SUFFIX
#undef ISL_HMAP
#undef ISL_HMAP_HAVE_READ_FROM_STR
#undef ISL_HMAP_IS_EQUAL
#endif

View File

@ -0,0 +1,21 @@
#ifndef ISL_ID_TO_ID_H
#define ISL_ID_TO_ID_H
#include <isl/id_type.h>
#include <isl/maybe_id.h>
#define ISL_KEY isl_id
#define ISL_VAL isl_id
#define ISL_HMAP_SUFFIX id_to_id
#define ISL_HMAP isl_id_to_id
#define ISL_HMAP_HAVE_READ_FROM_STR
#define ISL_HMAP_IS_EQUAL isl_id_to_id_is_equal
#include <isl/hmap.h>
#undef ISL_KEY
#undef ISL_VAL
#undef ISL_HMAP_SUFFIX
#undef ISL_HMAP
#undef ISL_HMAP_HAVE_READ_FROM_STR
#undef ISL_HMAP_IS_EQUAL
#endif

View File

@ -0,0 +1,22 @@
#ifndef ISL_ID_TO_PW_AFF_H
#define ISL_ID_TO_PW_AFF_H
#include <isl/id_type.h>
#include <isl/aff_type.h>
#include <isl/maybe_pw_aff.h>
#define ISL_KEY isl_id
#define ISL_VAL isl_pw_aff
#define ISL_HMAP_SUFFIX id_to_pw_aff
#define ISL_HMAP isl_id_to_pw_aff
#define ISL_HMAP_HAVE_READ_FROM_STR
#define ISL_HMAP_IS_EQUAL isl_id_to_pw_aff_plain_is_equal
#include <isl/hmap.h>
#undef ISL_KEY
#undef ISL_VAL
#undef ISL_HMAP_SUFFIX
#undef ISL_HMAP
#undef ISL_HMAP_HAVE_READ_FROM_STR
#undef ISL_HMAP_IS_EQUAL
#endif

View File

@ -0,0 +1,22 @@
#ifndef ISL_ID_TYPE_H
#define ISL_ID_TYPE_H
#include <isl/list.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_export isl_id;
typedef struct isl_id isl_id;
ISL_DECLARE_EXPORTED_LIST_TYPE(id)
struct __isl_export isl_multi_id;
typedef struct isl_multi_id isl_multi_id;
#if defined(__cplusplus)
}
#endif
#endif

71
external/mit/isl/dist/include/isl/ilp.h vendored Normal file
View File

@ -0,0 +1,71 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_ILP_H
#define ISL_ILP_H
#include <isl/aff_type.h>
#include <isl/set_type.h>
#include <isl/union_set_type.h>
#include <isl/val_type.h>
#include <isl/vec.h>
#if defined(__cplusplus)
extern "C" {
#endif
__isl_give isl_val *isl_basic_set_max_val(__isl_keep isl_basic_set *bset,
__isl_keep isl_aff *obj);
__isl_export
__isl_give isl_val *isl_set_min_val(__isl_keep isl_set *set,
__isl_keep isl_aff *obj);
__isl_export
__isl_give isl_val *isl_set_max_val(__isl_keep isl_set *set,
__isl_keep isl_aff *obj);
__isl_give isl_multi_val *isl_union_set_min_multi_union_pw_aff(
__isl_keep isl_union_set *uset, __isl_keep isl_multi_union_pw_aff *obj);
__isl_export
__isl_give isl_val *isl_pw_aff_min_val(__isl_take isl_pw_aff *pa);
__isl_export
__isl_give isl_val *isl_pw_aff_max_val(__isl_take isl_pw_aff *pa);
__isl_export
__isl_give isl_multi_val *isl_pw_multi_aff_min_multi_val(
__isl_take isl_pw_multi_aff *pma);
__isl_export
__isl_give isl_multi_val *isl_pw_multi_aff_max_multi_val(
__isl_take isl_pw_multi_aff *pma);
__isl_export
__isl_give isl_multi_val *isl_multi_pw_aff_min_multi_val(
__isl_take isl_multi_pw_aff *mpa);
__isl_export
__isl_give isl_multi_val *isl_multi_pw_aff_max_multi_val(
__isl_take isl_multi_pw_aff *mpa);
__isl_give isl_val *isl_union_pw_aff_min_val(__isl_take isl_union_pw_aff *upa);
__isl_give isl_val *isl_union_pw_aff_max_val(__isl_take isl_union_pw_aff *upa);
__isl_give isl_multi_val *isl_multi_union_pw_aff_min_multi_val(
__isl_take isl_multi_union_pw_aff *mupa);
__isl_give isl_multi_val *isl_multi_union_pw_aff_max_multi_val(
__isl_take isl_multi_union_pw_aff *mupa);
__isl_export
__isl_give isl_val *isl_basic_set_dim_max_val(__isl_take isl_basic_set *bset,
int pos);
__isl_export
__isl_give isl_val *isl_set_dim_min_val(__isl_take isl_set *set, int pos);
__isl_export
__isl_give isl_val *isl_set_dim_max_val(__isl_take isl_set *set, int pos);
#if defined(__cplusplus)
}
#endif
#endif

132
external/mit/isl/dist/include/isl/list.h vendored Normal file
View File

@ -0,0 +1,132 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_LIST_H
#define ISL_LIST_H
#include <isl/ctx.h>
#include <isl/printer_type.h>
#if defined(__cplusplus)
extern "C" {
#endif
#define ISL_DECLARE_LIST_TYPE2(EL,EXPORT) \
struct isl_##EL; \
struct EXPORT isl_##EL##_list; \
typedef struct isl_##EL##_list isl_##EL##_list;
#define ISL_DECLARE_LIST_TYPE(EL) \
ISL_DECLARE_LIST_TYPE2(EL,)
#define ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \
ISL_DECLARE_LIST_TYPE2(EL,__isl_export)
#define ISL_DECLARE_LIST_FN3(EL,CONSTRUCTOR,EXPORT) \
isl_ctx *isl_##EL##_list_get_ctx(__isl_keep isl_##EL##_list *list); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_to_list(__isl_take isl_##EL *el);\
CONSTRUCTOR \
__isl_give isl_##EL##_list *isl_##EL##_list_from_##EL( \
__isl_take isl_##EL *el); \
CONSTRUCTOR \
__isl_give isl_##EL##_list *isl_##EL##_list_alloc(isl_ctx *ctx, int n); \
__isl_give isl_##EL##_list *isl_##EL##_list_copy( \
__isl_keep isl_##EL##_list *list); \
__isl_null isl_##EL##_list *isl_##EL##_list_free( \
__isl_take isl_##EL##_list *list); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_add( \
__isl_take isl_##EL##_list *list, \
__isl_take isl_##EL *el); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_insert( \
__isl_take isl_##EL##_list *list, unsigned pos, \
__isl_take isl_##EL *el); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_drop( \
__isl_take isl_##EL##_list *list, unsigned first, unsigned n); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_clear( \
__isl_take isl_##EL##_list *list); \
__isl_give isl_##EL##_list *isl_##EL##_list_swap( \
__isl_take isl_##EL##_list *list, unsigned pos1, \
unsigned pos2); \
__isl_give isl_##EL##_list *isl_##EL##_list_reverse( \
__isl_take isl_##EL##_list *list); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_concat( \
__isl_take isl_##EL##_list *list1, \
__isl_take isl_##EL##_list *list2); \
EXPORT \
isl_size isl_##EL##_list_size(__isl_keep isl_##EL##_list *list); \
isl_size isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \
EXPORT \
__isl_give isl_##EL *isl_##EL##_list_get_at( \
__isl_keep isl_##EL##_list *list, int index); \
__isl_give struct isl_##EL *isl_##EL##_list_get_##EL( \
__isl_keep isl_##EL##_list *list, int index); \
EXPORT \
__isl_give isl_##EL##_list *isl_##EL##_list_set_at( \
__isl_take isl_##EL##_list *list, int index, \
__isl_take isl_##EL *el); \
__isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL( \
__isl_take struct isl_##EL##_list *list, int index, \
__isl_take struct isl_##EL *el); \
EXPORT \
isl_stat isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list, \
isl_stat (*fn)(__isl_take isl_##EL *el, void *user), \
void *user); \
isl_bool isl_##EL##_list_every(__isl_keep isl_##EL##_list *list, \
isl_bool (*test)(__isl_keep isl_##EL *el, void *user), \
void *user); \
__isl_give isl_##EL##_list *isl_##EL##_list_map( \
__isl_take isl_##EL##_list *list, \
__isl_give isl_##EL * (*fn)(__isl_take isl_##EL *el, \
void *user), \
void *user); \
__isl_give isl_##EL##_list *isl_##EL##_list_sort( \
__isl_take isl_##EL##_list *list, \
int (*cmp)(__isl_keep struct isl_##EL *a, \
__isl_keep struct isl_##EL *b, \
void *user), void *user); \
EXPORT \
isl_stat isl_##EL##_list_foreach_scc(__isl_keep isl_##EL##_list *list, \
isl_bool (*follows)(__isl_keep isl_##EL *a, \
__isl_keep isl_##EL *b, void *user), \
void *follows_user, \
isl_stat (*fn)(__isl_take isl_##EL##_list *scc, void *user), \
void *fn_user); \
__isl_give char *isl_##EL##_list_to_str( \
__isl_keep isl_##EL##_list *list); \
__isl_give isl_printer *isl_printer_print_##EL##_list( \
__isl_take isl_printer *p, __isl_keep isl_##EL##_list *list); \
void isl_##EL##_list_dump(__isl_keep isl_##EL##_list *list);
#define ISL_DECLARE_LIST_FN(EL) \
ISL_DECLARE_LIST_FN3(EL,,)
#define ISL_DECLARE_EXPORTED_LIST_FN(EL) \
ISL_DECLARE_LIST_FN3(EL,__isl_constructor,__isl_export)
#define ISL_DECLARE_LIST_FN_READ2(EL,CONSTRUCTOR) \
CONSTRUCTOR \
__isl_give isl_##EL##_list *isl_##EL##_list_read_from_str( \
isl_ctx *ctx, const char *str);
#define ISL_DECLARE_LIST_FN_READ(EL) \
ISL_DECLARE_LIST_FN_READ2(EL,)
#define ISL_DECLARE_EXPORTED_LIST_FN_READ(EL) \
ISL_DECLARE_LIST_FN_READ2(EL,__isl_constructor)
#define ISL_DECLARE_LIST(EL) \
ISL_DECLARE_LIST_TYPE(EL) \
ISL_DECLARE_LIST_FN(EL)
#define ISL_DECLARE_EXPORTED_LIST(EL) \
ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \
ISL_DECLARE_EXPORTED_LIST_FN(EL)
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,98 @@
#ifndef ISL_LOCAL_SPACE_H
#define ISL_LOCAL_SPACE_H
#include <isl/aff_type.h>
#include <isl/space_type.h>
#include <isl/printer.h>
#include <isl/map_type.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct isl_local_space;
typedef struct isl_local_space isl_local_space;
isl_ctx *isl_local_space_get_ctx(__isl_keep isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_from_space(
__isl_take isl_space *space);
__isl_give isl_local_space *isl_local_space_copy(
__isl_keep isl_local_space *ls);
__isl_null isl_local_space *isl_local_space_free(
__isl_take isl_local_space *ls);
isl_bool isl_local_space_is_params(__isl_keep isl_local_space *ls);
isl_bool isl_local_space_is_set(__isl_keep isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_set_tuple_id(
__isl_take isl_local_space *ls,
enum isl_dim_type type, __isl_take isl_id *id);
isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
enum isl_dim_type type);
isl_bool isl_local_space_has_dim_name(__isl_keep isl_local_space *ls,
enum isl_dim_type type, unsigned pos);
const char *isl_local_space_get_dim_name(__isl_keep isl_local_space *ls,
enum isl_dim_type type, unsigned pos);
__isl_give isl_local_space *isl_local_space_set_dim_name(
__isl_take isl_local_space *ls,
enum isl_dim_type type, unsigned pos, const char *s);
isl_bool isl_local_space_has_dim_id(__isl_keep isl_local_space *ls,
enum isl_dim_type type, unsigned pos);
__isl_give isl_id *isl_local_space_get_dim_id(__isl_keep isl_local_space *ls,
enum isl_dim_type type, unsigned pos);
__isl_give isl_local_space *isl_local_space_set_dim_id(
__isl_take isl_local_space *ls,
enum isl_dim_type type, unsigned pos, __isl_take isl_id *id);
__isl_give isl_space *isl_local_space_get_space(__isl_keep isl_local_space *ls);
__isl_give isl_aff *isl_local_space_get_div(__isl_keep isl_local_space *ls,
int pos);
int isl_local_space_find_dim_by_name(__isl_keep isl_local_space *ls,
enum isl_dim_type type, const char *name);
__isl_give isl_local_space *isl_local_space_domain(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_range(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_from_domain(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_add_dims(
__isl_take isl_local_space *ls, enum isl_dim_type type, unsigned n);
__isl_give isl_local_space *isl_local_space_drop_dims(
__isl_take isl_local_space *ls,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_local_space *isl_local_space_insert_dims(
__isl_take isl_local_space *ls,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_local_space *isl_local_space_set_from_params(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_intersect(
__isl_take isl_local_space *ls1, __isl_take isl_local_space *ls2);
__isl_give isl_local_space *isl_local_space_wrap(
__isl_take isl_local_space *ls);
isl_bool isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
__isl_keep isl_local_space *ls2);
__isl_give isl_basic_map *isl_local_space_lifting(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_flatten_domain(
__isl_take isl_local_space *ls);
__isl_give isl_local_space *isl_local_space_flatten_range(
__isl_take isl_local_space *ls);
__isl_give isl_printer *isl_printer_print_local_space(__isl_take isl_printer *p,
__isl_keep isl_local_space *ls);
void isl_local_space_dump(__isl_keep isl_local_space *ls);
#if defined(__cplusplus)
}
#endif
#endif

37
external/mit/isl/dist/include/isl/lp.h vendored Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_LP_H
#define ISL_LP_H
#include <isl/aff.h>
#include <isl/val_type.h>
#include <isl/set_type.h>
enum isl_lp_result {
isl_lp_error = -1,
isl_lp_ok = 0,
isl_lp_unbounded,
isl_lp_empty
};
#if defined(__cplusplus)
extern "C" {
#endif
__isl_give isl_val *isl_basic_set_min_lp_val(__isl_keep isl_basic_set *bset,
__isl_keep isl_aff *obj);
__isl_give isl_val *isl_basic_set_max_lp_val(__isl_keep isl_basic_set *bset,
__isl_keep isl_aff *obj);
#if defined(__cplusplus)
}
#endif
#endif

804
external/mit/isl/dist/include/isl/map.h vendored Normal file
View File

@ -0,0 +1,804 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_MAP_H
#define ISL_MAP_H
#include <stdio.h>
#include <isl/ctx.h>
#include <isl/space_type.h>
#include <isl/vec.h>
#include <isl/mat.h>
#include <isl/printer.h>
#include <isl/local_space.h>
#include <isl/aff_type.h>
#include <isl/list.h>
#include <isl/map_type.h>
#include <isl/val_type.h>
#include <isl/stdint.h>
#include <isl/stride_info.h>
#include <isl/fixed_box.h>
#if defined(__cplusplus)
extern "C" {
#endif
isl_size isl_basic_map_total_dim(__isl_keep const isl_basic_map *bmap);
isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type);
__isl_export
isl_size isl_map_domain_tuple_dim(__isl_keep isl_map *map);
__isl_export
isl_size isl_map_range_tuple_dim(__isl_keep isl_map *map);
isl_size isl_map_dim(__isl_keep isl_map *map, enum isl_dim_type type);
isl_ctx *isl_basic_map_get_ctx(__isl_keep isl_basic_map *bmap);
isl_ctx *isl_map_get_ctx(__isl_keep isl_map *map);
__isl_give isl_space *isl_basic_map_get_space(__isl_keep isl_basic_map *bmap);
__isl_export
__isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
__isl_give isl_aff *isl_basic_map_get_div(__isl_keep isl_basic_map *bmap,
int pos);
__isl_give isl_local_space *isl_basic_map_get_local_space(
__isl_keep isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_set_tuple_name(
__isl_take isl_basic_map *bmap, enum isl_dim_type type, const char *s);
const char *isl_basic_map_get_tuple_name(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type);
isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
enum isl_dim_type type);
const char *isl_map_get_tuple_name(__isl_keep isl_map *map,
enum isl_dim_type type);
__isl_give isl_map *isl_map_set_tuple_name(__isl_take isl_map *map,
enum isl_dim_type type, const char *s);
const char *isl_basic_map_get_dim_name(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos);
isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned pos);
const char *isl_map_get_dim_name(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned pos);
__isl_give isl_basic_map *isl_basic_map_set_dim_name(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos, const char *s);
__isl_give isl_map *isl_map_set_dim_name(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, const char *s);
__isl_give isl_basic_map *isl_basic_map_set_tuple_id(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, __isl_take isl_id *id);
__isl_give isl_map *isl_map_set_dim_id(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, __isl_take isl_id *id);
isl_bool isl_basic_map_has_dim_id(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos);
isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned pos);
__isl_give isl_id *isl_map_get_dim_id(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned pos);
__isl_overload
__isl_give isl_map *isl_map_set_domain_tuple_id(__isl_take isl_map *map,
__isl_take isl_id *id);
__isl_overload
__isl_give isl_map *isl_map_set_range_tuple_id(__isl_take isl_map *map,
__isl_take isl_id *id);
__isl_give isl_map *isl_map_set_tuple_id(__isl_take isl_map *map,
enum isl_dim_type type, __isl_take isl_id *id);
__isl_give isl_map *isl_map_reset_tuple_id(__isl_take isl_map *map,
enum isl_dim_type type);
__isl_export
isl_bool isl_map_has_domain_tuple_id(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_has_range_tuple_id(__isl_keep isl_map *map);
isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map, enum isl_dim_type type);
__isl_export
__isl_give isl_id *isl_map_get_domain_tuple_id(__isl_keep isl_map *map);
__isl_export
__isl_give isl_id *isl_map_get_range_tuple_id(__isl_keep isl_map *map);
__isl_give isl_id *isl_map_get_tuple_id(__isl_keep isl_map *map,
enum isl_dim_type type);
__isl_give isl_map *isl_map_reset_user(__isl_take isl_map *map);
int isl_basic_map_find_dim_by_name(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type, const char *name);
int isl_map_find_dim_by_id(__isl_keep isl_map *map, enum isl_dim_type type,
__isl_keep isl_id *id);
int isl_map_find_dim_by_name(__isl_keep isl_map *map, enum isl_dim_type type,
const char *name);
isl_bool isl_basic_map_is_rational(__isl_keep isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_identity(__isl_take isl_space *space);
__isl_null isl_basic_map *isl_basic_map_free(__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_copy(__isl_keep isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_equal(
__isl_take isl_space *space, unsigned n_equal);
__isl_give isl_basic_map *isl_basic_map_less_at(__isl_take isl_space *space,
unsigned pos);
__isl_give isl_basic_map *isl_basic_map_more_at(__isl_take isl_space *space,
unsigned pos);
__isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *space);
__isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *space);
__isl_give isl_basic_map *isl_basic_map_nat_universe(
__isl_take isl_space *space);
__isl_give isl_basic_map *isl_basic_map_remove_redundancies(
__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_remove_redundancies(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_map_simple_hull(__isl_take isl_map *map);
__isl_export
__isl_give isl_basic_map *isl_map_unshifted_simple_hull(
__isl_take isl_map *map);
__isl_give isl_basic_map *isl_map_plain_unshifted_simple_hull(
__isl_take isl_map *map);
__isl_give isl_basic_map *isl_map_unshifted_simple_hull_from_map_list(
__isl_take isl_map *map, __isl_take isl_map_list *list);
__isl_export
__isl_give isl_basic_map *isl_basic_map_intersect_domain(
__isl_take isl_basic_map *bmap,
__isl_take isl_basic_set *bset);
__isl_export
__isl_give isl_basic_map *isl_basic_map_intersect_range(
__isl_take isl_basic_map *bmap,
__isl_take isl_basic_set *bset);
__isl_export
__isl_give isl_basic_map *isl_basic_map_intersect(
__isl_take isl_basic_map *bmap1,
__isl_take isl_basic_map *bmap2);
__isl_give isl_basic_map *isl_basic_map_list_intersect(
__isl_take isl_basic_map_list *list);
__isl_export
__isl_give isl_map *isl_basic_map_union(
__isl_take isl_basic_map *bmap1,
__isl_take isl_basic_map *bmap2);
__isl_export
__isl_give isl_basic_map *isl_basic_map_apply_domain(
__isl_take isl_basic_map *bmap1,
__isl_take isl_basic_map *bmap2);
__isl_export
__isl_give isl_basic_map *isl_basic_map_apply_range(
__isl_take isl_basic_map *bmap1,
__isl_take isl_basic_map *bmap2);
__isl_export
__isl_give isl_basic_map *isl_basic_map_affine_hull(
__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_preimage_domain_multi_aff(
__isl_take isl_basic_map *bmap, __isl_take isl_multi_aff *ma);
__isl_give isl_basic_map *isl_basic_map_preimage_range_multi_aff(
__isl_take isl_basic_map *bmap, __isl_take isl_multi_aff *ma);
__isl_export
__isl_give isl_basic_map *isl_basic_map_reverse(__isl_take isl_basic_map *bmap);
__isl_give isl_basic_set *isl_basic_map_domain(__isl_take isl_basic_map *bmap);
__isl_give isl_basic_set *isl_basic_map_range(__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_domain_map(
__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_range_map(
__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_remove_dims(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_basic_map *isl_basic_map_eliminate(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_export
__isl_give isl_basic_map *isl_basic_map_sample(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_basic_map *isl_basic_map_detect_equalities(
__isl_take isl_basic_map *bmap);
__isl_give isl_basic_map *isl_basic_map_read_from_file(isl_ctx *ctx,
FILE *input);
__isl_constructor
__isl_give isl_basic_map *isl_basic_map_read_from_str(isl_ctx *ctx,
const char *str);
__isl_give isl_map *isl_map_read_from_file(isl_ctx *ctx, FILE *input);
__isl_constructor
__isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx, const char *str);
void isl_basic_map_dump(__isl_keep isl_basic_map *bmap);
void isl_map_dump(__isl_keep isl_map *map);
__isl_give char *isl_basic_map_to_str(__isl_keep isl_basic_map *bmap);
__isl_give isl_printer *isl_printer_print_basic_map(
__isl_take isl_printer *printer, __isl_keep isl_basic_map *bmap);
__isl_give char *isl_map_to_str(__isl_keep isl_map *map);
__isl_give isl_printer *isl_printer_print_map(__isl_take isl_printer *printer,
__isl_keep isl_map *map);
__isl_give isl_basic_map *isl_basic_map_fix_si(__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos, int value);
__isl_give isl_basic_map *isl_basic_map_fix_val(__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos, __isl_take isl_val *v);
__isl_give isl_basic_map *isl_basic_map_lower_bound_si(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos, int value);
__isl_give isl_basic_map *isl_basic_map_upper_bound_si(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos, int value);
__isl_overload
__isl_give isl_map *isl_map_lower_bound_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *lower);
__isl_overload
__isl_give isl_map *isl_map_upper_bound_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *upper);
__isl_give isl_basic_map *isl_basic_map_sum(__isl_take isl_basic_map *bmap1,
__isl_take isl_basic_map *bmap2);
__isl_give isl_basic_map *isl_basic_map_neg(__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_sum(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_neg(__isl_take isl_map *map);
__isl_give isl_map *isl_map_floordiv_val(__isl_take isl_map *map,
__isl_take isl_val *d);
__isl_export
isl_bool isl_basic_map_is_equal(__isl_keep isl_basic_map *bmap1,
__isl_keep isl_basic_map *bmap2);
isl_bool isl_basic_map_is_disjoint(__isl_keep isl_basic_map *bmap1,
__isl_keep isl_basic_map *bmap2);
__isl_give isl_map *isl_basic_map_partial_lexmax(
__isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
__isl_give isl_set **empty);
__isl_give isl_map *isl_basic_map_partial_lexmin(
__isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
__isl_give isl_set **empty);
__isl_give isl_map *isl_map_partial_lexmax(
__isl_take isl_map *map, __isl_take isl_set *dom,
__isl_give isl_set **empty);
__isl_give isl_map *isl_map_partial_lexmin(
__isl_take isl_map *map, __isl_take isl_set *dom,
__isl_give isl_set **empty);
__isl_export
__isl_give isl_map *isl_basic_map_lexmin(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_basic_map_lexmax(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_lexmin(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_lexmax(__isl_take isl_map *map);
__isl_give isl_pw_multi_aff *isl_basic_map_partial_lexmin_pw_multi_aff(
__isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
__isl_give isl_set **empty);
__isl_give isl_pw_multi_aff *isl_basic_map_partial_lexmax_pw_multi_aff(
__isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
__isl_give isl_set **empty);
__isl_give isl_pw_multi_aff *isl_basic_map_lexmin_pw_multi_aff(
__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
__isl_take isl_map *map);
__isl_export
__isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
__isl_take isl_map *map);
__isl_export
__isl_give isl_multi_pw_aff *isl_map_min_multi_pw_aff(__isl_take isl_map *map);
__isl_export
__isl_give isl_multi_pw_aff *isl_map_max_multi_pw_aff(__isl_take isl_map *map);
void isl_basic_map_print_internal(__isl_keep isl_basic_map *bmap,
FILE *out, int indent);
__isl_give isl_val *isl_basic_map_plain_get_val_if_fixed(
__isl_keep isl_basic_map *bmap,
enum isl_dim_type type, unsigned pos);
isl_bool isl_basic_map_image_is_bounded(__isl_keep isl_basic_map *bmap);
isl_bool isl_basic_map_plain_is_universe(__isl_keep isl_basic_map *bmap);
isl_bool isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
isl_bool isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
__isl_export
isl_bool isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
__isl_export
isl_bool isl_basic_map_is_subset(__isl_keep isl_basic_map *bmap1,
__isl_keep isl_basic_map *bmap2);
isl_bool isl_basic_map_is_strict_subset(__isl_keep isl_basic_map *bmap1,
__isl_keep isl_basic_map *bmap2);
__isl_export
__isl_give isl_map *isl_map_universe(__isl_take isl_space *space);
__isl_export
__isl_give isl_map *isl_space_universe_map(__isl_take isl_space *space);
__isl_give isl_map *isl_map_nat_universe(__isl_take isl_space *space);
__isl_export
__isl_give isl_map *isl_map_empty(__isl_take isl_space *space);
__isl_give isl_map *isl_map_identity(__isl_take isl_space *space);
__isl_give isl_map *isl_map_lex_lt_first(__isl_take isl_space *space,
unsigned n);
__isl_give isl_map *isl_map_lex_le_first(__isl_take isl_space *space,
unsigned n);
__isl_give isl_map *isl_map_lex_lt(__isl_take isl_space *set_space);
__isl_give isl_map *isl_map_lex_le(__isl_take isl_space *set_space);
__isl_give isl_map *isl_map_lex_gt_first(__isl_take isl_space *space,
unsigned n);
__isl_give isl_map *isl_map_lex_ge_first(__isl_take isl_space *space,
unsigned n);
__isl_give isl_map *isl_map_lex_gt(__isl_take isl_space *set_space);
__isl_give isl_map *isl_map_lex_ge(__isl_take isl_space *set_space);
__isl_null isl_map *isl_map_free(__isl_take isl_map *map);
__isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
__isl_export
__isl_give isl_map *isl_map_reverse(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_domain_reverse(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_range_reverse(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_union(
__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_union_disjoint(
__isl_take isl_map *map1, __isl_take isl_map *map2);
__isl_export
__isl_give isl_map *isl_map_intersect_domain(
__isl_take isl_map *map,
__isl_take isl_set *set);
__isl_export
__isl_give isl_map *isl_map_intersect_range(
__isl_take isl_map *map,
__isl_take isl_set *set);
__isl_export
__isl_give isl_map *isl_map_intersect_domain_factor_domain(
__isl_take isl_map *map, __isl_take isl_map *factor);
__isl_export
__isl_give isl_map *isl_map_intersect_domain_factor_range(
__isl_take isl_map *map, __isl_take isl_map *factor);
__isl_export
__isl_give isl_map *isl_map_intersect_range_factor_domain(
__isl_take isl_map *map, __isl_take isl_map *factor);
__isl_export
__isl_give isl_map *isl_map_intersect_range_factor_range(
__isl_take isl_map *map, __isl_take isl_map *factor);
__isl_export
__isl_give isl_map *isl_map_intersect_domain_wrapped_domain(
__isl_take isl_map *map, __isl_take isl_set *domain);
__isl_export
__isl_give isl_map *isl_map_intersect_range_wrapped_domain(
__isl_take isl_map *map, __isl_take isl_set *domain);
__isl_export
__isl_give isl_map *isl_map_apply_domain(
__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_export
__isl_give isl_map *isl_map_apply_range(
__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_overload
__isl_give isl_map *isl_map_preimage_domain_multi_aff(__isl_take isl_map *map,
__isl_take isl_multi_aff *ma);
__isl_overload
__isl_give isl_map *isl_map_preimage_range_multi_aff(__isl_take isl_map *map,
__isl_take isl_multi_aff *ma);
__isl_overload
__isl_give isl_map *isl_map_preimage_domain_pw_multi_aff(
__isl_take isl_map *map, __isl_take isl_pw_multi_aff *pma);
__isl_overload
__isl_give isl_map *isl_map_preimage_range_pw_multi_aff(
__isl_take isl_map *map, __isl_take isl_pw_multi_aff *pma);
__isl_overload
__isl_give isl_map *isl_map_preimage_domain_multi_pw_aff(
__isl_take isl_map *map, __isl_take isl_multi_pw_aff *mpa);
__isl_give isl_basic_map *isl_basic_map_product(
__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2);
__isl_export
__isl_give isl_map *isl_map_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_basic_map *isl_basic_map_domain_product(
__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2);
__isl_give isl_basic_map *isl_basic_map_range_product(
__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2);
__isl_export
__isl_give isl_map *isl_map_domain_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_export
__isl_give isl_map *isl_map_range_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_basic_map *isl_basic_map_flat_product(
__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2);
__isl_give isl_map *isl_map_flat_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_basic_map *isl_basic_map_flat_range_product(
__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2);
__isl_give isl_map *isl_map_flat_domain_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_flat_range_product(__isl_take isl_map *map1,
__isl_take isl_map *map2);
isl_bool isl_map_domain_is_wrapping(__isl_keep isl_map *map);
isl_bool isl_map_range_is_wrapping(__isl_keep isl_map *map);
isl_bool isl_map_is_product(__isl_keep isl_map *map);
__isl_export
__isl_give isl_map *isl_map_factor_domain(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_factor_range(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_domain_factor_domain(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_domain_factor_range(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_range_factor_domain(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_range_factor_range(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_intersect(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_export
__isl_give isl_map *isl_map_intersect_params(__isl_take isl_map *map,
__isl_take isl_set *params);
__isl_export
__isl_give isl_map *isl_map_subtract(
__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_subtract_domain(__isl_take isl_map *map,
__isl_take isl_set *dom);
__isl_give isl_map *isl_map_subtract_range(__isl_take isl_map *map,
__isl_take isl_set *dom);
__isl_export
__isl_give isl_map *isl_map_complement(__isl_take isl_map *map);
__isl_give isl_map *isl_map_fix_input_si(__isl_take isl_map *map,
unsigned input, int value);
__isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, int value);
__isl_give isl_map *isl_map_fix_val(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, __isl_take isl_val *v);
__isl_give isl_map *isl_map_lower_bound_si(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, int value);
__isl_give isl_map *isl_map_lower_bound_val(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, __isl_take isl_val *value);
__isl_give isl_map *isl_map_upper_bound_si(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, int value);
__isl_give isl_map *isl_map_upper_bound_val(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, __isl_take isl_val *value);
__isl_export
__isl_give isl_basic_set *isl_basic_map_deltas(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_basic_map_deltas_map(
__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_deltas_map(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_detect_equalities(__isl_take isl_map *map);
__isl_export
__isl_give isl_basic_map *isl_map_affine_hull(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_map_convex_hull(__isl_take isl_map *map);
__isl_export
__isl_give isl_basic_map *isl_map_polyhedral_hull(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_basic_map_add_dims(__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned n);
__isl_give isl_map *isl_map_add_dims(__isl_take isl_map *map,
enum isl_dim_type type, unsigned n);
__isl_give isl_basic_map *isl_basic_map_insert_dims(
__isl_take isl_basic_map *bmap, enum isl_dim_type type,
unsigned pos, unsigned n);
__isl_give isl_map *isl_map_insert_dims(__isl_take isl_map *map,
enum isl_dim_type type, unsigned pos, unsigned n);
__isl_give isl_basic_map *isl_basic_map_move_dims(
__isl_take isl_basic_map *bmap,
enum isl_dim_type dst_type, unsigned dst_pos,
enum isl_dim_type src_type, unsigned src_pos, unsigned n);
__isl_give isl_map *isl_map_move_dims(__isl_take isl_map *map,
enum isl_dim_type dst_type, unsigned dst_pos,
enum isl_dim_type src_type, unsigned src_pos, unsigned n);
__isl_give isl_basic_map *isl_basic_map_project_out(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_overload
__isl_give isl_map *isl_map_project_out_param_id(__isl_take isl_map *map,
__isl_take isl_id *id);
__isl_overload
__isl_give isl_map *isl_map_project_out_param_id_list(__isl_take isl_map *map,
__isl_take isl_id_list *list);
__isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_export
__isl_give isl_map *isl_map_project_out_all_params(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_basic_map_remove_divs(
__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_remove_unknown_divs(__isl_take isl_map *map);
__isl_give isl_map *isl_map_remove_divs(__isl_take isl_map *map);
__isl_give isl_map *isl_map_eliminate(__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_map *isl_map_remove_dims(__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_basic_map *isl_basic_map_remove_divs_involving_dims(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_map *isl_map_remove_divs_involving_dims(__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_map *isl_map_remove_inputs(__isl_take isl_map *map,
unsigned first, unsigned n);
__isl_give isl_basic_map *isl_basic_map_equate(__isl_take isl_basic_map *bmap,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_basic_map *isl_basic_map_order_ge(__isl_take isl_basic_map *bmap,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_order_ge(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_order_le(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_basic_map *isl_basic_map_order_gt(__isl_take isl_basic_map *bmap,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
__isl_export
__isl_give isl_map *isl_set_translation(__isl_take isl_set *deltas);
__isl_export
__isl_give isl_map *isl_set_identity(__isl_take isl_set *set);
__isl_export
isl_bool isl_basic_set_is_wrapping(__isl_keep isl_basic_set *bset);
__isl_export
isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
__isl_give isl_basic_set *isl_basic_map_wrap(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_set *isl_map_wrap(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_basic_set_unwrap(__isl_take isl_basic_set *bset);
__isl_export
__isl_give isl_map *isl_set_unwrap(__isl_take isl_set *set);
__isl_export
__isl_give isl_basic_map *isl_basic_map_flatten(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_flatten(__isl_take isl_map *map);
__isl_export
__isl_give isl_basic_map *isl_basic_map_flatten_domain(
__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_basic_map *isl_basic_map_flatten_range(
__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_flatten_domain(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_map_flatten_range(__isl_take isl_map *map);
__isl_export
__isl_give isl_basic_set *isl_basic_set_flatten(__isl_take isl_basic_set *bset);
__isl_export
__isl_give isl_set *isl_set_flatten(__isl_take isl_set *set);
__isl_give isl_map *isl_set_flatten_map(__isl_take isl_set *set);
__isl_export
__isl_give isl_set *isl_map_params(__isl_take isl_map *map);
__isl_export
__isl_give isl_set *isl_map_domain(__isl_take isl_map *bmap);
__isl_export
__isl_give isl_set *isl_map_range(__isl_take isl_map *map);
__isl_export
__isl_give isl_map *isl_set_insert_domain(__isl_take isl_set *set,
__isl_take isl_space *domain);
__isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
__isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
__isl_give isl_map *isl_set_wrapped_domain_map(__isl_take isl_set *set);
__isl_constructor
__isl_give isl_map *isl_map_from_basic_map(__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_from_domain(__isl_take isl_set *set);
__isl_give isl_basic_map *isl_basic_map_from_domain(
__isl_take isl_basic_set *bset);
__isl_give isl_basic_map *isl_basic_map_from_range(
__isl_take isl_basic_set *bset);
__isl_give isl_map *isl_map_from_range(__isl_take isl_set *set);
__isl_give isl_basic_map *isl_basic_map_from_domain_and_range(
__isl_take isl_basic_set *domain, __isl_take isl_basic_set *range);
__isl_give isl_map *isl_map_from_domain_and_range(__isl_take isl_set *domain,
__isl_take isl_set *range);
__isl_export
__isl_give isl_basic_map *isl_map_sample(__isl_take isl_map *map);
__isl_export
__isl_give isl_set *isl_map_bind_domain(__isl_take isl_map *map,
__isl_take isl_multi_id *tuple);
__isl_export
__isl_give isl_set *isl_map_bind_range(__isl_take isl_map *map,
__isl_take isl_multi_id *tuple);
isl_bool isl_map_plain_is_empty(__isl_keep isl_map *map);
isl_bool isl_map_plain_is_universe(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_is_empty(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_is_subset(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
__isl_export
isl_bool isl_map_is_strict_subset(__isl_keep isl_map *map1,
__isl_keep isl_map *map2);
__isl_export
isl_bool isl_map_is_equal(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
__isl_export
isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
__isl_keep isl_map *map2);
isl_bool isl_basic_map_is_single_valued(__isl_keep isl_basic_map *bmap);
isl_bool isl_map_plain_is_single_valued(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
isl_bool isl_map_plain_is_injective(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_is_injective(__isl_keep isl_map *map);
__isl_export
isl_bool isl_map_is_bijective(__isl_keep isl_map *map);
isl_bool isl_map_is_identity(__isl_keep isl_map *map);
int isl_map_is_translation(__isl_keep isl_map *map);
isl_bool isl_map_has_equal_space(__isl_keep isl_map *map1,
__isl_keep isl_map *map2);
isl_bool isl_basic_map_can_zip(__isl_keep isl_basic_map *bmap);
isl_bool isl_map_can_zip(__isl_keep isl_map *map);
__isl_give isl_basic_map *isl_basic_map_zip(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_zip(__isl_take isl_map *map);
isl_bool isl_basic_map_can_curry(__isl_keep isl_basic_map *bmap);
isl_bool isl_map_can_curry(__isl_keep isl_map *map);
__isl_give isl_basic_map *isl_basic_map_curry(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_curry(__isl_take isl_map *map);
isl_bool isl_map_can_range_curry(__isl_keep isl_map *map);
__isl_give isl_map *isl_map_range_curry(__isl_take isl_map *map);
isl_bool isl_basic_map_can_uncurry(__isl_keep isl_basic_map *bmap);
isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
__isl_give isl_basic_map *isl_basic_map_uncurry(__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_uncurry(__isl_take isl_map *map);
__isl_give isl_map *isl_map_make_disjoint(__isl_take isl_map *map);
__isl_give isl_map *isl_basic_map_compute_divs(__isl_take isl_basic_map *bmap);
__isl_give isl_map *isl_map_compute_divs(__isl_take isl_map *map);
ISL_DEPRECATED
__isl_give isl_map *isl_map_align_divs(__isl_take isl_map *map);
__isl_give isl_basic_map *isl_basic_map_drop_constraints_involving_dims(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_basic_map *isl_basic_map_drop_constraints_not_involving_dims(
__isl_take isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_map *isl_map_drop_constraints_involving_dims(
__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
__isl_give isl_map *isl_map_drop_constraints_not_involving_dims(
__isl_take isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
isl_bool isl_basic_map_involves_dims(__isl_keep isl_basic_map *bmap,
enum isl_dim_type type, unsigned first, unsigned n);
isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned first, unsigned n);
void isl_map_print_internal(__isl_keep isl_map *map, FILE *out, int indent);
__isl_give isl_val *isl_map_plain_get_val_if_fixed(__isl_keep isl_map *map,
enum isl_dim_type type, unsigned pos);
__isl_give isl_basic_map *isl_basic_map_gist_domain(
__isl_take isl_basic_map *bmap, __isl_take isl_basic_set *context);
__isl_export
__isl_give isl_basic_map *isl_basic_map_gist(__isl_take isl_basic_map *bmap,
__isl_take isl_basic_map *context);
__isl_export
__isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
__isl_take isl_map *context);
__isl_export
__isl_give isl_map *isl_map_gist_domain(__isl_take isl_map *map,
__isl_take isl_set *context);
__isl_give isl_map *isl_map_gist_range(__isl_take isl_map *map,
__isl_take isl_set *context);
__isl_export
__isl_give isl_map *isl_map_gist_params(__isl_take isl_map *map,
__isl_take isl_set *context);
__isl_give isl_map *isl_map_gist_basic_map(__isl_take isl_map *map,
__isl_take isl_basic_map *context);
__isl_give isl_stride_info *isl_map_get_range_stride_info(
__isl_keep isl_map *map, int pos);
__isl_export
__isl_give isl_fixed_box *isl_map_get_range_lattice_tile(
__isl_keep isl_map *map);
__isl_export
__isl_give isl_fixed_box *isl_map_get_range_simple_fixed_box_hull(
__isl_keep isl_map *map);
__isl_export
__isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
isl_bool isl_map_plain_is_equal(__isl_keep isl_map *map1,
__isl_keep isl_map *map2);
uint32_t isl_map_get_hash(__isl_keep isl_map *map);
__isl_export
isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
__isl_export
isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
isl_stat (*fn)(__isl_take isl_basic_map *bmap, void *user), void *user);
__isl_give isl_basic_map_list *isl_map_get_basic_map_list(
__isl_keep isl_map *map);
__isl_overload
__isl_give isl_map *isl_map_fixed_power_val(__isl_take isl_map *map,
__isl_take isl_val *exp);
__isl_give isl_map *isl_map_power(__isl_take isl_map *map, isl_bool *exact);
__isl_give isl_map *isl_map_reaching_path_lengths(__isl_take isl_map *map,
isl_bool *exact);
__isl_give isl_map *isl_map_transitive_closure(__isl_take isl_map *map,
isl_bool *exact);
__isl_give isl_map *isl_map_lex_le_map(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_lex_lt_map(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_lex_ge_map(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_give isl_map *isl_map_lex_gt_map(__isl_take isl_map *map1,
__isl_take isl_map *map2);
__isl_overload
__isl_give isl_map *isl_map_eq_at_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_map *isl_map_lex_lt_at_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_map *isl_map_lex_le_at_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_map *isl_map_lex_gt_at_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *mpa);
__isl_overload
__isl_give isl_map *isl_map_lex_ge_at_multi_pw_aff(__isl_take isl_map *map,
__isl_take isl_multi_pw_aff *mpa);
__isl_give isl_basic_map *isl_basic_map_align_params(
__isl_take isl_basic_map *bmap, __isl_take isl_space *model);
__isl_give isl_map *isl_map_align_params(__isl_take isl_map *map,
__isl_take isl_space *model);
__isl_give isl_basic_map *isl_basic_map_drop_unused_params(
__isl_take isl_basic_map *bmap);
__isl_export
__isl_give isl_map *isl_map_drop_unused_params(__isl_take isl_map *map);
__isl_give isl_mat *isl_basic_map_equalities_matrix(
__isl_keep isl_basic_map *bmap, enum isl_dim_type c1,
enum isl_dim_type c2, enum isl_dim_type c3,
enum isl_dim_type c4, enum isl_dim_type c5);
__isl_give isl_mat *isl_basic_map_inequalities_matrix(
__isl_keep isl_basic_map *bmap, enum isl_dim_type c1,
enum isl_dim_type c2, enum isl_dim_type c3,
enum isl_dim_type c4, enum isl_dim_type c5);
__isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
__isl_take isl_space *space,
__isl_take isl_mat *eq, __isl_take isl_mat *ineq, enum isl_dim_type c1,
enum isl_dim_type c2, enum isl_dim_type c3,
enum isl_dim_type c4, enum isl_dim_type c5);
__isl_give isl_basic_map *isl_basic_map_from_aff(__isl_take isl_aff *aff);
__isl_give isl_basic_map *isl_basic_map_from_multi_aff(
__isl_take isl_multi_aff *maff);
__isl_give isl_basic_map *isl_basic_map_from_aff_list(
__isl_take isl_space *domain_space, __isl_take isl_aff_list *list);
__isl_give isl_map *isl_map_from_aff(__isl_take isl_aff *aff);
__isl_export
__isl_give isl_map *isl_multi_aff_as_map(__isl_take isl_multi_aff *ma);
__isl_give isl_map *isl_map_from_multi_aff(__isl_take isl_multi_aff *maff);
__isl_give isl_pw_aff *isl_map_dim_min(__isl_take isl_map *map, int pos);
__isl_give isl_pw_aff *isl_map_dim_max(__isl_take isl_map *map, int pos);
ISL_DECLARE_LIST_FN(basic_map)
ISL_DECLARE_EXPORTED_LIST_FN(map)
ISL_DECLARE_EXPORTED_LIST_FN_READ(map)
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,22 @@
#ifndef ISL_MAP_TO_BASIC_SET_H
#define ISL_MAP_TO_BASIC_SET_H
#include <isl/set_type.h>
#include <isl/map_type.h>
#include <isl/maybe_basic_set.h>
#define ISL_KEY isl_map
#define ISL_VAL isl_basic_set
#define ISL_HMAP_SUFFIX map_to_basic_set
#define ISL_HMAP isl_map_to_basic_set
#define ISL_HMAP_HAVE_READ_FROM_STR
#define ISL_HMAP_IS_EQUAL isl_map_to_basic_set_plain_is_equal
#include <isl/hmap.h>
#undef ISL_KEY
#undef ISL_VAL
#undef ISL_HMAP_SUFFIX
#undef ISL_HMAP
#undef ISL_HMAP_HAVE_READ_FROM_STR
#undef ISL_HMAP_IS_EQUAL
#endif

View File

@ -0,0 +1,38 @@
#ifndef ISL_MAP_TYPE_H
#define ISL_MAP_TYPE_H
#include <isl/ctx.h>
#include <isl/list.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct __isl_subclass(isl_map) isl_basic_map;
typedef struct isl_basic_map isl_basic_map;
ISL_DECLARE_LIST_TYPE(basic_map)
struct __isl_subclass(isl_union_map) isl_map;
typedef struct isl_map isl_map;
ISL_DECLARE_EXPORTED_LIST_TYPE(map)
#ifndef isl_basic_set
struct __isl_subclass(isl_set) isl_basic_set;
typedef struct isl_basic_set isl_basic_set;
ISL_DECLARE_LIST_TYPE(basic_set)
#endif
#ifndef isl_set
struct __isl_subclass(isl_union_set) isl_set;
typedef struct isl_set isl_set;
ISL_DECLARE_EXPORTED_LIST_TYPE(set)
#endif
ISL_DECLARE_LIST_FN(basic_set)
ISL_DECLARE_EXPORTED_LIST_FN(set)
ISL_DECLARE_EXPORTED_LIST_FN_READ(set)
#if defined(__cplusplus)
}
#endif
#endif

119
external/mit/isl/dist/include/isl/mat.h vendored Normal file
View File

@ -0,0 +1,119 @@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_MAT_H
#define ISL_MAT_H
#include <stdio.h>
#include <isl/ctx.h>
#include <isl/vec.h>
#include <isl/val_type.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct isl_mat;
typedef struct isl_mat isl_mat;
isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
__isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
unsigned n_row, unsigned n_col);
__isl_give isl_mat *isl_mat_extend(__isl_take isl_mat *mat,
unsigned n_row, unsigned n_col);
__isl_give isl_mat *isl_mat_identity(isl_ctx *ctx, unsigned n_row);
__isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
__isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
isl_size isl_mat_rows(__isl_keep isl_mat *mat);
isl_size isl_mat_cols(__isl_keep isl_mat *mat);
__isl_give isl_val *isl_mat_get_element_val(__isl_keep isl_mat *mat,
int row, int col);
__isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
int row, int col, int v);
__isl_give isl_mat *isl_mat_set_element_val(__isl_take isl_mat *mat,
int row, int col, __isl_take isl_val *v);
__isl_give isl_mat *isl_mat_swap_cols(__isl_take isl_mat *mat,
unsigned i, unsigned j);
__isl_give isl_mat *isl_mat_swap_rows(__isl_take isl_mat *mat,
unsigned i, unsigned j);
__isl_give isl_vec *isl_mat_vec_product(__isl_take isl_mat *mat,
__isl_take isl_vec *vec);
__isl_give isl_vec *isl_vec_mat_product(__isl_take isl_vec *vec,
__isl_take isl_mat *mat);
__isl_give isl_vec *isl_mat_vec_inverse_product(__isl_take isl_mat *mat,
__isl_take isl_vec *vec);
__isl_give isl_mat *isl_mat_aff_direct_sum(__isl_take isl_mat *left,
__isl_take isl_mat *right);
__isl_give isl_mat *isl_mat_diagonal(__isl_take isl_mat *mat1,
__isl_take isl_mat *mat2);
__isl_give isl_mat *isl_mat_left_hermite(__isl_take isl_mat *M, int neg,
__isl_give isl_mat **U, __isl_give isl_mat **Q);
__isl_give isl_mat *isl_mat_lin_to_aff(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_inverse_product(__isl_take isl_mat *left,
__isl_take isl_mat *right);
__isl_give isl_mat *isl_mat_product(__isl_take isl_mat *left,
__isl_take isl_mat *right);
__isl_give isl_mat *isl_mat_transpose(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_normalize(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_normalize_row(__isl_take isl_mat *mat, int row);
__isl_give isl_mat *isl_mat_drop_cols(__isl_take isl_mat *mat,
unsigned col, unsigned n);
__isl_give isl_mat *isl_mat_drop_rows(__isl_take isl_mat *mat,
unsigned row, unsigned n);
__isl_give isl_mat *isl_mat_insert_cols(__isl_take isl_mat *mat,
unsigned col, unsigned n);
__isl_give isl_mat *isl_mat_insert_rows(__isl_take isl_mat *mat,
unsigned row, unsigned n);
__isl_give isl_mat *isl_mat_move_cols(__isl_take isl_mat *mat,
unsigned dst_col, unsigned src_col, unsigned n);
__isl_give isl_mat *isl_mat_add_rows(__isl_take isl_mat *mat, unsigned n);
__isl_give isl_mat *isl_mat_insert_zero_cols(__isl_take isl_mat *mat,
unsigned first, unsigned n);
__isl_give isl_mat *isl_mat_add_zero_cols(__isl_take isl_mat *mat, unsigned n);
__isl_give isl_mat *isl_mat_insert_zero_rows(__isl_take isl_mat *mat,
unsigned row, unsigned n);
__isl_give isl_mat *isl_mat_add_zero_rows(__isl_take isl_mat *mat, unsigned n);
void isl_mat_col_add(__isl_keep isl_mat *mat, int dst_col, int src_col);
__isl_give isl_mat *isl_mat_unimodular_complete(__isl_take isl_mat *M, int row);
__isl_give isl_mat *isl_mat_row_basis(__isl_take isl_mat *mat);
__isl_give isl_mat *isl_mat_row_basis_extension(
__isl_take isl_mat *mat1, __isl_take isl_mat *mat2);
__isl_give isl_mat *isl_mat_from_row_vec(__isl_take isl_vec *vec);
__isl_give isl_mat *isl_mat_concat(__isl_take isl_mat *top,
__isl_take isl_mat *bot);
__isl_give isl_mat *isl_mat_vec_concat(__isl_take isl_mat *top,
__isl_take isl_vec *bot);
isl_bool isl_mat_is_equal(__isl_keep isl_mat *mat1, __isl_keep isl_mat *mat2);
isl_bool isl_mat_has_linearly_independent_rows(__isl_keep isl_mat *mat1,
__isl_keep isl_mat *mat2);
isl_size isl_mat_rank(__isl_keep isl_mat *mat);
int isl_mat_initial_non_zero_cols(__isl_keep isl_mat *mat);
void isl_mat_print_internal(__isl_keep isl_mat *mat, FILE *out, int indent);
void isl_mat_dump(__isl_keep isl_mat *mat);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,7 @@
#ifndef ISL_MAYBE_H
#define ISL_MAYBE_H
#define ISL_xMAYBE(TYPE) isl_maybe_ ## TYPE
#define ISL_MAYBE(TYPE) ISL_xMAYBE(TYPE)
#endif

View File

@ -0,0 +1,8 @@
#ifndef ISL_MAYBE_AST_EXPR_H
#define ISL_MAYBE_AST_EXPR_H
#define ISL_TYPE isl_ast_expr
#include <isl/maybe_templ.h>
#undef ISL_TYPE
#endif

View File

@ -0,0 +1,8 @@
#ifndef ISL_MAYBE_BASIC_SET_H
#define ISL_MAYBE_BASIC_SET_H
#define ISL_TYPE isl_basic_set
#include <isl/maybe_templ.h>
#undef ISL_TYPE
#endif

Some files were not shown because too many files have changed in this diff Show More