aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/debug.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-01-08 19:53:41 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-05 04:18:59 -0400
commitc11207d345f8d678d440a3ff0f335b2ed25513e7 (patch)
treeb49c478537d5a81054f25fe4d1a93aa44be4153a /gcc/ada/debug.adb
parent78a4cb56a0f6fd46d469e6835fac6216ff91e29d (diff)
downloadgcc-c11207d345f8d678d440a3ff0f335b2ed25513e7.zip
gcc-c11207d345f8d678d440a3ff0f335b2ed25513e7.tar.gz
gcc-c11207d345f8d678d440a3ff0f335b2ed25513e7.tar.bz2
[Ada] Speed up enumeration'Value with perfect hash function
gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-imagen, s-imen16, s-imen32, s-imenu8, s-pehage, s-valuen, s-vaen16, s-vaen32 and s-vaenu8. Remove s-imenne, s-imgenu and s-valenu. * debug.adb (d_h): Document new usage. * einfo.ads (Lit_Hash): New attribute for enumeration types. (Set_Lit_Hash): Declare. * einfo.adb (Lit_Hash): New function. (Set_Lit_Hash): New procedure. (Write_Field21_Name): Print Lit_Hash for Enumeration_Kind. * exp_imgv.ads (Build_Enumeration_Image_Tables): Fix description and document the hash function and its tables. * exp_imgv.adb: Add with/use clauses for Debug. Add with clause for System.Perfect_Hash_Generators. (Append_Table_To): New helper routine. (Build_Enumeration_Image_Tables): Call it to build the tables. In the main unit, register the literals with the hash generator. If they are sufficiently many and -gnatd_h is not passed, generate a perfect hash function and its tables; otherwise, generate a dummy hash function. For the other units, generate only the declaration. In all cases, set Lit_Hash to the entity of the function, if any. (Expand_Value_Attribute): Pass the 'Unrestricted_Access of Lit_Hash, if any, as third argument to the Value_Enumeration_NN function. * gnat1drv.adb (Adjust_Global_Switches): force simpler implementation of 'Value in CodePeer_Mode. * lib.ads (Synchronize_Serial_Number): Add SN parameter. * lib.adb (Synchronize_Serial_Number): Assert that it is larger than the serial number of the current unit and set the latter to it only in this case. * rtsfind.ads (RTU_Id): Add System_Img_Enum_8, System_Img_Enum_16, System_Img_Enum_32, System_Val_Enum_8, System_Val_Enum_16 and System_Val_Enum_32. Remove System_Img_Enum, System_Img_Enum_New and System_Val_Enum. * sem_attr.adb (Analyze_Access_Attribute): Do not flag a compiler generated Unrestricted_Access attribute as illegal in a declare expression. (RE_Unit_Table): Adjust to above changes. * libgnat/g-heasor.ads: Add pragma Compiler_Unit_Warning. * libgnat/g-table.ads: Likewise. * libgnat/g-pehage.ads: Add with clause and local renaming for System.Perfect_Hash_Generators. (Optimization): Turn into derived type. (Verbose): Turn into renaming. (Too_Many_Tries): Likewise. (Table_Name): Move to System.Perfect_Hash_Generators. (Define): Likewise. (Value): Likewise. * libgnat/g-pehage.adb: Remove with clause for Ada.Directories, GNAT.Heap_Sort_G and GNAT.Table. Move bulk of implementation to System.Perfect_Hash_Generators, only keep the output part. * libgnat/s-imagen.ads: New generic unit. * libgnat/s-imagen.adb: New body. * libgnat/s-imen16.ads: New unit. * libgnat/s-imen32.ads: Likewise. * libgnat/s-imenu8.ads: Likewise. * libgnat/s-imenne.ads: Adjust description. * libgnat/s-imgenu.ads: Delete. * libgnat/s-imgenu.adb: Likewise. * libgnat/s-pehage.ads: New unit from GNAT.Perfect_Hash_Generators. * libgnat/s-pehage.adb: New body from GNAT.Perfect_Hash_Generators. * libgnat/s-valuen.ads: New generic unit. * libgnat/s-valuen.adb: New body. * libgnat/s-vaen16.ads: New unit. * libgnat/s-vaen32.ads: Likewise. * libgnat/s-vaenu8.ads: Likewise. * libgnat/s-valenu.ads: Delete. * libgnat/s-valenu.adb: Likewise. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add s-pehage.o. (GNATBIND_OBJS): Remove s-imgenu.o.
Diffstat (limited to 'gcc/ada/debug.adb')
-rw-r--r--gcc/ada/debug.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index d557ed1..784c7e0 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -146,7 +146,7 @@ package body Debug is
-- d_e Ignore entry calls and requeue statements for elaboration
-- d_f Issue info messages related to GNATprove usage
-- d_g
- -- d_h
+ -- d_h Disable the use of (perfect) hash functions for enumeration Value
-- d_i Ignore activations and calls to instances for elaboration
-- d_j Read JSON files and populate Repinfo tables (opposite of -gnatRjs)
-- d_k
@@ -971,6 +971,9 @@ package body Debug is
-- beginners find them confusing. Set automatically by GNATprove when
-- switch --info is used.
+ -- d_h The compiler does not make use of (perfect) hash functions in the
+ -- implementation of the Value attribute for enumeration types.
+
-- d_i The compiler ignores calls and task activations when they target a
-- subprogram or task type defined in an external instance for both
-- the static and dynamic elaboration models.