aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.h
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2022-05-09 15:35:14 -0400
committerAndrew MacLeod <amacleod@redhat.com>2022-05-17 14:38:03 -0400
commitb7501739f3b14ac7749aace93f636d021fd607f7 (patch)
tree5c359661a70191c7ee4cc92b6d001a78ff26c099 /gcc/gimple-range-cache.h
parent451894cadcf1210883ceefb2d69a0ed2d6a8cd8b (diff)
downloadgcc-b7501739f3b14ac7749aace93f636d021fd607f7.zip
gcc-b7501739f3b14ac7749aace93f636d021fd607f7.tar.gz
gcc-b7501739f3b14ac7749aace93f636d021fd607f7.tar.bz2
Add side effect infrastructure.
Replace the non-null procesing with a generic side effect implementation that can handle arbitrary side effects. * Makefile.in (OBJS): Add gimple-range-side-effect.o. * gimple-range-cache.cc (non_null_ref::non_null_ref): Delete. (non_null_ref::~non_null_ref): Delete. (non_null_ref::set_nonnull): Delete. (non_null_ref::non_null_deref_p): Delete. (non_null_ref::process_name): Delete. (ranger_cache::ranger_cache): Initialize m_exit object. (ranger_cache::fill_block_cache): Use m_exit object intead of nonnull. (ranger_cache::range_from_dom): Use side_effect class and m_exit object. (ranger_cache::update_to_nonnull): Delete. (non_null_loadstore): Delete. (ranger_cache::block_apply_nonnull): Delete. (ranger_cache::apply_side_effects): New. * gimple-range-cache.h (class non_null_ref): Delete. (non_null_ref::adjust_range): Delete. (class ranger_cache): Adjust prototypes, add side effect manager. * gimple-range-path.cc (path_range_query::range_defined_in_block): Use side effect manager for queries. (path_range_query::adjust_for_non_null_uses): Ditto. * gimple-range-path.h (class path_range_query): Delete non_null_ref. * gimple-range-side-effect.cc: New. * gimple-range-side-effect.h: New. * gimple-range.cc (gimple_ranger::gimple_ranger): Update contructor. (gimple_ranger::range_of_expr): Check def block for override value. (gimple_ranger::range_on_entry): Don't scan dominators for non-null. (gimple_ranger::range_on_edge): Check for outgoing side-effects. (gimple_ranger::register_side_effects): Call apply_side_effects. (enable_ranger): Update contructor. * gimple-range.h (class gimple_ranger): Update prototype. (enable_ranger): Update prototype. * tree-vrp.cc (execute_ranger_vrp): Invoke without immediate-use flag.
Diffstat (limited to 'gcc/gimple-range-cache.h')
-rw-r--r--gcc/gimple-range-cache.h58
1 files changed, 4 insertions, 54 deletions
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index 560403b..42aa41b 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -22,56 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_SSA_RANGE_CACHE_H
#include "gimple-range-gori.h"
-
-// Class used to track non-null references of an SSA name. A vector
-// of bitmaps indexed by SSA name is maintained. When indexed by
-// basic block, an on-bit indicates there is a non-null dereference
-// for that SSA in that block.
-
-class non_null_ref
-{
-public:
- non_null_ref ();
- ~non_null_ref ();
- bool non_null_deref_p (tree name, basic_block bb, bool search_dom = true);
- bool adjust_range (irange &r, tree name, basic_block bb,
- bool search_dom = true);
- bool set_nonnull (basic_block bb, tree name);
-private:
- vec <bitmap> m_nn;
- void process_name (tree name);
- bitmap_obstack m_bitmaps;
-};
-
-// If NAME has a non-null dereference in block BB, adjust R with the
-// non-zero information from non_null_deref_p, and return TRUE. If
-// SEARCH_DOM is true, non_null_deref_p should search the dominator tree.
-
-inline bool
-non_null_ref::adjust_range (irange &r, tree name, basic_block bb,
- bool search_dom)
-{
- // Non-call exceptions mean we could throw in the middle of the
- // block, so just punt on those for now.
- if (cfun->can_throw_non_call_exceptions)
- return false;
- // We only care about the null / non-null property of pointers.
- if (!POINTER_TYPE_P (TREE_TYPE (name)))
- return false;
- if (r.undefined_p () || r.lower_bound () != 0 || r.upper_bound () == 0)
- return false;
- // Check if pointers have any non-null dereferences.
- if (non_null_deref_p (name, bb, search_dom))
- {
- // Remove zero from the range.
- gcc_checking_assert (TYPE_UNSIGNED (TREE_TYPE (name)));
- int_range<2> nz;
- nz.set_nonzero (TREE_TYPE (name));
- r.intersect (nz);
- return true;
- }
- return false;
-}
+#include "gimple-range-side-effect.h"
// This class manages a vector of pointers to ssa_block ranges. It
// provides the basis for the "range on entry" cache for all
@@ -123,7 +74,7 @@ private:
class ranger_cache : public range_query
{
public:
- ranger_cache (int not_executable_flag);
+ ranger_cache (int not_executable_flag, bool use_imm_uses);
~ranger_cache ();
virtual bool range_of_expr (irange &r, tree name, gimple *stmt);
@@ -136,10 +87,9 @@ public:
void propagate_updated_value (tree name, basic_block bb);
- void block_apply_nonnull (gimple *s);
- void update_to_nonnull (basic_block bb, tree name);
- non_null_ref m_non_null;
+ void apply_side_effects (gimple *s);
gori_compute m_gori;
+ side_effect_manager m_exit;
void dump_bb (FILE *f, basic_block bb);
virtual void dump (FILE *f) OVERRIDE;