[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Aug 2011 09:41:15 +0000 (11:41 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Aug 2011 09:41:15 +0000 (11:41 +0200)
2011-08-29  Thomas Quinot  <quinot@adacore.com>

* s-pooglo.adb: Minor reformatting.

2011-08-29  Ed Schonberg  <schonberg@adacore.com>

* 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  <schonberg@adacore.com>

* 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  <duff@adacore.com>

* einfo.ads: Minor comment fix.

From-SVN: r178182

gcc/ada/ChangeLog
gcc/ada/einfo.ads
gcc/ada/exp_ch5.adb
gcc/ada/exp_util.adb
gcc/ada/s-pooglo.adb

index b63a9f3..24e400a 100644 (file)
@@ -1,3 +1,24 @@
+2011-08-29  Thomas Quinot  <quinot@adacore.com>
+
+       * s-pooglo.adb: Minor reformatting.
+
+2011-08-29  Ed Schonberg  <schonberg@adacore.com>
+
+       * 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  <schonberg@adacore.com>
+
+       * 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  <duff@adacore.com>
+
+       * einfo.ads: Minor comment fix.
+
 2011-08-29  Robert Dewar  <dewar@adacore.com>
 
        * frontend.adb, gnat1drv.adb: Minor reformatting.
index 7ed878d..9e0ff33 100644 (file)
@@ -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.
index 7dd2800..47ea0d8 100644 (file)
@@ -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
index a5faf48..64a6b6d 100644 (file)
@@ -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          |
index de96aa0..6e9cc30 100644 (file)
@@ -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);