Commit f9622ab1 by Arnaud Charlet

exp_atag.adb (Build_Inherit_Prims): Addition of a new formal.

	* exp_atag.adb (Build_Inherit_Prims): Addition of a new formal.
	(Build_Inherit_Predefined_Prims): Replace occurrences of Default_
	Prim_Op_Count by Max_Predef_Prims.

From-SVN: r127468
parent 33c423c8
...@@ -30,6 +30,7 @@ with Exp_Util; use Exp_Util; ...@@ -30,6 +30,7 @@ with Exp_Util; use Exp_Util;
with Nlists; use Nlists; with Nlists; use Nlists;
with Nmake; use Nmake; with Nmake; use Nmake;
with Rtsfind; use Rtsfind; with Rtsfind; use Rtsfind;
with Sem_Util; use Sem_Util;
with Stand; use Stand; with Stand; use Stand;
with Snames; use Snames; with Snames; use Snames;
with Tbuild; use Tbuild; with Tbuild; use Tbuild;
...@@ -139,7 +140,7 @@ package body Exp_Atag is ...@@ -139,7 +140,7 @@ package body Exp_Atag is
Make_Assignment_Statement (Loc, Make_Assignment_Statement (Loc,
Name => Make_Identifier (Loc, Name_uF), Name => Make_Identifier (Loc, Name_uF),
Expression => New_Reference_To (Standard_True, Loc)), Expression => New_Reference_To (Standard_True, Loc)),
Make_Return_Statement (Loc)))); Make_Simple_Return_Statement (Loc))));
end Build_Common_Dispatching_Select_Statements; end Build_Common_Dispatching_Select_Statements;
------------------------- -------------------------
...@@ -253,11 +254,13 @@ package body Exp_Atag is ...@@ -253,11 +254,13 @@ package body Exp_Atag is
function Build_Inherit_Prims function Build_Inherit_Prims
(Loc : Source_Ptr; (Loc : Source_Ptr;
Typ : Entity_Id;
Old_Tag_Node : Node_Id; Old_Tag_Node : Node_Id;
New_Tag_Node : Node_Id; New_Tag_Node : Node_Id;
Num_Prims : Nat) return Node_Id Num_Prims : Nat) return Node_Id
is is
begin begin
if RTE_Available (RE_DT) then
return return
Make_Assignment_Statement (Loc, Make_Assignment_Statement (Loc,
Name => Name =>
...@@ -287,6 +290,31 @@ package body Exp_Atag is ...@@ -287,6 +290,31 @@ package body Exp_Atag is
Make_Range (Loc, Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1), Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => Make_Integer_Literal (Loc, Num_Prims)))); High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
else
return
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix =>
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
New_Tag_Node),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => Make_Integer_Literal (Loc, Num_Prims))),
Expression =>
Make_Slice (Loc,
Prefix =>
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
Old_Tag_Node),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
end if;
end Build_Inherit_Prims; end Build_Inherit_Prims;
------------------------------- -------------------------------
...@@ -342,6 +370,7 @@ package body Exp_Atag is ...@@ -342,6 +370,7 @@ package body Exp_Atag is
New_Tag_Node : Node_Id) return Node_Id New_Tag_Node : Node_Id) return Node_Id
is is
begin begin
if RTE_Available (RE_DT) then
return return
Make_Assignment_Statement (Loc, Make_Assignment_Statement (Loc,
Name => Name =>
...@@ -357,7 +386,7 @@ package body Exp_Atag is ...@@ -357,7 +386,7 @@ package body Exp_Atag is
(RTE_Record_Component (RE_Predef_Prims), Loc)))), (RTE_Record_Component (RE_Predef_Prims), Loc)))),
Discrete_Range => Make_Range (Loc, Discrete_Range => Make_Range (Loc,
Make_Integer_Literal (Loc, Uint_1), Make_Integer_Literal (Loc, Uint_1),
New_Reference_To (RTE (RE_Default_Prim_Op_Count), Loc))), New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))),
Expression => Expression =>
Make_Slice (Loc, Make_Slice (Loc,
...@@ -370,11 +399,35 @@ package body Exp_Atag is ...@@ -370,11 +399,35 @@ package body Exp_Atag is
Selector_Name => Selector_Name =>
New_Reference_To New_Reference_To
(RTE_Record_Component (RE_Predef_Prims), Loc)))), (RTE_Record_Component (RE_Predef_Prims), Loc)))),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound =>
New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))));
else
return
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_Predef_Prims (Loc, New_Tag_Node)),
Discrete_Range => Make_Range (Loc,
Make_Integer_Literal (Loc, Uint_1),
New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))),
Expression =>
Make_Slice (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_Predef_Prims (Loc, Old_Tag_Node)),
Discrete_Range => Discrete_Range =>
Make_Range (Loc, Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1), Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => High_Bound =>
New_Reference_To (RTE (RE_Default_Prim_Op_Count), Loc)))); New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))));
end if;
end Build_Inherit_Predefined_Prims; end Build_Inherit_Predefined_Prims;
------------------------ ------------------------
......
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