public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] Be prepared for more aggregates in gigi
@ 2020-08-22 21:10 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:10 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4f9d210edce8282224941498a11d9aa6fb764fca
commit 4f9d210edce8282224941498a11d9aa6fb764fca
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date: Tue May 12 22:34:50 2020 +0200
Be prepared for more aggregates in gigi
This makes sure that gigi is prepared to handle more aggregates in the
special memset code path.
* sem_aggr.ads (Is_Single_Aggregate): New function.
* sem_aggr.adb (Is_Others_Aggregate): Use local variable.
(Is_Single_Aggregate): New function to recognize an aggregate with
a single association containing a single choice.
* fe.h (Is_Others_Aggregate): Delete.
(Is_Single_Aggregate): New declaration.
* gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Call
Is_Single_Aggregate instead of Is_Others_Aggregate.
Diff:
---
gcc/ada/ChangeLog | 11 +++++++++++
gcc/ada/fe.h | 4 ++--
gcc/ada/gcc-interface/trans.c | 4 ++--
gcc/ada/sem_aggr.adb | 19 ++++++++++++++++---
gcc/ada/sem_aggr.ads | 3 +++
5 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3502eb83d5e..0068265649b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2020-05-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_aggr.ads (Is_Single_Aggregate): New function.
+ * sem_aggr.adb (Is_Others_Aggregate): Use local variable.
+ (Is_Single_Aggregate): New function to recognize an aggregate with
+ a single association containing a single choice.
+ * fe.h (Is_Others_Aggregate): Delete.
+ (Is_Single_Aggregate): New declaration.
+ * gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Call
+ Is_Single_Aggregate instead of Is_Others_Aggregate.
+
2020-05-12 Eric Botcazou <ebotcazou@adacore.com>
PR ada/95035
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index 6b3f300301c..99613282213 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -253,9 +253,9 @@ extern Boolean No_Exception_Handlers_Set (void);
/* sem_aggr: */
-#define Is_Others_Aggregate sem_aggr__is_others_aggregate
+#define Is_Single_Aggregate sem_aggr__is_single_aggregate
-extern Boolean Is_Others_Aggregate (Node_Id);
+extern Boolean Is_Single_Aggregate (Node_Id);
/* sem_aux: */
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index cddeae3081a..b7a4cadb7e6 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -7887,7 +7887,7 @@ gnat_to_gnu (Node_Id gnat_node)
const bool use_memset_p
= regular_array_type_p
&& Nkind (gnat_inner) == N_Aggregate
- && Is_Others_Aggregate (gnat_inner);
+ && Is_Single_Aggregate (gnat_inner);
/* If we use memset, we need to find the innermost expression. */
if (use_memset_p)
@@ -7897,7 +7897,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnat_temp
= Expression (First (Component_Associations (gnat_temp)));
} while (Nkind (gnat_temp) == N_Aggregate
- && Is_Others_Aggregate (gnat_temp));
+ && Is_Single_Aggregate (gnat_temp));
gnu_rhs = gnat_to_gnu (gnat_temp);
}
else
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index e41fcdb6cc0..5a26cf9c7fd 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -832,13 +832,26 @@ package body Sem_Aggr is
-------------------------
function Is_Others_Aggregate (Aggr : Node_Id) return Boolean is
+ Assoc : constant List_Id := Component_Associations (Aggr);
+
begin
return No (Expressions (Aggr))
- and then
- Nkind (First (Choice_List (First (Component_Associations (Aggr))))) =
- N_Others_Choice;
+ and then Nkind (First (Choice_List (First (Assoc)))) = N_Others_Choice;
end Is_Others_Aggregate;
+ -------------------------
+ -- Is_Single_Aggregate --
+ -------------------------
+
+ function Is_Single_Aggregate (Aggr : Node_Id) return Boolean is
+ Assoc : constant List_Id := Component_Associations (Aggr);
+
+ begin
+ return No (Expressions (Aggr))
+ and then No (Next (First (Assoc)))
+ and then No (Next (First (Choice_List (First (Assoc)))));
+ end Is_Single_Aggregate;
+
----------------------------
-- Is_Top_Level_Aggregate --
----------------------------
diff --git a/gcc/ada/sem_aggr.ads b/gcc/ada/sem_aggr.ads
index 1d4f3489d78..13519a25742 100644
--- a/gcc/ada/sem_aggr.ads
+++ b/gcc/ada/sem_aggr.ads
@@ -37,6 +37,9 @@ package Sem_Aggr is
function Is_Others_Aggregate (Aggr : Node_Id) return Boolean;
-- Returns True is aggregate Aggr consists of a single OTHERS choice
+ function Is_Single_Aggregate (Aggr : Node_Id) return Boolean;
+ -- Returns True is aggregate Aggr consists of a single choice
+
-- WARNING: There is a matching C declaration of this subprogram in fe.h
end Sem_Aggr;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 21:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:10 [gcc/devel/autopar_devel] Be prepared for more aggregates in gigi Giuliano Belinassi
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).