aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-05-28 08:54:46 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-28 08:54:46 +0000
commitc84205cd4fb4122a092207542c55a92b62bcb314 (patch)
tree63bea3e1dd53cb59fd4e94dffc9f2757640da8ca /gcc
parenta98217beaa82d397893ea6f9eed30e74937427a2 (diff)
downloadgcc-c84205cd4fb4122a092207542c55a92b62bcb314.zip
gcc-c84205cd4fb4122a092207542c55a92b62bcb314.tar.gz
gcc-c84205cd4fb4122a092207542c55a92b62bcb314.tar.bz2
[Ada] Introduce a new Needs_Activation_Record entity flag
2018-05-28 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * einfo.ads, einfo.adb (Needs_Activation_Record): New flag on access-to-subprogram types, to indicate that an indirect call through such a type requires an activation record when compiling for LLVM. * sem_ch3.adb (Access_Subprogram_Declaration): Set new flag as needed. From-SVN: r260833
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/einfo.adb13
-rw-r--r--gcc/ada/einfo.ads11
-rw-r--r--gcc/ada/sem_ch3.adb10
4 files changed, 40 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index abcf424..5460ca4 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2018-05-28 Ed Schonberg <schonberg@adacore.com>
+ * einfo.ads, einfo.adb (Needs_Activation_Record): New flag on
+ access-to-subprogram types, to indicate that an indirect call through
+ such a type requires an activation record when compiling for LLVM.
+ * sem_ch3.adb (Access_Subprogram_Declaration): Set new flag as needed.
+
+2018-05-28 Ed Schonberg <schonberg@adacore.com>
+
* exp_ch4.adb (Real_Range_Check): Specialize float-to-fixed conversions
when bounds of fixed type are static, to remove some spuerfluous
implicit conversions and provide an accurate result when converting
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index cdfd44d..8ff9562 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -629,8 +629,8 @@ package body Einfo is
-- Suppress_Elaboration_Warnings Flag303
-- Is_Elaboration_Warnings_OK_Id Flag304
-- Is_Activation_Record Flag305
+ -- Needs_Activation_Record Flag306
- -- (unused) Flag306
-- (unused) Flag307
-- (unused) Flag308
-- (unused) Flag309
@@ -2870,6 +2870,11 @@ package body Einfo is
return Flag208 (Id);
end Must_Have_Preelab_Init;
+ function Needs_Activation_Record (Id : E) return B is
+ begin
+ return Flag306 (Id);
+ end Needs_Activation_Record;
+
function Needs_Debug_Info (Id : E) return B is
begin
return Flag147 (Id);
@@ -6108,6 +6113,11 @@ package body Einfo is
Set_Flag208 (Id, V);
end Set_Must_Have_Preelab_Init;
+ procedure Set_Needs_Activation_Record (Id : E; V : B := True) is
+ begin
+ Set_Flag306 (Id, V);
+ end Set_Needs_Activation_Record;
+
procedure Set_Needs_Debug_Info (Id : E; V : B := True) is
begin
Set_Flag147 (Id, V);
@@ -9915,6 +9925,7 @@ package body Einfo is
W ("May_Inherit_Delayed_Rep_Aspects", Flag262 (Id));
W ("Must_Be_On_Byte_Boundary", Flag183 (Id));
W ("Must_Have_Preelab_Init", Flag208 (Id));
+ W ("Needs_Activation_Record", Flag306 (Id));
W ("Needs_Debug_Info", Flag147 (Id));
W ("Needs_No_Actuals", Flag22 (Id));
W ("Never_Set_In_Source", Flag115 (Id));
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 17d6937..78504bb 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -3534,6 +3534,11 @@ package Einfo is
-- preelaborable initialization at freeze time (this has to be deferred
-- to the freeze point because of the rule about overriding Initialize).
+-- Needs_Activation_Record (Flag306)
+-- Defined on access_to_subprogram types. Indicates that a call through
+-- a named or anonymous access to subprogram requires an activation
+-- record when compiling with unnesting for C or LLVM.
+
-- Needs_Debug_Info (Flag147)
-- Defined in all entities. Set if the entity requires normal debugging
-- information to be generated. This is true of all entities that have
@@ -5814,6 +5819,7 @@ package Einfo is
-- Needs_No_Actuals (Flag22)
-- Original_Access_Type (Node28)
-- Can_Use_Internal_Rep (Flag229)
+ -- Needs_Activation_Record (Flag306)
-- (plus type attributes)
-- E_Access_Type
@@ -5846,6 +5852,7 @@ package Einfo is
-- Directly_Designated_Type (Node20)
-- Storage_Size_Variable (Node26) ??? is this needed ???
-- Can_Use_Internal_Rep (Flag229)
+ -- Needs_Activation_Record (Flag306)
-- (plus type attributes)
-- E_Anonymous_Access_Type
@@ -7405,6 +7412,7 @@ package Einfo is
function Modulus (Id : E) return U;
function Must_Be_On_Byte_Boundary (Id : E) return B;
function Must_Have_Preelab_Init (Id : E) return B;
+ function Needs_Activation_Record (Id : E) return B;
function Needs_Debug_Info (Id : E) return B;
function Needs_No_Actuals (Id : E) return B;
function Never_Set_In_Source (Id : E) return B;
@@ -8110,6 +8118,7 @@ package Einfo is
procedure Set_Modulus (Id : E; V : U);
procedure Set_Must_Be_On_Byte_Boundary (Id : E; V : B := True);
procedure Set_Must_Have_Preelab_Init (Id : E; V : B := True);
+ procedure Set_Needs_Activation_Record (Id : E; V : B := True);
procedure Set_Needs_Debug_Info (Id : E; V : B := True);
procedure Set_Needs_No_Actuals (Id : E; V : B := True);
procedure Set_Never_Set_In_Source (Id : E; V : B := True);
@@ -8980,6 +8989,7 @@ package Einfo is
pragma Inline (Modulus);
pragma Inline (Must_Be_On_Byte_Boundary);
pragma Inline (Must_Have_Preelab_Init);
+ pragma Inline (Needs_Activation_Record);
pragma Inline (Needs_Debug_Info);
pragma Inline (Needs_No_Actuals);
pragma Inline (Never_Set_In_Source);
@@ -9474,6 +9484,7 @@ package Einfo is
pragma Inline (Set_Modulus);
pragma Inline (Set_Must_Be_On_Byte_Boundary);
pragma Inline (Set_Must_Have_Preelab_Init);
+ pragma Inline (Set_Needs_Activation_Record);
pragma Inline (Set_Needs_Debug_Info);
pragma Inline (Set_Needs_No_Actuals);
pragma Inline (Set_Never_Set_In_Source);
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 8c5b26d..13162e0 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -1305,6 +1305,16 @@ package body Sem_Ch3 is
Init_Size_Align (T_Name);
Set_Directly_Designated_Type (T_Name, Desig_Type);
+ -- If the access_to_subprogram is not declared at the library level,
+ -- it can only point to subprograms that are at the same or deeper
+ -- accessibility level. All such might require an activation record
+ -- when compiling for C.
+
+ Set_Needs_Activation_Record (T_Name,
+ not Is_Library_Level_Entity (T_Name));
+ Set_Needs_Activation_Record (Desig_Type,
+ not Is_Library_Level_Entity (T_Name));
+
Generate_Reference_To_Formals (T_Name);
-- Ada 2005 (AI-231): Propagate the null-excluding attribute