* exp_atag.adb (Build_Inherit_Prims): Addition of a new formal.
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 08:55:26 +0000 (08:55 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 08:55:26 +0000 (08:55 +0000)
(Build_Inherit_Predefined_Prims): Replace occurrences of Default_
Prim_Op_Count by Max_Predef_Prims.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127468 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/exp_atag.adb

index 54bf33f..a2c0ee9 100644 (file)
@@ -30,6 +30,7 @@ with Exp_Util; use Exp_Util;
 with Nlists;   use Nlists;
 with Nmake;    use Nmake;
 with Rtsfind;  use Rtsfind;
+with Sem_Util; use Sem_Util;
 with Stand;    use Stand;
 with Snames;   use Snames;
 with Tbuild;   use Tbuild;
@@ -139,7 +140,7 @@ package body Exp_Atag is
               Make_Assignment_Statement (Loc,
                 Name       => Make_Identifier (Loc, Name_uF),
                 Expression => New_Reference_To (Standard_True, Loc)),
-              Make_Return_Statement (Loc))));
+              Make_Simple_Return_Statement (Loc))));
    end Build_Common_Dispatching_Select_Statements;
 
    -------------------------
@@ -253,40 +254,67 @@ package body Exp_Atag is
 
    function Build_Inherit_Prims
      (Loc          : Source_Ptr;
+      Typ          : Entity_Id;
       Old_Tag_Node : Node_Id;
       New_Tag_Node : Node_Id;
       Num_Prims    : Nat) return Node_Id
    is
    begin
-      return
-        Make_Assignment_Statement (Loc,
-          Name =>
-            Make_Slice (Loc,
-              Prefix =>
-                Make_Selected_Component (Loc,
-                  Prefix =>
-                    Build_DT (Loc, New_Tag_Node),
-                  Selector_Name =>
-                    New_Reference_To
-                      (RTE_Record_Component (RE_Prims_Ptr), Loc)),
-              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 =>
-                Make_Selected_Component (Loc,
-                  Prefix =>
-                    Build_DT (Loc, Old_Tag_Node),
-                  Selector_Name =>
-                    New_Reference_To
-                      (RTE_Record_Component (RE_Prims_Ptr), Loc)),
-              Discrete_Range =>
-                Make_Range (Loc,
-                Low_Bound  => Make_Integer_Literal (Loc, 1),
-                High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
+      if RTE_Available (RE_DT) then
+         return
+           Make_Assignment_Statement (Loc,
+             Name =>
+               Make_Slice (Loc,
+                 Prefix =>
+                   Make_Selected_Component (Loc,
+                     Prefix =>
+                       Build_DT (Loc, New_Tag_Node),
+                     Selector_Name =>
+                       New_Reference_To
+                         (RTE_Record_Component (RE_Prims_Ptr), Loc)),
+                 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 =>
+                   Make_Selected_Component (Loc,
+                     Prefix =>
+                       Build_DT (Loc, Old_Tag_Node),
+                     Selector_Name =>
+                       New_Reference_To
+                         (RTE_Record_Component (RE_Prims_Ptr), Loc)),
+                 Discrete_Range =>
+                   Make_Range (Loc,
+                     Low_Bound  => Make_Integer_Literal (Loc, 1),
+                     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;
 
    -------------------------------
@@ -342,39 +370,64 @@ package body Exp_Atag is
       New_Tag_Node : Node_Id) return Node_Id
    is
    begin
-      return
-        Make_Assignment_Statement (Loc,
-          Name =>
-            Make_Slice (Loc,
-              Prefix =>
-                Make_Explicit_Dereference (Loc,
-                  Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
-                    Make_Selected_Component (Loc,
-                      Prefix =>
-                        Build_DT (Loc, New_Tag_Node),
-                      Selector_Name =>
-                        New_Reference_To
-                          (RTE_Record_Component (RE_Predef_Prims), Loc)))),
-              Discrete_Range => Make_Range (Loc,
-                Make_Integer_Literal (Loc, Uint_1),
-                New_Reference_To (RTE (RE_Default_Prim_Op_Count), Loc))),
-
-          Expression =>
-            Make_Slice (Loc,
-              Prefix =>
-                Make_Explicit_Dereference (Loc,
-                  Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
-                    Make_Selected_Component (Loc,
-                      Prefix =>
-                        Build_DT (Loc, Old_Tag_Node),
-                      Selector_Name =>
-                        New_Reference_To
-                          (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_Default_Prim_Op_Count), Loc))));
+      if RTE_Available (RE_DT) then
+         return
+           Make_Assignment_Statement (Loc,
+             Name =>
+               Make_Slice (Loc,
+                 Prefix =>
+                   Make_Explicit_Dereference (Loc,
+                     Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
+                       Make_Selected_Component (Loc,
+                         Prefix =>
+                           Build_DT (Loc, New_Tag_Node),
+                         Selector_Name =>
+                           New_Reference_To
+                             (RTE_Record_Component (RE_Predef_Prims), Loc)))),
+                 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,
+                     Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
+                       Make_Selected_Component (Loc,
+                         Prefix =>
+                           Build_DT (Loc, Old_Tag_Node),
+                         Selector_Name =>
+                           New_Reference_To
+                             (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 =>
+                   Make_Range (Loc,
+                     Low_Bound  => Make_Integer_Literal (Loc, 1),
+                     High_Bound =>
+                       New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))));
+      end if;
    end Build_Inherit_Predefined_Prims;
 
    ------------------------