Compare commits

..
Author SHA1 Message Date
Joel E. Denny 72c5b9828e * NEWS (2.3b): Update release date since there has been a delay in
getting the announcements and tarballs out.
2008-05-28 00:28:50 +00:00
Joel E. Denny bd02cd5d3a * NEWS: Version 2.3b.
* configure.ac (AC_INIT): Likewise.
(PACKAGE_COPYRIGHT_YEAR): Update to 2008.
2008-05-23 05:32:11 +00:00
Joel E. Denny 9126263e13 * HACKING: Don't say don't mention HACKING in the ChangeLog. We've
been doing it for years.
(Test suite): Mention maintainer-push-check and maintainer-xml-check.
(Release Procedure): Add FIXME about make alpha being unmaintained.
2008-05-23 04:36:56 +00:00
23 changed files with 488 additions and 560 deletions
+19 -1
View File
@@ -1,3 +1,21 @@
2008-05-27 Joel E. Denny <[email protected]>
* NEWS (2.3b): Update release date since there has been a delay in
getting the announcements and tarballs out.
2008-05-23 Joel E. Denny <[email protected]>
* NEWS: Version 2.3b.
* configure.ac (AC_INIT): Likewise.
(PACKAGE_COPYRIGHT_YEAR): Update to 2008.
2008-05-23 Joel E. Denny <[email protected]>
* HACKING: Don't say don't mention HACKING in the ChangeLog. We've
been doing it for years.
(Test suite): Mention maintainer-push-check and maintainer-xml-check.
(Release Procedure): Add FIXME about make alpha being unmaintained.
2008-05-13 Joel E. Denny <[email protected]>
* data/yacc.c: Reformat m4 a little for readability.
@@ -20508,7 +20526,7 @@
-----
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Copying and distribution of this file, with or without
+15 -2
View File
@@ -1,8 +1,7 @@
-*- outline -*-
This file attempts to describe the rules to use when hacking Bison.
Don't put this file into the distribution. Don't mention it in the
ChangeLog.
Don't put this file into the distribution.
Everything related to the development of Bison is on Savannah:
@@ -57,6 +56,18 @@ release:
- runs the parsers under Valgrind.
- runs the test suite with G++ as C compiler...
- run `make maintainer-push-check', which runs `make maintainer-check'
while activating the push implementation and its pull interface wrappers
in many test cases that were originally written to exercise only the
pull implementation. This makes certain the push implementation can
perform every task the pull implementation can.
- run `make maintainer-xml-check', which runs `make maintainer-check'
while checking Bison's XML automaton report for every working grammar
passed to Bison in the test suite. The check just diffs the output of
Bison's included XSLT style sheets with the output of --report=all and
--graph.
- Change tests/atlocal/CFLAGS to add your preferred options. For
instance, `-traditional' to check that the parsers are K&R. Note
that it does not make sense for glr.c, which should be ANSI,
@@ -92,6 +103,8 @@ the tarballs, the xdeltas, and prepares (in /tmp/) a proto
announcement. It is so neat, that that's what I use anyway for
genuine releases, but adjusting things by hand (e.g., the urls in the
announcement file, the ChangeLog which is not needed etc.).
FIXME: `make alpha' is not maintained and is broken. These
instructions need to be replaced or removed.
If it fails, you're on your own...
+1 -1
View File
@@ -1,7 +1,7 @@
Bison News
----------
Changes in version 2.3a+ (????-??-??):
Changes in version 2.3b (2008-05-27):
* The quotes around NAME that used to be required in the following directive
are now deprecated:
+3 -3
View File
@@ -19,10 +19,10 @@
# We have strange test case titles, so we need Autoconf 2.61 or better.
AC_PREREQ(2.61)
AC_INIT([GNU Bison], [2.3a+], [[email protected]])
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2007],
AC_INIT([GNU Bison], [2.3b], [[email protected]])
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2008],
[The copyright year for this package])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2007])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2008])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
+2 -2
View File
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH BISON "1" "March 2008" "bison 2.3a+" "User Commands"
.TH BISON "1" "May 2008" "bison 2.3b" "User Commands"
.SH NAME
bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS
@@ -175,7 +175,7 @@ Written by Robert Corbett and Richard Stallman.
.SH "REPORTING BUGS"
Report bugs to <bug\-[email protected]>.
.SH COPYRIGHT
Copyright \(co 2007 Free Software Foundation, Inc.
Copyright \(co 2008 Free Software Foundation, Inc.
.br
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+10 -15
View File
@@ -1,10 +1,10 @@
/* Array bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,13 +13,9 @@
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.
*/
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "abitset.h"
#include <stddef.h>
@@ -34,14 +30,13 @@
static bitset_bindex
abitset_resize (bitset src ATTRIBUTE_UNUSED,
bitset_bindex size ATTRIBUTE_UNUSED)
abitset_resize (bitset src, bitset_bindex size)
{
if (BITSET_SIZE_ (src) == size)
return size;
/* These bitsets have a fixed size. */
abort ();
if (BITSET_SIZE_ (src) != size)
abort ();
return size;
}
/* Find list of up to NUM bits set in BSET starting from and including
+14 -15
View File
@@ -1,28 +1,27 @@
/* Functions to support abitsets.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ABITSET_H
#define _ABITSET_H
#define _ABITSET_H
#include "bitset.h"
extern size_t abitset_bytes PARAMS ((bitset_bindex));
extern size_t abitset_bytes (bitset_bindex);
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
extern bitset abitset_init (bitset, bitset_bindex);
#endif
+63 -66
View File
@@ -1,30 +1,28 @@
/* Base bitset stuff.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _BBITSET_H
#define _BBITSET_H
#include "config.h"
#include "libiberty.h"
#include <stdbool.h>
#include <limits.h>
#include <sys/types.h>
#include <stddef.h>
/* Currently we support five flavours of bitsets:
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
@@ -35,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
BITSET_TABLE: Expandable table of pointers to arrays of bits
(variable size, less storage for large sparse sets).
Faster than BITSET_LIST for random access.
BITSET_VARRAY: Variable array of bits (variable size, fast for
BITSET_VARRAY: Variable array of bits (variable size, fast for
dense bitsets).
BITSET_STATS: Wrapper bitset for internal use only. Used for gathering
statistics and/or better run-time checking.
@@ -49,8 +47,8 @@ extern const char * const bitset_type_names[];
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
/* Data type used to store a word of bits. */
typedef unsigned long bitset_word;
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
typedef unsigned long int bitset_word;
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
/* Bit index. In theory we might need a type wider than size_t, but
in practice we lose at most a factor of CHAR_BIT by going with
@@ -112,46 +110,45 @@ typedef union bitset_union *bitset;
/* The contents of this structure should be considered private. */
struct bitset_vtable
{
void (*set) PARAMS ((bitset, bitset_bindex));
void (*reset) PARAMS ((bitset, bitset_bindex));
bool (*toggle) PARAMS ((bitset, bitset_bindex));
bool (*test) PARAMS ((bitset, bitset_bindex));
bitset_bindex (*resize) PARAMS ((bitset, bitset_bindex));
bitset_bindex (*size) PARAMS ((bitset));
bitset_bindex (*count) PARAMS ((bitset));
void (*set) (bitset, bitset_bindex);
void (*reset) (bitset, bitset_bindex);
bool (*toggle) (bitset, bitset_bindex);
bool (*test) (bitset, bitset_bindex);
bitset_bindex (*resize) (bitset, bitset_bindex);
bitset_bindex (*size) (bitset);
bitset_bindex (*count) (bitset);
bool (*empty_p) PARAMS ((bitset));
void (*ones) PARAMS ((bitset));
void (*zero) PARAMS ((bitset));
bool (*empty_p) (bitset);
void (*ones) (bitset);
void (*zero) (bitset);
void (*copy) PARAMS ((bitset, bitset));
bool (*disjoint_p) PARAMS ((bitset, bitset));
bool (*equal_p) PARAMS ((bitset, bitset));
void (*not) PARAMS ((bitset, bitset));
bool (*subset_p) PARAMS ((bitset, bitset));
void (*copy) (bitset, bitset);
bool (*disjoint_p) (bitset, bitset);
bool (*equal_p) (bitset, bitset);
void (*not_) (bitset, bitset);
bool (*subset_p) (bitset, bitset);
void (*and) PARAMS ((bitset, bitset, bitset));
bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
void (*andn) PARAMS ((bitset, bitset, bitset));
bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
void (*or) PARAMS ((bitset, bitset, bitset));
bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
void (*xor) PARAMS ((bitset, bitset, bitset));
bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
void (*and_) (bitset, bitset, bitset);
bool (*and_cmp) (bitset, bitset, bitset);
void (*andn) (bitset, bitset, bitset);
bool (*andn_cmp) (bitset, bitset, bitset);
void (*or_) (bitset, bitset, bitset);
bool (*or_cmp) (bitset, bitset, bitset);
void (*xor_) (bitset, bitset, bitset);
bool (*xor_cmp) (bitset, bitset, bitset);
void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*and_or) (bitset, bitset, bitset, bitset);
bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
void (*andn_or) (bitset, bitset, bitset, bitset);
bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
void (*or_and) (bitset, bitset, bitset, bitset);
bool (*or_and_cmp) (bitset, bitset, bitset, bitset);
bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *));
bitset_bindex (*list_reverse) PARAMS ((bitset,
bitset_bindex *, bitset_bindex,
bitset_bindex *));
void (*free) PARAMS ((bitset));
bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
bitset_bindex *);
bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
bitset_bindex *);
void (*free) (bitset);
enum bitset_type type;
};
@@ -220,14 +217,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
/* DST = ~SRC. */
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
/* Return DST == DST | SRC. */
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
/* DST = SRC1 & SRC2. */
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
/* DST = SRC1 & ~SRC2. */
@@ -235,11 +232,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
/* DST = SRC1 | SRC2. */
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
/* DST = SRC1 ^ SRC2. */
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
@@ -281,24 +278,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
/* Private functions for bitset implementations. */
extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
extern bool bitset_toggle_ (bitset, bitset_bindex);
extern bitset_bindex bitset_count_ PARAMS ((bitset));
extern bitset_bindex bitset_count_ (bitset);
extern bitset_bindex bitset_size_ PARAMS ((bitset));
extern bitset_bindex bitset_size_ (bitset);
extern bool bitset_copy_ PARAMS ((bitset, bitset));
extern bool bitset_copy_ (bitset, bitset);
extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
#endif /* _BBITSET_H */
+20 -22
View File
@@ -1,10 +1,10 @@
/* General bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,16 +13,14 @@
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. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "bitset.h"
#include <stdlib.h>
#include <string.h>
#include "bitset.h"
#include "abitset.h"
#include "lbitset.h"
#include "ebitset.h"
@@ -45,6 +43,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
break;
@@ -60,9 +61,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
case BITSET_VARRAY:
bytes = vbitset_bytes (n_bits);
break;
default:
abort ();
}
return bytes;
@@ -78,6 +76,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
return abitset_init (bset, n_bits);
@@ -89,9 +90,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
case BITSET_VARRAY:
return vbitset_init (bset, n_bits);
default:
abort ();
}
}
@@ -111,7 +109,7 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
/* Choose the type of bitset. Note that sometimes we will be asked
for a zero length fixed size bitset. */
/* If no attributes selected, choose a good compromise. */
if (!attr)
return BITSET_VARRAY;
@@ -138,7 +136,7 @@ bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
bytes = bitset_bytes (type, n_bits);
bset = (bitset) xcalloc (1, bytes);
bset = xcalloc (1, bytes);
/* The cache is disabled until some elements are allocated. If we
have variable length arrays, then we may need to allocate a dummy
@@ -296,7 +294,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
if (verbose)
fprintf (file, "n_bits = %lu, set = {",
(unsigned long) bitset_size (bset));
(unsigned long int) bitset_size (bset));
pos = 30;
BITSET_FOR_EACH (iter, bset, i, 0)
@@ -307,7 +305,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
pos = 0;
}
fprintf (file, "%d ", i);
fprintf (file, "%lu ", (unsigned long int) i);
pos += 1 + (i >= 10) + (i >= 100);
};
@@ -421,6 +419,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
switch (op)
{
default:
abort ();
case BITSET_OP_OR_AND:
bitset_or (tmp, src1, src2);
changed = bitset_and_cmp (dst, src3, tmp);
@@ -435,9 +436,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
bitset_andn (tmp, src1, src2);
changed = bitset_or_cmp (dst, src3, tmp);
break;
default:
abort ();
}
bitset_free (tmp);
+52 -62
View File
@@ -1,20 +1,19 @@
/* Generic bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _BITSET_H
#define _BITSET_H
@@ -23,19 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Only use the functions and macros defined in this file. */
#include "bbitset.h"
/* obstack.h tries to be portable to K&R compilers, but its
__INT_TO_PTR macro generates diagnostics on compilers like Tru64 cc
that define __STDC__ to 0 when not in strict ANSI mode. The bitset
code assumes C89 or later, so it can avoid these glitches by
defining __INT_TO_PTR appropriately for C89 or later. */
#ifndef __INT_TO_PTR
# define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))
#endif
#include "obstack.h"
#include <stdio.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
/* Attributes used to select a bitset implementation. */
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
BITSET_VARIABLE = 2, /* Bitset size variable. */
@@ -103,38 +96,37 @@ typedef struct
/* Return bytes required for bitset of desired type and size. */
extern size_t bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
/* Initialise a bitset with desired type and size. */
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
/* Select an implementation type based on the desired bitset size
and attributes. */
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
bitset_attrs));
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
/* Create a bitset of desired type and size. The bitset is zeroed. */
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
/* Free bitset. */
extern void bitset_free PARAMS ((bitset));
extern void bitset_free (bitset);
/* Create a bitset of desired type and size using an obstack. The
bitset is zeroed. */
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
bitset_bindex, enum bitset_type));
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
bitset_bindex, enum bitset_type);
/* Free bitset allocated on obstack. */
extern void bitset_obstack_free PARAMS ((bitset));
extern void bitset_obstack_free (bitset);
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
extern bitset bitset_create (bitset_bindex, bitset_attrs);
/* Return bitset type. */
extern enum bitset_type bitset_type_get PARAMS ((bitset));
extern enum bitset_type bitset_type_get (bitset);
/* Return bitset type name. */
extern const char *bitset_type_name_get PARAMS ((bitset));
extern const char *bitset_type_name_get (bitset);
/* Set bit BITNO in bitset BSET. */
@@ -186,7 +178,7 @@ bitset_test (bitset bset, bitset_bindex bitno)
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
/* Change size of bitset. */
extern void bitset_resize PARAMS ((bitset, bitset_bindex));
extern void bitset_resize (bitset, bitset_bindex);
/* Return number of bits set in bitset SRC. */
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
@@ -286,43 +278,42 @@ extern void bitset_resize PARAMS ((bitset, bitset_bindex));
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
/* Return true if both bitsets are of the same type and size. */
extern bool
bitset_compatible_p (bitset bset1, bitset bset2);
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
/* Find next set bit from the given bit index. */
extern bitset_bindex bitset_next PARAMS ((bitset, bitset_bindex));
extern bitset_bindex bitset_next (bitset, bitset_bindex);
/* Find previous set bit from the given bit index. */
extern bitset_bindex bitset_prev PARAMS ((bitset, bitset_bindex));
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
/* Find first set bit. */
extern bitset_bindex bitset_first PARAMS ((bitset));
extern bitset_bindex bitset_first (bitset);
/* Find last set bit. */
extern bitset_bindex bitset_last PARAMS ((bitset));
extern bitset_bindex bitset_last (bitset);
/* Return nonzero if this is the only set bit. */
extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex));
extern bool bitset_only_set_p (bitset, bitset_bindex);
/* Dump bitset. */
extern void bitset_dump PARAMS ((FILE *, bitset));
extern void bitset_dump (FILE *, bitset);
/* Loop over all elements of BSET, starting with MIN, setting INDEX
to the index of each set bit. For example, the following will print
the bits set in a bitset:
bitset_bindex index;
bitset_bindex i;
bitset_iterator iter;
BITSET_FOR_EACH (iter, src, index, 0)
BITSET_FOR_EACH (iter, src, i, 0)
{
printf ("%ld ", index);
printf ("%lu ", (unsigned long int) i);
};
*/
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list (BSET, ITER.list, \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list (BSET, ITER.list, \
BITSET_LIST_SIZE, &ITER.next));) \
for (ITER.i = 0; \
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
@@ -330,20 +321,20 @@ extern void bitset_dump PARAMS ((FILE *, bitset));
/* Loop over all elements of BSET, in reverse order starting with
MIN, setting INDEX to the index of each set bit. For example, the
MIN, setting INDEX to the index of each set bit. For example, the
following will print the bits set in a bitset in reverse order:
bitset_bindex index;
bitset_bindex i;
bitset_iterator iter;
BITSET_FOR_EACH_REVERSE (iter, src, index, 0)
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
{
printf ("%ld ", index);
printf ("%lu ", (unsigned long int) i);
};
*/
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
(ITER.num == BITSET_LIST_SIZE) \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
BITSET_LIST_SIZE, &ITER.next));) \
for (ITER.i = 0; \
@@ -374,28 +365,27 @@ extern void bitset_dump PARAMS ((FILE *, bitset));
/* Release any memory tied up with bitsets. */
extern void bitset_release_memory PARAMS ((void));
extern void bitset_release_memory (void);
/* Enable bitset stats gathering. */
extern void bitset_stats_enable PARAMS ((void));
extern void bitset_stats_enable (void);
/* Disable bitset stats gathering. */
extern void bitset_stats_disable PARAMS ((void));
extern void bitset_stats_disable (void);
/* Read bitset stats file of accummulated stats. */
void bitset_stats_read PARAMS ((const char *filename));
void bitset_stats_read (const char *file_name);
/* Write bitset stats file of accummulated stats. */
void bitset_stats_write PARAMS ((const char *filename));
void bitset_stats_write (const char *file_name);
/* Dump bitset stats. */
extern void bitset_stats_dump PARAMS ((FILE *));
extern void bitset_stats_dump (FILE *);
/* Function to debug bitset from debugger. */
extern void debug_bitset PARAMS ((bitset));
extern void debug_bitset (bitset);
/* Function to debug bitset stats from debugger. */
extern void debug_bitset_stats PARAMS ((void));
extern void debug_bitset_stats (void);
#endif /* _BITSET_H */
+37 -45
View File
@@ -1,10 +1,10 @@
/* Bitset statistics.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,38 +13,30 @@
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.
*/
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This file is a wrapper bitset implementation for the other bitset
implementations. It provides bitset compatibility checking and
statistics gathering without having to instrument the bitset
implementations. When statistics gathering is enabled, the bitset
operations get vectored through here and we then call the appropriate
routines.
*/
routines. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "bitset_stats.h"
#include "bbitset.h"
#include "abitset.h"
#include "ebitset.h"
#include "lbitset.h"
#include "vbitset.h"
#include "bitset_stats.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_GETTEXT_H
#include "gettext.h"
#define _(Msgid) gettext (Msgid)
#else
#define _(Msgid) Msgid
#endif
/* Configuration macros. */
#define BITSET_STATS_FILE "bitset.dat"
@@ -54,29 +46,29 @@
/* Accessor macros. */
#define BITSET_STATS_ALLOCS_INC(TYPE) \
#define BITSET_STATS_ALLOCS_INC(TYPE) \
bitset_stats_info->types[(TYPE)].allocs++
#define BITSET_STATS_FREES_INC(BSET) \
#define BITSET_STATS_FREES_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
#define BITSET_STATS_SETS_INC(BSET) \
#define BITSET_STATS_SETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
#define BITSET_STATS_RESETS_INC(BSET) \
#define BITSET_STATS_RESETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
#define BITSET_STATS_TESTS_INC(BSET) \
#define BITSET_STATS_TESTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
#define BITSET_STATS_LISTS_INC(BSET) \
#define BITSET_STATS_LISTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
@@ -164,8 +156,8 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
for (; i < n_bins; i++)
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
(unsigned long) 1 << (i - 1),
((unsigned long) 1 << i) - 1,
1UL << (i - 1),
(1UL << i) - 1,
bins[i],
(100.0 * bins[i]) / total);
}
@@ -245,17 +237,17 @@ bitset_stats_disable (void)
/* Read bitset statistics file. */
void
bitset_stats_read (const char *filename)
bitset_stats_read (const char *file_name)
{
FILE *file;
if (!bitset_stats_info)
return;
if (!filename)
filename = BITSET_STATS_FILE;
if (!file_name)
file_name = BITSET_STATS_FILE;
file = fopen (filename, "r");
file = fopen (file_name, "r");
if (file)
{
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -275,17 +267,17 @@ bitset_stats_read (const char *filename)
/* Write bitset statistics file. */
void
bitset_stats_write (const char *filename)
bitset_stats_write (const char *file_name)
{
FILE *file;
if (!bitset_stats_info)
return;
if (!filename)
filename = BITSET_STATS_FILE;
if (!file_name)
file_name = BITSET_STATS_FILE;
file = fopen (filename, "w");
file = fopen (file_name, "w");
if (file)
{
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -700,32 +692,32 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
we are a wrapper over. */
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
sbset = (bitset) xcalloc (1, bytes);
sbset = xcalloc (1, bytes);
abitset_init (sbset, n_bits);
break;
case BITSET_LIST:
bytes = lbitset_bytes (n_bits);
sbset = (bitset) xcalloc (1, bytes);
sbset = xcalloc (1, bytes);
lbitset_init (sbset, n_bits);
break;
case BITSET_TABLE:
bytes = ebitset_bytes (n_bits);
sbset = (bitset) xcalloc (1, bytes);
sbset = xcalloc (1, bytes);
ebitset_init (sbset, n_bits);
break;
case BITSET_VARRAY:
bytes = vbitset_bytes (n_bits);
sbset = (bitset) xcalloc (1, bytes);
sbset = xcalloc (1, bytes);
vbitset_init (sbset, n_bits);
break;
default:
abort ();
}
bset->s.bset = sbset;
+14 -16
View File
@@ -1,20 +1,19 @@
/* Functions to support bitset statistics.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _BITSET_STATS_H
#define _BITSET_STATS_H
@@ -23,11 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern bool bitset_stats_enabled;
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
extern enum bitset_type bitset_stats_type_get (bitset);
extern size_t bitset_stats_bytes PARAMS ((void));
extern size_t bitset_stats_bytes (void);
extern bitset bitset_stats_init PARAMS ((bitset, bitset_bindex,
enum bitset_type));
extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
#endif
+16 -21
View File
@@ -1,29 +1,24 @@
/* Bitset vectors.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
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 3 of the License, or
(at your option) any later version.
GCC 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.
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 this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include <config.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "bitsetv.h"
#include <stdlib.h>
#include "bitsetv.h"
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
@@ -47,7 +42,7 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
/* Allocate vector table at head of bitset array. */
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
vector_bytes -= vector_bytes % bytes;
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
for (i = 0; i < n_vecs; i++)
{
@@ -149,7 +144,7 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
fprintf (file, "%s\n", title);
for (i = 0; bsetv[i]; i++)
{
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i);
bitset_dump (file, bsetv[i]);
}
@@ -164,7 +159,7 @@ debug_bitsetv (bitsetv bsetv)
for (i = 0; bsetv[i]; i++)
{
fprintf (stderr, "%lu: ", (unsigned long) i);
fprintf (stderr, "%lu: ", (unsigned long int) i);
debug_bitset (bsetv[i]);
}
+20 -24
View File
@@ -1,20 +1,19 @@
/* Bitset vectors.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _BITSETV_H
#define _BITSETV_H
@@ -25,38 +24,35 @@ typedef bitset * bitsetv;
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
type TYPE. */
extern bitsetv bitsetv_alloc PARAMS ((bitset_bindex, bitset_bindex,
enum bitset_type));
extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */
extern bitsetv bitsetv_create PARAMS ((bitset_bindex, bitset_bindex,
unsigned int));
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int);
/* Free vector of bitsets. */
extern void bitsetv_free PARAMS ((bitsetv));
extern void bitsetv_free (bitsetv);
/* Zero vector of bitsets. */
extern void bitsetv_zero PARAMS ((bitsetv));
extern void bitsetv_zero (bitsetv);
/* Set vector of bitsets. */
extern void bitsetv_ones PARAMS ((bitsetv));
extern void bitsetv_ones (bitsetv);
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the transitive closure of what was given. */
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
extern void bitsetv_transitive_closure (bitsetv);
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the reflexive transitive closure of what was given. This is
the same as transitive closure but with all bits on the diagonal
of the bit matrix set. */
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
extern void bitsetv_reflexive_transitive_closure (bitsetv);
/* Dump vector of bitsets. */
extern void bitsetv_dump PARAMS ((FILE *, const char *,
const char *, bitsetv));
extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
/* Function to debug vector of bitsets from debugger. */
extern void debug_bitsetv PARAMS ((bitsetv));
extern void debug_bitsetv (bitsetv);
#endif /* _BITSETV_H */
+28 -36
View File
@@ -1,10 +1,10 @@
/* Functions to support expandable bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,15 +13,12 @@
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.
*/
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "ebitset.h"
#include "obstack.h"
#include <stdlib.h>
#include <string.h>
@@ -52,7 +49,7 @@
/* Number of bits stored in each element. */
#define EBITSET_ELT_BITS \
((unsigned) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
/* Ebitset element. We use an array of bits. */
typedef struct ebitset_elt_struct
@@ -115,15 +112,13 @@ static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
#undef min
#undef max
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
ebitset_resize (src, n_bits)
bitset src;
bitset_bindex n_bits;
ebitset_resize (bitset src, bitset_bindex n_bits)
{
bitset_windex oldsize;
bitset_windex newsize;
@@ -138,7 +133,7 @@ ebitset_resize (src, n_bits)
{
bitset_windex size;
/* The bitset needs to grow. If we already have enough memory
/* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > EBITSET_ASIZE (src))
{
@@ -151,13 +146,13 @@ ebitset_resize (src, n_bits)
size = newsize;
else
size = newsize + newsize / 4;
EBITSET_ELTS (src)
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
EBITSET_ASIZE (src) = size;
}
memset (EBITSET_ELTS (src) + oldsize, 0,
memset (EBITSET_ELTS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (ebitset_elt *));
}
else
@@ -212,15 +207,13 @@ ebitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
#if ! defined __GNUC__ || __GNUC__ < 2
#define __alignof__(type) 0
#endif
obstack_specify_allocation (&ebitset_obstack, OBSTACK_CHUNK_SIZE,
__alignof__ (ebitset_elt),
(void *(*)PARAMS ((long)))
OBSTACK_CHUNK_ALLOC,
(void (*)PARAMS ((void *)))
OBSTACK_CHUNK_FREE);
}
@@ -326,6 +319,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
switch (mode)
{
default:
abort ();
case EBITSET_FIND:
return 0;
@@ -341,9 +337,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
case EBITSET_SUBST:
return &ebitset_zero_elts[0];
default:
abort ();
}
}
@@ -838,15 +831,14 @@ ebitset_list (bitset bset, bitset_bindex *list,
/* Ensure that any unused bits within the last element are clear. */
static inline void
ebitset_unused_clear (dst)
bitset dst;
ebitset_unused_clear (bitset dst)
{
unsigned int last_bit;
bitset_bindex n_bits;
n_bits = BITSET_NBITS_ (dst);
last_bit = n_bits % EBITSET_ELT_BITS;
if (last_bit)
{
bitset_windex eindex;
@@ -854,20 +846,20 @@ ebitset_unused_clear (dst)
ebitset_elt *elt;
elts = EBITSET_ELTS (dst);
eindex = n_bits / EBITSET_ELT_BITS;
elt = elts[eindex];
if (elt)
{
bitset_windex windex;
bitset_windex woffset;
bitset_word *srcp = EBITSET_WORDS (elt);
windex = n_bits / BITSET_WORD_BITS;
woffset = eindex * EBITSET_ELT_WORDS;
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
windex++;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
srcp[windex - woffset] = 0;
@@ -1095,6 +1087,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = EBITSET_WORDS (delt);
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1146,9 +1141,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!ebitset_elt_zero_p (delt))
+15 -16
View File
@@ -1,30 +1,29 @@
/* Functions to support ebitsets.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _EBITSET_H
#define _EBITSET_H
#define _EBITSET_H
#include "bitset.h"
extern size_t ebitset_bytes PARAMS ((bitset_bindex));
extern size_t ebitset_bytes (bitset_bindex);
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
extern bitset ebitset_init (bitset, bitset_bindex);
extern void ebitset_release_memory PARAMS ((void));
extern void ebitset_release_memory (void);
#endif
+22 -28
View File
@@ -1,10 +1,10 @@
/* Functions to support link list bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,15 +13,12 @@
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.
*/
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "lbitset.h"
#include "obstack.h"
#include <stddef.h>
#include <stdlib.h>
@@ -41,7 +38,7 @@
/* Number of words to use for each element. The larger the value the
greater the size of the cache and the shorter the time to find a given bit
but the more memory wasted for sparse bitsets and the longer the time
to search for set bits.
to search for set bits.
The routines that dominate timing profiles are lbitset_elt_find
and lbitset_elt_link, especially when accessing the bits randomly. */
@@ -54,7 +51,7 @@ typedef bitset_word lbitset_word;
/* Number of bits stored in each element. */
#define LBITSET_ELT_BITS \
((unsigned) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
((unsigned int) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
/* Lbitset element. We use an array of bits for each element.
These are linked together in a doubly-linked list. */
@@ -78,7 +75,7 @@ static struct obstack lbitset_obstack;
static bool lbitset_obstack_init = false;
static lbitset_elt *lbitset_free_list; /* Free list of bitset elements. */
extern void debug_lbitset PARAMS ((bitset));
extern void debug_lbitset (bitset);
#define LBITSET_CURRENT1(X) \
((lbitset_elt *) (void *) ((char *) (X) - offsetof (lbitset_elt, words)))
@@ -121,15 +118,13 @@ lbitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
#if ! defined __GNUC__ || __GNUC__ < 2
#define __alignof__(type) 0
#endif
obstack_specify_allocation (&lbitset_obstack, OBSTACK_CHUNK_SIZE,
__alignof__ (lbitset_elt),
(void *(*)PARAMS ((long)))
OBSTACK_CHUNK_ALLOC,
(void (*)PARAMS ((void *)))
OBSTACK_CHUNK_FREE);
}
@@ -365,6 +360,9 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
switch (mode)
{
default:
abort ();
case LBITSET_FIND:
return 0;
@@ -378,9 +376,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
case LBITSET_SUBST:
return &lbitset_zero_elts[0];
default:
abort ();
}
}
@@ -883,26 +878,25 @@ lbitset_empty_p (bitset dst)
/* Ensure that any unused bits within the last element are clear. */
static inline void
lbitset_unused_clear (dst)
bitset dst;
lbitset_unused_clear (bitset dst)
{
unsigned int last_bit;
bitset_bindex n_bits;
n_bits = BITSET_SIZE_ (dst);
last_bit = n_bits % LBITSET_ELT_BITS;
if (last_bit)
{
lbitset_elt *elt;
bitset_windex windex;
bitset_word *srcp;
elt = LBITSET_TAIL (dst);
srcp = elt->words;
windex = n_bits / BITSET_WORD_BITS;
srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1;
srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1;
windex++;
for (; (windex - elt->index) < LBITSET_ELT_WORDS; windex++)
@@ -1120,6 +1114,9 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = dtmp->words;
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1171,9 +1168,6 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!lbitset_elt_zero_p (dtmp))
@@ -1391,7 +1385,7 @@ debug_lbitset (bitset bset)
for (elt = LBITSET_HEAD (bset); elt; elt = elt->next)
{
fprintf (stderr, "Elt %lu\n", (unsigned long) elt->index);
fprintf (stderr, "Elt %lu\n", (unsigned long int) elt->index);
for (i = 0; i < LBITSET_ELT_WORDS; i++)
{
unsigned int j;
+15 -16
View File
@@ -1,30 +1,29 @@
/* Functions to support lbitsets.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LBITSET_H
#define _LBITSET_H
#define _LBITSET_H
#include "bitset.h"
extern size_t lbitset_bytes PARAMS ((bitset_bindex));
extern size_t lbitset_bytes (bitset_bindex);
extern bitset lbitset_init PARAMS ((bitset, bitset_bindex));
extern bitset lbitset_init (bitset, bitset_bindex);
extern void lbitset_release_memory PARAMS ((void));
extern void lbitset_release_memory (void);
#endif
+30 -7
View File
@@ -1,12 +1,35 @@
/* Dummy libiberty header file. */
/* Fake libiberty.h for Bison.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
#define PARAMS(X) X
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 3 of the License, or
(at your option) any later version.
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
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.
#define xmalloc malloc
#define xcalloc calloc
#define xrealloc realloc
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define xalloc_die()
/* Bison depends on libiberty's implementation of bitsets, which
requires a `libiberty.h' file. This file provides the minimum
services. */
#ifndef BISON_LIBIBERTY_H_
# define BISON_LIBIBERTY_H_ 1
# ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
# endif
# endif
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# include "xalloc.h"
#endif /* ! BISON_LIBIBERTY_H_ */
+75 -144
View File
@@ -1,10 +1,10 @@
/* Variable array bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software; you can redistribute it and/or modify
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 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,51 +13,45 @@
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.
*/
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <config.h>
#include "vbitset.h"
#include <stdlib.h>
#include <string.h>
/* This file implements variable size bitsets stored as a variable
length array of words. Any unused bits in the last word must be
zero.
zero.
Note that binary or ternary operations assume that each bitset operand
has the same size.
*/
static void vbitset_unused_clear PARAMS ((bitset));
static void vbitset_unused_clear (bitset);
static void vbitset_set PARAMS ((bitset, bitset_bindex));
static void vbitset_reset PARAMS ((bitset, bitset_bindex));
static bool vbitset_test PARAMS ((bitset, bitset_bindex));
static bitset_bindex vbitset_list PARAMS ((bitset, bitset_bindex *,
bitset_bindex,
bitset_bindex *));
static bitset_bindex vbitset_list_reverse PARAMS ((bitset, bitset_bindex *,
bitset_bindex,
bitset_bindex *));
static void vbitset_set (bitset, bitset_bindex);
static void vbitset_reset (bitset, bitset_bindex);
static bool vbitset_test (bitset, bitset_bindex);
static bitset_bindex vbitset_list (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
#define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
#define VBITSET_WORDS(X) ((X)->b.cdata)
#define VBITSET_SIZE(X) ((X)->b.csize)
#define VBITSET_ASIZE(X) ((X)->v.size)
#undef min
#undef max
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
vbitset_resize (src, n_bits)
bitset src;
bitset_bindex n_bits;
vbitset_resize (bitset src, bitset_bindex n_bits)
{
bitset_windex oldsize;
bitset_windex newsize;
@@ -72,7 +66,7 @@ vbitset_resize (src, n_bits)
{
bitset_windex size;
/* The bitset needs to grow. If we already have enough memory
/* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > VBITSET_ASIZE (src))
{
@@ -85,13 +79,13 @@ vbitset_resize (src, n_bits)
size = newsize;
else
size = newsize + newsize / 4;
VBITSET_WORDS (src)
= realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
VBITSET_ASIZE (src) = size;
}
memset (VBITSET_WORDS (src) + oldsize, 0,
memset (VBITSET_WORDS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (bitset_word));
VBITSET_SIZE (src) = newsize;
}
@@ -343,8 +337,7 @@ vbitset_unused_clear (dst)
static void
vbitset_ones (dst)
bitset dst;
vbitset_ones (bitset dst)
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -357,8 +350,7 @@ vbitset_ones (dst)
static void
vbitset_zero (dst)
bitset dst;
vbitset_zero (bitset dst)
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -370,8 +362,7 @@ vbitset_zero (dst)
static bool
vbitset_empty_p (dst)
bitset dst;
vbitset_empty_p (bitset dst)
{
unsigned int i;
bitset_word *dstp = VBITSET_WORDS (dst);
@@ -385,9 +376,7 @@ vbitset_empty_p (dst)
static void
vbitset_copy1 (dst, src)
bitset dst;
bitset src;
vbitset_copy1 (bitset dst, bitset src)
{
bitset_word *srcp;
bitset_word *dstp;
@@ -412,9 +401,7 @@ vbitset_copy1 (dst, src)
static void
vbitset_not (dst, src)
bitset dst;
bitset src;
vbitset_not (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp;
@@ -437,11 +424,9 @@ vbitset_not (dst, src)
sizeof (bitset_word) * (dsize - ssize));
}
static bool
vbitset_equal_p (dst, src)
bitset dst;
bitset src;
vbitset_equal_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -471,16 +456,14 @@ vbitset_equal_p (dst, src)
static bool
vbitset_subset_p (dst, src)
bitset dst;
bitset src;
vbitset_subset_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
bitset_word *dstp = VBITSET_WORDS (dst);
bitset_windex ssize = VBITSET_SIZE (src);
bitset_windex dsize = VBITSET_SIZE (dst);
for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
return 0;
@@ -497,9 +480,7 @@ vbitset_subset_p (dst, src)
static bool
vbitset_disjoint_p (dst, src)
bitset dst;
bitset src;
vbitset_disjoint_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -516,10 +497,7 @@ vbitset_disjoint_p (dst, src)
static void
vbitset_and (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_and (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -540,16 +518,13 @@ vbitset_and (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & *src2p++;
memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2)));
}
static bool
vbitset_and_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_and_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -572,14 +547,14 @@ vbitset_and_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -602,10 +577,7 @@ vbitset_and_cmp (dst, src1, src2)
static void
vbitset_andn (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_andn (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -626,7 +598,7 @@ vbitset_andn (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & ~(*src2p++);
if (ssize2 > ssize1)
{
for (; i < ssize2; i++)
@@ -645,10 +617,7 @@ vbitset_andn (dst, src1, src2)
static bool
vbitset_andn_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -671,14 +640,14 @@ vbitset_andn_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & ~(*src2p++);
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
for (; i < ssize2; i++, dstp++)
@@ -697,7 +666,7 @@ vbitset_andn_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -713,10 +682,7 @@ vbitset_andn_cmp (dst, src1, src2)
static void
vbitset_or (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_or (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -737,7 +703,7 @@ vbitset_or (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ | *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -752,10 +718,7 @@ vbitset_or (dst, src1, src2)
static bool
vbitset_or_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -778,14 +741,14 @@ vbitset_or_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ | *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -795,7 +758,7 @@ vbitset_or_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -810,10 +773,7 @@ vbitset_or_cmp (dst, src1, src2)
static void
vbitset_xor (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_xor (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -834,7 +794,7 @@ vbitset_xor (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ ^ *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -849,10 +809,7 @@ vbitset_xor (dst, src1, src2)
static bool
vbitset_xor_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -875,14 +832,14 @@ vbitset_xor_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ ^ *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -892,7 +849,7 @@ vbitset_xor_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -910,11 +867,7 @@ vbitset_xor_cmp (dst, src1, src2)
bitsets. */
static void
vbitset_and_or (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -922,7 +875,7 @@ vbitset_and_or (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -944,11 +897,7 @@ vbitset_and_or (dst, src1, src2, src3)
static bool
vbitset_and_or_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -957,7 +906,7 @@ vbitset_and_or_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_and_or_cmp_ (dst, src1, src2, src3);
@@ -969,11 +918,11 @@ vbitset_and_or_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -985,11 +934,7 @@ vbitset_and_or_cmp (dst, src1, src2, src3)
static void
vbitset_andn_or (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -997,7 +942,7 @@ vbitset_andn_or (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -1019,11 +964,7 @@ vbitset_andn_or (dst, src1, src2, src3)
static bool
vbitset_andn_or_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -1032,7 +973,7 @@ vbitset_andn_or_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_andn_or_cmp_ (dst, src1, src2, src3);
@@ -1044,11 +985,11 @@ vbitset_andn_or_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -1060,11 +1001,7 @@ vbitset_andn_or_cmp (dst, src1, src2, src3)
static void
vbitset_or_and (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -1072,7 +1009,7 @@ vbitset_or_and (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -1087,18 +1024,14 @@ vbitset_or_and (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++)
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
}
static bool
vbitset_or_and_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -1107,7 +1040,7 @@ vbitset_or_and_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_or_and_cmp_ (dst, src1, src2, src3);
@@ -1119,11 +1052,11 @@ vbitset_or_and_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -1134,10 +1067,8 @@ vbitset_or_and_cmp (dst, src1, src2, src3)
}
void
vbitset_copy (dst, src)
bitset dst;
bitset src;
static void
vbitset_copy (bitset dst, bitset src)
{
if (BITSET_COMPATIBLE_ (dst, src))
vbitset_copy1 (dst, src);
+14 -15
View File
@@ -1,28 +1,27 @@
/* Functions to support vbitsets.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
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 of the License, or
(at your option) any later version.
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 3 of the License, 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.
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. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _VBITSET_H
#define _VBITSET_H
#define _VBITSET_H
#include "bitset.h"
extern size_t vbitset_bytes PARAMS ((bitset_bindex));
extern size_t vbitset_bytes (bitset_bindex);
extern bitset vbitset_init PARAMS ((bitset, bitset_bindex));
extern bitset vbitset_init (bitset, bitset_bindex);
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3a+. */
/* A Bison parser, made by GNU Bison 2.3b. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -46,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.3a+"
#define YYBISON_VERSION "2.3b"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
+1 -1
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3a+. */
/* A Bison parser, made by GNU Bison 2.3b. */
/* Skeleton interface for Bison's Yacc-like parsers in C