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

View File

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

View File

@ -777,8 +777,13 @@ package body Sem_Cat is
Specification : Node_Id := Empty;
begin
Set_Is_Pure
(E, Is_Pure (Scop) and then Is_Library_Level_Entity (E));
-- Do not modify the purity of an internally generated entity if it has
-- 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 Ekind (E) in Subprogram_Kind then