1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2006-2011, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Atree; use Atree;
27 with Einfo; use Einfo;
28 with Elists; use Elists;
29 with Exp_Disp; use Exp_Disp;
30 with Exp_Util; use Exp_Util;
31 with Namet; use Namet;
32 with Nlists; use Nlists;
33 with Nmake; use Nmake;
35 with Rtsfind; use Rtsfind;
36 with Sinfo; use Sinfo;
37 with Sem_Aux; use Sem_Aux;
38 with Sem_Disp; use Sem_Disp;
39 with Sem_Util; use Sem_Util;
40 with Stand; use Stand;
41 with Snames; use Snames;
42 with Tbuild; use Tbuild;
44 package body Exp_Atag is
46 -----------------------
47 -- Local Subprograms --
48 -----------------------
52 Tag_Node : Node_Id) return Node_Id;
53 -- Build code that displaces the Tag to reference the base of the wrapper
57 -- To_Dispatch_Table_Ptr
58 -- (To_Address (Tag_Node) - Tag_Node.Prims_Ptr'Position);
62 Tag_Node_Addr : Node_Id) return Node_Id;
63 -- Build code that retrieves the address of the record containing the Type
64 -- Specific Data generated by GNAT.
66 -- Generate: To_Type_Specific_Data_Ptr
67 -- (To_Addr_Ptr (Tag_Node_Addr - Typeinfo_Offset).all);
69 ------------------------------------------------
70 -- Build_Common_Dispatching_Select_Statements --
71 ------------------------------------------------
73 procedure Build_Common_Dispatching_Select_Statements
77 Loc : constant Source_Ptr := Sloc (Typ);
82 -- C := get_prim_op_kind (tag! (<type>VP), S);
84 -- where C is the out parameter capturing the call kind and S is the
85 -- dispatch table slot number.
87 if Tagged_Type_Expansion then
89 Unchecked_Convert_To (RTE (RE_Tag),
91 (Node (First_Elmt (Access_Disp_Table (Typ))), Loc));
95 Make_Attribute_Reference (Loc,
96 Prefix => New_Reference_To (Typ, Loc),
97 Attribute_Name => Name_Tag);
101 Make_Assignment_Statement (Loc,
102 Name => Make_Identifier (Loc, Name_uC),
104 Make_Function_Call (Loc,
105 Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
106 Parameter_Associations => New_List (
108 Make_Identifier (Loc, Name_uS)))));
112 -- if C = POK_Procedure
113 -- or else C = POK_Protected_Procedure
114 -- or else C = POK_Task_Procedure;
119 -- where F is the out parameter capturing the status of a potential
123 Make_If_Statement (Loc,
129 Left_Opnd => Make_Identifier (Loc, Name_uC),
131 New_Reference_To (RTE (RE_POK_Procedure), Loc)),
136 Left_Opnd => Make_Identifier (Loc, Name_uC),
139 (RTE (RE_POK_Protected_Procedure), Loc)),
142 Left_Opnd => Make_Identifier (Loc, Name_uC),
145 (RTE (RE_POK_Task_Procedure), Loc)))),
149 Make_Assignment_Statement (Loc,
150 Name => Make_Identifier (Loc, Name_uF),
151 Expression => New_Reference_To (Standard_True, Loc)),
152 Make_Simple_Return_Statement (Loc))));
153 end Build_Common_Dispatching_Select_Statements;
155 -------------------------
156 -- Build_CW_Membership --
157 -------------------------
159 procedure Build_CW_Membership
161 Obj_Tag_Node : in out Node_Id;
162 Typ_Tag_Node : Node_Id;
163 Related_Nod : Node_Id;
164 New_Node : out Node_Id)
166 Tag_Addr : constant Entity_Id := Make_Temporary (Loc, 'D', Obj_Tag_Node);
167 Obj_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
168 Typ_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
169 Index : constant Entity_Id := Make_Temporary (Loc, 'D');
174 -- Tag_Addr : constant Tag := Address!(Obj_Tag);
175 -- Obj_TSD : constant Type_Specific_Data_Ptr
176 -- := Build_TSD (Tag_Addr);
177 -- Typ_TSD : constant Type_Specific_Data_Ptr
178 -- := Build_TSD (Address!(Typ_Tag));
179 -- Index : constant Integer := Obj_TSD.Idepth - Typ_TSD.Idepth
180 -- Index > 0 and then Obj_TSD.Tags_Table (Index) = Typ'Tag
182 Insert_Action (Related_Nod,
183 Make_Object_Declaration (Loc,
184 Defining_Identifier => Tag_Addr,
185 Constant_Present => True,
186 Object_Definition => New_Reference_To (RTE (RE_Address), Loc),
187 Expression => Unchecked_Convert_To
188 (RTE (RE_Address), Obj_Tag_Node)));
190 -- Unchecked_Convert_To relocates Obj_Tag_Node and therefore we must
193 Obj_Tag_Node := Expression (Expression (Parent (Tag_Addr)));
195 Insert_Action (Related_Nod,
196 Make_Object_Declaration (Loc,
197 Defining_Identifier => Obj_TSD,
198 Constant_Present => True,
199 Object_Definition => New_Reference_To
200 (RTE (RE_Type_Specific_Data_Ptr), Loc),
201 Expression => Build_TSD (Loc, New_Reference_To (Tag_Addr, Loc))));
203 Insert_Action (Related_Nod,
204 Make_Object_Declaration (Loc,
205 Defining_Identifier => Typ_TSD,
206 Constant_Present => True,
207 Object_Definition => New_Reference_To
208 (RTE (RE_Type_Specific_Data_Ptr), Loc),
209 Expression => Build_TSD (Loc,
210 Unchecked_Convert_To (RTE (RE_Address),
213 Insert_Action (Related_Nod,
214 Make_Object_Declaration (Loc,
215 Defining_Identifier => Index,
216 Constant_Present => True,
217 Object_Definition => New_Occurrence_Of (Standard_Integer, Loc),
219 Make_Op_Subtract (Loc,
221 Make_Selected_Component (Loc,
222 Prefix => New_Reference_To (Obj_TSD, Loc),
225 (RTE_Record_Component (RE_Idepth), Loc)),
228 Make_Selected_Component (Loc,
229 Prefix => New_Reference_To (Typ_TSD, Loc),
232 (RTE_Record_Component (RE_Idepth), Loc)))));
238 Left_Opnd => New_Occurrence_Of (Index, Loc),
239 Right_Opnd => Make_Integer_Literal (Loc, Uint_0)),
244 Make_Indexed_Component (Loc,
246 Make_Selected_Component (Loc,
247 Prefix => New_Reference_To (Obj_TSD, Loc),
250 (RTE_Record_Component (RE_Tags_Table), Loc)),
252 New_List (New_Occurrence_Of (Index, Loc))),
254 Right_Opnd => Typ_Tag_Node));
255 end Build_CW_Membership;
263 Tag_Node : Node_Id) return Node_Id
267 Make_Function_Call (Loc,
268 Name => New_Reference_To (RTE (RE_DT), Loc),
269 Parameter_Associations => New_List (
270 Unchecked_Convert_To (RTE (RE_Tag), Tag_Node)));
273 ----------------------------
274 -- Build_Get_Access_Level --
275 ----------------------------
277 function Build_Get_Access_Level
279 Tag_Node : Node_Id) return Node_Id
283 Make_Selected_Component (Loc,
286 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
289 (RTE_Record_Component (RE_Access_Level), Loc));
290 end Build_Get_Access_Level;
292 ------------------------------------------
293 -- Build_Get_Predefined_Prim_Op_Address --
294 ------------------------------------------
296 procedure Build_Get_Predefined_Prim_Op_Address
299 Tag_Node : in out Node_Id;
300 New_Node : out Node_Id)
305 Ctrl_Tag := Unchecked_Convert_To (RTE (RE_Address), Tag_Node);
307 -- Unchecked_Convert_To relocates the controlling tag node and therefore
308 -- we must update it.
310 Tag_Node := Expression (Ctrl_Tag);
312 -- Build code that retrieves the address of the dispatch table
313 -- containing the predefined Ada primitives:
316 -- To_Predef_Prims_Table_Ptr
317 -- (To_Addr_Ptr (To_Address (Tag) - Predef_Prims_Offset).all);
320 Make_Indexed_Component (Loc,
322 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
323 Make_Explicit_Dereference (Loc,
324 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
325 Make_Function_Call (Loc,
327 Make_Expanded_Name (Loc,
328 Chars => Name_Op_Subtract,
331 (RTU_Entity (System_Storage_Elements), Loc),
333 Make_Identifier (Loc, Name_Op_Subtract)),
334 Parameter_Associations => New_List (
337 (RTE (RE_DT_Predef_Prims_Offset), Loc)))))),
339 New_List (Make_Integer_Literal (Loc, Position)));
340 end Build_Get_Predefined_Prim_Op_Address;
342 -----------------------------
343 -- Build_Inherit_CPP_Prims --
344 -----------------------------
346 function Build_Inherit_CPP_Prims (Typ : Entity_Id) return List_Id is
347 Loc : constant Source_Ptr := Sloc (Typ);
348 CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ);
349 CPP_Table : array (1 .. CPP_Nb_Prims) of Boolean := (others => False);
350 CPP_Typ : constant Entity_Id := Enclosing_CPP_Parent (Typ);
351 Result : constant List_Id := New_List;
352 Parent_Typ : constant Entity_Id := Etype (Typ);
355 Parent_Tag : Entity_Id;
361 pragma Assert (not Is_CPP_Class (Typ));
363 -- No code needed if this type has no primitives inherited from C++
365 if CPP_Nb_Prims = 0 then
369 -- Stage 1: Inherit and override C++ slots of the primary dispatch table
372 -- Typ'Tag (Prim_Pos) := Prim'Unrestricted_Access;
374 Parent_Tag := Node (First_Elmt (Access_Disp_Table (Parent_Typ)));
375 Typ_Tag := Node (First_Elmt (Access_Disp_Table (Typ)));
377 Elmt := First_Elmt (Primitive_Operations (Typ));
378 while Present (Elmt) loop
380 E := Ultimate_Alias (Prim);
381 Prim_Pos := UI_To_Int (DT_Position (E));
383 -- Skip predefined, abstract, and eliminated primitives. Skip also
384 -- primitives not located in the C++ part of the dispatch table.
386 if not Is_Predefined_Dispatching_Operation (Prim)
387 and then not Is_Predefined_Dispatching_Operation (E)
388 and then not Present (Interface_Alias (Prim))
389 and then not Is_Abstract_Subprogram (E)
390 and then not Is_Eliminated (E)
391 and then Prim_Pos <= CPP_Nb_Prims
392 and then Find_Dispatching_Type (E) = Typ
394 -- Remember that this slot is used
396 pragma Assert (CPP_Table (Prim_Pos) = False);
397 CPP_Table (Prim_Pos) := True;
400 Make_Assignment_Statement (Loc,
402 Make_Indexed_Component (Loc,
404 Make_Explicit_Dereference (Loc,
406 (Node (Last_Elmt (Access_Disp_Table (Typ))),
407 New_Reference_To (Typ_Tag, Loc))),
409 New_List (Make_Integer_Literal (Loc, Prim_Pos))),
412 Unchecked_Convert_To (RTE (RE_Prim_Ptr),
413 Make_Attribute_Reference (Loc,
414 Prefix => New_Reference_To (E, Loc),
415 Attribute_Name => Name_Unrestricted_Access))));
421 -- If all primitives have been overridden then there is no need to copy
422 -- from Typ's parent its dispatch table. Otherwise, if some primitive is
423 -- inherited from the parent we copy only the C++ part of the dispatch
424 -- table from the parent before the assignments that initialize the
425 -- overridden primitives.
429 -- type CPP_TypG is array (1 .. CPP_Nb_Prims) ofd Prim_Ptr;
430 -- type CPP_TypH is access CPP_TypG;
431 -- CPP_TypG!(Typ_Tag).all := CPP_TypG!(Parent_Tag).all;
433 -- Note: There is no need to duplicate the declarations of CPP_TypG and
434 -- CPP_TypH because, for expansion of dispatching calls, these
435 -- entities are stored in the last elements of Access_Disp_Table.
437 for J in CPP_Table'Range loop
438 if not CPP_Table (J) then
440 Make_Assignment_Statement (Loc,
442 Make_Explicit_Dereference (Loc,
444 (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
445 New_Reference_To (Typ_Tag, Loc))),
447 Make_Explicit_Dereference (Loc,
449 (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
450 New_Reference_To (Parent_Tag, Loc)))));
455 -- Stage 2: Inherit and override C++ slots of secondary dispatch tables
459 Iface_Nb_Prims : Nat;
460 Parent_Ifaces_List : Elist_Id;
461 Parent_Ifaces_Comp_List : Elist_Id;
462 Parent_Ifaces_Tag_List : Elist_Id;
463 Parent_Iface_Tag_Elmt : Elmt_Id;
464 Typ_Ifaces_List : Elist_Id;
465 Typ_Ifaces_Comp_List : Elist_Id;
466 Typ_Ifaces_Tag_List : Elist_Id;
467 Typ_Iface_Tag_Elmt : Elmt_Id;
470 Collect_Interfaces_Info
472 Ifaces_List => Parent_Ifaces_List,
473 Components_List => Parent_Ifaces_Comp_List,
474 Tags_List => Parent_Ifaces_Tag_List);
476 Collect_Interfaces_Info
478 Ifaces_List => Typ_Ifaces_List,
479 Components_List => Typ_Ifaces_Comp_List,
480 Tags_List => Typ_Ifaces_Tag_List);
482 Parent_Iface_Tag_Elmt := First_Elmt (Parent_Ifaces_Tag_List);
483 Typ_Iface_Tag_Elmt := First_Elmt (Typ_Ifaces_Tag_List);
484 while Present (Parent_Iface_Tag_Elmt) loop
485 Parent_Tag := Node (Parent_Iface_Tag_Elmt);
486 Typ_Tag := Node (Typ_Iface_Tag_Elmt);
489 (Related_Type (Parent_Tag) = Related_Type (Typ_Tag));
490 Iface := Related_Type (Parent_Tag);
493 UI_To_Int (DT_Entry_Count (First_Tag_Component (Iface)));
495 if Iface_Nb_Prims > 0 then
497 -- Update slots of overridden primitives
500 Last_Nod : constant Node_Id := Last (Result);
501 Nb_Prims : constant Nat := UI_To_Int
503 (First_Tag_Component (Iface)));
509 Prims_Table : array (1 .. Nb_Prims) of Boolean;
512 Prims_Table := (others => False);
514 Elmt := First_Elmt (Primitive_Operations (Typ));
515 while Present (Elmt) loop
517 E := Ultimate_Alias (Prim);
519 if not Is_Predefined_Dispatching_Operation (Prim)
520 and then Present (Interface_Alias (Prim))
521 and then Find_Dispatching_Type (Interface_Alias (Prim))
523 and then not Is_Abstract_Subprogram (E)
524 and then not Is_Eliminated (E)
525 and then Find_Dispatching_Type (E) = Typ
527 Prim_Pos := UI_To_Int (DT_Position (Prim));
529 -- Remember that this slot is already initialized
531 pragma Assert (Prims_Table (Prim_Pos) = False);
532 Prims_Table (Prim_Pos) := True;
535 Make_Assignment_Statement (Loc,
537 Make_Indexed_Component (Loc,
539 Make_Explicit_Dereference (Loc,
543 (Access_Disp_Table (Iface))),
544 New_Reference_To (Typ_Tag, Loc))),
547 (Make_Integer_Literal (Loc, Prim_Pos))),
550 Unchecked_Convert_To (RTE (RE_Prim_Ptr),
551 Make_Attribute_Reference (Loc,
552 Prefix => New_Reference_To (E, Loc),
554 Name_Unrestricted_Access))));
560 -- Check if all primitives from the parent have been
561 -- overridden (to avoid copying the whole secondary
562 -- table from the parent).
564 -- IfaceG!(Typ_Sec_Tag).all := IfaceG!(Parent_Sec_Tag).all;
566 for J in Prims_Table'Range loop
567 if not Prims_Table (J) then
568 Insert_After (Last_Nod,
569 Make_Assignment_Statement (Loc,
571 Make_Explicit_Dereference (Loc,
573 (Node (Last_Elmt (Access_Disp_Table (Iface))),
574 New_Reference_To (Typ_Tag, Loc))),
576 Make_Explicit_Dereference (Loc,
578 (Node (Last_Elmt (Access_Disp_Table (Iface))),
579 New_Reference_To (Parent_Tag, Loc)))));
586 Next_Elmt (Typ_Iface_Tag_Elmt);
587 Next_Elmt (Parent_Iface_Tag_Elmt);
592 end Build_Inherit_CPP_Prims;
594 -------------------------
595 -- Build_Inherit_Prims --
596 -------------------------
598 function Build_Inherit_Prims
601 Old_Tag_Node : Node_Id;
602 New_Tag_Node : Node_Id;
603 Num_Prims : Nat) return Node_Id
606 if RTE_Available (RE_DT) then
608 Make_Assignment_Statement (Loc,
612 Make_Selected_Component (Loc,
614 Build_DT (Loc, New_Tag_Node),
617 (RTE_Record_Component (RE_Prims_Ptr), Loc)),
620 Low_Bound => Make_Integer_Literal (Loc, 1),
621 High_Bound => Make_Integer_Literal (Loc, Num_Prims))),
626 Make_Selected_Component (Loc,
628 Build_DT (Loc, Old_Tag_Node),
631 (RTE_Record_Component (RE_Prims_Ptr), Loc)),
634 Low_Bound => Make_Integer_Literal (Loc, 1),
635 High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
638 Make_Assignment_Statement (Loc,
643 (Node (Last_Elmt (Access_Disp_Table (Typ))),
647 Low_Bound => Make_Integer_Literal (Loc, 1),
648 High_Bound => Make_Integer_Literal (Loc, Num_Prims))),
654 (Node (Last_Elmt (Access_Disp_Table (Typ))),
658 Low_Bound => Make_Integer_Literal (Loc, 1),
659 High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
661 end Build_Inherit_Prims;
663 -------------------------------
664 -- Build_Get_Prim_Op_Address --
665 -------------------------------
667 procedure Build_Get_Prim_Op_Address
671 Tag_Node : in out Node_Id;
672 New_Node : out Node_Id)
674 New_Prefix : Node_Id;
678 (Position <= DT_Entry_Count (First_Tag_Component (Typ)));
680 -- At the end of the Access_Disp_Table list we have the type
681 -- declaration required to convert the tag into a pointer to
682 -- the prims_ptr table (see Freeze_Record_Type).
686 (Node (Last_Elmt (Access_Disp_Table (Typ))), Tag_Node);
688 -- Unchecked_Convert_To relocates the controlling tag node and therefore
689 -- we must update it.
691 Tag_Node := Expression (New_Prefix);
694 Make_Indexed_Component (Loc,
695 Prefix => New_Prefix,
696 Expressions => New_List (Make_Integer_Literal (Loc, Position)));
697 end Build_Get_Prim_Op_Address;
699 -----------------------------
700 -- Build_Get_Transportable --
701 -----------------------------
703 function Build_Get_Transportable
705 Tag_Node : Node_Id) return Node_Id
709 Make_Selected_Component (Loc,
712 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
715 (RTE_Record_Component (RE_Transportable), Loc));
716 end Build_Get_Transportable;
718 ------------------------------------
719 -- Build_Inherit_Predefined_Prims --
720 ------------------------------------
722 function Build_Inherit_Predefined_Prims
724 Old_Tag_Node : Node_Id;
725 New_Tag_Node : Node_Id) return Node_Id
729 Make_Assignment_Statement (Loc,
733 Make_Explicit_Dereference (Loc,
734 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
735 Make_Explicit_Dereference (Loc,
736 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
738 Discrete_Range => Make_Range (Loc,
739 Make_Integer_Literal (Loc, Uint_1),
740 New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))),
745 Make_Explicit_Dereference (Loc,
746 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
747 Make_Explicit_Dereference (Loc,
748 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
752 Make_Integer_Literal (Loc, 1),
753 New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))));
754 end Build_Inherit_Predefined_Prims;
756 -------------------------
757 -- Build_Offset_To_Top --
758 -------------------------
760 function Build_Offset_To_Top
762 This_Node : Node_Id) return Node_Id
768 Make_Explicit_Dereference (Loc,
769 Unchecked_Convert_To (RTE (RE_Tag_Ptr), This_Node));
772 Make_Explicit_Dereference (Loc,
773 Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
774 Make_Function_Call (Loc,
776 Make_Expanded_Name (Loc,
777 Chars => Name_Op_Subtract,
780 (RTU_Entity (System_Storage_Elements), Loc),
781 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
782 Parameter_Associations => New_List (
783 Unchecked_Convert_To (RTE (RE_Address), Tag_Node),
785 (RTE (RE_DT_Offset_To_Top_Offset), Loc)))));
786 end Build_Offset_To_Top;
788 ------------------------------------------
789 -- Build_Set_Predefined_Prim_Op_Address --
790 ------------------------------------------
792 function Build_Set_Predefined_Prim_Op_Address
796 Address_Node : Node_Id) return Node_Id
800 Make_Assignment_Statement (Loc,
802 Make_Indexed_Component (Loc,
804 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
805 Make_Explicit_Dereference (Loc,
806 Unchecked_Convert_To (RTE (RE_Addr_Ptr), Tag_Node))),
808 New_List (Make_Integer_Literal (Loc, Position))),
810 Expression => Address_Node);
811 end Build_Set_Predefined_Prim_Op_Address;
813 -------------------------------
814 -- Build_Set_Prim_Op_Address --
815 -------------------------------
817 function Build_Set_Prim_Op_Address
822 Address_Node : Node_Id) return Node_Id
824 Ctrl_Tag : Node_Id := Tag_Node;
828 Build_Get_Prim_Op_Address (Loc, Typ, Position, Ctrl_Tag, New_Node);
831 Make_Assignment_Statement (Loc,
833 Expression => Address_Node);
834 end Build_Set_Prim_Op_Address;
836 -----------------------------
837 -- Build_Set_Size_Function --
838 -----------------------------
840 function Build_Set_Size_Function
843 Size_Func : Entity_Id) return Node_Id is
845 pragma Assert (Chars (Size_Func) = Name_uSize
846 and then RTE_Record_Component_Available (RE_Size_Func));
848 Make_Assignment_Statement (Loc,
850 Make_Selected_Component (Loc,
853 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
856 (RTE_Record_Component (RE_Size_Func), Loc)),
858 Unchecked_Convert_To (RTE (RE_Size_Ptr),
859 Make_Attribute_Reference (Loc,
860 Prefix => New_Reference_To (Size_Func, Loc),
861 Attribute_Name => Name_Unrestricted_Access)));
862 end Build_Set_Size_Function;
864 ------------------------------------
865 -- Build_Set_Static_Offset_To_Top --
866 ------------------------------------
868 function Build_Set_Static_Offset_To_Top
871 Offset_Value : Node_Id) return Node_Id is
874 Make_Assignment_Statement (Loc,
875 Make_Explicit_Dereference (Loc,
876 Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
877 Make_Function_Call (Loc,
879 Make_Expanded_Name (Loc,
880 Chars => Name_Op_Subtract,
883 (RTU_Entity (System_Storage_Elements), Loc),
884 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
885 Parameter_Associations => New_List (
886 Unchecked_Convert_To (RTE (RE_Address), Iface_Tag),
888 (RTE (RE_DT_Offset_To_Top_Offset), Loc))))),
890 end Build_Set_Static_Offset_To_Top;
898 Tag_Node_Addr : Node_Id) return Node_Id is
901 Unchecked_Convert_To (RTE (RE_Type_Specific_Data_Ptr),
902 Make_Explicit_Dereference (Loc,
903 Prefix => Unchecked_Convert_To (RTE (RE_Addr_Ptr),
904 Make_Function_Call (Loc,
906 Make_Expanded_Name (Loc,
907 Chars => Name_Op_Subtract,
910 (RTU_Entity (System_Storage_Elements), Loc),
911 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
913 Parameter_Associations => New_List (
916 (RTE (RE_DT_Typeinfo_Ptr_Size), Loc))))));