This change lifts obsolete limitations for pragma Inline that have already been lifted for pragma Inline_Always, since they use the same machinery.
Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-31 Eric Botcazou <ebotca...@adacore.com> * inline.adb (Back_End_Cannot_Inline): Delete. (Add_Inlined_Subprogram): Do not call it.
Index: inline.adb =================================================================== --- inline.adb (revision 216925) +++ inline.adb (working copy) @@ -445,20 +445,6 @@ E : constant Entity_Id := Inlined.Table (Index).Name; Pack : constant Entity_Id := Get_Code_Unit_Entity (E); - function Back_End_Cannot_Inline (Subp : Entity_Id) return Boolean; - -- There are various conditions under which back-end inlining cannot - -- be done reliably: - -- - -- a) If a body has handlers, it must not be inlined, because this - -- may violate program semantics, and because in zero-cost exception - -- mode it will lead to undefined symbols at link time. - -- - -- b) If a body contains inlined function instances, it cannot be - -- inlined under ZCX because the numeric suffix generated by gigi - -- will be different in the body and the place of the inlined call. - -- - -- This procedure must be carefully coordinated with the back end. - procedure Register_Backend_Inlined_Subprogram (Subp : Entity_Id); -- Append Subp to the list of subprograms inlined by the backend @@ -466,52 +452,6 @@ -- Append Subp to the list of subprograms that cannot be inlined by -- the backend. - ---------------------------- - -- Back_End_Cannot_Inline -- - ---------------------------- - - function Back_End_Cannot_Inline (Subp : Entity_Id) return Boolean is - Decl : constant Node_Id := Unit_Declaration_Node (Subp); - Body_Ent : Entity_Id; - Ent : Entity_Id; - - begin - if Nkind (Decl) = N_Subprogram_Declaration - and then Present (Corresponding_Body (Decl)) - then - Body_Ent := Corresponding_Body (Decl); - else - return False; - end if; - - -- If subprogram is marked Inline_Always, inlining is mandatory - - if Has_Pragma_Inline_Always (Subp) then - return False; - end if; - - if Present - (Exception_Handlers - (Handled_Statement_Sequence - (Unit_Declaration_Node (Corresponding_Body (Decl))))) - then - return True; - end if; - - Ent := First_Entity (Body_Ent); - while Present (Ent) loop - if Is_Subprogram (Ent) - and then Is_Generic_Instance (Ent) - then - return True; - end if; - - Next_Entity (Ent); - end loop; - - return False; - end Back_End_Cannot_Inline; - ----------------------------------------- -- Register_Backend_Inlined_Subprogram -- ----------------------------------------- @@ -547,21 +487,15 @@ and then not Is_Nested (E) and then not Has_Initialized_Type (E) then - if Back_End_Cannot_Inline (E) then - Set_Is_Inlined (E, False); - Register_Backend_Not_Inlined_Subprogram (E); + Register_Backend_Inlined_Subprogram (E); + if No (Last_Inlined) then + Set_First_Inlined_Subprogram (Cunit (Main_Unit), E); else - Register_Backend_Inlined_Subprogram (E); - - if No (Last_Inlined) then - Set_First_Inlined_Subprogram (Cunit (Main_Unit), E); - else - Set_Next_Inlined_Subprogram (Last_Inlined, E); - end if; - - Last_Inlined := E; + Set_Next_Inlined_Subprogram (Last_Inlined, E); end if; + + Last_Inlined := E; else Register_Backend_Not_Inlined_Subprogram (E); end if;