aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-query.h
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2024-04-30 09:35:23 -0400
committerAndrew MacLeod <amacleod@redhat.com>2024-05-23 16:45:53 -0400
commit3be530f6d77ec24c94589341b069b199cfe6c2eb (patch)
treed1c1561e97272858cd32304998b5da993208ce58 /gcc/value-query.h
parent67afcf28570ff62210e1998f35def2be5cb8cb08 (diff)
downloadgcc-3be530f6d77ec24c94589341b069b199cfe6c2eb.zip
gcc-3be530f6d77ec24c94589341b069b199cfe6c2eb.tar.gz
gcc-3be530f6d77ec24c94589341b069b199cfe6c2eb.tar.bz2
Move to an always available relation oracle.
This eliminates the need to check if the relation oracle pointer is NULL before every call by providing a default oracle which does nothing. REmove unused routines, and Unify register_relation method names. * gimple-range-cache.cc (ranger_cache::dump_bb): Remove check for NULL oracle pointer. (ranger_cache::fill_block_cache): Likewise. * gimple-range-fold.cc (fur_stmt::get_phi_operand): Likewise. (fur_depend::fur_depend): Likewise. (fur_depend::register_relation): Likewise, use qury_relation. (fold_using_range::range_of_phi): Likewise. (fold_using_range::relation_fold_and_or): Likewise. * gimple-range-fold.h (fur_source::m_oracle): Delete. Oracle can be accessed dirctly via m_query now. * gimple-range-path.cc (path_range_query::path_range_query): Adjust for oracle reference pointer. (path_range_query::compute_ranges): Likewise. (jt_fur_source::jt_fur_source): Adjust for no m_oracle member. (jt_fur_source::register_relation): Do not check for NULL pointer. (jt_fur_source::query_relation): Likewise. * gimple-range.cc (gimple_ranger::gimple_ranger): Adjust for reference pointer. * value-query.cc (default_relation_oracle): New. (range_query::create_relation_oracle): Relocate from header. Ensure not being added to global query. (range_query::destroy_relation_oracle): Relocate from header. (range_query::range_query): Initailize to default oracle. (ange_query::~range_query): Call destroy_relation_oracle. * value-query.h (class range_query): Adjust prototypes. (range_query::create_relation_oracle): Move to source file. (range_query::destroy_relation_oracle): Move to source file. * value-relation.cc (relation_oracle::validate_relation): Delete. (relation_oracle::register_stmt): Rename to register_relation. (relation_oracle::register_edge): Likewise. * value-relation.h (register_stmt): Rename to register_relation and provide default function in base class. (register_edge): Likewise. (relation_oracle::validate_relation): Delete. (relation_oracle::query_relation): Provide default in base class. (relation_oracle::dump): Likewise. (relation_oracle::equiv_set): Likewise. (default_relation_oracle): New extenal reference. (partial_equiv_set, add_partial_equiv): Move to protected.
Diffstat (limited to 'gcc/value-query.h')
-rw-r--r--gcc/value-query.h31
1 files changed, 3 insertions, 28 deletions
diff --git a/gcc/value-query.h b/gcc/value-query.h
index 9df8990..ed355be 100644
--- a/gcc/value-query.h
+++ b/gcc/value-query.h
@@ -75,12 +75,12 @@ public:
virtual bool range_on_entry (vrange &r, basic_block bb, tree expr);
virtual bool range_on_exit (vrange &r, basic_block bb, tree expr);
- inline relation_oracle *oracle () const { return m_oracle; }
+ inline class relation_oracle &oracle () const { return *m_oracle; }
+ void create_relation_oracle ();
+ void destroy_relation_oracle ();
virtual void dump (FILE *);
- void create_relation_oracle ();
- void destroy_relation_oracle ();
protected:
bool get_tree_range (vrange &v, tree expr, gimple *stmt,
basic_block bbentry = NULL, basic_block bbexit = NULL);
@@ -118,29 +118,4 @@ get_range_query (const struct function *fun)
// Query the global range of NAME in function F. Default to cfun.
extern void gimple_range_global (vrange &v, tree name,
struct function *f = cfun);
-
-// Create dominance based range oracle for the current query if dom info is
-// available.
-
-inline void
-range_query::create_relation_oracle ()
-{
- if (!dom_info_available_p (CDI_DOMINATORS))
- return;
- gcc_checking_assert (m_oracle == NULL);
- m_oracle = new dom_oracle ();
-}
-
-// Destroy any relation oracle that was created.
-
-inline void
-range_query::destroy_relation_oracle ()
-{
- if (m_oracle != NULL)
- {
- delete m_oracle;
- m_oracle = NULL;
- }
-}
-
#endif // GCC_QUERY_H