From a4ff9076deb815aa980c006a6658eb3898c18e8e Mon Sep 17 00:00:00 2001 From: aldyh Date: Mon, 13 Nov 2017 18:30:50 +0000 Subject: 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 --- gcc/ssa-range-gen.c | 11 +++++++---- gcc/ssa-range-gen.h | 4 +++- 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 &bbs) +path_ranger::path_range (irange &r, tree name, const vec &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 &); 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 &bbs); + bool path_range (irange &r, tree name, const vec &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); -- cgit v1.2.1