[Ada] Performance degradation with references
authorHristian Kirtchev <kirtchev@adacore.com>
Mon, 11 Jun 2018 09:16:54 +0000 (09:16 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 11 Jun 2018 09:16:54 +0000 (09:16 +0000)
commit692918a9c1e601ecf81f99eb4926268964f62181
treeaf872ce2ce742199a99bca8764dcc9621416aae8
parent51b84f99dca6308f581da724faf7f4646d991f1a
[Ada] Performance degradation with references

This patch modifies the creation of markers for variable references in the
context of SPARK elaboration checks. Previously, prior to checking whether a
reference requires such a marker, the compiler performed a logarithmic look up
to determine whether the reference appears within a call. This action caused
the compiler to degrade when a source program contains multiple (100,000s)
references. Now, the compiler no longer performs the look up immediately.

2018-06-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_ch8.adb (Find_Direct_Name): Mode the declaration of
Is_Assignment_LHS further in. Use predicate
Needs_Variable_Reference_Marker to determine whether to create a
variable marker.
(Find_Expanded_Name): Mode the declaration of Is_Assignment_LHS further
in.  Use predicate Needs_Variable_Reference_Marker to determine whether
to create a variable marker.
* sem_elab.adb (Build_Variable_Reference_Marker): Remove the various
checks that determine whether the identifier or expanded name is a
suitable variable reference.  The checks are now performed by
Needs_Variable_Reference_Marker.
* sem_res.adb (Resolve_Actuals): Use predicate
Needs_Variable_Reference_Marker to determine whether to create a
variable marker.
* sem_util.adb (Needs_Variable_Reference_Marker): New routine.
* sem_util.ads (Needs_Variable_Reference_Marker): New routine.

From-SVN: r261400
gcc/ada/ChangeLog
gcc/ada/sem_ch8.adb
gcc/ada/sem_elab.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads