* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178410
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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 --
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
-- 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);
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
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));
Expression => Expr));
end Process_Transient_Object;
+ -- Local variables
+
Decl : Node_Id;
-- Start of processing for Expand_N_Expression_With_Actions
-- 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))
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,
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
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;