public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5681] [Ada] Do not return freeze nodes for start of early call regions
@ 2021-12-01 10:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-12-01 10:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bbafa6251ed34c3753d3efd821338b493cc957e0

commit r12-5681-gbbafa6251ed34c3753d3efd821338b493cc957e0
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Nov 18 19:00:45 2021 +0100

    [Ada] Do not return freeze nodes for start of early call regions
    
    gcc/ada/
    
            * sem_elab.adb (Previous_Suitable_Construct): New function declared
            in the Early_Call_Region_Processor package.
            (Find_ECR): Call it to get the previous node at the start.
            (Include): Call it to get the previous node during the traversal.

Diff:
---
 gcc/ada/sem_elab.adb | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index c9067081bf2..29f306994f7 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -6965,6 +6965,11 @@ package body Sem_Elab is
          --  Determine whether arbitrary node N denotes a suitable construct
          --  for inclusion into the early call region.
 
+         function Previous_Suitable_Construct (N : Node_Id) return Node_Id;
+         pragma Inline (Previous_Suitable_Construct);
+         --  Return the previous node suitable for inclusion into the early
+         --  call region.
+
          procedure Transition_Body_Declarations
            (Bod  : Node_Id;
             Curr : out Node_Id);
@@ -7209,7 +7214,7 @@ package body Sem_Elab is
          begin
             --  The early call region starts at N
 
-            Curr  := Prev (N);
+            Curr  := Previous_Suitable_Construct (N);
             Start := N;
 
             --  Inspect each node in reverse declarative order while going in
@@ -7286,7 +7291,7 @@ package body Sem_Elab is
             --  Otherwise the input node is still within some list
 
             else
-               Curr := Prev (Start);
+               Curr := Previous_Suitable_Construct (Start);
             end if;
          end Include;
 
@@ -7378,6 +7383,23 @@ package body Sem_Elab is
             end case;
          end Is_Suitable_Construct;
 
+         ---------------------------------
+         -- Previous_Suitable_Construct --
+         ---------------------------------
+
+         function Previous_Suitable_Construct (N : Node_Id) return Node_Id is
+            P : Node_Id;
+
+         begin
+            P := Prev (N);
+
+            while Present (P) and then not Is_Suitable_Construct (P) loop
+               Prev (P);
+            end loop;
+
+            return P;
+         end Previous_Suitable_Construct;
+
          ----------------------------------
          -- Transition_Body_Declarations --
          ----------------------------------


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-01 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 10:27 [gcc r12-5681] [Ada] Do not return freeze nodes for start of early call regions Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).