From 8c889ae483adccb124c7104e6c0e1ab274bd3677 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 29 Aug 2011 11:41:15 +0200 Subject: [PATCH] [multiple changes] 2011-08-29 Thomas Quinot * s-pooglo.adb: Minor reformatting. 2011-08-29 Ed Schonberg * exp_ch5.adb (Expand_N_Assignment_Statement): if the left-hand side is an indexed component of a packed array whose element type is a record with a representation clause different from that of the right-hand side, generate a temporary to minimuze the number of bit-field operations generated. 2011-08-29 Ed Schonberg * exp_util.adb (Insert_Actions): Use clauses can be part of lists of declarations, and thus are likely insertion points for actions. 2011-08-29 Bob Duff * einfo.ads: Minor comment fix. From-SVN: r178182 --- gcc/ada/ChangeLog | 21 +++++++++++++++++++++ gcc/ada/einfo.ads | 6 +++--- gcc/ada/exp_ch5.adb | 37 ++++++++++++++++++++++++++++++++++--- gcc/ada/exp_util.adb | 7 +++++-- gcc/ada/s-pooglo.adb | 12 +++++++++--- 5 files changed, 72 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b63a9f3..24e400a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2011-08-29 Thomas Quinot + + * s-pooglo.adb: Minor reformatting. + +2011-08-29 Ed Schonberg + + * exp_ch5.adb (Expand_N_Assignment_Statement): if the left-hand side is + an indexed component of a packed array whose element type is a record + with a representation clause different from that of the right-hand + side, generate a temporary to minimuze the number of bit-field + operations generated. + +2011-08-29 Ed Schonberg + + * exp_util.adb (Insert_Actions): Use clauses can be part of lists of + declarations, and thus are likely insertion points for actions. + +2011-08-29 Bob Duff + + * einfo.ads: Minor comment fix. + 2011-08-29 Robert Dewar * frontend.adb, gnat1drv.adb: Minor reformatting. diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 7ed878d..9e0ff33 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1088,9 +1088,9 @@ package Einfo is -- is itself another entity. For a type entity, points to the parent -- type for a derived type, or if the type is not derived, points to -- itself. For a subtype entity, Etype points to the base type. For --- a class wide type, points to the parent type. For a subprogram or --- subprogram type, Etype has the return type of a function or is set --- to Standard_Void_Type to represent a procedure. +-- a class wide type, points to the corresponding specific type. For a +-- subprogram or subprogram type, Etype has the return type of a function +-- or is set to Standard_Void_Type to represent a procedure. -- -- Note one obscure case: for pragma Default_Storage_Pool (null), the -- Etype of the N_Null node is Empty. diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 7dd2800..47ea0d8 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -1890,10 +1890,41 @@ package body Exp_Ch5 is if Nkind (Lhs) = N_Indexed_Component and then Is_Bit_Packed_Array (Etype (Prefix (Lhs))) - and then not Crep then - Expand_Bit_Packed_Element_Set (N); - return; + if not Crep then + Expand_Bit_Packed_Element_Set (N); + return; + else + + -- Generate the following, to force component-by-component + -- assignments in an efficient way. Otherwise each component + -- will require a temporary and two bit-field manipulations. + + -- T1 : Elmt_Type; + -- T1 := RhS; + -- Lhs := T1; + + declare + Tnn : constant Entity_Id := Make_Temporary (Loc, 'T'); + Stats : List_Id; + + begin + Stats := New_List ( + Make_Object_Declaration (Loc, + Defining_Identifier => Tnn, + Object_Definition => New_Occurrence_Of (Etype (Lhs), Loc)), + Make_Assignment_Statement (Loc, + Name => New_Occurrence_Of (Tnn, Loc), + Expression => Relocate_Node (Rhs)), + Make_Assignment_Statement (Loc, + Name => Relocate_Node (Lhs), + Expression => New_Occurrence_Of (Tnn, Loc))); + + Insert_Actions (N, Stats); + Rewrite (N, Make_Null_Statement (Loc)); + Analyze (N); + end; + end if; -- Build-in-place function call case. Note that we're not yet doing -- build-in-place for user-written assignment statements (the assignment diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index a5faf48..64a6b6d 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -3028,6 +3028,11 @@ package body Exp_Util is N_Task_Body_Stub | N_Task_Type_Declaration | + -- Use clauses can appear in lists of declarations + + N_Use_Package_Clause | + N_Use_Type_Clause | + -- Freeze entity behaves like a declaration or statement N_Freeze_Entity @@ -3328,8 +3333,6 @@ package body Exp_Util is N_Unconstrained_Array_Definition | N_Unused_At_End | N_Unused_At_Start | - N_Use_Package_Clause | - N_Use_Type_Clause | N_Variant | N_Variant_Part | N_Validate_Unchecked_Conversion | diff --git a/gcc/ada/s-pooglo.adb b/gcc/ada/s-pooglo.adb index de96aa0..6e9cc30 100644 --- a/gcc/ada/s-pooglo.adb +++ b/gcc/ada/s-pooglo.adb @@ -69,11 +69,15 @@ package body System.Pool_Global is end if; if Alignment > Standard'System_Allocator_Alignment then - -- Realign the returned address. + + -- Realign the returned address + Aligned_Address := To_Address (To_Integer (Allocated) + Integer_Address (Alignment) - (To_Integer (Allocated) mod Integer_Address (Alignment))); - -- Save the block address. + + -- Save the block address + declare Saved_Address : System.Address; pragma Import (Ada, Saved_Address); @@ -105,7 +109,9 @@ package body System.Pool_Global is begin if Alignment > Standard'System_Allocator_Alignment then - -- Retrieve the block address. + + -- Retrieve the block address + declare Saved_Address : System.Address; pragma Import (Ada, Saved_Address); -- 2.7.4