[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 26 Apr 2012 09:45:37 +0000 (11:45 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 26 Apr 2012 09:45:37 +0000 (11:45 +0200)
2012-04-26  Hristian Kirtchev  <kirtchev@adacore.com>

* einfo.adb (Proper_First_Index): Moved from Sem_Util.
* einfo.ads: Add new synthesized attribute Proper_First_Index
along with usage in nodes.
(Proper_First_Index): Moved from Sem_Util.
* sem_util.ads, sem_util.adb (Proper_First_Index): Moved to Einfo.

2012-04-26  Gary Dismukes  <dismukes@adacore.com>

* layout.adb (Layout_Component_List): Test for the case of a
single variant and the size of its component list was computed
as an integer literal, and use that size (which is in bits)
as is rather than converting to storage units.

2012-04-26  Robert Dewar  <dewar@adacore.com>

* exp_aggr.adb: Minor reformatting.

From-SVN: r186866

gcc/ada/ChangeLog
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/exp_aggr.adb
gcc/ada/layout.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads

index 53c3818b0bf8ff5b671a5f4031331119a1fff5b5..c485fadfafd0c285482544a4f488cbdbd47fb046 100644 (file)
@@ -1,3 +1,22 @@
+2012-04-26  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * einfo.adb (Proper_First_Index): Moved from Sem_Util.
+       * einfo.ads: Add new synthesized attribute Proper_First_Index
+       along with usage in nodes.
+       (Proper_First_Index): Moved from Sem_Util.
+       * sem_util.ads, sem_util.adb (Proper_First_Index): Moved to Einfo.
+
+2012-04-26  Gary Dismukes  <dismukes@adacore.com>
+
+       * layout.adb (Layout_Component_List): Test for the case of a
+       single variant and the size of its component list was computed
+       as an integer literal, and use that size (which is in bits)
+       as is rather than converting to storage units.
+
+2012-04-26  Robert Dewar  <dewar@adacore.com>
+
+       * exp_aggr.adb: Minor reformatting.
+
 2012-04-26  Robert Dewar  <dewar@adacore.com>
 
        * sem_util.adb: Minor reformatting.
index 0f597a1f9410a1c120b802f5c0877d2f2dfd0486..46d8ace5e66a7cc733e5c328b2dedff46794886e 100644 (file)
@@ -6456,6 +6456,26 @@ package body Einfo is
                 and then Present (Prival_Link (Id)));
    end Is_Prival;
 
+   ------------------------
+   -- Proper_First_Index --
+   ------------------------
+
+   function Proper_First_Index (Id : E) return E is
+      Typ : Entity_Id;
+
+   begin
+      Typ := Id;
+
+      --  The First_Index field is always empty for string literals, use the
+      --  base type instead.
+
+      if Ekind (Typ) = E_String_Literal_Subtype then
+         Typ := Base_Type (Typ);
+      end if;
+
+      return First_Index (Typ);
+   end Proper_First_Index;
+
    ----------------------------
    -- Is_Protected_Component --
    ----------------------------
index cf5aebe731196d73eece8bc7b2826c618138c9c2..1badc882d09f77891b9a4ab395f3d49db31b20c3 100644 (file)
@@ -3336,13 +3336,6 @@ package Einfo is
 --       conditions are present. The precondition_wrapper body is the original
 --       entry call, decorated with the given precondition for the entry.
 
---    Primitive_Operations (synthesized)
---       Present in concurrent types, tagged record types and subtypes, tagged
---       private types and tagged incomplete types. For concurrent types whose
---       Corresponding_Record_Type (CRT) is available, returns the list of
---       Direct_Primitive_Operations of its CRT; otherwise returns No_Elist.
---       For all the other types returns the Direct_Primitive_Operations.
-
 --    Predicate_Function (synthesized)
 --       Present in all types. Set for types for which (Has_Predicates is True)
 --       and for which a predicate procedure has been built that tests that the
@@ -3353,6 +3346,13 @@ package Einfo is
 --       Note: the reason this is marked as a synthesized attribute is that the
 --       way this is stored is as an element of the Subprograms_For_Type field.
 
+--    Primitive_Operations (synthesized)
+--       Present in concurrent types, tagged record types and subtypes, tagged
+--       private types and tagged incomplete types. For concurrent types whose
+--       Corresponding_Record_Type (CRT) is available, returns the list of
+--       Direct_Primitive_Operations of its CRT; otherwise returns No_Elist.
+--       For all the other types returns the Direct_Primitive_Operations.
+
 --    Prival (Node17)
 --       Present in private components of protected types. Refers to the entity
 --       of the component renaming declaration generated inside protected
@@ -3393,6 +3393,11 @@ package Einfo is
 --       in the shadow entity, it points to the proper location in which to
 --       restore the private view saved in the shadow.
 
+--    Proper_First_Index (synthesized)
+--       Applies to array types and subtypes. Returns the First_Index of the
+--       type unless it is a string literal. In that case, the First_Index is
+--       obtained from the base type.
+
 --    Protected_Formal (Node22)
 --       Present in formal parameters (in, in out and out parameters). Used
 --       only for formals of protected operations. References corresponding
@@ -5026,6 +5031,7 @@ package Einfo is
    --    Is_Constrained                      (Flag12)
    --    Next_Index                          (synth)
    --    Number_Dimensions                   (synth)
+   --    Proper_First_Index                  (synth)
    --    (plus type attributes)
 
    --  E_Block
@@ -5688,6 +5694,7 @@ package Einfo is
    --    Is_Constrained                      (Flag12)
    --    Next_Index                          (synth)
    --    Number_Dimensions                   (synth)
+   --    Proper_First_Index                  (synth)
    --    (plus type attributes)
 
    --  E_String_Literal_Subtype
@@ -5695,6 +5702,7 @@ package Einfo is
    --    String_Literal_Length               (Uint16)
    --    First_Index                         (Node17)   (always Empty)
    --    Packed_Array_Type                   (Node23)
+   --    Proper_First_Index                  (synth)
    --    (plus type attributes)
 
    --  E_Subprogram_Body
@@ -6532,6 +6540,7 @@ package Einfo is
    function Number_Formals                      (Id : E) return Pos;
    function Parameter_Mode                      (Id : E) return Formal_Kind;
    function Primitive_Operations                (Id : E) return L;
+   function Proper_First_Index                  (Id : E) return E;
    function Root_Type                           (Id : E) return E;
    function Safe_Emax_Value                     (Id : E) return U;
    function Safe_First_Value                    (Id : E) return R;
index 39c1019a0287533d8b90952614a60e796bc7b0e3..f1c47569800275c481d923089ec1f5dee203d08b 100644 (file)
@@ -6031,9 +6031,9 @@ package body Exp_Aggr is
 
          --  At this stage we have a suitable aggregate for handling at compile
          --  time (the only remaining checks are that the values of expressions
-         --  in the aggregate are compile time known (check is performed by
-         --  Get_Component_Val), and that any subtypes or ranges are statically
-         --  known.
+         --  in the aggregate are compile-time known, checks are performed by
+         --  Get_Component_Val, and that any subtypes or ranges are statically
+         --  known).
 
          --  If the aggregate is not fully positional at this stage, then
          --  convert it to positional form. Either this will fail, in which
@@ -6097,12 +6097,12 @@ package body Exp_Aggr is
                   exit;
 
                elsif Is_Record_Type (Etype (Enclosing_Aggregate))
-                    and then Reverse_Storage_Order
-                               (Etype (Enclosing_Aggregate))
+                 and then Reverse_Storage_Order (Etype (Enclosing_Aggregate))
                then
                   In_Reverse_Storage_Order_Record := True;
                   exit;
                end if;
+
                Enclosing_Aggregate := Parent (Enclosing_Aggregate);
             end loop;
 
@@ -6110,9 +6110,15 @@ package body Exp_Aggr is
             --  value. For big endian we fill up the high order bits of the
             --  target value (which is a left justified modular value).
 
+            --  Above comment needs extending for the code below, which is by
+            --  the way incomprehensible, I have no idea what a xor b xor c
+            --  means, and it hurts my brain to try to figure it out???
+            --  Let's introduce a new variable, perhaps Effectively_Big_Endian
+            --  and compute it with clearer code ???
+
             if Bytes_Big_Endian
-                 xor Debug_Flag_8
-                 xor In_Reverse_Storage_Order_Record
+              xor Debug_Flag_8
+              xor In_Reverse_Storage_Order_Record
             then
                Shift := Csiz * (Len - 1);
                Incr  := -Csiz;
index 519fad0f357f587cde756efba3b7d657f7c79bf8..9b6c0ce9f949b5dda6e9d970dedfee392706adf7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -2135,7 +2135,18 @@ package body Layout is
                      --  others case.
 
                      if No (RM_Siz_Expr) then
-                        RM_Siz_Expr := Bits_To_SU (RM_SizV);
+
+                        --  If this is the only variant and the size is a
+                        --  literal, then use bit size as is, otherwise convert
+                        --  to storage units and continue to the next variant.
+
+                        if No (Prev (Var))
+                          and then Nkind (RM_SizV) = N_Integer_Literal
+                        then
+                           RM_Siz_Expr := RM_SizV;
+                        else
+                           RM_Siz_Expr := Bits_To_SU (RM_SizV);
+                        end if;
 
                      --  Otherwise construct the appropriate test
 
index 4c37ca182abe2013a4132d7644ccf3a70ca68c24..0c8783103958f51db671c32d41c5571f8ac05bf0 100644 (file)
@@ -11652,23 +11652,6 @@ package body Sem_Util is
       Set_Sloc (Endl, Loc);
    end Process_End_Label;
 
-   ------------------------
-   -- Proper_First_Index --
-   ------------------------
-
-   function Proper_First_Index (Array_Typ : Entity_Id) return Entity_Id is
-      Typ : Entity_Id;
-
-   begin
-      Typ := Array_Typ;
-
-      if Ekind (Typ) = E_String_Literal_Subtype then
-         Typ := Base_Type (Typ);
-      end if;
-
-      return First_Index (Typ);
-   end Proper_First_Index;
-
    ------------------------------------
    -- References_Generic_Formal_Type --
    ------------------------------------
index 8e7d7bd81c6751f5d82c70001d7832d51e577da4..607bd8e72e049be9b3dc9489a5ef8b3f207b800e 100644 (file)
@@ -1284,11 +1284,6 @@ package Sem_Util is
    --  parameter Ent gives the entity to which the End_Label refers,
    --  and to which cross-references are to be generated.
 
-   function Proper_First_Index (Array_Typ : Entity_Id) return Entity_Id;
-   --  Return the First_Index attribute of an arbitrary array type unless it
-   --  is a string literal subtype in which case return the First_Index of the
-   --  base type.
-
    function References_Generic_Formal_Type (N : Node_Id) return Boolean;
    --  Returns True if the expression Expr contains any references to a
    --  generic type. This can only happen within a generic template.