diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
commit | e252b51ccde010cbd2a146485d8045103cd99533 (patch) | |
tree | e060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/value-query.h | |
parent | f10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff) | |
parent | 104c05c5284b7822d770ee51a7d91946c7e56d50 (diff) | |
download | gcc-e252b51ccde010cbd2a146485d8045103cd99533.zip gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2 |
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/value-query.h')
-rw-r--r-- | gcc/value-query.h | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/gcc/value-query.h b/gcc/value-query.h index e2cbc68..5161d23 100644 --- a/gcc/value-query.h +++ b/gcc/value-query.h @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_QUERY_H #define GCC_QUERY_H +#include "value-relation.h" + // The value_query class is used by optimization passes that require // valueizing SSA names in terms of a tree value, but have no neeed // for ranges. @@ -39,12 +41,12 @@ class value_query { public: value_query () { } - // Return the singleton expression for NAME at a gimple statement, + // Return the singleton expression for EXPR at a gimple statement, // or NULL if none found. - virtual tree value_of_expr (tree name, gimple * = NULL) = 0; - // Return the singleton expression for NAME at an edge, or NULL if + virtual tree value_of_expr (tree expr, gimple * = NULL) = 0; + // Return the singleton expression for EXPR at an edge, or NULL if // none found. - virtual tree value_on_edge (edge, tree name); + virtual tree value_on_edge (edge, tree expr); // Return the singleton expression for the LHS of a gimple // statement, assuming an (optional) initial value of NAME. Returns // NULL if none found. @@ -77,8 +79,8 @@ public: range_query (); virtual ~range_query (); - virtual tree value_of_expr (tree name, gimple * = NULL) OVERRIDE; - virtual tree value_on_edge (edge, tree name) OVERRIDE; + virtual tree value_of_expr (tree expr, gimple * = NULL) OVERRIDE; + virtual tree value_on_edge (edge, tree expr) OVERRIDE; virtual tree value_of_stmt (gimple *, tree name = NULL) OVERRIDE; // These are the range equivalents of the value_* methods. Instead @@ -86,22 +88,46 @@ public: // R. TRUE is returned on success or FALSE if no range was found. // // Note that range_of_expr must always return TRUE unless ranges are - // unsupported for NAME's type (supports_type_p is false). - virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) = 0; - virtual bool range_on_edge (irange &r, edge, tree name); + // unsupported for EXPR's type (supports_type_p is false). + virtual bool range_of_expr (irange &r, tree expr, gimple * = NULL) = 0; + virtual bool range_on_edge (irange &r, edge, tree expr); virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL); + // Query if there is any relation between SSA1 and SSA2. + relation_kind query_relation (gimple *s, tree ssa1, tree ssa2, + bool get_range = true); + relation_kind query_relation (edge e, tree ssa1, tree ssa2, + bool get_range = true); + // If present, Access relation oracle for more advanced uses. + inline relation_oracle *oracle () const { return m_oracle; } + // DEPRECATED: This method is used from vr-values. The plan is to // rewrite all uses of it to the above API. virtual const class value_range_equiv *get_value_range (const_tree, gimple * = NULL); + virtual void dump (FILE *); protected: class value_range_equiv *allocate_value_range_equiv (); void free_value_range_equiv (class value_range_equiv *); + bool get_tree_range (irange &r, tree expr, gimple *stmt); + bool get_arith_expr_range (irange &r, tree expr, gimple *stmt); + relation_oracle *m_oracle; private: class equiv_allocator *equiv_alloc; }; +// Global ranges for SSA names using SSA_NAME_RANGE_INFO. + +class global_range_query : public range_query +{ +public: + bool range_of_expr (irange &r, tree expr, gimple * = NULL) OVERRIDE; +}; + +extern global_range_query global_ranges; +extern value_range gimple_range_global (tree name); +extern bool update_global_range (irange &r, tree name); + #endif // GCC_QUERY_H |