diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-07-03 15:25:38 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-07-03 17:33:23 +0200 |
commit | 3ae9def08565c36af2dc0bff495545ee1e9db642 (patch) | |
tree | 2dc04b1d77cc6cf291fa183a0c6a74deea50708b /gcc/gimple-range-edge.cc | |
parent | 17f2e2b77b6610afb8fafd41d0537d3e4429efe0 (diff) | |
download | gcc-3ae9def08565c36af2dc0bff495545ee1e9db642.zip gcc-3ae9def08565c36af2dc0bff495545ee1e9db642.tar.gz gcc-3ae9def08565c36af2dc0bff495545ee1e9db642.tar.bz2 |
Move range allocator code to value-range-storage.*
Now that vrange_storage is in its own file, I think it's prudent to
move all the vrange allocator code there since it's all related.
The users of value-range.h do not need to know the implementation
details of the storage facilities.
Tested and benchmarked on x86-64 Linux.
gcc/ChangeLog:
* gimple-range-cache.cc: Include value-range-storage.h.
* gimple-range-cache.h (class block_range_cache): Add "class" to
m_range_allocator.
* gimple-range-edge.cc
(gimple_outgoing_range::gimple_outgoing_range): Allocate allocator.
(gimple_outgoing_range::~gimple_outgoing_range): Free allocator.
(gimple_outgoing_range::calc_switch_ranges): Dereference allocator.
* gimple-range-edge.h: Add "class" to m_range_allocator.
* gimple-range-infer.cc
(infer_range_manager::infer_range_manager): Allocate allocator.
(infer_range_manager::~infer_range_manager): Free allocator.
(infer_range_manager::get_nonzero): Dereference allocator.
(infer_range_manager::add_range): Same.
* gimple-range-infer.h (class vrange_allocator): Add "class" to
m_range_allocator.
* value-range-storage.h (class vrange_allocator): Move from
value-range.h.
(class obstack_vrange_allocator): Same.
(class ggc_vrange_allocator): Same.
(vrange_allocator::alloc_vrange): Same.
(vrange_allocator::alloc_irange): Same.
* value-range.h (class vrange_allocator): Move to value-range-storage.h.
(class obstack_vrange_allocator): Same.
(class ggc_vrange_allocator): Same.
Diffstat (limited to 'gcc/gimple-range-edge.cc')
-rw-r--r-- | gcc/gimple-range-edge.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc index 03a804a..194e8f8 100644 --- a/gcc/gimple-range-edge.cc +++ b/gcc/gimple-range-edge.cc @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "tree-cfg.h" #include "gimple-range.h" +#include "value-range-storage.h" // If there is a range control statment at the end of block BB, return it. // Otherwise return NULL. @@ -68,6 +69,7 @@ gimple_outgoing_range::gimple_outgoing_range (int max_sw_edges) { m_edge_table = NULL; m_max_edges = max_sw_edges; + m_range_allocator = new obstack_vrange_allocator; } @@ -75,6 +77,7 @@ gimple_outgoing_range::~gimple_outgoing_range () { if (m_edge_table) delete m_edge_table; + delete m_range_allocator; } @@ -162,13 +165,13 @@ gimple_outgoing_range::calc_switch_ranges (gswitch *sw) // If there was an existing range and it doesn't fit, we lose the memory. // It'll get reclaimed when the obstack is freed. This seems less // intrusive than allocating max ranges for each case. - slot = m_range_allocator.clone <irange> (case_range); + slot = m_range_allocator->clone <irange> (case_range); } irange *&slot = m_edge_table->get_or_insert (default_edge, &existed); // This should be the first call into this switch. gcc_checking_assert (!existed); - irange *dr = m_range_allocator.clone <irange> (default_range); + irange *dr = m_range_allocator->clone <irange> (default_range); slot = dr; } |