summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-13 18:30:50 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-13 18:30:50 +0000
commita4ff9076deb815aa980c006a6658eb3898c18e8e (patch)
treed75655e2eb3450f3ca1a7c7baec821e4724569a1
parent36abc601360ccc2ae5d05008f09869fc968293a2 (diff)
downloadgcc-a4ff9076deb815aa980c006a6658eb3898c18e8e.tar.gz
Add direction argument to path_range().
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/range-gen3@254701 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ssa-range-gen.c11
-rw-r--r--gcc/ssa-range-gen.h4
2 files changed, 10 insertions, 5 deletions
diff --git a/gcc/ssa-range-gen.c b/gcc/ssa-range-gen.c
index 36d782dbf7e..9cf89f4eb48 100644
--- a/gcc/ssa-range-gen.c
+++ b/gcc/ssa-range-gen.c
@@ -1035,13 +1035,16 @@ path_ranger::path_range_of_def (irange &r, gimple *g, edge e)
/* Calculate the known range for NAME on a path of basic blocks in
BBS. If such a range exists, store it in R and return TRUE,
- otherwise return FALSE. */
+ otherwise return FALSE.
+
+ DIR is FORWARD if BBS[0] is the definition and the last block is
+ the use. DIR is REVERSE if the blocks are in reverse order. */
bool
-path_ranger::path_range (irange &r, tree name, const vec<basic_block> &bbs)
+path_ranger::path_range (irange &r, tree name, const vec<basic_block> &bbs,
+ enum path_range_direction dir)
{
- /* Handle paths in which the blocks are reversed. */
- if (bbs.length () > 1 && find_edge (bbs[1], bbs[0]))
+ if (dir == REVERSE)
return path_range_reverse (r, name, bbs);
/* ?? Should we start with a known range for NAME? */
diff --git a/gcc/ssa-range-gen.h b/gcc/ssa-range-gen.h
index f77033d19d8..12e22ed7cf4 100644
--- a/gcc/ssa-range-gen.h
+++ b/gcc/ssa-range-gen.h
@@ -108,13 +108,15 @@ private:
void determine_block (tree name, basic_block bb, basic_block def_bb);
bool path_range_reverse (irange &r, tree name, const vec<basic_block> &);
public:
+ enum path_range_direction { FORWARD, REVERSE };
path_ranger ();
/* What is the known range of name from its DEF point to edge E. */
bool path_range_edge (irange& r, tree name, edge e);
bool path_range_entry (irange& r, tree name, basic_block bb);
bool path_range_stmt (irange& r, tree name, gimple *g);
- bool path_range (irange &r, tree name, const vec<basic_block> &bbs);
+ bool path_range (irange &r, tree name, const vec<basic_block> &bbs,
+ enum path_range_direction);
// Evaluate expression within a BB as much as possible.
bool path_range_of_def (irange& r, gimple *g, edge e = NULL);