@@ -1567,15 +1567,6 @@ package body Einfo.Utils is
Has_Option (Id, Name_Synchronous));
end Is_External_State;
- ------------------
- -- Is_Finalizer --
- ------------------
-
- function Is_Finalizer (Id : E) return B is
- begin
- return Ekind (Id) = E_Procedure and then Chars (Id) = Name_uFinalizer;
- end Is_Finalizer;
-
----------------------
-- Is_Full_Access --
----------------------
@@ -190,7 +190,6 @@ package Einfo.Utils is
function Is_Dynamic_Scope (Id : E) return B;
function Is_Elaboration_Target (Id : E) return B;
function Is_External_State (Id : E) return B;
- function Is_Finalizer (Id : E) return B with Inline;
function Is_Full_Access (Id : E) return B with Inline;
function Is_Null_State (Id : E) return B;
function Is_Package_Or_Generic_Package (Id : E) return B with Inline;
@@ -2647,7 +2647,7 @@ package Einfo is
-- the transient finalization mechanisms. The flag prevents the double
-- finalization of the object.
+-- Is_Finalizer
-- Applies to all entities, true for procedures containing finalization
-- code to process local or library level objects.
@@ -3532,6 +3532,7 @@ package body Exp_Ch3 is
DF_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Name_uFinalizer));
+ Set_Is_Finalizer (DF_Id);
Append_To (Decls, Make_Local_Deep_Finalize (Rec_Type, DF_Id));
@@ -1979,6 +1979,7 @@ package body Exp_Ch7 is
Fin_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Name_uFinalizer));
+ Set_Is_Finalizer (Fin_Id);
-- The visibility semantics of At_End handlers force a strange
-- separation of spec and body for stack-related finalizers:
@@ -14525,6 +14525,16 @@ package body Exp_Util is
return Target;
end Thunk_Target;
+ -----------------------
+ -- Try_Inline_Always --
+ -----------------------
+
+ function Try_Inline_Always (Subp : Entity_Id) return Boolean is
+ ((Is_Expression_Function (Subp) or else Is_Finalizer (Subp))
+ and then not Debug_Flag_Dot_8);
+ -- We want to inline expression functions and finalizers as much as
+ -- practical unless -gnatd.8.
+
-------------------
-- Type_Map_Hash --
-------------------
@@ -1260,6 +1260,11 @@ package Exp_Util is
-- WARNING: There is a matching C declaration of this subprogram in fe.h
+ function Try_Inline_Always (Subp : Entity_Id) return Boolean;
+ -- Determines if the backend should try hard to inline Subp. This is
+ -- similar to Subp having a pragma Inline_Always, but doesn't cause an
+ -- error if Subp can't actually be inlined.
+
function Type_May_Have_Bit_Aligned_Components
(Typ : Entity_Id) return Boolean;
-- Determines if Typ is a composite type that has within it (looking down
@@ -708,6 +708,7 @@ package Gen_IL.Fields is
Is_Exception_Handler,
Is_Exported,
Is_Finalized_Transient,
+ Is_Finalizer,
Is_First_Subtype,
Is_Fixed_Lower_Bound_Array_Subtype,
Is_Fixed_Lower_Bound_Index_Subtype,
@@ -146,6 +146,7 @@ begin -- Gen_IL.Gen.Gen_Entities
Sm (Is_Entry_Formal, Flag),
Sm (Is_Entry_Wrapper, Flag),
Sm (Is_Exported, Flag),
+ Sm (Is_Finalizer, Flag),
Sm (Is_First_Subtype, Flag),
Sm (Is_Formal_Subprogram, Flag),
Sm (Is_Frozen, Flag),
@@ -1778,11 +1778,6 @@ package body Sem_Elab is
-- Determine whether arbitrary entity Id denotes internally generated
-- routine Default_Initial_Condition.
- function Is_Finalizer_Proc (Id : Entity_Id) return Boolean;
- pragma Inline (Is_Finalizer_Proc);
- -- Determine whether arbitrary entity Id denotes internally generated
- -- routine _Finalizer.
-
function Is_Initial_Condition_Proc (Id : Entity_Id) return Boolean;
pragma Inline (Is_Initial_Condition_Proc);
-- Determine whether arbitrary entity Id denotes internally generated
@@ -2438,7 +2433,7 @@ package body Sem_Elab is
-- Calls to _Finalizer procedures must not appear in the output
-- because this creates confusing noise.
- elsif Is_Finalizer_Proc (Subp_Id) then
+ elsif Is_Finalizer (Subp_Id) then
null;
-- Initial_Condition
@@ -5338,7 +5333,7 @@ package body Sem_Elab is
return
(Is_Controlled_Procedure (Subp_Id, Name_Finalize)
- or else Is_Finalizer_Proc (Subp_Id)
+ or else Is_Finalizer (Subp_Id)
or else Is_TSS (Subp_Id, TSS_Deep_Finalize))
and then In_Initialization_Context (Call);
end Is_Partial_Finalization_Proc;
@@ -6607,7 +6602,7 @@ package body Sem_Elab is
-- Calls to _Finalizer procedures must not appear in the output
-- because this creates confusing noise.
- elsif Is_Finalizer_Proc (Subp_Id) then
+ elsif Is_Finalizer (Subp_Id) then
null;
-- Initial_Condition
@@ -13098,7 +13093,7 @@ package body Sem_Elab is
-- Controlled finalization actions
elsif Is_Controlled_Procedure (Targ_Id, Name_Finalize)
- or else Is_Finalizer_Proc (Targ_Id)
+ or else Is_Finalizer (Targ_Id)
then
Extra := First_Formal_Type (Targ_Id);
Kind := Controlled_Finalization;
@@ -14467,7 +14462,7 @@ package body Sem_Elab is
begin
return
Is_Accept_Alternative_Proc (Id)
- or else Is_Finalizer_Proc (Id)
+ or else Is_Finalizer (Id)
or else Is_Partial_Invariant_Proc (Id)
or else Is_TSS (Id, TSS_Deep_Adjust)
or else Is_TSS (Id, TSS_Deep_Finalize)
@@ -14488,17 +14483,6 @@ package body Sem_Elab is
return Ekind (Id) = E_Procedure and then Is_DIC_Procedure (Id);
end Is_Default_Initial_Condition_Proc;
- -----------------------
- -- Is_Finalizer_Proc --
- -----------------------
-
- function Is_Finalizer_Proc (Id : Entity_Id) return Boolean is
- begin
- -- To qualify, the entity must denote a _Finalizer procedure
-
- return Ekind (Id) = E_Procedure and then Chars (Id) = Name_uFinalizer;
- end Is_Finalizer_Proc;
-
-------------------------------
-- Is_Initial_Condition_Proc --
-------------------------------