aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/nlists.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2020-07-14 17:10:19 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-20 03:21:35 -0400
commit83dcc2bd35e5dc981a13959b9bb6750736cd6544 (patch)
treeb2ecadbe1434218ceaec2b21a0539708482a3755 /gcc/ada/nlists.adb
parent1b93e420fc10f0eaeb2b09d9b86c8defb5b459a4 (diff)
downloadgcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.zip
gcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.tar.gz
gcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.tar.bz2
[Ada] Flexible AST node structure
gcc/ada/ * atree.ads: Make Default_Node a constant. Remove the modification of Comes_From_Source, and use a separate flag for that. Change Sloc to 0; it always overwritten, and never left as the No_Location value. (Print_Statistics): Move to spec so we can call it from gnat1drv. (Num_Nodes): Rename to clarify that this is approximate. Correct comment: nodes and entities are never deleted, the count is never decremented, and this is not used by Xref. (Initialize): Correct comment: Error_List is not created here. Other minor naming and comment changes. * atree.adb (Extend_Node, New_Copy, New_Entity, New_Node): Streamline these. Simplify and improve efficiency. Move code from Allocate_Initialize_Node to these, where it can be executed unconditionally. Take advantage of automatic zeroing of the Nodes table. (Allocate_Initialize_Node): Remove this. It was an efficiency bottleneck, and somewhat complicated, because it was called from 4 places, and had all sorts of conditionals to check where it was called from. Better to move most of that code to the call sites, where it can be executed (or not) unconditionally. (Allocate_New_Node): New procedure to partly replace Allocate_Initialize_Node (called from just 2 of those 4 places). (Comes_From_Source_Default): New flag written/read by Set_Comes_From_Source_Default/Get_Comes_From_Source_Default. This allows us to make Default_Node into a constant with all-zeros value. (Set_Paren_Count_Of_Copy): New procedure to avoid duplicated code. (Report): New procedure to encapsulate the call to the reporting procedure. (Atree_Private_Part): We now need a body for this package, to contain package body Nodes. (Approx_Num_Nodes_And_Entities): Was Num_Nodes. For efficiency, compute the answer from Nodes.Last. That way we don't need to increment a counter on every node creation. Other minor naming and comment changes. * gnat1drv.adb: Call Atree.Print_Statistics if -gnatd.A switch was given. Add comment documenting the new order dependency (we must process the command line before calling Atree.Initialize). * debug.adb: Document -gnatd.A. * einfo.adb, sinfo.adb: Remove useless Style_Checks pragmas. * nlists.ads (Allocate_List_Tables): Inline makes node creation a little faster. * nlists.adb (Initialize): Remove local constant E, which didn't seem to add clarity. * treepr.adb (Print_Init): Use renamed Approx_Num_Nodes_And_Entities function. * types.ads: Change the Low and High bounds as described above. * types.h: Change Low and High bounds to match types.ads. * sem_ch8.adb, namet.adb, namet.ads: Move the computation of Last_Name_Id from sem_ch8 to namet, and correct it to not assume Name_Ids are positive. * ali.adb, ali-util.adb, bindo-writers.adb, exp_dist.adb, fmap.adb, fname-uf.adb, osint.adb: Fix various hash functions to avoid assuming the various ranges are positive. Note that "mod" returns a nonnegative result when the second operand is positive. "rem" can return negative values in that case (in particular, if the first operand is negative, which it now is). * switch-c.adb: Allow switch -gnaten to control the value of Nodes_Size_In_Meg. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Remove traling whitespaces. * opt.ads (Nodes_Size_In_Meg): New Variable.
Diffstat (limited to 'gcc/ada/nlists.adb')
-rw-r--r--gcc/ada/nlists.adb8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index 29eec04..ef39ed4 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -338,8 +338,6 @@ package body Nlists is
----------------
procedure Initialize is
- E : constant List_Id := Error_List;
-
begin
Lists.Init;
Next_Node.Init;
@@ -348,9 +346,9 @@ package body Nlists is
-- Allocate Error_List list header
Lists.Increment_Last;
- Set_Parent (E, Empty);
- Set_First (E, Empty);
- Set_Last (E, Empty);
+ Set_Parent (Error_List, Empty);
+ Set_First (Error_List, Empty);
+ Set_Last (Error_List, Empty);
end Initialize;
------------------