Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,46 @@
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-2016 Polly Labs
Contributions by
Mythri Alle
Riyadh Baghdadi
Serge Belyshev
Ray Donnelly
Johannes Doerfert
Tobias Grosser
Alexandre Isoard
Andreas Kloeckner
Michael Kruse
Sebastian Pop
Louis-Noel Pouchet
Benoit Pradelle
Uday Kumar Reddy
Andreas Simbuerger
Sven van Haastregt
The merge sort implementation was written by Jeffrey Stedfast.

View File

@@ -0,0 +1,193 @@
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

View File

@@ -0,0 +1 @@
isl-0.18-812-g565da6e

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.

View File

@@ -0,0 +1,442 @@
if HAVE_CLANG
MAYBE_INTERFACE = interface
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_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 IMATH_FOR_MP
MP_SRC = \
isl_hide_deprecated.h \
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
DEPRECATED_SRC =
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
DEPRECATED_SRC = isl_ast_int.c
MP_INCLUDE_H = include/isl/val_gmp.h
endif
AM_CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/include -Iinclude/ @MP_CPPFLAGS@
AM_CFLAGS = @WARNING_FLAGS@
libisl_la_SOURCES = \
$(MP_SRC) \
$(DEPRECATED_SRC) \
isl_aff.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_band.c \
isl_band_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_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_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_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_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_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_cat_LDADD = libisl.la
isl_cat_SOURCES = \
cat.c
isl_closure_LDADD = libisl.la
isl_closure_SOURCES = \
closure.c
nodist_pkginclude_HEADERS = \
include/isl/stdint.h
pkginclude_HEADERS = \
$(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/band.h \
include/isl/constraint.h \
include/isl/ctx.h \
include/isl/flow.h \
include/isl/id.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/stream.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/vec.h \
include/isl/version.h \
include/isl/vertices.h
deprecateddir = $(pkgincludedir)/deprecated
deprecated_HEADERS = \
include/isl/deprecated/int.h \
include/isl/deprecated/aff_int.h \
include/isl/deprecated/ast_int.h \
include/isl/deprecated/constraint_int.h \
include/isl/deprecated/ilp_int.h \
include/isl/deprecated/map_int.h \
include/isl/deprecated/mat_int.h \
include/isl/deprecated/point_int.h \
include/isl/deprecated/polynomial_int.h \
include/isl/deprecated/set_int.h \
include/isl/deprecated/union_map_int.h \
include/isl/deprecated/val_int.h \
include/isl/deprecated/vec_int.h
BUILT_SOURCES = gitversion.h
CLEANFILES = \
gitversion.h
DISTCLEANFILES = \
isl-uninstalled.sh \
isl-uninstalled.pc \
isl.pc \
isl.pc.in \
include/isl/stdint.h
EXTRA_DIST = \
LICENSE \
isl_config_post.h \
basis_reduction_templ.c \
bset_to_bmap.c \
bset_from_bmap.c \
extract_key.c \
isl_list_templ.c \
isl_list_templ.h \
isl_map_lexopt_templ.c \
isl_maybe_map.h \
isl_multi_macro.h \
isl_multi_templ.c \
isl_multi_templ.h \
isl_multi_apply_templ.c \
isl_multi_apply_set.c \
isl_multi_apply_union_set.c \
isl_multi_cmp.c \
isl_multi_coalesce.c \
isl_multi_floor.c \
isl_multi_gist.c \
isl_multi_hash.c \
isl_multi_intersect.c \
print_templ.c \
print_templ_yaml.c \
isl_power_templ.c \
isl_pw_macro.h \
isl_pw_templ.c \
isl_pw_hash.c \
isl_pw_union_opt.c \
read_in_string_templ.c \
set_to_map.c \
set_from_map.c \
isl_tab_lexopt_templ.c \
isl_union_macro.h \
isl_union_templ.c \
isl_union_single.c \
isl_union_multi.c \
isl_union_eval.c \
isl_union_neg.c \
isl.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 \
interface/all.h \
interface/isl.h.top \
interface/isl.py.top \
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)/isl.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)/isl.py \
$(DESTDIR)$(libdir)/$$libisl-gdb.py; \
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"; \
$(INSTALL_DATA) $(srcdir)/isl.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

File diff suppressed because it is too large Load Diff

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://freecode.com/projects/isl
If you use isl, you can let me know by stacking
https://www.ohloh.net/p/isl on ohloh.
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}
}

File diff suppressed because it is too large Load Diff

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,357 @@
/*
* 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 (!bset)
return NULL;
if (isl_basic_set_dim(bset, isl_dim_div) != 0)
isl_die(bset->ctx, isl_error_invalid,
"no integer division allowed", return NULL);
if (isl_basic_set_dim(bset, isl_dim_param) != 0)
isl_die(bset->ctx, isl_error_invalid,
"no parameters allowed", 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;
unsigned nvar = isl_basic_set_total_dim(bset);
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;
}

View File

@@ -0,0 +1,289 @@
#include <assert.h>
#include <isl/stream.h>
#include <isl_map_private.h>
#include <isl_polynomial_private.h>
#include <isl_scan.h>
#include <isl/options.h>
#include <isl/deprecated/point_int.h>
#include <isl/deprecated/polynomial_int.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)
{
unsigned nparam;
int i, r;
isl_point *pt, *pt2;
isl_set *box;
nparam = isl_set_dim(set, isl_dim_param);
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;
unsigned nparam;
struct verify_point_bound *vpb = (struct verify_point_bound *) user;
isl_int t;
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);
isl_int_init(t);
pwf = isl_pw_qpolynomial_fold_copy(vpb->pwf);
nparam = isl_pw_qpolynomial_fold_dim(pwf, isl_dim_param);
for (i = 0; i < nparam; ++i) {
isl_point_get_coordinate(pnt, isl_dim_param, i, &t);
pwf = isl_pw_qpolynomial_fold_fix_dim(pwf, isl_dim_param, i, t);
}
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, ", ");
isl_point_get_coordinate(pnt, isl_dim_param, i, &t);
p = isl_printer_print_isl_int(p, t);
}
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_int_clear(t);
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;
int 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;
}

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;
}

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;
}

View File

@@ -0,0 +1,68 @@
#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},
{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,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;
int 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;
}

View File

@@ -0,0 +1,244 @@
/*
* 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/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, n;
if (isl_schedule_node_get_type(node) != isl_schedule_node_band)
return node;
n = isl_schedule_node_band_n_member(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);
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

View File

@@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 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 <http://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*)
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/*)
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 )
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 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

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