2014-02-06 Sergey Rybin <rybin@adacore.com frybin>
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:21:40 +0000 (11:21 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:21:40 +0000 (11:21 +0100)
* gnat_ugn.texi, vms_data.ads: Add documentation of -j option for
gnatmetric.

2014-02-06  Robert Dewar  <dewar@adacore.com>

* exp_ch4.adb (Expand_N_Shift_Left): Handle shift counts greater
than the word size when operating in Modify_Tree_For_C mode.
* sinfo.ads: Add documentation section on Modify_Tree_For_C mode.

2014-02-06  Robert Dewar  <dewar@adacore.com>

* erroutc.adb (Warning_Specifically_Suppressed.Matches):
compare is case insensitive.
* gnat_rm.texi: Document that string compare for Warnings Off
is now case insensitive.

From-SVN: r207546

gcc/ada/ChangeLog
gcc/ada/erroutc.adb
gcc/ada/exp_ch4.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/sinfo.ads
gcc/ada/vms_data.ads

index 70bd9fc..d61f774 100644 (file)
@@ -1,3 +1,21 @@
+2014-02-06  Sergey Rybin  <rybin@adacore.com frybin>
+
+       * gnat_ugn.texi, vms_data.ads: Add documentation of -j option for
+       gnatmetric.
+
+2014-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Shift_Left): Handle shift counts greater
+       than the word size when operating in Modify_Tree_For_C mode.
+       * sinfo.ads: Add documentation section on Modify_Tree_For_C mode.
+
+2014-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * erroutc.adb (Warning_Specifically_Suppressed.Matches):
+       compare is case insensitive.
+       * gnat_rm.texi: Document that string compare for Warnings Off
+       is now case insensitive.
+
 2014-02-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat_rm.texi: Small wording tweak.
index 541cd43..b31f760 100644 (file)
@@ -1347,6 +1347,7 @@ package body Erroutc is
       function Matches (S : String; P : String) return Boolean;
       --  Returns true if the String S patches the pattern P, which can contain
       --  wild card chars (*). The entire pattern must match the entire string.
+      --  Case is ignored in the comparison (so X matches x).
 
       -------------
       -- Matches --
@@ -1398,7 +1399,7 @@ package body Erroutc is
 
             --  Dealt with end of string and *, advance if we have a match
 
-            elsif S (SPtr) = P (PPtr) then
+            elsif Fold_Lower (S (SPtr)) = Fold_Lower (P (PPtr)) then
                SPtr := SPtr + 1;
                PPtr := PPtr + 1;
 
index d45d509..ec9febf 100644 (file)
@@ -8787,6 +8787,7 @@ package body Exp_Ch4 is
                   Make_Op_Shift_Left (Loc,
                     Left_Opnd  => Left_Opnd (N),
                     Right_Opnd => Right_Opnd (N)),
