public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-626] Make TRUE/FALSE edge calculation available without the outgoing edge class.
@ 2021-05-07 19:02 Andrew Macleod
0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-05-07 19:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:12f0a54ba9fa25aa13af368af5bb07e345c33dff
commit r12-626-g12f0a54ba9fa25aa13af368af5bb07e345c33dff
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Mon Apr 26 18:14:15 2021 -0400
Make TRUE/FALSE edge calculation available without the outgoing edge class.
Rename class to gimple_outoging_edge and provide a non-class routine for
the outgoing edge of a gcond.
* gimple-range-edge.h (gimple_outgoing_range): Rename from
outgoing_range.
(gcond_edge_range): Export prototype.
* gimple-range-edge.cc (gcond_edge_range): New.
(gimple_outgoing_range::edge_range_p): Use gcond_edge_range.
* gimple-range-gori.h (gori_compute): Use gimple_outgoing_range.
Diff:
---
gcc/gimple-range-edge.cc | 31 ++++++++++++++++++++-----------
gcc/gimple-range-edge.h | 12 +++++++-----
gcc/gimple-range-gori.h | 2 +-
3 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index 4d4cb97bbec..d11153e677e 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -52,12 +52,26 @@ gimple_outgoing_range_stmt_p (basic_block bb)
}
-outgoing_range::outgoing_range ()
+// Return a TRUE or FALSE range representing the edge value of a GCOND.
+
+void
+gcond_edge_range (irange &r, edge e)
+{
+ gcc_checking_assert (e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE));
+ if (e->flags & EDGE_TRUE_VALUE)
+ r = int_range<2> (boolean_true_node, boolean_true_node);
+ else
+ r = int_range<2> (boolean_false_node, boolean_false_node);
+}
+
+
+gimple_outgoing_range::gimple_outgoing_range ()
{
m_edge_table = NULL;
}
-outgoing_range::~outgoing_range ()
+
+gimple_outgoing_range::~gimple_outgoing_range ()
{
if (m_edge_table)
delete m_edge_table;
@@ -68,7 +82,7 @@ outgoing_range::~outgoing_range ()
// Use a cached value if it exists, or calculate it if not.
bool
-outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
+gimple_outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
{
gcc_checking_assert (is_a<gswitch *> (s));
gswitch *sw = as_a<gswitch *> (s);
@@ -100,7 +114,7 @@ outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
// Calculate all switch edges from SW and cache them in the hash table.
void
-outgoing_range::calc_switch_ranges (gswitch *sw)
+gimple_outgoing_range::calc_switch_ranges (gswitch *sw)
{
bool existed;
unsigned x, lim;
@@ -165,7 +179,7 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
// return NULL
gimple *
-outgoing_range::edge_range_p (irange &r, edge e)
+gimple_outgoing_range::edge_range_p (irange &r, edge e)
{
// Determine if there is an outgoing edge.
gimple *s = gimple_outgoing_range_stmt_p (e->src);
@@ -174,12 +188,7 @@ outgoing_range::edge_range_p (irange &r, edge e)
if (is_a<gcond *> (s))
{
- if (e->flags & EDGE_TRUE_VALUE)
- r = int_range<2> (boolean_true_node, boolean_true_node);
- else if (e->flags & EDGE_FALSE_VALUE)
- r = int_range<2> (boolean_false_node, boolean_false_node);
- else
- gcc_unreachable ();
+ gcond_edge_range (r, e);
return s;
}
diff --git a/gcc/gimple-range-edge.h b/gcc/gimple-range-edge.h
index 8970c9e14d6..87b4124d01d 100644
--- a/gcc/gimple-range-edge.h
+++ b/gcc/gimple-range-edge.h
@@ -35,11 +35,11 @@ along with GCC; see the file COPYING3. If not see
// The return value is NULL for no range, or the branch statement which the
// edge gets the range from, along with the range.
-class outgoing_range
+class gimple_outgoing_range
{
public:
- outgoing_range ();
- ~outgoing_range ();
+ gimple_outgoing_range ();
+ ~gimple_outgoing_range ();
gimple *edge_range_p (irange &r, edge e);
private:
void calc_switch_ranges (gswitch *sw);
@@ -47,9 +47,11 @@ private:
hash_map<edge, irange *> *m_edge_table;
irange_allocator m_range_allocator;
-};
+};
-// If there is a range control statment at the end of block BB, return it.
+// If there is a range control statement at the end of block BB, return it.
gimple *gimple_outgoing_range_stmt_p (basic_block bb);
+// Return the range on edge E if it is from a GCOND. Either TRUE or FALSE.
+void gcond_edge_range (irange &r, edge e);
#endif // GIMPLE_RANGE_EDGE_H
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 48c746d1f37..7bb18a9baf1 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -108,7 +108,7 @@ private:
const irange &lhs, tree name);
class gori_map *m_gori_map;
- outgoing_range outgoing; // Edge values for COND_EXPR & SWITCH_EXPR.
+ gimple_outgoing_range outgoing; // Edge values for COND_EXPR & SWITCH_EXPR.
};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-07 19:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 19:02 [gcc r12-626] Make TRUE/FALSE edge calculation available without the outgoing edge class Andrew Macleod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).