public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] More complete information level for -gnatR4 output
@ 2019-07-22 14:03 Pierre-Marie de Rodat
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre-Marie de Rodat @ 2019-07-22 14:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

This instructs -gnatR4 to also list the Etype of user-declared objects
if it is compiler-generated, for example in:

package P2 is

  Arr_V : array (1 .. 5) of Integer;

end P2;

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-07-22  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* repinfo.adb (List_Entities): Also list compiled-generated
	types present as Etype of objects.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 600 bytes --]

--- gcc/ada/repinfo.adb
+++ gcc/ada/repinfo.adb
@@ -563,6 +563,13 @@ package body Repinfo is
                                   E_Loop_Parameter,
                                   E_Variable)
                then
+                  --  The type is relevant for an object
+
+                  if List_Representation_Info = 4 and then Is_Itype (Etype (E))
+                  then
+                     Relevant_Entities.Set (Etype (E), True);
+                  end if;
+
                   if List_Representation_Info >= 2 then
                      List_Object_Info (E);
                   end if;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Ada] More complete information level for -gnatR4 output
@ 2019-08-21  9:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre-Marie de Rodat @ 2019-08-21  9:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

This instructs -gnatR4 to also list the Etype of components in
user-declared record types if it is compiler-generated, for example in:

package P3 is

    type idx is range 1 .. 100;

    type Arr is array (Idx range <>) of Character;

    type Rec is record
       C : Arr (1 .. 5);
    end record;

end P3;

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-08-21  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* repinfo.adb (List_Array_Info): In -gnatR4 mode, set the
	relevant flag on the component type here instead of...
	(List_Object_Info): Likewise for the object type.
	(List_Entities): ...here.  In -gnatR4 mode, recurse into
	entities local to a record type.
	(List_Component_Layout): In -gnatR4 mode, mark the type as
	relevant.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2805 bytes --]

--- gcc/ada/repinfo.adb
+++ gcc/ada/repinfo.adb
@@ -357,6 +357,14 @@ package body Repinfo is
          Write_Eol;
          Write_Line ("}");
       end if;
+
+      --  The component type is relevant for an array
+
+      if List_Representation_Info = 4
+        and then Is_Itype (Component_Type (Base_Type (Ent)))
+      then
+         Relevant_Entities.Set (Component_Type (Base_Type (Ent)), True);
+      end if;
    end List_Array_Info;
 
    ---------------------------
@@ -539,20 +547,17 @@ package body Repinfo is
                      List_Record_Info (E, Bytes_Big_Endian);
                   end if;
 
+                  --  Recurse into entities local to a record type
+
+                  if List_Representation_Info = 4 then
+                     List_Entities (E, Bytes_Big_Endian, False);
+                  end if;
+
                elsif Is_Array_Type (E) then
                   if List_Representation_Info >= 1 then
                      List_Array_Info (E, Bytes_Big_Endian);
                   end if;
 
-                  --  The component type is relevant for an array
-
-                  if List_Representation_Info = 4
-                    and then Is_Itype (Component_Type (Base_Type (E)))
-                  then
-                     Relevant_Entities.Set
-                       (Component_Type (Base_Type (E)), True);
-                  end if;
-
                elsif Is_Type (E) then
                   if List_Representation_Info >= 2 then
                      List_Type_Info (E);
@@ -564,13 +569,6 @@ package body Repinfo is
                                   E_Loop_Parameter,
                                   E_Variable)
                then
-                  --  The type is relevant for an object
-
-                  if List_Representation_Info = 4 and then Is_Itype (Etype (E))
-                  then
-                     Relevant_Entities.Set (Etype (E), True);
-                  end if;
-
                   if List_Representation_Info >= 2 then
                      List_Object_Info (E);
                   end if;
@@ -975,6 +973,12 @@ package body Repinfo is
 
          List_Linker_Section (Ent);
       end if;
+
+      --  The type is relevant for an object
+
+      if List_Representation_Info = 4 and then Is_Itype (Etype (Ent)) then
+         Relevant_Entities.Set (Etype (Ent), True);
+      end if;
    end List_Object_Info;
 
    ----------------------
@@ -1283,6 +1287,12 @@ package body Repinfo is
          else
             Write_Line (";");
          end if;
+
+         --  The type is relevant for a component
+
+         if List_Representation_Info = 4 and then Is_Itype (Etype (Ent)) then
+            Relevant_Entities.Set (Etype (Ent), True);
+         end if;
       end List_Component_Layout;
 
       ------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Ada] More complete information level for -gnatR4 output
@ 2019-08-20  9:51 Pierre-Marie de Rodat
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre-Marie de Rodat @ 2019-08-20  9:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

This instructs -gnatR4 to also list the Etype of a user-declared record
subtype if it is compiler-generated, for example in:

package P is

   type U_Arr is array (Integer range <>) of Character;

   type Rec1 (D1, D2 : Integer) is record
      C : U_Arr (D1 .. D2);
   end record;

   type Rec_N is new Rec1 (1, 2);

end P;

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-08-20  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* repinfo.adb (List_Record_Info): In -gnatR4 mode, set the
	relevant flag on the implicit base type of a record subtype.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 470 bytes --]

--- gcc/ada/repinfo.adb
+++ gcc/ada/repinfo.adb
@@ -1681,6 +1681,15 @@ package body Repinfo is
          Write_Eol;
          Write_Line ("}");
       end if;
+
+      --  The type is relevant for a record subtype
+
+      if List_Representation_Info = 4
+        and then not Is_Base_Type (Ent)
+        and then Is_Itype (Etype (Ent))
+      then
+         Relevant_Entities.Set (Etype (Ent), True);
+      end if;
    end List_Record_Info;
 
    -------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-21  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 14:03 [Ada] More complete information level for -gnatR4 output Pierre-Marie de Rodat
2019-08-20  9:51 Pierre-Marie de Rodat
2019-08-21  9:27 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).