[gcc(refs/users/aldyh/heads/ranger-relational)] Fix remaining import issues. streamline gori-computes routines.
Andrew Macleod
amacleod@gcc.gnu.org
Thu Mar 18 19:51:48 GMT 2021
https://gcc.gnu.org/g:59e762c7b259f8636e441484bc19529da6532fc8
commit 59e762c7b259f8636e441484bc19529da6532fc8
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Wed Mar 17 15:45:33 2021 -0400
Fix remaining import issues. streamline gori-computes routines.
Diff:
---
gcc/gimple-range-gori.cc | 512 ++++++++++++++++++++++-------------------------
gcc/gimple-range-gori.h | 25 +--
2 files changed, 244 insertions(+), 293 deletions(-)
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 573d952ffd5..316dea848bb 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -142,6 +142,16 @@ range_def_chain::get_imports (tree name)
return i;
}
+// Return true if IMPORT is an import to NAMEs def chain.
+
+bool
+range_def_chain::chain_import_p (tree name, tree import)
+{
+ bitmap b = get_imports (name);
+ if (b)
+ return bitmap_bit_p (b, SSA_NAME_VERSION (import));
+ return false;
+}
// Build def_chains for NAME if it is in BB. Copy the def chain into RESULT.
@@ -234,17 +244,17 @@ range_def_chain::get_def_chain (tree name)
gimple *stmt = SSA_NAME_DEF_STMT (name);
if (gimple_range_handler (stmt))
{
- ssa1 = gimple_range_operand1 (stmt);
- ssa2 = gimple_range_operand2 (stmt);
+ ssa1 = gimple_range_ssa_p (gimple_range_operand1 (stmt));
+ ssa2 = gimple_range_ssa_p (gimple_range_operand2 (stmt));
ssa3 = NULL_TREE;
}
else if (is_a<gassign *> (stmt)
&& gimple_assign_rhs_code (stmt) == COND_EXPR)
{
gassign *st = as_a<gassign *> (stmt);
- ssa1 = gimple_assign_rhs1 (st);
- ssa2 = gimple_assign_rhs2 (st);
- ssa3 = gimple_assign_rhs3 (st);
+ ssa1 = gimple_range_ssa_p (gimple_assign_rhs1 (st));
+ ssa2 = gimple_range_ssa_p (gimple_assign_rhs2 (st));
+ ssa3 = gimple_range_ssa_p (gimple_assign_rhs3 (st));
}
else
{
@@ -373,6 +383,14 @@ gori_map::is_export_p (tree name, basic_block bb)
return bitmap_bit_p (exports (bb), SSA_NAME_VERSION (name));
}
+// Return true if NAME is an import to block BB.
+
+bool
+gori_map::is_import_p (tree name, basic_block bb)
+{
+ // If no BB is specified, test if it is exported anywhere in the IL.
+ return bitmap_bit_p (imports (bb), SSA_NAME_VERSION (name));
+}
// Clear the m_maybe_variant bit so ranges will not be tracked for NAME.
void
@@ -551,50 +569,6 @@ gori_compute::expr_range_in_bb (irange &r, tree expr, basic_block bb)
get_tree_range (r, expr);
}
-// Calculate the range for NAME if the lhs of statement S has the
-// range LHS. Return the result in R. Return false if no range can be
-// calculated.
-
-bool
-gori_compute::compute_name_range_op (irange &r, gimple *stmt,
- const irange &lhs, tree name)
-{
- int_range_max op1_range, op2_range;
-
- tree op1 = gimple_range_operand1 (stmt);
- tree op2 = gimple_range_operand2 (stmt);
-
- // Operand 1 is the name being looked for, evaluate it.
- if (op1 == name)
- {
- expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
- if (!op2)
- {
- // The second parameter to a unary operation is the range
- // for the type of operand1, but if it can be reduced
- // further, the results will be better. Start with what we
- // know of the range of OP1 instead of the full type.
- return gimple_range_calc_op1 (r, stmt, lhs, op1_range);
- }
- // If we need the second operand, get a value and evaluate.
- expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
- if (gimple_range_calc_op1 (r, stmt, lhs, op2_range))
- r.intersect (op1_range);
- else
- r = op1_range;
- return true;
- }
-
- if (op2 == name)
- {
- expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
- expr_range_in_bb (r, op2, gimple_bb (stmt));
- if (gimple_range_calc_op2 (op2_range, stmt, lhs, op1_range))
- r.intersect (op2_range);
- return true;
- }
- return false;
-}
// Given the switch S, return an evaluation in R for NAME when the lhs
// evaluates to LHS. Returning false means the name being looked for
@@ -672,17 +646,37 @@ gori_compute::compute_operand_range (irange &r, gimple *stmt,
tree op1 = gimple_range_ssa_p (gimple_range_operand1 (stmt));
tree op2 = gimple_range_ssa_p (gimple_range_operand2 (stmt));
- // The base ranger handles NAME on this statement.
- if (op1 == name || op2 == name)
- return compute_name_range_op (r, stmt, lhs, name);
-
- if (is_gimple_logical_p (stmt))
- return compute_logical_operands (r, stmt, lhs, name);
+ // Handle end of lookup first.
+ if (op1 == name)
+ return compute_operand1_range (r, stmt, lhs, name);
+ if (op2 == name)
+ return compute_operand2_range (r, stmt, lhs, name);
// NAME is not in this stmt, but one of the names in it ought to be
// derived from it.
- bool op1_in_chain = op1 && in_chain_p (name, op1);
- bool op2_in_chain = op2 && in_chain_p (name, op2);
+ bool op1_in_chain = op1 && in_chain_p (name, op1)
+ && !is_import_p (op1, gimple_bb (stmt));
+ bool op2_in_chain = op2 && in_chain_p (name, op2)
+ && !is_import_p (op2, gimple_bb (stmt));
+
+ // If neither operand is derived, then this stmt tells us nothing.
+ if (!op1_in_chain && !op2_in_chain)
+ return false;
+
+ // Process logicals as they have special handling.
+ if (is_gimple_logical_p (stmt))
+ {
+ int_range_max op1_trange, op1_frange;
+ int_range_max op2_trange, op2_frange;
+ compute_logical_operands (op1_trange, op1_frange, stmt, lhs,
+ name, op1, op1_in_chain);
+ compute_logical_operands (op2_trange, op2_frange, stmt, lhs,
+ name, op2, op2_in_chain);
+ return logical_combine (r, gimple_expr_code (stmt), lhs,
+ op1_trange, op1_frange, op2_trange, op2_frange);
+ }
+
+ // Follow the appropriate operands now.
if (op1_in_chain && op2_in_chain)
return compute_operand1_and_operand2_range (r, stmt, lhs, name);
if (op1_in_chain)
@@ -694,6 +688,119 @@ gori_compute::compute_operand_range (irange &r, gimple *stmt,
return false;
}
+
+// Calculate a range for NAME from the operand 1 position of STMT
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand1_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ int_range_max op1_range, op2_range;
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+
+ // Fetch the known range for op1 in this block.
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+
+ // Now range-op calcuate and put that result in r.
+ if (op2)
+ {
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+ if (!gimple_range_calc_op1 (r, stmt, lhs, op2_range))
+ return false;
+ }
+ else
+ {
+ // We pass op1_range to the unary operation. Nomally it's a
+ // hidden range_for_type parameter, but sometimes having the
+ // actual range can result in better information.
+ if (!gimple_range_calc_op1 (r, stmt, lhs, op1_range))
+ return false;
+ }
+
+ // Intersect the calculated result with the known result and return if done.
+ if (op1 == name)
+ {
+ r.intersect (op1_range);
+ return true;
+ }
+ // If the calculation continues, we're using op1_range as the new LHS.
+ op1_range.intersect (r);
+
+ gimple *src_stmt = SSA_NAME_DEF_STMT (op1);
+ gcc_checking_assert (src_stmt);
+ gcc_checking_assert (!is_import_p (op1, gimple_bb (stmt)));
+
+ // Then feed this range back as the LHS of the defining statement.
+ return compute_operand_range (r, src_stmt, op1_range, name);
+}
+
+
+// Calculate a range for NAME from the operand 2 position of S
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand2_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ int_range_max op1_range, op2_range;
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+
+ // Intersect with range for op2 based on lhs and op1.
+ if (!gimple_range_calc_op2 (r, stmt, lhs, op1_range))
+ return false;
+
+ // Intersect the calculated result with the known result and return if done.
+ if (op2 == name)
+ {
+ r.intersect (op2_range);
+ return true;
+ }
+ // If the calculation continues, we're using op2_range as the new LHS.
+ op2_range.intersect (r);
+
+ gimple *src_stmt = SSA_NAME_DEF_STMT (op2);
+ gcc_checking_assert (src_stmt);
+ gcc_checking_assert (!is_import_p (op2, gimple_bb (stmt)));
+
+ // Then feed this range back as the LHS of the defining statement.
+ return compute_operand_range (r, src_stmt, op2_range, name);
+}
+
+// Calculate a range for NAME from both operand positions of S
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand1_and_operand2_range (irange &r,
+ gimple *stmt,
+ const irange &lhs,
+ tree name)
+{
+ int_range_max op_range;
+
+ // Calculate a good a range for op2. Since op1 == op2, this will
+ // have already included whatever the actual range of name is.
+ if (!compute_operand2_range (op_range, stmt, lhs, name))
+ return false;
+
+ // Now get the range thru op1.
+ if (!compute_operand1_range (r, stmt, lhs, name))
+ return false;
+
+ // Both operands have to be simultaneously true, so perform an intersection.
+ r.intersect (op_range);
+ return true;
+}
+
+
// Return TRUE if range R is either a true or false compatible range.
static bool
@@ -709,19 +816,6 @@ range_is_either_true_or_false (const irange &r)
return (r.singleton_p () || !r.contains_p (build_zero_cst (type)));
}
-// A pair of ranges for true/false paths.
-
-struct tf_range
-{
- tf_range () { }
- tf_range (const irange &t_range, const irange &f_range)
- {
- true_range = t_range;
- false_range = f_range;
- }
- int_range_max true_range, false_range;
-};
-
// Evaluate a binary logical expression by combining the true and
// false ranges for each of the operands based on the result value in
// the LHS.
@@ -729,12 +823,11 @@ struct tf_range
bool
gori_compute::logical_combine (irange &r, enum tree_code code,
const irange &lhs,
- const tf_range &op1, const tf_range &op2)
+ const irange &op1_true, const irange &op1_false,
+ const irange &op2_true, const irange &op2_false)
{
- if (op1.true_range.varying_p ()
- && op1.false_range.varying_p ()
- && op2.true_range.varying_p ()
- && op2.false_range.varying_p ())
+ if (op1_true.varying_p () && op1_false.varying_p ()
+ && op2_true.varying_p () && op2_false.varying_p ())
return false;
// This is not a simple fold of a logical expression, rather it
@@ -775,8 +868,10 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
if (!range_is_either_true_or_false (lhs))
{
int_range_max r1;
- if (logical_combine (r1, code, m_bool_zero, op1, op2)
- && logical_combine (r, code, m_bool_one, op1, op2))
+ if (logical_combine (r1, code, m_bool_zero, op1_true, op1_false,
+ op2_true, op2_false)
+ && logical_combine (r, code, m_bool_one, op1_true, op1_false,
+ op2_true, op2_false))
{
r.union_ (r1);
return true;
@@ -793,18 +888,18 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
if (!lhs.zero_p ())
{
// The TRUE side is the intersection of the the 2 true ranges.
- r = op1.true_range;
- r.intersect (op2.true_range);
+ r = op1_true;
+ r.intersect (op2_true);
}
else
{
// The FALSE side is the union of the other 3 cases.
- int_range_max ff (op1.false_range);
- ff.intersect (op2.false_range);
- int_range_max tf (op1.true_range);
- tf.intersect (op2.false_range);
- int_range_max ft (op1.false_range);
- ft.intersect (op2.true_range);
+ int_range_max ff (op1_false);
+ ff.intersect (op2_false);
+ int_range_max tf (op1_true);
+ tf.intersect (op2_false);
+ int_range_max ft (op1_false);
+ ft.intersect (op2_true);
r = ff;
r.union_ (tf);
r.union_ (ft);
@@ -819,19 +914,19 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
// An OR operation will only take the FALSE path if both
// operands are false simlulateously, which means they should
// be intersected. !(x || y) == !x && !y
- r = op1.false_range;
- r.intersect (op2.false_range);
+ r = op1_false;
+ r.intersect (op2_false);
}
else
{
// The TRUE side of an OR operation will be the union of
// the other three combinations.
- int_range_max tt (op1.true_range);
- tt.intersect (op2.true_range);
- int_range_max tf (op1.true_range);
- tf.intersect (op2.false_range);
- int_range_max ft (op1.false_range);
- ft.intersect (op2.true_range);
+ int_range_max tt (op1_true);
+ tt.intersect (op2_true);
+ int_range_max tf (op1_true);
+ tf.intersect (op2_false);
+ int_range_max ft (op1_false);
+ ft.intersect (op2_true);
r = tt;
r.union_ (tf);
r.union_ (ft);
@@ -844,212 +939,56 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
return true;
}
-// Helper function for compute_logical_operands_in_chain that computes
-// the range of logical statements that can be computed without
-// chasing down operands. These are things like [0 = x | y] where we
-// know neither operand can be non-zero, or [1 = x & y] where we know
-// neither operand can be zero.
-
-bool
-gori_compute::optimize_logical_operands (tf_range &range,
- gimple *stmt,
- const irange &lhs,
- tree name,
- tree op)
-{
- enum tree_code code = gimple_expr_code (stmt);
-
- // Optimize [0 = x | y], since neither operand can ever be non-zero.
- if ((code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) && lhs.zero_p ())
- {
- if (!compute_operand_range (range.false_range, SSA_NAME_DEF_STMT (op),
- m_bool_zero, name))
- expr_range_in_bb (range.false_range, name, gimple_bb (stmt));
- range.true_range = range.false_range;
- return true;
- }
- // Optimize [1 = x & y], since neither operand can ever be zero.
- if ((code == BIT_AND_EXPR || code == TRUTH_AND_EXPR) && lhs == m_bool_one)
- {
- if (!compute_operand_range (range.true_range, SSA_NAME_DEF_STMT (op),
- m_bool_one, name))
- expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
- range.false_range = range.true_range;
- return true;
- }
- return false;
-}
// Given a logical STMT, calculate true and false ranges for each
// potential path of NAME, assuming NAME came through the OP chain if
// OP_IN_CHAIN is true.
void
-gori_compute::compute_logical_operands_in_chain (tf_range &range,
- gimple *stmt,
- const irange &lhs,
- tree name,
- tree op, bool op_in_chain)
+gori_compute::compute_logical_operands (irange &true_range, irange &false_range,
+ gimple *stmt,
+ const irange &lhs,
+ tree name,
+ tree op, bool op_in_chain)
{
gimple *src_stmt = gimple_range_ssa_p (op) ? SSA_NAME_DEF_STMT (op) : NULL;
basic_block bb = gimple_bb (stmt);
- if (!op_in_chain || (src_stmt != NULL && bb != gimple_bb (src_stmt)))
+ if (!op_in_chain || !src_stmt || chain_import_p (gimple_get_lhs (stmt), op))
{
// If op is not in the def chain, or defined in this block,
// use its known value on entry to the block.
- expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
- range.false_range = range.true_range;
+ expr_range_in_bb (true_range, name, bb);
+ false_range = true_range;
return;
}
- if (optimize_logical_operands (range, stmt, lhs, name, op))
- return;
-
- // Calculate ranges for true and false on both sides, since the false
- // path is not always a simple inversion of the true side.
- if (!compute_operand_range (range.true_range, src_stmt, m_bool_one, name))
- expr_range_in_bb (range.true_range, name, bb);
- if (!compute_operand_range (range.false_range, src_stmt, m_bool_zero, name))
- expr_range_in_bb (range.false_range, name, bb);
-}
-
-// Given a logical STMT, calculate true and false for each potential
-// path using NAME, and resolve the outcome based on the logical
-// operator.
-
-bool
-gori_compute::compute_logical_operands (irange &r, gimple *stmt,
- const irange &lhs,
- tree name)
-{
- // Reaching this point means NAME is not in this stmt, but one of
- // the names in it ought to be derived from it.
- tree op1 = gimple_range_operand1 (stmt);
- tree op2 = gimple_range_operand2 (stmt);
- gcc_checking_assert (op1 != name && op2 != name);
-
- bool op1_in_chain = (gimple_range_ssa_p (op1) && in_chain_p (name, op1));
- bool op2_in_chain = (gimple_range_ssa_p (op2) && in_chain_p (name, op2));
-
- // If neither operand is derived, then this stmt tells us nothing.
- if (!op1_in_chain && !op2_in_chain)
- return false;
-
- tf_range op1_range, op2_range;
- compute_logical_operands_in_chain (op1_range, stmt, lhs,
- name, op1, op1_in_chain);
- compute_logical_operands_in_chain (op2_range, stmt, lhs,
- name, op2, op2_in_chain);
- return logical_combine (r, gimple_expr_code (stmt), lhs,
- op1_range, op2_range);
-}
-// Calculate a range for NAME from the operand 1 position of STMT
-// assuming the result of the statement is LHS. Return the range in
-// R, or false if no range could be calculated.
-
-bool
-gori_compute::compute_operand1_range (irange &r, gimple *stmt,
- const irange &lhs, tree name)
-{
- int_range_max op1_range, op2_range;
- tree op1 = gimple_range_operand1 (stmt);
- tree op2 = gimple_range_operand2 (stmt);
-
- expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
-
- // Now calcuated the operand and put that result in r.
- if (op2)
- {
- expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
- if (!gimple_range_calc_op1 (r, stmt, lhs, op2_range))
- return false;
- }
- else
+ enum tree_code code = gimple_expr_code (stmt);
+ // Optimize [0 = x | y], since neither operand can ever be non-zero.
+ if ((code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) && lhs.zero_p ())
{
- // We pass op1_range to the unary operation. Nomally it's a
- // hidden range_for_type parameter, but sometimes having the
- // actual range can result in better information.
- if (!gimple_range_calc_op1 (r, stmt, lhs, op1_range))
- return false;
+ if (!compute_operand_range (false_range, src_stmt, m_bool_zero, name))
+ expr_range_in_bb (false_range, name, bb);
+ true_range = false_range;
+ return;
}
- // Intersect the calculated result with the known result.
- op1_range.intersect (r);
-
- gimple *src_stmt = SSA_NAME_DEF_STMT (op1);
- // If def stmt is outside of this BB, then name must be an import.
- if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
+ // Optimize [1 = x & y], since neither operand can ever be zero.
+ if ((code == BIT_AND_EXPR || code == TRUTH_AND_EXPR) && lhs == m_bool_one)
{
- // If this isn't the right import statement, then abort calculation.
- if (!src_stmt || gimple_get_lhs (src_stmt) != name)
- return false;
- return compute_name_range_op (r, src_stmt, op1_range, name);
+ if (!compute_operand_range (true_range, src_stmt, m_bool_one, name))
+ expr_range_in_bb (true_range, name, bb);
+ false_range = true_range;
+ return;
}
- // Then feed this range back as the LHS of the defining statement.
- return compute_operand_range (r, src_stmt, op1_range, name);
-}
-
-// Calculate a range for NAME from the operand 2 position of S
-// assuming the result of the statement is LHS. Return the range in
-// R, or false if no range could be calculated.
-
-bool
-gori_compute::compute_operand2_range (irange &r, gimple *stmt,
- const irange &lhs, tree name)
-{
- int_range_max op1_range, op2_range;
- tree op1 = gimple_range_operand1 (stmt);
- tree op2 = gimple_range_operand2 (stmt);
-
- expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
- expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
-
- // Intersect with range for op2 based on lhs and op1.
- if (!gimple_range_calc_op2 (r, stmt, lhs, op1_range))
- return false;
- op2_range.intersect (r);
-
- gimple *src_stmt = SSA_NAME_DEF_STMT (op2);
- // If def stmt is outside of this BB, then name must be an import.
- if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
- {
- // If this isn't the right src statement, then abort calculation.
- if (!src_stmt || gimple_get_lhs (src_stmt) != name)
- return false;
- return compute_name_range_op (r, src_stmt, op2_range, name);
- }
- // Then feed this range back as the LHS of the defining statement.
- return compute_operand_range (r, src_stmt, op2_range, name);
+ // Calculate ranges for true and false on both sides, since the false
+ // path is not always a simple inversion of the true side.
+ if (!compute_operand_range (true_range, src_stmt, m_bool_one, name))
+ expr_range_in_bb (true_range, name, bb);
+ if (!compute_operand_range (false_range, src_stmt, m_bool_zero, name))
+ expr_range_in_bb (false_range, name, bb);
}
-// Calculate a range for NAME from both operand positions of S
-// assuming the result of the statement is LHS. Return the range in
-// R, or false if no range could be calculated.
-
-bool
-gori_compute::compute_operand1_and_operand2_range
- (irange &r,
- gimple *stmt,
- const irange &lhs,
- tree name)
-{
- int_range_max op_range;
-
- // Calculate a good a range for op2. Since op1 == op2, this will
- // have already included whatever the actual range of name is.
- if (!compute_operand2_range (op_range, stmt, lhs, name))
- return false;
-
- // Now get the range thru op1.
- if (!compute_operand1_range (r, stmt, lhs, name))
- return false;
-
- // Whichever range is the most permissive is the one we need to
- // use. (?) OR is that true? Maybe this should be intersection?
- r.union_ (op_range);
- return true;
-}
// Return TRUE if a range can be calcalated for NAME on edge E.
@@ -1185,6 +1124,21 @@ gori_compute::dump (FILE *f)
// --------------------------------------------------------------------------
+// A pair of ranges for true/false paths.
+
+struct tf_range
+{
+ tf_range () { }
+ tf_range (const irange &t_range, const irange &f_range)
+ {
+ true_range = t_range;
+ false_range = f_range;
+ }
+ int_range_max true_range, false_range;
+};
+
+
+
// Cache for SSAs that appear on the RHS of a boolean assignment.
//
// Boolean assignments of logical expressions (i.e. LHS = j_5 > 999)
@@ -1483,9 +1437,11 @@ gori_compute_cache::cache_stmt (gimple *stmt)
bool ok = m_cache->get_range (op1_range, op1, cached_name);
ok = ok && m_cache->get_range (op2_range, op2, cached_name);
ok = ok && logical_combine (r_true_side, code, m_bool_one,
- op1_range, op2_range);
+ op1_range.true_range, op1_range.false_range,
+ op2_range.true_range, op2_range.false_range);
ok = ok && logical_combine (r_false_side, code, m_bool_zero,
- op1_range, op2_range);
+ op1_range.true_range, op1_range.false_range,
+ op2_range.true_range, op2_range.false_range);
gcc_checking_assert (ok);
if (ok)
m_cache->set_range (lhs, cached_name,
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 030708c40a8..ca37e4c070f 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -41,17 +41,18 @@ public:
tree depend1 (tree name) const;
tree depend2 (tree name) const;
bool in_chain_p (tree name, tree def);
- bitmap get_imports (tree name);
+ bool chain_import_p (tree name, tree import);
void register_dependency (tree name, tree ssa1, basic_block bb = NULL);
void dump (FILE *f, basic_block bb, const char *prefix = NULL);
protected:
bool has_def_chain (tree name);
bool def_chain_in_bitmap_p (tree name, bitmap b);
void add_def_chain_to_bitmap (bitmap b, tree name);
+ bitmap get_def_chain (tree name);
+ bitmap get_imports (tree name);
bitmap_obstack m_bitmaps;
private:
vec<rdc> m_def_chain; // SSA_NAME : def chain components.
- bitmap get_def_chain (tree name);
void set_import (struct rdc &data, tree imp, bitmap b);
};
@@ -84,6 +85,7 @@ public:
~gori_map ();
bool is_export_p (tree name, basic_block bb = NULL);
+ bool is_import_p (tree name, basic_block bb);
bitmap exports (basic_block bb);
bitmap imports (basic_block bb);
void set_range_invariant (tree name);
@@ -154,18 +156,13 @@ protected:
const irange &lhs, tree name);
void expr_range_in_bb (irange &r, tree expr, basic_block bb);
- bool compute_logical_operands (irange &r, gimple *stmt,
- const irange &lhs,
- tree name);
- void compute_logical_operands_in_chain (class tf_range &range,
- gimple *stmt, const irange &lhs,
- tree name, tree op,
- bool op_in_chain);
- bool optimize_logical_operands (tf_range &range, gimple *stmt,
- const irange &lhs, tree name, tree op);
+ void compute_logical_operands (irange &true_range, irange &false_range,
+ gimple *stmt, const irange &lhs,
+ tree name, tree op,
+ bool op_in_chain);
bool logical_combine (irange &r, enum tree_code code, const irange &lhs,
- const class tf_range &op1_range,
- const class tf_range &op2_range);
+ const irange &op1_true, const irange &op1_false,
+ const irange &op2_true, const irange &op2_false);
int_range<2> m_bool_zero; // Boolean false cached.
int_range<2> m_bool_one; // Boolean true cached.
outgoing_range outgoing; // Edge values for COND_EXPR & SWITCH_EXPR.
@@ -174,8 +171,6 @@ private:
bool recompute (irange &r, edge e, tree name);
bool compute_operand_range_switch (irange &r, gswitch *stmt,
const irange &lhs, tree name);
- bool compute_name_range_op (irange &r, gimple *stmt, const irange &lhs,
- tree name);
bool compute_operand1_range (irange &r, gimple *stmt, const irange &lhs,
tree name);
bool compute_operand2_range (irange &r, gimple *stmt, const irange &lhs,
More information about the Gcc-cvs
mailing list