diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2021-05-07 12:03:01 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2021-05-07 15:01:35 -0400 |
commit | 14b0f37a644d7b59e1737fb275ec4fff044972a8 (patch) | |
tree | 82f00813ce65dafa682bc3f092f8e599af64968c /gcc/value-range.h | |
parent | a7943ea96d6a076a06eb06bd71a2656e682b8a78 (diff) | |
download | gcc-14b0f37a644d7b59e1737fb275ec4fff044972a8.zip gcc-14b0f37a644d7b59e1737fb275ec4fff044972a8.tar.gz gcc-14b0f37a644d7b59e1737fb275ec4fff044972a8.tar.bz2 |
Clean up and virtualize the on-entry cache interface.
Cleanup/Virtualize the ssa_block_range class, and implement the current
vector approach as a derived class.
Allow memory allocation from the irange allocator obstack for easy freeing.
* gimple-range-cache.cc (ssa_block_ranges): Virtualize.
(sbr_vector): Renamed from ssa_block_cache.
(sbr_vector::sbr_vector): Allocate from obstack abd initialize.
(ssa_block_ranges::~ssa_block_ranges): Remove.
(sbr_vector::set_bb_range): Use varying and undefined cached values.
(ssa_block_ranges::set_bb_varying): Remove.
(sbr_vector::get_bb_range): Adjust assert.
(sbr_vector::bb_range_p): Adjust assert.
(~block_range_cache): No freeing loop required.
(block_range_cache::get_block_ranges): Remove.
(block_range_cache::set_bb_range): Inline get_block_ranges.
(block_range_cache::set_bb_varying): Remove.
* gimple-range-cache.h (set_bb_varying): Remove prototype.
* value-range.h (irange_allocator::get_memory): New.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r-- | gcc/value-range.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index f63433a..3e58dad 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -639,6 +639,7 @@ public: // Return a copy of SRC with the minimum amount of sub-ranges needed // to represent it. irange *allocate (const irange &src); + void *get_memory (unsigned num_bytes); private: DISABLE_COPY_AND_ASSIGN (irange_allocator); struct obstack m_obstack; @@ -656,6 +657,14 @@ irange_allocator::~irange_allocator () obstack_free (&m_obstack, NULL); } +// Provide a hunk of memory from the obstack +inline void * +irange_allocator::get_memory (unsigned num_bytes) +{ + void *r = obstack_alloc (&m_obstack, num_bytes); + return r; +} + // Return a new range with NUM_PAIRS. inline irange * |