Commit e360ab39 by Roger Sayle Committed by Roger Sayle

sbitmap.c (sbitmap_resize): New function.


	* sbitmap.c (sbitmap_resize): New function.
	* sbitmap.h (sbitmap_resize): Prototype here.
	* recog.c (split_all_insns): Use sbitmap_resize.

From-SVN: r63058
parent 6b00cbc7
2003-02-18 Roger Sayle <roger@eyesopen.com>
* sbitmap.c (sbitmap_resize): New function.
* sbitmap.h (sbitmap_resize): Prototype here.
* recog.c (split_all_insns): Use sbitmap_resize.
2003-02-18 Kazu Hirata <kazu@cs.umass.edu> 2003-02-18 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.md (*zero_extendhisi2_h8300): Fix the * config/h8300/h8300.md (*zero_extendhisi2_h8300): Fix the
......
...@@ -2883,18 +2883,7 @@ split_all_insns (upd_life) ...@@ -2883,18 +2883,7 @@ split_all_insns (upd_life)
find_many_sub_basic_blocks (blocks); find_many_sub_basic_blocks (blocks);
if (old_last_basic_block != last_basic_block && upd_life) if (old_last_basic_block != last_basic_block && upd_life)
{ blocks = sbitmap_resize (blocks, last_basic_block, 1);
sbitmap new_blocks = sbitmap_alloc (last_basic_block);
sbitmap_copy (new_blocks, blocks);
while (old_last_basic_block < last_basic_block)
{
SET_BIT (new_blocks, old_last_basic_block);
old_last_basic_block++;
}
sbitmap_free (blocks);
new_blocks = blocks;
}
} }
if (changed && upd_life) if (changed && upd_life)
......
/* Simple bitmaps. /* Simple bitmaps.
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -49,6 +49,64 @@ sbitmap_alloc (n_elms) ...@@ -49,6 +49,64 @@ sbitmap_alloc (n_elms)
return bmap; return bmap;
} }
/* Resize a simple bitmap BMAP to N_ELMS bits. If increasing the
size of BMAP, clear the new bits to zero if the DEF argument
is zero, and set them to one otherwise. */
sbitmap
sbitmap_resize (bmap, n_elms, def)
sbitmap bmap;
unsigned int n_elms;
int def;
{
unsigned int bytes, size, amt;
unsigned int last_bit;
size = SBITMAP_SET_SIZE (n_elms);
bytes = size * sizeof (SBITMAP_ELT_TYPE);
if (bytes > bmap->bytes)
{
amt = (sizeof (struct simple_bitmap_def)
+ bytes - sizeof (SBITMAP_ELT_TYPE));
bmap = (sbitmap) xrealloc ((PTR) bmap, amt);
}
if (n_elms > bmap->n_bits)
{
if (def)
{
memset ((PTR) (bmap->elms + bmap->size), -1, bytes - bmap->bytes);
/* Set the new bits if the original last element. */
last_bit = bmap->n_bits % SBITMAP_ELT_BITS;
if (last_bit)
bmap->elms[bmap->size - 1]
|= ~((SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit));
/* Clear the unused bit in the new last element. */
last_bit = n_elms % SBITMAP_ELT_BITS;
if (last_bit)
bmap->elms[size - 1]
&= (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
}
else
memset ((PTR) (bmap->elms + bmap->size), 0, bytes - bmap->bytes);
}
else if (n_elms < bmap->n_bits)
{
/* Clear the surplus bits in the last word. */
last_bit = n_elms % SBITMAP_ELT_BITS;
if (last_bit)
bmap->elms[size - 1]
&= (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
}
bmap->n_bits = n_elms;
bmap->size = size;
bmap->bytes = bytes;
return bmap;
}
/* Allocate a vector of N_VECS bitmaps of N_ELMS bits. */ /* Allocate a vector of N_VECS bitmaps of N_ELMS bits. */
sbitmap * sbitmap *
......
/* Simple bitmaps. /* Simple bitmaps.
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -125,6 +125,7 @@ extern void dump_sbitmap_vector PARAMS ((FILE *, const char *, ...@@ -125,6 +125,7 @@ extern void dump_sbitmap_vector PARAMS ((FILE *, const char *,
int)); int));
extern sbitmap sbitmap_alloc PARAMS ((unsigned int)); extern sbitmap sbitmap_alloc PARAMS ((unsigned int));
extern sbitmap *sbitmap_vector_alloc PARAMS ((unsigned int, unsigned int)); extern sbitmap *sbitmap_vector_alloc PARAMS ((unsigned int, unsigned int));
extern sbitmap sbitmap_resize PARAMS ((sbitmap, unsigned int, int));
extern void sbitmap_copy PARAMS ((sbitmap, sbitmap)); extern void sbitmap_copy PARAMS ((sbitmap, sbitmap));
extern int sbitmap_equal PARAMS ((sbitmap, sbitmap)); extern int sbitmap_equal PARAMS ((sbitmap, sbitmap));
extern void sbitmap_zero PARAMS ((sbitmap)); extern void sbitmap_zero PARAMS ((sbitmap));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment