diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2020-06-03 10:56:13 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2020-06-03 10:56:13 -0400 |
commit | c6e8b9bb06e4ba28dafcd685b8f85167b55ac829 (patch) | |
tree | 6468179464574db254aa2cd5ec6aee08e7d9a77a /gcc | |
parent | 5a8c373b79c1b66dbd9f165d06bdec385df4bf1c (diff) | |
download | gcc-c6e8b9bb06e4ba28dafcd685b8f85167b55ac829.zip gcc-c6e8b9bb06e4ba28dafcd685b8f85167b55ac829.tar.gz gcc-c6e8b9bb06e4ba28dafcd685b8f85167b55ac829.tar.bz2 |
use a bitmap obstack in the gori object instead of malloc
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gimple-range-gori.cc | 25 | ||||
-rw-r--r-- | gcc/gimple-range-gori.h | 5 |
2 files changed, 14 insertions, 16 deletions
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index 9e20b0a..8d90ae7 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -125,7 +125,7 @@ range_def_chain::build_def_chain (tree name, bitmap result, basic_block bb) { // Get the def chain for the operand b = get_def_chain (name); - // If there was one, copy it into result and retuirn the terminal name. + // If there was one, copy it into result and return the terminal name. if (b) { bitmap_ior_into (result, b); @@ -242,24 +242,16 @@ gori_map::gori_map () m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun)); m_incoming.create (0); m_incoming.safe_grow_cleared (last_basic_block_for_fn (cfun)); - + bitmap_obstack_initialize (&m_bitmaps); } // Free any memory the GORI map allocated. gori_map::~gori_map () { - unsigned bb; - for (bb = 0; bb < m_outgoing.length (); ++bb) - if (m_outgoing[bb]) - BITMAP_FREE (m_outgoing[bb]); - m_outgoing.release (); - - for (bb = 0; bb < m_incoming.length (); ++bb) - if (m_incoming[bb]) - BITMAP_FREE (m_incoming[bb]); + bitmap_obstack_release (&m_bitmaps); m_incoming.release (); - + m_outgoing.release (); } // Return the bitmap vector of all imports to BB. Calculate if necessary. @@ -347,9 +339,14 @@ void gori_map::calculate_gori (basic_block bb) { tree name; + if (bb->index >= (signed int)m_outgoing.length ()) + { + m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun)); + m_incoming.safe_grow_cleared (last_basic_block_for_fn (cfun)); + } gcc_assert (m_outgoing[bb->index] == NULL); - m_outgoing[bb->index] = BITMAP_ALLOC (NULL); - m_incoming[bb->index] = BITMAP_ALLOC (NULL); + m_outgoing[bb->index] = BITMAP_ALLOC (&m_bitmaps); + m_incoming[bb->index] = BITMAP_ALLOC (&m_bitmaps); // If this block's last statement may generate range informaiton, go // calculate it. diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h index 7a5e168..d3669e3 100644 --- a/gcc/gimple-range-gori.h +++ b/gcc/gimple-range-gori.h @@ -124,8 +124,9 @@ public: void dump (FILE *f); void dump (FILE *f, basic_block bb); private: - vec<bitmap> m_outgoing; // BB: Outgoing ranges generated. - vec<bitmap> m_incoming; // BB: ranges coming in. + bitmap_obstack m_bitmaps; + vec<bitmap> m_outgoing; // BB: Outgoing ranges calculatable on edges + vec<bitmap> m_incoming; // BB: block imports void maybe_add_gori (tree name, basic_block bb); void calculate_gori (basic_block bb); bitmap imports (basic_block bb); |