From a4c1cd80655ef876d7f8ff5944999492647ebab5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 8 Dec 2004 12:26:04 +0100 Subject: [PATCH] debug.adb: Document that -gnatdA automatically sets -gnatR3m * debug.adb: Document that -gnatdA automatically sets -gnatR3m * gnat1drv.adb (Gnat1drv): If debug flag A set, then automatically set -gnatR3m mode. * repinfo.adb (List_Rep_Info): Remove special handling of -gnatdA flag. No longer needed now that we handle this in gnat1drv.adb. * repinfo.ads: Minor reformatting From-SVN: r91878 --- gcc/ada/debug.adb | 3 +- gcc/ada/gnat1drv.adb | 20 +++++++++---- gcc/ada/repinfo.adb | 69 +++++++++++++++----------------------------- gcc/ada/repinfo.ads | 32 ++++++++------------ 4 files changed, 52 insertions(+), 72 deletions(-) diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 436f380ed5c..90036e2332b 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -345,7 +345,8 @@ package body Debug is -- dA Forces output of representation information, including full -- information for all internal type and object entities, as well -- as all user defined type and object entities including private - -- and incomplete types. + -- and incomplete types. This debug switch also automatically sets + -- the equivalent of -gnatR3m. -- dB Output debug encodings for types and variants. See Exp_Dbug for -- exact form of the generated output. diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index eccb6bb9226..0a31d559fae 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -78,7 +78,7 @@ procedure Gnat1drv is -- Compilation unit node for main unit Main_Kind : Node_Kind; - -- Kind of main compilation unit node. + -- Kind of main compilation unit node Back_End_Mode : Back_End.Back_End_Mode_Type; -- Record back end mode @@ -140,7 +140,7 @@ begin ("cannot locate file system.ads"); raise Unrecoverable_Error; - -- Here if system.ads successfully read. Remember its source index. + -- Remember source index of system.ads (which was read successfully) else System_Source_File_Index := S; @@ -162,6 +162,14 @@ begin Configurable_Run_Time_Mode := True; end if; + -- Set -gnatR3m mode if debug flag A set + + if Debug_Flag_AA then + Back_Annotate_Rep_Info := True; + List_Representation_Info := 1; + List_Representation_Info_Mechanisms := True; + end if; + -- Output copyright notice if full list mode if (Verbose_Mode or Full_List) @@ -581,10 +589,10 @@ begin -- the Java VM, since representations are largely symbolic there. if Back_End_Mode = Declarations_Only - and then (not (Back_Annotate_Rep_Info or Debug_Flag_AA) - or else Main_Kind = N_Subunit - or else Targparm.Frontend_Layout_On_Target - or else Hostparm.Java_VM) + and then (not Back_Annotate_Rep_Info + or else Main_Kind = N_Subunit + or else Targparm.Frontend_Layout_On_Target + or else Hostparm.Java_VM) then Sem_Ch13.Validate_Unchecked_Conversions; Errout.Finalize; diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index cd4e9db6a71..2ce0d661fc8 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2003 Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2004 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- -- @@ -31,22 +31,22 @@ -- -- ------------------------------------------------------------------------------ -with Alloc; use Alloc; -with Atree; use Atree; -with Casing; use Casing; -with Debug; use Debug; -with Einfo; use Einfo; -with Lib; use Lib; -with Namet; use Namet; -with Opt; use Opt; -with Output; use Output; -with Sinfo; use Sinfo; -with Sinput; use Sinput; -with Snames; use Snames; -with Stand; use Stand; -with Table; use Table; -with Uname; use Uname; -with Urealp; use Urealp; +with Alloc; use Alloc; +with Atree; use Atree; +with Casing; use Casing; +with Debug; use Debug; +with Einfo; use Einfo; +with Lib; use Lib; +with Namet; use Namet; +with Opt; use Opt; +with Output; use Output; +with Sinfo; use Sinfo; +with Sinput; use Sinput; +with Snames; use Snames; +with Stand; use Stand; +with Table; use Table; +with Uname; use Uname; +with Urealp; use Urealp; package body Repinfo is @@ -199,13 +199,9 @@ package body Repinfo is -- Create_Discrim_Ref -- ------------------------ - function Create_Discrim_Ref - (Discr : Entity_Id) - return Node_Ref - is + function Create_Discrim_Ref (Discr : Entity_Id) return Node_Ref is N : constant Uint := Discriminant_Number (Discr); T : Nat; - begin Rep_Table.Increment_Last; T := Rep_Table.Last; @@ -220,12 +216,8 @@ package body Repinfo is -- Create_Dynamic_SO_Ref -- --------------------------- - function Create_Dynamic_SO_Ref - (E : Entity_Id) - return Dynamic_SO_Ref - is + function Create_Dynamic_SO_Ref (E : Entity_Id) return Dynamic_SO_Ref is T : Nat; - begin Dynamic_SO_Entity_Table.Increment_Last; T := Dynamic_SO_Entity_Table.Last; @@ -241,11 +233,9 @@ package body Repinfo is (Expr : TCode; Op1 : Node_Ref_Or_Val; Op2 : Node_Ref_Or_Val := No_Uint; - Op3 : Node_Ref_Or_Val := No_Uint) - return Node_Ref + Op3 : Node_Ref_Or_Val := No_Uint) return Node_Ref is T : Nat; - begin Rep_Table.Increment_Last; T := Rep_Table.Last; @@ -253,7 +243,6 @@ package body Repinfo is Rep_Table.Table (T).Op1 := Op1; Rep_Table.Table (T).Op2 := Op2; Rep_Table.Table (T).Op3 := Op3; - return UI_From_Int (-T); end Create_Node; @@ -261,10 +250,7 @@ package body Repinfo is -- Get_Dynamic_SO_Entity -- --------------------------- - function Get_Dynamic_SO_Entity - (U : Dynamic_SO_Ref) - return Entity_Id - is + function Get_Dynamic_SO_Entity (U : Dynamic_SO_Ref) return Entity_Id is begin return Dynamic_SO_Entity_Table.Table (-UI_To_Int (U)); end Get_Dynamic_SO_Entity; @@ -304,7 +290,6 @@ package body Repinfo is procedure List_Array_Info (Ent : Entity_Id) is begin List_Type_Info (Ent); - Write_Str ("for "); List_Name (Ent); Write_Str ("'Component_Size use "); @@ -330,9 +315,9 @@ package body Repinfo is function Find_Declaration (E : Entity_Id) return Node_Id is Decl : Node_Id; + begin Decl := Parent (E); - while Present (Decl) and then Nkind (Decl) /= N_Package_Body and then Nkind (Decl) /= N_Subprogram_Declaration @@ -972,11 +957,6 @@ package body Repinfo is Col : Nat; begin - if Debug_Flag_AA then - List_Representation_Info := 3; - List_Representation_Info_Mechanisms := True; - end if; - if List_Representation_Info /= 0 or else List_Representation_Info_Mechanisms then @@ -1094,9 +1074,8 @@ package body Repinfo is --------------- function Rep_Value - (Val : Node_Ref_Or_Val; - D : Discrim_List) - return Uint + (Val : Node_Ref_Or_Val; + D : Discrim_List) return Uint is function B (Val : Boolean) return Uint; -- Returns Uint_0 for False, Uint_1 for True diff --git a/gcc/ada/repinfo.ads b/gcc/ada/repinfo.ads index 02676dc305a..bdc67b7a6f6 100644 --- a/gcc/ada/repinfo.ads +++ b/gcc/ada/repinfo.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2001 Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2004 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- -- @@ -73,7 +73,7 @@ package Repinfo is -- Back-Annotation by Gigi -- ----------------------------- - -- The following interface is used by gigi if Backend_Layout is True. + -- The following interface is used by gigi if Backend_Layout is True -- As part of the processing in gigi, the types are laid out and -- appropriate values computed for the sizes and component positions @@ -177,20 +177,17 @@ package Repinfo is -- The following declarations are for use by gigi for back annotation function Create_Node - (Expr : TCode; - Op1 : Node_Ref_Or_Val; - Op2 : Node_Ref_Or_Val := No_Uint; - Op3 : Node_Ref_Or_Val := No_Uint) - return Node_Ref; + (Expr : TCode; + Op1 : Node_Ref_Or_Val; + Op2 : Node_Ref_Or_Val := No_Uint; + Op3 : Node_Ref_Or_Val := No_Uint) return Node_Ref; -- Creates a node with using the tree code defined by Expr and from -- 1-3 operands as required (unused operands set as shown to No_Uint) -- Note that this call can be used to create a discriminant reference -- by using (Expr => Discrim_Val, Op1 => discriminant_number). - function Create_Discrim_Ref - (Discr : Entity_Id) - return Node_Ref; - -- Creates a refrerence to the discriminant whose entity is Discr. + function Create_Discrim_Ref (Discr : Entity_Id) return Node_Ref; + -- Creates a refrerence to the discriminant whose entity is Discr -------------------------------------------------------- -- Front-End Interface for Dynamic Size/Offset Values -- @@ -249,17 +246,13 @@ package Repinfo is -- Given a SO_Ref (Uint) value, returns True iff the SO_Ref value -- represents a static Size/Offset value (i.e. it is non-negative). - function Create_Dynamic_SO_Ref - (E : Entity_Id) - return Dynamic_SO_Ref; + function Create_Dynamic_SO_Ref (E : Entity_Id) return Dynamic_SO_Ref; -- Given the Entity_Id for a constant (case 1), the Node_Id for an -- expression (case 2), or the Entity_Id for a function (case 3), -- this function returns a (negative) Uint value that can be used -- to retrieve the entity or expression for later use. - function Get_Dynamic_SO_Entity - (U : Dynamic_SO_Ref) - return Entity_Id; + function Get_Dynamic_SO_Entity (U : Dynamic_SO_Ref) return Entity_Id; -- Retrieve the Node_Id or Entity_Id stored by a previous call to -- Create_Dynamic_SO_Ref. The approach is that the front end makes -- the necessary Create_Dynamic_SO_Ref calls to associate the node @@ -274,9 +267,8 @@ package Repinfo is -- Type used to represent list of discriminant values function Rep_Value - (Val : Node_Ref_Or_Val; - D : Discrim_List) - return Uint; + (Val : Node_Ref_Or_Val; + D : Discrim_List) return Uint; -- Given the contents of a First_Bit_Position or Esize field containing -- a node reference (i.e. a negative Uint value) and D, the list of -- discriminant values, returns the interpreted value of this field.