[multiple changes]

2011-09-01  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb: Minor code and comment reformatting.

2011-09-01  Thomas Quinot  <quinot@adacore.com>

	* exp_ch6.adb (Expand_Inlined_Call): Remove redundant tests
	for Is_Limited_Type and Is_Tagged_Type in condition checking
	for by-reference type.
	* inline.adb (Add_Inlined_Body): Only exclude init_procs. Other
	subprograms may have a completion because of a previous
	Inline_Always clause, but the enclosing package must be marked
	inlined for the subprogram body to become visible to the backend.

From-SVN: r178410
This commit is contained in:
Arnaud Charlet 2011-09-01 15:14:44 +02:00
parent 9d641fc0bb
commit db15225a8e
4 changed files with 40 additions and 23 deletions

View File

@ -1,3 +1,17 @@
2011-09-01 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb: Minor code and comment reformatting.
2011-09-01 Thomas Quinot <quinot@adacore.com>
* exp_ch6.adb (Expand_Inlined_Call): Remove redundant tests
for Is_Limited_Type and Is_Tagged_Type in condition checking
for by-reference type.
* inline.adb (Add_Inlined_Body): Only exclude init_procs. Other
subprograms may have a completion because of a previous
Inline_Always clause, but the enclosing package must be marked
inlined for the subprogram body to become visible to the backend.
2011-09-01 Thomas Quinot <quinot@adacore.com>
* sem_aux.adb, exp_ch4.adb: Minor reformatting

View File

@ -4417,11 +4417,11 @@ package body Exp_Ch4 is
procedure Process_Transient_Object (Decl : Node_Id) is
function Find_Insertion_Node return Node_Id;
-- Complex if statements may be converted into nested EWAs. In this
-- case, any generated code must be inserted before the if statement
-- to ensure proper visibility of the "hook" objects. This routine
-- returns the top most short circuit operator or the parent of the
-- EWA if no nesting was detected.
-- Complex conditions in if statements may be converted into nested
-- EWAs. In this case, any generated code must be inserted before the
-- if statement to ensure proper visibility of the hook objects. This
-- routine returns the top most short circuit operator or the parent
-- of the EWA if no nesting was detected.
-------------------------
-- Find_Insertion_Node --
@ -4431,7 +4431,7 @@ package body Exp_Ch4 is
Par : Node_Id;
begin
-- Climb up the branches of a complex if statement
-- Climb up the branches of a complex condition
Par := N;
while Nkind_In (Parent (Par), N_And_Then, N_Op_Not, N_Or_Else) loop
@ -4443,7 +4443,7 @@ package body Exp_Ch4 is
-- Local variables
Ins_Nod : constant Node_Id := Find_Insertion_Node;
Ins_Node : constant Node_Id := Find_Insertion_Node;
Loc : constant Source_Ptr := Sloc (Decl);
Obj_Id : constant Entity_Id := Defining_Identifier (Decl);
Obj_Typ : constant Entity_Id := Etype (Obj_Id);
@ -4480,7 +4480,7 @@ package body Exp_Ch4 is
Ekind (Obj_Typ) = E_General_Access_Type,
Subtype_Indication => New_Reference_To (Desig_Typ, Loc)));
Insert_Action (Ins_Nod, Ptr_Decl);
Insert_Action (Ins_Node, Ptr_Decl);
Analyze (Ptr_Decl);
-- Step 2: Create a temporary which acts as a hook to the transient
@ -4495,16 +4495,16 @@ package body Exp_Ch4 is
Defining_Identifier => Temp_Id,
Object_Definition => New_Reference_To (Ptr_Id, Loc));
Insert_Action (Ins_Nod, Temp_Decl);
Insert_Action (Ins_Node, Temp_Decl);
Analyze (Temp_Decl);
-- Mark this temporary as created for the purposes of "exporting" the
-- Mark this temporary as created for the purposes of exporting the
-- transient declaration out of the Actions list. This signals the
-- machinery in Build_Finalizer to recognize this special case.
Set_Return_Flag_Or_Transient_Decl (Temp_Id, Decl);
-- Step 3: "Hook" the transient object to the temporary
-- Step 3: Hook the transient object to the temporary
if Is_Access_Type (Obj_Typ) then
Expr := Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc));
@ -4526,6 +4526,8 @@ package body Exp_Ch4 is
Expression => Expr));
end Process_Transient_Object;
-- Local variables
Decl : Node_Id;
-- Start of processing for Expand_N_Expression_With_Actions

View File

@ -4186,8 +4186,6 @@ package body Exp_Ch6 is
-- code will have the same semantics.
if Ekind (F) = E_In_Parameter
and then not Is_Limited_Type (Etype (A))
and then not Is_Tagged_Type (Etype (A))
and then not Is_By_Reference_Type (Etype (A))
and then
(not Is_Array_Type (Etype (A))
@ -4197,9 +4195,10 @@ package body Exp_Ch6 is
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (Temp_Typ, Loc),
Expression => New_A);
Constant_Present => True,
Object_Definition => New_Occurrence_Of (Temp_Typ, Loc),
Expression => New_A);
else
Decl :=
Make_Object_Renaming_Declaration (Loc,
@ -4217,10 +4216,10 @@ package body Exp_Ch6 is
end loop;
-- Establish target of function call. If context is not assignment or
-- declaration, create a temporary as a target. The declaration for
-- the temporary may be subsequently optimized away if the body is a
-- single expression, or if the left-hand side of the assignment is
-- simple enough, i.e. an entity or an explicit dereference of one.
-- declaration, create a temporary as a target. The declaration for the
-- temporary may be subsequently optimized away if the body is a single
-- expression, or if the left-hand side of the assignment is simple
-- enough, i.e. an entity or an explicit dereference of one.
if Ekind (Subp) = E_Function then
if Nkind (Parent (N)) = N_Assignment_Statement

View File

@ -341,10 +341,12 @@ package body Inline is
if Is_Generic_Instance (Pack) then
null;
-- Do not inline the package if the subprogram is an init. proc
-- because in that case the body appears in the same unit that
-- declares the type, which will be compiled in any case.
elsif not Is_Inlined (Pack)
and then
(not Has_Completion (E)
or else Is_Expression_Function (E))
and then not Is_Init_Proc (E)
then
Set_Is_Inlined (Pack);
Inlined_Bodies.Increment_Last;