* arm.md (reload_mulsi3, reload_mulsi_compare0, reload_muladdsi)
[official-gcc.git] / gcc / ada / a-tags.ads
blobdbc5fdb71af1293ff9296a70fca21373cc4c7725
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . T A G S --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
11 -- --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the contents of the part following the private keyword. --
15 -- --
16 -- GNAT is free software; you can redistribute it and/or modify it under --
17 -- terms of the GNU General Public License as published by the Free Soft- --
18 -- ware Foundation; either version 2, or (at your option) any later ver- --
19 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
22 -- for more details. You should have received a copy of the GNU General --
23 -- Public License distributed with GNAT; see file COPYING. If not, write --
24 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
25 -- MA 02111-1307, USA. --
26 -- --
27 -- As a special exception, if other files instantiate generics from this --
28 -- unit, or you link this unit with other files to produce an executable, --
29 -- this unit does not by itself cause the resulting executable to be --
30 -- covered by the GNU General Public License. This exception does not --
31 -- however invalidate any other reasons why the executable file might be --
32 -- covered by the GNU Public License. --
33 -- --
34 -- GNAT was originally developed by the GNAT team at New York University. --
35 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
36 -- --
37 ------------------------------------------------------------------------------
39 with System;
40 with System.Storage_Elements;
42 package Ada.Tags is
44 pragma Elaborate_Body;
46 type Tag is private;
48 function Expanded_Name (T : Tag) return String;
50 function External_Tag (T : Tag) return String;
52 function Internal_Tag (External : String) return Tag;
54 Tag_Error : exception;
56 private
58 ----------------------------------------------------------------
59 -- Abstract procedural interface for the GNAT dispatch table --
60 ----------------------------------------------------------------
62 -- GNAT's Dispatch Table format is customizable in order to match the
63 -- format used in another language. GNAT supports programs that use
64 -- two different dispatch table format at the same time: the native
65 -- format that supports Ada 95 tagged types and which is described in
66 -- Ada.Tags and a foreign format for types that are imported from some
67 -- other language (typically C++) which is described in interfaces.cpp.
68 -- The runtime information kept for each tagged type is separated into
69 -- two objects: the Dispatch Table and the Type Specific Data record.
70 -- These two objects are allocated statically using the constants:
72 -- DT Size = DT_Prologue_Size + Nb_Prim * DT_Entry_Size
73 -- TSD Size = TSD_Prologue_Size + (1 + Idepth) * TSD_Entry_Size
75 -- where Nb_prim is the number of primitive operations of the given
76 -- type and Idepth its inheritance depth.
78 -- The compiler generates calls to the following SET routines to
79 -- initialize those structures and uses the GET functions to
80 -- retreive the information when needed
82 package S renames System;
83 package SSE renames System.Storage_Elements;
85 function CW_Membership (Obj_Tag : Tag; Typ_Tag : Tag) return Boolean;
86 -- Given the tag of an object and the tag associated to a type, return
87 -- true if Obj is in Typ'Class.
89 function Get_Expanded_Name (T : Tag) return S.Address;
90 -- Retrieve the address of a null terminated string containing
91 -- the expanded name
93 function Get_External_Tag (T : Tag) return S.Address;
94 -- Retrieve the address of a null terminated string containing
95 -- the external name
97 function Get_Prim_Op_Address
98 (T : Tag;
99 Position : Positive)
100 return S.Address;
101 -- Given a pointer to a dispatch Table (T) and a position in the DT
102 -- this function returns the address of the virtual function stored
103 -- in it (used for dispatching calls)
105 function Get_Inheritance_Depth (T : Tag) return Natural;
106 -- Given a pointer to a dispatch Table, retrieves the value representing
107 -- the depth in the inheritance tree (used for membership).
109 function Get_RC_Offset (T : Tag) return SSE.Storage_Offset;
110 -- Return the Offset of the implicit record controller when the object
111 -- has controlled components. O otherwise.
113 pragma Export (Ada, Get_RC_Offset, "ada__tags__get_rc_offset");
114 -- This procedure is used in s-finimp to compute the deep routines
115 -- it is exported manually in order to avoid changing completely the
116 -- organization of the run time.
118 function Get_Remotely_Callable (T : Tag) return Boolean;
119 -- Return the value previously set by Set_Remotely_Callable
121 function Get_TSD (T : Tag) return S.Address;
122 -- Given a pointer T to a dispatch Table, retreives the address of the
123 -- record containing the Type Specific Data generated by GNAT
125 procedure Inherit_DT
126 (Old_T : Tag;
127 New_T : Tag;
128 Entry_Count : Natural);
129 -- Entry point used to initialize the DT of a type knowing the tag
130 -- of the direct ancestor and the number of primitive ops that are
131 -- inherited (Entry_Count).
133 procedure Inherit_TSD (Old_TSD : S.Address; New_Tag : Tag);
134 -- Entry point used to initialize the TSD of a type knowing the
135 -- TSD of the direct ancestor.
137 function Parent_Size (Obj : S.Address) return SSE.Storage_Count;
138 -- Computes the size of field _Parent of a tagged extension object
139 -- whose address is 'obj' by calling the indirectly _size function of
140 -- the parent. This function assumes that _size is always in slot 1 of
141 -- the dispatch table.
143 pragma Export (Ada, Parent_Size, "ada__tags__parent_size");
144 -- This procedure is used in s-finimp and is thus exported manually
146 procedure Register_Tag (T : Tag);
147 -- Insert the Tag and its associated external_tag in a table for the
148 -- sake of Internal_Tag
150 procedure Set_Inheritance_Depth
151 (T : Tag;
152 Value : Natural);
153 -- Given a pointer to a dispatch Table, stores the value representing
154 -- the depth in the inheritance tree (the second parameter). Used during
155 -- elaboration of the tagged type.
157 procedure Set_Prim_Op_Address
158 (T : Tag;
159 Position : Positive;
160 Value : S.Address);
161 -- Given a pointer to a dispatch Table (T) and a position in the
162 -- dispatch Table put the address of the virtual function in it
163 -- (used for overriding)
165 procedure Set_TSD (T : Tag; Value : S.Address);
166 -- Given a pointer T to a dispatch Table, stores the address of the record
167 -- containing the Type Specific Data generated by GNAT
169 procedure Set_Expanded_Name (T : Tag; Value : S.Address);
170 -- Set the address of the string containing the expanded name
171 -- in the Dispatch table
173 procedure Set_External_Tag (T : Tag; Value : S.Address);
174 -- Set the address of the string containing the external tag
175 -- in the Dispatch table
177 procedure Set_RC_Offset (T : Tag; Value : SSE.Storage_Offset);
178 -- Sets the Offset of the implicit record controller when the object
179 -- has controlled components. Set to O otherwise.
181 procedure Set_Remotely_Callable (T : Tag; Value : Boolean);
182 -- Set to true if the type has been declared in a context described
183 -- in E.4 (18)
185 DT_Prologue_Size : constant SSE.Storage_Count :=
186 SSE.Storage_Count
187 (Standard'Address_Size / S.Storage_Unit);
188 -- Size of the first part of the dispatch table
190 DT_Entry_Size : constant SSE.Storage_Count :=
191 SSE.Storage_Count
192 (Standard'Address_Size / S.Storage_Unit);
193 -- Size of each primitive operation entry in the Dispatch Table.
195 TSD_Prologue_Size : constant SSE.Storage_Count :=
196 SSE.Storage_Count
197 (6 * Standard'Address_Size / S.Storage_Unit);
198 -- Size of the first part of the type specific data
200 TSD_Entry_Size : constant SSE.Storage_Count :=
201 SSE.Storage_Count (Standard'Address_Size / S.Storage_Unit);
202 -- Size of each ancestor tag entry in the TSD
204 type Address_Array is array (Natural range <>) of S.Address;
206 type Dispatch_Table;
207 type Tag is access all Dispatch_Table;
209 type Type_Specific_Data;
210 type Type_Specific_Data_Ptr is access all Type_Specific_Data;
212 pragma Inline_Always (CW_Membership);
213 pragma Inline_Always (Get_Expanded_Name);
214 pragma Inline_Always (Get_Inheritance_Depth);
215 pragma Inline_Always (Get_Prim_Op_Address);
216 pragma Inline_Always (Get_RC_Offset);
217 pragma Inline_Always (Get_Remotely_Callable);
218 pragma Inline_Always (Get_TSD);
219 pragma Inline_Always (Inherit_DT);
220 pragma Inline_Always (Inherit_TSD);
221 pragma Inline_Always (Register_Tag);
222 pragma Inline_Always (Set_Expanded_Name);
223 pragma Inline_Always (Set_External_Tag);
224 pragma Inline_Always (Set_Inheritance_Depth);
225 pragma Inline_Always (Set_Prim_Op_Address);
226 pragma Inline_Always (Set_RC_Offset);
227 pragma Inline_Always (Set_Remotely_Callable);
228 pragma Inline_Always (Set_TSD);
229 end Ada.Tags;