Commit c84205cd by Ed Schonberg Committed by Pierre-Marie de Rodat

[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
parent a98217be
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
......
......@@ -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));
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment