diff options
author | Trevor Saunders <tbsaunde+gcc@tbsaunde.org> | 2015-02-08 09:22:28 -0500 |
---|---|---|
committer | Trevor Saunders <tbsaunde+gcc@tbsaunde.org> | 2015-04-09 19:57:14 -0400 |
commit | 4f8953b6684459714538e47696797e3b02dfe428 (patch) | |
tree | ebb4c8dbf1bdaa10be85e4042cd782b936f52a62 /gcc/bitvec.c | |
parent | 4aed2663603411f5bb768f5c84d1a872a5bb281c (diff) | |
download | gcc-4f8953b6684459714538e47696797e3b02dfe428.tar.gz |
add bitvec and use sometbsaunde/bitvec
gcc/
2015-04-08 Trevor Saunders <tbsaunde@tbsaunde.org>
* bitvec.h: New file.
* bitvec.c: New file.
* Makefile.in (OBJS-libcommon): Add bitvec.o.
* alias.c, cfganal.c, cfgbuild.c, cfgbuild.h, cfgexpand.c, cfghooks.c,
cfghooks.h, cfgloop.c, cfgloopmanip.c, cfgloopmanip.h, cfgrtl.c,
config/spu/spu.c, cp/vtable-class-hierarchy.c, cse.c, dce.c,
df-core.c, dse.c, except.c, except.h, function.c, graph.c,
graphite-sese-to-poly.c, ira-lives.c, loop-unroll.c, lower-subreg.c,
lra-lives.c, lra.c, modulo-sched.c, recog.c, regcprop.c, reload1.c,
sched-int.h, sched-rgn.c, sel-sched-ir.c, sel-sched.c,
store-motion.c, tree-eh.c, tree-into-ssa.c, tree-outof-ssa.c,
tree-ssa-dce.c, tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-manip.c,
tree-ssa-loop-manip.h, tree-ssa-pre.c, tree-ssa-propagate.c,
tree-ssa-reassoc.c, tree-ssa-structalias.c, tree-stdarg.c,
tree-vect-slp.c, tree-vrp.c, var-tracking.c: Use bitvec instead
of sbitmap.
Diffstat (limited to 'gcc/bitvec.c')
-rw-r--r-- | gcc/bitvec.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/bitvec.c b/gcc/bitvec.c new file mode 100644 index 00000000000..fa661090619 --- /dev/null +++ b/gcc/bitvec.c @@ -0,0 +1,37 @@ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "bitvec.h" + +void +bitvec::dump (FILE *file) const +{ + size_t bits = m_bits.length () * bits_per_elt; + fprintf (file, "n_bits = %d, set = {", (int) bits); + + for (size_t pos = 30, i = 0; i < bits; i++) + if ((*this)[i]) + { + if (pos > 70) + { + fprintf (file, "\n "); + pos = 0; + } + + fprintf (file, "%d ", (int) i); + pos += 2 + (i >= 10) + (i >= 100) + (i >= 1000); + } + + fprintf (file, "}\n"); +} + +ssize_t +bitvec::first_set_bit () const +{ + for (size_t i = begin (); i < end (); i++) + if ((*this)[i]) + return i; + + return -1; +} |