+
                 Right_Opnd =>
                   Make_Op_Shift_Right (Loc,
                     Left_Opnd  => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
@@ -8839,6 +8840,7 @@ package body Exp_Ch4 is
                   Make_Op_Shift_Right (Loc,
                     Left_Opnd  => Left_Opnd (N),
                     Right_Opnd => Right_Opnd (N)),
+
                 Right_Opnd =>
                   Make_Op_Shift_Left (Loc,
                     Left_Opnd  => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
@@ -8857,9 +8859,64 @@ package body Exp_Ch4 is
    -- Expand_N_Op_Shift_Left --
    ----------------------------
 
+   --  Note: nothing in this routine depends on left as opposed to right shifts
+   --  so we share the routine for expanding shift right operations.
+
    procedure Expand_N_Op_Shift_Left (N : Node_Id) is
    begin
       Binary_Op_Validity_Checks (N);
+
+      --  If we are in Modify_Tree_For_C mode, then ensure that the right
+      --  operand is not greater than the word size (since that would not
+      --  be defined properly by the corresponding C shift operator).
+
+      if Modify_Tree_For_C then
+         declare
+            Right : constant Node_Id    := Right_Opnd (N);
+            Loc   : constant Source_Ptr := Sloc (Right);
+            Typ   : constant Entity_Id  := Etype (N);
+            Siz   : constant Uint       := Esize (Typ);
+            Orig  : Node_Id;
+            OK    : Boolean;
+            Lo    : Uint;
+            Hi    : Uint;
+
+         begin
+            if Compile_Time_Known_Value (Right) then
+               if Expr_Value (Right) >= Siz then
+                  Rewrite (N, Make_Integer_Literal (Loc, 0));
+                  Analyze_And_Resolve (N, Typ);
+               end if;
+
+            --  Not compile time known, find range
+
+            else
+               Determine_Range (Right, OK, Lo, Hi, Assume_Valid => True);
+
+               --  Nothing to do if known to be OK range, otherwise expand
+
+               if not OK or else Hi >= Siz then
+
+                  --  Prevent recursion on copy of shift node
+
+                  Orig := Relocate_Node (N);
+                  Set_Analyzed (Orig);
+
+                  --  Now do the rewrite
+
+                  Rewrite (N,
+                     Make_If_Expression (Loc,
+                       Expressions => New_List (
+                         Make_Op_Ge (Loc,
+                           Left_Opnd  => Duplicate_Subexpr_Move_Checks (Right),
+                           Right_Opnd => Make_Integer_Literal (Loc, Siz)),
+                         Make_Integer_Literal (Loc, 0),
+                         Orig)));
+                  Analyze_And_Resolve (N, Typ);
+               end if;
+            end if;
+         end;
+      end if;
    end Expand_N_Op_Shift_Left;
 
    -----------------------------
@@ -8868,7 +8925,9 @@ package body Exp_Ch4 is
 
    procedure Expand_N_Op_Shift_Right (N : Node_Id) is
    begin
-      Binary_Op_Validity_Checks (N);
+      --  Share shift left circuit
+
+      Expand_N_Op_Shift_Left (N);
    end Expand_N_Op_Shift_Right;
 
    ----------------------------------------
@@ -8892,6 +8951,10 @@ package body Exp_Ch4 is
       --  Note: in almost all C compilers it would work to just shift a
       --  signed integer right, but it's undefined and we cannot rely on it.
 
+      --  Note: the above works fine for shift counts greater than or equal
+      --  to the word size, since in this case (not (Shift_Right (Mask, bits)))
+      --  generates all 1'bits.
+
       --  What about non-binary modulus ???
 
       declare
index b7c97ac..dad15cd 100644 (file)
@@ -7435,6 +7435,7 @@ the message. For example, you can use
 message @code{warning: 960 bits of "a" unused}. No other regular
 expression notations are permitted. All characters other than asterisk in
 these three specific cases are treated as literal characters in the match.
+The match is case insensitive, for example XYZ matches xyz.
 
 The above use of patterns to match the message applies only to warning
 messages generated by the front end. This form of the pragma with a
index bbe9900..9dfedf6 100644 (file)
@@ -6497,7 +6497,8 @@ an inherited operation must carry an overriding indicator.
 @emph{Check pragma casing.}
 Pragma names must be written in mixed case, that is, the
 initial letter and any letter following an underscore must be uppercase.
-All other letters must be lowercase.
+All other letters must be lowercase. An exception is that SPARK_Mode is
+allowed as an alternative for Spark_Mode.
 
 @item ^r^REFERENCES^
 @emph{Check references.}
@@ -16622,14 +16623,21 @@ line breaks. You can use this switch more than once in the same call to
 @command{gnatmetric}. You also can combine this switch with
 an explicit list of files.
 
+@item ^-j^/PROCESSES=^@var{n}
+@cindex @option{^-j^/PROCESSES^} (@command{gnatmetric})
+Use @var{n} processes to carry out the tree creations (internal representations
+of the argument sources). On a multiprocessor machine this speeds up processing
+of big sets of argument sources. If @var{n} is 0, then the maximum number of
+parallel tree creations is the number of core processors on the platform.
+
 @item ^-v^/VERBOSE^
-@cindex @option{^-v^/VERBOSE^} (@code{gnatmetric})
+@cindex @option{^-v^/VERBOSE^} (@command{gnatmetric})
 Verbose mode;
 @command{gnatmetric} generates version information and then
 a trace of sources being processed.
 
 @item ^-q^/QUIET^
-@cindex @option{^-q^/QUIET^} (@code{gnatmetric})
+@cindex @option{^-q^/QUIET^} (@command{gnatmetric})
 Quiet mode.
 @end table
 
index d89f12e..f399dab 100644 (file)
@@ -614,6 +614,28 @@ package Sinfo is
    --    refers to a node or is posted on its source location, and has the
    --    effect of inhibiting further messages involving this same node.
 
+   -----------------------
+   -- Modify_Tree_For_C --
+   -----------------------
+
+   --  If the flag Opt.Modify_Tree_For_C is set True, then the tree is modified
+   --  in ways that help match the semantics better with C, easing the task of
+   --  interfacing to C code generators (other than GCC, where the work is done
+   --  in gigi, and there is no point in changing that), and also making life
+   --  easier for Cprint in generating C source code.
+
+   --  The current modifications implemented are as follows:
+
+   --    N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic nodes
+   --    are eliminated from the tree (since these operations do not exist in
+   --    C), and the operations are rewritten in terms of logical shifts and
+   --    other logical operations that do exist in C. See Exp_Ch4 expansion
+   --    routines for these operators for details of the transformations made.
+
+   --    The right operand of N_Op_Shift_Right and N_Op_Shift_Left is always
+   --    less than the word size (since other values are not well-defined in
+   --    C). This is done using an explicit test if necessary.
+
    ------------------------------------
    -- Description of Semantic Fields --
    ------------------------------------
@@ -7145,6 +7167,12 @@ package Sinfo is
       --  plus fields for expression
       --  Shift_Count_OK (Flag4-Sem)
 
+      --  Note: N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic
+      --  never appear in the expanded tree if Modify_Tree_For_C mode is set.
+
+      --  Note: For N_Op_Shift_Left and N_Op_Shift_Right, the right operand is
+      --  always less than the word size if Modify_Tree_For_C mode is set.
+
    --------------------------
    -- Obsolescent Features --
    --------------------------
index 82567ea..e9b0212 100644 (file)
@@ -5798,6 +5798,18 @@ package VMS_Data is
    --   at the main project file will be parsed before the invocation of the
    --   binder.
 
+   S_Metric_Processes : aliased constant S := "/PROCESSES=#"                 &
+                                            "-j#";
+
+   --        /NOPROCESSES (D)
+   --        /PROCESSES=NNN
+   --
+   --   Use NNN processes to carry out the tree creations (internal
+   --   representations of the argument sources). On a multiprocessor machine
+   --   this speeds up processing of big sets of argument sources. If NNN is 0,
+   --   then the maximum number of parallel tree creations is the number of
+   --   core processors on the platform.
+
    S_Metric_Quiet    : aliased constant S := "/QUIET "                     &
                                              "-q";
    --        /NOQUIET (D)
@@ -5871,6 +5883,7 @@ package VMS_Data is
                         S_Metric_No_Local         'Access,
                         S_Metric_No_Static_Loop   'Access,
                         S_Metric_Project          'Access,
+                        S_Metric_Processes        'Access,
                         S_Metric_Quiet            'Access,
                         S_Metric_Suffix           'Access,
                         S_Metric_Subdirs          'Access,