aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-12-14 10:53:41 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-12-14 10:53:41 +0000
commitfcdc7fd55df451a405f040733c29b8fe3d20cff1 (patch)
tree4df96b3c4eb8310d8d483978186ec49bb6cb75de
parent544a4843e8873ce0dc08b2e1cde8978b15d23628 (diff)
downloadgcc-fcdc7fd55df451a405f040733c29b8fe3d20cff1.zip
gcc-fcdc7fd55df451a405f040733c29b8fe3d20cff1.tar.gz
gcc-fcdc7fd55df451a405f040733c29b8fe3d20cff1.tar.bz2
dwarf2out.c (analyze_discr_in_predicate): Simplify.
* dwarf2out.c (analyze_discr_in_predicate): Simplify. (analyze_variants_discr): Deal with naked boolean discriminants. ada/ * gcc-interface/decl.c (choices_to_gnu): Directly use a naked boolean discriminant if the value is the boolean true. From-SVN: r267130
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/gcc-interface/decl.c3
-rw-r--r--gcc/dwarf2out.c27
4 files changed, 32 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f97c401..3e34022 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * dwarf2out.c (analyze_discr_in_predicate): Simplify.
+ (analyze_variants_discr): Deal with naked boolean discriminants.
+
2018-12-14 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_restore_callee_milli) Don't clobber off
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index f04a052..9fa05898 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (choices_to_gnu): Directly use a naked boolean
+ discriminant if the value is the boolean true.
+
2018-12-11 Eric Botcazou <ebotcazou@adacore.com>
PR ada/88429
@@ -170,8 +175,8 @@
retrieve directly its RM size.
(components_to_record): Minor tweak.
(set_rm_size): Remove useless test.
- * gcc-interface/trans.c (gnat_to_gnu): Do wrap the instance of a
- boolean discriminant attached to a variant part.
+ * gcc-interface/trans.c (gnat_to_gnu): Do not wrap the instance of
+ a boolean discriminant attached to a variant part.
2018-12-11 Ed Schonberg <schonberg@adacore.com>
@@ -289,8 +294,7 @@
* fe.h (Is_Atomic_Object): Declare.
(Is_Volatile_Object): Likewise.
- * gcc-interface/trans.c (atomic_or_volatile_copy_required_p):
- New.
+ * gcc-interface/trans.c (atomic_or_volatile_copy_required_p): New.
(Call_to_gnu): Generate a copy for an actual parameter passed by
reference if the conditions set forth by RM C.6(19) are met and
specificially deal with an atomic actual parameter.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index b2f9229..0ad06f1 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -6848,6 +6848,9 @@ choices_to_gnu (tree gnu_operand, Node_Id gnat_choices)
build_binary_op (LE_EXPR, boolean_type_node,
gnu_operand, gnu_high, true),
true);
+ else if (gnu_low == boolean_true_node
+ && TREE_TYPE (gnu_operand) == boolean_type_node)
+ gnu_test = gnu_operand;
else if (gnu_low)
gnu_test
= build_binary_op (EQ_EXPR, boolean_type_node, gnu_operand, gnu_low,
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 99ac40f..cb5cc01 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24537,6 +24537,7 @@ gen_inheritance_die (tree binfo, tree access, tree type,
/* Return whether DECL is a FIELD_DECL that represents the variant part of a
structure. */
+
static bool
is_variant_part (tree decl)
{
@@ -24550,17 +24551,8 @@ is_variant_part (tree decl)
static tree
analyze_discr_in_predicate (tree operand, tree struct_type)
{
- bool continue_stripping = true;
- while (continue_stripping)
- switch (TREE_CODE (operand))
- {
- CASE_CONVERT:
- operand = TREE_OPERAND (operand, 0);
- break;
- default:
- continue_stripping = false;
- break;
- }
+ while (CONVERT_EXPR_P (operand))
+ operand = TREE_OPERAND (operand, 0);
/* Match field access to members of struct_type only. */
if (TREE_CODE (operand) == COMPONENT_REF
@@ -24780,6 +24772,19 @@ analyze_variants_discr (tree variant_part_decl,
new_node->dw_discr_range = true;
}
+ else if ((candidate_discr
+ = analyze_discr_in_predicate (match_expr, struct_type))
+ && TREE_TYPE (candidate_discr) == boolean_type_node)
+ {
+ /* We are matching: <discr_field> for a boolean discriminant.
+ This sub-expression matches boolean_true_node. */
+ new_node = ggc_cleared_alloc<dw_discr_list_node> ();
+ if (!get_discr_value (boolean_true_node,
+ &new_node->dw_discr_lower_bound))
+ goto abort;
+ new_node->dw_discr_range = false;
+ }
+
else
/* Unsupported sub-expression: we cannot determine the set of
matching discriminant values. Abort everything. */