]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Improve speed of discriminated return types
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:50:19 +0000 (09:50 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:50:19 +0000 (09:50 +0000)
commit80012fc8a20049e0a609b5c2d4be3c4cfa38d92d
treecd0ad2fd4b60b699963083199c6eae5157111a3c
parent7a5b8c31b1b394c066ea86f6ad6f15b4c2697b7f
[Ada] Improve speed of discriminated return types

The compiler now generates faster code for functions that return
discriminated types in many cases where the size is known at compile
time.

2019-08-20  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_ch6.adb (Needs_BIP_Alloc_Form): Call
Requires_Transient_Scope rather than checking constrainedness
and so forth.  We have previously improved
Requires_Transient_Scope to return False in various cases,
notably a limited record with an access discriminant. This
change takes advantage of that to avoid using the secondary
stack for functions returning such types.
(Make_Build_In_Place_Call_In_Allocator): Be consistent by
calling Needs_BIP_Alloc_Form rather than Is_Constrained and so
forth.
* sem_ch4.adb (Analyze_Allocator): The above change causes the
compiler to generate code that is not legal Ada, in particular
an uninitialized allocator for indefinite subtype.  This is
harmless, so we suppress the error message in this case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274738 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/ada/sem_ch4.adb