* [Ada] Improve efficiency of aggregates with <>
@ 2019-08-20 9:51 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-08-20 9:51 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]
The generated code has been improved so that aggregates with <> are more
efficient. No change in behavior; no test.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-08-20 Bob Duff <duff@adacore.com>
gcc/ada/
* exp_aggr.adb (Expand_Array_Aggregate): Use build-in-place in
the nonlimited case in STEP 4. This improves the efficiency of
things like (1 .. 1000 => <>). We still generate some code for
that, unfortunately, but it is much improved.
(Aggr_Assignment_OK_For_Backend): Return false if <> components
are present.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 877 bytes --]
--- gcc/ada/exp_aggr.adb
+++ gcc/ada/exp_aggr.adb
@@ -5233,6 +5233,12 @@ package body Exp_Aggr is
Value : Uint;
begin
+ -- Back end doesn't know about <>
+
+ if Has_Default_Init_Comps (N) then
+ return False;
+ end if;
+
-- Recurse as far as possible to find the innermost component type
Ctyp := Etype (N);
@@ -6292,9 +6298,7 @@ package body Exp_Aggr is
-- previously excluded controlled components but this is an old
-- oversight: the rules in 7.6 (17) are clear.
- if (not Has_Default_Init_Comps (N)
- or else Is_Limited_Type (Etype (N)))
- and then Comes_From_Source (Parent_Node)
+ if Comes_From_Source (Parent_Node)
and then Parent_Kind = N_Object_Declaration
and then Present (Expression (Parent_Node))
and then not
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-20 9:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 9:51 [Ada] Improve efficiency of aggregates with <> Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).