1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2006-2010, 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;
34 with Rtsfind; use Rtsfind;
35 with Sinfo; use Sinfo;
36 with Sem_Aux; use Sem_Aux;
37 with Sem_Disp; use Sem_Disp;
38 with Sem_Util; use Sem_Util;
39 with Stand; use Stand;
40 with Snames; use Snames;
41 with Tbuild; use Tbuild;
43 package body Exp_Atag is
45 -----------------------
46 -- Local Subprograms --
47 -----------------------
51 Tag_Node : Node_Id) return Node_Id;
52 -- Build code that displaces the Tag to reference the base of the wrapper
56 -- To_Dispatch_Table_Ptr
57 -- (To_Address (Tag_Node) - Tag_Node.Prims_Ptr'Position);
61 Tag_Node_Addr : Node_Id) return Node_Id;
62 -- Build code that retrieves the address of the record containing the Type
63 -- Specific Data generated by GNAT.
65 -- Generate: To_Type_Specific_Data_Ptr
66 -- (To_Addr_Ptr (Tag_Node_Addr - Typeinfo_Offset).all);
68 ------------------------------------------------
69 -- Build_Common_Dispatching_Select_Statements --
70 ------------------------------------------------
72 procedure Build_Common_Dispatching_Select_Statements
79 -- C := get_prim_op_kind (tag! (<type>VP), S);
81 -- where C is the out parameter capturing the call kind and S is the
82 -- dispatch table slot number.
85 Make_Assignment_Statement (Loc,
86 Name => Make_Identifier (Loc, Name_uC),
88 Make_Function_Call (Loc,
89 Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
90 Parameter_Associations => New_List (
91 Unchecked_Convert_To (RTE (RE_Tag),
92 New_Reference_To (DT_Ptr, Loc)),
93 Make_Identifier (Loc, Name_uS)))));
97 -- if C = POK_Procedure
98 -- or else C = POK_Protected_Procedure
99 -- or else C = POK_Task_Procedure;
104 -- where F is the out parameter capturing the status of a potential
108 Make_If_Statement (Loc,
114 Left_Opnd => Make_Identifier (Loc, Name_uC),
116 New_Reference_To (RTE (RE_POK_Procedure), Loc)),
121 Left_Opnd => Make_Identifier (Loc, Name_uC),
124 (RTE (RE_POK_Protected_Procedure), Loc)),
127 Left_Opnd => Make_Identifier (Loc, Name_uC),
130 (RTE (RE_POK_Task_Procedure), Loc)))),
134 Make_Assignment_Statement (Loc,
135 Name => Make_Identifier (Loc, Name_uF),
136 Expression => New_Reference_To (Standard_True, Loc)),
137 Make_Simple_Return_Statement (Loc))));
138 end Build_Common_Dispatching_Select_Statements;
140 -------------------------
141 -- Build_CW_Membership --
142 -------------------------
144 procedure Build_CW_Membership
146 Obj_Tag_Node : in out Node_Id;
147 Typ_Tag_Node : Node_Id;
148 Related_Nod : Node_Id;
149 New_Node : out Node_Id)
151 Tag_Addr : constant Entity_Id := Make_Temporary (Loc, 'D', Obj_Tag_Node);
152 Obj_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
153 Typ_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
154 Index : constant Entity_Id := Make_Temporary (Loc, 'D');
159 -- Tag_Addr : constant Tag := Address!(Obj_Tag);
160 -- Obj_TSD : constant Type_Specific_Data_Ptr
161 -- := Build_TSD (Tag_Addr);
162 -- Typ_TSD : constant Type_Specific_Data_Ptr
163 -- := Build_TSD (Address!(Typ_Tag));
164 -- Index : constant Integer := Obj_TSD.Idepth - Typ_TSD.Idepth
165 -- Index > 0 and then Obj_TSD.Tags_Table (Index) = Typ'Tag
167 Insert_Action (Related_Nod,
168 Make_Object_Declaration (Loc,
169 Defining_Identifier => Tag_Addr,
170 Constant_Present => True,
171 Object_Definition => New_Reference_To (RTE (RE_Address), Loc),
172 Expression => Unchecked_Convert_To
173 (RTE (RE_Address), Obj_Tag_Node)));
175 -- Unchecked_Convert_To relocates Obj_Tag_Node and therefore we must
178 Obj_Tag_Node := Expression (Expression (Parent (Tag_Addr)));
180 Insert_Action (Related_Nod,
181 Make_Object_Declaration (Loc,
182 Defining_Identifier => Obj_TSD,
183 Constant_Present => True,
184 Object_Definition => New_Reference_To
185 (RTE (RE_Type_Specific_Data_Ptr), Loc),
186 Expression => Build_TSD (Loc, New_Reference_To (Tag_Addr, Loc))));
188 Insert_Action (Related_Nod,
189 Make_Object_Declaration (Loc,
190 Defining_Identifier => Typ_TSD,
191 Constant_Present => True,
192 Object_Definition => New_Reference_To
193 (RTE (RE_Type_Specific_Data_Ptr), Loc),
194 Expression => Build_TSD (Loc,
195 Unchecked_Convert_To (RTE (RE_Address),
198 Insert_Action (Related_Nod,
199 Make_Object_Declaration (Loc,
200 Defining_Identifier => Index,
201 Constant_Present => True,
202 Object_Definition => New_Occurrence_Of (Standard_Integer, Loc),
204 Make_Op_Subtract (Loc,
206 Make_Selected_Component (Loc,
207 Prefix => New_Reference_To (Obj_TSD, Loc),
210 (RTE_Record_Component (RE_Idepth), Loc)),
213 Make_Selected_Component (Loc,
214 Prefix => New_Reference_To (Typ_TSD, Loc),
217 (RTE_Record_Component (RE_Idepth), Loc)))));
223 Left_Opnd => New_Occurrence_Of (Index, Loc),
224 Right_Opnd => Make_Integer_Literal (Loc, Uint_0)),
229 Make_Indexed_Component (Loc,
231 Make_Selected_Component (Loc,
232 Prefix => New_Reference_To (Obj_TSD, Loc),
235 (RTE_Record_Component (RE_Tags_Table), Loc)),
237 New_List (New_Occurrence_Of (Index, Loc))),
239 Right_Opnd => Typ_Tag_Node));
240 end Build_CW_Membership;
248 Tag_Node : Node_Id) return Node_Id
252 Make_Function_Call (Loc,
253 Name => New_Reference_To (RTE (RE_DT), Loc),
254 Parameter_Associations => New_List (
255 Unchecked_Convert_To (RTE (RE_Tag), Tag_Node)));
258 ----------------------------
259 -- Build_Get_Access_Level --
260 ----------------------------
262 function Build_Get_Access_Level
264 Tag_Node : Node_Id) return Node_Id
268 Make_Selected_Component (Loc,
271 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
274 (RTE_Record_Component (RE_Access_Level), Loc));
275 end Build_Get_Access_Level;
277 ------------------------------------------
278 -- Build_Get_Predefined_Prim_Op_Address --
279 ------------------------------------------
281 procedure Build_Get_Predefined_Prim_Op_Address
284 Tag_Node : in out Node_Id;
285 New_Node : out Node_Id)
290 Ctrl_Tag := Unchecked_Convert_To (RTE (RE_Address), Tag_Node);
292 -- Unchecked_Convert_To relocates the controlling tag node and therefore
293 -- we must update it.
295 Tag_Node := Expression (Ctrl_Tag);
297 -- Build code that retrieves the address of the dispatch table
298 -- containing the predefined Ada primitives:
301 -- To_Predef_Prims_Table_Ptr
302 -- (To_Addr_Ptr (To_Address (Tag) - Predef_Prims_Offset).all);
305 Make_Indexed_Component (Loc,
307 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
308 Make_Explicit_Dereference (Loc,
309 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
310 Make_Function_Call (Loc,
312 Make_Expanded_Name (Loc,
313 Chars => Name_Op_Subtract,
316 (RTU_Entity (System_Storage_Elements), Loc),
318 Make_Identifier (Loc, Name_Op_Subtract)),
319 Parameter_Associations => New_List (
322 (RTE (RE_DT_Predef_Prims_Offset), Loc)))))),
324 New_List (Make_Integer_Literal (Loc, Position)));
325 end Build_Get_Predefined_Prim_Op_Address;
327 -----------------------------
328 -- Build_Inherit_CPP_Prims --
329 -----------------------------
331 function Build_Inherit_CPP_Prims (Typ : Entity_Id) return List_Id is
332 Loc : constant Source_Ptr := Sloc (Typ);
333 CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ);
334 CPP_Table : array (1 .. CPP_Nb_Prims) of Boolean := (others => False);
335 CPP_Typ : constant Entity_Id := Enclosing_CPP_Parent (Typ);
336 Result : constant List_Id := New_List;
337 Parent_Typ : constant Entity_Id := Etype (Typ);
340 Parent_Tag : Entity_Id;
346 pragma Assert (not Is_CPP_Class (Typ));
348 -- No code needed if this type has no primitives inherited from C++
350 if CPP_Nb_Prims = 0 then
354 -- Stage 1: Inherit and override C++ slots of the primary dispatch table
357 -- Typ'Tag (Prim_Pos) := Prim'Unrestricted_Access;
359 Parent_Tag := Node (First_Elmt (Access_Disp_Table (Parent_Typ)));
360 Typ_Tag := Node (First_Elmt (Access_Disp_Table (Typ)));
362 Elmt := First_Elmt (Primitive_Operations (Typ));
363 while Present (Elmt) loop
365 E := Ultimate_Alias (Prim);
366 Prim_Pos := UI_To_Int (DT_Position (E));
368 -- Skip predefined, abstract, and eliminated primitives. Skip also
369 -- primitives not located in the C++ part of the dispatch table.
371 if not Is_Predefined_Dispatching_Operation (Prim)
372 and then not Is_Predefined_Dispatching_Operation (E)
373 and then not Present (Interface_Alias (Prim))
374 and then not Is_Abstract_Subprogram (E)
375 and then not Is_Eliminated (E)
376 and then Prim_Pos <= CPP_Nb_Prims
377 and then Find_Dispatching_Type (E) = Typ
379 -- Remember that this slot is used
381 pragma Assert (CPP_Table (Prim_Pos) = False);
382 CPP_Table (Prim_Pos) := True;
385 Make_Assignment_Statement (Loc,
387 Make_Indexed_Component (Loc,
389 Make_Explicit_Dereference (Loc,
391 (Node (Last_Elmt (Access_Disp_Table (Typ))),
392 New_Reference_To (Typ_Tag, Loc))),
394 New_List (Make_Integer_Literal (Loc, Prim_Pos))),
397 Unchecked_Convert_To (RTE (RE_Prim_Ptr),
398 Make_Attribute_Reference (Loc,
399 Prefix => New_Reference_To (E, Loc),
400 Attribute_Name => Name_Unrestricted_Access))));
406 -- If all primitives have been overridden then there is no need to copy
407 -- from Typ's parent its dispatch table. Otherwise, if some primitive is
408 -- inherited from the parent we copy only the C++ part of the dispatch
409 -- table from the parent before the assignments that initialize the
410 -- overridden primitives.
414 -- type CPP_TypG is array (1 .. CPP_Nb_Prims) ofd Prim_Ptr;
415 -- type CPP_TypH is access CPP_TypG;
416 -- CPP_TypG!(Typ_Tag).all := CPP_TypG!(Parent_Tag).all;
418 -- Note: There is no need to duplicate the declarations of CPP_TypG and
419 -- CPP_TypH because, for expansion of dispatching calls, these
420 -- entities are stored in the last elements of Access_Disp_Table.
422 for J in CPP_Table'Range loop
423 if not CPP_Table (J) then
425 Make_Assignment_Statement (Loc,
427 Make_Explicit_Dereference (Loc,
429 (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
430 New_Reference_To (Typ_Tag, Loc))),
432 Make_Explicit_Dereference (Loc,
434 (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
435 New_Reference_To (Parent_Tag, Loc)))));
440 -- Stage 2: Inherit and override C++ slots of secondary dispatch tables
444 Iface_Nb_Prims : Nat;
445 Parent_Ifaces_List : Elist_Id;
446 Parent_Ifaces_Comp_List : Elist_Id;
447 Parent_Ifaces_Tag_List : Elist_Id;
448 Parent_Iface_Tag_Elmt : Elmt_Id;
449 Typ_Ifaces_List : Elist_Id;
450 Typ_Ifaces_Comp_List : Elist_Id;
451 Typ_Ifaces_Tag_List : Elist_Id;
452 Typ_Iface_Tag_Elmt : Elmt_Id;
455 Collect_Interfaces_Info
457 Ifaces_List => Parent_Ifaces_List,
458 Components_List => Parent_Ifaces_Comp_List,
459 Tags_List => Parent_Ifaces_Tag_List);
461 Collect_Interfaces_Info
463 Ifaces_List => Typ_Ifaces_List,
464 Components_List => Typ_Ifaces_Comp_List,
465 Tags_List => Typ_Ifaces_Tag_List);
467 Parent_Iface_Tag_Elmt := First_Elmt (Parent_Ifaces_Tag_List);
468 Typ_Iface_Tag_Elmt := First_Elmt (Typ_Ifaces_Tag_List);
469 while Present (Parent_Iface_Tag_Elmt) loop
470 Parent_Tag := Node (Parent_Iface_Tag_Elmt);
471 Typ_Tag := Node (Typ_Iface_Tag_Elmt);
474 (Related_Type (Parent_Tag) = Related_Type (Typ_Tag));
475 Iface := Related_Type (Parent_Tag);
478 UI_To_Int (DT_Entry_Count (First_Tag_Component (Iface)));
480 if Iface_Nb_Prims > 0 then
482 -- Update slots of overridden primitives
485 Last_Nod : constant Node_Id := Last (Result);
486 Nb_Prims : constant Nat := UI_To_Int
488 (First_Tag_Component (Iface)));
494 Prims_Table : array (1 .. Nb_Prims) of Boolean;
497 Prims_Table := (others => False);
499 Elmt := First_Elmt (Primitive_Operations (Typ));
500 while Present (Elmt) loop
502 E := Ultimate_Alias (Prim);
504 if not Is_Predefined_Dispatching_Operation (Prim)
505 and then Present (Interface_Alias (Prim))
506 and then Find_Dispatching_Type (Interface_Alias (Prim))
508 and then not Is_Abstract_Subprogram (E)
509 and then not Is_Eliminated (E)
510 and then Find_Dispatching_Type (E) = Typ
512 Prim_Pos := UI_To_Int (DT_Position (Prim));
514 -- Remember that this slot is already initialized
516 pragma Assert (Prims_Table (Prim_Pos) = False);
517 Prims_Table (Prim_Pos) := True;
520 Make_Assignment_Statement (Loc,
522 Make_Indexed_Component (Loc,
524 Make_Explicit_Dereference (Loc,
528 (Access_Disp_Table (Iface))),
529 New_Reference_To (Typ_Tag, Loc))),
532 (Make_Integer_Literal (Loc, Prim_Pos))),
535 Unchecked_Convert_To (RTE (RE_Prim_Ptr),
536 Make_Attribute_Reference (Loc,
537 Prefix => New_Reference_To (E, Loc),
539 Name_Unrestricted_Access))));
545 -- Check if all primitives from the parent have been
546 -- overridden (to avoid copying the whole secondary
547 -- table from the parent).
549 -- IfaceG!(Typ_Sec_Tag).all := IfaceG!(Parent_Sec_Tag).all;
551 for J in Prims_Table'Range loop
552 if not Prims_Table (J) then
553 Insert_After (Last_Nod,
554 Make_Assignment_Statement (Loc,
556 Make_Explicit_Dereference (Loc,
558 (Node (Last_Elmt (Access_Disp_Table (Iface))),
559 New_Reference_To (Typ_Tag, Loc))),
561 Make_Explicit_Dereference (Loc,
563 (Node (Last_Elmt (Access_Disp_Table (Iface))),
564 New_Reference_To (Parent_Tag, Loc)))));
571 Next_Elmt (Typ_Iface_Tag_Elmt);
572 Next_Elmt (Parent_Iface_Tag_Elmt);
577 end Build_Inherit_CPP_Prims;
579 -------------------------
580 -- Build_Inherit_Prims --
581 -------------------------
583 function Build_Inherit_Prims
586 Old_Tag_Node : Node_Id;
587 New_Tag_Node : Node_Id;
588 Num_Prims : Nat) return Node_Id
591 if RTE_Available (RE_DT) then
593 Make_Assignment_Statement (Loc,
597 Make_Selected_Component (Loc,
599 Build_DT (Loc, New_Tag_Node),
602 (RTE_Record_Component (RE_Prims_Ptr), Loc)),
605 Low_Bound => Make_Integer_Literal (Loc, 1),
606 High_Bound => Make_Integer_Literal (Loc, Num_Prims))),
611 Make_Selected_Component (Loc,
613 Build_DT (Loc, Old_Tag_Node),
616 (RTE_Record_Component (RE_Prims_Ptr), Loc)),
619 Low_Bound => Make_Integer_Literal (Loc, 1),
620 High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
623 Make_Assignment_Statement (Loc,
628 (Node (Last_Elmt (Access_Disp_Table (Typ))),
632 Low_Bound => Make_Integer_Literal (Loc, 1),
633 High_Bound => Make_Integer_Literal (Loc, Num_Prims))),
639 (Node (Last_Elmt (Access_Disp_Table (Typ))),
643 Low_Bound => Make_Integer_Literal (Loc, 1),
644 High_Bound => Make_Integer_Literal (Loc, Num_Prims))));
646 end Build_Inherit_Prims;
648 -------------------------------
649 -- Build_Get_Prim_Op_Address --
650 -------------------------------
652 procedure Build_Get_Prim_Op_Address
656 Tag_Node : in out Node_Id;
657 New_Node : out Node_Id)
659 New_Prefix : Node_Id;
663 (Position <= DT_Entry_Count (First_Tag_Component (Typ)));
665 -- At the end of the Access_Disp_Table list we have the type
666 -- declaration required to convert the tag into a pointer to
667 -- the prims_ptr table (see Freeze_Record_Type).
671 (Node (Last_Elmt (Access_Disp_Table (Typ))), Tag_Node);
673 -- Unchecked_Convert_To relocates the controlling tag node and therefore
674 -- we must update it.
676 Tag_Node := Expression (New_Prefix);
679 Make_Indexed_Component (Loc,
680 Prefix => New_Prefix,
681 Expressions => New_List (Make_Integer_Literal (Loc, Position)));
682 end Build_Get_Prim_Op_Address;
684 -----------------------------
685 -- Build_Get_Transportable --
686 -----------------------------
688 function Build_Get_Transportable
690 Tag_Node : Node_Id) return Node_Id
694 Make_Selected_Component (Loc,
697 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
700 (RTE_Record_Component (RE_Transportable), Loc));
701 end Build_Get_Transportable;
703 ------------------------------------
704 -- Build_Inherit_Predefined_Prims --
705 ------------------------------------
707 function Build_Inherit_Predefined_Prims
709 Old_Tag_Node : Node_Id;
710 New_Tag_Node : Node_Id) return Node_Id
714 Make_Assignment_Statement (Loc,
718 Make_Explicit_Dereference (Loc,
719 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
720 Make_Explicit_Dereference (Loc,
721 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
723 Discrete_Range => Make_Range (Loc,
724 Make_Integer_Literal (Loc, Uint_1),
725 New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))),
730 Make_Explicit_Dereference (Loc,
731 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
732 Make_Explicit_Dereference (Loc,
733 Unchecked_Convert_To (RTE (RE_Addr_Ptr),
737 Make_Integer_Literal (Loc, 1),
738 New_Reference_To (RTE (RE_Max_Predef_Prims), Loc))));
739 end Build_Inherit_Predefined_Prims;
741 -------------------------
742 -- Build_Offset_To_Top --
743 -------------------------
745 function Build_Offset_To_Top
747 This_Node : Node_Id) return Node_Id
753 Make_Explicit_Dereference (Loc,
754 Unchecked_Convert_To (RTE (RE_Tag_Ptr), This_Node));
757 Make_Explicit_Dereference (Loc,
758 Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
759 Make_Function_Call (Loc,
761 Make_Expanded_Name (Loc,
762 Chars => Name_Op_Subtract,
765 (RTU_Entity (System_Storage_Elements), Loc),
766 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
767 Parameter_Associations => New_List (
768 Unchecked_Convert_To (RTE (RE_Address), Tag_Node),
770 (RTE (RE_DT_Offset_To_Top_Offset), Loc)))));
771 end Build_Offset_To_Top;
773 ------------------------------------------
774 -- Build_Set_Predefined_Prim_Op_Address --
775 ------------------------------------------
777 function Build_Set_Predefined_Prim_Op_Address
781 Address_Node : Node_Id) return Node_Id
785 Make_Assignment_Statement (Loc,
787 Make_Indexed_Component (Loc,
789 Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
790 Make_Explicit_Dereference (Loc,
791 Unchecked_Convert_To (RTE (RE_Addr_Ptr), Tag_Node))),
793 New_List (Make_Integer_Literal (Loc, Position))),
795 Expression => Address_Node);
796 end Build_Set_Predefined_Prim_Op_Address;
798 -------------------------------
799 -- Build_Set_Prim_Op_Address --
800 -------------------------------
802 function Build_Set_Prim_Op_Address
807 Address_Node : Node_Id) return Node_Id
809 Ctrl_Tag : Node_Id := Tag_Node;
813 Build_Get_Prim_Op_Address (Loc, Typ, Position, Ctrl_Tag, New_Node);
816 Make_Assignment_Statement (Loc,
818 Expression => Address_Node);
819 end Build_Set_Prim_Op_Address;
821 -----------------------------
822 -- Build_Set_Size_Function --
823 -----------------------------
825 function Build_Set_Size_Function
828 Size_Func : Entity_Id) return Node_Id is
830 pragma Assert (Chars (Size_Func) = Name_uSize
831 and then RTE_Record_Component_Available (RE_Size_Func));
833 Make_Assignment_Statement (Loc,
835 Make_Selected_Component (Loc,
838 Unchecked_Convert_To (RTE (RE_Address), Tag_Node)),
841 (RTE_Record_Component (RE_Size_Func), Loc)),
843 Unchecked_Convert_To (RTE (RE_Size_Ptr),
844 Make_Attribute_Reference (Loc,
845 Prefix => New_Reference_To (Size_Func, Loc),
846 Attribute_Name => Name_Unrestricted_Access)));
847 end Build_Set_Size_Function;
849 ------------------------------------
850 -- Build_Set_Static_Offset_To_Top --
851 ------------------------------------
853 function Build_Set_Static_Offset_To_Top
856 Offset_Value : Node_Id) return Node_Id is
859 Make_Assignment_Statement (Loc,
860 Make_Explicit_Dereference (Loc,
861 Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
862 Make_Function_Call (Loc,
864 Make_Expanded_Name (Loc,
865 Chars => Name_Op_Subtract,
868 (RTU_Entity (System_Storage_Elements), Loc),
869 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
870 Parameter_Associations => New_List (
871 Unchecked_Convert_To (RTE (RE_Address), Iface_Tag),
873 (RTE (RE_DT_Offset_To_Top_Offset), Loc))))),
875 end Build_Set_Static_Offset_To_Top;
883 Tag_Node_Addr : Node_Id) return Node_Id is
886 Unchecked_Convert_To (RTE (RE_Type_Specific_Data_Ptr),
887 Make_Explicit_Dereference (Loc,
888 Prefix => Unchecked_Convert_To (RTE (RE_Addr_Ptr),
889 Make_Function_Call (Loc,
891 Make_Expanded_Name (Loc,
892 Chars => Name_Op_Subtract,
895 (RTU_Entity (System_Storage_Elements), Loc),
896 Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
898 Parameter_Associations => New_List (
901 (RTE (RE_DT_Typeinfo_Ptr_Size), Loc))))));