OSDN Git Service

* haifa-sched.c (extend_global): Split to extend_global_data and
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-auxdec-vms_64.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                       S Y S T E M . A U X _ D E C                        --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1996-2008, Free Software Foundation, Inc.         --
10 --                                                                          --
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 2,  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 COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package contains definitions that are designed to be compatible
35 --  with the extra definitions in package System for DEC Ada implementations.
36
37 --  These definitions can be used directly by withing this package, or merged
38 --  with System using pragma Extend_System (Aux_DEC)
39
40 --  This is the VMS 64 bit version
41
42 with Ada.Unchecked_Conversion;
43
44 package System.Aux_DEC is
45    pragma Preelaborate;
46
47    type Short_Integer_Address is
48      range -2 ** (32 - 1) .. +2 ** (32 - 1) - 1;
49    --  Integer literals cannot appear naked in an address context, as a
50    --  result the bounds of Short_Address cannot be given simply as 2^32 etc.
51
52    subtype Short_Address is Address
53      range Address (Short_Integer_Address'First) ..
54            Address (Short_Integer_Address'Last);
55    for Short_Address'Object_Size use 32;
56    --  This subtype allows addresses to be converted from 64 bits to 32 bits
57    --  with an appropriate range check. Note that since this is a subtype of
58    --  type System.Address, the same limitations apply to this subtype. Namely
59    --  there are no visible arithmetic operations, and integer literals are
60    --  not available.
61
62    Short_Memory_Size : constant := 2 ** 32;
63    --  Defined for convenience of porting
64
65    type Integer_8  is range -2 **  (8 - 1) .. +2 **  (8 - 1) - 1;
66    for Integer_8'Size  use  8;
67
68    type Integer_16 is range -2 ** (16 - 1) .. +2 ** (16 - 1) - 1;
69    for Integer_16'Size use 16;
70
71    type Integer_32 is range -2 ** (32 - 1) .. +2 ** (32 - 1) - 1;
72    for Integer_32'Size use 32;
73
74    type Integer_64 is range -2 ** (64 - 1) .. +2 ** (64 - 1) - 1;
75    for Integer_64'Size use 64;
76
77    type Largest_Integer is range Min_Int .. Max_Int;
78
79    type AST_Handler is private;
80
81    No_AST_Handler : constant AST_Handler;
82
83    type Type_Class is
84      (Type_Class_Enumeration,
85       Type_Class_Integer,
86       Type_Class_Fixed_Point,
87       Type_Class_Floating_Point,
88       Type_Class_Array,
89       Type_Class_Record,
90       Type_Class_Access,
91       Type_Class_Task,             -- also in Ada 95 protected
92       Type_Class_Address);
93
94    function "not" (Left        : Largest_Integer) return Largest_Integer;
95    function "and" (Left, Right : Largest_Integer) return Largest_Integer;
96    function "or"  (Left, Right : Largest_Integer) return Largest_Integer;
97    function "xor" (Left, Right : Largest_Integer) return Largest_Integer;
98
99    Address_Zero       : constant Address;
100    No_Addr            : constant Address;
101    Address_Size       : constant := Standard'Address_Size;
102    Short_Address_Size : constant := 32;
103
104    function "+" (Left : Address; Right : Integer) return Address;
105    function "+" (Left : Integer; Right : Address) return Address;
106    function "-" (Left : Address; Right : Address) return Integer;
107    function "-" (Left : Address; Right : Integer) return Address;
108
109    generic
110       type Target is private;
111    function Fetch_From_Address (A : Address) return Target;
112
113    generic
114       type Target is private;
115    procedure Assign_To_Address (A : Address; T : Target);
116
117    --  Floating point type declarations for VAX floating point data types
118
119    pragma Warnings (Off);
120
121    type F_Float is digits 6;
122    pragma Float_Representation (VAX_Float, F_Float);
123
124    type D_Float is digits 9;
125    pragma Float_Representation (Vax_Float, D_Float);
126
127    type G_Float is digits 15;
128    pragma Float_Representation (Vax_Float, G_Float);
129
130    --  Floating point type declarations for IEEE floating point data types
131
132    type IEEE_Single_Float is digits 6;
133    pragma Float_Representation (IEEE_Float, IEEE_Single_Float);
134
135    type IEEE_Double_Float is digits 15;
136    pragma Float_Representation (IEEE_Float, IEEE_Double_Float);
137
138    pragma Warnings (On);
139
140    Non_Ada_Error : exception;
141
142    --  Hardware-oriented types and functions
143
144    type Bit_Array is array (Integer range <>) of Boolean;
145    pragma Pack (Bit_Array);
146
147    subtype Bit_Array_8  is Bit_Array (0 ..  7);
148    subtype Bit_Array_16 is Bit_Array (0 .. 15);
149    subtype Bit_Array_32 is Bit_Array (0 .. 31);
150    subtype Bit_Array_64 is Bit_Array (0 .. 63);
151
152    type Unsigned_Byte is range 0 .. 255;
153    for  Unsigned_Byte'Size use 8;
154
155    function "not" (Left        : Unsigned_Byte) return Unsigned_Byte;
156    function "and" (Left, Right : Unsigned_Byte) return Unsigned_Byte;
157    function "or"  (Left, Right : Unsigned_Byte) return Unsigned_Byte;
158    function "xor" (Left, Right : Unsigned_Byte) return Unsigned_Byte;
159
160    function To_Unsigned_Byte (X : Bit_Array_8) return Unsigned_Byte;
161    function To_Bit_Array_8   (X : Unsigned_Byte) return Bit_Array_8;
162
163    type Unsigned_Byte_Array is array (Integer range <>) of Unsigned_Byte;
164
165    type Unsigned_Word is range 0 .. 65535;
166    for  Unsigned_Word'Size use 16;
167
168    function "not" (Left        : Unsigned_Word) return Unsigned_Word;
169    function "and" (Left, Right : Unsigned_Word) return Unsigned_Word;
170    function "or"  (Left, Right : Unsigned_Word) return Unsigned_Word;
171    function "xor" (Left, Right : Unsigned_Word) return Unsigned_Word;
172
173    function To_Unsigned_Word (X : Bit_Array_16) return Unsigned_Word;
174    function To_Bit_Array_16  (X : Unsigned_Word) return Bit_Array_16;
175
176    type Unsigned_Word_Array is array (Integer range <>) of Unsigned_Word;
177
178    type Unsigned_Longword is range -2_147_483_648 .. 2_147_483_647;
179    for  Unsigned_Longword'Size use 32;
180
181    function "not" (Left        : Unsigned_Longword) return Unsigned_Longword;
182    function "and" (Left, Right : Unsigned_Longword) return Unsigned_Longword;
183    function "or"  (Left, Right : Unsigned_Longword) return Unsigned_Longword;
184    function "xor" (Left, Right : Unsigned_Longword) return Unsigned_Longword;
185
186    function To_Unsigned_Longword (X : Bit_Array_32) return Unsigned_Longword;
187    function To_Bit_Array_32 (X : Unsigned_Longword) return Bit_Array_32;
188
189    type Unsigned_Longword_Array is
190       array (Integer range <>) of Unsigned_Longword;
191
192    type Unsigned_32 is range 0 .. 4_294_967_295;
193    for  Unsigned_32'Size use 32;
194
195    function "not" (Left        : Unsigned_32) return Unsigned_32;
196    function "and" (Left, Right : Unsigned_32) return Unsigned_32;
197    function "or"  (Left, Right : Unsigned_32) return Unsigned_32;
198    function "xor" (Left, Right : Unsigned_32) return Unsigned_32;
199
200    function To_Unsigned_32 (X : Bit_Array_32) return Unsigned_32;
201    function To_Bit_Array_32 (X : Unsigned_32) return Bit_Array_32;
202
203    type Unsigned_Quadword is record
204       L0 : Unsigned_Longword;
205       L1 : Unsigned_Longword;
206    end record;
207
208    for Unsigned_Quadword'Size      use 64;
209    for Unsigned_Quadword'Alignment use
210      Integer'Min (8, Standard'Maximum_Alignment);
211
212    function "not" (Left        : Unsigned_Quadword) return Unsigned_Quadword;
213    function "and" (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
214    function "or"  (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
215    function "xor" (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
216
217    function To_Unsigned_Quadword (X : Bit_Array_64) return Unsigned_Quadword;
218    function To_Bit_Array_64 (X : Unsigned_Quadword) return Bit_Array_64;
219
220    type Unsigned_Quadword_Array is
221       array (Integer range <>) of Unsigned_Quadword;
222
223    function To_Address      (X : Integer)           return Address;
224    pragma Pure_Function (To_Address);
225
226    function To_Address_Long (X : Unsigned_Longword) return Address;
227    pragma Pure_Function (To_Address_Long);
228
229    function To_Integer      (X : Address)           return Integer;
230
231    function To_Unsigned_Longword (X : Address)     return Unsigned_Longword;
232    function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword;
233
234    --  Conventional names for static subtypes of type UNSIGNED_LONGWORD
235
236    subtype Unsigned_1  is Unsigned_Longword range 0 .. 2** 1-1;
237    subtype Unsigned_2  is Unsigned_Longword range 0 .. 2** 2-1;
238    subtype Unsigned_3  is Unsigned_Longword range 0 .. 2** 3-1;
239    subtype Unsigned_4  is Unsigned_Longword range 0 .. 2** 4-1;
240    subtype Unsigned_5  is Unsigned_Longword range 0 .. 2** 5-1;
241    subtype Unsigned_6  is Unsigned_Longword range 0 .. 2** 6-1;
242    subtype Unsigned_7  is Unsigned_Longword range 0 .. 2** 7-1;
243    subtype Unsigned_8  is Unsigned_Longword range 0 .. 2** 8-1;
244    subtype Unsigned_9  is Unsigned_Longword range 0 .. 2** 9-1;
245    subtype Unsigned_10 is Unsigned_Longword range 0 .. 2**10-1;
246    subtype Unsigned_11 is Unsigned_Longword range 0 .. 2**11-1;
247    subtype Unsigned_12 is Unsigned_Longword range 0 .. 2**12-1;
248    subtype Unsigned_13 is Unsigned_Longword range 0 .. 2**13-1;
249    subtype Unsigned_14 is Unsigned_Longword range 0 .. 2**14-1;
250    subtype Unsigned_15 is Unsigned_Longword range 0 .. 2**15-1;
251    subtype Unsigned_16 is Unsigned_Longword range 0 .. 2**16-1;
252    subtype Unsigned_17 is Unsigned_Longword range 0 .. 2**17-1;
253    subtype Unsigned_18 is Unsigned_Longword range 0 .. 2**18-1;
254    subtype Unsigned_19 is Unsigned_Longword range 0 .. 2**19-1;
255    subtype Unsigned_20 is Unsigned_Longword range 0 .. 2**20-1;
256    subtype Unsigned_21 is Unsigned_Longword range 0 .. 2**21-1;
257    subtype Unsigned_22 is Unsigned_Longword range 0 .. 2**22-1;
258    subtype Unsigned_23 is Unsigned_Longword range 0 .. 2**23-1;
259    subtype Unsigned_24 is Unsigned_Longword range 0 .. 2**24-1;
260    subtype Unsigned_25 is Unsigned_Longword range 0 .. 2**25-1;
261    subtype Unsigned_26 is Unsigned_Longword range 0 .. 2**26-1;
262    subtype Unsigned_27 is Unsigned_Longword range 0 .. 2**27-1;
263    subtype Unsigned_28 is Unsigned_Longword range 0 .. 2**28-1;
264    subtype Unsigned_29 is Unsigned_Longword range 0 .. 2**29-1;
265    subtype Unsigned_30 is Unsigned_Longword range 0 .. 2**30-1;
266    subtype Unsigned_31 is Unsigned_Longword range 0 .. 2**31-1;
267
268    --  Function for obtaining global symbol values
269
270    function Import_Value         (Symbol : String) return Unsigned_Longword;
271    function Import_Address       (Symbol : String) return Address;
272    function Import_Largest_Value (Symbol : String) return Largest_Integer;
273
274    pragma Import (Intrinsic, Import_Value);
275    pragma Import (Intrinsic, Import_Address);
276    pragma Import (Intrinsic, Import_Largest_Value);
277
278    --  For the following declarations, note that the declaration without
279    --  a Retry_Count parameter means to retry infinitely. A value of zero
280    --  for the Retry_Count parameter means do not retry.
281
282    --  Interlocked-instruction procedures
283
284    procedure Clear_Interlocked
285      (Bit       : in out Boolean;
286       Old_Value : out Boolean);
287
288    procedure Set_Interlocked
289      (Bit       : in out Boolean;
290       Old_Value : out Boolean);
291
292    type Aligned_Word is record
293       Value : Short_Integer;
294    end record;
295
296    for Aligned_Word'Alignment use
297      Integer'Min (2, Standard'Maximum_Alignment);
298
299    procedure Clear_Interlocked
300      (Bit          : in out Boolean;
301       Old_Value    : out Boolean;
302       Retry_Count  : Natural;
303       Success_Flag : out Boolean);
304
305    procedure Set_Interlocked
306      (Bit          : in out Boolean;
307       Old_Value    : out Boolean;
308       Retry_Count  : Natural;
309       Success_Flag : out Boolean);
310
311    procedure Add_Interlocked
312      (Addend       : Short_Integer;
313       Augend       : in out Aligned_Word;
314       Sign         : out Integer);
315
316    type Aligned_Integer is record
317       Value : Integer;
318    end record;
319
320    for Aligned_Integer'Alignment use
321      Integer'Min (4, Standard'Maximum_Alignment);
322
323    type Aligned_Long_Integer is record
324       Value : Long_Integer;
325    end record;
326
327    for Aligned_Long_Integer'Alignment use
328      Integer'Min (8, Standard'Maximum_Alignment);
329
330    --  For the following declarations, note that the declaration without
331    --  a Retry_Count parameter mean to retry infinitely. A value of zero
332    --  for the Retry_Count means do not retry.
333
334    procedure Add_Atomic
335      (To           : in out Aligned_Integer;
336       Amount       : Integer);
337
338    procedure Add_Atomic
339      (To           : in out Aligned_Integer;
340       Amount       : Integer;
341       Retry_Count  : Natural;
342       Old_Value    : out Integer;
343       Success_Flag : out Boolean);
344
345    procedure Add_Atomic
346      (To           : in out Aligned_Long_Integer;
347       Amount       : Long_Integer);
348
349    procedure Add_Atomic
350      (To           : in out Aligned_Long_Integer;
351       Amount       : Long_Integer;
352       Retry_Count  : Natural;
353       Old_Value    : out Long_Integer;
354       Success_Flag : out Boolean);
355
356    procedure And_Atomic
357      (To           : in out Aligned_Integer;
358       From         : Integer);
359
360    procedure And_Atomic
361      (To           : in out Aligned_Integer;
362       From         : Integer;
363       Retry_Count  : Natural;
364       Old_Value    : out Integer;
365       Success_Flag : out Boolean);
366
367    procedure And_Atomic
368      (To           : in out Aligned_Long_Integer;
369       From         : Long_Integer);
370
371    procedure And_Atomic
372      (To           : in out Aligned_Long_Integer;
373       From         : Long_Integer;
374       Retry_Count  : Natural;
375       Old_Value    : out Long_Integer;
376       Success_Flag : out Boolean);
377
378    procedure Or_Atomic
379      (To           : in out Aligned_Integer;
380       From         : Integer);
381
382    procedure Or_Atomic
383      (To           : in out Aligned_Integer;
384       From         : Integer;
385       Retry_Count  : Natural;
386       Old_Value    : out Integer;
387       Success_Flag : out Boolean);
388
389    procedure Or_Atomic
390      (To           : in out Aligned_Long_Integer;
391       From         : Long_Integer);
392
393    procedure Or_Atomic
394      (To           : in out Aligned_Long_Integer;
395       From         : Long_Integer;
396       Retry_Count  : Natural;
397       Old_Value    : out Long_Integer;
398       Success_Flag : out Boolean);
399
400    type Insq_Status is
401      (Fail_No_Lock, OK_Not_First, OK_First);
402
403    for Insq_Status use
404      (Fail_No_Lock => -1,
405       OK_Not_First => 0,
406       OK_First     => +1);
407
408    type Remq_Status is (
409      Fail_No_Lock,
410      Fail_Was_Empty,
411      OK_Not_Empty,
412      OK_Empty);
413
414    for Remq_Status use
415      (Fail_No_Lock   => -1,
416       Fail_Was_Empty => 0,
417       OK_Not_Empty   => +1,
418       OK_Empty       => +2);
419
420    procedure Insqhi
421      (Item   : Address;
422       Header : Address;
423       Status : out Insq_Status);
424
425    procedure Remqhi
426      (Header : Address;
427       Item   : out Address;
428       Status : out Remq_Status);
429
430    procedure Insqti
431      (Item   : Address;
432       Header : Address;
433       Status : out Insq_Status);
434
435    procedure Remqti
436      (Header : Address;
437       Item   : out Address;
438       Status : out Remq_Status);
439
440 private
441
442    Address_Zero : constant Address := Null_Address;
443    No_Addr      : constant Address := Null_Address;
444
445    --  An AST_Handler value is from a typing point of view simply a pointer
446    --  to a procedure taking a single 64bit parameter. However, this
447    --  is a bit misleading, because the data that this pointer references is
448    --  highly stylized. See body of System.AST_Handling for full details.
449
450    type AST_Handler is access procedure (Param : Long_Integer);
451    No_AST_Handler : constant AST_Handler := null;
452
453    --  Other operators have incorrect profiles. It would be nice to make
454    --  them intrinsic, since the backend can handle them, but the front
455    --  end is not prepared to deal with them, so at least inline them.
456
457    pragma Inline_Always ("+");
458    pragma Inline_Always ("-");
459    pragma Inline_Always ("not");
460    pragma Inline_Always ("and");
461    pragma Inline_Always ("or");
462    pragma Inline_Always ("xor");
463
464    --  Other inlined subprograms
465
466    pragma Inline_Always (Fetch_From_Address);
467    pragma Inline_Always (Assign_To_Address);
468
469    --  Synchronization related subprograms. Mechanism is explicitly set
470    --  so that the critical parameters are passed by reference.
471    --  Without this, the parameters are passed by copy, creating load/store
472    --  race conditions. We also inline them, since this seems more in the
473    --  spirit of the original (hardware intrinsic) routines.
474
475    pragma Export_Procedure
476      (Clear_Interlocked,
477       External        => "system__aux_dec__clear_interlocked__1",
478       Parameter_Types => (Boolean, Boolean),
479       Mechanism       => (Reference, Reference));
480    pragma Export_Procedure
481      (Clear_Interlocked,
482       External        => "system__aux_dec__clear_interlocked__2",
483       Parameter_Types => (Boolean, Boolean, Natural, Boolean),
484       Mechanism       => (Reference, Reference, Value, Reference));
485    pragma Inline_Always (Clear_Interlocked);
486
487    pragma Export_Procedure
488      (Set_Interlocked,
489       External        => "system__aux_dec__set_interlocked__1",
490       Parameter_Types => (Boolean, Boolean),
491       Mechanism       => (Reference, Reference));
492    pragma Export_Procedure
493      (Set_Interlocked,
494       External        => "system__aux_dec__set_interlocked__2",
495       Parameter_Types => (Boolean, Boolean, Natural, Boolean),
496       Mechanism       => (Reference, Reference, Value, Reference));
497    pragma Inline_Always (Set_Interlocked);
498
499    pragma Export_Procedure
500      (Add_Interlocked,
501       External        => "system__aux_dec__add_interlocked__1",
502       Mechanism       => (Value, Reference, Reference));
503    pragma Inline_Always (Add_Interlocked);
504
505    pragma Export_Procedure
506      (Add_Atomic,
507       External        => "system__aux_dec__add_atomic__1",
508       Parameter_Types => (Aligned_Integer, Integer),
509       Mechanism       => (Reference, Value));
510    pragma Export_Procedure
511      (Add_Atomic,
512       External        => "system__aux_dec__add_atomic__2",
513       Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
514       Mechanism       => (Reference, Value, Value, Reference, Reference));
515    pragma Export_Procedure
516      (Add_Atomic,
517       External        => "system__aux_dec__add_atomic__3",
518       Parameter_Types => (Aligned_Long_Integer, Long_Integer),
519       Mechanism       => (Reference, Value));
520    pragma Export_Procedure
521      (Add_Atomic,
522       External        => "system__aux_dec__add_atomic__4",
523       Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
524                           Long_Integer, Boolean),
525       Mechanism       => (Reference, Value, Value, Reference, Reference));
526    pragma Inline_Always (Add_Atomic);
527
528    pragma Export_Procedure
529      (And_Atomic,
530       External        => "system__aux_dec__and_atomic__1",
531       Parameter_Types => (Aligned_Integer, Integer),
532       Mechanism       => (Reference, Value));
533    pragma Export_Procedure
534      (And_Atomic,
535       External        => "system__aux_dec__and_atomic__2",
536       Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
537       Mechanism       => (Reference, Value, Value, Reference, Reference));
538    pragma Export_Procedure
539      (And_Atomic,
540       External        => "system__aux_dec__and_atomic__3",
541       Parameter_Types => (Aligned_Long_Integer, Long_Integer),
542       Mechanism       => (Reference, Value));
543    pragma Export_Procedure
544      (And_Atomic,
545       External        => "system__aux_dec__and_atomic__4",
546       Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
547                           Long_Integer, Boolean),
548       Mechanism       => (Reference, Value, Value, Reference, Reference));
549    pragma Inline_Always (And_Atomic);
550
551    pragma Export_Procedure
552      (Or_Atomic,
553       External        => "system__aux_dec__or_atomic__1",
554       Parameter_Types => (Aligned_Integer, Integer),
555       Mechanism       => (Reference, Value));
556    pragma Export_Procedure
557      (Or_Atomic,
558       External        => "system__aux_dec__or_atomic__2",
559       Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
560       Mechanism       => (Reference, Value, Value, Reference, Reference));
561    pragma Export_Procedure
562      (Or_Atomic,
563       External        => "system__aux_dec__or_atomic__3",
564       Parameter_Types => (Aligned_Long_Integer, Long_Integer),
565       Mechanism       => (Reference, Value));
566    pragma Export_Procedure
567      (Or_Atomic,
568       External        => "system__aux_dec__or_atomic__4",
569       Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
570                           Long_Integer, Boolean),
571       Mechanism       => (Reference, Value, Value, Reference, Reference));
572    pragma Inline_Always (Or_Atomic);
573
574    --  Provide proper unchecked conversion definitions for transfer
575    --  functions. Note that we need this level of indirection because
576    --  the formal parameter name is X and not Source (and this is indeed
577    --  detectable by a program)
578
579    function To_Unsigned_Byte_A is new
580      Ada.Unchecked_Conversion (Bit_Array_8, Unsigned_Byte);
581
582    function To_Unsigned_Byte (X : Bit_Array_8) return Unsigned_Byte
583      renames To_Unsigned_Byte_A;
584
585    function To_Bit_Array_8_A is new
586      Ada.Unchecked_Conversion (Unsigned_Byte, Bit_Array_8);
587
588    function To_Bit_Array_8 (X : Unsigned_Byte) return Bit_Array_8
589      renames To_Bit_Array_8_A;
590
591    function To_Unsigned_Word_A is new
592      Ada.Unchecked_Conversion (Bit_Array_16, Unsigned_Word);
593
594    function To_Unsigned_Word (X : Bit_Array_16) return Unsigned_Word
595      renames To_Unsigned_Word_A;
596
597    function To_Bit_Array_16_A is new
598      Ada.Unchecked_Conversion (Unsigned_Word, Bit_Array_16);
599
600    function To_Bit_Array_16 (X : Unsigned_Word) return Bit_Array_16
601      renames To_Bit_Array_16_A;
602
603    function To_Unsigned_Longword_A is new
604      Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_Longword);
605
606    function To_Unsigned_Longword (X : Bit_Array_32) return Unsigned_Longword
607      renames To_Unsigned_Longword_A;
608
609    function To_Bit_Array_32_A is new
610      Ada.Unchecked_Conversion (Unsigned_Longword, Bit_Array_32);
611
612    function To_Bit_Array_32 (X : Unsigned_Longword) return Bit_Array_32
613      renames To_Bit_Array_32_A;
614
615    function To_Unsigned_32_A is new
616      Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_32);
617
618    function To_Unsigned_32 (X : Bit_Array_32) return Unsigned_32
619      renames To_Unsigned_32_A;
620
621    function To_Bit_Array_32_A is new
622      Ada.Unchecked_Conversion (Unsigned_32, Bit_Array_32);
623
624    function To_Bit_Array_32 (X : Unsigned_32) return Bit_Array_32
625      renames To_Bit_Array_32_A;
626
627    function To_Unsigned_Quadword_A is new
628      Ada.Unchecked_Conversion (Bit_Array_64, Unsigned_Quadword);
629
630    function To_Unsigned_Quadword (X : Bit_Array_64) return Unsigned_Quadword
631      renames To_Unsigned_Quadword_A;
632
633    function To_Bit_Array_64_A is new
634      Ada.Unchecked_Conversion (Unsigned_Quadword, Bit_Array_64);
635
636    function To_Bit_Array_64 (X : Unsigned_Quadword) return Bit_Array_64
637      renames To_Bit_Array_64_A;
638
639    pragma Warnings (Off);
640    --  Turn warnings off. This is needed for systems with 64-bit integers,
641    --  where some of these operations are of dubious meaning, but we do not
642    --  want warnings when we compile on such systems.
643
644    function To_Address_A is new
645      Ada.Unchecked_Conversion (Integer, Address);
646    pragma Pure_Function (To_Address_A);
647
648    function To_Address (X : Integer) return Address
649      renames To_Address_A;
650    pragma Pure_Function (To_Address);
651
652    function To_Address_Long_A is new
653      Ada.Unchecked_Conversion (Unsigned_Longword, Address);
654    pragma Pure_Function (To_Address_Long_A);
655
656    function To_Address_Long (X : Unsigned_Longword) return Address
657      renames To_Address_Long_A;
658    pragma Pure_Function (To_Address_Long);
659
660    function To_Integer_A is new
661      Ada.Unchecked_Conversion (Address, Integer);
662
663    function To_Integer (X : Address) return Integer
664      renames To_Integer_A;
665
666    function To_Unsigned_Longword_A is new
667      Ada.Unchecked_Conversion (Address, Unsigned_Longword);
668
669    function To_Unsigned_Longword (X : Address) return Unsigned_Longword
670      renames To_Unsigned_Longword_A;
671
672    function To_Unsigned_Longword_A is new
673      Ada.Unchecked_Conversion (AST_Handler, Unsigned_Longword);
674
675    function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword
676      renames To_Unsigned_Longword_A;
677
678    pragma Warnings (On);
679
680 end System.Aux_DEC;