mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-09 15:51:08 +08:00
Makefile.def: Remove libbanshee.
Toplevel: 2004-09-09 Daniel Berlin <dberlin@dberlin.org> * Makefile.def: Remove libbanshee. * Makefile.tpl: Ditto. * configure.in: Ditto. * Makefile.in: Regen. * configure: Ditto. gcc/ 2004-09-09 Daniel Berlin <dberlin@dberlin.org> * Makefile.in: Remove libbanshee, tree-alias-*. Remove tree-alias-common.h dependencies. * common.opt: Remove -ftree-points-to. * configure.ac: Remove libbanshee. * flags.h: Remove pta_type, flag_tree_points_to. * gengtype.c (open_base_files): Remove tree-alias-type.h. * opts.c (OPT_ftree_points_to): Remove. * toplev.c: Remove tree-alias-common.h, flag_tree_points_to. * tree-dfa.c: Remove tree-alias-common.h * tree-into-ssa.c: Ditto. * tree-outof-ssa.c: Ditto. * tree-ssa-copyrename.c: Ditto. * tree-ssa-live.c: Ditto. * tree-optimize.c: Ditto. * tree-ssa.c: Ditto. Remove pass_build_pta, pass_del_pta. * tree-pass.h: Ditto. * tree-ssa-alias.c: Remove tree-alias-common.h. (struct alias_stats_d): Remove pta_queries, pta_resolved. (pass_may_alias): Remove PROP_pta requirement. (may_alias_p): Remove pta_queries, pta_resolved, use of andersens. (get_tmt_for): Ditto. (dump_alias_stats): Ditto. * doc/passes.texi: Remove blurb about points-to analysis. * fortran/Make-lang.in: Remove tree-alias-*.o. From-SVN: r87253
This commit is contained in:
parent
c1a404bd99
commit
0a05048550
ChangeLogMakefile.defMakefile.inMakefile.tplconfigureconfigure.in
gcc
ChangeLogMakefile.incommon.optconfigureconfigure.ac
doc
flags.hfortran
gengtype.copts.ctoplev.ctree-alias-ander.ctree-alias-ander.htree-alias-common.ctree-alias-common.htree-alias-type.ctree-alias-type.htree-dfa.ctree-into-ssa.ctree-optimize.ctree-outof-ssa.ctree-pass.htree-ssa-alias.ctree-ssa-copyrename.ctree-ssa-live.ctree-ssa.clibbanshee
.cvsignoreAUTHORSCOPYINGCOPYRIGHTChangeLogINSTALLMakefile.amMakefile.inNEWSREADMEaclocal.m4config.h.inconfigureconfigure.ac
engine
ChangeLogMakefile.amMakefile.inarray.carray.hbanshee.cbanshee.hbool.hbounds.cbounds.hbuffer.cbuffer.hcompiler.hdot.cdot.hflow-var.cflow-var.hflowrow-sort.cflowrow-sort.hhash.chash.hhashset.chashset.hjcollection.cjcollection.hlinkage.hlist.clist.hmalloc.cnonspec.cnonspec.hsetif-sort.csetif-sort.hsetif-var.csetif-var.hsetst-sort.csetst-sort.hsetst-var.csetst-var.hstamp.cstamp.hterm-sort.cterm-sort.hterm-var.cterm-var.htermhash.ctermhash.hufind.cufind.hutil.cutil.h
libcompat
@ -1,3 +1,11 @@
|
||||
2004-09-09 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Makefile.def: Remove libbanshee.
|
||||
* Makefile.tpl: Ditto.
|
||||
* configure.in: Ditto.
|
||||
* Makefile.in: Regen.
|
||||
* configure: Ditto.
|
||||
|
||||
2004-09-08 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
* ltmain.sh: Use $pic_object as $non_pic_object if
|
||||
|
@ -70,7 +70,6 @@ host_modules= { module= itcl; };
|
||||
host_modules= { module= ld; bootstrap=true; };
|
||||
host_modules= { module= libcpp; bootstrap=true; };
|
||||
host_modules= { module= libgui; };
|
||||
host_modules= { module= libbanshee; bootstrap=true; no_install=true; };
|
||||
host_modules= { module= libiberty; bootstrap=true; };
|
||||
host_modules= { module= libtool; };
|
||||
host_modules= { module= m4; };
|
||||
@ -253,7 +252,6 @@ dependencies = { module=all-gcc; on=all-binutils; };
|
||||
dependencies = { module=all-gcc; on=all-gas; };
|
||||
dependencies = { module=all-gcc; on=all-ld; };
|
||||
dependencies = { module=all-gcc; on=all-zlib; };
|
||||
dependencies = { module=all-gcc; on=all-libbanshee; };
|
||||
dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-build-libiberty; };
|
||||
|
||||
|
722
Makefile.in
722
Makefile.in
File diff suppressed because it is too large
Load Diff
@ -107,7 +107,7 @@ REALLY_SET_LIB_PATH = \
|
||||
$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
|
||||
|
||||
# This is the list of directories to be built for the build system.
|
||||
BUILD_CONFIGDIRS = libiberty libbanshee
|
||||
BUILD_CONFIGDIRS = libiberty
|
||||
# Build programs are put under this directory.
|
||||
BUILD_SUBDIR = @build_subdir@
|
||||
# This is set by the configure script to the arguments to use when configuring
|
||||
|
192
configure
vendored
192
configure
vendored
@ -11,8 +11,6 @@
|
||||
ac_help=
|
||||
ac_default_prefix=/usr/local
|
||||
# Any additions from configure.in:
|
||||
ac_help="$ac_help
|
||||
--without-libbanshee Don't build with libbanshee"
|
||||
ac_help="$ac_help
|
||||
--enable-libada Builds libada directory"
|
||||
ac_help="$ac_help
|
||||
@ -593,7 +591,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
||||
echo "configure:597: checking host system type" >&5
|
||||
echo "configure:595: checking host system type" >&5
|
||||
|
||||
host_alias=$host
|
||||
case "$host_alias" in
|
||||
@ -614,7 +612,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
echo "$ac_t""$host" 1>&6
|
||||
|
||||
echo $ac_n "checking target system type""... $ac_c" 1>&6
|
||||
echo "configure:618: checking target system type" >&5
|
||||
echo "configure:616: checking target system type" >&5
|
||||
|
||||
target_alias=$target
|
||||
case "$target_alias" in
|
||||
@ -632,7 +630,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
echo "$ac_t""$target" 1>&6
|
||||
|
||||
echo $ac_n "checking build system type""... $ac_c" 1>&6
|
||||
echo "configure:636: checking build system type" >&5
|
||||
echo "configure:634: checking build system type" >&5
|
||||
|
||||
build_alias=$build
|
||||
case "$build_alias" in
|
||||
@ -687,7 +685,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
|
||||
echo "configure:691: checking for a BSD compatible install" >&5
|
||||
echo "configure:689: checking for a BSD compatible install" >&5
|
||||
if test -z "$INSTALL"; then
|
||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -740,7 +738,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
echo $ac_n "checking whether ln works""... $ac_c" 1>&6
|
||||
echo "configure:744: checking whether ln works" >&5
|
||||
echo "configure:742: checking whether ln works" >&5
|
||||
if eval "test \"`echo '$''{'acx_cv_prog_LN'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -764,7 +762,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
|
||||
echo "configure:768: checking whether ln -s works" >&5
|
||||
echo "configure:766: checking whether ln -s works" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -891,7 +889,7 @@ build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fix
|
||||
|
||||
# these libraries are used by various programs built for the host environment
|
||||
#
|
||||
host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libbanshee libcpp"
|
||||
host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp"
|
||||
|
||||
# these tools are built for the host environment
|
||||
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
|
||||
@ -1084,21 +1082,6 @@ case "${host}" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check whether --with-libbanshee or --without-libbanshee was given.
|
||||
if test "${with_libbanshee+set}" = set; then
|
||||
withval="$with_libbanshee"
|
||||
:
|
||||
fi
|
||||
|
||||
case ${with_libbanshee} in
|
||||
no)
|
||||
noconfigdirs="$noconfigdirs libbanshee" ;;
|
||||
yes|"")
|
||||
with_libbanshee=yes
|
||||
;;
|
||||
*)
|
||||
{ echo "configure: error: --with-libbanshee can only be empty, "yes" or "no" (empty defaults to "yes"." 1>&2; exit 1; }
|
||||
esac
|
||||
|
||||
# Check whether --enable-libada or --disable-libada was given.
|
||||
if test "${enable_libada+set}" = set; then
|
||||
@ -1788,7 +1771,7 @@ else
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1792: checking for $ac_word" >&5
|
||||
echo "configure:1775: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -1818,7 +1801,7 @@ if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1822: checking for $ac_word" >&5
|
||||
echo "configure:1805: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -1869,7 +1852,7 @@ fi
|
||||
# Extract the first word of "cl", so it can be a program name with args.
|
||||
set dummy cl; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1873: checking for $ac_word" >&5
|
||||
echo "configure:1856: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -1901,7 +1884,7 @@ fi
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
|
||||
echo "configure:1905: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
echo "configure:1888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
@ -1912,12 +1895,12 @@ cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
|
||||
#line 1916 "configure"
|
||||
#line 1899 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
main(){return(0);}
|
||||
EOF
|
||||
if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
ac_cv_prog_cc_works=yes
|
||||
# If we can't run a trivial program, we are probably using a cross compiler.
|
||||
if (./conftest; exit) 2>/dev/null; then
|
||||
@ -1943,12 +1926,12 @@ if test $ac_cv_prog_cc_works = no; then
|
||||
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
|
||||
fi
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
|
||||
echo "configure:1947: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "configure:1930: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
|
||||
echo "configure:1952: checking whether we are using GNU C" >&5
|
||||
echo "configure:1935: checking whether we are using GNU C" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -1957,7 +1940,7 @@ else
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
@ -1976,7 +1959,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
|
||||
echo "configure:1980: checking whether ${CC-cc} accepts -g" >&5
|
||||
echo "configure:1963: checking whether ${CC-cc} accepts -g" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2043,7 +2026,7 @@ fi
|
||||
# Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2047: checking for $ac_word" >&5
|
||||
echo "configure:2030: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2075,7 +2058,7 @@ if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "gnatbind", so it can be a program name with args.
|
||||
set dummy gnatbind; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2079: checking for $ac_word" >&5
|
||||
echo "configure:2062: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2108,7 +2091,7 @@ fi
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6
|
||||
echo "configure:2112: checking whether compiler driver understands Ada" >&5
|
||||
echo "configure:2095: checking whether compiler driver understands Ada" >&5
|
||||
if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2141,7 +2124,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6
|
||||
echo "configure:2145: checking how to compare bootstrapped objects" >&5
|
||||
echo "configure:2128: checking how to compare bootstrapped objects" >&5
|
||||
if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2239,9 +2222,9 @@ saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $gmpinc"
|
||||
# Check GMP actually works
|
||||
echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6
|
||||
echo "configure:2243: checking for correct version of gmp.h" >&5
|
||||
echo "configure:2226: checking for correct version of gmp.h" >&5
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2245 "configure"
|
||||
#line 2228 "configure"
|
||||
#include "confdefs.h"
|
||||
#include "gmp.h"
|
||||
int main() {
|
||||
@ -2252,7 +2235,7 @@ choke me
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:2239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
echo "$ac_t""yes" 1>&6
|
||||
else
|
||||
@ -2265,12 +2248,12 @@ rm -f conftest*
|
||||
|
||||
if test x"$have_gmp" = xyes; then
|
||||
echo $ac_n "checking for MPFR""... $ac_c" 1>&6
|
||||
echo "configure:2269: checking for MPFR" >&5
|
||||
echo "configure:2252: checking for MPFR" >&5
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
LIBS="$LIBS $gmplibs"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2274 "configure"
|
||||
#line 2257 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <gmp.h>
|
||||
#include <mpfr.h>
|
||||
@ -2278,7 +2261,7 @@ int main() {
|
||||
mpfr_t n; mpfr_init(n);
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
echo "$ac_t""yes" 1>&6
|
||||
else
|
||||
@ -2721,10 +2704,6 @@ if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-
|
||||
extra_host_args="$extra_host_args --with-newlib"
|
||||
fi
|
||||
|
||||
if test x${with_libbanshee} = xyes && echo " ${configdirs} " | grep " libbanshee " >/dev/null 2>&1; then
|
||||
extra_host_args="$extra_host_args --with-libbanshee"
|
||||
fi
|
||||
|
||||
# Default to using --with-stabs for certain targets.
|
||||
if test x${with_stabs} = x ; then
|
||||
case "${target}" in
|
||||
@ -2759,7 +2738,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2766: checking for $ac_word" >&5
|
||||
echo "configure:2742: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_BISON'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2794,7 +2773,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2801: checking for $ac_word" >&5
|
||||
echo "configure:2777: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_YACC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2829,7 +2808,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2836: checking for $ac_word" >&5
|
||||
echo "configure:2812: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_M4'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2864,7 +2843,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2871: checking for $ac_word" >&5
|
||||
echo "configure:2847: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_FLEX'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2899,7 +2878,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2906: checking for $ac_word" >&5
|
||||
echo "configure:2882: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LEX'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -2934,7 +2913,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2941: checking for $ac_word" >&5
|
||||
echo "configure:2917: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_MAKEINFO'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3568,7 +3547,7 @@ test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
|
||||
# Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}ar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3575: checking for $ac_word" >&5
|
||||
echo "configure:3551: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3601,7 +3580,7 @@ if test -z "$ac_cv_prog_AR" ; then
|
||||
# Extract the first word of "ar", so it can be a program name with args.
|
||||
set dummy ar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3608: checking for $ac_word" >&5
|
||||
echo "configure:3584: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3640,7 +3619,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}as; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3647: checking for $ac_word" >&5
|
||||
echo "configure:3623: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3673,7 +3652,7 @@ if test -z "$ac_cv_prog_AS" ; then
|
||||
# Extract the first word of "as", so it can be a program name with args.
|
||||
set dummy as; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3680: checking for $ac_word" >&5
|
||||
echo "configure:3656: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3712,7 +3691,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}dlltool; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3719: checking for $ac_word" >&5
|
||||
echo "configure:3695: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3745,7 +3724,7 @@ if test -z "$ac_cv_prog_DLLTOOL" ; then
|
||||
# Extract the first word of "dlltool", so it can be a program name with args.
|
||||
set dummy dlltool; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3752: checking for $ac_word" >&5
|
||||
echo "configure:3728: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3784,7 +3763,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}ld; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3791: checking for $ac_word" >&5
|
||||
echo "configure:3767: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3817,7 +3796,7 @@ if test -z "$ac_cv_prog_LD" ; then
|
||||
# Extract the first word of "ld", so it can be a program name with args.
|
||||
set dummy ld; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3824: checking for $ac_word" >&5
|
||||
echo "configure:3800: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3856,7 +3835,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}nm; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3863: checking for $ac_word" >&5
|
||||
echo "configure:3839: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3889,7 +3868,7 @@ if test -z "$ac_cv_prog_NM" ; then
|
||||
# Extract the first word of "nm", so it can be a program name with args.
|
||||
set dummy nm; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3896: checking for $ac_word" >&5
|
||||
echo "configure:3872: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3928,7 +3907,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3935: checking for $ac_word" >&5
|
||||
echo "configure:3911: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -3961,7 +3940,7 @@ if test -z "$ac_cv_prog_RANLIB" ; then
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3968: checking for $ac_word" >&5
|
||||
echo "configure:3944: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4000,7 +3979,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}windres; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4007: checking for $ac_word" >&5
|
||||
echo "configure:3983: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4033,7 +4012,7 @@ if test -z "$ac_cv_prog_WINDRES" ; then
|
||||
# Extract the first word of "windres", so it can be a program name with args.
|
||||
set dummy windres; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4040: checking for $ac_word" >&5
|
||||
echo "configure:4016: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4072,7 +4051,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}objcopy; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4079: checking for $ac_word" >&5
|
||||
echo "configure:4055: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4105,7 +4084,7 @@ if test -z "$ac_cv_prog_OBJCOPY" ; then
|
||||
# Extract the first word of "objcopy", so it can be a program name with args.
|
||||
set dummy objcopy; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4112: checking for $ac_word" >&5
|
||||
echo "configure:4088: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4144,7 +4123,7 @@ fi
|
||||
# Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args.
|
||||
set dummy ${ncn_tool_prefix}objdump; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4151: checking for $ac_word" >&5
|
||||
echo "configure:4127: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4177,7 +4156,7 @@ if test -z "$ac_cv_prog_OBJDUMP" ; then
|
||||
# Extract the first word of "objdump", so it can be a program name with args.
|
||||
set dummy objdump; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4184: checking for $ac_word" >&5
|
||||
echo "configure:4160: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4223,7 +4202,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}ar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4230: checking for $ac_word" >&5
|
||||
echo "configure:4206: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4256,7 +4235,7 @@ if test -z "$ac_cv_prog_CONFIGURED_AR_FOR_TARGET" ; then
|
||||
# Extract the first word of "ar", so it can be a program name with args.
|
||||
set dummy ar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4263: checking for $ac_word" >&5
|
||||
echo "configure:4239: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4295,7 +4274,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}as; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4302: checking for $ac_word" >&5
|
||||
echo "configure:4278: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4328,7 +4307,7 @@ if test -z "$ac_cv_prog_CONFIGURED_AS_FOR_TARGET" ; then
|
||||
# Extract the first word of "as", so it can be a program name with args.
|
||||
set dummy as; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4335: checking for $ac_word" >&5
|
||||
echo "configure:4311: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4367,7 +4346,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4374: checking for $ac_word" >&5
|
||||
echo "configure:4350: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4400,7 +4379,7 @@ if test -z "$ac_cv_prog_CONFIGURED_DLLTOOL_FOR_TARGET" ; then
|
||||
# Extract the first word of "dlltool", so it can be a program name with args.
|
||||
set dummy dlltool; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4407: checking for $ac_word" >&5
|
||||
echo "configure:4383: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4439,7 +4418,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}ld; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4446: checking for $ac_word" >&5
|
||||
echo "configure:4422: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4472,7 +4451,7 @@ if test -z "$ac_cv_prog_CONFIGURED_LD_FOR_TARGET" ; then
|
||||
# Extract the first word of "ld", so it can be a program name with args.
|
||||
set dummy ld; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4479: checking for $ac_word" >&5
|
||||
echo "configure:4455: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4511,7 +4490,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}nm; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4518: checking for $ac_word" >&5
|
||||
echo "configure:4494: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4544,7 +4523,7 @@ if test -z "$ac_cv_prog_CONFIGURED_NM_FOR_TARGET" ; then
|
||||
# Extract the first word of "nm", so it can be a program name with args.
|
||||
set dummy nm; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4551: checking for $ac_word" >&5
|
||||
echo "configure:4527: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4583,7 +4562,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4590: checking for $ac_word" >&5
|
||||
echo "configure:4566: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4616,7 +4595,7 @@ if test -z "$ac_cv_prog_CONFIGURED_RANLIB_FOR_TARGET" ; then
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4623: checking for $ac_word" >&5
|
||||
echo "configure:4599: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4655,7 +4634,7 @@ fi
|
||||
# Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args.
|
||||
set dummy ${ncn_target_tool_prefix}windres; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4662: checking for $ac_word" >&5
|
||||
echo "configure:4638: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4688,7 +4667,7 @@ if test -z "$ac_cv_prog_CONFIGURED_WINDRES_FOR_TARGET" ; then
|
||||
# Extract the first word of "windres", so it can be a program name with args.
|
||||
set dummy windres; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4695: checking for $ac_word" >&5
|
||||
echo "configure:4671: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4773,7 +4752,7 @@ RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
|
||||
NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
|
||||
|
||||
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
|
||||
echo "configure:4780: checking whether to enable maintainer-specific portions of Makefiles" >&5
|
||||
echo "configure:4756: checking whether to enable maintainer-specific portions of Makefiles" >&5
|
||||
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
|
||||
if test "${enable_maintainer_mode+set}" = set; then
|
||||
enableval="$enable_maintainer_mode"
|
||||
@ -4820,7 +4799,7 @@ esac
|
||||
# gcc for stageN-gcc and stagePREV-gcc for stage(N-1). In case this is not
|
||||
# possible, however, we can resort to mv.
|
||||
echo $ac_n "checking if symbolic links between directories work""... $ac_c" 1>&6
|
||||
echo "configure:4827: checking if symbolic links between directories work" >&5
|
||||
echo "configure:4803: checking if symbolic links between directories work" >&5
|
||||
if eval "test \"`echo '$''{'gcc_cv_prog_ln_s_dir'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4934,15 +4913,34 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
||||
# Transform confdefs.h into DEFS.
|
||||
# Protect against shell expansion while executing Makefile rules.
|
||||
# Protect against Makefile macro expansion.
|
||||
cat > conftest.defs <<\EOF
|
||||
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
|
||||
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
|
||||
s%\[%\\&%g
|
||||
s%\]%\\&%g
|
||||
s%\$%$$%g
|
||||
EOF
|
||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
||||
rm -f conftest.defs
|
||||
#
|
||||
# If the first sed substitution is executed (which looks for macros that
|
||||
# take arguments), then we branch to the quote section. Otherwise,
|
||||
# look for a macro that doesn't take arguments.
|
||||
cat >confdef2opt.sed <<\_ACEOF
|
||||
t clear
|
||||
: clear
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
|
||||
t quote
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
|
||||
t quote
|
||||
d
|
||||
: quote
|
||||
s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
|
||||
s,\[,\\&,g
|
||||
s,\],\\&,g
|
||||
s,\$,$$,g
|
||||
p
|
||||
_ACEOF
|
||||
# We use echo to avoid assuming a particular line-breaking character.
|
||||
# The extra dot is to prevent the shell from consuming trailing
|
||||
# line-breaks from the sub-command output. A line-break within
|
||||
# single-quotes doesn't work because, if this script is created in a
|
||||
# platform that uses two characters for line-breaks (e.g., DOS), tr
|
||||
# would break.
|
||||
ac_LF_and_DOT=`echo; echo .`
|
||||
DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
|
||||
rm -f confdef2opt.sed
|
||||
|
||||
|
||||
# Without the "./", some shells look in PATH for config.status.
|
||||
|
17
configure.in
17
configure.in
@ -136,7 +136,7 @@ build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fix
|
||||
|
||||
# these libraries are used by various programs built for the host environment
|
||||
#
|
||||
host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libbanshee libcpp"
|
||||
host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp"
|
||||
|
||||
# these tools are built for the host environment
|
||||
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
|
||||
@ -308,17 +308,6 @@ case "${host}" in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(libbanshee,
|
||||
[ --without-libbanshee Don't build with libbanshee])
|
||||
case ${with_libbanshee} in
|
||||
no)
|
||||
noconfigdirs="$noconfigdirs libbanshee" ;;
|
||||
yes|"")
|
||||
with_libbanshee=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([--with-libbanshee can only be empty, "yes" or "no" (empty defaults to "yes".])
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(libada,
|
||||
[ --enable-libada Builds libada directory],
|
||||
@ -1526,10 +1515,6 @@ if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-
|
||||
extra_host_args="$extra_host_args --with-newlib"
|
||||
fi
|
||||
|
||||
if test x${with_libbanshee} = xyes && echo " ${configdirs} " | grep " libbanshee " >/dev/null 2>&1; then
|
||||
extra_host_args="$extra_host_args --with-libbanshee"
|
||||
fi
|
||||
|
||||
# Default to using --with-stabs for certain targets.
|
||||
if test x${with_stabs} = x ; then
|
||||
case "${target}" in
|
||||
|
@ -1,3 +1,31 @@
|
||||
2004-09-09 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Makefile.in: Remove libbanshee, tree-alias-*.
|
||||
Remove tree-alias-common.h dependencies.
|
||||
* common.opt: Remove -ftree-points-to.
|
||||
* configure.ac: Remove libbanshee.
|
||||
* flags.h: Remove pta_type, flag_tree_points_to.
|
||||
* gengtype.c (open_base_files): Remove tree-alias-type.h.
|
||||
* opts.c (OPT_ftree_points_to): Remove.
|
||||
* toplev.c: Remove tree-alias-common.h, flag_tree_points_to.
|
||||
* tree-dfa.c: Remove tree-alias-common.h
|
||||
* tree-into-ssa.c: Ditto.
|
||||
* tree-outof-ssa.c: Ditto.
|
||||
* tree-ssa-copyrename.c: Ditto.
|
||||
* tree-ssa-live.c: Ditto.
|
||||
* tree-optimize.c: Ditto.
|
||||
* tree-ssa.c: Ditto.
|
||||
Remove pass_build_pta, pass_del_pta.
|
||||
* tree-pass.h: Ditto.
|
||||
* tree-ssa-alias.c: Remove tree-alias-common.h.
|
||||
(struct alias_stats_d): Remove pta_queries, pta_resolved.
|
||||
(pass_may_alias): Remove PROP_pta requirement.
|
||||
(may_alias_p): Remove pta_queries, pta_resolved, use of andersens.
|
||||
(get_tmt_for): Ditto.
|
||||
(dump_alias_stats): Ditto.
|
||||
* doc/passes.texi: Remove blurb about points-to analysis.
|
||||
* fortran/Make-lang.in: Remove tree-alias-*.o.
|
||||
|
||||
2004-09-09 Richard Sandiford <rsandifo@redhat.com>
|
||||
|
||||
* genattrtab.c (write_insn_cases): New function, split out from
|
||||
|
@ -200,8 +200,6 @@ SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error
|
||||
# recognizing that the loop will always be executed at least once. We need
|
||||
# a new loop optimizer.
|
||||
reload1.o-warn = -Wno-error
|
||||
# These warnings are due to libbanshee.
|
||||
tree-alias-ander.o-warn = -Wno-error
|
||||
|
||||
# All warnings have to be shut off in stage1 if the compiler used then
|
||||
# isn't gcc; configure determines that. WARN_CFLAGS will be either
|
||||
@ -286,9 +284,6 @@ ZLIBINC = @zlibinc@
|
||||
GMPLIBS = @GMPLIBS@
|
||||
GMPINC = @GMPINC@
|
||||
|
||||
BANSHEELIB = @BANSHEELIB@
|
||||
BANSHEEINC = @BANSHEEINC@
|
||||
|
||||
CPPLIB = ../libcpp/libcpp.a
|
||||
CPPINC = -I$(srcdir)/../libcpp/include
|
||||
|
||||
@ -757,7 +752,7 @@ LIBIBERTY = ../libiberty/libiberty.a
|
||||
BUILD_LIBIBERTY = ../$(build_subdir)/libiberty/libiberty.a
|
||||
|
||||
# Dependencies on the intl and portability libraries.
|
||||
LIBDEPS= $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) $(BANSHEELIB)
|
||||
LIBDEPS= $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP)
|
||||
|
||||
# Likewise, for use in the tools that must run on this machine
|
||||
# even if we are cross-building GCC.
|
||||
@ -765,7 +760,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
|
||||
|
||||
# How to link with both our special library facilities
|
||||
# and the system's installed libraries.
|
||||
LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(BANSHEELIB) $(LIBIBERTY)
|
||||
LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY)
|
||||
|
||||
# Any system libraries needed just for GNAT.
|
||||
SYSLIBS = @GNAT_LIBEXC@
|
||||
@ -794,7 +789,7 @@ BUILD_VARRAY = build-varray.o
|
||||
# libintl.h will be found in ../intl if we are using the included libintl.
|
||||
INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
|
||||
-I$(srcdir)/../include @INCINTL@ \
|
||||
$(CPPINC) $(BANSHEEINC) $(GMPINC)
|
||||
$(CPPINC) $(GMPINC)
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
|
||||
@ -890,9 +885,9 @@ C_OBJS = c-parse.o c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
|
||||
OBJS-common = \
|
||||
tree-chrec.o tree-scalar-evolution.o tree-data-ref.o \
|
||||
tree-cfg.o tree-dfa.o tree-eh.o tree-ssa.o tree-optimize.o tree-gimple.o \
|
||||
tree-alias-type.o gimplify.o tree-pretty-print.o tree-into-ssa.o \
|
||||
tree-outof-ssa.o tree-alias-common.o tree-ssa-ccp.o tree-vn.o \
|
||||
@ANDER@ tree-ssa-dce.o tree-ssa-copy.o tree-nrv.o tree-ssa-copyrename.o \
|
||||
gimplify.o tree-pretty-print.o tree-into-ssa.o \
|
||||
tree-outof-ssa.o tree-ssa-ccp.o tree-vn.o \
|
||||
tree-ssa-dce.o tree-ssa-copy.o tree-nrv.o tree-ssa-copyrename.o \
|
||||
tree-ssa-pre.o tree-ssa-live.o tree-ssa-operands.o tree-ssa-alias.o \
|
||||
tree-ssa-phiopt.o tree-ssa-forwprop.o tree-nested.o tree-ssa-dse.o \
|
||||
tree-ssa-dom.o domwalk.o tree-tailcall.o gimple-low.o tree-iterator.o \
|
||||
@ -1556,7 +1551,7 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
varray.h $(HASHTAB_H) $(SPLAY_TREE_H) bitmap.h $(TREE_H) $(RTL_H) \
|
||||
function.h insn-config.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
|
||||
cselib.h insn-addr.h $(OPTABS_H) libfuncs.h debug.h $(GGC_H) \
|
||||
cgraph.h tree-alias-type.h $(TREE_FLOW_H) reload.h $(CPP_ID_DATA_H)
|
||||
cgraph.h $(TREE_FLOW_H) reload.h $(CPP_ID_DATA_H)
|
||||
|
||||
ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
|
||||
$(HASHTAB_H) toplev.h $(PARAMS_H) hosthooks.h
|
||||
@ -1599,31 +1594,19 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
$(TREE_H) $(PARAMS_H) $(FLAGS_H) function.h $(EXPR_H) $(RTL_H) toplev.h \
|
||||
$(GGC_H) $(TM_P_H) $(TARGET_H) \
|
||||
langhooks.h $(REGS_H)
|
||||
tree-alias-type.o: tree-alias-type.c tree-alias-type.h $(SYSTEM_H) $(CONFIG_H) \
|
||||
$(GGC_H) $(TM_H) coretypes.h $(VARRAY_H)
|
||||
tree-alias-ander.o: tree-alias-ander.c tree-alias-ander.h $(SYSTEM_H) \
|
||||
$(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) tree-alias-common.h \
|
||||
$(TM_H) coretypes.h cgraph.h tree-pass.h
|
||||
tree-alias-common.o: tree-alias-common.c tree-alias-common.h $(SYSTEM_H) \
|
||||
$(CONFIG_H) $(GGC_H) $(TREE_H) gt-tree-alias-common.h $(TREE_FLOW_H) \
|
||||
$(TM_H) coretypes.h cgraph.h tree-pass.h $(TIMEVAR_H) tree-alias-type.h \
|
||||
bitmap.h tree-alias-ander.h $(FLAGS_H) $(RTL_H) $(TM_P_H) \
|
||||
hard-reg-set.h $(BASIC_BLOCK_H) output.h errors.h $(EXPR_H) \
|
||||
$(DIAGNOSTIC_H) $(C_COMMON_H) tree-inline.h varray.h $(C_TREE_H) \
|
||||
$(TREE_GIMPLE_H) $(HASHTAB_H) function.h
|
||||
tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) \
|
||||
$(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h $(CFGLOOP_H) \
|
||||
tree-pass.h
|
||||
tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) \
|
||||
$(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h domwalk.h tree-pass.h \
|
||||
$(GGC_H)
|
||||
tree-outof-ssa.o : tree-outof-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) \
|
||||
$(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h domwalk.h \
|
||||
tree-pass.h $(TREE_SSA_LIVE_H)
|
||||
tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||
@ -1665,12 +1648,12 @@ domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
$(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) domwalk.h $(GGC_H)
|
||||
tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \
|
||||
errors.h toplev.h function.h $(TIMEVAR_H) \
|
||||
$(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H)
|
||||
tree-ssa-copyrename.o : tree-ssa-copyrename.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
|
||||
diagnostic.h errors.h toplev.h function.h $(TIMEVAR_H) tree-pass.h \
|
||||
tree-alias-common.h $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H)
|
||||
$(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H)
|
||||
tree-ssa-pre.o : tree-ssa-pre.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(SYSTEM_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \
|
||||
$(GGC_H) output.h diagnostic.h errors.h toplev.h $(TIMEVAR_H) \
|
||||
@ -1697,7 +1680,7 @@ tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
|
||||
tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
|
||||
errors.h tree-inline.h $(HASHTAB_H) $(FLAGS_H) function.h $(TIMEVAR_H) \
|
||||
tree-alias-common.h convert.h $(TM_H) coretypes.h langhooks.h \
|
||||
convert.h $(TM_H) coretypes.h langhooks.h \
|
||||
$(TREE_DUMP_H) tree-pass.h params.h
|
||||
tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(SYSTEM_H) $(TREE_H) $(TM_P_H) $(GGC_H) diagnostic.h errors.h \
|
||||
@ -1736,11 +1719,11 @@ tree-ssa-loop-im.o : tree-ssa-loop-im.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
tree-pass.h flags.h
|
||||
tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) tree-inline.h $(FLAGS_H) \
|
||||
function.h $(TIMEVAR_H) tree-alias-common.h convert.h $(TM_H) coretypes.h \
|
||||
function.h $(TIMEVAR_H) convert.h $(TM_H) coretypes.h \
|
||||
langhooks.h $(TREE_DUMP_H) tree-pass.h params.h
|
||||
tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \
|
||||
$(GGC_H) output.h diagnostic.h errors.h $(FLAGS_H) tree-alias-common.h \
|
||||
$(GGC_H) output.h diagnostic.h errors.h $(FLAGS_H) \
|
||||
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) toplev.h function.h \
|
||||
langhooks.h $(FLAGS_H) cgraph.h tree-inline.h tree-mudflap.h $(GGC_H) \
|
||||
cgraph.h tree-pass.h
|
||||
@ -2430,8 +2413,6 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
|
||||
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
|
||||
$(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
|
||||
$(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
|
||||
$(srcdir)/tree-alias-type.h $(srcdir)/tree-alias-common.h \
|
||||
$(srcdir)/tree-alias-type.c $(srcdir)/tree-alias-common.c \
|
||||
$(srcdir)/tree-chrec.h \
|
||||
$(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
|
||||
$(srcdir)/tree-profile.c $(srcdir)/rtl-profile.c $(srcdir)/tree-nested.c \
|
||||
@ -2451,7 +2432,7 @@ gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dojump.h \
|
||||
gt-dwarf2out.h gt-ra-build.h gt-reg-stack.h gt-dwarf2asm.h \
|
||||
gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parse.h \
|
||||
gt-c-pragma.h gtype-c.h gt-input.h gt-cfglayout.h \
|
||||
gt-tree-alias-common.h gt-tree-mudflap.h \
|
||||
gt-tree-mudflap.h \
|
||||
gt-tree-ssa-ccp.h gt-tree-eh.h \
|
||||
gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \
|
||||
gt-tree-phinodes.h gt-tree-cfg.h gt-tree-nested.h \
|
||||
|
@ -876,9 +876,6 @@ ftree-loop-optimize
|
||||
Common Report Var(flag_tree_loop_optimize) Init(1)
|
||||
Enable loop optimizations on tree level
|
||||
|
||||
ftree-points-to=
|
||||
Common Joined RejectNegative
|
||||
|
||||
ftree-pre
|
||||
Common Report Var(flag_tree_pre)
|
||||
Enable SSA-PRE optimization on trees
|
||||
|
40
gcc/configure
vendored
40
gcc/configure
vendored
@ -309,7 +309,7 @@ ac_includes_default="\
|
||||
# include <unistd.h>
|
||||
#endif"
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag TREEBROWSER EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2 libgcc_visibility GGC zlibdir zlibinc MAINT ANDER BANSHEEINC BANSHEELIB gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag TREEBROWSER EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2 libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files='language_hooks'
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@ -925,7 +925,6 @@ Optional Packages:
|
||||
--with-gc={page,zone} choose the garbage collection mechanism to use
|
||||
with the compiler
|
||||
--with-system-zlib use installed libz
|
||||
--with-libbanshee enable libbanshee
|
||||
--with-slibdir=DIR shared libraries in DIR LIBDIR
|
||||
|
||||
Some influential environment variables:
|
||||
@ -5291,7 +5290,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then
|
||||
else
|
||||
ac_prog_version=`$MAKEINFO --version 2>&1 |
|
||||
sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
|
||||
echo "configure:5294: version of makeinfo is $ac_prog_version" >&5
|
||||
echo "configure:5293: version of makeinfo is $ac_prog_version" >&5
|
||||
case $ac_prog_version in
|
||||
'') gcc_cv_prog_makeinfo_modern=no;;
|
||||
4.[2-9]*)
|
||||
@ -12186,38 +12185,6 @@ else
|
||||
MAINT='#'
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking whether to use libbanshee for points-to alias analysis" >&5
|
||||
echo $ECHO_N "checking whether to use libbanshee for points-to alias analysis... $ECHO_C" >&6
|
||||
|
||||
# Check whether --with-libbanshee or --without-libbanshee was given.
|
||||
if test "${with_libbanshee+set}" = set; then
|
||||
withval="$with_libbanshee"
|
||||
libbanshee="$with_libbanshee"
|
||||
else
|
||||
libbanshee=no
|
||||
fi;
|
||||
|
||||
if test x"$libbanshee" = xyes; then
|
||||
BANSHEELIB="../libbanshee/points-to/libandersen.a ../libbanshee/engine/libbansheeengine.a ../libbanshee/libcompat/libbansheecompat.a "
|
||||
BANSHEEINC="-I\$(srcdir)/../libbanshee/libcompat -I\$(srcdir)/../libbanshee -I\$(srcdir)/../libbanshee/points-to"
|
||||
ANDER="tree-alias-ander.o"
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_BANSHEE 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
BANSHEELIB=""
|
||||
BANSHEEINC=""
|
||||
ANDER=""
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $with_libbanshee" >&5
|
||||
echo "${ECHO_T}$with_libbanshee" >&6
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# --------------
|
||||
# Language hooks
|
||||
# --------------
|
||||
@ -13250,9 +13217,6 @@ s,@GGC@,$GGC,;t t
|
||||
s,@zlibdir@,$zlibdir,;t t
|
||||
s,@zlibinc@,$zlibinc,;t t
|
||||
s,@MAINT@,$MAINT,;t t
|
||||
s,@ANDER@,$ANDER,;t t
|
||||
s,@BANSHEEINC@,$BANSHEEINC,;t t
|
||||
s,@BANSHEELIB@,$BANSHEELIB,;t t
|
||||
s,@gcc_tooldir@,$gcc_tooldir,;t t
|
||||
s,@dollar@,$dollar,;t t
|
||||
s,@slibdir@,$slibdir,;t t
|
||||
|
@ -2973,28 +2973,6 @@ else
|
||||
fi
|
||||
AC_SUBST(MAINT)dnl
|
||||
|
||||
AC_MSG_CHECKING([whether to use libbanshee for points-to alias analysis])
|
||||
AC_ARG_WITH(libbanshee,
|
||||
[ --with-libbanshee enable libbanshee],
|
||||
libbanshee="$with_libbanshee",
|
||||
libbanshee=no)
|
||||
|
||||
if test x"$libbanshee" = xyes; then
|
||||
BANSHEELIB="../libbanshee/points-to/libandersen.a ../libbanshee/engine/libbansheeengine.a ../libbanshee/libcompat/libbansheecompat.a "
|
||||
BANSHEEINC="-I\$(srcdir)/../libbanshee/libcompat -I\$(srcdir)/../libbanshee -I\$(srcdir)/../libbanshee/points-to"
|
||||
ANDER="tree-alias-ander.o"
|
||||
AC_DEFINE(HAVE_BANSHEE, 1, [Define if BANSHEE is available])
|
||||
else
|
||||
BANSHEELIB=""
|
||||
BANSHEEINC=""
|
||||
ANDER=""
|
||||
fi
|
||||
AC_MSG_RESULT($with_libbanshee)
|
||||
|
||||
AC_SUBST(ANDER)
|
||||
AC_SUBST(BANSHEEINC)
|
||||
AC_SUBST(BANSHEELIB)
|
||||
|
||||
# --------------
|
||||
# Language hooks
|
||||
# --------------
|
||||
|
@ -240,12 +240,6 @@ for the variable within this function. This data is needed by the
|
||||
SSA rewriting routines. The pass is located in @file{tree-dfa.c}
|
||||
and is described by @code{pass_referenced_vars}.
|
||||
|
||||
@item Points-to analysis
|
||||
|
||||
This pass constructs flow-insensitive alias analysis information.
|
||||
The pass is located in @file{tree-alias-common.c} and described by
|
||||
@code{pass_build_pta}.
|
||||
|
||||
@item Enter static single assignment form
|
||||
|
||||
This pass rewrites the function such that it is in SSA form. After
|
||||
|
@ -240,14 +240,6 @@ extern enum graph_dump_types graph_dump_format;
|
||||
and to print them when we are done. */
|
||||
extern int flag_detailed_statistics;
|
||||
|
||||
/* Enable points-to analysis on trees. */
|
||||
enum pta_type
|
||||
{
|
||||
PTA_NONE,
|
||||
PTA_ANDERSEN
|
||||
};
|
||||
extern enum pta_type flag_tree_points_to;
|
||||
|
||||
extern int flag_web;
|
||||
|
||||
/* Nonzero means that we defer emitting functions until they are actually
|
||||
|
@ -83,7 +83,7 @@ F95_OBJS = $(F95_PARSER_OBJS) \
|
||||
F95_ADDITIONAL_OBJS = \
|
||||
tree-cfg.o tree-dfa.o tree-optimize.o tree-gimple.o \
|
||||
tree-ssa.o tree-ssa-ccp.o tree-ssa-dce.o \
|
||||
tree-alias-common.o tree-alias-type.o gimplify.o stor-layout.o
|
||||
gimplify.o stor-layout.o
|
||||
|
||||
# GFORTRAN uses GMP for its internal arithmetics.
|
||||
F95_LIBS = $(GMPLIBS) $(LIBS)
|
||||
|
@ -1085,7 +1085,7 @@ open_base_files (void)
|
||||
"function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
|
||||
"basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
|
||||
"libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
|
||||
"tree-alias-type.h", "tree-flow.h", "reload.h",
|
||||
"tree-flow.h", "reload.h",
|
||||
"cpp-id-data.h",
|
||||
"tree-chrec.h",
|
||||
NULL
|
||||
|
16
gcc/opts.c
16
gcc/opts.c
@ -954,22 +954,6 @@ common_handle_option (size_t scode, const char *arg, int value)
|
||||
flag_tracer_set = true;
|
||||
break;
|
||||
|
||||
case OPT_ftree_points_to_:
|
||||
if (!strcmp (arg, "andersen"))
|
||||
#ifdef HAVE_BANSHEE
|
||||
flag_tree_points_to = PTA_ANDERSEN;
|
||||
#else
|
||||
warning ("Andersen's PTA not available - libbanshee not compiled.");
|
||||
#endif
|
||||
else if (!strcmp (arg, "none"))
|
||||
flag_tree_points_to = PTA_NONE;
|
||||
else
|
||||
{
|
||||
warning ("`%s`: unknown points-to analysis algorithm", arg);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_funroll_loops:
|
||||
flag_unroll_loops_set = true;
|
||||
break;
|
||||
|
@ -74,7 +74,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "target.h"
|
||||
#include "langhooks.h"
|
||||
#include "cfglayout.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "cfgloop.h"
|
||||
#include "hosthooks.h"
|
||||
#include "cgraph.h"
|
||||
@ -332,9 +331,6 @@ rtx stack_limit_rtx;
|
||||
one, unconditionally renumber instruction UIDs. */
|
||||
int flag_renumber_insns = 1;
|
||||
|
||||
/* Enable points-to analysis on trees. */
|
||||
enum pta_type flag_tree_points_to = PTA_NONE;
|
||||
|
||||
/* Nonzero if we should track variables. When
|
||||
flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
|
||||
to optimize, debug_info_level and debug_hooks in process_options (). */
|
||||
|
@ -1,933 +0,0 @@
|
||||
/* Tree based Andersen points-to analysis
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC 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 GCC; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
#include "ggc.h"
|
||||
#include "bitmap.h"
|
||||
#include "tree-alias-type.h"
|
||||
#include "tree-alias-ander.h"
|
||||
#include "flags.h"
|
||||
#include "rtl.h"
|
||||
#include "tm_p.h"
|
||||
#include "hard-reg-set.h"
|
||||
#include "basic-block.h"
|
||||
#include "output.h"
|
||||
#include "errors.h"
|
||||
#include "expr.h"
|
||||
#include "diagnostic.h"
|
||||
#include "tree.h"
|
||||
#include "tree-flow.h"
|
||||
#include "tree-inline.h"
|
||||
#include "varray.h"
|
||||
#include "tree-gimple.h"
|
||||
#include "splay-tree.h"
|
||||
#include "engine/util.h"
|
||||
#include "libcompat/regions.h"
|
||||
#include "andersen_terms.h"
|
||||
#include "cgraph.h"
|
||||
#include "tree-pass.h"
|
||||
|
||||
|
||||
/* Andersen's interprocedural points-to analysis.
|
||||
This is a flow-insensitive, context insensitive algorithm.
|
||||
|
||||
This file is an implementation of the alias_ops structure used by
|
||||
tree-alias-common.c to drive PTA analysis.
|
||||
|
||||
All these functions do is generate constraints for and through
|
||||
libbanshee. When we query for a points-to set, we ask libbanshee
|
||||
to solve the constraints and give us the answer. The terms of the
|
||||
constraints are the aterms, which are an opaque data structure
|
||||
that stores libbanshee specific data for the constraints.
|
||||
|
||||
The constraints to be generated come from andersen's paper. By
|
||||
constraint, we mean something like "the points-to set of A must be
|
||||
a subset or equal to the points-to set of B" or "the points-to set
|
||||
of A must include Q". In order to avoid having to write all the
|
||||
constraints directly in the code, we use helper functions such as
|
||||
pta_assignment, pta_rvalue, etc, that generate the necessary
|
||||
constraint terms for us, making for much more readable code.
|
||||
|
||||
One could replace libbanshee with some other constraint solving
|
||||
engine, and you'd simply have to replace the implementation of the
|
||||
pta_* functions, and provide replacements for the aterm specific
|
||||
functions (like making a list of aterms, printing the label of an
|
||||
aterm). However, libbanshee is extremely fast, and extremely low
|
||||
memory usage, so one would be hard pressed to do better than it
|
||||
anyway.
|
||||
|
||||
Understanding how constraint solving and what each constraint means is
|
||||
beyond the scope of this documentation. See the libbanshee
|
||||
documentation, and references therein for more enlightenment.
|
||||
|
||||
That said, our constraints inclusion constraints of set
|
||||
expressions. Given the helper functions, the various inference
|
||||
functions we implement should *look* relatively straightforward.
|
||||
|
||||
In order to save time during queries, we cache the resulting
|
||||
points-to sets of each variable, rather than recalculate them
|
||||
again and again. (libbanshee actually has it's own internal
|
||||
caching, but the function call overhead for calling the solver is
|
||||
non-trivial, given the number of queries).
|
||||
|
||||
Todo: Don't pass alias ops as first argument, just have a global
|
||||
"current_alias_ops". */
|
||||
|
||||
static unsigned int id_num = 1;
|
||||
static region andersen_rgn;
|
||||
static void andersen_simple_assign (struct tree_alias_ops *,
|
||||
alias_var, alias_var);
|
||||
static void andersen_addr_assign (struct tree_alias_ops *,
|
||||
alias_var, alias_var);
|
||||
static void andersen_ptr_assign (struct tree_alias_ops *,
|
||||
alias_var, alias_var);
|
||||
static void andersen_op_assign (struct tree_alias_ops *,
|
||||
alias_var, varray_type, tree, bitmap);
|
||||
static void andersen_heap_assign (struct tree_alias_ops *, alias_var);
|
||||
static void andersen_assign_ptr (struct tree_alias_ops *,
|
||||
alias_var, alias_var);
|
||||
static void andersen_function_def (struct tree_alias_ops *, alias_var,
|
||||
varray_type, alias_var);
|
||||
static int andersen_function_call (struct tree_alias_ops *, alias_var,
|
||||
alias_var, varray_type, bitmap);
|
||||
static void andersen_init (struct tree_alias_ops *);
|
||||
static int print_out_result (splay_tree_node, void *);
|
||||
static void andersen_cleanup (struct tree_alias_ops *);
|
||||
static bool andersen_may_alias (struct tree_alias_ops *, alias_var,
|
||||
alias_var);
|
||||
static bool andersen_same_points_to_set (struct tree_alias_ops *,
|
||||
alias_var, alias_var);
|
||||
static bool andersen_empty_points_to_set (struct tree_alias_ops *,
|
||||
alias_var);
|
||||
static alias_var andersen_add_var (struct tree_alias_ops *, tree);
|
||||
static alias_var andersen_add_var_same (struct tree_alias_ops *,
|
||||
tree, alias_var);
|
||||
static bool pointer_destroying_op (tree);
|
||||
static aterm_list get_ptset (alias_var);
|
||||
static splay_tree ptamap;
|
||||
|
||||
|
||||
static struct tree_alias_ops andersen_ops = {
|
||||
andersen_init,
|
||||
andersen_cleanup,
|
||||
andersen_add_var,
|
||||
andersen_add_var_same,
|
||||
andersen_simple_assign,
|
||||
andersen_addr_assign,
|
||||
andersen_ptr_assign,
|
||||
andersen_op_assign,
|
||||
andersen_heap_assign,
|
||||
andersen_assign_ptr,
|
||||
andersen_function_def,
|
||||
andersen_function_call,
|
||||
andersen_may_alias,
|
||||
andersen_same_points_to_set,
|
||||
andersen_empty_points_to_set,
|
||||
0, /* data */
|
||||
0, /* Currently non-interprocedural */
|
||||
1 /* Can do IP on all statics without help. */
|
||||
};
|
||||
struct tree_alias_ops *andersen_alias_ops = &andersen_ops;
|
||||
|
||||
static void term_inclusion (aterm, aterm);
|
||||
static void pta_init (void);
|
||||
static void pta_reset (void);
|
||||
static aterm get_ref (aterm);
|
||||
static argterm fun_rec_aterm (aterm_list);
|
||||
static aterm pta_make_lam (const char *, aterm, aterm_list);
|
||||
static aterm pta_make_ref (const char *);
|
||||
static aterm pta_bottom (void);
|
||||
static aterm pta_join (aterm, aterm);
|
||||
static aterm pta_deref (aterm);
|
||||
static aterm pta_rvalue (aterm);
|
||||
static aterm pta_address (aterm);
|
||||
static void pta_assignment (aterm, aterm);
|
||||
static aterm pta_make_fun (const char *, aterm, aterm_list);
|
||||
static aterm pta_application (aterm, aterm_list);
|
||||
|
||||
typedef aterm contents_type;
|
||||
static contents_type pta_get_contents (aterm);
|
||||
static void pr_ptset_aterm_elem (aterm);
|
||||
static void pta_pr_ptset (contents_type);
|
||||
|
||||
/* Hook for debugging. This function is called instead of
|
||||
aterm_inclusion, and lets us print the actual constraints as they
|
||||
are generated. */
|
||||
|
||||
static void
|
||||
term_inclusion (aterm t1, aterm t2)
|
||||
{
|
||||
if (dump_file)
|
||||
{
|
||||
fprintf (dump_file, "Constraint: ");
|
||||
aterm_print (dump_file, t1);
|
||||
fprintf (dump_file, " <= ");
|
||||
aterm_print (dump_file, t2);
|
||||
fprintf (dump_file, "\n");
|
||||
}
|
||||
|
||||
aterm_inclusion (t1, t2);
|
||||
}
|
||||
|
||||
/* Initialize libbanshee's constraint engine. */
|
||||
|
||||
static void
|
||||
pta_init (void)
|
||||
{
|
||||
andersen_terms_init ();
|
||||
}
|
||||
|
||||
/* Reset libbanshee's constraint engine. We do this when we are done
|
||||
using it, as it releases the memory libbanshee is using. */
|
||||
|
||||
static void
|
||||
pta_reset (void)
|
||||
{
|
||||
andersen_terms_reset ();
|
||||
}
|
||||
|
||||
static aterm
|
||||
get_ref (aterm t)
|
||||
{
|
||||
struct ref_decon r_decon;
|
||||
r_decon = ref_decon (t);
|
||||
|
||||
assert (r_decon.f1);
|
||||
|
||||
return r_decon.f1;
|
||||
}
|
||||
|
||||
/* Make a function record out of the arguments. */
|
||||
|
||||
static argterm
|
||||
fun_rec_aterm (aterm_list args)
|
||||
{
|
||||
region scratch;
|
||||
int counter = 0;
|
||||
argterm rest, result;
|
||||
aterm_list_scanner scan;
|
||||
aterm temp;
|
||||
char field_name[512];
|
||||
argterm_map map;
|
||||
|
||||
scratch = newregion ();
|
||||
map = new_argterm_map (scratch);
|
||||
aterm_list_scan (args, &scan);
|
||||
while (aterm_list_next (&scan, &temp))
|
||||
{
|
||||
snprintf (field_name, 512, "%d", counter++);
|
||||
argterm_map_cons (argterm_make_field (field_name, temp), map);
|
||||
}
|
||||
|
||||
rest = argterm_wild ();
|
||||
/* rest = argterm_fresh(); */
|
||||
|
||||
/* safe since field_add makes a copy of the string*/
|
||||
result = argterm_row (map, rest);
|
||||
|
||||
deleteregion (scratch);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static aterm
|
||||
pta_make_lam (const char *id, aterm ret, aterm_list args)
|
||||
{
|
||||
return lam (label_term_constant (id), fun_rec_aterm (args), ret);
|
||||
}
|
||||
|
||||
/* Make a label reference to the given id. */
|
||||
|
||||
static aterm
|
||||
pta_make_ref (const char *id)
|
||||
{
|
||||
|
||||
aterm var = aterm_fresh (id);
|
||||
|
||||
label_term tag = label_term_constant (id);
|
||||
|
||||
return ref (tag, var, var);
|
||||
}
|
||||
|
||||
/* Return the empty set. */
|
||||
|
||||
static aterm
|
||||
pta_bottom (void)
|
||||
{
|
||||
return aterm_zero ();
|
||||
}
|
||||
|
||||
/* Join two terms, such that anything in set t1 will also be in set
|
||||
t2, and vice versa. */
|
||||
|
||||
static aterm
|
||||
pta_join (aterm t1, aterm t2)
|
||||
{
|
||||
aterm result;
|
||||
region scratch_rgn = newregion ();
|
||||
aterm_list list = new_aterm_list (scratch_rgn);
|
||||
|
||||
aterm_list_cons (t1, list);
|
||||
aterm_list_cons (t2, list);
|
||||
|
||||
|
||||
result = aterm_union (list);
|
||||
deleteregion (scratch_rgn);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Generate the constraint for a dereference of term t1. */
|
||||
|
||||
static aterm
|
||||
pta_deref (aterm t1)
|
||||
{
|
||||
return ref_proj2 (t1);
|
||||
}
|
||||
|
||||
/* Generate the constraint for t1 being an rvalue. */
|
||||
|
||||
static aterm
|
||||
pta_rvalue (aterm t1)
|
||||
{
|
||||
return pta_deref (t1);
|
||||
}
|
||||
|
||||
/* Generate the constraint for taking the address of t1. */
|
||||
|
||||
static aterm
|
||||
pta_address (aterm t1)
|
||||
{
|
||||
return ref (label_term_one (), aterm_one (), t1);
|
||||
}
|
||||
|
||||
/* Generate the constraint for assigning t2 to t1. */
|
||||
|
||||
static void
|
||||
pta_assignment (aterm t1, aterm t2)
|
||||
{
|
||||
term_inclusion (t1, ref_pat1 (t2));
|
||||
}
|
||||
|
||||
/* Make a function from the given name, return value, and arguments. */
|
||||
|
||||
static aterm
|
||||
pta_make_fun (const char *name, aterm ret, aterm_list args)
|
||||
{
|
||||
aterm temp;
|
||||
aterm_list_scanner scan;
|
||||
region scratch_rgn = newregion ();
|
||||
aterm_list arg_list = new_aterm_list (scratch_rgn);
|
||||
|
||||
aterm_list_scan (args, &scan);
|
||||
|
||||
while (aterm_list_next (&scan, &temp))
|
||||
{
|
||||
aterm_list_cons (get_ref (temp), arg_list);
|
||||
}
|
||||
|
||||
return pta_make_lam (name, get_ref (ret), arg_list);
|
||||
}
|
||||
|
||||
/* Return the constraint for calling function T with arguments
|
||||
ACTUALS. */
|
||||
|
||||
static aterm
|
||||
pta_application (aterm t, aterm_list actuals)
|
||||
{
|
||||
argterm args = fun_rec_aterm (actuals);
|
||||
|
||||
term_inclusion (t, lam_pat1 (args));
|
||||
return pta_address (lam_proj2 (t));
|
||||
}
|
||||
|
||||
/* Return the contents of set expression T. */
|
||||
|
||||
static contents_type
|
||||
pta_get_contents (aterm t)
|
||||
{
|
||||
struct ref_decon t_decon;
|
||||
t_decon = ref_decon (t);
|
||||
|
||||
return t_decon.f1;
|
||||
}
|
||||
|
||||
/* Print out a points-to set element. */
|
||||
|
||||
static void
|
||||
pr_ptset_aterm_elem (aterm t)
|
||||
{
|
||||
struct ref_decon ref;
|
||||
struct lam_decon lam;
|
||||
|
||||
ref = ref_decon (t);
|
||||
lam = lam_decon (t);
|
||||
|
||||
fprintf (dump_file, ",");
|
||||
if (ref.f0)
|
||||
label_term_print (dump_file, ref.f0);
|
||||
else if (lam.f0)
|
||||
label_term_print (dump_file, lam.f0);
|
||||
}
|
||||
|
||||
|
||||
/* Print out a points-to set. */
|
||||
|
||||
static void
|
||||
pta_pr_ptset (contents_type t)
|
||||
{
|
||||
int size;
|
||||
region scratch_rgn;
|
||||
aterm_list ptset;
|
||||
scratch_rgn = newregion ();
|
||||
ptset = aterm_list_copy (scratch_rgn, aterm_tlb (t));
|
||||
|
||||
size = aterm_list_length (ptset);
|
||||
|
||||
fprintf (dump_file, "{");
|
||||
if (!aterm_list_empty (ptset))
|
||||
{
|
||||
struct ref_decon ref;
|
||||
struct lam_decon lam;
|
||||
ref = ref_decon (aterm_list_head (ptset));
|
||||
lam = lam_decon (aterm_list_head (ptset));
|
||||
if (ref.f0)
|
||||
label_term_print (dump_file, ref.f0);
|
||||
else if (lam.f0)
|
||||
label_term_print (dump_file, lam.f0);
|
||||
|
||||
/* aterm_pr(stdout,aterm_hd(ptset)); */
|
||||
ptset = aterm_list_tail (ptset);
|
||||
}
|
||||
aterm_list_app (ptset, pr_ptset_aterm_elem);
|
||||
fprintf (dump_file, "}(%d)\n", size);
|
||||
deleteregion (scratch_rgn);
|
||||
}
|
||||
|
||||
/* Initialize Andersen alias analysis. */
|
||||
static int initted = 0;
|
||||
|
||||
static void
|
||||
andersen_init (struct tree_alias_ops *ops ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#if 0
|
||||
/* Don't claim we can do ip partial unless we have unit_at_a_time on. */
|
||||
if (!flag_unit_at_a_time)
|
||||
#endif
|
||||
andersen_ops.ip_partial = 0;
|
||||
if (!initted || (!andersen_ops.ip_partial && !andersen_ops.ip))
|
||||
{
|
||||
pta_init ();
|
||||
andersen_rgn = newregion ();
|
||||
initted = 1;
|
||||
}
|
||||
|
||||
ptamap = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
print_out_result (splay_tree_node node, void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
fprintf (dump_file, "%s :=",
|
||||
alias_get_name (ALIAS_VAR_DECL (((alias_var) node->value))));
|
||||
pta_pr_ptset (pta_get_contents ((aterm) node->key));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cleanup after Andersen alias analysis. */
|
||||
|
||||
static void
|
||||
andersen_cleanup (struct tree_alias_ops *ops ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (dump_file)
|
||||
{
|
||||
if (dump_flags & TDF_STATS)
|
||||
{
|
||||
fprintf (dump_file, "\nPoints-to stats:\n");
|
||||
andersen_terms_stats (dump_file);
|
||||
}
|
||||
|
||||
fprintf (dump_file, "\nPoints-to sets:\n");
|
||||
splay_tree_foreach (ptamap, print_out_result, NULL);
|
||||
}
|
||||
|
||||
splay_tree_delete (ptamap);
|
||||
|
||||
if (!andersen_ops.ip_partial && !andersen_ops.ip)
|
||||
{
|
||||
pta_reset ();
|
||||
deleteregion (andersen_rgn);
|
||||
andersen_rgn = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add decl to the analyzer, and return a var for it. For
|
||||
Andersen, we create a new alias var for the declaration, and
|
||||
return that. */
|
||||
|
||||
static alias_var
|
||||
andersen_add_var (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl)
|
||||
{
|
||||
alias_var ret;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Adding variable %s\n",
|
||||
alias_get_name (decl));
|
||||
|
||||
if (alias_get_name (decl) != NULL)
|
||||
{
|
||||
ret = alias_var_new_with_aterm (decl,
|
||||
pta_make_ref (alias_get_name (decl)));
|
||||
}
|
||||
else
|
||||
{
|
||||
char *tmp_name;
|
||||
ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++);
|
||||
ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name));
|
||||
}
|
||||
splay_tree_insert (ptamap, (splay_tree_key) ALIAS_VAR_ATERM (ret),
|
||||
(splay_tree_value) ret);
|
||||
ALIAS_VAR_PTSET (ret) = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Add a variable to the analyzer that is equivalent (as far as
|
||||
aliases go) to some existing alias variable.
|
||||
For Andersen, we just call a function that does this for us. */
|
||||
|
||||
static alias_var
|
||||
andersen_add_var_same (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl,
|
||||
alias_var tv)
|
||||
{
|
||||
alias_var ret;
|
||||
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Adding variable %s same as %s\n",
|
||||
alias_get_name (decl), alias_get_name (ALIAS_VAR_DECL (tv)));
|
||||
|
||||
if (alias_get_name (decl) != NULL)
|
||||
ret = alias_var_new_with_aterm (decl,
|
||||
pta_make_ref (alias_get_name (decl)));
|
||||
else
|
||||
{
|
||||
char *tmp_name;
|
||||
ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++);
|
||||
ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name));
|
||||
}
|
||||
|
||||
pta_join (ALIAS_VAR_ATERM (tv), ALIAS_VAR_ATERM (ret));
|
||||
splay_tree_insert (ptamap, (splay_tree_key) ALIAS_VAR_ATERM (ret),
|
||||
(splay_tree_value) ret);
|
||||
ALIAS_VAR_PTSET (tv) = NULL;
|
||||
ALIAS_VAR_PTSET (ret) = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Inference for simple assignment (lhs = rhs) */
|
||||
|
||||
static void
|
||||
andersen_simple_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var lhs, alias_var rhs)
|
||||
{
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Simple assignment %s = %s\n",
|
||||
alias_get_name (ALIAS_VAR_DECL (lhs)),
|
||||
alias_get_name (ALIAS_VAR_DECL (rhs)));
|
||||
if (lhs == rhs)
|
||||
return;
|
||||
|
||||
/* The rvalue is just the term itself, and we generate a constraint
|
||||
for assigning it to the lhs. */
|
||||
pta_assignment (ALIAS_VAR_ATERM (lhs),
|
||||
pta_rvalue (ALIAS_VAR_ATERM (rhs)));
|
||||
}
|
||||
|
||||
/* Inference for address assignment (lhs = &addr) */
|
||||
|
||||
static void
|
||||
andersen_addr_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var lhs, alias_var addr)
|
||||
{
|
||||
if (addr == NULL)
|
||||
return;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Address assignment %s = &%s\n",
|
||||
alias_get_name (ALIAS_VAR_DECL (lhs)),
|
||||
alias_get_name (ALIAS_VAR_DECL (addr)));
|
||||
|
||||
/* The rvalue here is the address of a term, and we generate a
|
||||
constraint to assign this address to the lhs. */
|
||||
pta_assignment (ALIAS_VAR_ATERM (lhs),
|
||||
pta_rvalue (pta_address (ALIAS_VAR_ATERM (addr))));
|
||||
}
|
||||
|
||||
|
||||
/* Inference for pointer assignment (lhs = *ptr) */
|
||||
|
||||
static void
|
||||
andersen_ptr_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var lhs, alias_var ptr)
|
||||
{
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Pointer assignment %s = *%s\n",
|
||||
alias_get_name (ALIAS_VAR_DECL (lhs)),
|
||||
alias_get_name (ALIAS_VAR_DECL (ptr)));
|
||||
|
||||
pta_assignment (ALIAS_VAR_ATERM (lhs),
|
||||
pta_rvalue (pta_deref (ALIAS_VAR_ATERM (ptr))));
|
||||
|
||||
}
|
||||
|
||||
/* Determine if OP destroys the current assumed to be valid pointer
|
||||
(whether it generates a new valid pointer is not relevant). */
|
||||
|
||||
static bool
|
||||
pointer_destroying_op (tree op)
|
||||
{
|
||||
switch (TREE_CODE (op))
|
||||
{
|
||||
case TRUTH_AND_EXPR:
|
||||
case TRUTH_OR_EXPR:
|
||||
case TRUTH_NOT_EXPR:
|
||||
case LT_EXPR:
|
||||
case GT_EXPR:
|
||||
case GE_EXPR:
|
||||
case LE_EXPR:
|
||||
case EQ_EXPR:
|
||||
case NE_EXPR:
|
||||
case MULT_EXPR:
|
||||
case TRUNC_DIV_EXPR:
|
||||
case LSHIFT_EXPR:
|
||||
case RSHIFT_EXPR:
|
||||
case LROTATE_EXPR:
|
||||
case RROTATE_EXPR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Inference rule for operations (lhs = operation(operands)). */
|
||||
|
||||
static void
|
||||
andersen_op_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var lhs, varray_type operands, tree operation,
|
||||
bitmap addrargs)
|
||||
{
|
||||
aterm newvar = NULL;
|
||||
|
||||
if (VARRAY_ACTIVE_SIZE (operands) == 0)
|
||||
return;
|
||||
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
fprintf (dump_file, "Op assignment %s = ",
|
||||
alias_get_name (ALIAS_VAR_DECL (lhs)));
|
||||
print_generic_stmt (dump_file, operation, dump_flags);
|
||||
fprintf (dump_file, "\n");
|
||||
}
|
||||
|
||||
|
||||
/* Pointer destroying operations do not give us the same valid pointer
|
||||
back, and thus, are assignment to pta_bottom. */
|
||||
if (pointer_destroying_op (operation))
|
||||
{
|
||||
pta_assignment (ALIAS_VAR_ATERM (lhs), pta_rvalue (pta_bottom ()));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Operations in general we can't track the exact effect of. Thus,
|
||||
we conservatively assume that it could make the LHS point to
|
||||
*anything* the RHS points to. To signify this, we join the RHS
|
||||
variables together and assign it to the LHS. */
|
||||
/* The >2 case occurs when we are dealing with constructors. */
|
||||
if (VARRAY_ACTIVE_SIZE (operands) > 2)
|
||||
{
|
||||
size_t i;
|
||||
alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0);
|
||||
newvar = ALIAS_VAR_ATERM (tv1);
|
||||
for (i = 1; i < VARRAY_ACTIVE_SIZE (operands); i++)
|
||||
{
|
||||
alias_var tempvar = VARRAY_GENERIC_PTR (operands, i);
|
||||
aterm t2 = ALIAS_VAR_ATERM (tempvar);
|
||||
if (bitmap_bit_p (addrargs, i))
|
||||
newvar = pta_join (newvar, pta_address (t2));
|
||||
else
|
||||
newvar = pta_join (newvar, t2);
|
||||
}
|
||||
}
|
||||
else if (VARRAY_ACTIVE_SIZE (operands) == 2)
|
||||
{
|
||||
alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0);
|
||||
alias_var tv2 = VARRAY_GENERIC_PTR (operands, 1);
|
||||
aterm t1 = ALIAS_VAR_ATERM (tv1);
|
||||
aterm t2 = ALIAS_VAR_ATERM (tv2);
|
||||
if (bitmap_bit_p (addrargs, 0) && bitmap_bit_p (addrargs, 1))
|
||||
newvar = pta_join (pta_address (t1), pta_address (t2));
|
||||
else if (bitmap_bit_p (addrargs, 0))
|
||||
newvar = pta_join (pta_address (t1), t2);
|
||||
else if (bitmap_bit_p (addrargs, 1))
|
||||
newvar = pta_join (t1, pta_address (t2));
|
||||
else
|
||||
newvar = pta_join (t1, t2);
|
||||
}
|
||||
else if (VARRAY_ACTIVE_SIZE (operands) == 1)
|
||||
{
|
||||
alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0);
|
||||
aterm t1 = ALIAS_VAR_ATERM (tv1);
|
||||
if (bitmap_bit_p (addrargs, 0))
|
||||
newvar = pta_address (t1);
|
||||
else
|
||||
newvar = t1;
|
||||
}
|
||||
pta_assignment (ALIAS_VAR_ATERM (lhs), pta_rvalue (newvar));
|
||||
}
|
||||
|
||||
/* Inference for heap assignment (lhs = alloc). */
|
||||
|
||||
static void
|
||||
andersen_heap_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var lhs ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#if 0
|
||||
alias_type type1;
|
||||
ECR tau;
|
||||
type1 = ECR_get_type (alias_var_get_ECR (lhs));
|
||||
tau = alias_ltype_loc (type1);
|
||||
|
||||
if (ECR_get_type (tau) == alias_bottom)
|
||||
ECR_set_type (tau, alias_ltype_new ());
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Inference for assignment to a pointer (*ptr = rhs). */
|
||||
|
||||
static void
|
||||
andersen_assign_ptr (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var ptr, alias_var rhs)
|
||||
{
|
||||
|
||||
if (rhs == NULL)
|
||||
return;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file, "Assignment to pointer *%s = %s\n",
|
||||
alias_get_name (ALIAS_VAR_DECL (ptr)),
|
||||
alias_get_name (ALIAS_VAR_DECL (rhs)));
|
||||
/* The RHS is a standard rvalue, and the LHS is a pointer
|
||||
dereference. */
|
||||
pta_assignment (pta_deref (ALIAS_VAR_ATERM (ptr)),
|
||||
pta_rvalue (ALIAS_VAR_ATERM (rhs)));
|
||||
}
|
||||
|
||||
/* Inference for a function definition. */
|
||||
|
||||
static void
|
||||
andersen_function_def (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var func, varray_type params,
|
||||
alias_var retval)
|
||||
{
|
||||
aterm_list args = new_aterm_list (andersen_rgn);
|
||||
aterm fun_type;
|
||||
|
||||
size_t l = VARRAY_ACTIVE_SIZE (params);
|
||||
size_t i;
|
||||
|
||||
/* Set up the arguments for the new function type. */
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
alias_var tv = VARRAY_GENERIC_PTR (params, i);
|
||||
aterm_list_cons (ALIAS_VAR_ATERM (tv), args);
|
||||
}
|
||||
/* Create the function type. */
|
||||
fun_type = pta_make_fun (alias_get_name (ALIAS_VAR_DECL (func)),
|
||||
ALIAS_VAR_ATERM (retval), args);
|
||||
|
||||
/* Assign the function type itself to the function. */
|
||||
pta_assignment (ALIAS_VAR_ATERM (func), fun_type);
|
||||
}
|
||||
|
||||
/* Inference for a function call assignment. */
|
||||
|
||||
static int
|
||||
andersen_function_call (struct tree_alias_ops *ops,
|
||||
alias_var lhs, alias_var func,
|
||||
varray_type args, bitmap addrargs)
|
||||
{
|
||||
aterm_list actuals = new_aterm_list (andersen_rgn);
|
||||
aterm ftype = ALIAS_VAR_ATERM (func);
|
||||
aterm ret = NULL;
|
||||
aterm res;
|
||||
tree decl = ALIAS_VAR_DECL (func);
|
||||
|
||||
size_t i;
|
||||
|
||||
if (lhs)
|
||||
ret = ALIAS_VAR_ATERM (lhs);
|
||||
for (i = 0; i < VARRAY_ACTIVE_SIZE (args); i++)
|
||||
{
|
||||
alias_var argtv = VARRAY_GENERIC_PTR (args, i);
|
||||
aterm arg = ALIAS_VAR_ATERM (argtv);
|
||||
if (bitmap_bit_p (addrargs, i))
|
||||
aterm_list_cons (pta_rvalue (pta_address (arg)), actuals);
|
||||
else
|
||||
aterm_list_cons (pta_rvalue (arg), actuals);
|
||||
}
|
||||
aterm_list_reverse (actuals);
|
||||
|
||||
/* Generate the constraint that calls the function with it's
|
||||
arguments, and gives us the result. This in turn applies
|
||||
whatever constraints are in that function. */
|
||||
res = pta_application (pta_rvalue (ftype), actuals);
|
||||
/* We only need care about the result if we have an LHS. If we do,
|
||||
assign the result of function application back to the LHS. */
|
||||
if (ret)
|
||||
pta_assignment (ret, pta_rvalue (res));
|
||||
|
||||
/* We can handle functions we've got trees for. non-statics will
|
||||
just have incoming parameters assigned to global_var if
|
||||
necessary. */
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& DECL_PTA_ALIASVAR (decl)
|
||||
&& ops->ip_partial
|
||||
&& (cgraph_local_info (decl)->local))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Simple pointer comparison function for list sorting. */
|
||||
|
||||
static int
|
||||
simple_cmp (const aterm a, const aterm b)
|
||||
{
|
||||
return (int *)a - (int *)b;
|
||||
}
|
||||
|
||||
|
||||
/* Get the points-to set for TV, caching if it we had to compute it. */
|
||||
|
||||
static aterm_list
|
||||
get_ptset (alias_var tv)
|
||||
{
|
||||
aterm_list ptset;
|
||||
ptset = ALIAS_VAR_PTSET (tv);
|
||||
if (ptset != NULL)
|
||||
return ptset;
|
||||
ptset = aterm_tlb (pta_get_contents (ALIAS_VAR_ATERM (tv)));
|
||||
ALIAS_VAR_PTSET (tv) = ptset;
|
||||
return ptset;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if two aterm's have the same points-to set. */
|
||||
|
||||
static bool
|
||||
andersen_same_points_to_set (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var ptrtv, alias_var vartv)
|
||||
{
|
||||
aterm_list ptset1, ptset2;
|
||||
aterm_list_scanner scan1, scan2;
|
||||
aterm data1, data2;
|
||||
region scratch_rgn = newregion ();
|
||||
|
||||
ptset1 = get_ptset (ptrtv);
|
||||
ptset2 = get_ptset (vartv);
|
||||
|
||||
if (aterm_list_length (ptset1) != aterm_list_length (ptset2))
|
||||
{
|
||||
deleteregion (scratch_rgn);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ptset1 == ptset2)
|
||||
{
|
||||
deleteregion (scratch_rgn);
|
||||
return true;
|
||||
}
|
||||
|
||||
ptset1 = aterm_list_copy (scratch_rgn, ptset1);
|
||||
ptset2 = aterm_list_copy (scratch_rgn, ptset2);
|
||||
|
||||
if (aterm_list_length (ptset1) != aterm_list_length (ptset2))
|
||||
{
|
||||
deleteregion (scratch_rgn);
|
||||
return false;
|
||||
}
|
||||
|
||||
ptset1 = aterm_list_sort (ptset1, simple_cmp);
|
||||
ptset2 = aterm_list_sort (ptset2, simple_cmp);
|
||||
|
||||
aterm_list_scan (ptset1, &scan1);
|
||||
aterm_list_scan (ptset2, &scan2);
|
||||
while (aterm_list_next (&scan1, &data1))
|
||||
{
|
||||
aterm_list_next (&scan2, &data2);
|
||||
if (data1 != data2)
|
||||
{
|
||||
deleteregion(scratch_rgn);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
deleteregion(scratch_rgn);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if two variables may alias. In our case, this means
|
||||
whether the decl represented by PTRTV can point to VARTV. */
|
||||
|
||||
static bool
|
||||
andersen_may_alias (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var ptrtv, alias_var vartv)
|
||||
{
|
||||
aterm_list ptset;
|
||||
ptset = get_ptset (ptrtv);
|
||||
|
||||
if (aterm_list_empty (ptset))
|
||||
return false;
|
||||
|
||||
return aterm_list_member (ptset, ALIAS_VAR_ATERM (vartv));
|
||||
}
|
||||
|
||||
/* Determine whether PTRTV has an empty points-to set. IE it may not
|
||||
point to anything. */
|
||||
|
||||
static bool
|
||||
andersen_empty_points_to_set (struct tree_alias_ops *ops ATTRIBUTE_UNUSED,
|
||||
alias_var ptrtv)
|
||||
{
|
||||
aterm_list ptset;
|
||||
ptset = get_ptset (ptrtv);
|
||||
return aterm_list_empty (ptset);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/* Tree based Andersen points-to analysis
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC 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 GCC; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef TREE_ALIAS_ANDER
|
||||
#define TREE_ALIAS_ANDER
|
||||
|
||||
#include "tree-alias-common.h"
|
||||
|
||||
extern struct tree_alias_ops *andersen_alias_ops;
|
||||
|
||||
#endif /* TREE_ALIAS_ANDER */
|
File diff suppressed because it is too large
Load Diff
@ -1,123 +0,0 @@
|
||||
/* Tree based points-to analysis
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC 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 GCC; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef TREE_ALIAS_COMMON
|
||||
#define TREE_ALIAS_COMMON
|
||||
|
||||
#include "tree-alias-type.h"
|
||||
|
||||
/* Alias analysis function pointers.
|
||||
Functions implemented by the actual alias analysis algorithms in
|
||||
order for them to work with the common points-to structure. */
|
||||
struct tree_alias_ops
|
||||
{
|
||||
/* Initialization.
|
||||
Called right before we start using the other functions. */
|
||||
void (*init) (struct tree_alias_ops *);
|
||||
|
||||
/* Cleanup.
|
||||
Called when we are finished with the alias analyzer. */
|
||||
void (*cleanup) (struct tree_alias_ops *);
|
||||
|
||||
/* Add variable.
|
||||
Called when we want to inform the alias analyzer about a new
|
||||
variable we've found. */
|
||||
alias_var (*add_var) (struct tree_alias_ops *, tree);
|
||||
|
||||
/* Add variable equivalent to existing one.
|
||||
Called when we want to inform the alias analyzer about a new
|
||||
variable that has the same points-to set as an existing
|
||||
variable. */
|
||||
alias_var (*add_var_same) (struct tree_alias_ops *, tree,
|
||||
alias_var);
|
||||
|
||||
/* Process a simple assignment (a = b).
|
||||
Called to process simple assignment statements of the form a = b,
|
||||
where a and b are both variables. */
|
||||
void (*simple_assign) (struct tree_alias_ops *, alias_var,
|
||||
alias_var);
|
||||
/* Process an address assignment (a = &b).
|
||||
Called to process address assignment statements of the form a =
|
||||
&b, where a and b are both variables. */
|
||||
void (*addr_assign) (struct tree_alias_ops *, alias_var, alias_var);
|
||||
|
||||
/* Process a pointer assignment (a = *b).
|
||||
Called to process pointer assignment statements of the form a =
|
||||
*b, where a and b are both variables. */
|
||||
void (*ptr_assign) (struct tree_alias_ops *, alias_var, alias_var);
|
||||
|
||||
/* Process an operator assignment (a = op (...))
|
||||
Called to process operators of the form a = op(...), where a is a
|
||||
variable. */
|
||||
void (*op_assign) (struct tree_alias_ops *, alias_var, varray_type,
|
||||
tree, bitmap);
|
||||
/* Process a heap assignment (a = alloc (...))
|
||||
Called to process a heap assignment of the form a = alloc
|
||||
(...), where a is a variable, and *alloc is a function that
|
||||
returns new memory. */
|
||||
void (*heap_assign) (struct tree_alias_ops *, alias_var);
|
||||
|
||||
/* Process an assignment to a pointer (*a = b)
|
||||
Called to process assignment to pointer statements of the form
|
||||
*a = b, where a and b are both variables. */
|
||||
void (*assign_ptr) (struct tree_alias_ops *, alias_var, alias_var);
|
||||
|
||||
/* Process a function definition.
|
||||
Called to inform the alias analyzer about a new function
|
||||
definition. */
|
||||
void (*function_def) (struct tree_alias_ops *, alias_var,
|
||||
varray_type, alias_var);
|
||||
|
||||
/* Process a function call.
|
||||
Return 1 if we need to assume conservative side-effects. */
|
||||
int (*function_call) (struct tree_alias_ops *, alias_var,
|
||||
alias_var, varray_type, bitmap);
|
||||
|
||||
/* Determine if two alias variables may alias. */
|
||||
bool (*may_alias) (struct tree_alias_ops *, alias_var, alias_var);
|
||||
|
||||
/* Determine if two alias variables have the same points-to set. */
|
||||
bool (*same_points_to_set) (struct tree_alias_ops *, alias_var,
|
||||
alias_var);
|
||||
|
||||
/* Determine if the alias variable has an empty points-to set. */
|
||||
bool (*empty_points_to_set) (struct tree_alias_ops *, alias_var);
|
||||
|
||||
/* Private data. */
|
||||
void *data;
|
||||
|
||||
/* Interprocedural. */
|
||||
unsigned int ip:1;
|
||||
|
||||
/* Can do conservative interprocedural analysis if we save the
|
||||
* info. */
|
||||
unsigned int ip_partial:1;
|
||||
|
||||
};
|
||||
|
||||
extern struct tree_alias_ops *current_alias_ops;
|
||||
extern void init_alias_vars (void);
|
||||
extern bool ptr_may_alias_var (tree, tree);
|
||||
extern bool same_points_to_set (tree, tree);
|
||||
extern bool empty_points_to_set (tree);
|
||||
extern const char *alias_get_name (tree);
|
||||
|
||||
#endif /* TREE_ALIAS_COMMON */
|
@ -1,37 +0,0 @@
|
||||
/* Tree based linear points-to analysis
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC 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 GCC; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
#include "ggc.h"
|
||||
#include "tree-alias-type.h"
|
||||
|
||||
alias_var
|
||||
alias_var_new_with_aterm (tree decl, struct aterm_ *term)
|
||||
{
|
||||
alias_var ret = ggc_alloc (sizeof (struct alias_var_aterm));
|
||||
ALIAS_VAR_KIND (ret) = ATERM_AVAR;
|
||||
ALIAS_VAR_DECL (ret) = decl;
|
||||
ALIAS_VAR_ATERM (ret) = term;
|
||||
return ret;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/* Tree based linear points-to analysis
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC 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 GCC; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef TREE_ALIAS_TYPE_H
|
||||
#define TREE_ALIAS_TYPE_H
|
||||
|
||||
#include "varray.h"
|
||||
|
||||
union alias_var_def;
|
||||
struct aterm_;
|
||||
struct aterm_list_a;
|
||||
|
||||
enum alias_var_kind
|
||||
{
|
||||
ATERM_AVAR
|
||||
};
|
||||
|
||||
struct alias_var_common GTY (())
|
||||
{
|
||||
enum alias_var_kind kind;
|
||||
unsigned int varnum;
|
||||
tree decl;
|
||||
};
|
||||
|
||||
struct alias_var_aterm GTY (())
|
||||
{
|
||||
struct alias_var_common common;
|
||||
struct aterm_ * GTY((skip (""))) term;
|
||||
struct aterm_list_a *GTY ((skip (""))) ptset;
|
||||
};
|
||||
|
||||
union alias_var_def GTY ((desc ("%0.common.kind")))
|
||||
{
|
||||
struct alias_var_common GTY ((tag ("-1"))) common;
|
||||
struct alias_var_aterm GTY ((tag ("ATERM_AVAR"))) aterm;
|
||||
};
|
||||
|
||||
typedef union alias_var_def *alias_var;
|
||||
|
||||
#define ALIAS_VAR_KIND(x) ((x)->common.kind)
|
||||
#define ALIAS_VAR_VARNUM(x) ((x)->common.varnum)
|
||||
#define ALIAS_VAR_DECL(x) ((x)->common.decl)
|
||||
#define ALIAS_VAR_ATERM(x) ((x)->aterm.term)
|
||||
#define ALIAS_VAR_PTSET(x) ((x)->aterm.ptset)
|
||||
union alias_type_def;
|
||||
typedef union alias_type_def *alias_type;
|
||||
|
||||
alias_var alias_var_new_with_aterm (tree, struct aterm_ *);
|
||||
|
||||
#endif /* TREE_ALIAS_TYPE_H */
|
@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-gimple.h"
|
||||
#include "tree-flow.h"
|
||||
#include "tree-inline.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "tree-pass.h"
|
||||
#include "convert.h"
|
||||
#include "params.h"
|
||||
|
@ -41,7 +41,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-inline.h"
|
||||
#include "varray.h"
|
||||
#include "timevar.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "hashtab.h"
|
||||
#include "tree-dump.h"
|
||||
#include "tree-pass.h"
|
||||
|
@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-inline.h"
|
||||
#include "tree-mudflap.h"
|
||||
#include "tree-pass.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "ggc.h"
|
||||
#include "cgraph.h"
|
||||
#include "graph.h"
|
||||
@ -346,7 +345,6 @@ init_tree_optimization_passes (void)
|
||||
|
||||
p = &pass_all_optimizations.sub;
|
||||
NEXT_PASS (pass_referenced_vars);
|
||||
NEXT_PASS (pass_build_pta);
|
||||
NEXT_PASS (pass_build_ssa);
|
||||
NEXT_PASS (pass_may_alias);
|
||||
NEXT_PASS (pass_rename_ssa_copies);
|
||||
@ -384,7 +382,6 @@ init_tree_optimization_passes (void)
|
||||
NEXT_PASS (pass_phiopt);
|
||||
NEXT_PASS (pass_tail_calls);
|
||||
NEXT_PASS (pass_late_warn_uninitialized);
|
||||
NEXT_PASS (pass_del_pta);
|
||||
NEXT_PASS (pass_del_ssa);
|
||||
NEXT_PASS (pass_nrv);
|
||||
NEXT_PASS (pass_remove_useless_vars);
|
||||
|
@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-inline.h"
|
||||
#include "varray.h"
|
||||
#include "timevar.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "hashtab.h"
|
||||
#include "tree-dump.h"
|
||||
#include "tree-ssa-live.h"
|
||||
|
@ -119,8 +119,6 @@ extern struct tree_opt_pass pass_lower_eh;
|
||||
extern struct tree_opt_pass pass_build_cfg;
|
||||
extern struct tree_opt_pass pass_tree_profile;
|
||||
extern struct tree_opt_pass pass_referenced_vars;
|
||||
extern struct tree_opt_pass pass_build_pta;
|
||||
extern struct tree_opt_pass pass_del_pta;
|
||||
extern struct tree_opt_pass pass_sra;
|
||||
extern struct tree_opt_pass pass_tail_recursion;
|
||||
extern struct tree_opt_pass pass_tail_calls;
|
||||
|
@ -39,7 +39,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-gimple.h"
|
||||
#include "tree-flow.h"
|
||||
#include "tree-inline.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "tree-pass.h"
|
||||
#include "convert.h"
|
||||
#include "params.h"
|
||||
@ -125,8 +124,6 @@ struct alias_stats_d
|
||||
unsigned int simple_resolved;
|
||||
unsigned int tbaa_queries;
|
||||
unsigned int tbaa_resolved;
|
||||
unsigned int pta_queries;
|
||||
unsigned int pta_resolved;
|
||||
};
|
||||
|
||||
|
||||
@ -354,7 +351,7 @@ struct tree_opt_pass pass_may_alias =
|
||||
NULL, /* next */
|
||||
0, /* static_pass_number */
|
||||
TV_TREE_MAY_ALIAS, /* tv_id */
|
||||
PROP_cfg | PROP_ssa | PROP_pta, /* properties_required */
|
||||
PROP_cfg | PROP_ssa, /* properties_required */
|
||||
PROP_alias, /* properties_provided */
|
||||
0, /* properties_destroyed */
|
||||
0, /* todo_flags_start */
|
||||
@ -1618,18 +1615,6 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set,
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_tree_points_to != PTA_NONE)
|
||||
alias_stats.pta_queries++;
|
||||
|
||||
/* If -ftree-points-to is given, check if PTR may point to VAR. */
|
||||
if (flag_tree_points_to == PTA_ANDERSEN
|
||||
&& !ptr_may_alias_var (ptr, var))
|
||||
{
|
||||
alias_stats.alias_noalias++;
|
||||
alias_stats.pta_resolved++;
|
||||
return false;
|
||||
}
|
||||
|
||||
alias_stats.alias_mayalias++;
|
||||
return true;
|
||||
}
|
||||
@ -2119,9 +2104,7 @@ get_tmt_for (tree ptr, struct alias_info *ai)
|
||||
for (i = 0, tag = NULL_TREE; i < ai->num_pointers; i++)
|
||||
{
|
||||
struct alias_map_d *curr = ai->pointers[i];
|
||||
if (tag_set == curr->set
|
||||
&& (flag_tree_points_to == PTA_NONE
|
||||
|| same_points_to_set (curr->var, ptr)))
|
||||
if (tag_set == curr->set)
|
||||
{
|
||||
tag = var_ann (curr->var)->type_mem_tag;
|
||||
break;
|
||||
@ -2203,10 +2186,6 @@ dump_alias_stats (FILE *file)
|
||||
alias_stats.tbaa_queries);
|
||||
fprintf (file, "Total TBAA resolved:\t%u\n",
|
||||
alias_stats.tbaa_resolved);
|
||||
fprintf (file, "Total PTA queries:\t%u\n",
|
||||
alias_stats.pta_queries);
|
||||
fprintf (file, "Total PTA resolved:\t%u\n",
|
||||
alias_stats.pta_resolved);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-gimple.h"
|
||||
#include "tree-inline.h"
|
||||
#include "timevar.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "hashtab.h"
|
||||
#include "tree-dump.h"
|
||||
#include "tree-ssa-live.h"
|
||||
|
@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-inline.h"
|
||||
#include "varray.h"
|
||||
#include "timevar.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "hashtab.h"
|
||||
#include "tree-dump.h"
|
||||
#include "tree-ssa-live.h"
|
||||
|
@ -41,7 +41,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-inline.h"
|
||||
#include "varray.h"
|
||||
#include "timevar.h"
|
||||
#include "tree-alias-common.h"
|
||||
#include "hashtab.h"
|
||||
#include "tree-dump.h"
|
||||
#include "tree-pass.h"
|
||||
|
@ -1 +0,0 @@
|
||||
autom4te.cache
|
@ -1,26 +0,0 @@
|
||||
Copyright (c) 2000-2001
|
||||
The Regents of the University of California. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
@ -1,162 +0,0 @@
|
||||
2004-06-27 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR bootstrap/15627
|
||||
* engine/flowrow-sort.c (update_upper_bound): Converted comment to
|
||||
C-style.
|
||||
(flowrow_inclusion): Likewise.
|
||||
(flowrow_extract_field): Unnest field_eq.
|
||||
* engine/setif-sort.c (search_ubs): Unnest search_ubs_aux.
|
||||
(search_lbs): Unnest search_lbs_aux.
|
||||
(setif_inclusion): Unnest collapse_cycle_lower, collapse_cycle_upper,
|
||||
update_lower_bound, update_upper_bound.
|
||||
|
||||
2004-06-15 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* Makefile.in: Regenerate with automake 1.8.5.
|
||||
* aclocal.m4: Likewise.
|
||||
* engine/Makefile.in: Likewise.
|
||||
* libcompat/Makefile.in: Likewise.
|
||||
* points-to/Makefile.in: Likewise.
|
||||
* configure: Regenerate.
|
||||
* .cvsignore: New file.
|
||||
|
||||
2004-05-28 Kelley Cook <kcook@gcc.gnu.org>
|
||||
|
||||
* configure.in: Rename to ...
|
||||
* configure.ac: this. Update to modern autoconf style.
|
||||
Correct AC_INIT macro with the actual package name.
|
||||
Replace gcc_AC_HEADER_STDBOOL and GCC_AC_C__BOOL with AC_HEADER_STDBOOL.
|
||||
* acinclude.m4, stamp.h-in: Delete.
|
||||
* config.h, configure: Regenerate with autoconf 2.59.
|
||||
* aclocal.m4, Makefile.in: Regenerate with automake 1.7.9.
|
||||
* engine/Makefile.in: Likewise.
|
||||
* libcompat/Makefile.in: Likewise.
|
||||
* points-to/Makefile.in: Likewise.
|
||||
|
||||
2004-05-24 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
PR other/15627
|
||||
* engine/util.h: Include ansidecl.h.
|
||||
Make max and min static inline.
|
||||
* engine/util.c: Remove max and min from here.
|
||||
|
||||
2004-03-26 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* configure.in: Remove GCC_NO_EXECUTABLES.
|
||||
* configure: Regenerated.
|
||||
|
||||
2004-03-07 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* engine/Makefile.am (AM_CFLAGS): Add -I$(top_srcddir)/../include, so we
|
||||
can get ansidecl.h and friends.
|
||||
* engine/array.c (array_extend): Fix unsigned/signed comparison.
|
||||
* engine/banshee.h (struct gen_e): Just make void * when empty, instead
|
||||
of empty struct.
|
||||
* engine/compiler.h: Don't ever define HAVE_VARIADIC_MACROS, -pedantic
|
||||
whines about them even when we know we can use them.
|
||||
* engine/dot.c: constify our char *'s everywhere.
|
||||
(declare_node): Cast &result to char * before casting to hash_data *.
|
||||
* engine/dot.h: constify our char *'s everywhere.
|
||||
* engine/flow-var.c: Ditto.
|
||||
* engine/flow-var.h: Ditto.
|
||||
* engine/flowrow-sort.c: Include ansidecl.h.
|
||||
(get_contour): Mark unused parameter.
|
||||
(update_upper_bound): Make comment /* instead of //.
|
||||
(field_eq): Staticify.
|
||||
* engine/hash.c (string_hash): Staticify.
|
||||
(string_eq): Ditto.
|
||||
(entry_cmp): Ditto.
|
||||
* engine/hash.h: Move comments around.
|
||||
(hash_table_apply): Add prototype.
|
||||
* engine/hashset.c (INIT_TABLE_SIZE): Remove extra semicolon.
|
||||
(EMPTY_KEY): Ditto.
|
||||
* engine/jcollection.c (jcoll_create_chain): // -> /* comment.
|
||||
(jcoll_accum): Staticify.
|
||||
* engine/list.c (sort_linked_list): Staticify.
|
||||
(compare): Use comparator_fn as last argument, not void *.
|
||||
* engine/list.h: Declare the functions even for opaque lists.
|
||||
(list_clear macro): don't return value.
|
||||
* engine/setif-sort.c: Replaced with new version from banshee cvs.
|
||||
* engine/setif-var.c: constify our char *'s.
|
||||
* engine/setif-var.h: Ditto.
|
||||
* engine/setst-var.c: Ditto.
|
||||
* engine/setst-var.h: Ditto.
|
||||
* engine/stamp.c (stamp_string): Use long, not int.
|
||||
Cast through char *.
|
||||
* engine/stamp.h (stamp): Long, not int.
|
||||
* engine/term-sort.c (term_print_stats): Mark argument unused.
|
||||
include ansidecl.h.
|
||||
* engine/term-var.c: constify the char *'s.
|
||||
* engine/term-var.h: Ditto.
|
||||
* engine/ufind.h (union find update macro): Don't return uf_update's value
|
||||
(which is void anyway).
|
||||
* engine/util.c (ptr_hash): Return long, not int.
|
||||
* engine/util.h (ptr_hash): Ditto.
|
||||
|
||||
2004-02-29 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* configure.in: Set ac_libbanshee_warn_cflags for GCC.
|
||||
* configure: Regenerated.
|
||||
|
||||
* libcompat/Makefile.am (AM_CFLAGS): Add
|
||||
ac_libbanshee_warn_cflags.
|
||||
* engine/Makefile.am (AM_CFLAGS): Likewise.
|
||||
* points-to/Makefile.am (AM_CFLAGS): Likewise.
|
||||
|
||||
* libcompat/Makefile.in: Regenerated.
|
||||
* engine/Makefile.in: Regenerated.
|
||||
* points-to/Makefile.in: Regenerated.
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
* libcompat/radix-tree.c: Include <stdlib.h> for calloc.
|
||||
|
||||
2004-02-03 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
Fix PR other/12220
|
||||
* engine/Makefile.am: Remove -fno-strict-aliasing.
|
||||
* libcompat/Makefile.am: Ditto.
|
||||
* points-to/Makefile.am: Ditto.
|
||||
* configure: Regenerated.
|
||||
* config.h.in: Ditto.
|
||||
* Makefile.in: Ditto.
|
||||
* engine/Makefile.am: Ditto.
|
||||
* libcompat/Makefile.am: Ditto.
|
||||
* points-to/Makefile.am: Ditto.
|
||||
|
||||
2003-07-01 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* acinclude.m4: New, copy the bool tests from gcc.
|
||||
|
||||
* configure.in: Use the new bool tests.
|
||||
|
||||
* Regenerate configure.
|
||||
|
||||
* engine/bool.h: Rewrite to use the part of gcc's system.h that does
|
||||
bool type handling.
|
||||
|
||||
2002-12-26 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Makefile.am: Use the same flag passing hack all other subdirs use.
|
||||
|
||||
* */Makefile.am: Use -fno-strict-aliasing till i get rid of the
|
||||
type-punning.
|
||||
|
||||
* Regenerate configure and Makefiles.
|
||||
|
||||
* engine/setst-*.c: Remove nested functions.
|
||||
|
||||
2002-11-28 Diego Novillo <dnovillo@redhat.com>
|
||||
|
||||
* aclocal.m4: Don't call aclocal and automake with a
|
||||
version number suffix.
|
||||
* Makefile.in, config.h.in, configure,
|
||||
engine/Makefile.in, libcompat/Makefile.in,
|
||||
points-to/Makefile.in: Regenerate.
|
||||
|
||||
2002-11-24 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* points-to/andersen_terms.c: Fix multi-line string literals
|
||||
|
||||
2002-10-31 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Autoconf'ed, automak'ed, de-nested functified, etc.
|
@ -1,41 +0,0 @@
|
||||
SUBDIRS = engine points-to libcompat
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
AM_MAKEFLAGS = \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
||||
"LDFLAGS=$(LDFLAGS)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"EXPECT=$(EXPECT)" \
|
||||
"RUNTEST=$(RUNTEST)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"tooldir=$(tooldir)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
"CC=$(CC)" \
|
||||
"CXX=$(CXX)" \
|
||||
"LD=$(LD)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"NM=$(NM)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"DESTDIR=$(DESTDIR)"
|
@ -1,603 +0,0 @@
|
||||
# Makefile.in generated by automake 1.8.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
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 = :
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/../install-sh \
|
||||
$(srcdir)/../missing $(srcdir)/../mkinstalldirs \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno configure.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-exec-recursive install-info-recursive \
|
||||
install-recursive installcheck-recursive installdirs-recursive \
|
||||
pdf-recursive ps-recursive uninstall-info-recursive \
|
||||
uninstall-recursive
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d $(distdir) \
|
||||
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr $(distdir); }; }
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_libbanshee_warn_cflags = @ac_libbanshee_warn_cflags@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
SUBDIRS = engine points-to libcompat
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
AM_MAKEFLAGS = \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
||||
"LDFLAGS=$(LDFLAGS)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"EXPECT=$(EXPECT)" \
|
||||
"RUNTEST=$(RUNTEST)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"tooldir=$(tooldir)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
"CC=$(CC)" \
|
||||
"CXX=$(CXX)" \
|
||||
"LD=$(LD)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"NM=$(NM)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"DESTDIR=$(DESTDIR)"
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
|
||||
cd $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
$(mkdir_p) $(distdir)/..
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| mkdir "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="../$(top_distdir)" \
|
||||
distdir="../$(distdir)/$$subdir" \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
$(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\
|
||||
*.tar.bz2*) \
|
||||
bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& cd $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
|
||||
distuninstallcheck:
|
||||
@cd $(distuninstallcheck_dir) \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_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-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
|
||||
check-am clean clean-generic clean-recursive ctags \
|
||||
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
|
||||
dist-tarZ dist-zip distcheck distclean distclean-generic \
|
||||
distclean-hdr distclean-recursive distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-recursive \
|
||||
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
|
||||
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# 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:
|
@ -1,11 +0,0 @@
|
||||
This is banshee, a toolkit for constructing constraint-based program analyses.
|
||||
See the user manual in docs/banshee.ps for a complete description of banshee.
|
||||
|
||||
This is a beta release of banshee. Although banshee has been designed to solve
|
||||
many kinds of constraints, it has only been extensively tested on
|
||||
Andersen's-style points-to analysis.
|
||||
|
||||
banshee is distributed under the BSD license. See the COPYRIGHT file for more
|
||||
details.
|
||||
|
||||
Send bug reports to jkodumal@cs.berkeley.edu.
|
948
libbanshee/aclocal.m4
vendored
948
libbanshee/aclocal.m4
vendored
@ -1,948 +0,0 @@
|
||||
# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
# Free Software Foundation, Inc.
|
||||
# This file 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.
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
# Generated from amversion.in; do not edit by hand.
|
||||
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.8.5])])
|
||||
|
||||
# AM_AUX_DIR_EXPAND
|
||||
|
||||
# Copyright (C) 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])
|
||||
AC_SUBST([$1_FALSE])
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.])
|
||||
fi])])
|
||||
|
||||
# serial 7 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
#serial 2
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
|
||||
# Extract the definition of DEP_FILES from the Makefile without
|
||||
# running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
|
||||
# We invoke sed twice because it is the simplest approach to
|
||||
# changing $(DEPDIR) to its actual value in the expansion.
|
||||
for file in `sed -n '
|
||||
/^DEP_FILES = .*\\\\$/ {
|
||||
s/^DEP_FILES = //
|
||||
:loop
|
||||
s/\\\\$//
|
||||
p
|
||||
n
|
||||
/\\\\$/ b loop
|
||||
p
|
||||
}
|
||||
/^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# This macro actually does too much some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 11
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.58])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_MISSING_PROG(AMTAR, tar)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
|
||||
# Copyright (C) 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Copyright (C) 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 1
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 3
|
||||
|
||||
AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 2
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# -*- Autoconf -*-
|
||||
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
||||
|
||||
# Copyright (C) 2003, 2004 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
||||
# created by `make install' are always world readable, even if the
|
||||
# installer happens to have an overly restrictive umask (e.g. 077).
|
||||
# This was a mistake. There are at least two reasons why we must not
|
||||
# use `-m 0755':
|
||||
# - it causes special bits like SGID to be ignored,
|
||||
# - it may be too restrictive (some setups expect 775 directories).
|
||||
#
|
||||
# Do not use -m 0755 and let people choose whatever they expect by
|
||||
# setting umask.
|
||||
#
|
||||
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
||||
# Some implementations (such as Solaris 8's) are not thread-safe: if a
|
||||
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
||||
# concurrently, both version can detect that a/ is missing, but only
|
||||
# one can create it and the other will error out. Consequently we
|
||||
# restrict ourselves to GNU make (using the --version option ensures
|
||||
# this.)
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# Keeping the `.' argument allows $(mkdir_p) to be used without
|
||||
# argument. Indeed, we sometimes output rules like
|
||||
# $(mkdir_p) $(somedir)
|
||||
# where $(somedir) is conditionally defined.
|
||||
# (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
|
||||
# expensive solution, as it forces Make to start a sub-shell.)
|
||||
mkdir_p='mkdir -p -- .'
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
for d in ./-p ./--version;
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
||||
if test -f "$ac_aux_dir/mkinstalldirs"; then
|
||||
mkdir_p='$(mkinstalldirs)'
|
||||
else
|
||||
mkdir_p='$(install_sh) -d'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([mkdir_p])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
|
||||
# Copyright (C) 2001, 2003 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the `atexit' function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#undef HAVE_FLOOR
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define to 1 if stdbool.h conforms to C99. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
6376
libbanshee/configure
vendored
6376
libbanshee/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(libbanshee,0.9,dberlin@dberlin.org)
|
||||
AC_CONFIG_SRCDIR(engine/flowrow-sort.c)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
# Checks for libraries.
|
||||
# FIXME: Replace `main' with a function in `-llambda':
|
||||
#AC_CHECK_LIB([lambda], [main])
|
||||
# FIXME: Replace `main' with a function in `-lm':
|
||||
#AC_CHECK_LIB([m], [main])
|
||||
|
||||
|
||||
if test x$GCC = xyes; then
|
||||
ac_libbanshee_warn_cflags='-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes'
|
||||
fi
|
||||
AC_SUBST(ac_libbanshee_warn_cflags)
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h sys/param.h unistd.h])
|
||||
AC_HEADER_STDBOOL
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_MMAP
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([atexit dup2 floor getpagesize memset munmap])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
engine/Makefile
|
||||
libcompat/Makefile
|
||||
points-to/Makefile])
|
||||
AC_OUTPUT
|
@ -1,18 +0,0 @@
|
||||
2004-05-28 Aaron W. LaFramboise <aaronraolete36@aaronwl.com>
|
||||
|
||||
* engine/util.c (vfail): Remove unnecessary sync, fsync, and fflush.
|
||||
|
||||
2003-07-01 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* bool.h: Can't include gcc's system.h and bool.h at the same time.
|
||||
|
||||
2003-06-25 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* compiler.h: Fix the grouping of the #if
|
||||
|
||||
2003-02-02 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* compiler.h: Only define HAVE_VARIADIC_MACROS if IN_GCC is not
|
||||
defined.
|
||||
* util.h: Add prototypes for min and max.
|
||||
|
@ -1,6 +0,0 @@
|
||||
AM_CFLAGS = -I$(srcdir)/../libcompat -I$(top_srcdir)/../include -I$(srcdir)/../include -I. -Ddeletes= -Dtraditional= -Dsameregion= -Dparentptr= @ac_libbanshee_warn_cflags@
|
||||
noinst_LIBRARIES = libbansheeengine.a
|
||||
libbansheeengine_a_SOURCES = array.c bounds.c hash.c hashset.c list.c stamp.c \
|
||||
ufind.c util.c setif-sort.c termhash.c setif-var.c flow-var.c flowrow-sort.c \
|
||||
setst-var.c jcollection.c banshee.c buffer.c setst-sort.c term-var.c \
|
||||
term-sort.c dot.c
|
@ -1,418 +0,0 @@
|
||||
# Makefile.in generated by automake 1.8.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
|
||||
SOURCES = $(libbansheeengine_a_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
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 = :
|
||||
subdir = engine
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
libbansheeengine_a_AR = $(AR) $(ARFLAGS)
|
||||
libbansheeengine_a_LIBADD =
|
||||
am_libbansheeengine_a_OBJECTS = array.$(OBJEXT) bounds.$(OBJEXT) \
|
||||
hash.$(OBJEXT) hashset.$(OBJEXT) list.$(OBJEXT) \
|
||||
stamp.$(OBJEXT) ufind.$(OBJEXT) util.$(OBJEXT) \
|
||||
setif-sort.$(OBJEXT) termhash.$(OBJEXT) setif-var.$(OBJEXT) \
|
||||
flow-var.$(OBJEXT) flowrow-sort.$(OBJEXT) setst-var.$(OBJEXT) \
|
||||
jcollection.$(OBJEXT) banshee.$(OBJEXT) buffer.$(OBJEXT) \
|
||||
setst-sort.$(OBJEXT) term-var.$(OBJEXT) term-sort.$(OBJEXT) \
|
||||
dot.$(OBJEXT)
|
||||
libbansheeengine_a_OBJECTS = $(am_libbansheeengine_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/../depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/banshee.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/bounds.Po ./$(DEPDIR)/buffer.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/dot.Po ./$(DEPDIR)/flow-var.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/flowrow-sort.Po ./$(DEPDIR)/hash.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/hashset.Po ./$(DEPDIR)/jcollection.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/setif-sort.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/setif-var.Po ./$(DEPDIR)/setst-sort.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/setst-var.Po ./$(DEPDIR)/stamp.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/term-sort.Po ./$(DEPDIR)/term-var.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/termhash.Po ./$(DEPDIR)/ufind.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/util.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libbansheeengine_a_SOURCES)
|
||||
DIST_SOURCES = $(libbansheeengine_a_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_libbanshee_warn_cflags = @ac_libbanshee_warn_cflags@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
AM_CFLAGS = -I$(srcdir)/../libcompat -I$(top_srcdir)/../include -I$(srcdir)/../include -I. -Ddeletes= -Dtraditional= -Dsameregion= -Dparentptr= @ac_libbanshee_warn_cflags@
|
||||
noinst_LIBRARIES = libbansheeengine.a
|
||||
libbansheeengine_a_SOURCES = array.c bounds.c hash.c hashset.c list.c stamp.c \
|
||||
ufind.c util.c setif-sort.c termhash.c setif-var.c flow-var.c flowrow-sort.c \
|
||||
setst-var.c jcollection.c banshee.c buffer.c setst-sort.c term-var.c \
|
||||
term-sort.c dot.c
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu engine/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu engine/Makefile
|
||||
.PRECIOUS: 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__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libbansheeengine.a: $(libbansheeengine_a_OBJECTS) $(libbansheeengine_a_DEPENDENCIES)
|
||||
-rm -f libbansheeengine.a
|
||||
$(libbansheeengine_a_AR) libbansheeengine.a $(libbansheeengine_a_OBJECTS) $(libbansheeengine_a_LIBADD)
|
||||
$(RANLIB) libbansheeengine.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/banshee.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bounds.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dot.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flow-var.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowrow-sort.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashset.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcollection.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setif-sort.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setif-var.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setst-sort.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setst-var.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/term-sort.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/term-var.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/termhash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufind.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$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 $(LIBRARIES)
|
||||
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:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_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-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-info-am
|
||||
|
||||
# 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:
|
@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <regions.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "array.h"
|
||||
|
||||
struct array {
|
||||
region sameregion r;
|
||||
void *sameregion data;
|
||||
size_t elemsize;
|
||||
type_t elemtype;
|
||||
size_t nelems, nalloc;
|
||||
};
|
||||
|
||||
struct array *new_array(region r, size_t initialsize,
|
||||
size_t typesize, type_t typeinfo)
|
||||
{
|
||||
struct array *a = ralloc(r, struct array);
|
||||
|
||||
a->r = r;
|
||||
a->data = typed_rarrayalloc(r, initialsize, typesize, typeinfo);
|
||||
a->elemsize = typesize;
|
||||
a->elemtype = typeinfo;
|
||||
a->nelems = 0;
|
||||
a->nalloc = initialsize;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void *array_extend(struct array *a, int by)
|
||||
{
|
||||
size_t oldelems = a->nelems;
|
||||
|
||||
if (by < 0)
|
||||
assert(((unsigned int)-by) <= a->nelems && by != INT_MIN);
|
||||
else if (a->nelems + by > a->nalloc)
|
||||
{
|
||||
size_t newsize = a->nalloc * 2 + by;
|
||||
void *newdata = typed_rarrayalloc(a->r, newsize, a->elemsize, a->elemtype);
|
||||
|
||||
/* XXX: could work harder to support really large array sizes
|
||||
(this code will fail for a->nalloc >= (max(size_t)-by)/2) */
|
||||
assert(newsize > a->nalloc); /* die when we get really big */
|
||||
typed_rarraycopy(newdata, a->data, a->nelems, a->elemsize, a->elemtype);
|
||||
a->data = newdata;
|
||||
a->nalloc = newsize;
|
||||
}
|
||||
a->nelems += by;
|
||||
|
||||
return (char *)a->data + a->elemsize * oldelems;
|
||||
}
|
||||
|
||||
void array_reset(struct array *a)
|
||||
{
|
||||
a->nelems = 0;
|
||||
}
|
||||
|
||||
size_t array_length(struct array *a)
|
||||
{
|
||||
return a->nelems;
|
||||
}
|
||||
|
||||
void *array_data(struct array *a)
|
||||
{
|
||||
return a->data;
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
/* A region-based growable array type */
|
||||
|
||||
struct array;
|
||||
|
||||
struct array *new_array(region r, size_t initialsize,
|
||||
size_t typesize, type_t typeinfo);
|
||||
void *array_extend(struct array *a, int by);
|
||||
void array_reset(struct array *a);
|
||||
size_t array_length(struct array *a);
|
||||
void *array_data(struct array *a);
|
||||
|
||||
|
||||
#define DECLARE_ARRAY(name, type) \
|
||||
typedef struct name ## _a *name; \
|
||||
name new_ ## name(region r, size_t initialsize); \
|
||||
type *name ## _extend(name a, int by); \
|
||||
void name ## _reset(name a); \
|
||||
size_t name ## _length(name a); \
|
||||
type *name ## _data(name a);
|
||||
|
||||
#define DEFINE_ARRAY(name, type) \
|
||||
name new_ ## name(region r, size_t initialsize) \
|
||||
{ \
|
||||
return (name)new_array(r, initialsize, sizeof(type), rctypeof(type)); \
|
||||
} \
|
||||
type *name ## _extend(name a, int by) \
|
||||
{ \
|
||||
return array_extend((struct array *)a, by); \
|
||||
} \
|
||||
void name ## _reset(name a) \
|
||||
{ \
|
||||
return array_reset((struct array *)a); \
|
||||
} \
|
||||
size_t name ## _length(name a) \
|
||||
{ \
|
||||
return array_length((struct array *)a); \
|
||||
} \
|
||||
type *name ## _data(name a) \
|
||||
{ \
|
||||
return array_data((struct array *)a); \
|
||||
}
|
||||
|
||||
#endif
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <regions.h>
|
||||
#include "banshee.h"
|
||||
#include "setif-sort.h"
|
||||
#include "setst-sort.h"
|
||||
#include "flowrow-sort.h"
|
||||
#include "setif-var.h"
|
||||
|
||||
DEFINE_LIST(gen_e_list,gen_e)
|
||||
|
||||
void engine_init(void)
|
||||
{
|
||||
region_init();
|
||||
stamp_init();
|
||||
}
|
||||
|
||||
void engine_reset(void) deletes
|
||||
{
|
||||
stamp_reset();
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
void engine_update(void)
|
||||
{
|
||||
}
|
||||
|
||||
void engine_stats(FILE *f)
|
||||
{
|
||||
setif_print_stats(f);
|
||||
setst_print_stats(f);
|
||||
flowrow_print_stats(f);
|
||||
}
|
||||
|
||||
void print_constraint_graphs(FILE *f)
|
||||
{
|
||||
setif_print_constraint_graph(f);
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BANSHEE_H
|
||||
#define BANSHEE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "linkage.h"
|
||||
#include "stamp.h"
|
||||
#include "list.h"
|
||||
#include "util.h"
|
||||
#include "dot.h"
|
||||
|
||||
#define ALIAS_TYPE -2
|
||||
#define VAR_TYPE -1
|
||||
#define ZERO_TYPE 0
|
||||
#define ONE_TYPE 1
|
||||
#define UNION_TYPE 2
|
||||
#define INTER_TYPE 3
|
||||
#define CONSTANT_TYPE 4
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
|
||||
#ifdef NONSPEC
|
||||
|
||||
typedef enum sort_kind
|
||||
{
|
||||
flowrow_sort,
|
||||
setif_sort,
|
||||
setst_sort,
|
||||
flowterm_sort,
|
||||
term_sort
|
||||
} sort_kind;
|
||||
|
||||
typedef struct gen_e
|
||||
{
|
||||
sort_kind sort;
|
||||
} *gen_e;
|
||||
#else
|
||||
typedef void *gen_e;
|
||||
#endif
|
||||
|
||||
DECLARE_LIST(gen_e_list,gen_e)
|
||||
|
||||
typedef void (*gen_e_pr_fn_ptr) (FILE *, gen_e);
|
||||
|
||||
/*
|
||||
Function pointers that are common to all sorts
|
||||
*/
|
||||
|
||||
/* inclusion */
|
||||
typedef void (*incl_fn_ptr) (gen_e, gen_e) deletes;
|
||||
|
||||
/* match constructed terms */
|
||||
typedef void (*con_match_fn_ptr) (gen_e, gen_e) deletes;
|
||||
|
||||
/* make fresh variables */
|
||||
typedef gen_e (*fresh_fn_ptr) (const char *);
|
||||
typedef gen_e (*fresh_small_fn_ptr) (const char *);
|
||||
typedef gen_e (*fresh_large_fn_ptr) (const char *);
|
||||
|
||||
/* get a stamp */
|
||||
typedef stamp (*get_stamp_fn_ptr) (gen_e);
|
||||
|
||||
/* extract a term from a proj pat */
|
||||
typedef gen_e (*get_proj_fn_ptr) (gen_e_list);
|
||||
|
||||
void engine_init(void);
|
||||
void engine_reset(void) deletes;
|
||||
void engine_update(void);
|
||||
void engine_stats(FILE *f);
|
||||
|
||||
void print_constraint_graphs(FILE *f);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* BANSHEE_H */
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOL_H
|
||||
#define BOOL_H
|
||||
#ifndef GCC_SYSTEM_H
|
||||
#include "config.h"
|
||||
/* 1 if we have _Bool. */
|
||||
#ifndef HAVE__BOOL
|
||||
# define HAVE__BOOL \
|
||||
((GCC_VERSION >= 3000) || (__STDC_VERSION__ >= 199901L))
|
||||
#endif
|
||||
/* Provide some sort of boolean type. We use stdbool.h if it's
|
||||
available. This must be after all inclusion of system headers,
|
||||
as some of them will mess us up. */
|
||||
#undef bool
|
||||
#undef true
|
||||
#undef false
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
# include <stdbool.h>
|
||||
#else
|
||||
# if !HAVE__BOOL
|
||||
typedef char _Bool;
|
||||
# endif
|
||||
# define bool _Bool
|
||||
# define true 1
|
||||
# define false 0
|
||||
#endif
|
||||
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
#endif
|
||||
#endif
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "bounds.h"
|
||||
|
||||
struct bounds
|
||||
{
|
||||
hash_set set;
|
||||
gen_e_list elems;
|
||||
};
|
||||
|
||||
bounds bounds_create(region r)
|
||||
{
|
||||
bounds result;
|
||||
|
||||
result = ralloc(r, struct bounds);
|
||||
result->set = hs_create(r);
|
||||
result->elems = new_gen_e_list(r);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gen_e_list bounds_exprs(bounds b)
|
||||
{
|
||||
return b->elems;
|
||||
}
|
||||
|
||||
bool bounds_add(bounds b, gen_e e, stamp s)
|
||||
{
|
||||
if (hs_member(b->set, s))
|
||||
return TRUE;
|
||||
|
||||
else
|
||||
{
|
||||
gen_e_list_cons(e,b->elems);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool bounds_empty(bounds b)
|
||||
{
|
||||
return (gen_e_list_empty(b->elems));
|
||||
}
|
||||
|
||||
bool bounds_query(bounds b, stamp x)
|
||||
{
|
||||
return (hs_query(b->set, x));
|
||||
}
|
||||
|
||||
void bounds_set(bounds b,gen_e_list l)
|
||||
{
|
||||
b->elems = l;
|
||||
}
|
||||
|
||||
void bounds_delete(bounds b)
|
||||
{
|
||||
hs_delete(b->set);
|
||||
}
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOUNDS_H
|
||||
#define BOUNDS_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
#include "stamp.h"
|
||||
#include "hashset.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct bounds *bounds;
|
||||
|
||||
bounds bounds_create(region r);
|
||||
|
||||
gen_e_list bounds_exprs(bounds);
|
||||
|
||||
/* returns true if the bound was already present */
|
||||
bool bounds_add(bounds,gen_e,stamp);
|
||||
bool bounds_query(bounds,stamp);
|
||||
bool bounds_empty(bounds);
|
||||
void bounds_delete(bounds);
|
||||
void bounds_set(bounds,gen_e_list);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* BOUNDS_H */
|
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "buffer.h"
|
||||
|
||||
/* Invariant: buffer always null-terminated */
|
||||
struct growbuf
|
||||
{
|
||||
region r;
|
||||
unsigned int maxsize, cursize;
|
||||
char *buffer;
|
||||
};
|
||||
|
||||
/* Make a new buffer with initial size */
|
||||
growbuf growbuf_new(region r, int size)
|
||||
{
|
||||
growbuf b = ralloc(r, struct growbuf);
|
||||
|
||||
assert(size > 0);
|
||||
b->r = r;
|
||||
b->maxsize = size; /* Force some growth! */
|
||||
b->cursize = 1;
|
||||
b->buffer = rstralloc(r, size);
|
||||
b->buffer[0] = '\0';
|
||||
return b;
|
||||
}
|
||||
|
||||
/* Empty a buffer */
|
||||
void growbuf_reset(growbuf b)
|
||||
{
|
||||
assert(b->maxsize > 0);
|
||||
b->cursize = 1;
|
||||
b->buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/* Print to a buffer */
|
||||
int gprintf(growbuf b, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
return gvprintf(b, fmt, args);
|
||||
}
|
||||
|
||||
/* Print to a buffer */
|
||||
int gvprintf(growbuf b, const char *fmt, va_list args)
|
||||
{
|
||||
int nchars;
|
||||
|
||||
if (!fmt) /* Bug (?)/feature of vnsprintf -- printing \0 returns -1,
|
||||
goes into infinite loop. */
|
||||
return 0;
|
||||
while (1)
|
||||
{
|
||||
char *bufStart;
|
||||
int sizeLeft;
|
||||
|
||||
bufStart = b->buffer + b->cursize - 1; /* chop trailing \0 */
|
||||
sizeLeft = b->maxsize - b->cursize + 1; /* +1 size we're chooping
|
||||
the trailing \0 */
|
||||
assert(*bufStart == '\0');
|
||||
nchars = vsnprintf(bufStart, sizeLeft, fmt, args);
|
||||
if (nchars > -1 && nchars < sizeLeft)
|
||||
{
|
||||
b->cursize += nchars; /* nchars doesn't include \0,
|
||||
but we overwrote our \0 */
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* How much room do we need? In the new glibc, nchars
|
||||
tells us how much (not including the trailing null).
|
||||
So we need the current size, -1 since we'll remove the null,
|
||||
plus the new size, plus 1 for the new null. */
|
||||
int newSize = (nchars > -1) ? b->cursize - 1 + nchars + 1
|
||||
: b->maxsize * 2;
|
||||
char *newBuf;
|
||||
|
||||
/* fprintf(stderr, "Reallocating buffer, newSize=%d\n", newSize); */
|
||||
newBuf = rstralloc(b->r, newSize);
|
||||
memcpy(newBuf, b->buffer, b->cursize);
|
||||
newBuf[b->cursize-1] = '\0'; /* vsnprintf has printed something! */
|
||||
b->buffer = newBuf;
|
||||
b->maxsize = newSize;
|
||||
/* b->cursize unchanged */
|
||||
}
|
||||
}
|
||||
return nchars;
|
||||
}
|
||||
|
||||
/* Get the contents of a buffer */
|
||||
char *growbuf_contents(growbuf b)
|
||||
{
|
||||
return b->buffer;
|
||||
}
|
||||
|
||||
bool growbuf_empty(growbuf b)
|
||||
{
|
||||
return b->cursize == 1; /* Buffer always null terminated */
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BUFFER_H
|
||||
#define BUFFER_H
|
||||
|
||||
/*
|
||||
* Growable buffers
|
||||
*
|
||||
* Always null terminated.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "bool.h"
|
||||
#include "regions.h"
|
||||
#include "linkage.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct growbuf *growbuf;
|
||||
|
||||
growbuf growbuf_new(region, int); /* Make a new buffer with initial size */
|
||||
void growbuf_reset(growbuf); /* Empty a buffer */
|
||||
int gprintf(growbuf, const char *, ...); /* Print to a buffer */
|
||||
int gvprintf(growbuf, const char *, va_list); /* Print to a buffer */
|
||||
char *growbuf_contents(growbuf); /* Get the contents of a buffer */
|
||||
bool growbuf_empty(growbuf); /* Return true iff buffer is empty */
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef COMPILER_H
|
||||
#define COMPILER_H
|
||||
|
||||
# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define HAVE_C99
|
||||
# endif
|
||||
|
||||
# if 0
|
||||
/*(defined(__GNUC__) || defined(HAVE_C99)) && !defined (IN_GCC) */
|
||||
# define HAVE_VARIADIC_MACROS
|
||||
# endif
|
||||
|
||||
|
||||
# if !defined(__GNUC__) && !defined(__attribute__)
|
||||
# define __attribute__(attributes)
|
||||
# endif
|
||||
|
||||
#endif /* !COMPILER_H */
|
@ -1,362 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <regions.h>
|
||||
#include "dot.h"
|
||||
#include "hash.h"
|
||||
|
||||
static FILE *of;
|
||||
static hash_table node_hash_table;
|
||||
static region dot_region;
|
||||
static int node_count;
|
||||
static const char *edge_op;
|
||||
|
||||
static void print_n_attrs(node_attr *attrs, int n)
|
||||
{
|
||||
int i;
|
||||
fputc('[',of);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
const char *name;
|
||||
switch (attrs[i].name)
|
||||
{
|
||||
case n_color:
|
||||
name = "color";
|
||||
break;
|
||||
case n_fontcolor:
|
||||
name = "fontcolor";
|
||||
break;
|
||||
case n_fontname:
|
||||
name = "fontname";
|
||||
break;
|
||||
case n_fontsize:
|
||||
name = "fontsize";
|
||||
break;
|
||||
case n_height:
|
||||
name = "height";
|
||||
break;
|
||||
case n_width:
|
||||
name = "width";
|
||||
break;
|
||||
case n_label:
|
||||
name = "label";
|
||||
break;
|
||||
case n_layer:
|
||||
name = "layer";
|
||||
break;
|
||||
case n_shape:
|
||||
name = "shape";
|
||||
break;
|
||||
case n_shapefile:
|
||||
name = "shapefile";
|
||||
break;
|
||||
case n_style:
|
||||
name = "style";
|
||||
break;
|
||||
default:
|
||||
name = "";
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
if (i > 0)
|
||||
fputc(',',of);
|
||||
fprintf(of,"%s = %s",name,attrs[i].value);
|
||||
}
|
||||
|
||||
fputc(']',of);
|
||||
}
|
||||
|
||||
static void print_e_attrs(edge_attr *attrs, int n)
|
||||
{
|
||||
int i;
|
||||
fputc('[',of);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
const char *name;
|
||||
switch(attrs[i].name)
|
||||
{
|
||||
case e_color:
|
||||
name = "color";
|
||||
break;
|
||||
case e_decorate:
|
||||
name = "decorate";
|
||||
break;
|
||||
case e_dir:
|
||||
name = "dir";
|
||||
break;
|
||||
case e_fontcolor:
|
||||
name = "fontcolor";
|
||||
break;
|
||||
case e_fontname:
|
||||
name = "fontname";
|
||||
break;
|
||||
case e_fontsize:
|
||||
name = "fontsize";
|
||||
break;
|
||||
case e_id:
|
||||
name = "id";
|
||||
break;
|
||||
case e_label:
|
||||
name = "label";
|
||||
break;
|
||||
case e_layer:
|
||||
name = "layer";
|
||||
break;
|
||||
case e_minlen:
|
||||
name = "minlen";
|
||||
break;
|
||||
case e_style:
|
||||
name = "style";
|
||||
break;
|
||||
case e_weight:
|
||||
name = "weight";
|
||||
break;
|
||||
default :
|
||||
name = "";
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
if (i > 0)
|
||||
fputc(',',of);
|
||||
fprintf(of,"%s = %s",name,attrs[i].value);
|
||||
}
|
||||
fputc(']',of);
|
||||
}
|
||||
|
||||
static void print_g_attrs(graph_attr *attrs, int n)
|
||||
{
|
||||
int i;
|
||||
fputc('[',of);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
const char *name;
|
||||
switch (attrs[i].name)
|
||||
{
|
||||
case g_center:
|
||||
name = "center";
|
||||
break;
|
||||
case g_clusterrank:
|
||||
name = "clusterrank";
|
||||
break;
|
||||
case g_color:
|
||||
name = "color";
|
||||
break;
|
||||
case g_concentrate:
|
||||
name = "concentrate";
|
||||
break;
|
||||
case g_fontcolor:
|
||||
name = "fontcolor";
|
||||
break;
|
||||
case g_fontname:
|
||||
name = "fontname";
|
||||
break;
|
||||
case g_fontsize:
|
||||
name = "fontsize";
|
||||
break;
|
||||
case g_label:
|
||||
name = "label";
|
||||
break;
|
||||
case g_layerseq:
|
||||
name = "layerseq";
|
||||
break;
|
||||
case g_margin:
|
||||
name = "margin";
|
||||
break;
|
||||
case g_mclimit:
|
||||
name = "mclimit";
|
||||
break;
|
||||
case g_nodesep:
|
||||
name = "nodesep";
|
||||
break;
|
||||
case g_nslimit:
|
||||
name = "nslimit";
|
||||
break;
|
||||
case g_ordering:
|
||||
name = "ordering";
|
||||
break;
|
||||
case g_orientation:
|
||||
name = "orientation";
|
||||
break;
|
||||
case g_page:
|
||||
name = "page";
|
||||
break;
|
||||
case g_rank:
|
||||
name = "rank";
|
||||
break;
|
||||
case g_rankdir:
|
||||
name = "rankdir";
|
||||
break;
|
||||
case g_ranksep:
|
||||
name = "ranksep";
|
||||
break;
|
||||
case g_ratio:
|
||||
name = "ratio";
|
||||
break;
|
||||
case g_size:
|
||||
name = "size";
|
||||
break;
|
||||
default :
|
||||
name = "";
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
if (i > 0)
|
||||
fputc(',',of);
|
||||
fprintf(of,"%s = %s",name,attrs[i].value);
|
||||
}
|
||||
fputc(']',of);
|
||||
}
|
||||
|
||||
|
||||
void dot_start(FILE *to,const char *name,bool is_directed,bool is_strict)
|
||||
{
|
||||
const char *graph_type,*strict;
|
||||
|
||||
|
||||
node_count = 0;
|
||||
dot_region = newregion();
|
||||
node_hash_table = make_string_hash_table(dot_region,8,TRUE);
|
||||
of = to;
|
||||
|
||||
if (is_directed)
|
||||
{
|
||||
edge_op = "->";
|
||||
graph_type = "digraph";
|
||||
}
|
||||
else
|
||||
{
|
||||
edge_op = "--";
|
||||
graph_type = "graph";
|
||||
}
|
||||
|
||||
if (is_strict)
|
||||
strict = "strict";
|
||||
else
|
||||
strict = "";
|
||||
|
||||
fprintf(of,"%s %s %s{\n",strict,graph_type,name);
|
||||
|
||||
}
|
||||
|
||||
void dot_global_graph_style(graph_attr *attrs, int n)
|
||||
{
|
||||
fputs("graph ",of);
|
||||
print_g_attrs(attrs,n);
|
||||
fputc(';',of);
|
||||
fputc('\n',of);
|
||||
}
|
||||
|
||||
void dot_global_edge_style(edge_attr *attrs, int n)
|
||||
{
|
||||
fputs("edge ",of);
|
||||
print_e_attrs(attrs,n);
|
||||
fputc(';',of);
|
||||
fputc('\n',of);
|
||||
}
|
||||
|
||||
void dot_global_node_style(node_attr *attrs, int n)
|
||||
{
|
||||
fputs("node ",of);
|
||||
print_n_attrs(attrs,n);
|
||||
fputc(';',of);
|
||||
fputc('\n',of);
|
||||
}
|
||||
|
||||
/* by default, set the node's name to label */
|
||||
static void declare_node(dot_node n, char *label)
|
||||
{
|
||||
int i;
|
||||
char mangled[512];
|
||||
|
||||
if (label[0] == '\"')
|
||||
mangled[0] = 's';
|
||||
else
|
||||
mangled[0] = label[0];
|
||||
|
||||
for (i = 1; label[i] && i < 512 ;i++)
|
||||
{
|
||||
if (label[i] == '\"')
|
||||
mangled[i] = '_';
|
||||
else mangled[i] = label[i];
|
||||
}
|
||||
mangled[i] = '\0';
|
||||
|
||||
fprintf(of,"nd_%d [label=\"%s\"]\n",n,mangled);
|
||||
}
|
||||
|
||||
dot_node dot_get_node(char *label) deletes
|
||||
{
|
||||
dot_node result;
|
||||
if (!hash_table_lookup(node_hash_table,(hash_key)label,(hash_data *)(char *)&result))
|
||||
{
|
||||
dot_node newnode = node_count++;
|
||||
|
||||
declare_node(newnode,label);
|
||||
hash_table_insert(node_hash_table,
|
||||
(hash_key)rstrdup(dot_region,label),
|
||||
(hash_data)newnode);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
void dot_node_style(dot_node node,node_attr *attrs, int n)
|
||||
{
|
||||
fprintf(of,"nd_%d ",node);
|
||||
print_n_attrs(attrs,n);
|
||||
fputc(';',of);
|
||||
fputc('\n',of);
|
||||
}
|
||||
|
||||
void dot_plain_edge(dot_node from, dot_node to)
|
||||
{
|
||||
fprintf(of,"nd_%d %s nd_%d;\n",from,edge_op,to);
|
||||
}
|
||||
|
||||
void dot_styled_edge(dot_node from, dot_node to, edge_attr *attrs, int n)
|
||||
{
|
||||
fprintf(of,"nd_%d %s nd_%d ",from,edge_op,to);
|
||||
print_e_attrs(attrs,n);
|
||||
fputc(';',of);
|
||||
fputc('\n',of);
|
||||
}
|
||||
|
||||
void dot_end(void) deletes
|
||||
{
|
||||
fputc('}',of);
|
||||
hash_table_delete(node_hash_table);
|
||||
deleteregion_ptr(&dot_region);
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DOT_H
|
||||
#define DOT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "linkage.h"
|
||||
#include "bool.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef int dot_node;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
enum n_attrs
|
||||
{
|
||||
n_color,
|
||||
n_fontcolor,
|
||||
n_fontname,
|
||||
n_fontsize,
|
||||
n_height,
|
||||
n_width,
|
||||
n_label,
|
||||
n_layer,
|
||||
n_shape,
|
||||
n_shapefile,
|
||||
n_style
|
||||
} name;
|
||||
const char *value;
|
||||
} node_attr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
enum e_attrs
|
||||
{
|
||||
e_color,
|
||||
e_decorate,
|
||||
e_dir,
|
||||
e_fontcolor,
|
||||
e_fontname,
|
||||
e_fontsize,
|
||||
e_id,
|
||||
e_label,
|
||||
e_layer,
|
||||
e_minlen,
|
||||
e_style,
|
||||
e_weight
|
||||
} name;
|
||||
const char *value;
|
||||
} edge_attr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
enum g_attrs
|
||||
{
|
||||
g_center,
|
||||
g_clusterrank,
|
||||
g_color,
|
||||
g_concentrate,
|
||||
g_fontcolor,
|
||||
g_fontname,
|
||||
g_fontsize,
|
||||
g_label,
|
||||
g_layerseq,
|
||||
g_margin,
|
||||
g_mclimit,
|
||||
g_nodesep,
|
||||
g_nslimit,
|
||||
g_ordering,
|
||||
g_orientation,
|
||||
g_page,
|
||||
g_rank,
|
||||
g_rankdir,
|
||||
g_ranksep,
|
||||
g_ratio,
|
||||
g_size
|
||||
} name;
|
||||
const char *value;
|
||||
} graph_attr;
|
||||
|
||||
void dot_start(FILE *to,const char *name,bool directed,bool strict);
|
||||
|
||||
void dot_global_graph_style(graph_attr *attrs,int n);
|
||||
void dot_global_edge_style(edge_attr *attrs,int n);
|
||||
void dot_global_node_style(node_attr *attrs,int n);
|
||||
|
||||
dot_node dot_get_node(char *label) deletes;
|
||||
void dot_node_style(dot_node node,node_attr *attrs,int n);
|
||||
|
||||
void dot_plain_edge(dot_node from, dot_node to);
|
||||
void dot_styled_edge(dot_node from, dot_node to, edge_attr *attrs,int n);
|
||||
|
||||
void dot_end(void) deletes;
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* DOT_H */
|
@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "banshee.h"
|
||||
#include "flow-var.h"
|
||||
#include "ufind.h"
|
||||
#include "bounds.h"
|
||||
|
||||
DECLARE_UFIND(contour_elt,contour)
|
||||
|
||||
struct flow_var /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type; /* alias or var */
|
||||
stamp st;
|
||||
gen_e alias;
|
||||
bounds sameregion ubs;
|
||||
bounds sameregion lbs;
|
||||
contour_elt elt;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
DEFINE_UFIND(contour_elt,contour)
|
||||
DEFINE_LIST(flow_var_list, flow_var)
|
||||
|
||||
#define get_contour(x) (contour_elt_get_info((x)->elt))
|
||||
|
||||
static flow_var make_var(region r, const char *name, stamp st)
|
||||
{
|
||||
flow_var result = ralloc(r,struct flow_var);
|
||||
|
||||
result->type = VAR_TYPE;
|
||||
result->st = st;
|
||||
result->alias = NULL;
|
||||
result->ubs = bounds_create(r);
|
||||
result->lbs = bounds_create(r);
|
||||
result->elt = new_contour_elt(r,NULL);
|
||||
result->name = name;
|
||||
|
||||
#ifdef NONSPEC
|
||||
result->sort = flow_sort;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
flow_var fv_fresh(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh());
|
||||
}
|
||||
|
||||
flow_var fv_fresh_large(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_large());
|
||||
}
|
||||
|
||||
flow_var fv_fresh_small(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_small());
|
||||
}
|
||||
|
||||
const char * fv_get_name(flow_var v)
|
||||
{
|
||||
return v->name;
|
||||
}
|
||||
|
||||
gen_e_list fv_get_lbs(flow_var v)
|
||||
{
|
||||
return bounds_exprs(v->lbs);
|
||||
}
|
||||
|
||||
gen_e_list fv_get_ubs(flow_var v)
|
||||
{
|
||||
return bounds_exprs(v->ubs);
|
||||
}
|
||||
|
||||
bool fv_add_ub(flow_var v, gen_e e, stamp st)
|
||||
{
|
||||
return bounds_add(v->ubs,e,st);
|
||||
}
|
||||
|
||||
bool fv_add_lb(flow_var v, gen_e e, stamp st)
|
||||
{
|
||||
return bounds_add(v->lbs,e,st);
|
||||
}
|
||||
|
||||
bool fv_is_ub(flow_var v, stamp st)
|
||||
{
|
||||
bool self_edge = v->st == st,
|
||||
in_bounds = bounds_query(v->ubs,st);
|
||||
|
||||
return (self_edge || in_bounds);
|
||||
}
|
||||
|
||||
bool fv_is_lb(flow_var v, stamp st)
|
||||
{
|
||||
bool self_edge = v->st == st,
|
||||
in_bounds = bounds_query(v->lbs,st);
|
||||
|
||||
return (self_edge || in_bounds);
|
||||
}
|
||||
|
||||
void fv_set_alias(flow_var v, gen_e e)
|
||||
{
|
||||
assert(v->type == VAR_TYPE);
|
||||
|
||||
v->type = ALIAS_TYPE;
|
||||
v->alias = e;
|
||||
}
|
||||
|
||||
gen_e fv_get_alias(flow_var v)
|
||||
{
|
||||
return v->alias;
|
||||
}
|
||||
|
||||
bool fv_has_contour(flow_var v)
|
||||
{
|
||||
return (get_contour(v) != NULL);
|
||||
}
|
||||
|
||||
void fv_set_contour(flow_var v, contour c)
|
||||
{
|
||||
contour_elt_update(v->elt,c);
|
||||
}
|
||||
|
||||
static contour combine_contour(contour c1, contour c2)
|
||||
{
|
||||
if (c1 == NULL)
|
||||
return c2;
|
||||
else if (c2 == NULL)
|
||||
return c1;
|
||||
|
||||
else
|
||||
{
|
||||
fail("Attempt to unify two distinct contours\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
void fv_unify_contour(flow_var v1, flow_var v2)
|
||||
{
|
||||
contour_elt_unify(combine_contour,v1->elt,v2->elt);
|
||||
}
|
||||
|
||||
|
||||
gen_e fv_instantiate_contour(flow_var v) deletes
|
||||
{
|
||||
contour c = get_contour(v);
|
||||
return c->instantiate(c->fresh,c->get_stamp,c->shape);
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FLOW_VAR_H
|
||||
#define FLOW_VAR_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
#include "jcollection.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct flow_var *flow_var;
|
||||
|
||||
typedef gen_e (*contour_inst_fn_ptr) (fresh_fn_ptr,get_stamp_fn_ptr,gen_e) deletes;
|
||||
|
||||
struct contour
|
||||
{
|
||||
gen_e shape;
|
||||
fresh_fn_ptr fresh;
|
||||
get_stamp_fn_ptr get_stamp;
|
||||
contour_inst_fn_ptr instantiate;
|
||||
};
|
||||
|
||||
typedef struct contour *contour;
|
||||
|
||||
DECLARE_LIST(flow_var_list, flow_var)
|
||||
|
||||
flow_var fv_fresh(region r, const char *name);
|
||||
flow_var fv_fresh_large(region r, const char *name);
|
||||
flow_var fv_fresh_small(region r, const char *name);
|
||||
const char * fv_get_name(flow_var v);
|
||||
gen_e_list fv_get_lbs(flow_var v);
|
||||
gen_e_list fv_get_ubs(flow_var v);
|
||||
bool fv_add_ub(flow_var v, gen_e e, stamp st);
|
||||
bool fv_add_lb(flow_var v, gen_e e, stamp st);
|
||||
bool fv_is_ub(flow_var v, stamp st);
|
||||
bool fv_is_lb(flow_var v, stamp st);
|
||||
|
||||
void fv_set_alias(flow_var v, gen_e e);
|
||||
gen_e fv_get_alias(flow_var v);
|
||||
void fv_set_contour(flow_var v, contour c);
|
||||
bool fv_has_contour(flow_var v);
|
||||
void fv_unify_contour(flow_var v1, flow_var v2);
|
||||
gen_e fv_instantiate_contour(flow_var v) deletes;
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* FLOW_VAR_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FLOWROW_SORT_H
|
||||
#define FLOWROW_SORT_H
|
||||
|
||||
|
||||
#include "stdio.h"
|
||||
#include "banshee.h"
|
||||
#include "termhash.h"
|
||||
#include "flow-var.h"
|
||||
|
||||
struct flowrow_field
|
||||
{
|
||||
char *label;
|
||||
gen_e expr;
|
||||
};
|
||||
|
||||
typedef struct flowrow_field *flowrow_field;
|
||||
|
||||
DECLARE_LIST(flowrow_map,flowrow_field)
|
||||
|
||||
extern region flowrow_region;
|
||||
|
||||
void flowrow_inclusion(fresh_fn_ptr fresh, get_stamp_fn_ptr get_stamp,
|
||||
incl_fn_ptr field_incl,gen_e zero_elem, gen_e e1,
|
||||
gen_e e2) deletes;
|
||||
|
||||
gen_e flowrow_row(get_stamp_fn_ptr get_stamp,flowrow_map fields, gen_e rest) deletes;
|
||||
|
||||
gen_e flowrow_extract_field(const char *name, gen_e e);
|
||||
gen_e flowrow_extract_rest(gen_e e);
|
||||
flowrow_map flowrow_extract_fields(gen_e e);
|
||||
|
||||
stamp flowrow_get_stamp(gen_e e);
|
||||
|
||||
#ifndef NONSPEC
|
||||
gen_e flowrow_zero(void);
|
||||
gen_e flowrow_one(void);
|
||||
gen_e flowrow_abs(void);
|
||||
gen_e flowrow_wild(void);
|
||||
gen_e flowrow_fresh(const char *name);
|
||||
gen_e flowrow_fresh_small(const char *name);
|
||||
gen_e flowrow_fresh_large(const char *name);
|
||||
#else
|
||||
sort_kind flowrow_base_sort(gen_e e);
|
||||
gen_e flowrow_zero(sort_kind base_sort);
|
||||
gen_e flowrow_one(sort_kind base_sort);
|
||||
gen_e flowrow_abs(sort_kind base_sort);
|
||||
gen_e flowrow_wild(sort_kind base_sort);
|
||||
gen_e flowrow_fresh(sort_kind base_sort);
|
||||
gen_e flowrow_fresh_small(sort_kind base_sort);
|
||||
gen_e flowrow_fresh_large(sort_kind base_sort);
|
||||
#endif
|
||||
|
||||
bool flowrow_is_zero(gen_e e);
|
||||
bool flowrow_is_one(gen_e e);
|
||||
bool flowrow_is_abs(gen_e e);
|
||||
bool flowrow_is_wild(gen_e e);
|
||||
bool flowrow_is_var(gen_e e);
|
||||
bool flowrow_is_row(gen_e e);
|
||||
bool flowrow_is_alias(gen_e e);
|
||||
|
||||
|
||||
void flowrow_init(void);
|
||||
void flowrow_reset(void) deletes;
|
||||
|
||||
typedef void (* field_print_fn_ptr) (FILE *f,gen_e e) deletes;
|
||||
|
||||
void flowrow_print(FILE *f,get_stamp_fn_ptr get_stamp,
|
||||
field_print_fn_ptr field_print,gen_e e) deletes;
|
||||
void flowrow_print_stats(FILE *f);
|
||||
|
||||
extern struct flowrow_stats flowrow_stats;
|
||||
|
||||
struct flowrow_stats
|
||||
{
|
||||
int fresh;
|
||||
int fresh_small;
|
||||
int fresh_large;
|
||||
|
||||
int rows_disjoint_wild;
|
||||
int rows_equal;
|
||||
int rows_zero_one_wild;
|
||||
int rows_l_inductive;
|
||||
int rows_r_inductive;
|
||||
int rows_disjoint_r1_minimal;
|
||||
int rows_disjoint_r1_var_r2_minimal;
|
||||
int rows_disjoint_r1_var_r2_maximal;
|
||||
int rows_disjoint_r1_var_r2_closed;
|
||||
int rows_disjoint_r1_var_r2_var_lt;
|
||||
int rows_disjoint_r1_var_r2_var_gt;
|
||||
int rows_equal_domains;
|
||||
int rows_nonempty_intersection;
|
||||
int rows_fresh;
|
||||
int rows_fresh_large;
|
||||
};
|
||||
|
||||
#endif /* FLOWROW_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,427 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "hash.h"
|
||||
#include "util.h"
|
||||
|
||||
struct bucket
|
||||
{
|
||||
hash_key key;
|
||||
hash_data data;
|
||||
struct bucket *next;
|
||||
};
|
||||
|
||||
#define scan_bucket(b, var) for (var = b; var; var = var->next)
|
||||
|
||||
struct Hash_table
|
||||
{
|
||||
region r; /* Region for this table */
|
||||
hash_fn hash; /* Function for hashing keys */
|
||||
keyeq_fn cmp; /* Function for comparing keys */
|
||||
|
||||
int size; /* Number of buckets */
|
||||
int elts; /* Number of elements */
|
||||
bool internal_rgn; /* TRUE if the ht uses an internal region */
|
||||
bucket *table; /* Array of (size) buckets */
|
||||
};
|
||||
|
||||
static void rehash(hash_table ht) deletes;
|
||||
|
||||
/* Make a new hash table, with size buckets initially. The actual
|
||||
table is allocated in a local region, which is discarded on rehashing. */
|
||||
hash_table make_hash_table(region r, int size, hash_fn hash,
|
||||
keyeq_fn cmp, bool internal_rgn)
|
||||
{
|
||||
hash_table result;
|
||||
|
||||
assert(size > 0);
|
||||
result = ralloc(r, struct Hash_table);
|
||||
|
||||
if (internal_rgn)
|
||||
result->r = newregion();
|
||||
else
|
||||
result->r = r;
|
||||
|
||||
result->internal_rgn = internal_rgn;
|
||||
result->hash = hash;
|
||||
result->cmp = cmp;
|
||||
result->size = size;
|
||||
result->elts = 0;
|
||||
result->table = rarrayalloc(result->r, size, bucket);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Hash a string */
|
||||
static int string_hash(char *str)
|
||||
{
|
||||
char *c;
|
||||
int h;
|
||||
|
||||
c = str;
|
||||
h = 0;
|
||||
if (!c)
|
||||
return 0;
|
||||
while (*c)
|
||||
h = 33*h + 720 + *c++; /* SML/NJ's string hash function */
|
||||
return h;
|
||||
}
|
||||
|
||||
/* Return TRUE iff s1 == s2 */
|
||||
static bool string_eq(char *s1, char *s2)
|
||||
{
|
||||
return !strcmp(s1, s2);
|
||||
}
|
||||
|
||||
/* Make a hash table for strings. */
|
||||
hash_table make_string_hash_table(region rhash, int size, bool internal_rgn)
|
||||
{
|
||||
return make_hash_table(rhash, size, (hash_fn) string_hash,
|
||||
(keyeq_fn) string_eq,internal_rgn);
|
||||
}
|
||||
|
||||
/* Zero out ht. Doesn't reclaim bucket space. */
|
||||
void hash_table_reset(hash_table ht) deletes
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ht->internal_rgn)
|
||||
{
|
||||
deleteregion(ht->r);
|
||||
ht->r = newregion();
|
||||
}
|
||||
|
||||
ht->elts = 0;
|
||||
for (i = 0; i < ht->size; i++)
|
||||
ht->table[i] = NULL;
|
||||
}
|
||||
|
||||
void hash_table_delete(hash_table ht) deletes
|
||||
{
|
||||
if (ht->internal_rgn)
|
||||
deleteregion(ht->r);
|
||||
}
|
||||
|
||||
|
||||
/* Return the number of entries in ht */
|
||||
int hash_table_size(hash_table ht)
|
||||
{
|
||||
return ht->elts;
|
||||
}
|
||||
|
||||
/* Return the bucket corresponding to k in ht */
|
||||
static inline bucket *find_bucket(hash_table ht, hash_key k)
|
||||
{
|
||||
int hash;
|
||||
|
||||
hash = ht->hash(k);
|
||||
if (hash < 0)
|
||||
hash = -1*hash;
|
||||
return &ht->table[hash % ht->size];
|
||||
}
|
||||
|
||||
/* Lookup k in ht. Returns corresponding data in *d, and function
|
||||
result is TRUE if the k was in ht, false otherwise. */
|
||||
bool hash_table_lookup(hash_table ht, hash_key k, hash_data *d)
|
||||
{
|
||||
bucket cur;
|
||||
|
||||
cur = *find_bucket(ht, k);
|
||||
while (cur)
|
||||
{
|
||||
if (ht->cmp(k, cur->key))
|
||||
{
|
||||
if (d)
|
||||
*d = cur->data;
|
||||
return TRUE;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Add k:d to ht. If k was already in ht, replace old entry by k:d.
|
||||
Rehash if necessary. Returns TRUE if k was not already in ht. */
|
||||
bool hash_table_insert(hash_table ht, hash_key k, hash_data d) deletes
|
||||
{
|
||||
bucket *cur;
|
||||
|
||||
if (ht->elts > ht->size*15)
|
||||
rehash(ht);
|
||||
cur = find_bucket(ht, k);
|
||||
while (*cur)
|
||||
{
|
||||
if (ht->cmp(k, (*cur)->key))
|
||||
{
|
||||
(*cur)->data = d;
|
||||
return FALSE; /* Replace */
|
||||
}
|
||||
cur = &(*cur)->next;
|
||||
}
|
||||
*cur = ralloc(ht->r, struct bucket);
|
||||
(*cur)->key = k;
|
||||
(*cur)->data = d;
|
||||
(*cur)->next = NULL;
|
||||
ht->elts++;
|
||||
return TRUE; /* New key */
|
||||
}
|
||||
|
||||
/* Remove mapping for k in ht. Returns TRUE if k was in ht. */
|
||||
bool hash_table_remove(hash_table ht, hash_key k)
|
||||
{
|
||||
bucket *cur;
|
||||
bucket *prev = NULL;
|
||||
|
||||
cur = find_bucket(ht, k);
|
||||
while (*cur)
|
||||
{
|
||||
if (ht->cmp(k, (*cur)->key))
|
||||
{
|
||||
if (!*prev)
|
||||
(*prev)->next = (*cur)->next;
|
||||
else
|
||||
*cur = NULL;
|
||||
ht->elts--;
|
||||
return TRUE;
|
||||
}
|
||||
prev = cur;
|
||||
cur = &(*cur)->next;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return a copy of ht */
|
||||
hash_table hash_table_copy(region r, hash_table ht)
|
||||
{
|
||||
int i;
|
||||
hash_table result;
|
||||
bucket cur, newbucket, *prev;
|
||||
|
||||
result = make_hash_table(r, ht->size, ht->hash, ht->cmp,ht->internal_rgn);
|
||||
result->elts = ht->elts;
|
||||
|
||||
for (i = 0; i < ht->size; i++)
|
||||
{
|
||||
prev = &result->table[i];
|
||||
scan_bucket(ht->table[i], cur)
|
||||
{
|
||||
newbucket = ralloc(result->r, struct bucket);
|
||||
newbucket->key = cur->key;
|
||||
newbucket->data = cur->data;
|
||||
newbucket->next = NULL;
|
||||
assert(!*prev);
|
||||
*prev = newbucket;
|
||||
prev = &newbucket->next;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
/*
|
||||
hash_table result;
|
||||
hash_table_scanner hts;
|
||||
hash_key k;
|
||||
hash_data d;
|
||||
|
||||
result = make_hash_table(r, ht->size, ht->hash, ht->cmp);
|
||||
hash_table_scan(ht, &hts);
|
||||
while (hash_table_next(&hts, &k, &d))
|
||||
insist(hash_table_insert(result, k, d));
|
||||
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
|
||||
/* Increase size of ht (double it) and reinsert all the elements */
|
||||
static void rehash(hash_table ht) deletes
|
||||
{
|
||||
int old_table_size, i;
|
||||
bucket *old_table, cur;
|
||||
region old_region;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Rehash table size=%d, elts=%d\n", ht->size, ht->elts);
|
||||
#endif
|
||||
|
||||
old_table_size = ht->size;
|
||||
old_table = ht->table;
|
||||
old_region = ht->r;
|
||||
|
||||
if (ht->internal_rgn)
|
||||
ht->r = newregion();
|
||||
|
||||
ht->size = ht->size*2;
|
||||
ht->elts = 0;
|
||||
ht->table = rarrayalloc(ht->r, ht->size, bucket);
|
||||
|
||||
for (i = 0; i < old_table_size; i++)
|
||||
scan_bucket(old_table[i], cur)
|
||||
insist(hash_table_insert(ht, cur->key, cur->data));
|
||||
|
||||
if (ht->internal_rgn)
|
||||
deleteregion(old_region);
|
||||
}
|
||||
|
||||
/* Begin scanning ht */
|
||||
void hash_table_scan(hash_table ht, hash_table_scanner *hts)
|
||||
{
|
||||
hts->ht = ht;
|
||||
hts->i = 0;
|
||||
hts->cur = hts->ht->table[0];
|
||||
}
|
||||
|
||||
/* Get next elt in table, storing the elt in *k and *d if k and d are
|
||||
non-NULL, respectively. Returns TRUE if there is a next elt, FALSE
|
||||
otherwise. */
|
||||
bool hash_table_next(hash_table_scanner *hts, hash_key *k, hash_data *d)
|
||||
{
|
||||
while (hts->cur == NULL)
|
||||
{
|
||||
hts->i++;
|
||||
if (hts->i < hts->ht->size)
|
||||
hts->cur = hts->ht->table[hts->i];
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (hts->i == hts->ht->size)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (k)
|
||||
*k = hts->cur->key;
|
||||
if (d)
|
||||
*d = hts->cur->data;
|
||||
hts->cur = hts->cur->next;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Apply f to all elements of ht, in some arbitrary order */
|
||||
void hash_table_apply(hash_table ht, hash_apply_fn f, void *arg)
|
||||
{
|
||||
int i;
|
||||
bucket cur;
|
||||
|
||||
for (i = 0; i < ht->size; i++)
|
||||
scan_bucket(ht->table[i], cur)
|
||||
f(cur->key, cur->data, arg);
|
||||
}
|
||||
|
||||
/* Map f to all elements on ht, creating a new hash table */
|
||||
hash_table hash_table_map(hash_table ht, hash_map_fn f, void *arg)
|
||||
{
|
||||
int i;
|
||||
hash_table result;
|
||||
bucket cur, newbucket, *prev;
|
||||
|
||||
result = make_hash_table(ht->r, ht->size, ht->hash, ht->cmp,ht->internal_rgn);
|
||||
result->elts = ht->elts;
|
||||
|
||||
for (i = 0; i < ht->size; i++)
|
||||
{
|
||||
prev = &result->table[i];
|
||||
scan_bucket(ht->table[i], cur)
|
||||
{
|
||||
newbucket = ralloc(ht->r, struct bucket);
|
||||
newbucket->key = cur->key;
|
||||
newbucket->data = f(cur->key, cur->data, arg);
|
||||
newbucket->next = NULL;
|
||||
assert(!*prev);
|
||||
*prev = newbucket;
|
||||
prev = &newbucket->next;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
/*
|
||||
hash_table result;
|
||||
int i;
|
||||
bucket cur;
|
||||
|
||||
result = make_hash_table(ht->r, ht->size, ht->hash, ht->cmp);
|
||||
for (i = 0; i < ht->size; i++)
|
||||
scan_bucket(ht->table[i], cur)
|
||||
insist(hash_table_insert(result, cur->key, f(cur->key, cur->data, arg)));
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
|
||||
static keycmp_fn cur_cmp = NULL;
|
||||
|
||||
static int entry_cmp(const void *a, const void *b)
|
||||
{
|
||||
struct sorted_entry *ae = (struct sorted_entry *) a;
|
||||
struct sorted_entry *be = (struct sorted_entry *) b;
|
||||
return cur_cmp(ae->k, be->k);
|
||||
}
|
||||
|
||||
/* Begin scanning ht in sorted order according to f */
|
||||
void hash_table_scan_sorted(hash_table ht, keycmp_fn f,
|
||||
hash_table_scanner_sorted *htss)
|
||||
{
|
||||
hash_table_scanner hts;
|
||||
int i;
|
||||
|
||||
htss->r = newregion();
|
||||
htss->size = hash_table_size(ht);
|
||||
htss->entries = rarrayalloc(htss->r, htss->size, struct sorted_entry);
|
||||
htss->i = 0;
|
||||
|
||||
hash_table_scan(ht, &hts);
|
||||
i = 0;
|
||||
while (hash_table_next(&hts, &htss->entries[i].k,
|
||||
&htss->entries[i].d))
|
||||
i++;
|
||||
assert(i == htss->size);
|
||||
cur_cmp = f;
|
||||
qsort(htss->entries, htss->size, sizeof(struct sorted_entry), entry_cmp);
|
||||
cur_cmp = NULL;
|
||||
}
|
||||
|
||||
/* Just like hash_table_next, but scans in sorted order */
|
||||
bool hash_table_next_sorted(hash_table_scanner_sorted *htss, hash_key *k,
|
||||
hash_data *d) deletes
|
||||
{
|
||||
if (htss->i < htss->size)
|
||||
{
|
||||
*k = htss->entries[htss->i].k;
|
||||
*d = htss->entries[htss->i].d;
|
||||
htss->i++;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteregion(htss->r);
|
||||
htss->r = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HASH_H
|
||||
#define HASH_H
|
||||
|
||||
#include <regions.h>
|
||||
#include "bool.h"
|
||||
/*#include "hash_info.h"*/ /* Includes hash_key, hash_data typedef */
|
||||
#include "linkage.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef void *hash_key;
|
||||
typedef void *hash_data;
|
||||
|
||||
/* Function to hash a key */
|
||||
typedef int (*hash_fn)(hash_key k);
|
||||
|
||||
/* Function returning true iff k1 and k2 are equal */
|
||||
typedef bool (*keyeq_fn)(hash_key k1, hash_key k2);
|
||||
|
||||
/* Function applied to elts in the hash table */
|
||||
typedef void (*hash_apply_fn)(hash_key k, hash_data d, void *arg);
|
||||
|
||||
/* Function mapped to elts in the hash table */
|
||||
typedef hash_data (*hash_map_fn)(hash_key k, hash_data d, void *arg);
|
||||
|
||||
typedef struct Hash_table *hash_table;
|
||||
|
||||
/* Make a new hash table, with size buckets initially. */
|
||||
hash_table make_hash_table(region rhash, int size, hash_fn hash,
|
||||
keyeq_fn cmp, bool internal_rgn);
|
||||
|
||||
/* Make a hash table for strings. */
|
||||
hash_table make_string_hash_table(region rhash, int size, bool internal_rgn);
|
||||
|
||||
/* Zero out ht. Doesn't reclaim bucket space. */
|
||||
void hash_table_reset(hash_table ht) deletes;
|
||||
|
||||
/* Delete ht and internal memory associated with it. The top level pointer
|
||||
must still be deleted. */
|
||||
void hash_table_delete(hash_table ht) deletes;
|
||||
|
||||
/* Return the number of entries in ht */
|
||||
int hash_table_size(hash_table ht);
|
||||
|
||||
|
||||
/* Lookup k in ht. If d is not NULL, returns corresponding data in *d.
|
||||
Function result is TRUE if the k was in ht, false otherwise. */
|
||||
bool hash_table_lookup(hash_table ht, hash_key k, hash_data *d);
|
||||
|
||||
/* Add k:d to ht. If k was already in ht, replace old entry by k:d.
|
||||
Rehash if necessary. Returns TRUE if k was not already in ht. */
|
||||
bool hash_table_insert(hash_table ht, hash_key k, hash_data d) deletes;
|
||||
|
||||
/* Remove mapping for k in ht. Returns TRUE if k was in ht. */
|
||||
bool hash_table_remove(hash_table ht, hash_key k);
|
||||
|
||||
/* Return a copy of ht, allocated in rhash */
|
||||
hash_table hash_table_copy(region rhash, hash_table ht);
|
||||
|
||||
/* Apply f to all elements of ht, in some arbitrary order */
|
||||
void hash_table_apply(hash_table ht, hash_apply_fn f, void *arg);
|
||||
|
||||
/* Map f to all elements on ht, creating a new hash table */
|
||||
hash_table hash_table_map(hash_table ht, hash_map_fn f, void *arg);
|
||||
|
||||
typedef struct bucket *bucket;
|
||||
typedef struct
|
||||
{
|
||||
hash_table ht;
|
||||
int i;
|
||||
bucket cur;
|
||||
} hash_table_scanner; /* Opaque type! Do not modify fields. */
|
||||
|
||||
/* Begin scanning ht */
|
||||
void hash_table_scan(hash_table ht, hash_table_scanner *);
|
||||
|
||||
/* Get next elt in table, storing the elt in *k and *d if k and d are
|
||||
non-NULL, respectively. Returns TRUE if there is a next elt, FALSE
|
||||
otherwise. */
|
||||
bool hash_table_next(hash_table_scanner *, hash_key *k, hash_data *d);
|
||||
|
||||
/* Total order on hash table keys, only uesd for hash_table_scan_sorted */
|
||||
typedef int (*keycmp_fn)(hash_key k1, hash_key k2);
|
||||
|
||||
struct sorted_entry
|
||||
{
|
||||
hash_key k;
|
||||
hash_data d;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
region r;
|
||||
int i;
|
||||
int size;
|
||||
struct sorted_entry *entries;
|
||||
} hash_table_scanner_sorted;
|
||||
|
||||
/* Begin scanning ht in sorted order according to f */
|
||||
void hash_table_scan_sorted(hash_table ht, keycmp_fn f,
|
||||
hash_table_scanner_sorted *htss);
|
||||
|
||||
/* Just like hash_table_next, but scans in sorted order */
|
||||
bool hash_table_next_sorted(hash_table_scanner_sorted *htss, hash_key *k,
|
||||
hash_data *d) deletes;
|
||||
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
@ -1,217 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "hashset.h"
|
||||
#include "util.h"
|
||||
#define INIT_TABLE_SIZE 2
|
||||
#define EMPTY_KEY 0
|
||||
#define UB(n) ((1<<n)-1) /* 2^n-1 */
|
||||
#define CAP(n) (1<<n) /* 2^n */
|
||||
|
||||
struct hash_set
|
||||
{
|
||||
int *traditional table;
|
||||
unsigned int ub;
|
||||
unsigned int capacity;
|
||||
unsigned int inserts;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
static const int prime_1 = 83;
|
||||
static const int prime_2 = 5189;
|
||||
static const int init_table_size = INIT_TABLE_SIZE;
|
||||
static const int empty_key = EMPTY_KEY;
|
||||
|
||||
hash_set hs_create(region r)
|
||||
{
|
||||
|
||||
hash_set hs = ralloc(r, struct hash_set);
|
||||
|
||||
hs->ub = UB(init_table_size);
|
||||
hs->size = init_table_size;
|
||||
hs->capacity = CAP(init_table_size);
|
||||
hs->table = (int *)calloc(hs->capacity, sizeof(int));
|
||||
hs->inserts = 0;
|
||||
return hs;
|
||||
}
|
||||
|
||||
int hs_num_items(hash_set hs)
|
||||
{
|
||||
return hs->inserts;
|
||||
}
|
||||
|
||||
int *hs_list_items(hash_set hs)
|
||||
{
|
||||
return hs->table;
|
||||
}
|
||||
|
||||
static bool member(int *table, int ub, int i, int value)
|
||||
{
|
||||
while (table[i] != empty_key)
|
||||
{
|
||||
if (table[i] == value)
|
||||
return TRUE;
|
||||
|
||||
else
|
||||
i = ub & (i + prime_2);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline void reinsert(int *table, int ub, int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = ub & (prime_1 * value);
|
||||
|
||||
while (table[i] != empty_key)
|
||||
{
|
||||
/* possibly the value is already present */
|
||||
if (table[i] == value)
|
||||
return;
|
||||
|
||||
else
|
||||
i = ub & (i + prime_2);
|
||||
}
|
||||
|
||||
table[i] = value;
|
||||
}
|
||||
|
||||
static bool member_or_insert(int *table, int ub, int i, int value)
|
||||
{
|
||||
while (table[i] != empty_key)
|
||||
{
|
||||
if (table[i] == value)
|
||||
return TRUE;
|
||||
|
||||
else
|
||||
i = ub & (i + prime_2);
|
||||
}
|
||||
table[i] = value;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void rehash(hash_set hs)
|
||||
{
|
||||
int *old_table;
|
||||
int old_capacity, i;
|
||||
|
||||
old_table = hs->table;
|
||||
old_capacity = hs->capacity;
|
||||
hs->capacity *= 2;
|
||||
hs->ub = UB(++hs->size);
|
||||
hs->table = (int *)calloc(hs->capacity, sizeof(int));
|
||||
assert(hs->table);
|
||||
|
||||
|
||||
for (i = 0; i < old_capacity; i++)
|
||||
{
|
||||
reinsert(hs->table, hs->ub, old_table[i]);
|
||||
}
|
||||
|
||||
free(old_table);
|
||||
}
|
||||
/*
|
||||
static void post_insert(hash_set hs)
|
||||
{
|
||||
float percent_full;
|
||||
|
||||
int capacity = hs->capacity;
|
||||
int inserts = ++hs->inserts;
|
||||
|
||||
printf("%d,%d->%f\n",inserts,capacity,percent_full);
|
||||
assert(capacity);
|
||||
percent_full = (float) inserts / capacity;
|
||||
|
||||
|
||||
if (percent_full != percent_full)
|
||||
{
|
||||
assert (0);
|
||||
}
|
||||
|
||||
if (percent_full >= .85)
|
||||
rehash(hs);
|
||||
}
|
||||
*/
|
||||
|
||||
static void post_insert(hash_set hs)
|
||||
{
|
||||
int capacity = hs->capacity;
|
||||
int inserts = ++hs->inserts;
|
||||
|
||||
float percent_capacity = capacity * .85;
|
||||
|
||||
/*
|
||||
printf("%d,%d->%f\n",inserts,capacity,percent_capacity);
|
||||
*/
|
||||
|
||||
if ( (float) inserts >= percent_capacity)
|
||||
{
|
||||
rehash(hs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool hs_query(hash_set hs, int entry)
|
||||
{
|
||||
int hash;
|
||||
int ub = hs->ub;
|
||||
|
||||
hash = ub & (prime_1 * abs(entry));
|
||||
return member(hs->table, ub, hash, entry);
|
||||
}
|
||||
|
||||
bool hs_member(hash_set hs, int entry)
|
||||
{
|
||||
int hash;
|
||||
int ub = hs->ub;
|
||||
|
||||
hash = ub & (prime_1 * abs(entry));
|
||||
if (member_or_insert(hs->table, ub, hash, entry))
|
||||
return TRUE;
|
||||
|
||||
else
|
||||
{
|
||||
post_insert(hs);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void hs_delete(hash_set hs)
|
||||
{
|
||||
free(hs->table);
|
||||
}
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HASHSET_H
|
||||
#define HASHSET_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct hash_set *hash_set;
|
||||
|
||||
hash_set hs_create(region r);
|
||||
void hs_delete(hash_set);
|
||||
bool hs_member(hash_set,int); /* adds the entry if not present */
|
||||
bool hs_query(hash_set,int); /* query only */
|
||||
int *hs_list_items(hash_set);
|
||||
int hs_num_items(hash_set);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* HASHSET_H */
|
@ -1,326 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "jcollection.h"
|
||||
#include "hashset.h"
|
||||
#include "termhash.h"
|
||||
|
||||
|
||||
/*
|
||||
static term_hash jcoll_hash;
|
||||
*/
|
||||
|
||||
struct jcoll_dict
|
||||
{
|
||||
region r;
|
||||
term_hash hash;
|
||||
get_stamp_fn_ptr get_stamp;
|
||||
};
|
||||
|
||||
enum jcoll_type
|
||||
{
|
||||
j_single,
|
||||
j_chain,
|
||||
j_join
|
||||
};
|
||||
|
||||
/* generic jcoll type */
|
||||
struct jcoll
|
||||
{
|
||||
enum jcoll_type type;
|
||||
stamp st;
|
||||
};
|
||||
|
||||
struct jcoll_single
|
||||
{
|
||||
enum jcoll_type type;
|
||||
stamp st;
|
||||
gen_e entry;
|
||||
};
|
||||
|
||||
struct jcoll_chain
|
||||
{
|
||||
enum jcoll_type type;
|
||||
stamp st;
|
||||
gen_e_list sameregion entries;
|
||||
};
|
||||
|
||||
struct jcoll_join
|
||||
{
|
||||
enum jcoll_type type;
|
||||
stamp st;
|
||||
jcoll_list sameregion joins;
|
||||
gen_e_list sameregion cache;
|
||||
};
|
||||
|
||||
typedef struct jcoll_single *jcoll_single;
|
||||
typedef struct jcoll_chain *jcoll_chain;
|
||||
typedef struct jcoll_join *jcoll_join;
|
||||
|
||||
DEFINE_LIST(jcoll_list,jcoll)
|
||||
|
||||
|
||||
|
||||
jcoll jcoll_new(jcoll_dict d, gen_e e)
|
||||
{
|
||||
jcoll_single result = ralloc(d->r, struct jcoll_single);
|
||||
result->type = j_single;
|
||||
result->st = stamp_fresh();
|
||||
result->entry = e;
|
||||
return (jcoll)result;
|
||||
}
|
||||
|
||||
jcoll jcoll_jjoin(jcoll_dict d,jcoll_list list)
|
||||
{
|
||||
|
||||
if (jcoll_list_empty(list))
|
||||
return NULL;
|
||||
else if (jcoll_list_length(list) == 1)
|
||||
return jcoll_list_head(list);
|
||||
|
||||
else
|
||||
{
|
||||
int i = 0,
|
||||
length = jcoll_list_length(list) + 1;
|
||||
stamp sts[length];
|
||||
jcoll_join result;
|
||||
|
||||
jcoll_list_scanner scan;
|
||||
jcoll temp;
|
||||
|
||||
sts[i++] = j_join;
|
||||
|
||||
jcoll_list_scan(list,&scan);
|
||||
while (jcoll_list_next(&scan,&temp))
|
||||
{
|
||||
stamp st = temp ? temp->st : 0;
|
||||
sts[i++] = st;
|
||||
}
|
||||
qsort(&sts[1],length-1,sizeof(int),ptr_cmp);
|
||||
|
||||
if ( NULL == (result = (jcoll_join)term_hash_find(d->hash,sts,length)) )
|
||||
{
|
||||
result = ralloc(d->r,struct jcoll_join);
|
||||
|
||||
result->type = j_join;
|
||||
result->st = stamp_fresh();
|
||||
result->joins = list;
|
||||
result->cache = new_gen_e_list(d->r);
|
||||
term_hash_insert(d->hash,(gen_e)result,sts,length);
|
||||
}
|
||||
return (jcoll)result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Hash chains
|
||||
*/
|
||||
jcoll jcoll_create_chain(jcoll_dict d, gen_e_list elems)
|
||||
{
|
||||
int i = 0,
|
||||
length = gen_e_list_length(elems) + 1;
|
||||
stamp sts[length];
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
jcoll_chain result;
|
||||
|
||||
sts[i++] = j_chain;
|
||||
|
||||
gen_e_list_scan(elems,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
sts[i++] = d->get_stamp(temp);
|
||||
}
|
||||
qsort(&sts[1],length-1,sizeof(int),ptr_cmp); /* FIX, first pos should always be chain */
|
||||
|
||||
if ( NULL == (result = (jcoll_chain)term_hash_find(d->hash,sts,length)) )
|
||||
{
|
||||
result = ralloc(d->r,struct jcoll_chain);
|
||||
result->type = j_chain;
|
||||
result->st = stamp_fresh();
|
||||
result->entries = elems;
|
||||
term_hash_insert(d->hash,(gen_e)result,sts,
|
||||
length);
|
||||
}
|
||||
return (jcoll)result;
|
||||
}
|
||||
|
||||
typedef void (*japp_fn_ptr) (void *, void *);
|
||||
|
||||
static void app_aux(hash_set h, get_stamp_fn_ptr get_stamp, japp_fn_ptr app,
|
||||
jcoll j, void *data)
|
||||
{
|
||||
if (! j)
|
||||
return;
|
||||
|
||||
switch(j->type)
|
||||
{
|
||||
case j_single:
|
||||
{
|
||||
jcoll_single single = (jcoll_single) j;
|
||||
|
||||
if (! hs_member(h,get_stamp(single->entry)) )
|
||||
app(single->entry, data);
|
||||
}
|
||||
break;
|
||||
case j_chain:
|
||||
{
|
||||
jcoll_chain chain = (jcoll_chain) j;
|
||||
|
||||
if (! hs_member(h,chain->st) )
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e entry;
|
||||
|
||||
gen_e_list_scan(chain->entries, &scan);
|
||||
while (gen_e_list_next(&scan, &entry))
|
||||
{
|
||||
if (! hs_member(h, get_stamp(entry)) )
|
||||
app(entry, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case j_join:
|
||||
{
|
||||
jcoll_join join = (jcoll_join) j;
|
||||
|
||||
if (! hs_member(h, join->st))
|
||||
{
|
||||
if (! gen_e_list_empty(join->cache))
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e entry;
|
||||
|
||||
gen_e_list_scan(join->cache, &scan);
|
||||
while (gen_e_list_next(&scan, &entry))
|
||||
{
|
||||
if (! hs_member(h, get_stamp(entry)) )
|
||||
app(entry, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jcoll_list_scanner scan;
|
||||
jcoll temp;
|
||||
|
||||
jcoll_list_scan(join->joins, &scan);
|
||||
while (jcoll_list_next(&scan,&temp))
|
||||
{
|
||||
app_aux(h,get_stamp,app,temp, data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void jcoll_app(jcoll_dict d, japp_fn_ptr app, jcoll j, void *data) deletes
|
||||
{
|
||||
region scratch_rgn = newregion();
|
||||
hash_set hash = hs_create(scratch_rgn);
|
||||
app_aux(hash,d->get_stamp, app, j, data);
|
||||
hs_delete(hash);
|
||||
deleteregion(scratch_rgn);
|
||||
}
|
||||
static void jcoll_accum(void *e, void *accum)
|
||||
{
|
||||
gen_e_list_cons((gen_e) e, (gen_e_list) accum);
|
||||
}
|
||||
|
||||
gen_e_list jcoll_flatten(jcoll_dict d, jcoll j) deletes
|
||||
{
|
||||
|
||||
gen_e_list accum = NULL;
|
||||
|
||||
|
||||
if (j == NULL)
|
||||
return new_gen_e_list(d->r);
|
||||
|
||||
switch (j->type)
|
||||
{
|
||||
case j_single:
|
||||
{
|
||||
jcoll_single single = (jcoll_single)j;
|
||||
|
||||
accum = new_gen_e_list(d->r);
|
||||
gen_e_list_cons(single->entry,accum);
|
||||
}
|
||||
break;
|
||||
case j_chain:
|
||||
{
|
||||
jcoll_chain chain = (jcoll_chain)j;
|
||||
/* accum = gen_e_list_copy(r,chain->entries); */
|
||||
accum = chain->entries;
|
||||
}
|
||||
break;
|
||||
case j_join:
|
||||
{
|
||||
jcoll_join join = (jcoll_join)j;
|
||||
|
||||
if (! gen_e_list_empty(join->cache))
|
||||
return join->cache;
|
||||
else
|
||||
{
|
||||
accum = new_gen_e_list(d->r);
|
||||
jcoll_app(d, jcoll_accum,j, accum);
|
||||
|
||||
gen_e_list_append(join->cache,accum /* gen_e_list_copy(r,accum)*/);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return accum;
|
||||
}
|
||||
|
||||
jcoll_dict jcoll_create_dict(region r,get_stamp_fn_ptr get_stamp)
|
||||
{
|
||||
jcoll_dict result = ralloc(r,struct jcoll_dict);
|
||||
|
||||
result->r = r;
|
||||
result->hash = make_term_hash(r);
|
||||
result->get_stamp = get_stamp;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void jcoll_delete_dict(jcoll_dict d)
|
||||
{
|
||||
term_hash_delete(d->hash);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef JCOLLECTION_H
|
||||
#define JCOLLECTION_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct jcoll *jcoll;
|
||||
|
||||
typedef struct jcoll_dict *jcoll_dict;
|
||||
|
||||
DECLARE_LIST(jcoll_list,jcoll)
|
||||
|
||||
jcoll jcoll_new(jcoll_dict d, gen_e e);
|
||||
jcoll jcoll_jjoin(jcoll_dict d, jcoll_list list);
|
||||
gen_e_list jcoll_flatten(jcoll_dict d, jcoll j) deletes;
|
||||
jcoll jcoll_create_chain(jcoll_dict d, gen_e_list elems);
|
||||
|
||||
jcoll_dict jcoll_create_dict(region r,get_stamp_fn_ptr get_stamp);
|
||||
void jcoll_delete_dict(jcoll_dict d);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* JCOLLECTION_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LINKAGE_H
|
||||
#define LINKAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN_C extern "C"
|
||||
# define EXTERN_C_BEGIN extern "C" {
|
||||
# define EXTERN_C_END }
|
||||
#else
|
||||
# define EXTERN_C
|
||||
# define EXTERN_C_BEGIN
|
||||
# define EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,438 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "list.h"
|
||||
#include "util.h"
|
||||
|
||||
struct list_node
|
||||
{
|
||||
void *data;
|
||||
struct list_node *sameregion next;
|
||||
};
|
||||
|
||||
#define scan_node(b,var) for (var = b; var; var = var->next)
|
||||
|
||||
struct list
|
||||
{
|
||||
region sameregion r;
|
||||
int length;
|
||||
list_node sameregion head;
|
||||
};
|
||||
|
||||
struct list *new_list(region r)
|
||||
{
|
||||
struct list *result;
|
||||
|
||||
assert(r);
|
||||
|
||||
result = ralloc(r,struct list);
|
||||
result->r = r;
|
||||
result->length = 0;
|
||||
result->head = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int list_size(struct list *l)
|
||||
{
|
||||
return l->length;
|
||||
}
|
||||
|
||||
struct list *list_cons(void *data, struct list *l)
|
||||
{
|
||||
list_node newnode = ralloc(l->r, struct list_node);
|
||||
newnode->next = l->head;
|
||||
newnode->data = data;
|
||||
|
||||
l->head = newnode;
|
||||
l->length++;
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
struct list *list_reverse(struct list *l)
|
||||
{
|
||||
|
||||
if (list_empty(l))
|
||||
return l;
|
||||
|
||||
else
|
||||
{
|
||||
list_node temp,reversed = NULL;
|
||||
|
||||
while (l->head)
|
||||
{
|
||||
temp = l->head->next;
|
||||
|
||||
l->head->next = reversed;
|
||||
|
||||
reversed = l->head;
|
||||
|
||||
l->head = temp;
|
||||
}
|
||||
|
||||
l->head = reversed;
|
||||
return l;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool list_empty(struct list *l)
|
||||
{
|
||||
return (l->head == NULL);
|
||||
}
|
||||
|
||||
static inline list_node tail(list_node n)
|
||||
{
|
||||
if (n == NULL)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
list_node temp = NULL,
|
||||
tail = NULL;
|
||||
|
||||
scan_node(n,temp)
|
||||
tail = temp;
|
||||
|
||||
assert(tail && tail->next == NULL);
|
||||
|
||||
return tail;
|
||||
}
|
||||
}
|
||||
|
||||
struct list *list_append(struct list *a, struct list *b)
|
||||
{
|
||||
list_node tl;
|
||||
|
||||
assert( a && b );
|
||||
assert( a != b);
|
||||
assert( ptr_eq(a->r,b->r) );
|
||||
|
||||
tl = tail(a->head);
|
||||
|
||||
|
||||
if (! tl)
|
||||
{
|
||||
a->head = b->head;
|
||||
a->length = b->length;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
tl->next = b->head;
|
||||
a->length += b->length;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
struct list *list_app(struct list *l,app_fn app)
|
||||
{
|
||||
list_node n = NULL;
|
||||
|
||||
|
||||
assert(l);
|
||||
|
||||
scan_node(l->head,n)
|
||||
{
|
||||
app(n->data);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
void *list_find(struct list *l,eq_fn eq)
|
||||
{
|
||||
list_node n = NULL;
|
||||
assert(l);
|
||||
|
||||
scan_node(l->head,n)
|
||||
{
|
||||
if (eq(n->data))
|
||||
return n;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct list *list_tail(struct list *l)
|
||||
{
|
||||
l->length--;
|
||||
l->head = l->head->next;
|
||||
return l;
|
||||
}
|
||||
|
||||
void *list_head(struct list *l)
|
||||
{
|
||||
return l->head->data;
|
||||
}
|
||||
|
||||
struct list *list_filter(region r,struct list *l,eq_fn eq)
|
||||
{
|
||||
struct list *result;
|
||||
list_node n = NULL;
|
||||
assert(l);
|
||||
|
||||
result = new_list(r);
|
||||
|
||||
scan_node(l->head,n)
|
||||
{
|
||||
if (eq(n->data))
|
||||
list_cons(n->data,result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct list *list_keep(struct list *l, eq_fn eq)
|
||||
{
|
||||
list_node prev, n;
|
||||
assert(l);
|
||||
|
||||
while (l->head && !eq(l->head->data))
|
||||
{
|
||||
l->head = l->head->next;
|
||||
}
|
||||
|
||||
prev = l->head;
|
||||
scan_node(l->head->next,n)
|
||||
{
|
||||
if (!eq(n->data))
|
||||
prev->next = n->next;
|
||||
else prev = n;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
struct list *list_filter2(struct list *l,eq_fn eq)
|
||||
{
|
||||
return list_filter(l->r,l,eq);
|
||||
}
|
||||
|
||||
struct list *list_copy(region r, struct list *l)
|
||||
{
|
||||
|
||||
struct list *result;
|
||||
list_node n = NULL;
|
||||
#ifndef NDEBUG
|
||||
int count = 0;
|
||||
#endif
|
||||
assert(l);
|
||||
|
||||
result = new_list(r);
|
||||
|
||||
scan_node(l->head,n)
|
||||
{
|
||||
list_cons(n->data,result);
|
||||
assert(++count <= l->length);
|
||||
}
|
||||
|
||||
return list_reverse(result);
|
||||
}
|
||||
/* A Linked-List Memory Sort
|
||||
by Philip J. Erdelsky
|
||||
pje@acm.org
|
||||
http://www.alumni.caltech.edu/~pje/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void *sort_linked_list(void *p, unsigned index,
|
||||
int (*compare)(const void *,const void *, comparator_fn), long *pcount, comparator_fn data)
|
||||
{
|
||||
unsigned base;
|
||||
unsigned long block_size;
|
||||
|
||||
struct record
|
||||
{
|
||||
struct record *next[1];
|
||||
/* other members not directly accessed by this function */
|
||||
};
|
||||
|
||||
struct tape
|
||||
{
|
||||
struct record *first, *last;
|
||||
unsigned long count;
|
||||
} tape[4];
|
||||
|
||||
/* Distribute the records alternately to tape[0] and tape[1]. */
|
||||
|
||||
tape[0].count = tape[1].count = 0L;
|
||||
tape[0].first = NULL;
|
||||
base = 0;
|
||||
while (p != NULL)
|
||||
{
|
||||
struct record *next = ((struct record *)p)->next[index];
|
||||
((struct record *)p)->next[index] = tape[base].first;
|
||||
tape[base].first = ((struct record *)p);
|
||||
tape[base].count++;
|
||||
p = next;
|
||||
base ^= 1;
|
||||
}
|
||||
|
||||
/* If the list is empty or contains only a single record, then */
|
||||
/* tape[1].count == 0L and this part is vacuous. */
|
||||
|
||||
for (base = 0, block_size = 1L; tape[base+1].count != 0L;
|
||||
base ^= 2, block_size <<= 1)
|
||||
{
|
||||
int dest;
|
||||
struct tape *tape0, *tape1;
|
||||
tape0 = tape + base;
|
||||
tape1 = tape + base + 1;
|
||||
dest = base ^ 2;
|
||||
tape[dest].count = tape[dest+1].count = 0;
|
||||
for (; tape0->count != 0; dest ^= 1)
|
||||
{
|
||||
unsigned long n0, n1;
|
||||
struct tape *output_tape = tape + dest;
|
||||
n0 = n1 = block_size;
|
||||
while (1)
|
||||
{
|
||||
struct record *chosen_record;
|
||||
struct tape *chosen_tape;
|
||||
if (n0 == 0 || tape0->count == 0)
|
||||
{
|
||||
if (n1 == 0 || tape1->count == 0)
|
||||
break;
|
||||
chosen_tape = tape1;
|
||||
n1--;
|
||||
}
|
||||
else if (n1 == 0 || tape1->count == 0)
|
||||
{
|
||||
chosen_tape = tape0;
|
||||
n0--;
|
||||
}
|
||||
else if ((*compare)(tape0->first, tape1->first, data) > 0)
|
||||
{
|
||||
chosen_tape = tape1;
|
||||
n1--;
|
||||
}
|
||||
else
|
||||
{
|
||||
chosen_tape = tape0;
|
||||
n0--;
|
||||
}
|
||||
chosen_tape->count--;
|
||||
chosen_record = chosen_tape->first;
|
||||
chosen_tape->first = chosen_record->next[index];
|
||||
if (output_tape->count == 0)
|
||||
output_tape->first = chosen_record;
|
||||
else
|
||||
output_tape->last->next[index] = chosen_record;
|
||||
output_tape->last = chosen_record;
|
||||
output_tape->count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tape[base].count > 1L)
|
||||
tape[base].last->next[index] = NULL;
|
||||
if (pcount != NULL)
|
||||
*pcount = tape[base].count;
|
||||
return tape[base].first;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int compare(const void *node1, const void *node2, comparator_fn data)
|
||||
{
|
||||
comparator_fn cmp = (comparator_fn) data;
|
||||
return cmp(((struct list_node *)node1)->data,
|
||||
((struct list_node *)node2)->data);
|
||||
}
|
||||
|
||||
struct list *list_sort(struct list *l, comparator_fn cmp)
|
||||
{
|
||||
long pcount;
|
||||
l->head = sort_linked_list(l->head,1,compare,&pcount, cmp);
|
||||
assert(pcount == l->length);
|
||||
return l;
|
||||
}
|
||||
|
||||
struct list *list_merge(struct list *a,struct list *b, comparator_fn cmp)
|
||||
{
|
||||
return list_sort( list_append(a,b),cmp);
|
||||
}
|
||||
|
||||
void list_scan(struct list *a,struct list_scanner *scan)
|
||||
{
|
||||
scan->l = a;
|
||||
scan->cur = a->head;
|
||||
}
|
||||
|
||||
bool list_next(struct list_scanner *scan, void **data)
|
||||
{
|
||||
if (!scan->cur)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
if (data)
|
||||
*data = scan->cur->data;
|
||||
scan->cur = scan->cur->next;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void list_clear(struct list *l)
|
||||
{
|
||||
l->head = NULL;
|
||||
l->length = 0;
|
||||
}
|
||||
|
||||
bool list_member(struct list *l,void *data)
|
||||
{
|
||||
list_node n = NULL;
|
||||
scan_node(l->head,n)
|
||||
{
|
||||
if (n->data == data)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
struct list *list_from_array(region r,void **data, int length)
|
||||
{
|
||||
struct list *result = new_list(r);
|
||||
int i;
|
||||
|
||||
for (i = length -1; i >= 0; i--)
|
||||
{
|
||||
list_cons(data[i],result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIST_H
|
||||
#define LIST_H
|
||||
|
||||
#include <regions.h>
|
||||
#include "bool.h"
|
||||
|
||||
typedef void *list_data;
|
||||
typedef void (*app_fn) (void *);
|
||||
typedef bool (*eq_fn)(const void *);
|
||||
typedef int (*comparator_fn)(const void *,const void *);
|
||||
|
||||
struct list;
|
||||
|
||||
typedef struct list_node *list_node;
|
||||
|
||||
struct list_scanner
|
||||
{
|
||||
struct list *l;
|
||||
list_node cur;
|
||||
}; /* Opaque type. Do not modify fields */
|
||||
|
||||
|
||||
struct list *new_list(region r);
|
||||
int list_size(struct list *a);
|
||||
struct list *list_cons(void *data, struct list *a);
|
||||
struct list *list_append(struct list *a, struct list *b);
|
||||
struct list *list_app(struct list *a,app_fn app);
|
||||
void *list_find(struct list *a,eq_fn eq);
|
||||
void *list_head(struct list *a);
|
||||
struct list *list_tail(struct list *a);
|
||||
struct list *list_filter(region r,struct list *a,eq_fn eq);
|
||||
struct list *list_filter2(struct list *a,eq_fn eq);
|
||||
struct list *list_keep(struct list *a,eq_fn eq);
|
||||
struct list *list_copy(region r, struct list *a);
|
||||
struct list *list_sort(struct list *a, comparator_fn cmp);
|
||||
struct list *list_merge(struct list *a,struct list *b, comparator_fn cmp);
|
||||
void list_scan(struct list *a,struct list_scanner *scan);
|
||||
bool list_next(struct list_scanner *scan, void **data);
|
||||
bool list_empty(struct list *a);
|
||||
bool list_member(struct list *a, void *data);
|
||||
void list_clear(struct list *a);
|
||||
struct list *list_reverse(struct list *a);
|
||||
struct list *list_from_array(region r,void **data, int length);
|
||||
|
||||
#define DECLARE_OPAQUE_LIST(name,type) \
|
||||
typedef struct list_scanner name ## _scanner; \
|
||||
typedef void (* name ## _app_fn) (type); \
|
||||
typedef bool (* name ## _eq_fn) (const type); \
|
||||
typedef int (* name ## _comparator_fn)(const type,const type); \
|
||||
name new_ ## name(region r); \
|
||||
int name ## _length(name a); \
|
||||
name name ## _cons(type data, name a); \
|
||||
name name ## _append(name a, name b); \
|
||||
name name ## _app(name a, name ## _app_fn app); \
|
||||
type name ## _find(name a, name ## _eq_fn eq); \
|
||||
type name ## _head(name a); \
|
||||
name name ## _tail(name a); \
|
||||
name name ## _filter(region r,name a, name ## _eq_fn eq); \
|
||||
name name ## _filter2(name a, name ## _eq_fn eq); \
|
||||
name name ## _keep(name a, name ## _eq_fn eq); \
|
||||
name name ## _copy(region r, name a); \
|
||||
name name ## _sort(name a, name ## _comparator_fn cmp); \
|
||||
name name ## _merge(name a,name b, name ## _comparator_fn cmp); \
|
||||
void name ## _scan(name a, name ##_scanner *scan); \
|
||||
bool name ## _next(name ##_scanner *scan, type *data); \
|
||||
bool name ## _empty(name a); \
|
||||
void name ## _clear(name a); \
|
||||
bool name ## _member(name a, type data); \
|
||||
name name ## _reverse(name a); \
|
||||
name name ## _from_array(region r,type data[], int length);
|
||||
|
||||
#define DECLARE_LIST(name,type) \
|
||||
typedef struct name ## _a *name; \
|
||||
typedef struct list_scanner name ## _scanner; \
|
||||
typedef void (* name ## _app_fn) (type); \
|
||||
typedef bool (* name ## _eq_fn) (const type); \
|
||||
typedef int (* name ## _comparator_fn)(const type,const type); \
|
||||
name new_ ## name(region r); \
|
||||
int name ## _length(name a); \
|
||||
name name ## _cons(type data, name a); \
|
||||
name name ## _append(name a, name b); \
|
||||
name name ## _app(name a, name ## _app_fn app); \
|
||||
type name ## _find(name a, name ## _eq_fn eq); \
|
||||
type name ## _head(name a); \
|
||||
name name ## _tail(name a); \
|
||||
name name ## _filter(region r,name a, name ## _eq_fn eq); \
|
||||
name name ## _filter2(name a, name ## _eq_fn eq); \
|
||||
name name ## _keep(name a, name ## _eq_fn eq); \
|
||||
name name ## _copy(region r, name a); \
|
||||
name name ## _sort(name a, name ## _comparator_fn cmp); \
|
||||
name name ## _merge(name a,name b, name ## _comparator_fn cmp); \
|
||||
void name ## _scan(name a, name ##_scanner *scan); \
|
||||
bool name ## _next(name ##_scanner *scan, type *data); \
|
||||
bool name ## _empty(name a); \
|
||||
void name ## _clear(name a); \
|
||||
bool name ## _member(name a, type data); \
|
||||
name name ## _reverse(name a); \
|
||||
name name ## _from_array(region r,type data[], int length);
|
||||
|
||||
#define DEFINE_LIST(name,type) \
|
||||
name new_ ## name(region r) \
|
||||
{ \
|
||||
return (name)new_list(r); \
|
||||
} \
|
||||
int name ## _length(name a) \
|
||||
{ \
|
||||
return list_size((struct list *)a); \
|
||||
} \
|
||||
name name ## _cons(type data, name a) \
|
||||
{ \
|
||||
return (name)list_cons((void *)data,(struct list *) a ); \
|
||||
}\
|
||||
name name ## _append(name a, name b) \
|
||||
{ \
|
||||
return (name)list_append((struct list *)a,(struct list *)b); \
|
||||
} \
|
||||
name name ## _app(name a, name ## _app_fn app) \
|
||||
{ \
|
||||
return (name)list_app((struct list *) a, (app_fn) app); \
|
||||
} \
|
||||
type name ## _find(name a, name ## _eq_fn eq) \
|
||||
{ \
|
||||
return (type)list_find((struct list *)a, (eq_fn) eq); \
|
||||
} \
|
||||
name name ## _tail(name a) \
|
||||
{\
|
||||
return (name)list_tail((struct list *)a);\
|
||||
}\
|
||||
type name ## _head(name a) \
|
||||
{ \
|
||||
return (type)list_head((struct list *)a); \
|
||||
} \
|
||||
name name ## _filter(region r,name a, name ## _eq_fn eq) \
|
||||
{ \
|
||||
return (name)list_filter(r,(struct list *)a, (eq_fn) eq); \
|
||||
} \
|
||||
name name ## _keep(name a, name ## _eq_fn eq) \
|
||||
{ \
|
||||
return (name)list_keep((struct list *)a, (eq_fn) eq); \
|
||||
} \
|
||||
name name ## _filter2(name a, name ## _eq_fn eq) \
|
||||
{ \
|
||||
return (name)list_filter2((struct list *)a, (eq_fn) eq); \
|
||||
} \
|
||||
name name ## _copy(region r, name a) \
|
||||
{ \
|
||||
return (name)list_copy(r,(struct list *) a); \
|
||||
} \
|
||||
name name ## _sort(name a, name ## _comparator_fn cmp) \
|
||||
{ \
|
||||
return (name)list_sort((struct list *)a,(comparator_fn) cmp); \
|
||||
} \
|
||||
name name ## _merge(name a,name b, name ## _comparator_fn cmp) \
|
||||
{ \
|
||||
return (name)list_merge((struct list *)a,(struct list *)b,(comparator_fn)cmp); \
|
||||
} \
|
||||
void name ## _scan(name a, name ##_scanner *scan) \
|
||||
{ \
|
||||
list_scan((struct list *)a,(struct list_scanner *)scan);\
|
||||
}\
|
||||
bool name ## _next(name ##_scanner *scan, type *data) \
|
||||
{ \
|
||||
return list_next((struct list_scanner *)scan, (void **)data); \
|
||||
} \
|
||||
bool name ## _empty(name a) \
|
||||
{ \
|
||||
return list_empty((struct list *)a); \
|
||||
} \
|
||||
void name ## _clear(name a) \
|
||||
{ \
|
||||
list_clear((struct list *)a); \
|
||||
} \
|
||||
bool name ## _member(name a, type data) \
|
||||
{ \
|
||||
return list_member((struct list *)a,(void *)data); \
|
||||
} \
|
||||
name name ## _reverse(name a) \
|
||||
{\
|
||||
return (name)list_reverse((struct list *)a);\
|
||||
}\
|
||||
name name ## _from_array(region r,type data[], int length) \
|
||||
{\
|
||||
return (name)list_from_array(r,(void **)data,length); \
|
||||
}\
|
||||
|
||||
#endif /* LIST_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,852 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "banshee.h"
|
||||
#include "flowrow-sort.h"
|
||||
#include "flowrow-var.h"
|
||||
#include "setif-sort.h"
|
||||
#include "setif-var.h"
|
||||
#include "setst-sort.h"
|
||||
#include "setst-var.h"
|
||||
#include "term-sort.h"
|
||||
#include "term-var.h"
|
||||
|
||||
struct constructor
|
||||
{
|
||||
sort_kind sort;
|
||||
int type;
|
||||
int arity;
|
||||
char *name;
|
||||
sig_elt *sig;
|
||||
};
|
||||
|
||||
typedef struct constructor *constructor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
vnc_pos,
|
||||
vnc_neg,
|
||||
vnc_non
|
||||
} vnc_kind;
|
||||
|
||||
struct sig_elt
|
||||
{
|
||||
vnc_kind variance;
|
||||
sort_kind sort;
|
||||
};
|
||||
|
||||
typedef struct sig_elt sig_elt;
|
||||
|
||||
typedef struct proj_pat
|
||||
{
|
||||
sort_kind sort;
|
||||
int type;
|
||||
stamp st;
|
||||
int i;
|
||||
gen_e exp;
|
||||
vnc_kind variance;
|
||||
constructor c;
|
||||
} *proj_pat;
|
||||
|
||||
|
||||
typedef struct cons_expr
|
||||
{
|
||||
sort_kind sort;
|
||||
int type;
|
||||
stamp st;
|
||||
int arity;
|
||||
char *name;
|
||||
sig_elt *sig;
|
||||
gen_e *exps;
|
||||
} * cons_expr;
|
||||
|
||||
|
||||
static int new_type()
|
||||
{
|
||||
static int type = 10;
|
||||
int ret = type;
|
||||
if (type > 2000)
|
||||
{
|
||||
fprintf(stderr, "Exceeded maximum number of constructors\n");
|
||||
assert(0);
|
||||
}
|
||||
type += 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool fixed_sort(sort_kind s)
|
||||
{
|
||||
return !(s == sort_term || s == sort_set);
|
||||
}
|
||||
|
||||
/*
|
||||
Convention : constructor types are even, pats are odd.
|
||||
The smallest specialized type is 10.
|
||||
*/
|
||||
static bool setif_is_pat(gen_e e)
|
||||
{
|
||||
int type = ((setif_term)e)->type;
|
||||
return ( (type & 1) && (type > 10) );
|
||||
}
|
||||
|
||||
static bool setst_is_pat(gen_e e)
|
||||
{
|
||||
int type = ((setst_term)e)->type;
|
||||
return ( (type & 1) && (type > 10) );
|
||||
}
|
||||
|
||||
static gen_e get_proj_var(sort_kind s, bool large)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case setif_sort:
|
||||
{
|
||||
if (large)
|
||||
return (gen_e)sv_fresh_large(get_sort_region(setif_sort),NULL);
|
||||
else return (gen_e)sv_fresh(get_sort_region(setif_sort),NULL);
|
||||
}
|
||||
break;
|
||||
case setst_sort:
|
||||
{
|
||||
if (large)
|
||||
return (gen_e)st_fresh_large(get_sort_region(setst_sort),NULL);
|
||||
else return (gen_e)st_fresh(get_sort_region(setst_sort),NULL);
|
||||
}
|
||||
break;
|
||||
case flowrow_sort:
|
||||
{
|
||||
if (large)
|
||||
return (gen_e)fv_fresh_large(get_sort_region(flowrow_sort),NULL);
|
||||
else return (gen_e)fv_fresh(get_sort_region(flowrow_sort),NULL);
|
||||
}
|
||||
break;
|
||||
case term_sort:
|
||||
{
|
||||
if (large)
|
||||
return (gen_e)tv_fresh_large(get_sort_region(term_sort),NULL);
|
||||
else return (gen_e)tv_fresh(get_sort_region(term_sort),NULL)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
fail("Unmatched sort in get_proj_var\n");
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gen_e get_sort_zero(sort_kind s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case setif_sort:
|
||||
return setif_zero();
|
||||
case setst_sort:
|
||||
return setst_zero();
|
||||
case flowrow_sort:
|
||||
return flowrow_zero();
|
||||
case term_sort:
|
||||
return term_zero();
|
||||
default:
|
||||
fail("Unmatched sort in get_sort_zero\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gen_e get_sort_one(sort_kind s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case setif_sort:
|
||||
return setif_one();
|
||||
case setst_sort:
|
||||
return setst_one();
|
||||
case flowrow_sort:
|
||||
return flowrow_one();
|
||||
case term_sort:
|
||||
return term_one();
|
||||
default:
|
||||
fail("Unmatched sort in get_sort_zero\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static region get_sort_region(sort s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case setif_sort:
|
||||
return setif_region;
|
||||
case setst_sort:
|
||||
return setst_region;
|
||||
case flowrow_sort:
|
||||
return flowrow_region;
|
||||
case term_sort:
|
||||
return term_region:
|
||||
default:
|
||||
fail("Unmatched sort in get_sort_region\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static term_hash get_sort_hash(sort s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case setif_sort:
|
||||
return setif_hash;
|
||||
case setst_sort:
|
||||
return setst_hash;
|
||||
case flowrow_sort:
|
||||
return flowrow_hash;
|
||||
case term_sort:
|
||||
return term_hash:
|
||||
default:
|
||||
fail("Unmatched sort in get_sort_hash\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
constructor make_constructor(const char *name,sort_kind sort, sig_elt s[],
|
||||
int arity)
|
||||
{
|
||||
constructor c = ralloc(expr_region,struct constructor);
|
||||
sig_elt *sig = rarrayalloc(expr_region,arity,sig_elt);
|
||||
|
||||
c->type = new_type();
|
||||
|
||||
if (arity)
|
||||
{
|
||||
memcpy(sig,s,sizeof(sig_elt)*arity);
|
||||
}
|
||||
|
||||
if ( fixed_sort(sort) )
|
||||
failure("Specified sort does not allow constructor types\n");
|
||||
|
||||
c->sort = sort;
|
||||
c->arity = arity;
|
||||
c->name = rstrdup(expr_region,name);
|
||||
c->sig = sig;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
gen_e constructor_expr(constructor c, gen_e exps[], int arity)
|
||||
{
|
||||
cons_expr result;
|
||||
int i;
|
||||
region sort_region = get_sort_region(c->sort);
|
||||
term_hash sort_hash = get_sort_hash(c->sort);
|
||||
|
||||
stamp *st = rarrayalloc(sort_region,arity + 1,stamp);
|
||||
st[0] = c->type;
|
||||
|
||||
// Dynamic arity check
|
||||
if(arity != c->arity)
|
||||
failure("Signature mismatch\n");
|
||||
|
||||
// Dynamic sort checks
|
||||
for (i = 0; i < arity; i++)
|
||||
{
|
||||
if ( c->sig[i].sort != exps[i]->sort)
|
||||
failure(stderr,"Signature mismatch\n");
|
||||
st[i+1] = exps[i]->st;
|
||||
}
|
||||
|
||||
// Hash-consing of terms
|
||||
if (!(result = term_hash_find(sort_hash,st,arity+1)) || arity == 0 )
|
||||
{
|
||||
gen_e *e = rarrayalloc(sort_region,arity,gen_e);
|
||||
|
||||
if (arity)
|
||||
memcpy(e,exps,sizeof(gen_e)*arity);
|
||||
else
|
||||
e = NULL;
|
||||
|
||||
result = ralloc(sort_region,struct cons_expr);
|
||||
result->type = st[0];
|
||||
result->st = stamp_fresh();
|
||||
result->sort = c->sort;
|
||||
result->arity = c->arity;
|
||||
result->name = c->name;
|
||||
result->sig = c->sig;
|
||||
result->exps = e;
|
||||
|
||||
term_hash_insert(expr_hash,result,st,arity+1);
|
||||
}
|
||||
|
||||
return (gen_e)result;
|
||||
}
|
||||
|
||||
static gen_e proj_pat(constructor c, int i, gen_e e)
|
||||
{
|
||||
proj_pat pat;
|
||||
region sort_region = get_sort_region(e->sort);
|
||||
term_hash sort_hash = get_sort_hash(e->sort);
|
||||
|
||||
stamp s[3];
|
||||
s[0] = c->type + 1;
|
||||
s[1] = e->st;
|
||||
s[2] = i;
|
||||
|
||||
if (! (pat = term_hash_find(sort_hash,s,3)) )
|
||||
{
|
||||
pat = ralloc(sort_region,struct proj_pat);
|
||||
pat->type = s[0];
|
||||
pat->st = stamp_fresh();
|
||||
pat->sort = c->sort;
|
||||
pat->exp = e;
|
||||
pat->variance = c->sig[i].variance;
|
||||
pat->c = c;
|
||||
pat->i = i;
|
||||
term_hash_insert(sort_hash,pat,s,3);
|
||||
}
|
||||
|
||||
return (gen_e)pat;
|
||||
}
|
||||
|
||||
gen_e setif_proj_pat(constructor c,int i,gen_e e)
|
||||
{
|
||||
return proj_pat(c,i,e);
|
||||
}
|
||||
|
||||
gen_e setst_proj_pat(constructor c, int i, gen_e e)
|
||||
{
|
||||
return proj_pat(c,i,e);
|
||||
}
|
||||
|
||||
gen_e setif_proj(constructor c, int i, gen_e e)
|
||||
{
|
||||
setif_var v;
|
||||
gen_e proj_var, proj;
|
||||
|
||||
gen_e nonspec_get_proj(gen_e_list arg1)
|
||||
{
|
||||
proj_pat pat;
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
|
||||
gen_e_list_scan(arg1,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
pat = (proj_pat)temp;
|
||||
if ( pat_match(pat->type,c->type) && i == pat->i )
|
||||
return pat->exp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (e->sort != setif_sort)
|
||||
{
|
||||
failure("Sort check : setif_proj\n");
|
||||
}
|
||||
|
||||
else if (i < 0 || i > c->arity)
|
||||
{
|
||||
failure("Signature mismatch\n");
|
||||
}
|
||||
|
||||
else if (setif_is_zero(e))
|
||||
return get_sort_zero(c->sig[i].sort);
|
||||
|
||||
else if ( ((setif_term)e)->type == c->type )
|
||||
{
|
||||
cons_expr constructed = (cons_expr)e;
|
||||
return constructed->exps[i];
|
||||
}
|
||||
|
||||
else if (setif_is_var(e))
|
||||
{
|
||||
v = (setif_var)e;
|
||||
if ( (proj = sv_get_ub_proj(v,nonspec_get_proj)) )
|
||||
{
|
||||
return proj;
|
||||
}
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
gen_e_list_scanner scan;
|
||||
gen_e lb;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setif_proj_pat(c,i,proj_var);
|
||||
sv_add_ub_proj(sort_region,v,pat);
|
||||
|
||||
gen_e_list_scan(sv_get_lbs(v),&scan);
|
||||
while (gen_e_list_next(&scan,&lb))
|
||||
{
|
||||
setif_inclusion(lb,pat);
|
||||
}
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
|
||||
else if (setif_is_union(e))
|
||||
{
|
||||
if( (proj = nonspec_get_proj(setif_get_proj_cache(e))) )
|
||||
return proj;
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setif_proj_pat(c,i,proj_var);
|
||||
|
||||
setif_set_proj_cache(e,pat);
|
||||
|
||||
setif_inclusion(e,pat);
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setif_proj_pat(c,i,proj_var);
|
||||
setif_inclusion(e,pat);
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
|
||||
gen_e setst_proj(constructor c, int i, gen_e e)
|
||||
{
|
||||
setst_var v;
|
||||
gen_e proj_var, proj;
|
||||
|
||||
gen_e nonspec_get_proj(gen_e_list arg1)
|
||||
{
|
||||
proj_pat pat;
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
|
||||
gen_e_list_scan(arg1,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
pat = (proj_pat)temp;
|
||||
if ( pat_match(pat->type,c->type) && i == pat->i )
|
||||
return pat->exp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (e->sort != setst_sort)
|
||||
{
|
||||
failure("Sort check : setst_proj\n");
|
||||
}
|
||||
|
||||
else if (i < 0 || i > c->arity)
|
||||
{
|
||||
failure("Signature mismatch\n");
|
||||
}
|
||||
|
||||
else if (setst_is_zero(e))
|
||||
return get_sort_zero(c->sig[i].sort);
|
||||
|
||||
else if ( ((setst_term)e)->type == c->type )
|
||||
{
|
||||
cons_expr constructed = (cons_expr)e;
|
||||
return constructed->exps[i];
|
||||
}
|
||||
|
||||
else if (setst_is_var(e))
|
||||
{
|
||||
v = (setst_var)e;
|
||||
if ( (proj = sv_get_ub_proj(v,nonspec_get_proj)) )
|
||||
{
|
||||
return proj;
|
||||
}
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
gen_e_list_scanner scan;
|
||||
gen_e lb;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setst_proj_pat(c,i,proj_var);
|
||||
sv_add_ub_proj(sort_region,v,pat);
|
||||
|
||||
gen_e_list_scan(sv_get_lbs(v),&scan);
|
||||
while (gen_e_list_next(&scan,&lb))
|
||||
{
|
||||
setst_inclusion(lb,pat);
|
||||
}
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
|
||||
else if (setst_is_union(e))
|
||||
{
|
||||
if( (proj = nonspec_get_proj(setst_get_proj_cache(e))) )
|
||||
return proj;
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setst_proj_pat(c,i,proj_var);
|
||||
|
||||
setst_set_proj_cache(e,pat);
|
||||
|
||||
setst_inclusion(e,pat);
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gen_e pat;
|
||||
proj_var = get_proj_var(c->sig[i].sort,FALSE);
|
||||
pat = setst_proj_pat(c,i,proj_var);
|
||||
setst_inclusion(e,pat);
|
||||
return proj_var;
|
||||
}
|
||||
}
|
||||
|
||||
static void setif_con_match(gen_e e1, gen_e e2)
|
||||
{
|
||||
// Case where e1 is a constructor expression and e2 is a proj_pat
|
||||
if (pat_match(((setif_term)e2)->type,((setif_term)e1)->type))
|
||||
{
|
||||
cons_expr c = (cons_expr)e1;
|
||||
proj_pat p = (proj_pat)e2;
|
||||
int i = p->i;
|
||||
|
||||
if (c->sig[i].variance == vnc_pos)
|
||||
call_inclusion_fn(c->exps[i],p->exp);
|
||||
else if (c->sig[i].variance == vnc_neg)
|
||||
call_inclusion_fn(p->exp,c->exps[i]);
|
||||
else
|
||||
call_unify_fn(c->exps[i],p->exp);
|
||||
}
|
||||
else if (setif_is_pat(e2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Case where e1 and e2 are constructor expressions
|
||||
else
|
||||
{
|
||||
cons_expr c1 = (cons_expr)e1,
|
||||
c2 = (cons_expr)e2;
|
||||
|
||||
if (c1->type != c2->type)
|
||||
failure("Constructor mismatch\n");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < c1->arity; i++)
|
||||
{
|
||||
if (c1->sig[i].variance == vnc_pos)
|
||||
call_inclusion_fn(e1,e2);
|
||||
else if (c1->sig[i].variance == vnc_neg)
|
||||
call_inclusion_fn(e2,e1);
|
||||
else
|
||||
call_unify_fn(e1,e2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void setst_con_match(gen_e e1, gen_e e2)
|
||||
{
|
||||
// Case where e1 is a constructor expression and e2 is a proj_pat
|
||||
if (pat_match(((setst_term)e2)->type,((setst_term)e1)->type))
|
||||
{
|
||||
cons_expr c = (cons_expr)e1;
|
||||
proj_pat p = (proj_pat)e2;
|
||||
int i = p->i;
|
||||
|
||||
if (c->sig[i].variance == vnc_pos)
|
||||
call_inclusion_fn(c->exps[i],p->exp);
|
||||
else if (c->sig[i].variance == vnc_neg)
|
||||
call_inclusion_fn(p->exp,c->exps[i]);
|
||||
else
|
||||
call_unify_fn(c->exps[i],p->exp);
|
||||
}
|
||||
else if (setst_is_pat(e2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Case where e1 and e2 are constructor expressions
|
||||
else
|
||||
{
|
||||
cons_expr c1 = (cons_expr)e1,
|
||||
c2 = (cons_expr)e2;
|
||||
|
||||
if (c1->type != c2->type)
|
||||
failure("Constructor mismatch\n");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < c1->arity; i++)
|
||||
{
|
||||
if (c1->sig[i].variance == vnc_pos)
|
||||
call_inclusion_fn(e1,e2);
|
||||
else if (c1->sig[i].variance == vnc_neg)
|
||||
call_inclusion_fn(e2,e1);
|
||||
else
|
||||
call_unify_fn(e1,e2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// given x <= proj(c,i,e)
|
||||
// proj_merge(region,e,get_proj_i_arg,fresh_large_fn_ptr,
|
||||
// sort_inclusion_fn_ptr,set_inclusion)
|
||||
static bool nonspec_res_proj(set_var v1,gen_e e2)
|
||||
{
|
||||
proj_pat projection_pat = (proj_pat)e2;
|
||||
|
||||
gen_e setif_get_proj(gen_e_list arg1)
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
proj_pat pat;
|
||||
|
||||
gen_e_list_scan(arg1,&scan);
|
||||
while(gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
pat = (proj_pat)temp;
|
||||
if ( pat->type == ((setif_term)e2)->type &&
|
||||
pat->i == ((proj_pat)e2)->i)
|
||||
return pat->exp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gen_e fresh_large(void)
|
||||
{
|
||||
return get_proj_var( ((proj_pat)e2)->exp->sort,TRUE);
|
||||
}
|
||||
|
||||
bool sort_inclusion(gen_e e1, gen_e e2)
|
||||
{
|
||||
if ( projection_pat->variance == vnc_pos )
|
||||
return call_inclusion_fn(e1,e2);
|
||||
else if ( projection_pat->variance == vnc_neg)
|
||||
return call_inclusion_fn(e2,e1);
|
||||
else
|
||||
return call_unify_fn(e1,e2);
|
||||
}
|
||||
|
||||
gen_e proj_con(gen_e e)
|
||||
{
|
||||
return make_proj_pat( ((proj_pat)e2)->c, ((proj_pat)e2)->i,e);
|
||||
}
|
||||
|
||||
return setif_proj_merge(setif_region,v1,((proj_pat)e2)->exp,
|
||||
setif_get_proj,proj_con,
|
||||
fresh_large,sort_inclusion,
|
||||
call_setif_inclusion);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void call_setif_inclusion(gen_e e1,gen_e e2)
|
||||
{
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e1,e2);
|
||||
}
|
||||
|
||||
void call_setif_unify(gen_e e1, gen_e e2)
|
||||
{
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e1,e2);
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e2,e1);
|
||||
}
|
||||
|
||||
void call_setst_inclusion(gen_e e1, gen_e e2)
|
||||
{
|
||||
setst_inclusion(setst_con_match,e1,e2);
|
||||
}
|
||||
|
||||
void call_setst_unify(gen_e e1, gen_e e2)
|
||||
{
|
||||
setst_inclusion(setst_con_match,e1,e2);
|
||||
setst_inclusion(setst_con_match,e2,e1);
|
||||
}
|
||||
|
||||
void call_flowrow_inclusion(gen_e e1,gen_e e2)
|
||||
{
|
||||
|
||||
if ( (e1->sort != flowrow_sort) || (e2->sort != flowrow_sort) )
|
||||
failure("Constraint system is not well-sorted\n");
|
||||
|
||||
if ( flowrow_base_sort(e1) != flowrow_base_sert(e2))
|
||||
failure("Constraint system is not well-sorted\n");
|
||||
|
||||
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e1,e2);
|
||||
}
|
||||
|
||||
void call_flowrow_unify(gen_e e1, gen_e e2)
|
||||
{
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e1,e2);
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e2,e1);
|
||||
}
|
||||
|
||||
static void term_con_match(gen_e e1, gen_e e2)
|
||||
{
|
||||
cons_expr c1 = (cons_expr)e1,
|
||||
c2 = (cons_expr)e2;
|
||||
|
||||
if (c1->type != c2->type)
|
||||
failure("Constructor mismatch\n");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < c1->arity; i++)
|
||||
{
|
||||
call_unify_fn(e1,e2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void term_occurs(term_var v, gen_e e)
|
||||
{
|
||||
gen_e ecr = term_get_ecr(e);
|
||||
|
||||
if (((gen_term)ecr)->type == VAR_TYPE)
|
||||
return ( term_get_stamp((gen_e)v) == term_get_stamp(e) );
|
||||
|
||||
else if (((gen_term)ecr)->type >= 10)
|
||||
{
|
||||
cons_expr c_e = (cons_expr) e;
|
||||
int i;
|
||||
for (int i = 0; i < arity; i++)
|
||||
{
|
||||
if (term_occurs(v,c->exps[i]))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void call_term_unify(gen_e e1, gen_e e2)
|
||||
{
|
||||
term_unify(term_con_match,term_occurs,e1,e2);
|
||||
}
|
||||
|
||||
void call_term_cunify(gen_e e1, gen_e e2)
|
||||
{
|
||||
term_cunify(term_con_match,term_occurs,e1,e2);
|
||||
}
|
||||
|
||||
|
||||
static void call_inclusion_fn(gen_e e1, gen_e e2)
|
||||
{
|
||||
switch (e1->sort)
|
||||
{
|
||||
case sort_setif:
|
||||
{
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e1,e2);
|
||||
}
|
||||
break;
|
||||
case sort_setst:
|
||||
{
|
||||
setst_inclusion(setst_con_match,e1,e2);
|
||||
}
|
||||
break;
|
||||
case sort_term:
|
||||
{
|
||||
term_unify(term_con_match,term_occurs,e1,e2);
|
||||
}
|
||||
break;
|
||||
case sort_row:
|
||||
{
|
||||
/* TODO */
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e1,e2);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
fail("Unmatched sort in call inclusion\n");
|
||||
}
|
||||
}
|
||||
|
||||
static bool call_unify_fn(gen_e e1, gen_e e2)
|
||||
{
|
||||
|
||||
switch (e1->sort)
|
||||
{
|
||||
case sort_setif:
|
||||
{
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e1,e2);
|
||||
setif_inclusion(setif_con_match,setif_res_proj,e2,e1);
|
||||
}
|
||||
break;
|
||||
case sort_setst:
|
||||
{
|
||||
setst_inclusion(setst_con_match,e1,e2);
|
||||
setst_inclusion(setst_con_match,e2,e1);
|
||||
}
|
||||
break;
|
||||
case sort_term:
|
||||
{
|
||||
term_unify(term_con_match,term_occurs,e1,e2);
|
||||
}
|
||||
break;
|
||||
case sort_row:
|
||||
{
|
||||
/* TODO */
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e1,e2);
|
||||
flowrow_inclusion(fresh,get_stamp,field_incl,zero_elem,e2,e1);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
fail("Unmatched sort in call inclusion\n");
|
||||
}
|
||||
}
|
||||
|
||||
void nonspec_init(void)
|
||||
{
|
||||
banshee_init();
|
||||
setif_init();
|
||||
setst_init();
|
||||
flowrow_init();
|
||||
}
|
||||
|
||||
void nonspec_reset(void)
|
||||
{
|
||||
flowrow_reset();
|
||||
setst_reset();
|
||||
setif_reset();
|
||||
banshee_reset();
|
||||
}
|
||||
|
||||
void expr_print(FILE *f,gen_e e)
|
||||
{
|
||||
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NONSPEC_H
|
||||
#define NONSPEC_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef enum
|
||||
{
|
||||
vnc_pos,
|
||||
vnc_neg,
|
||||
vnc_non
|
||||
} vnc_kind;
|
||||
|
||||
struct sig_elt
|
||||
{
|
||||
vnc_kind variance;
|
||||
sort_kind sort;
|
||||
};
|
||||
|
||||
typedef struct sig_elt sig_elt;
|
||||
typedef struct constructor *constructor;
|
||||
|
||||
struct flowrow_field
|
||||
{
|
||||
char *label;
|
||||
gen_e expr;
|
||||
};
|
||||
|
||||
DECLARE_LIST(flowrow_map,flowrow_field)
|
||||
|
||||
/*
|
||||
Flags
|
||||
*/
|
||||
extern bool flag_merge_projections;
|
||||
extern bool flag_eliminate_cycles;
|
||||
extern bool flag_occurs_check;
|
||||
|
||||
/*
|
||||
Operations for building terms
|
||||
*/
|
||||
|
||||
/* Defines a new constructor for sort s with the given signature */
|
||||
constructor make_constructor(const char *name,sort_kind sort, sig_elt[],
|
||||
int arity);
|
||||
|
||||
/* Build the term c(exps[0]....exps[n]) */
|
||||
gen_e constructor_expr(constructor c, gen_e exps[], int arity);
|
||||
|
||||
/* make a constant of sort s */
|
||||
gen_e setif_constant(const char *name);
|
||||
|
||||
gen_e setst_constant(const char *name);
|
||||
|
||||
gen_e term_constant(const char *name);
|
||||
|
||||
/* Creates a projection pattern projpat(c,i,e) */
|
||||
gen_e setif_proj_pat(constructor c,int i,gen_e e);
|
||||
|
||||
gen_e setst_proj_pat(constructor c, int i, gen_e e);
|
||||
|
||||
/* Adds a constraint e <= projpat(c,i,fv) where fv is a fresh variable */
|
||||
gen_e setif_proj(constructor c, int i, gen_e e);
|
||||
|
||||
gen_e setst_proj(constructor c, int i, gen_e e);
|
||||
|
||||
/* Make a new variable of sort s */
|
||||
gen_e setif_fresh(const char *name);
|
||||
|
||||
gen_e term_fresh(const char *name);
|
||||
|
||||
gen_e flowrow_fresh(const char *name);
|
||||
|
||||
gen_e setst_fresh(const char *name);
|
||||
|
||||
/* Operations for unions */
|
||||
|
||||
gen_e setif_union(gen_e exps[]);
|
||||
|
||||
gen_e setif_inter(gen_e exps[]);
|
||||
|
||||
gen_e setst_union(gen_e exps[]);
|
||||
|
||||
gen_e setst_inter(gen_e exps[]);
|
||||
|
||||
/* Empty set of sort s */
|
||||
gen_e setif_zero(void);
|
||||
|
||||
gen_e setst_zero(void);
|
||||
|
||||
gen_e flowrow_zero(sort_kind base_sort);
|
||||
|
||||
gen_e term_zero(void);
|
||||
|
||||
/* Universal set of sort s */
|
||||
gen_e setif_one(void);
|
||||
|
||||
gen_e setst_one(void);
|
||||
|
||||
gen_e flowrow_one(sort_kind base_sort);
|
||||
|
||||
gen_e term_one(void);
|
||||
|
||||
/*
|
||||
Operations for building flowrows
|
||||
*/
|
||||
|
||||
/* Closed flowrow of base sort s */
|
||||
gen_e flowrow_abs(sort_kind base_sort);
|
||||
|
||||
/* Wild flowrow of base sort s */
|
||||
gen_e flowrow_wild(sort_kind base_sort);
|
||||
|
||||
/* Build a flowrow of <l : e>_fields o <rest> */
|
||||
gen_e flowrow_row(flowrow_map fields, gen_e rest);
|
||||
|
||||
/*
|
||||
Inclusion functions
|
||||
*/
|
||||
void call_setif_inclusion(gen_e e1,gen_e e2);
|
||||
void call_setif_unify(gen_e e1, gen_e e2);
|
||||
|
||||
void call_setst_inclusion(gen_e e1, gen_e e2);
|
||||
void call_setst_unify(gen_e e1, gen_e e2);
|
||||
|
||||
void call_flowrow_inclusion(gen_e e1,gen_e e2);
|
||||
void call_flowrow_unify(gen_e e1, gen_e e2);
|
||||
|
||||
void call_term_unify(gen_e e1, gen_e e2);
|
||||
void call_term_cunify(gen_e e1, gen_e e2);
|
||||
|
||||
/*
|
||||
Extracting solutions
|
||||
*/
|
||||
struct decon
|
||||
{
|
||||
int arity;
|
||||
gen_e[1];
|
||||
};
|
||||
struct decon deconstruct_expr(constructor c,gen_e e);
|
||||
|
||||
gen_e_list setif_tlb(gen_e e);
|
||||
|
||||
gen_e_list setst_tlb(gen_e e);
|
||||
|
||||
gen_e term_get_ecr(gen_e e);
|
||||
|
||||
gen_e flowrow_extract_field(const char *label,gen_e row);
|
||||
flowrow_map flowrow_extract_fields(gen_e row);
|
||||
gen_e flowrow_extract_rest(gen_e row);
|
||||
|
||||
void nonspec_init(void);
|
||||
void nonspec_reset(void);
|
||||
|
||||
void expr_print(FILE *f,gen_e e);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* NONSPEC_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SETIF_SORT_H
|
||||
#define SETIF_SORT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "banshee.h"
|
||||
#include "termhash.h"
|
||||
#include "setif-var.h"
|
||||
|
||||
|
||||
struct setif_term /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
const sort_kind sort;
|
||||
#endif
|
||||
const int type;
|
||||
const stamp st;
|
||||
};
|
||||
|
||||
typedef struct setif_term *setif_term;
|
||||
|
||||
extern bool flag_merge_projections;
|
||||
extern bool flag_eliminate_cycles;
|
||||
|
||||
extern region setif_region;
|
||||
extern term_hash setif_hash;
|
||||
|
||||
typedef bool (*res_proj_fn_ptr) (setif_var v,gen_e proj) deletes;
|
||||
typedef gen_e (*proj_con_fn_ptr) (gen_e) deletes;
|
||||
|
||||
stamp setif_get_stamp(gen_e e);
|
||||
void setif_inclusion(con_match_fn_ptr,res_proj_fn_ptr, gen_e, gen_e) deletes;
|
||||
|
||||
bool setif_proj_merge(setif_var v, gen_e se, get_proj_fn_ptr get_proj,
|
||||
proj_con_fn_ptr make_proj,fresh_large_fn_ptr fresh_var,
|
||||
incl_fn_ptr sort_incl, incl_fn_ptr set_incl) deletes;
|
||||
|
||||
gen_e setif_zero(void);
|
||||
gen_e setif_one(void);
|
||||
gen_e setif_fresh(const char *name);
|
||||
gen_e setif_fresh_large(const char *name);
|
||||
gen_e setif_fresh_small(const char *name);
|
||||
gen_e setif_constant(const char *name) deletes;
|
||||
gen_e setif_union(gen_e_list exprs) deletes;
|
||||
gen_e setif_inter(gen_e_list exprs) deletes;
|
||||
bool setif_is_zero(gen_e e);
|
||||
bool setif_is_one(gen_e e);
|
||||
bool setif_is_var(gen_e e);
|
||||
bool setif_is_union(gen_e e);
|
||||
bool setif_is_inter(gen_e e);
|
||||
bool setif_is_constant(gen_e e);
|
||||
char *setif_get_constant_name(gen_e e);
|
||||
|
||||
gen_e_list setif_get_union(gen_e e);
|
||||
gen_e_list setif_get_inter(gen_e e);
|
||||
|
||||
gen_e_list setif_tlb(gen_e e) deletes;
|
||||
|
||||
void setif_set_proj_cache(gen_e e, gen_e elem);
|
||||
gen_e_list setif_get_proj_cache(gen_e e);
|
||||
|
||||
void setif_init(void);
|
||||
void setif_reset(void) deletes;
|
||||
void setif_print_stats(FILE *f);
|
||||
void setif_print_constraint_graph(FILE *f);
|
||||
|
||||
extern struct setif_stats setif_stats;
|
||||
struct setif_stats
|
||||
{
|
||||
int fresh;
|
||||
int fresh_small;
|
||||
int fresh_large;
|
||||
|
||||
int distinct_constructors;
|
||||
int hashed_constructors;
|
||||
int distinct_constants;
|
||||
int hashed_constants;
|
||||
int distinct_unions;
|
||||
int filtered_unions;
|
||||
int hashed_unions;
|
||||
int distinct_intersections;
|
||||
int filtered_intersections;
|
||||
int hashed_intersections;
|
||||
|
||||
int redundant_pred;
|
||||
int redundant_succ;
|
||||
int redundant_source;
|
||||
int redundant_sink;
|
||||
|
||||
int added_pred;
|
||||
int added_succ;
|
||||
int added_source;
|
||||
int added_sink;
|
||||
|
||||
int cycles_searched_forward;
|
||||
int cycles_searched_backward;
|
||||
|
||||
int cycles_collapsed_forward;
|
||||
int cycles_collapsed_backward;
|
||||
|
||||
int cycles_length_forward;
|
||||
int cycles_length_backward;
|
||||
};
|
||||
|
||||
#endif /* SETIF_SORT_H */
|
@ -1,226 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <regions.h>
|
||||
#include "setif-var.h"
|
||||
#include "ufind.h"
|
||||
#include "bounds.h"
|
||||
|
||||
struct sv_info
|
||||
{
|
||||
stamp st;
|
||||
bounds sameregion lbs;
|
||||
bounds sameregion ubs;
|
||||
jcoll tlb_cache;
|
||||
gen_e_list ub_projs;
|
||||
const char *name;
|
||||
uf_element component;
|
||||
};
|
||||
|
||||
typedef struct sv_info *sv_info;
|
||||
|
||||
DECLARE_UFIND(sv_elt,sv_info)
|
||||
|
||||
DEFINE_UFIND(sv_elt,sv_info)
|
||||
|
||||
DEFINE_LIST(setif_var_list,setif_var)
|
||||
|
||||
#define get_info(v) (sv_elt_get_info((v)->elt))
|
||||
|
||||
struct setif_var /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
sv_elt elt;
|
||||
};
|
||||
|
||||
bool sv_lt(setif_var v1, setif_var v2)
|
||||
{
|
||||
return ( sv_get_stamp(v1) < sv_get_stamp(v2) );
|
||||
}
|
||||
|
||||
bool sv_eq(setif_var v1, setif_var v2)
|
||||
{
|
||||
return ( sv_get_stamp(v1) == sv_get_stamp(v2) );
|
||||
}
|
||||
|
||||
static setif_var make_var(region r, const char *name, stamp st)
|
||||
{
|
||||
setif_var result = ralloc(r, struct setif_var);
|
||||
sv_info info = ralloc(r, struct sv_info);
|
||||
|
||||
info->st = st;
|
||||
info->lbs = bounds_create(r);
|
||||
info->ubs = bounds_create(r);
|
||||
info->tlb_cache = NULL;
|
||||
info->ub_projs = new_gen_e_list(r);
|
||||
info->name = name ? rstrdup(r,name) : "fv";
|
||||
info->component = new_uf_element(r, NULL);
|
||||
|
||||
result->type = VAR_TYPE;
|
||||
result->elt = new_sv_elt(r,info);
|
||||
|
||||
#ifdef NONSPEC
|
||||
result->sort = setif_sort;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
setif_var sv_fresh(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh());
|
||||
}
|
||||
|
||||
setif_var sv_fresh_large(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_large());
|
||||
}
|
||||
|
||||
setif_var sv_fresh_small(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_small());
|
||||
}
|
||||
|
||||
stamp sv_get_stamp(setif_var v)
|
||||
{
|
||||
return get_info(v)->st;
|
||||
}
|
||||
|
||||
const char *sv_get_name(setif_var v)
|
||||
{
|
||||
return get_info(v)->name;
|
||||
}
|
||||
|
||||
|
||||
static sv_info combine(sv_info i1, sv_info i2)
|
||||
{
|
||||
if (i1->st < i2->st)
|
||||
return i1;
|
||||
else return i2;
|
||||
}
|
||||
|
||||
void sv_unify(setif_var v,setif_var_list vars)
|
||||
{
|
||||
setif_var temp;
|
||||
setif_var_list_scanner scan;
|
||||
|
||||
setif_var_list_scan(vars,&scan);
|
||||
|
||||
while (setif_var_list_next(&scan,&temp))
|
||||
{
|
||||
sv_elt_unify(combine,v->elt,temp->elt);
|
||||
}
|
||||
}
|
||||
|
||||
gen_e_list sv_get_lbs(setif_var v)
|
||||
{
|
||||
return bounds_exprs(get_info(v)->lbs);
|
||||
}
|
||||
|
||||
gen_e_list sv_get_ubs(setif_var v)
|
||||
{
|
||||
return bounds_exprs(get_info(v)->ubs);
|
||||
}
|
||||
|
||||
bool sv_add_ub(setif_var v, gen_e e, stamp s)
|
||||
{
|
||||
return bounds_add(get_info(v)->ubs,e,s);
|
||||
}
|
||||
|
||||
bool sv_add_lb(setif_var v, gen_e e, stamp s)
|
||||
{
|
||||
return bounds_add(get_info(v)->lbs,e,s);
|
||||
}
|
||||
|
||||
bool sv_is_ub(setif_var v, stamp s)
|
||||
{
|
||||
bool self_edge = sv_get_stamp(v) == s,
|
||||
in_bounds = bounds_query(get_info(v)->ubs,s);
|
||||
|
||||
return (self_edge || in_bounds);
|
||||
}
|
||||
|
||||
bool sv_is_lb(setif_var v, stamp s)
|
||||
{
|
||||
|
||||
bool self_edge = sv_get_stamp(v) == s,
|
||||
in_bounds = bounds_query(get_info(v)->lbs,s);
|
||||
|
||||
return (self_edge || in_bounds);
|
||||
|
||||
}
|
||||
|
||||
void sv_add_ub_proj(setif_var v, gen_e e)
|
||||
{
|
||||
gen_e_list_cons(e,get_info(v)->ub_projs);
|
||||
}
|
||||
|
||||
gen_e sv_get_ub_proj(setif_var v, get_proj_fn_ptr get_proj)
|
||||
{
|
||||
return get_proj(get_info(v)->ub_projs);
|
||||
}
|
||||
|
||||
gen_e_list sv_get_ub_projs(setif_var v)
|
||||
{
|
||||
return get_info(v)->ub_projs;
|
||||
}
|
||||
|
||||
|
||||
bool sv_union_component(setif_var v1, setif_var v2)
|
||||
{
|
||||
if (uf_eq(get_info(v1)->component,get_info(v2)->component))
|
||||
return FALSE;
|
||||
|
||||
else
|
||||
{
|
||||
uf_union(get_info(v1)->component,get_info(v2)->component);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void sv_set_tlb_cache(setif_var v, jcoll j)
|
||||
{
|
||||
get_info(v)->tlb_cache = j;
|
||||
}
|
||||
|
||||
jcoll sv_get_tlb_cache(setif_var v)
|
||||
{
|
||||
return get_info(v)->tlb_cache;
|
||||
}
|
||||
|
||||
void sv_clear_tlb_cache(setif_var v)
|
||||
{
|
||||
get_info(v)->tlb_cache = NULL;
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SETIF_VAR_H
|
||||
#define SETIF_VAR_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
#include "jcollection.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct setif_var *setif_var;
|
||||
|
||||
DECLARE_LIST(setif_var_list,setif_var)
|
||||
|
||||
bool sv_lt(setif_var v1, setif_var v2);
|
||||
bool sv_eq(setif_var v1, setif_var v2);
|
||||
setif_var sv_fresh(region r, const char *name);
|
||||
setif_var sv_fresh_large(region r, const char *name);
|
||||
setif_var sv_fresh_small(region r, const char *name);
|
||||
stamp sv_get_stamp(setif_var v);
|
||||
const char *sv_get_name(setif_var v);
|
||||
void sv_unify(setif_var v,setif_var_list vars);
|
||||
gen_e_list sv_get_lbs(setif_var v);
|
||||
gen_e_list sv_get_ubs(setif_var v);
|
||||
bool sv_add_ub(setif_var v, gen_e e, stamp st);
|
||||
bool sv_add_lb(setif_var v, gen_e e, stamp st);
|
||||
bool sv_is_ub(setif_var v, stamp st);
|
||||
bool sv_is_lb(setif_var v, stamp st);
|
||||
void sv_set_tlb_cache(setif_var v, jcoll j);
|
||||
jcoll sv_get_tlb_cache(setif_var v);
|
||||
void sv_clear_tlb_cache(setif_var v);
|
||||
void sv_add_ub_proj(setif_var v, gen_e e);
|
||||
|
||||
gen_e sv_get_ub_proj(setif_var v, get_proj_fn_ptr get_proj);
|
||||
gen_e_list sv_get_ub_projs(setif_var v);
|
||||
|
||||
bool sv_union_component(setif_var v1, setif_var v2);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
|
||||
#endif /* SETIF_VAR_H */
|
||||
|
@ -1,907 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <regions.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "bounds.h"
|
||||
#include "setst-sort.h"
|
||||
|
||||
|
||||
struct setst_union_
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
gen_e_list exprs;
|
||||
gen_e_list proj_cache;
|
||||
};
|
||||
|
||||
struct setst_inter_
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
gen_e_list exprs;
|
||||
};
|
||||
|
||||
struct setst_constant_
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
char *name;
|
||||
};
|
||||
|
||||
typedef struct setst_inter_ *setst_inter_;
|
||||
typedef struct setst_union_ *setst_union_;
|
||||
typedef struct setst_constant_ *setst_constant_;
|
||||
|
||||
static region tlb_cache_region;
|
||||
static jcoll_dict tlb_dict;
|
||||
static setst_var_list setst_vars;
|
||||
static bool setst_changed = FALSE;
|
||||
|
||||
region setst_region;
|
||||
term_hash setst_hash;
|
||||
struct setst_stats setst_stats;
|
||||
|
||||
stamp setst_get_stamp(gen_e e)
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
assert(e->sort == setst_sort);
|
||||
#endif
|
||||
|
||||
if ( ((setst_term)e)->type == VAR_TYPE)
|
||||
return st_get_stamp( (setst_var)e );
|
||||
|
||||
else
|
||||
return ((setst_term)e)->st;
|
||||
}
|
||||
|
||||
static bool eq(gen_e e1, gen_e e2)
|
||||
{
|
||||
return ( setst_get_stamp(e1) == setst_get_stamp(e2) );
|
||||
}
|
||||
|
||||
static gen_e_list get_union(gen_e e)
|
||||
{
|
||||
assert ( ((setst_term)e)->type == UNION_TYPE);
|
||||
|
||||
return ( (setst_union_) e)->exprs;
|
||||
}
|
||||
|
||||
static gen_e_list get_inter(gen_e e)
|
||||
{
|
||||
assert ( ((setst_term)e)->type == INTER_TYPE);
|
||||
|
||||
return ( (setst_inter_) e)->exprs;
|
||||
}
|
||||
|
||||
static void update_lower_bound(setst_var v, gen_e e)
|
||||
{
|
||||
if (setst_is_var(e))
|
||||
{
|
||||
if (st_add_lb(v,(setst_var)e))
|
||||
{
|
||||
setst_stats.redundant_var++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setst_stats.added_var++;
|
||||
setst_changed = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (st_add_source(v, e,setst_get_stamp(e)))
|
||||
{
|
||||
setst_stats.redundant_source++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setst_stats.added_source++;
|
||||
setst_changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void update_upper_bound(setst_var v, gen_e e)
|
||||
{
|
||||
assert(! setst_is_var(e));
|
||||
|
||||
if (st_add_sink(v,e,setst_get_stamp(e)))
|
||||
{
|
||||
setst_stats.redundant_sink++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setst_stats.added_sink++;
|
||||
setst_changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setst_inclusion(con_match_fn_ptr con_match,gen_e e1, gen_e e2)
|
||||
{
|
||||
if (eq(e1,e2))
|
||||
return;
|
||||
|
||||
else if ( setst_is_zero(e1) || setst_is_one(e2) )
|
||||
return;
|
||||
|
||||
else if (setst_is_union(e1))
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
|
||||
gen_e_list exprs = get_union(e1);
|
||||
|
||||
gen_e_list_scan(exprs,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
setst_inclusion(con_match,temp,e2);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else if (setst_is_inter(e2))
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
|
||||
gen_e_list exprs = get_inter(e2);
|
||||
|
||||
gen_e_list_scan(exprs,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
setst_inclusion(con_match,e1,temp);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else if (setst_is_var(e2))
|
||||
{
|
||||
setst_var v = (setst_var)e2;
|
||||
|
||||
update_lower_bound(v,e1);
|
||||
}
|
||||
|
||||
else if (setst_is_var(e1))
|
||||
{
|
||||
setst_var v = (setst_var)e1;
|
||||
|
||||
update_upper_bound(v,e2);
|
||||
}
|
||||
|
||||
else con_match(e1,e2);
|
||||
}
|
||||
|
||||
#ifdef NONSPEC
|
||||
static struct setst_term zero = {ZERO_TYPE,setst_sort,ZERO_TYPE};
|
||||
static struct setst_term one = {ONE_TYPE,setst_sort,ONE_TYPE};
|
||||
#else
|
||||
static struct setst_term zero = {ZERO_TYPE,ZERO_TYPE};
|
||||
static struct setst_term one = {ONE_TYPE,ONE_TYPE};
|
||||
#endif /* NONSPEC */
|
||||
|
||||
gen_e setst_zero(void)
|
||||
{
|
||||
return (gen_e)&zero;
|
||||
}
|
||||
|
||||
gen_e setst_one(void)
|
||||
{
|
||||
return (gen_e)&one;
|
||||
}
|
||||
|
||||
gen_e setst_fresh(const char *name)
|
||||
{
|
||||
setst_var v = st_fresh(setst_region,name);
|
||||
setst_var_list_cons(v,setst_vars);
|
||||
return (gen_e)v;
|
||||
}
|
||||
|
||||
gen_e setst_fresh_large(const char *name)
|
||||
{
|
||||
setst_var v = st_fresh_large(setst_region,name);
|
||||
setst_var_list_cons(v,setst_vars);
|
||||
return (gen_e)v;
|
||||
}
|
||||
|
||||
gen_e setst_fresh_small(const char *name)
|
||||
{
|
||||
setst_var v = st_fresh_small(setst_region,name);
|
||||
setst_var_list_cons(v,setst_vars);
|
||||
return (gen_e)v;
|
||||
}
|
||||
|
||||
gen_e setst_constant(const char *str) deletes
|
||||
{
|
||||
stamp st[2];
|
||||
gen_e result;
|
||||
char *name = rstrdup(setst_region,str);
|
||||
|
||||
assert (str != NULL);
|
||||
|
||||
st[0] = CONSTANT_TYPE;
|
||||
st[1] = stamp_string(name);
|
||||
|
||||
if ( (result = term_hash_find(setst_hash,st,2)) == NULL)
|
||||
{
|
||||
setst_constant_ c = ralloc(setst_region, struct setst_constant_);
|
||||
c->type = CONSTANT_TYPE;
|
||||
c->st = stamp_fresh();
|
||||
c->name = name;
|
||||
|
||||
result = (gen_e) c;
|
||||
term_hash_insert(setst_hash,result,st,2);
|
||||
|
||||
setst_stats.distinct_constants++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
setst_stats.hashed_constants++;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static bool filter_zero(const gen_e e)
|
||||
{
|
||||
return (!setst_is_zero(e));
|
||||
}
|
||||
|
||||
|
||||
static bool filter_one(const gen_e e)
|
||||
{
|
||||
return (!setst_is_one(e));
|
||||
}
|
||||
|
||||
gen_e setst_union(gen_e_list exprs) deletes
|
||||
{
|
||||
gen_e_list filtered = gen_e_list_filter(setst_region,exprs,filter_zero);
|
||||
|
||||
if ( gen_e_list_empty(filtered) )
|
||||
{
|
||||
setst_stats.filtered_unions++;
|
||||
return setst_zero();
|
||||
}
|
||||
else if (gen_e_list_length(filtered) == 1)
|
||||
{
|
||||
setst_stats.filtered_unions++;
|
||||
return gen_e_list_head(filtered);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
gen_e temp,result;
|
||||
gen_e_list_scanner scan;
|
||||
stamp st[ gen_e_list_length(filtered) + 1 ];
|
||||
|
||||
st[0] = UNION_TYPE;
|
||||
|
||||
gen_e_list_scan(filtered,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
st[++i] = setst_get_stamp(temp);
|
||||
}
|
||||
|
||||
if ( (result =
|
||||
term_hash_find(setst_hash,st,gen_e_list_length(filtered)+1))
|
||||
== NULL )
|
||||
{
|
||||
struct setst_union_ *u = ralloc(setst_region,struct setst_union_);
|
||||
|
||||
u->type = UNION_TYPE;
|
||||
u->st = stamp_fresh();
|
||||
u->proj_cache = new_gen_e_list(setst_region);
|
||||
u->exprs = filtered;
|
||||
|
||||
result = (gen_e)u;
|
||||
term_hash_insert(setst_hash,result,st,gen_e_list_length(filtered)+1);
|
||||
|
||||
setst_stats.distinct_unions++;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
setst_stats.hashed_unions++;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gen_e setst_inter(gen_e_list exprs) deletes
|
||||
{
|
||||
gen_e_list filtered = gen_e_list_filter(setst_region,exprs,filter_one);
|
||||
|
||||
if ( gen_e_list_empty(filtered) )
|
||||
{
|
||||
setst_stats.filtered_intersections++;
|
||||
return setst_one();
|
||||
}
|
||||
else if (gen_e_list_length(filtered) == 1)
|
||||
{
|
||||
setst_stats.filtered_intersections++;
|
||||
return gen_e_list_head(filtered);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
gen_e temp,result;
|
||||
gen_e_list_scanner scan;
|
||||
stamp st[ gen_e_list_length(filtered) + 1 ];
|
||||
|
||||
st[0] = INTER_TYPE;
|
||||
|
||||
gen_e_list_scan(filtered,&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
st[++i] = setst_get_stamp(temp);
|
||||
}
|
||||
|
||||
if ( (result =
|
||||
term_hash_find(setst_hash,st,gen_e_list_length(filtered)+1))
|
||||
== NULL )
|
||||
{
|
||||
struct setst_inter_ *u = ralloc(setst_region,struct setst_inter_);
|
||||
|
||||
u->type = UNION_TYPE;
|
||||
u->st = stamp_fresh();
|
||||
u->exprs = filtered;
|
||||
|
||||
result = (gen_e)u;
|
||||
term_hash_insert(setst_hash,result,st,gen_e_list_length(filtered)+1);
|
||||
|
||||
setst_stats.distinct_intersections++;
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
setst_stats.hashed_intersections++;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gen_e_list setst_get_union(gen_e e)
|
||||
{
|
||||
assert (((setst_term)e)->type == UNION_TYPE);
|
||||
|
||||
return ((setst_union_)e)->exprs;
|
||||
}
|
||||
|
||||
|
||||
gen_e_list setst_get_inter(gen_e e)
|
||||
{
|
||||
assert (((setst_term)e)->type == INTER_TYPE);
|
||||
|
||||
return ((setst_inter_)e)->exprs;
|
||||
}
|
||||
|
||||
static void invalidate_tlb_cache(void)
|
||||
{
|
||||
assert(tlb_cache_region);
|
||||
|
||||
jcoll_delete_dict(tlb_dict);
|
||||
setst_var_list_app(setst_vars,st_clear_tlb_cache);
|
||||
deleteregion_ptr(&tlb_cache_region);
|
||||
|
||||
tlb_cache_region = newregion();
|
||||
tlb_dict = jcoll_create_dict(tlb_cache_region,setst_get_stamp);
|
||||
}
|
||||
|
||||
static void set_tlb_cache(setst_var v,jcoll j)
|
||||
{
|
||||
st_set_tlb_cache(v,j);
|
||||
}
|
||||
|
||||
static void collect_sinks(bounds b,setst_var v)
|
||||
{
|
||||
gen_e sink;
|
||||
gen_e_list_scanner scan;
|
||||
|
||||
gen_e_list_scan(st_get_sinks(v),&scan);
|
||||
|
||||
while (gen_e_list_next(&scan,&sink))
|
||||
{
|
||||
bounds_add(b,sink,setst_get_stamp(sink));
|
||||
}
|
||||
}
|
||||
|
||||
static void collect_sources(bounds b, setst_var v)
|
||||
{
|
||||
gen_e source;
|
||||
gen_e_list_scanner scan;
|
||||
|
||||
gen_e_list_scan(st_get_sources(v),&scan);
|
||||
|
||||
while (gen_e_list_next(&scan,&source))
|
||||
{
|
||||
bounds_add(b,source,setst_get_stamp(source));
|
||||
}
|
||||
}
|
||||
|
||||
static void collect_lower_bounds(bounds b, setst_var v)
|
||||
{
|
||||
setst_var lb;
|
||||
setst_var_list_scanner scan;
|
||||
|
||||
setst_var_list_scan(st_get_lbs(v),&scan);
|
||||
|
||||
while (setst_var_list_next(&scan,&lb))
|
||||
{
|
||||
bounds_add(b,(gen_e)lb,st_get_stamp(lb));
|
||||
}
|
||||
}
|
||||
|
||||
static void apply_sources(setst_var witness, bounds sources)
|
||||
{
|
||||
gen_e source;
|
||||
gen_e_list_scanner scan;
|
||||
|
||||
gen_e_list_scan(bounds_exprs(sources),&scan);
|
||||
|
||||
while (gen_e_list_next(&scan,&source))
|
||||
{
|
||||
if ( st_add_source(witness,source,setst_get_stamp(source)))
|
||||
setst_stats.redundant_source++;
|
||||
|
||||
else
|
||||
setst_stats.added_source++;
|
||||
}
|
||||
}
|
||||
|
||||
static void apply_sinks(setst_var witness, bounds sinks)
|
||||
{
|
||||
gen_e sink;
|
||||
gen_e_list_scanner scan;
|
||||
|
||||
gen_e_list_scan(bounds_exprs(sinks),&scan);
|
||||
|
||||
while (gen_e_list_next(&scan,&sink))
|
||||
{
|
||||
if (st_add_sink(witness,sink,setst_get_stamp(sink)))
|
||||
setst_stats.redundant_sink++;
|
||||
|
||||
else
|
||||
setst_stats.added_sink++;
|
||||
}
|
||||
}
|
||||
|
||||
static void apply_lower_bounds(setst_var witness,bounds lower)
|
||||
{
|
||||
gen_e lb;
|
||||
gen_e_list_scanner scan;
|
||||
|
||||
gen_e_list_scan(bounds_exprs(lower),&scan);
|
||||
|
||||
while (gen_e_list_next(&scan,&lb))
|
||||
{
|
||||
if (st_add_lb(witness,(setst_var)lb))
|
||||
setst_stats.redundant_var++;
|
||||
else
|
||||
setst_stats.added_var++;
|
||||
}
|
||||
}
|
||||
|
||||
static void collapse_cycle(setst_var witness, setst_var_list cycle) deletes
|
||||
{
|
||||
setst_var_list_scanner var_scan;
|
||||
setst_var temp;
|
||||
region scratch_rgn = newregion();
|
||||
|
||||
bounds sources = bounds_create(scratch_rgn);
|
||||
bounds sinks = bounds_create(scratch_rgn);
|
||||
bounds lower = bounds_create(scratch_rgn);
|
||||
|
||||
|
||||
setst_stats.cycles_collapsed++;
|
||||
|
||||
/* force at least another iteration */
|
||||
setst_changed = TRUE;
|
||||
|
||||
/* collect all bounds */
|
||||
setst_var_list_scan(cycle,&var_scan);
|
||||
while (setst_var_list_next(&var_scan,&temp))
|
||||
{
|
||||
collect_sources(sources,temp);
|
||||
collect_sinks(sinks,temp);
|
||||
collect_lower_bounds(lower,temp);
|
||||
}
|
||||
|
||||
/* unify all vars */
|
||||
st_unify(witness,cycle);
|
||||
|
||||
/* add all bounds back */
|
||||
apply_sources(witness,sources);
|
||||
apply_sinks(witness,sinks);
|
||||
apply_lower_bounds(witness,lower);
|
||||
|
||||
/* cleanup */
|
||||
bounds_delete(sources);
|
||||
bounds_delete(sinks);
|
||||
bounds_delete(lower);
|
||||
deleteregion(scratch_rgn);
|
||||
|
||||
/* remove self edges */
|
||||
st_repair_bounds(witness);
|
||||
}
|
||||
/*
|
||||
static bool cycle_detect(setst_var goal, setst_var_list path,
|
||||
setst_var_list *result)
|
||||
{
|
||||
int pos = st_get_path_pos(goal);
|
||||
setst_stats.cycles_searched++;
|
||||
|
||||
if (pos)
|
||||
{
|
||||
setst_var_list_scanner scan;
|
||||
setst_var temp;
|
||||
setst_var_list cycle = new_setst_var_list(tlb_cache_region);
|
||||
|
||||
setst_var_list_scan(path,&scan);
|
||||
while(setst_var_list_next(&scan,&temp))
|
||||
{
|
||||
if (st_get_path_pos(temp) >= pos)
|
||||
setst_var_list_cons(temp,cycle);
|
||||
}
|
||||
|
||||
*result = cycle;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*/
|
||||
static bool cycle_detect(setst_var goal, setst_var_list path,
|
||||
setst_var_list *result)
|
||||
{
|
||||
setst_var_list cycle =
|
||||
setst_var_list_reverse(setst_var_list_copy(tlb_cache_region,path));
|
||||
|
||||
setst_stats.cycles_searched++;
|
||||
|
||||
while (!setst_var_list_empty(cycle) &&
|
||||
!eq((gen_e)setst_var_list_head(cycle),(gen_e)goal))
|
||||
{
|
||||
setst_var_list_tail(cycle);
|
||||
}
|
||||
|
||||
if (setst_var_list_empty(cycle))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = cycle;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static jcoll tlb_aux(gen_e e,int path_len,setst_var_list path) deletes
|
||||
{
|
||||
if (setst_is_var(e))
|
||||
{
|
||||
setst_var_list cycle;
|
||||
setst_var v = (setst_var)e;
|
||||
if ( cycle_detect(v,path,&cycle) )
|
||||
{
|
||||
setst_stats.cycles_length += setst_var_list_length(cycle);
|
||||
collapse_cycle(v,cycle);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (st_get_tlb_cache(v) != NULL)
|
||||
return st_get_tlb_cache(v);
|
||||
else
|
||||
{
|
||||
jcoll result;
|
||||
setst_var_list_scanner scan;
|
||||
setst_var lb;
|
||||
jcoll_list jvars = new_jcoll_list(tlb_cache_region);
|
||||
|
||||
gen_e_list sources = gen_e_list_copy(tlb_cache_region,
|
||||
st_get_sources(v));
|
||||
|
||||
st_set_path_pos(v,path_len);
|
||||
setst_var_list_scan(st_get_lbs(v),&scan);
|
||||
while (setst_var_list_next(&scan,&lb))
|
||||
{
|
||||
setst_var_list_cons(v,path);
|
||||
jcoll_list_cons(tlb_aux((gen_e)lb,++path_len,path),
|
||||
jvars);
|
||||
setst_var_list_tail(path);
|
||||
}
|
||||
|
||||
if (! gen_e_list_empty(sources))
|
||||
jcoll_list_cons(jcoll_create_chain(tlb_dict,sources),
|
||||
jvars);
|
||||
result = jcoll_jjoin(tlb_dict,jvars);
|
||||
set_tlb_cache(v,result);
|
||||
st_set_path_pos(v,0);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (setst_is_union(e))
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
jcoll_list jexprs = new_jcoll_list(tlb_cache_region);
|
||||
|
||||
gen_e_list_scan(setst_get_union(e),&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
jcoll_list_cons(tlb_aux(temp,++path_len,path),jexprs);
|
||||
}
|
||||
|
||||
return jcoll_jjoin(tlb_dict,jexprs);
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Unmatched case in setst tlb computation\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
static gen_e_list tlb(gen_e e)
|
||||
{
|
||||
return jcoll_flatten(tlb_dict,
|
||||
tlb_aux(e,1,new_setst_var_list(tlb_cache_region)) );
|
||||
}
|
||||
static void match_sinks(incl_fn_ptr setst_incl)
|
||||
{
|
||||
gen_e_list_scanner tlb_scanner, sink_scanner;
|
||||
setst_var_list_scanner var_scanner;
|
||||
setst_var v;
|
||||
gen_e lb, sink;
|
||||
|
||||
setst_var_list_scan(setst_vars,&var_scanner);
|
||||
|
||||
while (setst_var_list_next(&var_scanner,&v))
|
||||
{
|
||||
gen_e_list tlbs = tlb((gen_e)v);
|
||||
gen_e_list snks = st_get_sinks(v);
|
||||
|
||||
|
||||
if(gen_e_list_empty(st_get_sinks(v)))
|
||||
{
|
||||
setst_stats.no_sinks++;
|
||||
continue;
|
||||
}
|
||||
else if(st_get_seen(v))
|
||||
{
|
||||
setst_stats.incycle_vars++;
|
||||
continue;
|
||||
}
|
||||
else if (gen_e_list_length(tlbs) == st_get_src_sz(v)
|
||||
&& gen_e_list_length(snks) == st_get_snk_sz(v) )
|
||||
{
|
||||
setst_stats.unchanged_vars++;
|
||||
continue;
|
||||
}
|
||||
st_set_seen(v,TRUE);
|
||||
|
||||
st_set_src_sz(v,gen_e_list_length(tlbs));
|
||||
st_set_snk_sz(v,gen_e_list_length(snks));
|
||||
|
||||
gen_e_list_scan(tlbs,&tlb_scanner);
|
||||
|
||||
while (gen_e_list_next(&tlb_scanner,&lb))
|
||||
{
|
||||
gen_e_list_scan(snks,&sink_scanner);
|
||||
|
||||
while (gen_e_list_next(&sink_scanner,&sink))
|
||||
setst_incl(lb,sink);
|
||||
}
|
||||
}
|
||||
}
|
||||
static void iterate(incl_fn_ptr setst_incl)
|
||||
{
|
||||
setst_var_list_scanner var_scanner;
|
||||
setst_var v;
|
||||
/* static int iterations = 0; */
|
||||
setst_changed = FALSE;
|
||||
|
||||
setst_var_list_scan(setst_vars,&var_scanner);
|
||||
while (setst_var_list_next(&var_scanner,&v))
|
||||
{
|
||||
st_set_seen(v,FALSE);
|
||||
}
|
||||
|
||||
invalidate_tlb_cache();
|
||||
match_sinks(setst_incl);
|
||||
|
||||
/* fprintf(stderr,"Iterations : %d\n",++iterations); */
|
||||
|
||||
if (setst_changed)
|
||||
iterate(setst_incl);
|
||||
}
|
||||
gen_e_list setst_tlb(gen_e e,incl_fn_ptr setst_incl) deletes
|
||||
{
|
||||
if (! setst_changed)
|
||||
{
|
||||
return tlb(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
iterate(setst_incl);
|
||||
return tlb(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setst_set_proj_cache(gen_e e, gen_e elem)
|
||||
{
|
||||
if (setst_is_union(e))
|
||||
{
|
||||
setst_union_ u = (setst_union_)e;
|
||||
gen_e_list_cons(elem,u->proj_cache);
|
||||
}
|
||||
}
|
||||
|
||||
gen_e_list setst_get_proj_cache(gen_e e)
|
||||
{
|
||||
|
||||
if (setst_is_union(e))
|
||||
{
|
||||
setst_union_ u = (setst_union_)e;
|
||||
return u->proj_cache;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Term does not cache projections\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void setst_init(void)
|
||||
{
|
||||
setst_region = newregion();
|
||||
tlb_cache_region = newregion();
|
||||
setst_hash = make_term_hash(setst_region);
|
||||
setst_vars = new_setst_var_list(setst_region);
|
||||
tlb_dict = jcoll_create_dict(tlb_cache_region,setst_get_stamp);
|
||||
}
|
||||
|
||||
void setst_reset(void) deletes
|
||||
{
|
||||
term_hash_delete(setst_hash);
|
||||
deleteregion_ptr(&setst_region);
|
||||
|
||||
setst_region = newregion();
|
||||
setst_hash = make_term_hash(setst_region);
|
||||
setst_vars = new_setst_var_list(setst_region);
|
||||
invalidate_tlb_cache();
|
||||
setst_changed = FALSE;
|
||||
}
|
||||
|
||||
bool setst_is_zero(gen_e e)
|
||||
{
|
||||
return ((setst_term)e)->type == ZERO_TYPE;
|
||||
}
|
||||
|
||||
bool setst_is_one(gen_e e)
|
||||
{
|
||||
return ((setst_term)e)->type == ONE_TYPE;
|
||||
}
|
||||
|
||||
bool setst_is_var(gen_e e)
|
||||
{
|
||||
return ((setst_term)e)->type == VAR_TYPE;
|
||||
}
|
||||
|
||||
bool setst_is_union(gen_e e)
|
||||
{
|
||||
return ((setst_term)e)->type == UNION_TYPE;
|
||||
}
|
||||
|
||||
bool setst_is_inter(gen_e e)
|
||||
{
|
||||
return ((setst_term)e)->type == INTER_TYPE;
|
||||
}
|
||||
|
||||
char *setst_get_constant_name(gen_e e)
|
||||
{
|
||||
assert( ((setst_term)e)->type == CONSTANT_TYPE );
|
||||
|
||||
return ((setst_constant_)e)->name;
|
||||
}
|
||||
|
||||
void setst_print_stats(FILE *f)
|
||||
{
|
||||
fprintf(f,"\n========== SetST Var Stats ==========\n");
|
||||
fprintf(f,"Fresh : %d\n",setst_stats.fresh);
|
||||
fprintf(f,"Fresh Small : %d\n",setst_stats.fresh_small);
|
||||
fprintf(f,"Fresh Large : %d\n",setst_stats.fresh_large);
|
||||
fprintf(f,"Total : %d\n",setst_stats.fresh + setst_stats.fresh_small
|
||||
+ setst_stats.fresh_large);
|
||||
fprintf(f,"\n========== SetST Sort Stats ==========\n");
|
||||
fprintf(f,"\n");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Additions");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Var: %d\n",setst_stats.added_var);
|
||||
fprintf(f,"Source: %d\n",setst_stats.added_source);
|
||||
fprintf(f,"Sink: %d",setst_stats.added_sink);
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Total: %d",setst_stats.added_var + setst_stats.added_source
|
||||
+ setst_stats.added_sink);
|
||||
fprintf(f,"\n");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Redundant");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Var: %d\n",setst_stats.redundant_var);
|
||||
fprintf(f,"Source: %d\n",setst_stats.redundant_source);
|
||||
fprintf(f,"Sink: %d",setst_stats.redundant_sink);
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Total: %d\n",
|
||||
setst_stats.redundant_var + setst_stats.redundant_source
|
||||
+ setst_stats.redundant_sink);
|
||||
|
||||
fprintf(f,"\n");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Iteration Optimizations");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Skipped vars: %d\n",setst_stats.incycle_vars);
|
||||
fprintf(f,"Unchanged vars: %d\n",setst_stats.unchanged_vars);
|
||||
fprintf(f,"Vars w/o sinks: %d\n",setst_stats.no_sinks);
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Cycles");
|
||||
fprintf(f,"\n------------------------------\n");
|
||||
fprintf(f,"Collapsed: %d\n",setst_stats.cycles_collapsed);
|
||||
fprintf(f,"Searched: %d\n",setst_stats.cycles_searched);
|
||||
fprintf(f,"Hit rate: %f\n",
|
||||
((float)setst_stats.cycles_collapsed)/((float)setst_stats.cycles_searched));
|
||||
fprintf(f,"Average Length: %f\n",
|
||||
((float)setst_stats.cycles_length) / ((float)setst_stats.cycles_collapsed));
|
||||
fprintf(f,"=====================================\n");
|
||||
}
|
||||
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SETST_SORT_H
|
||||
#define SETST_SORT_H
|
||||
|
||||
#include "banshee.h"
|
||||
#include "termhash.h"
|
||||
#include "setst-var.h"
|
||||
|
||||
extern region setst_region;
|
||||
extern term_hash setst_hash;
|
||||
|
||||
struct setst_term /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
};
|
||||
|
||||
typedef struct setst_term *setst_term;
|
||||
|
||||
stamp setst_get_stamp(gen_e e);
|
||||
void setst_inclusion(con_match_fn_ptr,gen_e, gen_e);
|
||||
|
||||
gen_e setst_zero(void);
|
||||
gen_e setst_one(void);
|
||||
gen_e setst_fresh(const char *name);
|
||||
gen_e setst_fresh_large(const char *name);
|
||||
gen_e setst_fresh_small(const char *name);
|
||||
gen_e setst_constant(const char *name) deletes;
|
||||
gen_e setst_union(gen_e_list exprs) deletes;
|
||||
gen_e setst_inter(gen_e_list exprs) deletes;
|
||||
bool setst_is_zero(gen_e e);
|
||||
bool setst_is_one(gen_e e);
|
||||
bool setst_is_var(gen_e e);
|
||||
bool setst_is_union(gen_e e);
|
||||
bool setst_is_inter(gen_e e);
|
||||
bool setst_is_constant(gen_e e);
|
||||
|
||||
char *setst_get_constant_name(gen_e e);
|
||||
gen_e_list setst_get_union(gen_e e);
|
||||
gen_e_list setst_get_inter(gen_e e);
|
||||
|
||||
gen_e_list setst_tlb(gen_e e,incl_fn_ptr setst_incl) deletes;
|
||||
void setst_set_proj_cache(gen_e e, gen_e elem);
|
||||
gen_e_list setst_get_proj_cache(gen_e e);
|
||||
|
||||
|
||||
void setst_init(void);
|
||||
void setst_reset(void) deletes;
|
||||
void setst_print_stats(FILE *f);
|
||||
|
||||
extern struct setst_stats setst_stats;
|
||||
|
||||
struct setst_stats
|
||||
{
|
||||
int fresh;
|
||||
int fresh_large;
|
||||
int fresh_small;
|
||||
|
||||
int distinct_constructors;
|
||||
int hashed_constructors;
|
||||
int distinct_constants;
|
||||
int hashed_constants;
|
||||
int distinct_unions;
|
||||
int filtered_unions;
|
||||
int hashed_unions;
|
||||
int distinct_intersections;
|
||||
int filtered_intersections;
|
||||
int hashed_intersections;
|
||||
|
||||
int redundant_var;
|
||||
int redundant_source;
|
||||
int redundant_sink;
|
||||
|
||||
int added_var;
|
||||
int added_source;
|
||||
int added_sink;
|
||||
|
||||
int incycle_vars;
|
||||
int unchanged_vars;
|
||||
int no_sinks;
|
||||
|
||||
int cycles_searched;
|
||||
int cycles_collapsed;
|
||||
int cycles_length;
|
||||
};
|
||||
|
||||
|
||||
#endif /* SETST_SORT_H */
|
||||
|
@ -1,249 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <regions.h>
|
||||
#include "setst-var.h"
|
||||
#include "jcollection.h"
|
||||
#include "ufind.h"
|
||||
#include "bounds.h"
|
||||
|
||||
struct st_info
|
||||
{
|
||||
stamp st;
|
||||
bounds lbs;
|
||||
bounds sources;
|
||||
bounds sinks;
|
||||
jcoll tlb_cache;
|
||||
const char *name;
|
||||
bool seen;
|
||||
int path_pos;
|
||||
int src_sz;
|
||||
int snk_sz;
|
||||
};
|
||||
|
||||
typedef struct st_info *st_info;
|
||||
|
||||
DECLARE_UFIND(st_elt,st_info)
|
||||
|
||||
DEFINE_UFIND(st_elt,st_info)
|
||||
|
||||
DEFINE_LIST(setst_var_list,setst_var)
|
||||
|
||||
#define get_info(v) (st_elt_get_info((v)->elt))
|
||||
|
||||
struct setst_var /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
st_elt elt;
|
||||
};
|
||||
|
||||
bool st_eq(setst_var v1, setst_var v2)
|
||||
{
|
||||
return (st_get_stamp(v1) == st_get_stamp(v2));
|
||||
}
|
||||
|
||||
static setst_var make_var(region r, const char *name, stamp st)
|
||||
{
|
||||
setst_var result = ralloc(r,struct setst_var);
|
||||
st_info info = ralloc(r, struct st_info);
|
||||
|
||||
info->st = st;
|
||||
info->lbs = bounds_create(r);
|
||||
info->sources = bounds_create(r);
|
||||
info->sinks = bounds_create(r);
|
||||
info->tlb_cache = NULL;
|
||||
info->name = name ? rstrdup(r,name) : "fv";
|
||||
info->seen = FALSE;
|
||||
info->path_pos = 0;
|
||||
info->src_sz = 0;
|
||||
info->snk_sz = 0;
|
||||
|
||||
result->type = VAR_TYPE;
|
||||
result->elt = new_st_elt(r,info);
|
||||
|
||||
|
||||
#ifdef NONSPEC
|
||||
result->sort = setst_sort;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
setst_var st_fresh(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh());
|
||||
}
|
||||
|
||||
setst_var st_fresh_large(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_large());
|
||||
}
|
||||
|
||||
setst_var st_fresh_small(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_small());
|
||||
}
|
||||
|
||||
stamp st_get_stamp(setst_var v)
|
||||
{
|
||||
return get_info(v)->st;
|
||||
}
|
||||
|
||||
const char *st_get_name(setst_var v)
|
||||
{
|
||||
return get_info(v)->name;
|
||||
}
|
||||
|
||||
void st_unify(setst_var v,setst_var_list vars)
|
||||
{
|
||||
setst_var temp;
|
||||
setst_var_list_scanner scan;
|
||||
|
||||
setst_var_list_scan(vars,&scan);
|
||||
|
||||
while (setst_var_list_next(&scan,&temp))
|
||||
{
|
||||
st_elt_union(v->elt,temp->elt);
|
||||
}
|
||||
}
|
||||
|
||||
setst_var_list st_get_lbs(setst_var v)
|
||||
{
|
||||
return (setst_var_list)bounds_exprs(get_info(v)->lbs);
|
||||
}
|
||||
|
||||
gen_e_list st_get_sources(setst_var v)
|
||||
{
|
||||
return bounds_exprs(get_info(v)->sources);
|
||||
}
|
||||
|
||||
gen_e_list st_get_sinks(setst_var v)
|
||||
{
|
||||
return bounds_exprs(get_info(v)->sinks);
|
||||
}
|
||||
|
||||
bool st_add_lb(setst_var v, setst_var lb)
|
||||
{
|
||||
return bounds_add(get_info(v)->lbs,(gen_e)lb,st_get_stamp(lb));
|
||||
}
|
||||
|
||||
bool st_add_source(setst_var v, gen_e source, stamp s)
|
||||
{
|
||||
return bounds_add(get_info(v)->sources,source,s);
|
||||
}
|
||||
|
||||
bool st_add_sink(setst_var v, gen_e sink, stamp s)
|
||||
{
|
||||
return bounds_add(get_info(v)->sinks,sink,s);
|
||||
}
|
||||
|
||||
jcoll st_get_tlb_cache(setst_var v)
|
||||
{
|
||||
return get_info(v)->tlb_cache;
|
||||
}
|
||||
|
||||
void st_set_tlb_cache(setst_var v, jcoll j)
|
||||
{
|
||||
get_info(v)->tlb_cache = j;
|
||||
}
|
||||
|
||||
void st_clear_tlb_cache(setst_var v)
|
||||
{
|
||||
get_info(v)->tlb_cache = NULL;
|
||||
}
|
||||
|
||||
gen_e st_get_ub_proj(setst_var v, get_proj_fn_ptr get_proj)
|
||||
{
|
||||
return get_proj(st_get_sinks(v));
|
||||
}
|
||||
static setst_var neq_temp;
|
||||
static bool neq (const setst_var v2)
|
||||
{
|
||||
return (!(st_get_stamp (neq_temp) == st_get_stamp (v2)));
|
||||
}
|
||||
void st_repair_bounds(setst_var v1)
|
||||
{
|
||||
setst_var_list lbs;
|
||||
neq_temp = v1;
|
||||
lbs = setst_var_list_filter2(st_get_lbs(v1),neq);
|
||||
|
||||
bounds_set(get_info(v1)->lbs,(gen_e_list)lbs);
|
||||
}
|
||||
|
||||
void st_set_path_pos(setst_var v, int pos)
|
||||
{
|
||||
get_info(v)->path_pos = pos;
|
||||
}
|
||||
|
||||
int st_get_path_pos(setst_var v)
|
||||
{
|
||||
return get_info(v)->path_pos;
|
||||
}
|
||||
|
||||
void st_set_seen(setst_var v, bool b)
|
||||
{
|
||||
get_info(v)->seen = b;
|
||||
}
|
||||
|
||||
bool st_get_seen(setst_var v)
|
||||
{
|
||||
return get_info(v)->seen;
|
||||
}
|
||||
|
||||
void st_set_src_sz(setst_var v, int size)
|
||||
{
|
||||
get_info(v)->src_sz = size;
|
||||
}
|
||||
|
||||
int st_get_src_sz(setst_var v)
|
||||
{
|
||||
return get_info(v)->src_sz;
|
||||
}
|
||||
|
||||
void st_set_snk_sz(setst_var v, int size)
|
||||
{
|
||||
get_info(v)->snk_sz = size;
|
||||
}
|
||||
|
||||
int st_get_snk_sz(setst_var v)
|
||||
{
|
||||
return get_info(v)->snk_sz;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SETST_VAR_H
|
||||
#define SETST_VAR_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
#include "jcollection.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct setst_var *setst_var;
|
||||
|
||||
DECLARE_LIST(setst_var_list,setst_var)
|
||||
|
||||
bool st_eq(setst_var v1, setst_var v2);
|
||||
setst_var st_fresh(region r, const char *name);
|
||||
setst_var st_fresh_large(region r, const char *name);
|
||||
setst_var st_fresh_small(region r, const char *name);
|
||||
stamp st_get_stamp(setst_var v);
|
||||
const char *st_get_name(setst_var v);
|
||||
void st_unify(setst_var v,setst_var_list vars);
|
||||
setst_var_list st_get_lbs(setst_var v);
|
||||
gen_e_list st_get_sources(setst_var v);
|
||||
gen_e_list st_get_sinks(setst_var v);
|
||||
gen_e st_get_ub_proj(setst_var v, get_proj_fn_ptr get_proj);
|
||||
bool st_add_lb(setst_var v, setst_var lb);
|
||||
bool st_add_source(setst_var v, gen_e source, stamp s);
|
||||
bool st_add_sink(setst_var v, gen_e sink, stamp s);
|
||||
|
||||
void st_set_path_pos(setst_var v, int pos);
|
||||
int st_get_path_pos(setst_var v);
|
||||
void st_set_seen(setst_var v, bool b);
|
||||
bool st_get_seen(setst_var v);
|
||||
void st_set_src_sz(setst_var v, int size);
|
||||
int st_get_src_sz(setst_var v);
|
||||
void st_set_snk_sz(setst_var v, int size);
|
||||
int st_get_snk_sz(setst_var v);
|
||||
|
||||
jcoll st_get_tlb_cache(setst_var v);
|
||||
void st_set_tlb_cache(setst_var v, jcoll j);
|
||||
void st_clear_tlb_cache(setst_var v);
|
||||
|
||||
void st_repair_bounds(setst_var v);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* SETST_VAR_H */
|
||||
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stamp.h"
|
||||
#include "util.h"
|
||||
#include "hash.h"
|
||||
#include "list.h"
|
||||
#define INITIAL_SIZE 32
|
||||
#define INITIAL1 0
|
||||
#define INITIAL2 2000
|
||||
#define INITIAL3 536870911
|
||||
#define MIN -1073741824 /* -2^30 */
|
||||
#define MAX 1073741824 /* 2^30 */
|
||||
|
||||
static hash_table str_hash;
|
||||
static region str_hash_rgn;
|
||||
|
||||
static int count1 = INITIAL1, count2 = INITIAL2, count3 = INITIAL3;
|
||||
static int bounds1 = MIN, bounds2 = 536870911, bounds3 = MAX;
|
||||
|
||||
static inline stamp check1(int i)
|
||||
{
|
||||
if (i <= bounds1)
|
||||
fail ("Unable to create stamp with small index\n");
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline stamp check2(int i)
|
||||
{
|
||||
if (i > bounds2)
|
||||
fail ("Unable to create a stamp with regular index\n");
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline stamp check3(int i)
|
||||
{
|
||||
if (i >= bounds3)
|
||||
fail ("Unable to create a stamp with large index\n");
|
||||
return i;
|
||||
}
|
||||
|
||||
stamp stamp_fresh(void)
|
||||
{
|
||||
return (check2(++count2));
|
||||
}
|
||||
|
||||
stamp stamp_fresh_small(void)
|
||||
{
|
||||
return (check1(--count1));
|
||||
}
|
||||
|
||||
stamp stamp_fresh_large(void)
|
||||
{
|
||||
return (check3(++count3));
|
||||
}
|
||||
|
||||
stamp stamp_string(const char *str) deletes
|
||||
{
|
||||
long st;
|
||||
assert(str_hash != NULL);
|
||||
|
||||
if (! hash_table_lookup(str_hash,(hash_key)str, (void *)(char *) &st))
|
||||
{
|
||||
st = stamp_fresh();
|
||||
(void)hash_table_insert(str_hash,(hash_key)str,(hash_data) st);
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
void stamp_reset(void) deletes
|
||||
{
|
||||
count1 = INITIAL1;
|
||||
count2 = INITIAL2;
|
||||
count3 = INITIAL3;
|
||||
hash_table_reset(str_hash);
|
||||
deleteregion_ptr(&str_hash_rgn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stamp_init(void)
|
||||
{
|
||||
str_hash_rgn = newregion();
|
||||
str_hash = make_string_hash_table(str_hash_rgn,INITIAL_SIZE,FALSE);
|
||||
|
||||
}
|
||||
#if 0
|
||||
const char *stamp_to_str(region r,stamp st)
|
||||
{
|
||||
return inttostr(r,st);
|
||||
}
|
||||
#endif
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STAMP_H
|
||||
#define STAMP_H
|
||||
|
||||
#include <regions.h>
|
||||
#include "linkage.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef long stamp;
|
||||
|
||||
stamp stamp_fresh(void);
|
||||
stamp stamp_fresh_small(void);
|
||||
stamp stamp_fresh_large(void);
|
||||
|
||||
stamp stamp_string(const char *) deletes;
|
||||
|
||||
const char *stamp_to_str(region r,stamp st);
|
||||
|
||||
void stamp_reset(void) deletes;
|
||||
void stamp_init(void);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* STAMP_H */
|
||||
|
||||
|
||||
|
@ -1,291 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <regions.h>
|
||||
#include <assert.h>
|
||||
#include <ansidecl.h>
|
||||
#include "term-sort.h"
|
||||
|
||||
struct term_constant_ /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
char *name;
|
||||
};
|
||||
|
||||
typedef struct term_constant_ *term_constant_;
|
||||
|
||||
region term_sort_region;
|
||||
term_hash term_sort_hash;
|
||||
bool flag_occurs_check = FALSE;
|
||||
|
||||
struct term_stats term_stats;
|
||||
|
||||
stamp term_get_stamp(gen_e e)
|
||||
{
|
||||
if ( ((gen_term)e)->type == VAR_TYPE )
|
||||
return ((gen_term)term_get_ecr(e))->st;
|
||||
else
|
||||
return ((gen_term)e)->st;
|
||||
}
|
||||
|
||||
gen_e term_fresh(const char *name)
|
||||
{
|
||||
term_stats.fresh++;
|
||||
return (gen_e)tv_fresh(term_sort_region,name);
|
||||
}
|
||||
|
||||
gen_e term_fresh_large(const char *name)
|
||||
{
|
||||
term_stats.fresh_large++;
|
||||
return (gen_e)tv_fresh_large(term_sort_region,name);
|
||||
}
|
||||
|
||||
gen_e term_fresh_small(const char *name)
|
||||
{
|
||||
term_stats.fresh_small++;
|
||||
return (gen_e)tv_fresh_small(term_sort_region,name);
|
||||
}
|
||||
|
||||
|
||||
#ifdef NONSPEC
|
||||
static struct gen_term zero = {ZERO_TYPE,term_sort,ZERO_TYPE};
|
||||
static struct gen_term one = {ONE_TYPE,term_sort,ONE_TYPE};
|
||||
#else
|
||||
static struct gen_term zero = {ZERO_TYPE,ZERO_TYPE};
|
||||
static struct gen_term one = {ONE_TYPE,ONE_TYPE};
|
||||
#endif /* NONSPEC */
|
||||
|
||||
gen_e term_zero(void)
|
||||
{
|
||||
return (gen_e)&zero;
|
||||
}
|
||||
|
||||
gen_e term_one(void)
|
||||
{
|
||||
return (gen_e)&one;
|
||||
}
|
||||
|
||||
|
||||
gen_e term_constant(const char *str)
|
||||
{
|
||||
stamp st[2];
|
||||
gen_e result;
|
||||
char *name = rstrdup(term_sort_region,str);
|
||||
|
||||
assert (str != NULL);
|
||||
|
||||
st[0] = CONSTANT_TYPE;
|
||||
st[1] = stamp_string(name);
|
||||
|
||||
if ( (result = term_hash_find(term_sort_hash,st,2)) == NULL)
|
||||
{
|
||||
term_constant_ c = ralloc(term_sort_region, struct term_constant_);
|
||||
c->type = CONSTANT_TYPE;
|
||||
c->st = stamp_fresh();
|
||||
c->name = name;
|
||||
|
||||
result = (gen_e) c;
|
||||
term_hash_insert(term_sort_hash,result,st,2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool term_is_bottom(gen_e e)
|
||||
{
|
||||
return (term_is_zero(e) || term_is_var(e));
|
||||
}
|
||||
|
||||
bool term_is_zero(gen_e e)
|
||||
{
|
||||
return ( ((gen_term)term_get_ecr(e))->type == ZERO_TYPE);
|
||||
}
|
||||
|
||||
bool term_is_one(gen_e e)
|
||||
{
|
||||
return ( ((gen_term)term_get_ecr(e))->type == ONE_TYPE);
|
||||
}
|
||||
|
||||
bool term_is_var(gen_e e)
|
||||
{
|
||||
return ( ((gen_term)term_get_ecr(e))->type == VAR_TYPE);
|
||||
}
|
||||
|
||||
bool term_is_constant(gen_e e)
|
||||
{
|
||||
return ( ((gen_term)term_get_ecr(e))->type == CONSTANT_TYPE);
|
||||
}
|
||||
|
||||
char *term_get_constant_name(gen_e e)
|
||||
{
|
||||
gen_e ecr = term_get_ecr(e);
|
||||
if(! term_is_constant(ecr))
|
||||
return NULL;
|
||||
else
|
||||
return ((term_constant_)ecr)->name;
|
||||
}
|
||||
|
||||
gen_e term_get_ecr(gen_e e)
|
||||
{
|
||||
if (((gen_term)e)->type == VAR_TYPE)
|
||||
return tv_get_ecr((term_var)e);
|
||||
else return e;
|
||||
}
|
||||
|
||||
static void fire_pending(term_var v, gen_e e,
|
||||
con_match_fn_ptr con_match,
|
||||
occurs_check_fn_ptr occurs)
|
||||
{
|
||||
gen_e_list_scanner scan;
|
||||
gen_e temp;
|
||||
|
||||
gen_e_list_scan(tv_get_pending(v),&scan);
|
||||
while (gen_e_list_next(&scan,&temp))
|
||||
{
|
||||
term_unify(con_match,occurs,temp,e);
|
||||
}
|
||||
}
|
||||
|
||||
static bool eq(gen_e e1, gen_e e2)
|
||||
{
|
||||
return term_get_ecr(e1) == term_get_ecr(e2);
|
||||
}
|
||||
|
||||
void term_unify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
|
||||
gen_e a, gen_e b)
|
||||
{
|
||||
gen_e e1 = term_get_ecr(a),
|
||||
e2 = term_get_ecr(b);
|
||||
|
||||
if ( eq(e1,e2) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (term_is_constant(e1) && term_is_constant(e2))
|
||||
{
|
||||
failure("Inconsistent system of constraints\n");
|
||||
}
|
||||
else if (term_is_var(e1))
|
||||
{
|
||||
term_var v = (term_var)e1;
|
||||
|
||||
|
||||
if (! term_is_bottom(e2))
|
||||
fire_pending(v,e2,con_match,occurs);
|
||||
|
||||
if (term_is_var(e2))
|
||||
tv_unify_vars(v,(term_var)e2);
|
||||
else /* v = e2, e2 is not a var */
|
||||
{
|
||||
if (occurs(v,e2))
|
||||
failure("Unify terms: occurs check failed\n");
|
||||
tv_unify(v,e2);
|
||||
}
|
||||
}
|
||||
else if (term_is_var(e2))
|
||||
{
|
||||
term_var v = (term_var)e2;
|
||||
|
||||
if (! term_is_bottom(e2))
|
||||
fire_pending(v,e1,con_match,occurs);
|
||||
|
||||
/* v = e1, e1 is not a var */
|
||||
if (occurs(v,e1))
|
||||
failure("Unify terms: occurs check failed\n");
|
||||
tv_unify(v,e1);
|
||||
|
||||
}
|
||||
else con_match(e1,e2);
|
||||
}
|
||||
|
||||
void term_cunify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
|
||||
gen_e e1, gen_e e2)
|
||||
{
|
||||
if (term_is_bottom(e1) && term_is_var(e1))
|
||||
{
|
||||
term_var v1 = (term_var)e1;
|
||||
tv_add_pending(v1,e2);
|
||||
}
|
||||
else
|
||||
{
|
||||
term_unify(con_match,occurs,e1,e2);
|
||||
}
|
||||
}
|
||||
|
||||
static void term_reset_stats(void)
|
||||
{
|
||||
term_stats.fresh = 0;
|
||||
term_stats.fresh_small = 0;
|
||||
term_stats.fresh_large = 0;
|
||||
}
|
||||
|
||||
void term_print_stats(FILE *f)
|
||||
{
|
||||
fprintf(f,"\n========== Term Var Stats ==========\n");
|
||||
fprintf(f,"Fresh : %d\n",term_stats.fresh);
|
||||
fprintf(f,"Fresh Small : %d\n",term_stats.fresh_small);
|
||||
fprintf(f,"Fresh Large : %d\n",term_stats.fresh_large);
|
||||
fprintf(f,"=====================================\n");
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
void term_print_constraint_graph(FILE *f ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void term_init(void)
|
||||
{
|
||||
term_sort_region = newregion();
|
||||
term_sort_hash = make_term_hash(term_sort_region);
|
||||
}
|
||||
|
||||
void term_reset(void)
|
||||
{
|
||||
term_hash_delete(term_sort_hash);
|
||||
deleteregion_ptr(&term_sort_region);
|
||||
|
||||
term_reset_stats();
|
||||
|
||||
term_sort_region = newregion();
|
||||
term_sort_hash = make_term_hash(term_sort_region);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TERM_SORT_H
|
||||
#define TERM_SORT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "banshee.h"
|
||||
#include "termhash.h"
|
||||
#include "term-var.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
extern bool flag_occurs_check;
|
||||
extern region term_sort_region;
|
||||
extern term_hash term_sort_hash;
|
||||
|
||||
struct gen_term /* extends gen_e */
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
const sort_kind sort;
|
||||
#endif
|
||||
const int type;
|
||||
const stamp st;
|
||||
};
|
||||
|
||||
typedef struct gen_term *gen_term;
|
||||
|
||||
/* return TRUE if v occurs in e, fals otherwise */
|
||||
typedef bool (* occurs_check_fn_ptr) (term_var v, gen_e e);
|
||||
|
||||
stamp term_get_stamp(gen_e e);
|
||||
|
||||
gen_e term_fresh(const char *name);
|
||||
gen_e term_fresh_large(const char *name);
|
||||
gen_e term_fresh_small(const char *name);
|
||||
gen_e term_zero(void);
|
||||
gen_e term_one(void);
|
||||
gen_e term_constant(const char *name);
|
||||
|
||||
bool term_is_zero(gen_e e);
|
||||
bool term_is_one(gen_e e);
|
||||
bool term_is_var(gen_e e);
|
||||
bool term_is_constant(gen_e e);
|
||||
|
||||
char *term_get_constant_name(gen_e e);
|
||||
gen_e term_get_ecr(gen_e e);
|
||||
|
||||
void term_unify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
|
||||
gen_e e1, gen_e e2);
|
||||
void term_cunify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
|
||||
gen_e e1, gen_e e2);
|
||||
|
||||
void term_print_stats(FILE *f);
|
||||
void term_print_constraint_graph(FILE *f);
|
||||
|
||||
void term_init(void);
|
||||
void term_reset(void);
|
||||
|
||||
extern struct term_stats term_stats;
|
||||
|
||||
struct term_stats
|
||||
{
|
||||
int fresh;
|
||||
int fresh_small;
|
||||
int fresh_large;
|
||||
};
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* TERM_SORT_H */
|
||||
|
||||
|
||||
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <regions.h>
|
||||
#include <assert.h>
|
||||
#include "ufind.h"
|
||||
#include "term-var.h"
|
||||
|
||||
DECLARE_UFIND(tv_elt,gen_e)
|
||||
|
||||
DEFINE_UFIND(tv_elt,gen_e)
|
||||
|
||||
DEFINE_LIST(term_var_list,term_var)
|
||||
|
||||
struct term_var
|
||||
{
|
||||
#ifdef NONSPEC
|
||||
sort_kind sort;
|
||||
#endif
|
||||
int type;
|
||||
stamp st;
|
||||
gen_e_list pending;
|
||||
const char *name;
|
||||
tv_elt elt;
|
||||
};
|
||||
|
||||
static term_var make_var(region r, const char *name, stamp st)
|
||||
{
|
||||
term_var result = ralloc(r, struct term_var);
|
||||
gen_e info = (gen_e) result;
|
||||
|
||||
result->type = VAR_TYPE;
|
||||
result->st = st;
|
||||
result->pending = new_gen_e_list(r);
|
||||
result->name = name ? rstrdup(r,name) : "fv";
|
||||
result->elt = new_tv_elt(r,info);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
term_var tv_fresh(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh());
|
||||
}
|
||||
|
||||
term_var tv_fresh_small(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_small());
|
||||
}
|
||||
|
||||
term_var tv_fresh_large(region r, const char *name)
|
||||
{
|
||||
return make_var(r,name,stamp_fresh_large());
|
||||
}
|
||||
|
||||
static term_var tv_get_v_ecr(term_var v)
|
||||
{
|
||||
term_var ecr = (term_var)tv_get_ecr(v);
|
||||
assert (ecr->type == VAR_TYPE); /* this is a hack, but should be ok */
|
||||
|
||||
return ecr;
|
||||
}
|
||||
|
||||
const char *tv_get_name(term_var v)
|
||||
{
|
||||
return tv_get_v_ecr(v)->name;
|
||||
}
|
||||
|
||||
gen_e_list tv_get_pending(term_var v)
|
||||
{
|
||||
return tv_get_v_ecr(v)->pending;
|
||||
}
|
||||
|
||||
void tv_add_pending(term_var v,gen_e e)
|
||||
{
|
||||
gen_e_list_cons(e,tv_get_v_ecr(v)->pending);
|
||||
}
|
||||
|
||||
void tv_unify(term_var v, gen_e e)
|
||||
{
|
||||
tv_elt_update(v->elt,e);
|
||||
|
||||
assert(tv_get_ecr(v) == e);
|
||||
}
|
||||
|
||||
static gen_e tv_combine(gen_e e1, gen_e e2)
|
||||
{
|
||||
term_var v1 = (term_var)e1,
|
||||
v2 = (term_var)e2;
|
||||
|
||||
if (! (v1 == v2) )
|
||||
gen_e_list_append(tv_get_pending(v1), tv_get_pending(v2));
|
||||
|
||||
return e1;
|
||||
}
|
||||
|
||||
void tv_unify_vars(term_var v1, term_var v2)
|
||||
{
|
||||
tv_elt_unify(tv_combine,v1->elt, v2->elt);
|
||||
}
|
||||
|
||||
gen_e tv_get_ecr(term_var v)
|
||||
{
|
||||
return tv_elt_get_info(v->elt);
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TERM_VAR_H
|
||||
#define TERM_VAR_H
|
||||
|
||||
#include "linkage.h"
|
||||
#include "banshee.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef struct term_var *term_var;
|
||||
|
||||
DECLARE_LIST(term_var_list,term_var)
|
||||
|
||||
term_var tv_fresh(region r, const char *name);
|
||||
term_var tv_fresh_small(region r, const char *name);
|
||||
term_var tv_fresh_large(region r, const char *name);
|
||||
|
||||
const char *tv_get_name(term_var v);
|
||||
|
||||
gen_e_list tv_get_pending(term_var v);
|
||||
void tv_add_pending(term_var v,gen_e e);
|
||||
|
||||
void tv_unify(term_var v, gen_e e);
|
||||
void tv_unify_vars(term_var v1, term_var v2);
|
||||
|
||||
gen_e tv_get_ecr(term_var v);
|
||||
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* TERM_VAR_H */
|
@ -1,262 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "termhash.h"
|
||||
#include "hash.h"
|
||||
#include "termhash.h"
|
||||
#include "util.h"
|
||||
|
||||
#define UB(n) ((1<<n)-1)
|
||||
#define CAP(n) (1<<n)
|
||||
#define INITIAL_TABLE_SIZE 8 /* the initial table size is 2^8 */
|
||||
|
||||
/* An individual entry in the table consists of an array of stamps */
|
||||
/* (same arity as the expr's constructor) in addition to the expr */
|
||||
/* itself. */
|
||||
typedef struct hash_entry *hash_entry;
|
||||
|
||||
/* A term_bucket is a list of entries (an list of exprs that have */
|
||||
/* collided after hashing) */
|
||||
typedef struct term_bucket *term_bucket;
|
||||
|
||||
struct hash_entry
|
||||
{
|
||||
int length;
|
||||
stamp *stamps;
|
||||
gen_e e;
|
||||
};
|
||||
|
||||
struct term_bucket
|
||||
{
|
||||
hash_entry entry;
|
||||
struct term_bucket *next;
|
||||
};
|
||||
|
||||
#define scan_term_bucket(b,var) for(var = b; var; var = var->next)
|
||||
|
||||
/* size: initial_table_size + number of rehashes */
|
||||
/* capacity: 2^size (for array size) */
|
||||
/* ub: 2^size-1 (for array indexing) */
|
||||
/* inserts: num of elements inserted into the array */
|
||||
struct term_hash
|
||||
{
|
||||
term_bucket * term_buckets;
|
||||
region rgn;
|
||||
int ub;
|
||||
int size;
|
||||
int capacity;
|
||||
int inserts;
|
||||
};
|
||||
|
||||
static int hash(int ub, stamp stamps[], int len);
|
||||
static void post_insert(term_hash tab) deletes;
|
||||
static void rehash(term_hash tab) deletes;
|
||||
static void reinsert(term_hash tab, term_bucket b);
|
||||
static void insert(term_hash tab, gen_e e, stamp * stamps, int len);
|
||||
static void insert_entry(term_hash tab, struct hash_entry *entry);
|
||||
static gen_e walk(term_bucket b, stamp * stamps, int len);
|
||||
|
||||
static const int primes[] =
|
||||
{ 83, 1789, 5189, 5449, 5659, 6703, 7517, 7699, 8287, 8807, 9067, 9587,
|
||||
10627, 10939, 11239};
|
||||
/*
|
||||
static const int prime_1 = 83;
|
||||
static const int prime_2 = 1789;
|
||||
*/
|
||||
static const int initial_table_size = INITIAL_TABLE_SIZE;
|
||||
|
||||
term_hash make_term_hash(region rgn)
|
||||
{
|
||||
int ub, n;
|
||||
int i;
|
||||
|
||||
region r;
|
||||
|
||||
term_hash tab = ralloc(rgn, struct term_hash);
|
||||
|
||||
r = newregion();
|
||||
ub = UB(initial_table_size);
|
||||
n = CAP(initial_table_size);
|
||||
|
||||
|
||||
tab->term_buckets = rarrayalloc(r, n, term_bucket);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
tab->term_buckets[i] = NULL;
|
||||
}
|
||||
|
||||
tab->rgn = r;
|
||||
tab->ub = ub;
|
||||
tab->size = initial_table_size;
|
||||
tab->capacity = n;
|
||||
tab->inserts = 0;
|
||||
return tab;
|
||||
}
|
||||
|
||||
void term_hash_delete(term_hash tab) deletes
|
||||
{
|
||||
deleteregion(tab->rgn);
|
||||
}
|
||||
|
||||
gen_e term_hash_find(term_hash tab, stamp stamps[], int len)
|
||||
{
|
||||
int hash_val;
|
||||
|
||||
term_bucket b;
|
||||
hash_val = hash(tab->ub, stamps, len);
|
||||
b = tab->term_buckets[hash_val];
|
||||
return walk(b, stamps, len);
|
||||
}
|
||||
|
||||
static gen_e walk(term_bucket b, stamp stamps[], int len)
|
||||
{
|
||||
term_bucket cur;
|
||||
scan_term_bucket(b,cur)
|
||||
{
|
||||
if (len == cur->entry->length
|
||||
&& (memcmp(stamps, cur->entry->stamps, sizeof(int)*len) == 0) )
|
||||
return cur->entry->e;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Should call t_hash_find to see if a gen_e with the given stamp */
|
||||
/* signature is already in the table. If so, insert should return */
|
||||
/* true and do nothing. */
|
||||
bool term_hash_insert(term_hash tab, gen_e e, stamp * stamps, int len) deletes
|
||||
{
|
||||
if (term_hash_find(tab, stamps, len) != NULL)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
insert(tab, e, stamps, len);
|
||||
post_insert(tab);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Insert an expression e represented by the given stamp array into */
|
||||
/* the hash table. */
|
||||
static void insert(term_hash tab, gen_e e, stamp stamps[], int len)
|
||||
{
|
||||
hash_entry entry;
|
||||
stamp * stamp_cpy;
|
||||
int i;
|
||||
|
||||
|
||||
entry = ralloc(tab->rgn, struct hash_entry);
|
||||
|
||||
stamp_cpy = rarrayalloc(tab->rgn, len, stamp);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
stamp_cpy[i] = stamps[i];
|
||||
}
|
||||
|
||||
entry->length = len;
|
||||
entry->stamps = stamp_cpy;
|
||||
entry->e = e;
|
||||
insert_entry(tab, entry);
|
||||
}
|
||||
|
||||
static void insert_entry(term_hash tab, hash_entry entry)
|
||||
{
|
||||
int hash_val;
|
||||
|
||||
term_bucket b, new_term_bucket;
|
||||
hash_val = hash(tab->ub, entry->stamps, entry->length);
|
||||
b = tab->term_buckets[hash_val];
|
||||
new_term_bucket = ralloc(tab->rgn, struct term_bucket);
|
||||
|
||||
new_term_bucket->entry = entry;
|
||||
new_term_bucket->next = b;
|
||||
tab->term_buckets[hash_val] = new_term_bucket;
|
||||
}
|
||||
|
||||
static void post_insert(term_hash tab) deletes
|
||||
{
|
||||
if (tab->capacity == ++tab->inserts)
|
||||
{
|
||||
rehash(tab);
|
||||
}
|
||||
}
|
||||
|
||||
/* Double the size of the hash table and reinsert all of the elements. */
|
||||
static void rehash(term_hash tab) deletes
|
||||
{
|
||||
region old_rgn;
|
||||
term_bucket * old_term_buckets;
|
||||
int i;
|
||||
int old_table_size = tab->capacity;
|
||||
|
||||
old_term_buckets = tab->term_buckets;
|
||||
tab->capacity *= 2;
|
||||
tab->ub = UB(++tab->size);
|
||||
old_rgn = tab->rgn;
|
||||
tab->rgn = newregion();
|
||||
|
||||
|
||||
tab->term_buckets = rarrayalloc(tab->rgn, tab->capacity, term_bucket);
|
||||
for (i = 0; i < old_table_size; i++)
|
||||
{
|
||||
if (old_term_buckets[i] != NULL && old_term_buckets[i]->entry != NULL)
|
||||
reinsert(tab, old_term_buckets[i]);
|
||||
}
|
||||
|
||||
deleteregion(old_rgn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void reinsert(term_hash tab, term_bucket b)
|
||||
{
|
||||
term_bucket cur;
|
||||
scan_term_bucket(b,cur)
|
||||
insert(tab, cur->entry->e, cur->entry->stamps, cur->entry->length);
|
||||
}
|
||||
|
||||
static int hash(int ub, stamp stamps[], int len)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
n = (n + (primes[i % 15] * abs(stamps[i]))) & ub;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TERMHASH_H
|
||||
#define TERMHASH_H
|
||||
|
||||
#include "banshee.h"
|
||||
#include "stamp.h"
|
||||
#include "bool.h"
|
||||
|
||||
typedef struct term_hash *term_hash;
|
||||
|
||||
term_hash make_term_hash(region r);
|
||||
|
||||
gen_e term_hash_find(term_hash h, stamp *st,int length);
|
||||
|
||||
bool term_hash_insert(term_hash h, gen_e e, stamp *st, int length) deletes;
|
||||
|
||||
void term_hash_delete(term_hash h) deletes;
|
||||
|
||||
#endif /* TERMHASH_H */
|
@ -1,177 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ufind.h"
|
||||
#include "assert.h"
|
||||
|
||||
|
||||
enum uf_type {uf_ecr,uf_link};
|
||||
typedef enum uf_type uf_type;
|
||||
|
||||
struct uf_element
|
||||
{
|
||||
uf_type type;
|
||||
int rank;
|
||||
void *info;
|
||||
struct uf_element *link;
|
||||
};
|
||||
|
||||
struct uf_element *new_uf_element(region r, void *info)
|
||||
{
|
||||
struct uf_element *result;
|
||||
|
||||
result = ralloc(r, struct uf_element);
|
||||
|
||||
result->type = uf_ecr;
|
||||
result->rank = 0;
|
||||
result->info = info;
|
||||
result->link = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct uf_element *find(struct uf_element *e)
|
||||
{
|
||||
|
||||
if (e->type == uf_ecr)
|
||||
return e;
|
||||
|
||||
else if (e->link->type == uf_link)
|
||||
{
|
||||
struct uf_element *temp = e->link;
|
||||
|
||||
e->link = e->link->link;
|
||||
|
||||
return find(temp);
|
||||
}
|
||||
|
||||
else
|
||||
return e->link;
|
||||
}
|
||||
|
||||
bool uf_union(struct uf_element *a, struct uf_element *b)
|
||||
{
|
||||
struct uf_element *e1 = find(a);
|
||||
struct uf_element *e2 = find(b);
|
||||
|
||||
if ( e1 == e2 )
|
||||
return FALSE;
|
||||
|
||||
else if (e1->rank < e2->rank)
|
||||
{
|
||||
e1->type = uf_link;
|
||||
e1->link = e2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (e1->rank > e2->rank)
|
||||
{
|
||||
e2->type = uf_link;
|
||||
e2->link = e1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
e2->rank++;
|
||||
|
||||
e1->type = uf_link;
|
||||
e1->link = e2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool uf_unify(combine_fn_ptr combine,
|
||||
struct uf_element *a, struct uf_element *b)
|
||||
{
|
||||
struct uf_element *e1 = find(a);
|
||||
struct uf_element *e2 = find(b);
|
||||
|
||||
if ( e1 == e2 )
|
||||
return FALSE;
|
||||
|
||||
else if (e1->rank < e2->rank)
|
||||
{
|
||||
e2->info = combine(e2->info,e1->info);
|
||||
e1->type = uf_link;
|
||||
e1->link = e2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (e1->rank > e2->rank)
|
||||
{
|
||||
e1->info = combine(e1->info,e2->info);
|
||||
e2->type = uf_link;
|
||||
e2->link = e1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
e2->info = combine(e2->info, e1->info);
|
||||
|
||||
e2->rank++;
|
||||
e1->type = uf_link;
|
||||
e1->link = e2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *uf_get_info(struct uf_element *e)
|
||||
{
|
||||
return find(e)->info;
|
||||
}
|
||||
|
||||
|
||||
bool uf_eq(struct uf_element *e1,struct uf_element *e2)
|
||||
{
|
||||
return (find(e1) == find(e2));
|
||||
}
|
||||
|
||||
void uf_update(struct uf_element *e,uf_info i)
|
||||
{
|
||||
find(e)->info = i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UFIND_H
|
||||
#define UFIND_H
|
||||
|
||||
#include <regions.h>
|
||||
#include "linkage.h"
|
||||
#include "bool.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
struct uf_element;
|
||||
|
||||
typedef struct uf_element *uf_element;
|
||||
typedef void *uf_info;
|
||||
|
||||
typedef uf_info (*combine_fn_ptr)(uf_info,uf_info);
|
||||
|
||||
struct uf_element *new_uf_element(region r,uf_info i);
|
||||
uf_info uf_get_info(struct uf_element *);
|
||||
bool uf_unify(combine_fn_ptr,struct uf_element *,struct uf_element *);
|
||||
bool uf_union(struct uf_element *,struct uf_element *);
|
||||
bool uf_eq(struct uf_element *,struct uf_element *);
|
||||
void uf_update(struct uf_element *,uf_info i);
|
||||
|
||||
#define DECLARE_UFIND(name,type) \
|
||||
typedef struct name *name; \
|
||||
typedef type (* name ## _combine_fn_ptr)(type info1,type info2); \
|
||||
name new_ ## name(region r, type info); \
|
||||
type name ## _get_info(name); \
|
||||
bool name ## _unify(name ## _combine_fn_ptr,name e1, name e2); \
|
||||
bool name ## _union(name e1, name e2); \
|
||||
bool name ## _eq(name e1, name e2); \
|
||||
void name ## _update(name e1, type info);
|
||||
|
||||
#define DEFINE_UFIND(name,type) \
|
||||
name new_ ## name(region r, type info) \
|
||||
{ \
|
||||
return (name)new_uf_element(r,info);\
|
||||
}\
|
||||
type name ## _get_info(name elem) \
|
||||
{ \
|
||||
return (type)uf_get_info((struct uf_element *)elem);\
|
||||
} \
|
||||
bool name ## _unify(name ## _combine_fn_ptr cmb,name e1, name e2) \
|
||||
{ \
|
||||
return uf_unify((combine_fn_ptr)cmb,(struct uf_element *)e1,(struct uf_element *)e2); \
|
||||
} \
|
||||
bool name ## _union(name e1, name e2) \
|
||||
{ \
|
||||
return uf_union((struct uf_element *)e1,(struct uf_element *)e2); \
|
||||
}\
|
||||
bool name ## _eq(name e1, name e2) \
|
||||
{ \
|
||||
return uf_eq((struct uf_element *)e1,(struct uf_element *)e2); \
|
||||
} \
|
||||
void name ##_update(name e1, type info) \
|
||||
{ \
|
||||
uf_update((struct uf_element *)e1,(uf_info)info); \
|
||||
} \
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* UFIND_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,194 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "buffer.h"
|
||||
#include "util.h"
|
||||
|
||||
/* Panic with a message */
|
||||
static void vfail(const char *fmt, va_list args) __attribute__((__noreturn__));
|
||||
|
||||
static void vfail(const char *fmt, va_list args)
|
||||
{
|
||||
vfprintf(stderr, fmt, args);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
abort();
|
||||
while (1); /* Work around stupid gcc-2.96-85 bug */
|
||||
}
|
||||
|
||||
/* Panic with a nice message */
|
||||
void __fail(const char *file, unsigned int line,
|
||||
const char *func __attribute__((unused)),
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "\n%s:%u ", file, line);
|
||||
vfail(fmt, args);
|
||||
}
|
||||
|
||||
#ifndef HAVE_VARIADIC_MACROS
|
||||
/* Panic with a not-quite-as-nice message */
|
||||
void fail(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfail(fmt, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
void failure(const char *message)
|
||||
{
|
||||
fprintf(stderr,message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Concatenate 2 strings, allocating space in r for the result */
|
||||
char *rstrcat(region r, const char *s1, const char *s2)
|
||||
{
|
||||
char *result = rarrayalloc(r, strlen(s1)+strlen(s2)+1, char);
|
||||
result[0] = '\0';
|
||||
strcat(result, s1);
|
||||
strcat(result, s2);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Concatenate n strings, allocating space in r for the result. The
|
||||
last argument should be a null pointer. */
|
||||
char *rstrscat(region r, ...)
|
||||
{
|
||||
char *result;
|
||||
int len = 0;
|
||||
const char *s;
|
||||
va_list args;
|
||||
|
||||
va_start(args, r);
|
||||
while ((s = va_arg(args, const char *)))
|
||||
len += strlen(s);
|
||||
result = rarrayalloc(r, len+1, char);
|
||||
result[0] = '\0';
|
||||
|
||||
va_start(args, r);
|
||||
while ((s = va_arg(args, const char *)))
|
||||
strcat(result, s);
|
||||
|
||||
return result;
|
||||
}
|
||||
#if 0
|
||||
/* Convert an integer to a string, storing the result in r */
|
||||
const char *inttostr(region r, int i)
|
||||
{
|
||||
char *result;
|
||||
int width;
|
||||
|
||||
if (i == 0)
|
||||
width = 1;
|
||||
else
|
||||
width = (int) (floor(log10(abs((double) i))) + 1);
|
||||
if (i<0) width++;
|
||||
|
||||
printf("i=%d, width=%d\n", i, width);
|
||||
assert(width >0);
|
||||
|
||||
result = rarrayalloc(r, width + 1, char);
|
||||
if (snprintf(result, width + 1, "%d", i) == -1) {
|
||||
printf("i=%d, width=%d\n", i, width);
|
||||
fail ("inttostr width wrong\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* sprintf a string, allocating space in r for the result */
|
||||
char *rsprintf(region r, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
return rvsprintf(r, fmt, args);
|
||||
}
|
||||
|
||||
char *rvsprintf(region r, const char *fmt, va_list args)
|
||||
{
|
||||
growbuf buf = growbuf_new(r, 100);
|
||||
gvprintf(buf, fmt, args);
|
||||
return growbuf_contents(buf);
|
||||
}
|
||||
|
||||
/* Space for the ASCII representation of a pointer -- 2 hex chars per
|
||||
byte, plus 3 chars for 0x prefix and trailing \0 */
|
||||
#define PTR_ASCII_SIZE ((int) (3 + sizeof(void *)*2))
|
||||
|
||||
/* Convert a pointer to an ascii string with leading 0x. Re-uses
|
||||
internal buffer. */
|
||||
char *ptr_to_ascii(void *ptr) {
|
||||
static char addr[PTR_ASCII_SIZE];
|
||||
int nchars;
|
||||
|
||||
nchars = snprintf(addr, PTR_ASCII_SIZE, "%p", ptr);
|
||||
if (nchars == -1 || nchars >= PTR_ASCII_SIZE)
|
||||
fail("Unable to convert ptr to ascii (need %d bytes, have %d)\n",
|
||||
nchars, PTR_ASCII_SIZE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Convert a pointer to an integer */
|
||||
long ptr_hash(void *ptr)
|
||||
{
|
||||
return (long) ptr;
|
||||
}
|
||||
|
||||
/* Return TRUE iff ptr1 == ptr2 */
|
||||
bool ptr_eq(void *ptr1, void *ptr2)
|
||||
{
|
||||
return ptr1 == ptr2;
|
||||
}
|
||||
|
||||
/* Return TRUE iff s1 == s2 */
|
||||
bool str_eq(const char *s1, const char *s2)
|
||||
{
|
||||
return (strcmp(s1, s2) == 0);
|
||||
}
|
||||
|
||||
/* A total ordering on pointers. Returns 0 if ptr1 = ptr2, a value <0
|
||||
if ptr1 < ptr2, or a value >0 if ptr1 > ptr2. */
|
||||
int ptr_cmp(const void *ptr1, const void *ptr2)
|
||||
{
|
||||
return (char *) ptr1 - (char *) ptr2;
|
||||
}
|
||||
|
||||
/* int abs(int a) { if (a < 0) return -a; else return a; } */
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <regions.h>
|
||||
#include <ansidecl.h>
|
||||
#include "compiler.h"
|
||||
#include "linkage.h"
|
||||
#include "bool.h"
|
||||
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#ifdef HAVE_VARIADIC_MACROS
|
||||
#define fail(args...) __fail(__FILE__, __LINE__, __FUNCTION__, args)
|
||||
#else
|
||||
void fail(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
void __fail(const char *file, unsigned int line,
|
||||
const char *func, const char *fmt, ...) __attribute__ ((__noreturn__));
|
||||
|
||||
|
||||
/* insist(action) is like assert(action), but action may have
|
||||
side-effects */
|
||||
#ifdef NDEBUG
|
||||
# define insist(action) (action)
|
||||
#else
|
||||
# define insist assert
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
# define insistnot(action) (action)
|
||||
#else
|
||||
# define insistnot(action) assert(!(action))
|
||||
#endif
|
||||
|
||||
void failure(const char *message);
|
||||
|
||||
/* Concatenate 2 strings, allocating space in r for the result */
|
||||
char *rstrcat(region, const char *, const char *);
|
||||
|
||||
/* Concatenate n strings, allocating space in r for the result. The
|
||||
last argument should be a null pointer. */
|
||||
char *rstrscat(region, ...);
|
||||
|
||||
/* Convert an integer to a string, storing the result in r */
|
||||
const char *inttostr(region r, int);
|
||||
|
||||
/* sprintf a string, allocating space in r for the result */
|
||||
char *rsprintf(region r, const char *fmt, ...);
|
||||
char *rvsprintf(region r, const char *fmt, va_list args);
|
||||
|
||||
/* Convert a pointer to an ascii string with leading 0x. Re-uses
|
||||
internal buffer. */
|
||||
char *ptr_to_ascii(void *ptr);
|
||||
|
||||
/* Convert a pointer to an integer */
|
||||
long ptr_hash(void *ptr);
|
||||
|
||||
/* Return TRUE iff ptr1 == ptr2 */
|
||||
bool ptr_eq(void *ptr1, void *ptr2);
|
||||
|
||||
/* Return TRUE iff s1 == s2 */
|
||||
bool str_eq(const char *s1, const char *s2);
|
||||
|
||||
/* A total ordering on pointers. Returns 0 if ptr1 = ptr2, a value <0
|
||||
if ptr1 < ptr2, or a value >0 if ptr1 > ptr2. */
|
||||
int ptr_cmp(const void *ptr1, const void *ptr2);
|
||||
|
||||
static inline int min(int a, int b) { if (a < b) return a; else return b; }
|
||||
static inline int max(int a, int b) { if (a < b) return b; else return a; }
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
AM_CFLAGS = -I$(srcdir)/../engine -I$(srcdir)/../include -I. -Ddeletes= -Dtraditional= -Dsameregion= -Dparentptr= @ac_libbanshee_warn_cflags@
|
||||
noinst_LIBRARIES = libbansheecompat.a
|
||||
libbansheecompat_a_SOURCES = regions.c radix-tree.c
|
||||
|
@ -1,379 +0,0 @@
|
||||
# Makefile.in generated by automake 1.8.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
|
||||
SOURCES = $(libbansheecompat_a_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
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 = :
|
||||
subdir = libcompat
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
libbansheecompat_a_AR = $(AR) $(ARFLAGS)
|
||||
libbansheecompat_a_LIBADD =
|
||||
am_libbansheecompat_a_OBJECTS = regions.$(OBJEXT) radix-tree.$(OBJEXT)
|
||||
libbansheecompat_a_OBJECTS = $(am_libbansheecompat_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/../depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/radix-tree.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/regions.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libbansheecompat_a_SOURCES)
|
||||
DIST_SOURCES = $(libbansheecompat_a_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_libbanshee_warn_cflags = @ac_libbanshee_warn_cflags@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
AM_CFLAGS = -I$(srcdir)/../engine -I$(srcdir)/../include -I. -Ddeletes= -Dtraditional= -Dsameregion= -Dparentptr= @ac_libbanshee_warn_cflags@
|
||||
noinst_LIBRARIES = libbansheecompat.a
|
||||
libbansheecompat_a_SOURCES = regions.c radix-tree.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libcompat/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libcompat/Makefile
|
||||
.PRECIOUS: 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__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libbansheecompat.a: $(libbansheecompat_a_OBJECTS) $(libbansheecompat_a_DEPENDENCIES)
|
||||
-rm -f libbansheecompat.a
|
||||
$(libbansheecompat_a_AR) libbansheecompat.a $(libbansheecompat_a_OBJECTS) $(libbansheecompat_a_LIBADD)
|
||||
$(RANLIB) libbansheecompat.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radix-tree.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regions.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$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 $(LIBRARIES)
|
||||
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:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_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-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-info-am
|
||||
|
||||
# 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:
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2001
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/* TBD: recover unusued portions of pages for use as individual pages */
|
||||
|
||||
#include <stddef.h>
|
||||
#include "regions.h"
|
||||
|
||||
static void alloc_block(region r, struct allocator *a, struct ablock *blk,
|
||||
void **p1, int s1, int a1, void **p2, int s2, int a2,
|
||||
size_t blksize, int needsclear)
|
||||
{
|
||||
struct page *newp;
|
||||
char *mem1, *mem2;
|
||||
|
||||
mem1 = PALIGN(blk->allocfrom, a1);
|
||||
mem2 = PALIGN(mem1 + s1, a2);
|
||||
|
||||
/* Can't use last byte of page (pointers to the byte after an object are
|
||||
valid) */
|
||||
if (mem2 + s2 >= blk->base + blksize)
|
||||
{
|
||||
if (blksize == RPAGESIZE)
|
||||
{
|
||||
newp = alloc_single_page(a->pages);
|
||||
a->pages = newp;
|
||||
blk->allocfrom = (char *)newp + offsetof(struct page, previous);
|
||||
set_region(newp, 1, r);
|
||||
}
|
||||
else
|
||||
{
|
||||
newp = alloc_pages(blksize >> RPAGELOG, a->bigpages);
|
||||
a->bigpages = newp;
|
||||
blk->allocfrom = (char *)newp + offsetof(struct page, previous);
|
||||
set_region(newp, blksize >> RPAGELOG, r);
|
||||
}
|
||||
blk->base = (char *)newp;
|
||||
|
||||
if (needsclear)
|
||||
preclear(blk->allocfrom, blksize - (blk->allocfrom - (char *)newp));
|
||||
mem1 = PALIGN(blk->allocfrom, a1);
|
||||
mem2 = PALIGN(mem1 + s1, a2);
|
||||
}
|
||||
|
||||
ASSERT_INUSE(blk->base, r);
|
||||
blk->allocfrom = mem2 + s2;
|
||||
|
||||
*p1 = mem1;
|
||||
*p2 = mem2;
|
||||
}
|
||||
|
||||
void qalloc(region r, struct allocator *a, void **p1, int s1, int a1,
|
||||
void **p2, int s2, int a2, int needsclear)
|
||||
{
|
||||
struct page *p;
|
||||
char *mem;
|
||||
int npages;
|
||||
int n = ALIGN(s1, a2) + s2; /* Yes, this is correct (see alloc_block) */
|
||||
|
||||
if (n <= RPAGESIZE / K)
|
||||
{
|
||||
alloc_block(r, a, &a->page, p1, s1, a1, p2, s2, a2, RPAGESIZE,
|
||||
needsclear);
|
||||
return;
|
||||
}
|
||||
if (n <= RPAGESIZE)
|
||||
{
|
||||
alloc_block(r, a, &a->superpage, p1, s1, a1, p2, s2, a2,
|
||||
K * RPAGESIZE, needsclear);
|
||||
return;
|
||||
}
|
||||
if (n <= RPAGESIZE * K)
|
||||
{
|
||||
alloc_block(r, a, &a->hyperpage, p1, s1, a1, p2, s2, a2,
|
||||
K * K * RPAGESIZE, needsclear);
|
||||
return;
|
||||
}
|
||||
|
||||
npages = (n + ALIGN(offsetof(struct page, previous), a1) + RPAGESIZE - 1)
|
||||
>> RPAGELOG;
|
||||
p = alloc_pages(npages, a->bigpages);
|
||||
a->bigpages = p;
|
||||
set_region(p, npages, r);
|
||||
|
||||
mem = (char *)p + offsetof(struct page, previous);
|
||||
*p1 = PALIGN(mem, a1);
|
||||
*p2 = PALIGN((char *) *p1 + s1, a2);
|
||||
if (needsclear)
|
||||
preclear(*p2, s2);
|
||||
}
|
||||
|
||||
void free_all_pages(region r, struct allocator *a)
|
||||
/* Assumes freepages_lock held */
|
||||
{
|
||||
struct page *p, *next;
|
||||
|
||||
for (p = a->pages; p; p = next)
|
||||
{
|
||||
next = p->next;
|
||||
free_single_page(r, p);
|
||||
}
|
||||
for (p = a->bigpages; p; p = next)
|
||||
{
|
||||
next = p->next;
|
||||
free_pages(r, p);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user