Commit fcdc7fd5 by Eric Botcazou Committed by Eric Botcazou

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
parent 544a4843
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> 2018-12-14 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_restore_callee_milli) Don't clobber off * config/arc/arc.c (arc_restore_callee_milli) Don't clobber off
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> 2018-12-11 Eric Botcazou <ebotcazou@adacore.com>
PR ada/88429 PR ada/88429
...@@ -170,8 +175,8 @@ ...@@ -170,8 +175,8 @@
retrieve directly its RM size. retrieve directly its RM size.
(components_to_record): Minor tweak. (components_to_record): Minor tweak.
(set_rm_size): Remove useless test. (set_rm_size): Remove useless test.
* gcc-interface/trans.c (gnat_to_gnu): Do wrap the instance of a * gcc-interface/trans.c (gnat_to_gnu): Do not wrap the instance of
boolean discriminant attached to a variant part. a boolean discriminant attached to a variant part.
2018-12-11 Ed Schonberg <schonberg@adacore.com> 2018-12-11 Ed Schonberg <schonberg@adacore.com>
...@@ -289,8 +294,7 @@ ...@@ -289,8 +294,7 @@
* fe.h (Is_Atomic_Object): Declare. * fe.h (Is_Atomic_Object): Declare.
(Is_Volatile_Object): Likewise. (Is_Volatile_Object): Likewise.
* gcc-interface/trans.c (atomic_or_volatile_copy_required_p): * gcc-interface/trans.c (atomic_or_volatile_copy_required_p): New.
New.
(Call_to_gnu): Generate a copy for an actual parameter passed by (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 reference if the conditions set forth by RM C.6(19) are met and
specificially deal with an atomic actual parameter. specificially deal with an atomic actual parameter.
......
...@@ -6848,6 +6848,9 @@ choices_to_gnu (tree gnu_operand, Node_Id gnat_choices) ...@@ -6848,6 +6848,9 @@ choices_to_gnu (tree gnu_operand, Node_Id gnat_choices)
build_binary_op (LE_EXPR, boolean_type_node, build_binary_op (LE_EXPR, boolean_type_node,
gnu_operand, gnu_high, true), gnu_operand, gnu_high, true),
true); true);
else if (gnu_low == boolean_true_node
&& TREE_TYPE (gnu_operand) == boolean_type_node)
gnu_test = gnu_operand;
else if (gnu_low) else if (gnu_low)
gnu_test gnu_test
= build_binary_op (EQ_EXPR, boolean_type_node, gnu_operand, gnu_low, = build_binary_op (EQ_EXPR, boolean_type_node, gnu_operand, gnu_low,
......
...@@ -24537,6 +24537,7 @@ gen_inheritance_die (tree binfo, tree access, tree type, ...@@ -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 /* Return whether DECL is a FIELD_DECL that represents the variant part of a
structure. */ structure. */
static bool static bool
is_variant_part (tree decl) is_variant_part (tree decl)
{ {
...@@ -24550,17 +24551,8 @@ is_variant_part (tree decl) ...@@ -24550,17 +24551,8 @@ is_variant_part (tree decl)
static tree static tree
analyze_discr_in_predicate (tree operand, tree struct_type) analyze_discr_in_predicate (tree operand, tree struct_type)
{ {
bool continue_stripping = true; while (CONVERT_EXPR_P (operand))
while (continue_stripping) operand = TREE_OPERAND (operand, 0);
switch (TREE_CODE (operand))
{
CASE_CONVERT:
operand = TREE_OPERAND (operand, 0);
break;
default:
continue_stripping = false;
break;
}
/* Match field access to members of struct_type only. */ /* Match field access to members of struct_type only. */
if (TREE_CODE (operand) == COMPONENT_REF if (TREE_CODE (operand) == COMPONENT_REF
...@@ -24780,6 +24772,19 @@ analyze_variants_discr (tree variant_part_decl, ...@@ -24780,6 +24772,19 @@ analyze_variants_discr (tree variant_part_decl,
new_node->dw_discr_range = true; 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 else
/* Unsupported sub-expression: we cannot determine the set of /* Unsupported sub-expression: we cannot determine the set of
matching discriminant values. Abort everything. */ matching discriminant values. Abort everything. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment