Switch bitset.h/raw_bitset.h to size_t instead of unsigned size parameters.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 27 Dec 2010 22:29:47 +0000 (22:29 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 27 Dec 2010 22:29:47 +0000 (22:29 +0000)
Note that this is an ugly change because ALL index variables used inside
bitset_foreach() MUST be switched to size_t now, or the magical

elm != (size_t) -1;

will fail :-(

[r28199]

12 files changed:
ir/adt/bitset.h
ir/adt/raw_bitset.h
ir/ana/irlivechk.c
ir/be/bechordal.c
ir/be/bechordal_common.c
ir/be/becopyheur.c
ir/be/becopyheur2.c
ir/be/becopyheur4.c
ir/be/becopyilp2.c
ir/be/becopyopt.c
ir/ir/irargs.c
ir/ir/iredges.c

index 931cc5c..c3858a3 100644 (file)
@@ -37,7 +37,7 @@
 #include "raw_bitset.h"
 
 typedef struct bitset_t {
-       unsigned size;     /**< size of the bitset in bits */
+       size_t size;       /**< size of the bitset in bits */
        unsigned data[1];  /**< data (should be declared data[] but this is only
                                allowed in C99) */
 } bitset_t;
@@ -45,7 +45,7 @@ typedef struct bitset_t {
 /**
  * return the number of bytes a bitset would need
  */
-static inline size_t bitset_total_size(unsigned n_bits)
+static inline size_t bitset_total_size(size_t n_bits)
 {
        return sizeof(bitset_t) - sizeof(((bitset_t*)0)->data)
                + BITSET_SIZE_BYTES(n_bits);
@@ -55,7 +55,7 @@ static inline size_t bitset_total_size(unsigned n_bits)
  * initialize a bitset for bitsize size (bitset should point to memory
  * with a size calculated by bitset_total_size)
  */
-static inline bitset_t *bitset_init(void *memory, unsigned size)
+static inline bitset_t *bitset_init(void *memory, size_t size)
 {
        bitset_t *result = (bitset_t*) memory;
        result->size = size;
@@ -70,7 +70,7 @@ static inline bitset_t *bitset_init(void *memory, unsigned size)
  * @return A pointer to an empty initialized bitset.
  */
 static inline bitset_t *bitset_obstack_alloc(struct obstack *obst,
-                                             unsigned n_bits)
+                                             size_t n_bits)
 {
        size_t size   = bitset_total_size(n_bits);
        void  *memory = obstack_alloc(obst, size);
@@ -82,7 +82,7 @@ static inline bitset_t *bitset_obstack_alloc(struct obstack *obst,
  * @param size The greatest bit that shall be stored in the set.
  * @return A pointer to an empty initialized bitset.
  */
-static inline bitset_t *bitset_malloc(unsigned n_bits)
+static inline bitset_t *bitset_malloc(size_t n_bits)
 {
        size_t  size   = bitset_total_size(n_bits);
        void   *memory = xmalloc(size);
@@ -112,7 +112,7 @@ static inline void bitset_free(bitset_t *bitset)
  * @param bs The bitset.
  * @return The highest bit which can be set or cleared plus 1.
  */
-static inline unsigned bitset_size(const bitset_t *bitset)
+static inline size_t bitset_size(const bitset_t *bitset)
 {
        return bitset->size;
 }
@@ -122,7 +122,7 @@ static inline unsigned bitset_size(const bitset_t *bitset)
  * @param bs The bitset.
  * @param bit The bit to set.
  */
-static inline void bitset_set(bitset_t *bs, unsigned bit)
+static inline void bitset_set(bitset_t *bs, size_t bit)
 {
        assert(bit < bs->size);
        rbitset_set(bs->data, bit);
@@ -133,7 +133,7 @@ static inline void bitset_set(bitset_t *bs, unsigned bit)
  * @param bs The bitset.
  * @param bit The bit to clear.
  */
-static inline void bitset_clear(bitset_t *bs, unsigned bit)
+static inline void bitset_clear(bitset_t *bs, size_t bit)
 {
        assert(bit < bs->size);
        rbitset_clear(bs->data, bit);
@@ -145,7 +145,7 @@ static inline void bitset_clear(bitset_t *bs, unsigned bit)
  * @param bit The bit to check for.
  * @return 1, if the bit was set, 0 if not.
  */
-static inline bool bitset_is_set(const bitset_t *bs, unsigned bit)
+static inline bool bitset_is_set(const bitset_t *bs, size_t bit)
 {
        assert(bit < bs->size);
        return rbitset_is_set(bs->data, bit);
@@ -156,7 +156,7 @@ static inline bool bitset_is_set(const bitset_t *bs, unsigned bit)
  * @param bs The bitset.
  * @param bit The bit to flip.
  */
-static inline void bitset_flip(bitset_t *bs, unsigned bit)
+static inline void bitset_flip(bitset_t *bs, size_t bit)
 {
        assert(bit < bs->size);
        rbitset_flip(bs->data, bit);
@@ -195,13 +195,13 @@ static inline void bitset_copy_into(bitset_t *tgt, const bitset_t *src)
  * @note Note that if pos is unset, pos is returned.
  * @param bs The bitset.
  * @param pos The bit from which to search for the next set bit.
- * @return The next set bit from pos on, or (unsigned)-1, if no unset bit was
+ * @return The next set bit from pos on, or (size_t)-1, if no unset bit was
  * found after pos.
  */
-static inline unsigned bitset_next_clear(const bitset_t *bs, unsigned pos)
+static inline size_t bitset_next_clear(const bitset_t *bs, size_t pos)
 {
        if (pos >= bs->size)
-               return (unsigned)-1;
+               return (size_t)-1;
        return rbitset_next_max(bs->data, pos, bs->size, false);
 }
 
@@ -210,27 +210,27 @@ static inline unsigned bitset_next_clear(const bitset_t *bs, unsigned pos)
  * @note Note that if pos is set, pos is returned.
  * @param bs The bitset.
  * @param pos The bit from which to search for the next set bit.
- * @return The next set bit from pos on, or (unsigned)-1, if no set bit was
+ * @return The next set bit from pos on, or (size_t)-1, if no set bit was
  * found after pos.
  */
-static inline unsigned bitset_next_set(const bitset_t *bs, unsigned pos)
+static inline size_t bitset_next_set(const bitset_t *bs, size_t pos)
 {
        if (pos >= bs->size)
-               return (unsigned)-1;
+               return (size_t)-1;
        return rbitset_next_max(bs->data, pos, bs->size, true);
 }
 
 /**
  * Convenience macro for bitset iteration.
  * @param bitset The bitset.
- * @param elm A unsigned long variable.
+ * @param elm A size_t variable.
  */
 #define bitset_foreach(bitset,elm) \
-       for(elm = bitset_next_set(bitset,0); elm != (unsigned) -1; elm = bitset_next_set(bitset,elm+1))
+       for(elm = bitset_next_set(bitset,0); elm != (size_t)-1; elm = bitset_next_set(bitset,elm+1))
 
 
 #define bitset_foreach_clear(bitset,elm) \
-       for(elm = bitset_next_clear(bitset,0); elm != (unsigned) -1; elm = bitset_next_clear(bitset,elm+1))
+       for(elm = bitset_next_clear(bitset,0); elm != (size_t) -1; elm = bitset_next_clear(bitset,elm+1))
 
 /**
  * Count the bits set.
@@ -238,7 +238,7 @@ static inline unsigned bitset_next_set(const bitset_t *bs, unsigned pos)
  * @param bs The bitset.
  * @return The number of bits set in the bitset.
  */
-static inline unsigned bitset_popcount(const bitset_t *bs)
+static inline size_t bitset_popcount(const bitset_t *bs)
 {
        return rbitset_popcount(bs->data, bs->size);
 }
@@ -305,14 +305,14 @@ static inline bool bitset_intersect(const bitset_t *a, const bitset_t *b)
  * @param to     The last index plus one to set to one.
  * @param do_set If 1 the bits are set, if 0, they are cleared.
  */
-static inline void bitset_mod_range(bitset_t *a, unsigned from, unsigned to,
+static inline void bitset_mod_range(bitset_t *a, size_t from, size_t to,
                                     bool do_set)
 {
        if (from == to)
            return;
 
        if (to < from) {
-               unsigned tmp = from;
+               size_t tmp = from;
                from = to;
                to = tmp;
        }
@@ -345,10 +345,10 @@ static inline bool bitset_is_empty(const bitset_t *bs)
 static inline void bitset_fprint(FILE *file, const bitset_t *bs)
 {
        const char *prefix = "";
-       int i;
+       size_t i;
 
        putc('{', file);
-       for(i = bitset_next_set(bs, 0); i != -1; i = bitset_next_set(bs, i + 1)) {
+       for(i = bitset_next_set(bs, 0); i != (size_t)-1; i = bitset_next_set(bs, i + 1)) {
                fprintf(file, "%s%d", prefix, i);
                prefix = ",";
        }
index 5de07f1..e5056c4 100644 (file)
@@ -56,7 +56,7 @@
  *
  * @return the new bitset
  */
-static inline unsigned *rbitset_malloc(unsigned size)
+static inline unsigned *rbitset_malloc(size_t size)
 {
        return XMALLOCNZ(unsigned, BITSET_SIZE_ELEMS(size));
 }
@@ -69,7 +69,7 @@ static inline unsigned *rbitset_malloc(unsigned size)
  */
 #define rbitset_alloca(res, size) \
 do { \
-       unsigned size_bytes = BITSET_SIZE_BYTES(size); \
+       size_t size_bytes = BITSET_SIZE_BYTES(size); \
        res = (unsigned*)alloca(size_bytes); \
        memset(res, 0, size_bytes); \
 } while(0)
@@ -83,7 +83,7 @@ do { \
  * @return the new bitset
  */
 static inline unsigned *rbitset_obstack_alloc(struct obstack *obst,
-                                              unsigned size)
+                                              size_t size)
 {
        return OALLOCNZ(obst, unsigned, BITSET_SIZE_ELEMS(size));
 }
@@ -98,9 +98,9 @@ static inline unsigned *rbitset_obstack_alloc(struct obstack *obst,
  * @return the new bitset
  */
 static inline unsigned *rbitset_duplicate_obstack_alloc(struct obstack *obst,
-       const unsigned *old_bitset, unsigned size)
+       const unsigned *old_bitset, size_t size)
 {
-       unsigned  size_bytes = BITSET_SIZE_BYTES(size);
+       size_t    size_bytes = BITSET_SIZE_BYTES(size);
        unsigned *res        = OALLOCN(obst, unsigned, BITSET_SIZE_ELEMS(size));
        memcpy(res, old_bitset, size_bytes);
 
@@ -110,10 +110,10 @@ static inline unsigned *rbitset_duplicate_obstack_alloc(struct obstack *obst,
 /**
  * Check if a bitset is empty, ie all bits cleared.
  */
-static inline bool rbitset_is_empty(const unsigned *bitset, unsigned size)
+static inline bool rbitset_is_empty(const unsigned *bitset, size_t size)
 {
-       unsigned i;
-       unsigned n = BITSET_SIZE_ELEMS(size);
+       size_t i;
+       size_t n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                if (bitset[i] != 0) {
@@ -129,7 +129,7 @@ static inline bool rbitset_is_empty(const unsigned *bitset, unsigned size)
  * @param bitset  the bitset
  * @param pos     the position of the bit to be set
  */
-static inline void rbitset_set(unsigned *bitset, unsigned pos)
+static inline void rbitset_set(unsigned *bitset, size_t pos)
 {
        BITSET_ELEM(bitset,pos) |= 1 << (pos % BITS_PER_ELEM);
 }
@@ -140,14 +140,14 @@ static inline void rbitset_set(unsigned *bitset, unsigned pos)
  * @param bitset  the bitset
  * @param pos     position of the bit to be flipped
  */
-static inline void rbitset_flip(unsigned *bitset, unsigned pos)
+static inline void rbitset_flip(unsigned *bitset, size_t pos)
 {
        BITSET_ELEM(bitset, pos) ^= 1 << (pos % BITS_PER_ELEM);
 }
 
-static inline unsigned rbitset_last_mask_(unsigned size)
+static inline unsigned rbitset_last_mask_(size_t size)
 {
-       unsigned p;
+       size_t p;
        if (size == 0)
                return 0;
        p = size % BITS_PER_ELEM;
@@ -160,10 +160,10 @@ static inline unsigned rbitset_last_mask_(unsigned size)
  * @param bitset  the bitset
  * @param size    number of bits in the bitset
  */
-static inline void rbitset_set_all(unsigned *bitset, unsigned size)
+static inline void rbitset_set_all(unsigned *bitset, size_t size)
 {
-       unsigned i;
-       unsigned n = BITSET_SIZE_ELEMS(size);
+       size_t i;
+       size_t n = BITSET_SIZE_ELEMS(size);
 
        if (n == 0)
                return;
@@ -180,7 +180,7 @@ static inline void rbitset_set_all(unsigned *bitset, unsigned size)
  * @param bitset  the bitset
  * @param pos     the position of the bit to be clear
  */
-static inline void rbitset_clear(unsigned *bitset, unsigned pos)
+static inline void rbitset_clear(unsigned *bitset, size_t pos)
 {
        BITSET_ELEM(bitset, pos) &= ~(1 << (pos % BITS_PER_ELEM));
 }
@@ -191,9 +191,9 @@ static inline void rbitset_clear(unsigned *bitset, unsigned pos)
  * @param bitset  the bitset
  * @param size    number of bits in the bitset
  */
-static inline void rbitset_clear_all(unsigned *bitset, unsigned size)
+static inline void rbitset_clear_all(unsigned *bitset, size_t size)
 {
-       unsigned size_bytes = BITSET_SIZE_BYTES(size);
+       size_t size_bytes = BITSET_SIZE_BYTES(size);
        memset(bitset, 0, size_bytes);
 }
 
@@ -203,10 +203,10 @@ static inline void rbitset_clear_all(unsigned *bitset, unsigned size)
  * @param bitset  the bitset
  * @param size    number of bits in the bitset
  */
-static inline void rbitset_flip_all(unsigned *bitset, unsigned size)
+static inline void rbitset_flip_all(unsigned *bitset, size_t size)
 {
-       unsigned pos;
-       unsigned n = BITSET_SIZE_ELEMS(size);
+       size_t pos;
+       size_t n = BITSET_SIZE_ELEMS(size);
 
        if (n == 0)
                return;
@@ -223,7 +223,7 @@ static inline void rbitset_flip_all(unsigned *bitset, unsigned size)
  * @param bitset  the bitset
  * @param pos     the position of the bit to check
  */
-static inline bool rbitset_is_set(const unsigned *bitset, unsigned pos)
+static inline bool rbitset_is_set(const unsigned *bitset, size_t pos)
 {
        return (BITSET_ELEM(bitset, pos) & (1 << (pos % BITS_PER_ELEM))) != 0;
 }
@@ -234,11 +234,10 @@ static inline bool rbitset_is_set(const unsigned *bitset, unsigned pos)
  * @param bitset  the bitset
  * @param size    size of the bitset in bits
  */
-static inline unsigned rbitset_popcount(const unsigned *bitset, unsigned size)
+static inline size_t rbitset_popcount(const unsigned *bitset, size_t size)
 {
-       unsigned i;
-       unsigned n   = BITSET_SIZE_ELEMS(size);
-       unsigned res = 0;
+       size_t i, n  = BITSET_SIZE_ELEMS(size);
+       size_t res = 0;
 
        for (i = 0; i < n; ++i) {
                res += popcount(bitset[i]);
@@ -260,12 +259,12 @@ static inline unsigned rbitset_popcount(const unsigned *bitset, unsigned size)
  * @note Does NOT check the size of the bitset, so ensure that a bit
  *       will be found or use a sentinel bit!
  */
-static inline unsigned rbitset_next(const unsigned *bitset, unsigned pos,
-                                    bool set)
+static inline size_t rbitset_next(const unsigned *bitset, size_t pos,
+                                  bool set)
 {
        unsigned p;
-       unsigned elem_pos = pos / BITS_PER_ELEM;
-       unsigned bit_pos = pos % BITS_PER_ELEM;
+       size_t elem_pos = pos / BITS_PER_ELEM;
+       size_t bit_pos = pos % BITS_PER_ELEM;
 
        unsigned elem = bitset[elem_pos];
        unsigned mask = set ? 0 : ~0u;
@@ -306,24 +305,24 @@ static inline unsigned rbitset_next(const unsigned *bitset, unsigned pos,
  * @param set     if 0 search for unset bit, else for set bit
  *
  * @return the first position where a matched bit was found.
- *         (unsigned)-1 if no bit was found.
+ *         (size_t)-1 if no bit was found.
  */
-static inline unsigned rbitset_next_max(const unsigned *bitset, unsigned pos,
-                                        unsigned last, bool set)
+static inline size_t rbitset_next_max(const unsigned *bitset, size_t pos,
+                                      size_t last, bool set)
 {
-       unsigned p;
-       unsigned elem_pos = pos / BITS_PER_ELEM;
-       unsigned bit_pos  = pos % BITS_PER_ELEM;
+       size_t p;
+       size_t elem_pos = pos / BITS_PER_ELEM;
+       size_t bit_pos  = pos % BITS_PER_ELEM;
 
        unsigned elem = bitset[elem_pos];
-       unsigned mask = set ? 0 : ~0u;
-       unsigned res  = (unsigned)-1;
+       unsigned mask = set ? 0u : ~0u;
+       size_t res  = (size_t)-1;
 
        /*
         * Mask out the bits smaller than pos in the current unit.
         * We are only interested in bits set higher than pos.
         */
-       unsigned in_elem_mask = (1 << bit_pos) - 1;
+       unsigned in_elem_mask = (1u << bit_pos) - 1;
 
        assert(pos < last);
 
@@ -334,7 +333,7 @@ static inline unsigned rbitset_next_max(const unsigned *bitset, unsigned pos,
        if (p < BITS_PER_ELEM) {
                res = elem_pos * BITS_PER_ELEM + p;
        } else {
-               unsigned n = BITSET_SIZE_ELEMS(last);
+               size_t n = BITSET_SIZE_ELEMS(last);
                /* Else search for set bits in the next units. */
                for (elem_pos++; elem_pos < n; elem_pos++) {
                        elem = bitset[elem_pos] ^ mask;
@@ -347,7 +346,7 @@ static inline unsigned rbitset_next_max(const unsigned *bitset, unsigned pos,
                }
        }
        if (res >= last)
-               res = (unsigned)-1;
+               res = (size_t)-1;
 
        return res;
 }
@@ -359,9 +358,9 @@ static inline unsigned rbitset_next_max(const unsigned *bitset, unsigned pos,
  * @param src   the second bitset
  * @param size  size of both bitsets in bits
  */
-static inline void rbitset_and(unsigned *dst, const unsigned *src, unsigned size)
+static inline void rbitset_and(unsigned *dst, const unsigned *src, size_t size)
 {
-       unsigned i, n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                dst[i] &= src[i];
@@ -375,9 +374,9 @@ static inline void rbitset_and(unsigned *dst, const unsigned *src, unsigned size
  * @param src   the second bitset
  * @param size  size of both bitsets in bits
  */
-static inline void rbitset_or(unsigned *dst, const unsigned *src, unsigned size)
+static inline void rbitset_or(unsigned *dst, const unsigned *src, size_t size)
 {
-       unsigned i, n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                dst[i] |= src[i];
@@ -391,9 +390,9 @@ static inline void rbitset_or(unsigned *dst, const unsigned *src, unsigned size)
  * @param src   the second bitset
  * @param size  size of both bitsets in bits
  */
-static inline void rbitset_andnot(unsigned *dst, const unsigned *src, unsigned size)
+static inline void rbitset_andnot(unsigned *dst, const unsigned *src, size_t size)
 {
-       unsigned i, n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                dst[i] &= ~src[i];
@@ -407,9 +406,9 @@ static inline void rbitset_andnot(unsigned *dst, const unsigned *src, unsigned s
  * @param src   the second bitset
  * @param size  size of both bitsets in bits
  */
-static inline void rbitset_xor(unsigned *dst, const unsigned *src, unsigned size)
+static inline void rbitset_xor(unsigned *dst, const unsigned *src, size_t size)
 {
-       unsigned i, n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                dst[i] ^= src[i];
@@ -423,8 +422,8 @@ static inline void rbitset_xor(unsigned *dst, const unsigned *src, unsigned size
  * @param to       last bit (the first bit which is not set anymore)
  * @param val      wether to set to 1 or 0
  */
-static inline void rbitset_set_range(unsigned *bitset, unsigned from,
-                                     unsigned to, bool val)
+static inline void rbitset_set_range(unsigned *bitset, size_t from,
+                                     size_t to, bool val)
 {
        /*
         * A small example (for cleaning bits in the same unit).
@@ -438,13 +437,13 @@ static inline void rbitset_set_range(unsigned *bitset, unsigned from,
         *                           1         2         3
         */
 
-       unsigned from_bit       = from % BITS_PER_ELEM;
-       unsigned from_pos       = from / BITS_PER_ELEM;
+       size_t from_bit         = from % BITS_PER_ELEM;
+       size_t from_pos         = from / BITS_PER_ELEM;
        unsigned from_unit_mask = ~((1 << from_bit) - 1);
 
-       unsigned to_bit         = to % BITS_PER_ELEM;
-       unsigned to_pos         = to / BITS_PER_ELEM;
-       unsigned to_unit_mask   = (1 << to_bit) - 1;
+       size_t to_bit         = to % BITS_PER_ELEM;
+       size_t to_pos         = to / BITS_PER_ELEM;
+       unsigned to_unit_mask = (1 << to_bit) - 1;
 
        assert(from < to);
 
@@ -453,7 +452,7 @@ static inline void rbitset_set_range(unsigned *bitset, unsigned from,
                if (from_pos == to_pos) {
                        BITSET_ELEM(bitset, from_pos) |= from_unit_mask & to_unit_mask;
                } else {
-                       unsigned i;
+                       size_t i;
                        BITSET_ELEM(bitset, from_pos) |= from_unit_mask;
                        BITSET_ELEM(bitset, to_pos)   |= to_unit_mask;
                        for (i = from_pos + 1; i < to_pos; ++i)
@@ -464,7 +463,7 @@ static inline void rbitset_set_range(unsigned *bitset, unsigned from,
                if (from_pos == to_pos) {
                        BITSET_ELEM(bitset, from_pos) &= ~(from_unit_mask & to_unit_mask);
                } else {
-                       unsigned i;
+                       size_t i;
                        BITSET_ELEM(bitset, from_pos) &= ~from_unit_mask;
                        BITSET_ELEM(bitset, to_pos)   &= ~to_unit_mask;
                        for (i = from_pos + 1; i < to_pos; ++i)
@@ -481,9 +480,9 @@ static inline void rbitset_set_range(unsigned *bitset, unsigned from,
  * @param size     size of both bitsets in bits
  */
 static inline bool rbitsets_equal(const unsigned *bitset1,
-                                  const unsigned *bitset2, unsigned size)
+                                  const unsigned *bitset2, size_t size)
 {
-       unsigned size_bytes = BITSET_SIZE_BYTES(size);
+       size_t size_bytes = BITSET_SIZE_BYTES(size);
        return memcmp(bitset1, bitset2, size_bytes) == 0;
 }
 
@@ -495,10 +494,9 @@ static inline bool rbitsets_equal(const unsigned *bitset1,
  * @param size     size of both bitsets in bits
  */
 static inline bool rbitsets_have_common(const unsigned *bitset1,
-                                        const unsigned *bitset2, unsigned size)
+                                        const unsigned *bitset2, size_t size)
 {
-       unsigned i;
-       unsigned n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                if ((bitset1[i] & bitset2[i]) != 0)
@@ -515,10 +513,9 @@ static inline bool rbitsets_have_common(const unsigned *bitset1,
  * @param size     size of both bitsets in bits
  */
 static inline bool rbitset_contains(const unsigned *bitset1,
-                                    const unsigned *bitset2, unsigned size)
+                                    const unsigned *bitset2, size_t size)
 {
-       unsigned i;
-       unsigned n = BITSET_SIZE_ELEMS(size);
+       size_t i, n = BITSET_SIZE_ELEMS(size);
 
        for (i = 0; i < n; ++i) {
                if ((bitset1[i] & bitset2[i]) != bitset1[i])
@@ -532,10 +529,9 @@ static inline bool rbitset_contains(const unsigned *bitset1,
  * @param  bitset  the bitset.
  * @return size    size of the bitset in bits
  */
-static inline void rbitset_minus1(unsigned *bitset, unsigned size)
+static inline void rbitset_minus1(unsigned *bitset, size_t size)
 {
-       unsigned i;
-       unsigned n         = BITSET_SIZE_ELEMS(size);
+       size_t i, n        = BITSET_SIZE_ELEMS(size);
        unsigned last_mask = rbitset_last_mask_(size);
 
        for (i = 0; i < n; ++i) {
@@ -557,15 +553,15 @@ static inline void rbitset_minus1(unsigned *bitset, unsigned size)
  * @param size  size of both bitsets in bits
  */
 static inline void rbitset_copy(unsigned *dst, const unsigned *src,
-                                unsigned size)
+                                size_t size)
 {
        memcpy(dst, src, BITSET_SIZE_BYTES(size));
 }
 
 static inline void rbitset_copy_into(unsigned *dst, const unsigned *src,
-                                     unsigned size)
+                                     size_t size)
 {
-       unsigned n         = BITSET_SIZE_ELEMS(size);
+       size_t n           = BITSET_SIZE_ELEMS(size);
        unsigned last_mask = rbitset_last_mask_(size);
 
        memcpy(dst, src, (n-1) * (BITS_PER_ELEM/8));
index 6d5f6b3..fb66abd 100644 (file)
@@ -168,7 +168,7 @@ static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl)
        bitset_t *tmp = bitset_alloca(lv->n_blocks);
        bl_info_t *bi = get_block_info(lv, bl);
 
-       unsigned elm;
+       size_t elm;
 
        DBG((lv->dbg, LEVEL_2, "computing T_%d\n", bi->id));
 
@@ -205,7 +205,7 @@ static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl)
 
 static inline void compute_back_edge_chains(lv_chk_t *lv)
 {
-       unsigned elm;
+       size_t elm;
        int i, n;
 
        DBG((lv->dbg, LEVEL_2, "back edge sources: %B\n", lv->back_edge_src));
index d574254..ea259f6 100644 (file)
@@ -180,7 +180,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
        int *assignment;
        pmap *partners;
        int i, n_alloc;
-       unsigned col;
+       size_t col;
        const ir_edge_t *edge;
        ir_node *perm = NULL;
        //int match_res, cost;
index 4094add..0bffe02 100644 (file)
@@ -119,7 +119,7 @@ void create_borders(ir_node *block, void *env_ptr)
        be_lv_t *lv                       = be_get_irg_liveness(env->irg);
 
        int i, n;
-       unsigned elm;
+       size_t elm;
        unsigned step = 0;
        unsigned pressure = 0;
        struct list_head *head;
index 083a06a..c1a2cd2 100644 (file)
@@ -398,7 +398,7 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou)
        ir_node **safe, **unsafe;
        int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs;
        bitset_t *curr, *best;
-       unsigned pos;
+       size_t pos;
        int next, curr_weight, best_weight = 0;
 
        /* assign the nodes into two groups.
@@ -461,7 +461,7 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou)
                                                        goto no_stable_set;
 
                        /* if we arrive here, we have a stable set */
-                       /* compute the weigth of the stable set*/
+                       /* compute the weight of the stable set*/
                        curr_weight = 0;
                        bitset_foreach(curr, pos)
                                curr_weight += unsafe_costs[pos];
index 374ea49..27127d1 100644 (file)
@@ -324,7 +324,7 @@ static void determine_color_costs(co2_t *env, co2_irn_t *ci, col_cost_pair_t *co
        bitset_t *forb     = bitset_alloca(n_regs);
        affinity_node_t *a = ci->aff;
 
-       unsigned elm;
+       size_t elm;
        const ir_node *pos;
        neighbours_iter_t it;
        int i;
@@ -609,7 +609,7 @@ static void node_color_badness(co2_cloud_irn_t *ci, int *badness)
        be_ifg_t *ifg  = env->co->cenv->ifg;
        bitset_t *bs   = bitset_alloca(n_regs);
 
-       unsigned elm;
+       size_t elm;
        const ir_node *irn;
        neighbours_iter_t it;
 
index ab0ff49..479964d 100644 (file)
@@ -174,7 +174,7 @@ static void dbg_aff_chunk(const co_mst_env_t *env, const aff_chunk_t *c)
  */
 static void dbg_admissible_colors(const co_mst_env_t *env, const co_mst_irn_t *node)
 {
-       unsigned idx;
+       size_t idx;
        (void) env;
 
        if (bitset_popcount(node->adm_colors) < 1)
@@ -571,7 +571,7 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c)
 
                        node->chunk = c;
                        if (node->constr_factor > REAL(0.0)) {
-                               unsigned col;
+                               size_t col;
                                bitset_foreach (node->adm_colors, col)
                                        c->color_affinity[col].cost += node->constr_factor;
                        }
index d813d45..36dad10 100644 (file)
@@ -82,7 +82,7 @@ static void build_coloring_cstr(ilp_env_t *ienv)
 
        be_ifg_foreach_node(ifg, &iter, irn)
                if (!sr_is_removed(ienv->sr, irn)) {
-                       unsigned col;
+                       size_t col;
                        int cst_idx;
                        const arch_register_req_t *req;
                        int curr_node_color = get_irn_col(irn);
index aab8f77..e9e0e9c 100644 (file)
@@ -308,7 +308,7 @@ static int ou_max_ind_set_costs(unit_t *ou)
        ir_node **safe, **unsafe;
        int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs;
        bitset_t *curr;
-       unsigned  pos;
+       size_t  pos;
        int curr_weight, best_weight = 0;
 
        /* assign the nodes into two groups.
@@ -344,7 +344,7 @@ static int ou_max_ind_set_costs(unit_t *ou)
        /* now compute the best set out of the unsafe nodes*/
        if (unsafe_count > MIS_HEUR_TRIGGER) {
                bitset_t *best = bitset_alloca(unsafe_count);
-               /* Heuristik: Greedy trial and error form index 0 to unsafe_count-1 */
+               /* Heuristic: Greedy trial and error form index 0 to unsafe_count-1 */
                for (i=0; i<unsafe_count; ++i) {
                        bitset_set(best, i);
                        /* check if it is a stable set */
@@ -369,7 +369,7 @@ static int ou_max_ind_set_costs(unit_t *ou)
                                                        goto no_stable_set;
 
                        /* if we arrive here, we have a stable set */
-                       /* compute the weigth of the stable set*/
+                       /* compute the weight of the stable set*/
                        curr_weight = 0;
                        bitset_foreach(curr, pos)
                                curr_weight += unsafe_costs[pos];
index 9d54ed2..d08a93d 100644 (file)
@@ -66,7 +66,7 @@ static int bitset_emit(lc_appendable_t *app,
 {
        int res = 2;
        bitset_t *b = (bitset_t*)arg->v_ptr;
-       unsigned  p;
+       size_t  p;
        char buf[32];
        const char *prefix = "";
 
index 537b8a2..e09b322 100644 (file)
@@ -859,7 +859,7 @@ static void verify_edge_counter(ir_node *irn, void *env)
        int                    list_cnt;
        int                    ref_cnt;
        int                    edge_cnt;
-       unsigned long          idx;
+       size_t                 idx;
        const struct list_head *head;
        const struct list_head *pos;