diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-11 10:19:39 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-11 10:19:39 +0000 |
commit | 5852b0a407b84f6698f5b6cbad16adb64e4e6ebb (patch) | |
tree | 17830370fb0bc223697052c20038f600115efa0e /gcc/ada/gcc-interface/decl.c | |
parent | 070b207449232243e6aa091c2175393ed08b53d8 (diff) |
* gcc-interface/utils2.c (build_binary_op): Add a NO_FOLD
argument. Disable folding when true.
* gcc-interface/gigi.h (choices_to_gnu): Remove declaration.
(build_binary_op): Update signature and comment.
* gcc-interface/decl.c (choices_to_gnu): Make static. Disable
folding for all calls to build_binary_op.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240978 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 58d6625dcaa2..3aaaaca73eda 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6832,7 +6832,7 @@ elaborate_reference (tree ref, Entity_Id gnat_entity, bool definition, /* Given a GNU tree and a GNAT list of choices, generate an expression to test the value passed against the list of choices. */ -tree +static tree choices_to_gnu (tree operand, Node_Id choices) { Node_Id choice; @@ -6851,9 +6851,10 @@ choices_to_gnu (tree operand, Node_Id choices) this_test = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, build_binary_op (GE_EXPR, boolean_type_node, - operand, low), + operand, low, true), build_binary_op (LE_EXPR, boolean_type_node, - operand, high)); + operand, high, true), + true); break; @@ -6865,9 +6866,10 @@ choices_to_gnu (tree operand, Node_Id choices) this_test = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, build_binary_op (GE_EXPR, boolean_type_node, - operand, low), + operand, low, true), build_binary_op (LE_EXPR, boolean_type_node, - operand, high)); + operand, high, true), + true); break; case N_Identifier: @@ -6886,9 +6888,10 @@ choices_to_gnu (tree operand, Node_Id choices) this_test = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, build_binary_op (GE_EXPR, boolean_type_node, - operand, low), + operand, low, true), build_binary_op (LE_EXPR, boolean_type_node, - operand, high)); + operand, high, true), + true); break; } @@ -6898,7 +6901,7 @@ choices_to_gnu (tree operand, Node_Id choices) case N_Integer_Literal: single = gnat_to_gnu (choice); this_test = build_binary_op (EQ_EXPR, boolean_type_node, operand, - single); + single, true); break; case N_Others_Choice: @@ -6909,8 +6912,11 @@ choices_to_gnu (tree operand, Node_Id choices) gcc_unreachable (); } - result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result, - this_test); + if (result == boolean_false_node) + result = this_test; + else + result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result, + this_test, true); } return result; |