Commit db15225a by Arnaud Charlet

[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
parent 9d641fc0
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> 2011-09-01 Thomas Quinot <quinot@adacore.com>
* sem_aux.adb, exp_ch4.adb: Minor reformatting * sem_aux.adb, exp_ch4.adb: Minor reformatting
......
...@@ -4417,11 +4417,11 @@ package body Exp_Ch4 is ...@@ -4417,11 +4417,11 @@ package body Exp_Ch4 is
procedure Process_Transient_Object (Decl : Node_Id) is procedure Process_Transient_Object (Decl : Node_Id) is
function Find_Insertion_Node return Node_Id; function Find_Insertion_Node return Node_Id;
-- Complex if statements may be converted into nested EWAs. In this -- Complex conditions in if statements may be converted into nested
-- case, any generated code must be inserted before the if statement -- EWAs. In this case, any generated code must be inserted before the
-- to ensure proper visibility of the "hook" objects. This routine -- if statement to ensure proper visibility of the hook objects. This
-- returns the top most short circuit operator or the parent of the -- routine returns the top most short circuit operator or the parent
-- EWA if no nesting was detected. -- of the EWA if no nesting was detected.
------------------------- -------------------------
-- Find_Insertion_Node -- -- Find_Insertion_Node --
...@@ -4431,7 +4431,7 @@ package body Exp_Ch4 is ...@@ -4431,7 +4431,7 @@ package body Exp_Ch4 is
Par : Node_Id; Par : Node_Id;
begin begin
-- Climb up the branches of a complex if statement -- Climb up the branches of a complex condition
Par := N; Par := N;
while Nkind_In (Parent (Par), N_And_Then, N_Op_Not, N_Or_Else) loop while Nkind_In (Parent (Par), N_And_Then, N_Op_Not, N_Or_Else) loop
...@@ -4443,7 +4443,7 @@ package body Exp_Ch4 is ...@@ -4443,7 +4443,7 @@ package body Exp_Ch4 is
-- Local variables -- Local variables
Ins_Nod : constant Node_Id := Find_Insertion_Node; Ins_Node : constant Node_Id := Find_Insertion_Node;
Loc : constant Source_Ptr := Sloc (Decl); Loc : constant Source_Ptr := Sloc (Decl);
Obj_Id : constant Entity_Id := Defining_Identifier (Decl); Obj_Id : constant Entity_Id := Defining_Identifier (Decl);
Obj_Typ : constant Entity_Id := Etype (Obj_Id); Obj_Typ : constant Entity_Id := Etype (Obj_Id);
...@@ -4480,7 +4480,7 @@ package body Exp_Ch4 is ...@@ -4480,7 +4480,7 @@ package body Exp_Ch4 is
Ekind (Obj_Typ) = E_General_Access_Type, Ekind (Obj_Typ) = E_General_Access_Type,
Subtype_Indication => New_Reference_To (Desig_Typ, Loc))); Subtype_Indication => New_Reference_To (Desig_Typ, Loc)));
Insert_Action (Ins_Nod, Ptr_Decl); Insert_Action (Ins_Node, Ptr_Decl);
Analyze (Ptr_Decl); Analyze (Ptr_Decl);
-- Step 2: Create a temporary which acts as a hook to the transient -- Step 2: Create a temporary which acts as a hook to the transient
...@@ -4495,16 +4495,16 @@ package body Exp_Ch4 is ...@@ -4495,16 +4495,16 @@ package body Exp_Ch4 is
Defining_Identifier => Temp_Id, Defining_Identifier => Temp_Id,
Object_Definition => New_Reference_To (Ptr_Id, Loc)); Object_Definition => New_Reference_To (Ptr_Id, Loc));
Insert_Action (Ins_Nod, Temp_Decl); Insert_Action (Ins_Node, Temp_Decl);
Analyze (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 -- transient declaration out of the Actions list. This signals the
-- machinery in Build_Finalizer to recognize this special case. -- machinery in Build_Finalizer to recognize this special case.
Set_Return_Flag_Or_Transient_Decl (Temp_Id, Decl); 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 if Is_Access_Type (Obj_Typ) then
Expr := Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc)); Expr := Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc));
...@@ -4526,6 +4526,8 @@ package body Exp_Ch4 is ...@@ -4526,6 +4526,8 @@ package body Exp_Ch4 is
Expression => Expr)); Expression => Expr));
end Process_Transient_Object; end Process_Transient_Object;
-- Local variables
Decl : Node_Id; Decl : Node_Id;
-- Start of processing for Expand_N_Expression_With_Actions -- Start of processing for Expand_N_Expression_With_Actions
......
...@@ -4186,8 +4186,6 @@ package body Exp_Ch6 is ...@@ -4186,8 +4186,6 @@ package body Exp_Ch6 is
-- code will have the same semantics. -- code will have the same semantics.
if Ekind (F) = E_In_Parameter 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_By_Reference_Type (Etype (A))
and then and then
(not Is_Array_Type (Etype (A)) (not Is_Array_Type (Etype (A))
...@@ -4197,9 +4195,10 @@ package body Exp_Ch6 is ...@@ -4197,9 +4195,10 @@ package body Exp_Ch6 is
Decl := Decl :=
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Temp, Defining_Identifier => Temp,
Constant_Present => True, Constant_Present => True,
Object_Definition => New_Occurrence_Of (Temp_Typ, Loc), Object_Definition => New_Occurrence_Of (Temp_Typ, Loc),
Expression => New_A); Expression => New_A);
else else
Decl := Decl :=
Make_Object_Renaming_Declaration (Loc, Make_Object_Renaming_Declaration (Loc,
...@@ -4217,10 +4216,10 @@ package body Exp_Ch6 is ...@@ -4217,10 +4216,10 @@ package body Exp_Ch6 is
end loop; end loop;
-- Establish target of function call. If context is not assignment or -- Establish target of function call. If context is not assignment or
-- declaration, create a temporary as a target. The declaration for -- declaration, create a temporary as a target. The declaration for the
-- the temporary may be subsequently optimized away if the body is a -- temporary may be subsequently optimized away if the body is a single
-- single expression, or if the left-hand side of the assignment is -- expression, or if the left-hand side of the assignment is simple
-- simple enough, i.e. an entity or an explicit dereference of one. -- enough, i.e. an entity or an explicit dereference of one.
if Ekind (Subp) = E_Function then if Ekind (Subp) = E_Function then
if Nkind (Parent (N)) = N_Assignment_Statement if Nkind (Parent (N)) = N_Assignment_Statement
......
...@@ -341,10 +341,12 @@ package body Inline is ...@@ -341,10 +341,12 @@ package body Inline is
if Is_Generic_Instance (Pack) then if Is_Generic_Instance (Pack) then
null; 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) elsif not Is_Inlined (Pack)
and then and then not Is_Init_Proc (E)
(not Has_Completion (E)
or else Is_Expression_Function (E))
then then
Set_Is_Inlined (Pack); Set_Is_Inlined (Pack);
Inlined_Bodies.Increment_Last; Inlined_Bodies.Increment_Last;
......
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