]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 20 Feb 2015 09:48:22 +0000 (10:48 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 20 Feb 2015 09:48:22 +0000 (10:48 +0100)
2015-02-20  Eric Botcazou  <ebotcazou@adacore.com>

* sinfo.ads: Add comment.

2015-02-20  Olivier Hainque  <hainque@adacore.com>

* opt.ads: Replace Opt.Suppress_All_Inlining by two separate
flags controlling the actual FE inlining out of pragma Inline
and pragma Inline_Always.
* adabkend.adb (Scan_Compiler_Arguments): Set both flags to True
on -fno-inline, which disables all inlining in compilers with
an Ada back-end and without back-end inlining support.
* back_end.adb (Scan_Back_End_Switches): Set the Inline related
flag to True on -fno-inline and leave Inline_Always alone for
gcc back-ends.
* back_end.ads (Scan_Compiler_Arguments): Adjust spec wrt the
names of the Opt flags it sets.
* gnat1drv.adb (Adjust_Global_Switches): Remove test on
Opt.Suppress_All_Inlining in the Back_End_Inlining computation.
* sem_prag.adb (Make_Inline): Remove early return conditioned
on Opt.Suppress_All_Inlining.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use the flags to
disable the calls to Build_Body_To_Inline otherwise triggered
by pragma Inline or Inline_Always. This will prevent actual
front-end inlining of the subprogram on calls.

From-SVN: r220842

gcc/ada/ChangeLog
gcc/ada/adabkend.adb
gcc/ada/back_end.adb
gcc/ada/back_end.ads
gcc/ada/gnat1drv.adb
gcc/ada/opt.ads
gcc/ada/sem_ch6.adb
gcc/ada/sem_prag.adb
gcc/ada/sinfo.ads

index 7a2d6d112e58899391cd8b098893e2fd98791851..27f4cd04395c8ca623c303594f827d5410ca469a 100644 (file)
@@ -1,3 +1,29 @@
+2015-02-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sinfo.ads: Add comment.
+
+2015-02-20  Olivier Hainque  <hainque@adacore.com>
+
+       * opt.ads: Replace Opt.Suppress_All_Inlining by two separate
+       flags controlling the actual FE inlining out of pragma Inline
+       and pragma Inline_Always.
+       * adabkend.adb (Scan_Compiler_Arguments): Set both flags to True
+       on -fno-inline, which disables all inlining in compilers with
+       an Ada back-end and without back-end inlining support.
+       * back_end.adb (Scan_Back_End_Switches): Set the Inline related
+       flag to True on -fno-inline and leave Inline_Always alone for
+       gcc back-ends.
+       * back_end.ads (Scan_Compiler_Arguments): Adjust spec wrt the
+       names of the Opt flags it sets.
+       * gnat1drv.adb (Adjust_Global_Switches): Remove test on
+       Opt.Suppress_All_Inlining in the Back_End_Inlining computation.
+       * sem_prag.adb (Make_Inline): Remove early return conditioned
+       on Opt.Suppress_All_Inlining.
+       * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use the flags to
+       disable the calls to Build_Body_To_Inline otherwise triggered
+       by pragma Inline or Inline_Always. This will prevent actual
+       front-end inlining of the subprogram on calls.
+
 2015-02-20  Eric Botcazou  <ebotcazou@adacore.com>
 
        * exp_ch3.adb (Default_Initialize_Object): Call Add_Inlined_Body on the
index 1a420009100ed2f87e8dea803057c6e7eaf07a51..5bf4f748bfe3c6618a984363387e82f271b063c1 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2001-2014, AdaCore                     --
+--                     Copyright (C) 2001-2015, AdaCore                     --
 --                                                                          --
 -- 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- --
@@ -178,12 +178,13 @@ package body Adabkend is
             return;
 
          --  Special check, the back end switch -fno-inline also sets the
-         --  front end flag to entirely inhibit all inlining. So we store it
-         --  and set the appropriate flag.
+         --  front end flags to entirely inhibit all inlining. So we store it
+         --  and set the appropriate flags.
 
          elsif Switch_Chars (First .. Last) = "fno-inline" then
             Lib.Store_Compilation_Switch (Switch_Chars);
-            Opt.Suppress_All_Inlining := True;
+            Opt.Disable_FE_Inline := True;
+            Opt.Disable_FE_Inline_Always := True;
             return;
 
          --  Similar processing for -fpreserve-control-flow
index adba33e5e319e0583fb9c8b6434b623b8124b5c6..7768687b26907cde6ae70605dc3cebdb0971e240 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, 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- --
@@ -23,6 +23,8 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
+--  This is the version of the Back_End package for GCC back ends
+
 with Atree;    use Atree;
 with Debug;    use Debug;
 with Elists;   use Elists;
@@ -251,11 +253,12 @@ package body Back_End is
          else
             Store_Compilation_Switch (Switch_Chars);
 
-            --  Back end switch -fno-inline also sets the Suppress_All_Inlining
-            --  front end flag to entirely inhibit all inlining.
+            --  For gcc back ends, -fno-inline disables Inline pragmas only,
+            --  not Inline_Always to remain consistent with the always_inline
+            --  attribute behavior.
 
             if Switch_Chars (First .. Last) = "fno-inline" then
-               Opt.Suppress_All_Inlining := True;
+               Opt.Disable_FE_Inline := True;
 
             --  Back end switch -fpreserve-control-flow also sets the front end
             --  flag that inhibits improper control flow transformations.
index 0d45a9ba7e6d2dca55edd051890b69e0644fe485..c58f0805f200aae8bc549f329ae8508157b4ee3e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, 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- --
@@ -24,6 +24,7 @@
 ------------------------------------------------------------------------------
 
 --  Call the back end with all the information needed
+
 --  Note: there are multiple bodies/variants of this package, so do not
 --  modify this spec without coordination.
 
@@ -65,7 +66,8 @@ package Back_End is
    --  This routine is expected to set the following to True if necessary (the
    --  default for all of these in Opt is False).
    --
-   --    Opt.Suppress_All_Inlining
+   --    Opt.Disable_FE_Inline
+   --    Opt.Disable_FE_Inline_Always
    --    Opt.Suppress_Control_Float_Optimizations
    --    Opt.Generate_SCO
    --    Opt.Generate_SCO_Instance_Table
index 983c120c09ca864aaf635184e166619ab1c3b31a..a7acd29801a6c748d4256425c2c69d50ef3f6d73 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, 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- --
@@ -609,13 +609,9 @@ procedure Gnat1drv is
 
       Back_End_Inlining :=
 
-        --  No back end inlining if inlining is suppressed
-
-        not Suppress_All_Inlining
-
         --  No back end inlining available for VM targets
 
-        and then VM_Target = No_VM
+        VM_Target = No_VM
 
         --  No back end inlining available on AAMP
 
index 026878ed79703a34b42e925468f2f251318cadbb..d144a5a8df83c961bca18542f04641f5b49237dd 100644 (file)
@@ -1370,10 +1370,14 @@ package Opt is
    --  with'ed indirectly. It is set True by use of either the -gnatg or
    --  -gnaty switches, but not by use of the Style_Checks pragma.
 
-   Suppress_All_Inlining : Boolean := False;
-   --  GNAT
-   --  Set by -fno-inline. Suppresses all inlining, both front end and back end
-   --  regardless of any other switches that are set.
+   Disable_FE_Inline        : Boolean := False;
+   Disable_FE_Inline_Always : Boolean := False;
+   --  GNAT
+   --  Request to disable front end inlining from pragma Inline or pragma
+   --  Inline_Always out of the presence of the -fno-inline back end flag
+   --  on the command line, regardless of any other switches that are set.
+   --  It remains the back end's reponsibility to honor -fno-inline at the
+   --  back end level.
 
    Suppress_Control_Flow_Optimizations : Boolean := False;
    --  GNAT
index 94249faad3e67bf9a5a8199ebf0a636150b48f5b..523cbc22c37742e5dd5a0f6fd326b62f88781ef1 100644 (file)
@@ -3739,8 +3739,11 @@ package body Sem_Ch6 is
          --  Legacy implementation (relying on frontend inlining)
 
          if not Back_End_Inlining then
-            if Has_Pragma_Inline_Always (Spec_Id)
-              or else (Has_Pragma_Inline (Spec_Id) and Front_End_Inlining)
+            if (Has_Pragma_Inline_Always (Spec_Id)
+                  and then not Opt.Disable_FE_Inline_Always)
+              or else
+              (Has_Pragma_Inline (Spec_Id) and then Front_End_Inlining
+                 and then not Opt.Disable_FE_Inline)
             then
                Build_Body_To_Inline (N, Spec_Id);
             end if;
index 01fe51e263cbe45656bb958285b64d0197896b06..8c26e3ef8a0bfa7dba4c2882b9ea9e3ef02775d9 100644 (file)
@@ -8204,12 +8204,6 @@ package body Sem_Prag is
                Applies := True;
                return;
 
-            --  Ignore if all inlining is suppressed
-
-            elsif Suppress_All_Inlining then
-               Applies := True;
-               return;
-
             --  If inlining is not possible, for now do not treat as an error
 
             elsif Status /= Suppressed
index 7c4bbf9a98aa4fc6919598fe5b401fb20b9899a1..3dc93111fb184ad6fb41043bfe6c879c57413edd 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, 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- --
@@ -6522,6 +6522,14 @@ package Sinfo is
       --  a cleanup procedure that must handle declarations as well as the
       --  statements of a block.
 
+      --  Note: the cleanup_procedure_call does not go through the common
+      --  processing for calls, which in particular means that it will not be
+      --  automatically inlined in all cases, even though the procedure to be
+      --  called is marked inline. More specifically, if the procedure comes
+      --  from another unit than the main source unit, for example a run-time
+      --  unit, then it needs to be manually added to the list of bodies to be
+      --  inlined by invoking Add_Inlined_Body on it.
+
       --  N_Handled_Sequence_Of_Statements
       --  Sloc points to first token of first statement
       --  Statements (List3)