]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
exp_util.adb (Silly_Boolean_Array_Xor_Test): Simplify existing code.
authorRobert Dewar <dewar@adacore.com>
Thu, 9 Apr 2009 10:15:20 +0000 (10:15 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 9 Apr 2009 10:15:20 +0000 (12:15 +0200)
2009-04-09  Robert Dewar  <dewar@adacore.com>

* exp_util.adb (Silly_Boolean_Array_Xor_Test): Simplify existing code.

* atree.h: Add Elist26

* gnat_ugn.texi: Complete documentation deprecating -gnatN for non-gcc
backends.

From-SVN: r145818

gcc/ada/ChangeLog
gcc/ada/atree.h
gcc/ada/exp_util.adb
gcc/ada/gnat_ugn.texi

index ebbc4d94553addbd93e4848f8712b57464a36367..fc35d44a53037b72cc7bb91f055774ff4ffbce55 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-09  Robert Dewar  <dewar@adacore.com>
+
+       * exp_util.adb (Silly_Boolean_Array_Xor_Test): Simplify existing code.
+
+       * atree.h: Add Elist26
+
+       * gnat_ugn.texi: Complete documentation deprecating -gnatN for non-gcc
+       backends.
+
 2009-04-09  Javier Miranda  <miranda@adacore.com>
 
        * exp_disp.adb (Export_DT): Addition of a new argument (Index); used to
index 9dda243499c614d9a43a963ebe138ce482b4fcaa..7ad985d139d3462fcdc071cf37a58aa3aff0b20a 100644 (file)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                              C Header File                               *
  *                                                                          *
- *          Copyright (C) 1992-2007, Free Software Foundation, Inc.         *
+ *          Copyright (C) 1992-2008, 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- *
@@ -473,6 +473,7 @@ extern Node_Id Current_Error_Node;
 #define Elist21(N)    Field21 (N)
 #define Elist23(N)    Field23 (N)
 #define Elist25(N)    Field25 (N)
+#define Elist26(N)    Field26 (N)
 
 #define Name1(N)      Field1  (N)
 #define Name2(N)      Field2  (N)
index 241132ff04c110aeb068c43906c824ab5c0aa17f..b61801cbabaeffe4bd12f5f41eb817233f3cf90c 100644 (file)
@@ -5147,7 +5147,7 @@ package body Exp_Util is
    --  This procedure implements an odd and silly test. We explicitly check
    --  for the XOR case where the component type is True .. True, since this
    --  will raise constraint error. A special check is required since CE
-   --  will not be required otherwise (cf Expand_Packed_Not).
+   --  will not be generated otherwise (cf Expand_Packed_Not).
 
    --  No such check is required for AND and OR, since for both these cases
    --  False op False = False, and True op True = True.
@@ -5155,34 +5155,46 @@ package body Exp_Util is
    procedure Silly_Boolean_Array_Xor_Test (N : Node_Id; T : Entity_Id) is
       Loc : constant Source_Ptr := Sloc (N);
       CT  : constant Entity_Id  := Component_Type (T);
-      BT  : constant Entity_Id  := Base_Type (CT);
 
    begin
+      --  The check we install is
+
+      --    constraint_error when
+      --      Boolean (component_type'First)
+      --        and then Boolean (component_type'Last)
+      --        and then array_type'Length /= 0)
+
+      --  We need the last guard because we don't want to raise CE for empty
+      --  arrays since no out of range values result (Empty arrays with a
+      --  component type of True .. True -- very useful -- even the ACATS
+      --  does not test that marginal case!).
+
       Insert_Action (N,
         Make_Raise_Constraint_Error (Loc,
           Condition =>
-            Make_Op_And (Loc,
+            Make_And_Then (Loc,
               Left_Opnd =>
-                Make_Op_Eq (Loc,
+                Make_And_Then (Loc,
                   Left_Opnd =>
-                    Make_Attribute_Reference (Loc,
-                      Prefix         => New_Occurrence_Of (CT, Loc),
-                      Attribute_Name => Name_First),
+                    Convert_To (Standard_Boolean,
+                      Make_Attribute_Reference (Loc,
+                        Prefix         => New_Occurrence_Of (CT, Loc),
+                        Attribute_Name => Name_First)),
 
                   Right_Opnd =>
-                    Convert_To (BT,
-                      New_Occurrence_Of (Standard_True, Loc))),
+                    Convert_To (Standard_Boolean,
+                      Make_Attribute_Reference (Loc,
+                        Prefix         => New_Occurrence_Of (CT, Loc),
+                        Attribute_Name => Name_Last))),
 
               Right_Opnd =>
-                Make_Op_Eq (Loc,
+                Make_Op_Ne (Loc,
                   Left_Opnd =>
                     Make_Attribute_Reference (Loc,
-                      Prefix         => New_Occurrence_Of (CT, Loc),
-                      Attribute_Name => Name_Last),
+                      Prefix => New_Reference_To (T, Loc),
+                      Attribute_Name => Name_Length),
+                  Right_Opnd => Make_Integer_Literal (Loc, 0))),
 
-                  Right_Opnd =>
-                    Convert_To (BT,
-                      New_Occurrence_Of (Standard_True, Loc)))),
           Reason => CE_Range_Check_Failed));
    end Silly_Boolean_Array_Xor_Test;
 
index 6d4390d6f3b9081a8a532cccd1e4bd0643faa070..9b17e2c119acfaa2a63f2a85e4660714fa1117d9 100644 (file)
@@ -2372,9 +2372,6 @@ The use of @option{-gnatN} activates  inlining optimization
 that is performed by the front end of the compiler. This inlining does
 not require that the code generation be optimized. Like @option{-gnatn},
 the use of this switch generates additional dependencies.
-Note that
-@option{-gnatN} automatically implies @option{-gnatn} so it is not necessary
-to specify both options.
 
 When using a gcc-based back end (in practice this means using any version
 of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
@@ -4014,14 +4011,12 @@ Activate front end inlining for subprograms for which
 pragma @code{Inline} is specified. This inlining is performed
 by the front end and will be visible in the
 @option{-gnatG} output.
-In some cases, this has proved more effective than the back end
-inlining resulting from the use of
-@option{-gnatn}.
-Note that
-@option{-gnatN} automatically implies
-@option{-gnatn} so it is not necessary
-to specify both options. There are a few cases that the back-end inlining
-catches that cannot be dealt with in the front-end.
+
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
 
 @item -gnato
 @cindex @option{-gnato} (@command{gcc})
@@ -6716,12 +6711,14 @@ see @ref{Inlining of Subprograms}.
 
 @item -gnatN
 @cindex @option{-gnatN} (@command{gcc})
-The front end inlining activated by this switch is generally more extensive,
-and quite often more effective than the standard @option{-gnatn} inlining mode.
-It will also generate additional dependencies.
-Note that
-@option{-gnatN} automatically implies @option{-gnatn} so it is not necessary
-to specify both options.
+This switch activates front-end inlining which also
+generates additional dependencies.
+
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
 @end table
 
 @node Auxiliary Output Control