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