Commit 43a4dd82 by Eric Botcazou Committed by Eric Botcazou

decl.c (gnat_to_gnu_entity): Use Underlying_Type in lieu of more verbose construct.

	* gcc-interface/decl.c (gnat_to_gnu_entity): Use Underlying_Type in
	lieu of more verbose construct.
	* gcc-interface/trans.c (Call_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.  Remove obsolete code.

From-SVN: r210585
parent f9d7d7c1
2014-05-18 Eric Botcazou <ebotcazou@adacore.com> 2014-05-18 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Use Underlying_Type in
lieu of more verbose construct.
* gcc-interface/trans.c (Call_to_gnu): Likewise.
(gnat_to_gnu): Likewise. Remove obsolete code.
2014-05-18 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Do not * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Do not
consider that regular packed arrays can never be superflat. consider that regular packed arrays can never be superflat.
......
...@@ -543,10 +543,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -543,10 +543,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
This is a workaround for major problems in protected type This is a workaround for major problems in protected type
handling. */ handling. */
Entity_Id Scop = Scope (Scope (gnat_entity)); Entity_Id Scop = Scope (Scope (gnat_entity));
if ((Is_Protected_Type (Scop) if (Is_Protected_Type (Underlying_Type (Scop))
|| (Is_Private_Type (Scop)
&& Present (Full_View (Scop))
&& Is_Protected_Type (Full_View (Scop))))
&& Present (Original_Record_Component (gnat_entity))) && Present (Original_Record_Component (gnat_entity)))
{ {
gnu_decl gnu_decl
...@@ -870,9 +867,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -870,9 +867,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* If this is an aliased object with an unconstrained nominal subtype, /* If this is an aliased object with an unconstrained nominal subtype,
make a type that includes the template. */ make a type that includes the template. */
if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity))
&& (Is_Array_Type (Etype (gnat_entity)) && Is_Array_Type (Underlying_Type (Etype (gnat_entity)))
|| (Is_Private_Type (Etype (gnat_entity))
&& Is_Array_Type (Full_View (Etype (gnat_entity)))))
&& !type_annotate_only) && !type_annotate_only)
{ {
tree gnu_array tree gnu_array
...@@ -1383,9 +1378,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1383,9 +1378,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
Note that we have to do that this late because of the couple of Note that we have to do that this late because of the couple of
allocation adjustments that might be made just above. */ allocation adjustments that might be made just above. */
if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity))
&& (Is_Array_Type (Etype (gnat_entity)) && Is_Array_Type (Underlying_Type (Etype (gnat_entity)))
|| (Is_Private_Type (Etype (gnat_entity))
&& Is_Array_Type (Full_View (Etype (gnat_entity)))))
&& !type_annotate_only) && !type_annotate_only)
{ {
tree gnu_array tree gnu_array
......
...@@ -4269,9 +4269,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, ...@@ -4269,9 +4269,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual)) && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual))
&& Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual)) && Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual))
&& (Is_Array_Type (Etype (gnat_actual)) && Is_Array_Type (Underlying_Type (Etype (gnat_actual))))
|| (Is_Private_Type (Etype (gnat_actual))
&& Is_Array_Type (Full_View (Etype (gnat_actual))))))
gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
gnu_actual); gnu_actual);
} }
...@@ -6192,8 +6190,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6192,8 +6190,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* These can either be operations on booleans or on modular types. /* These can either be operations on booleans or on modular types.
Fall through for boolean types since that's the way GNU_CODES is Fall through for boolean types since that's the way GNU_CODES is
set up. */ set up. */
if (IN (Ekind (Underlying_Type (Etype (gnat_node))), if (Is_Modular_Integer_Type (Underlying_Type (Etype (gnat_node))))
Modular_Integer_Kind))
{ {
enum tree_code code enum tree_code code
= (kind == N_Op_Or ? BIT_IOR_EXPR = (kind == N_Op_Or ? BIT_IOR_EXPR
...@@ -6236,22 +6233,14 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6236,22 +6233,14 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_lhs = maybe_vector_array (gnu_lhs); gnu_lhs = maybe_vector_array (gnu_lhs);
gnu_rhs = maybe_vector_array (gnu_rhs); gnu_rhs = maybe_vector_array (gnu_rhs);
/* If this is a comparison operator, convert any references to /* If this is a comparison operator, convert any references to an
an unconstrained array value into a reference to the unconstrained array value into a reference to the actual array. */
actual array. */
if (TREE_CODE_CLASS (code) == tcc_comparison) if (TREE_CODE_CLASS (code) == tcc_comparison)
{ {
gnu_lhs = maybe_unconstrained_array (gnu_lhs); gnu_lhs = maybe_unconstrained_array (gnu_lhs);
gnu_rhs = maybe_unconstrained_array (gnu_rhs); gnu_rhs = maybe_unconstrained_array (gnu_rhs);
} }
/* If the result type is a private type, its full view may be a
numeric subtype. The representation we need is that of its base
type, given that it is the result of an arithmetic operation. */
else if (Is_Private_Type (Etype (gnat_node)))
gnu_type = gnu_result_type
= get_unpadded_type (Base_Type (Full_View (Etype (gnat_node))));
/* If this is a shift whose count is not guaranteed to be correct, /* If this is a shift whose count is not guaranteed to be correct,
we need to adjust the shift count. */ we need to adjust the shift count. */
if (IN (kind, N_Op_Shift) && !Shift_Count_OK (gnat_node)) if (IN (kind, N_Op_Shift) && !Shift_Count_OK (gnat_node))
...@@ -6361,9 +6350,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6361,9 +6350,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* This case can apply to a boolean or a modular type. /* This case can apply to a boolean or a modular type.
Fall through for a boolean operand since GNU_CODES is set Fall through for a boolean operand since GNU_CODES is set
up to handle this. */ up to handle this. */
if (Is_Modular_Integer_Type (Etype (gnat_node)) if (Is_Modular_Integer_Type (Underlying_Type (Etype (gnat_node))))
|| (Is_Private_Type (Etype (gnat_node))
&& Is_Modular_Integer_Type (Full_View (Etype (gnat_node)))))
{ {
gnu_expr = gnat_to_gnu (Right_Opnd (gnat_node)); gnu_expr = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
......
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