exp_ch3.adb (Expand_Freeze_Enumeration_Type): Mark the representation-to-position function as inlined.

2017-01-19  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Mark the
	representation-to-position function as inlined.
	* sem_cat.adb (Set_Categorization_From_Scope): Do not modify
	the purity of an internally generated entity if it has been
	explicitly marked as pure for optimization purposes.
	* exp_aggr.adb: Minor reformatting.

From-SVN: r244624
This commit is contained in:
Hristian Kirtchev 2017-01-19 12:01:01 +00:00 committed by Arnaud Charlet
parent ed20a004e1
commit 138fc6f10f
4 changed files with 32 additions and 16 deletions

View File

@ -1,3 +1,12 @@
2017-01-19 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Mark the
representation-to-position function as inlined.
* sem_cat.adb (Set_Categorization_From_Scope): Do not modify
the purity of an internally generated entity if it has been
explicitly marked as pure for optimization purposes.
* exp_aggr.adb: Minor reformatting.
2017-01-19 Javier Miranda <miranda@adacore.com> 2017-01-19 Javier Miranda <miranda@adacore.com>
* exp_ch6.adb (Expand_Call): Remove side effects on * exp_ch6.adb (Expand_Call): Remove side effects on

View File

@ -6756,9 +6756,9 @@ package body Exp_Aggr is
elsif Is_Derived_Type (Typ) then elsif Is_Derived_Type (Typ) then
-- For untagged types, non-stored discriminants are replaced -- For untagged types, non-stored discriminants are replaced with
-- with stored discriminants, which are the ones that gigi uses -- stored discriminants, which are the ones that gigi uses to
-- to describe the type and its components. -- describe the type and its components.
Generate_Aggregate_For_Derived_Type : declare Generate_Aggregate_For_Derived_Type : declare
Constraints : constant List_Id := New_List; Constraints : constant List_Id := New_List;
@ -6782,9 +6782,8 @@ package body Exp_Aggr is
while Present (Discriminant) loop while Present (Discriminant) loop
New_Comp := New_Comp :=
Make_Component_Association (Loc, Make_Component_Association (Loc,
Choices => Choices => New_List (
New_List (New_Occurrence_Of (Discriminant, Loc)), New_Occurrence_Of (Discriminant, Loc)),
Expression => Expression =>
New_Copy_Tree New_Copy_Tree
(Get_Discriminant_Value (Get_Discriminant_Value
@ -6853,6 +6852,7 @@ package body Exp_Aggr is
(Discriminant, (Discriminant,
Typ, Typ,
Discriminant_Constraint (Typ))); Discriminant_Constraint (Typ)));
Append (New_Comp, Constraints); Append (New_Comp, Constraints);
Next_Stored_Discriminant (Discriminant); Next_Stored_Discriminant (Discriminant);
end loop; end loop;
@ -6949,7 +6949,6 @@ package body Exp_Aggr is
-- all the inherited components. -- all the inherited components.
if Is_Derived_Type (Typ) then if Is_Derived_Type (Typ) then
declare declare
First_Comp : Node_Id; First_Comp : Node_Id;
Parent_Comps : List_Id; Parent_Comps : List_Id;
@ -7014,10 +7013,11 @@ package body Exp_Aggr is
elsif Tagged_Type_Expansion then elsif Tagged_Type_Expansion then
declare declare
Tag_Name : constant Node_Id := Tag_Name : constant Node_Id :=
New_Occurrence_Of (First_Tag_Component (Typ), Loc); New_Occurrence_Of
(First_Tag_Component (Typ), Loc);
Typ_Tag : constant Entity_Id := RTE (RE_Tag); Typ_Tag : constant Entity_Id := RTE (RE_Tag);
Conv_Node : constant Node_Id := Conv_Node : constant Node_Id :=
Unchecked_Convert_To (Typ_Tag, Tag_Value); Unchecked_Convert_To (Typ_Tag, Tag_Value);
begin begin
Set_Etype (Conv_Node, Typ_Tag); Set_Etype (Conv_Node, Typ_Tag);
@ -7040,8 +7040,8 @@ package body Exp_Aggr is
begin begin
Aggr := N; Aggr := N;
while Present (Parent (Aggr)) while Present (Parent (Aggr))
and then Nkind_In (Parent (Aggr), N_Component_Association, and then Nkind_In (Parent (Aggr), N_Aggregate,
N_Aggregate) N_Component_Association)
loop loop
Aggr := Parent (Aggr); Aggr := Parent (Aggr);
end loop; end loop;
@ -7081,8 +7081,8 @@ package body Exp_Aggr is
-- aggregates for C++ imported types must be expanded. -- aggregates for C++ imported types must be expanded.
if Ada_Version >= Ada_2005 and then Is_Limited_View (Typ) then if Ada_Version >= Ada_2005 and then Is_Limited_View (Typ) then
if not Nkind_In (Parent (N), N_Object_Declaration, if not Nkind_In (Parent (N), N_Component_Association,
N_Component_Association) N_Object_Declaration)
then then
Convert_To_Assignments (N, Typ); Convert_To_Assignments (N, Typ);

View File

@ -4590,7 +4590,7 @@ package body Exp_Ch3 is
Discrete_Subtype_Definitions => New_List ( Discrete_Subtype_Definitions => New_List (
Make_Subtype_Indication (Loc, Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (Standard_Natural, Loc), Subtype_Mark => New_Occurrence_Of (Standard_Natural, Loc),
Constraint => Constraint =>
Make_Range_Constraint (Loc, Make_Range_Constraint (Loc,
Range_Expression => Range_Expression =>
Make_Range (Loc, Make_Range (Loc,
@ -4810,6 +4810,8 @@ package body Exp_Ch3 is
Set_Debug_Info_Off (Fent); Set_Debug_Info_Off (Fent);
end if; end if;
Set_Is_Inlined (Fent);
exception exception
when RE_Not_Available => when RE_Not_Available =>
return; return;

View File

@ -777,8 +777,13 @@ package body Sem_Cat is
Specification : Node_Id := Empty; Specification : Node_Id := Empty;
begin begin
Set_Is_Pure -- Do not modify the purity of an internally generated entity if it has
(E, Is_Pure (Scop) and then Is_Library_Level_Entity (E)); -- been explicitly marked as pure for optimization purposes.
if not Has_Pragma_Pure_Function (E) then
Set_Is_Pure
(E, Is_Pure (Scop) and then Is_Library_Level_Entity (E));
end if;
if not Is_Remote_Call_Interface (E) then if not Is_Remote_Call_Interface (E) then
if Ekind (E) in Subprogram_Kind then if Ekind (E) in Subprogram_Kind then