OSDN Git Service

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