OSDN Git Service

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