File : exp_pakd.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT COMPILER COMPONENTS                         --
   4 --                                                                          --
   5 --                             E X P _ P A K D                              --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 --          Copyright (C) 1992-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.  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 COPYING3.  If not, go to --
  19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
  20 --                                                                          --
  21 -- GNAT was originally developed  by the GNAT team at  New York University. --
  22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  23 --                                                                          --
  24 ------------------------------------------------------------------------------
  25 
  26 --  Expand routines for manipulation of packed arrays
  27 
  28 with Rtsfind; use Rtsfind;
  29 with Types;   use Types;
  30 
  31 package Exp_Pakd is
  32 
  33    -------------------------------------
  34    -- Implementation of Packed Arrays --
  35    -------------------------------------
  36 
  37    --  When a packed array (sub)type is frozen, we create a corresponding
  38    --  type that will be used to hold the bits of the packed value, and store
  39    --  the entity for this type in the Packed_Array_Impl_Type field of the
  40    --  E_Array_Type or E_Array_Subtype entity for the packed array.
  41 
  42    --  This packed array type has the name xxxPn, where xxx is the name
  43    --  of the packed type, and n is the component size. The expanded
  44    --  declaration declares a type that is one of the following:
  45 
  46    --    For an unconstrained array with component size 1,2,4 or any other
  47    --    odd component size. These are the cases in which we do not need
  48    --    to align the underlying array.
  49 
  50    --      type xxxPn is new Packed_Bytes1;
  51 
  52    --    For an unconstrained array with component size that is divisible
  53    --    by 2, but not divisible by 4 (other than 2 itself). These are the
  54    --    cases in which we can generate better code if the underlying array
  55    --    is 2-byte aligned (see System.Pack_14 in file s-pack14 for example).
  56 
  57    --      type xxxPn is new Packed_Bytes2;
  58 
  59    --    For an unconstrained array with component size that is divisible
  60    --    by 4, other than powers of 2 (which either come under the 1,2,4
  61    --    exception above, or are not packed at all). These are cases where
  62    --    we can generate better code if the underlying array is 4-byte
  63    --    aligned (see System.Pack_20 in file s-pack20 for example).
  64 
  65    --      type xxxPn is new Packed_Bytes4;
  66 
  67    --    For a constrained array with a static index type where the number
  68    --    of bits does not exceed the size of Unsigned:
  69 
  70    --      type xxxPn is new Unsigned range 0 .. 2 ** nbits - 1;
  71 
  72    --    For a constrained array with a static index type where the number
  73    --    of bits is greater than the size of Unsigned, but does not exceed
  74    --    the size of Long_Long_Unsigned:
  75 
  76    --       type xxxPn is new Long_Long_Unsigned range 0 .. 2 ** nbits - 1;
  77 
  78    --    For all other constrained arrays, we use one of
  79 
  80    --       type xxxPn is new Packed_Bytes1 (0 .. m);
  81    --       type xxxPn is new Packed_Bytes2 (0 .. m);
  82    --       type xxxPn is new Packed_Bytes4 (0 .. m);
  83 
  84    --    where m is calculated (from the length of the original packed array)
  85    --    to hold the required number of bits, and the choice of the particular
  86    --    Packed_Bytes{1,2,4} type is made on the basis of alignment needs as
  87    --    described above for the unconstrained case.
  88 
  89    --  When a variable of packed array type is allocated, gigi will allocate
  90    --  the amount of space indicated by the corresponding packed array type.
  91    --  However, we do NOT attempt to rewrite the types of any references or
  92    --  to retype the variable itself, since this would cause all kinds of
  93    --  semantic problems in the front end (remember that expansion proceeds
  94    --  at the same time as analysis).
  95 
  96    --  For an indexed reference to a packed array, we simply convert the
  97    --  reference to the appropriate equivalent reference to the object
  98    --  of the packed array type (using unchecked conversion).
  99 
 100    --  In some cases (for internally generated types, and for the subtypes
 101    --  for record fields that depend on a discriminant), the corresponding
 102    --  packed type cannot be easily generated in advance. In these cases,
 103    --  we generate the required subtype on the fly at the reference point.
 104 
 105    --  For the modular case, any unused bits are initialized to zero, and
 106    --  all operations maintain these bits as zero (where necessary all
 107    --  unchecked conversions from corresponding array values require
 108    --  these bits to be clear, which is done automatically by gigi).
 109 
 110    --  For the array cases, there can be unused bits in the last byte, and
 111    --  these are neither initialized, nor treated specially in operations
 112    --  (i.e. it is allowable for these bits to be clobbered, e.g. by not).
 113 
 114    ---------------------------
 115    -- Endian Considerations --
 116    ---------------------------
 117 
 118    --  The standard does not specify the way in which bits are numbered in
 119    --  a packed array. There are two reasonable rules for deciding this:
 120 
 121    --    Store the first bit at right end (low order) word. This means
 122    --    that the scaled subscript can be used directly as a left shift
 123    --    count (if we put bit 0 at the left end, then we need an extra
 124    --    subtract to compute the shift count).
 125 
 126    --    Layout the bits so that if the packed boolean array is overlaid on
 127    --    a record, using unchecked conversion, then bit 0 of the array is
 128    --    the same as the bit numbered bit 0 in a record representation
 129    --    clause applying to the record. For example:
 130 
 131    --       type Rec is record
 132    --          C : Bits4;
 133    --          D : Bits7;
 134    --          E : Bits5;
 135    --       end record;
 136 
 137    --       for Rec use record
 138    --          C at 0 range  0  .. 3;
 139    --          D at 0 range  4 .. 10;
 140    --          E at 0 range 11 .. 15;
 141    --       end record;
 142 
 143    --       type P16 is array (0 .. 15) of Boolean;
 144    --       pragma Pack (P16);
 145 
 146    --    Now if we use unchecked conversion to convert a value of the record
 147    --    type to the packed array type, according to this second criterion,
 148    --    we would expect field D to occupy bits 4..10 of the Boolean array.
 149 
 150    --  Although not required, this correspondence seems a highly desirable
 151    --  property, and is one that GNAT decides to guarantee. For a little
 152    --  endian machine, we can also meet the first requirement, but for a
 153    --  big endian machine, it will be necessary to store the first bit of
 154    --  a Boolean array in the left end (most significant) bit of the word.
 155    --  This may cost an extra instruction on some machines, but we consider
 156    --  that a worthwhile price to pay for the consistency.
 157 
 158    --  One more important point arises in the case where we have a constrained
 159    --  subtype of an unconstrained array. Take the case of 20 bits. For the
 160    --  unconstrained representation, we would use an array of bytes:
 161 
 162    --     Little-endian case
 163    --       8-7-6-5-4-3-2-1  16-15-14-13-12-11-10-9  x-x-x-x-20-19-18-17
 164 
 165    --     Big-endian case
 166    --       1-2-3-4-5-6-7-8  9-10-11-12-13-14-15-16  17-18-19-20-x-x-x-x
 167 
 168    --   For the constrained case, we use a 20-bit modular value, but in
 169    --   general this value may well be stored in 32 bits. Let's look at
 170    --   what it looks like:
 171 
 172    --     Little-endian case
 173 
 174    --       x-x-x-x-x-x-x-x-x-x-x-x-20-19-18-17-...-10-9-8-7-6-5-4-3-2-1
 175 
 176    --         which stored in memory looks like
 177 
 178    --       8-7-...-2-1  16-15-...-10-9  x-x-x-x-20-19-18-17  x-x-x-x-x-x-x
 179 
 180    --   An important rule is that the constrained and unconstrained cases
 181    --   must have the same bit representation in memory, since we will often
 182    --   convert from one to the other (e.g. when calling a procedure whose
 183    --   formal is unconstrained). As we see, that criterion is met for the
 184    --   little-endian case above. Now let's look at the big-endian case:
 185 
 186    --     Big-endian case
 187 
 188    --       x-x-x-x-x-x-x-x-x-x-x-x-1-2-3-4-5-6-7-8-9-10-...-17-18-19-20
 189 
 190    --         which stored in memory looks like
 191 
 192    --       x-x-x-x-x-x-x-x  x-x-x-x-1-2-3-4  5-6-...11-12  13-14-...-19-20
 193 
 194    --   That won't do, the representation value in memory is NOT the same in
 195    --   the constrained and unconstrained case. The solution is to store the
 196    --   modular value left-justified:
 197 
 198    --       1-2-3-4-5-6-7-8-9-10-...-17-18-19-20-x-x-x-x-x-x-x-x-x-x-x
 199 
 200    --         which stored in memory looks like
 201 
 202    --       1-2-...-7-8  9-10-...15-16  17-18-19-20-x-x-x-x  x-x-x-x-x-x-x-x
 203 
 204    --   and now, we do indeed have the same representation for the memory
 205    --   version in the constrained and unconstrained cases.
 206 
 207    ----------------------------------------------
 208    -- Entity Tables for Packed Access Routines --
 209    ----------------------------------------------
 210 
 211    --  For the cases of component size = 3,5-7,9-15,17-31,33-63 we call library
 212    --  routines. These tables provide the entity for the proper routine. They
 213    --  are exposed in the spec to allow checking for the presence of the needed
 214    --  routine when an array is subject to pragma Pack.
 215 
 216    type E_Array is array (Int range 01 .. 63) of RE_Id;
 217 
 218    --  Array of Bits_nn entities. Note that we do not use library routines
 219    --  for the 8-bit and 16-bit cases, but we still fill in the table, using
 220    --  entries from System.Unsigned, because we also use this table for
 221    --  certain special unchecked conversions in the big-endian case.
 222 
 223    Bits_Id : constant E_Array :=
 224      (01 => RE_Bits_1,
 225       02 => RE_Bits_2,
 226       03 => RE_Bits_03,
 227       04 => RE_Bits_4,
 228       05 => RE_Bits_05,
 229       06 => RE_Bits_06,
 230       07 => RE_Bits_07,
 231       08 => RE_Unsigned_8,
 232       09 => RE_Bits_09,
 233       10 => RE_Bits_10,
 234       11 => RE_Bits_11,
 235       12 => RE_Bits_12,
 236       13 => RE_Bits_13,
 237       14 => RE_Bits_14,
 238       15 => RE_Bits_15,
 239       16 => RE_Unsigned_16,
 240       17 => RE_Bits_17,
 241       18 => RE_Bits_18,
 242       19 => RE_Bits_19,
 243       20 => RE_Bits_20,
 244       21 => RE_Bits_21,
 245       22 => RE_Bits_22,
 246       23 => RE_Bits_23,
 247       24 => RE_Bits_24,
 248       25 => RE_Bits_25,
 249       26 => RE_Bits_26,
 250       27 => RE_Bits_27,
 251       28 => RE_Bits_28,
 252       29 => RE_Bits_29,
 253       30 => RE_Bits_30,
 254       31 => RE_Bits_31,
 255       32 => RE_Unsigned_32,
 256       33 => RE_Bits_33,
 257       34 => RE_Bits_34,
 258       35 => RE_Bits_35,
 259       36 => RE_Bits_36,
 260       37 => RE_Bits_37,
 261       38 => RE_Bits_38,
 262       39 => RE_Bits_39,
 263       40 => RE_Bits_40,
 264       41 => RE_Bits_41,
 265       42 => RE_Bits_42,
 266       43 => RE_Bits_43,
 267       44 => RE_Bits_44,
 268       45 => RE_Bits_45,
 269       46 => RE_Bits_46,
 270       47 => RE_Bits_47,
 271       48 => RE_Bits_48,
 272       49 => RE_Bits_49,
 273       50 => RE_Bits_50,
 274       51 => RE_Bits_51,
 275       52 => RE_Bits_52,
 276       53 => RE_Bits_53,
 277       54 => RE_Bits_54,
 278       55 => RE_Bits_55,
 279       56 => RE_Bits_56,
 280       57 => RE_Bits_57,
 281       58 => RE_Bits_58,
 282       59 => RE_Bits_59,
 283       60 => RE_Bits_60,
 284       61 => RE_Bits_61,
 285       62 => RE_Bits_62,
 286       63 => RE_Bits_63);
 287 
 288    --  Array of Get routine entities. These are used to obtain an element from
 289    --  a packed array. The N'th entry is used to obtain elements from a packed
 290    --  array whose component size is N. RE_Null is used as a null entry, for
 291    --  the cases where a library routine is not used.
 292 
 293    Get_Id : constant E_Array :=
 294      (01 => RE_Null,
 295       02 => RE_Null,
 296       03 => RE_Get_03,
 297       04 => RE_Null,
 298       05 => RE_Get_05,
 299       06 => RE_Get_06,
 300       07 => RE_Get_07,
 301       08 => RE_Null,
 302       09 => RE_Get_09,
 303       10 => RE_Get_10,
 304       11 => RE_Get_11,
 305       12 => RE_Get_12,
 306       13 => RE_Get_13,
 307       14 => RE_Get_14,
 308       15 => RE_Get_15,
 309       16 => RE_Null,
 310       17 => RE_Get_17,
 311       18 => RE_Get_18,
 312       19 => RE_Get_19,
 313       20 => RE_Get_20,
 314       21 => RE_Get_21,
 315       22 => RE_Get_22,
 316       23 => RE_Get_23,
 317       24 => RE_Get_24,
 318       25 => RE_Get_25,
 319       26 => RE_Get_26,
 320       27 => RE_Get_27,
 321       28 => RE_Get_28,
 322       29 => RE_Get_29,
 323       30 => RE_Get_30,
 324       31 => RE_Get_31,
 325       32 => RE_Null,
 326       33 => RE_Get_33,
 327       34 => RE_Get_34,
 328       35 => RE_Get_35,
 329       36 => RE_Get_36,
 330       37 => RE_Get_37,
 331       38 => RE_Get_38,
 332       39 => RE_Get_39,
 333       40 => RE_Get_40,
 334       41 => RE_Get_41,
 335       42 => RE_Get_42,
 336       43 => RE_Get_43,
 337       44 => RE_Get_44,
 338       45 => RE_Get_45,
 339       46 => RE_Get_46,
 340       47 => RE_Get_47,
 341       48 => RE_Get_48,
 342       49 => RE_Get_49,
 343       50 => RE_Get_50,
 344       51 => RE_Get_51,
 345       52 => RE_Get_52,
 346       53 => RE_Get_53,
 347       54 => RE_Get_54,
 348       55 => RE_Get_55,
 349       56 => RE_Get_56,
 350       57 => RE_Get_57,
 351       58 => RE_Get_58,
 352       59 => RE_Get_59,
 353       60 => RE_Get_60,
 354       61 => RE_Get_61,
 355       62 => RE_Get_62,
 356       63 => RE_Get_63);
 357 
 358    --  Array of Get routine entities to be used in the case where the packed
 359    --  array is itself a component of a packed structure, and therefore may not
 360    --  be fully aligned. This only affects the even sizes, since for the odd
 361    --  sizes, we do not get any fixed alignment in any case.
 362 
 363    GetU_Id : constant E_Array :=
 364      (01 => RE_Null,
 365       02 => RE_Null,
 366       03 => RE_Get_03,
 367       04 => RE_Null,
 368       05 => RE_Get_05,
 369       06 => RE_GetU_06,
 370       07 => RE_Get_07,
 371       08 => RE_Null,
 372       09 => RE_Get_09,
 373       10 => RE_GetU_10,
 374       11 => RE_Get_11,
 375       12 => RE_GetU_12,
 376       13 => RE_Get_13,
 377       14 => RE_GetU_14,
 378       15 => RE_Get_15,
 379       16 => RE_Null,
 380       17 => RE_Get_17,
 381       18 => RE_GetU_18,
 382       19 => RE_Get_19,
 383       20 => RE_GetU_20,
 384       21 => RE_Get_21,
 385       22 => RE_GetU_22,
 386       23 => RE_Get_23,
 387       24 => RE_GetU_24,
 388       25 => RE_Get_25,
 389       26 => RE_GetU_26,
 390       27 => RE_Get_27,
 391       28 => RE_GetU_28,
 392       29 => RE_Get_29,
 393       30 => RE_GetU_30,
 394       31 => RE_Get_31,
 395       32 => RE_Null,
 396       33 => RE_Get_33,
 397       34 => RE_GetU_34,
 398       35 => RE_Get_35,
 399       36 => RE_GetU_36,
 400       37 => RE_Get_37,
 401       38 => RE_GetU_38,
 402       39 => RE_Get_39,
 403       40 => RE_GetU_40,
 404       41 => RE_Get_41,
 405       42 => RE_GetU_42,
 406       43 => RE_Get_43,
 407       44 => RE_GetU_44,
 408       45 => RE_Get_45,
 409       46 => RE_GetU_46,
 410       47 => RE_Get_47,
 411       48 => RE_GetU_48,
 412       49 => RE_Get_49,
 413       50 => RE_GetU_50,
 414       51 => RE_Get_51,
 415       52 => RE_GetU_52,
 416       53 => RE_Get_53,
 417       54 => RE_GetU_54,
 418       55 => RE_Get_55,
 419       56 => RE_GetU_56,
 420       57 => RE_Get_57,
 421       58 => RE_GetU_58,
 422       59 => RE_Get_59,
 423       60 => RE_GetU_60,
 424       61 => RE_Get_61,
 425       62 => RE_GetU_62,
 426       63 => RE_Get_63);
 427 
 428    --  Array of Set routine entities. These are used to assign an element of a
 429    --  packed array. The N'th entry is used to assign elements for a packed
 430    --  array whose component size is N. RE_Null is used as a null entry, for
 431    --  the cases where a library routine is not used.
 432 
 433    Set_Id : constant E_Array :=
 434      (01 => RE_Null,
 435       02 => RE_Null,
 436       03 => RE_Set_03,
 437       04 => RE_Null,
 438       05 => RE_Set_05,
 439       06 => RE_Set_06,
 440       07 => RE_Set_07,
 441       08 => RE_Null,
 442       09 => RE_Set_09,
 443       10 => RE_Set_10,
 444       11 => RE_Set_11,
 445       12 => RE_Set_12,
 446       13 => RE_Set_13,
 447       14 => RE_Set_14,
 448       15 => RE_Set_15,
 449       16 => RE_Null,
 450       17 => RE_Set_17,
 451       18 => RE_Set_18,
 452       19 => RE_Set_19,
 453       20 => RE_Set_20,
 454       21 => RE_Set_21,
 455       22 => RE_Set_22,
 456       23 => RE_Set_23,
 457       24 => RE_Set_24,
 458       25 => RE_Set_25,
 459       26 => RE_Set_26,
 460       27 => RE_Set_27,
 461       28 => RE_Set_28,
 462       29 => RE_Set_29,
 463       30 => RE_Set_30,
 464       31 => RE_Set_31,
 465       32 => RE_Null,
 466       33 => RE_Set_33,
 467       34 => RE_Set_34,
 468       35 => RE_Set_35,
 469       36 => RE_Set_36,
 470       37 => RE_Set_37,
 471       38 => RE_Set_38,
 472       39 => RE_Set_39,
 473       40 => RE_Set_40,
 474       41 => RE_Set_41,
 475       42 => RE_Set_42,
 476       43 => RE_Set_43,
 477       44 => RE_Set_44,
 478       45 => RE_Set_45,
 479       46 => RE_Set_46,
 480       47 => RE_Set_47,
 481       48 => RE_Set_48,
 482       49 => RE_Set_49,
 483       50 => RE_Set_50,
 484       51 => RE_Set_51,
 485       52 => RE_Set_52,
 486       53 => RE_Set_53,
 487       54 => RE_Set_54,
 488       55 => RE_Set_55,
 489       56 => RE_Set_56,
 490       57 => RE_Set_57,
 491       58 => RE_Set_58,
 492       59 => RE_Set_59,
 493       60 => RE_Set_60,
 494       61 => RE_Set_61,
 495       62 => RE_Set_62,
 496       63 => RE_Set_63);
 497 
 498    --  Array of Set routine entities to be used in the case where the packed
 499    --  array is itself a component of a packed structure, and therefore may not
 500    --  be fully aligned. This only affects the even sizes, since for the odd
 501    --  sizes, we do not get any fixed alignment in any case.
 502 
 503    SetU_Id : constant E_Array :=
 504      (01 => RE_Null,
 505       02 => RE_Null,
 506       03 => RE_Set_03,
 507       04 => RE_Null,
 508       05 => RE_Set_05,
 509       06 => RE_SetU_06,
 510       07 => RE_Set_07,
 511       08 => RE_Null,
 512       09 => RE_Set_09,
 513       10 => RE_SetU_10,
 514       11 => RE_Set_11,
 515       12 => RE_SetU_12,
 516       13 => RE_Set_13,
 517       14 => RE_SetU_14,
 518       15 => RE_Set_15,
 519       16 => RE_Null,
 520       17 => RE_Set_17,
 521       18 => RE_SetU_18,
 522       19 => RE_Set_19,
 523       20 => RE_SetU_20,
 524       21 => RE_Set_21,
 525       22 => RE_SetU_22,
 526       23 => RE_Set_23,
 527       24 => RE_SetU_24,
 528       25 => RE_Set_25,
 529       26 => RE_SetU_26,
 530       27 => RE_Set_27,
 531       28 => RE_SetU_28,
 532       29 => RE_Set_29,
 533       30 => RE_SetU_30,
 534       31 => RE_Set_31,
 535       32 => RE_Null,
 536       33 => RE_Set_33,
 537       34 => RE_SetU_34,
 538       35 => RE_Set_35,
 539       36 => RE_SetU_36,
 540       37 => RE_Set_37,
 541       38 => RE_SetU_38,
 542       39 => RE_Set_39,
 543       40 => RE_SetU_40,
 544       41 => RE_Set_41,
 545       42 => RE_SetU_42,
 546       43 => RE_Set_43,
 547       44 => RE_SetU_44,
 548       45 => RE_Set_45,
 549       46 => RE_SetU_46,
 550       47 => RE_Set_47,
 551       48 => RE_SetU_48,
 552       49 => RE_Set_49,
 553       50 => RE_SetU_50,
 554       51 => RE_Set_51,
 555       52 => RE_SetU_52,
 556       53 => RE_Set_53,
 557       54 => RE_SetU_54,
 558       55 => RE_Set_55,
 559       56 => RE_SetU_56,
 560       57 => RE_Set_57,
 561       58 => RE_SetU_58,
 562       59 => RE_Set_59,
 563       60 => RE_SetU_60,
 564       61 => RE_Set_61,
 565       62 => RE_SetU_62,
 566       63 => RE_Set_63);
 567 
 568    -----------------
 569    -- Subprograms --
 570    -----------------
 571 
 572    procedure Create_Packed_Array_Impl_Type (Typ  : Entity_Id);
 573    --  Typ is a array type or subtype to which pragma Pack applies. If the
 574    --  Packed_Array_Impl_Type field of Typ is already set, then the call has
 575    --  no effect, otherwise a suitable type or subtype is created and stored in
 576    --  the Packed_Array_Impl_Type field of Typ. This created type is an Itype
 577    --  so that Gigi will simply elaborate and freeze the type on first use
 578    --  (which is typically the definition of the corresponding array type).
 579    --
 580    --  Note: although this routine is included in the expander package for
 581    --  packed types, it is actually called unconditionally from Freeze,
 582    --  whether or not expansion (and code generation) is enabled. We do this
 583    --  since we want gigi to be able to properly compute type characteristics
 584    --  (for the Data Decomposition Annex of ASIS, and possible other future
 585    --  uses) even if code generation is not active. Strictly this means that
 586    --  this procedure is not part of the expander, but it seems appropriate
 587    --  to keep it together with the other expansion routines that have to do
 588    --  with packed array types.
 589 
 590    procedure Expand_Packed_Boolean_Operator (N : Node_Id);
 591    --  N is an N_Op_And, N_Op_Or or N_Op_Xor node whose operand type is a
 592    --  packed boolean array. This routine expands the appropriate operations
 593    --  to carry out the logical operation on the packed arrays. It handles
 594    --  both the modular and array representation cases.
 595 
 596    procedure Expand_Packed_Element_Reference (N : Node_Id);
 597    --  N is an N_Indexed_Component node whose prefix is a packed array. In
 598    --  the bit packed case, this routine can only be used for the expression
 599    --  evaluation case, not the assignment case, since the result is not a
 600    --  variable. See Expand_Bit_Packed_Element_Set for how the assignment case
 601    --  is handled in the bit packed case. For the enumeration case, the result
 602    --  of this call is always a variable, so the call can be used for both the
 603    --  expression evaluation and assignment cases.
 604 
 605    procedure Expand_Bit_Packed_Element_Set (N : Node_Id);
 606    --  N is an N_Assignment_Statement node whose name is an indexed
 607    --  component of a bit-packed array. This procedure rewrites the entire
 608    --  assignment statement with appropriate code to set the referenced
 609    --  bits of the packed array type object. Note that this procedure is
 610    --  used only for the bit-packed case, not for the enumeration case.
 611 
 612    procedure Expand_Packed_Eq (N : Node_Id);
 613    --  N is an N_Op_Eq node where the operands are packed arrays whose
 614    --  representation is an array-of-bytes type (the case where a modular
 615    --  type is used for the representation does not require any special
 616    --  handling, because in the modular case, unused bits are zeroes.
 617 
 618    procedure Expand_Packed_Not (N : Node_Id);
 619    --  N is an N_Op_Not node where the operand is packed array of Boolean
 620    --  in standard representation (i.e. component size is one bit). This
 621    --  procedure expands the corresponding not operation. Note that the
 622    --  non-standard representation case is handled by using a loop through
 623    --  elements generated by the normal non-packed circuitry.
 624 
 625    function Involves_Packed_Array_Reference (N : Node_Id) return Boolean;
 626    --  N is the node for a name. This function returns true if the name
 627    --  involves a packed array reference. A node involves a packed array
 628    --  reference if it is itself an indexed component referring to a bit-
 629    --  packed array, or it is a selected component whose prefix involves
 630    --  a packed array reference.
 631 
 632    procedure Expand_Packed_Address_Reference (N : Node_Id);
 633    --  The node N is an attribute reference for the 'Address reference, where
 634    --  the prefix involves a packed array reference. This routine expands the
 635    --  necessary code for performing the address reference in this case.
 636 
 637    procedure Expand_Packed_Bit_Reference (N : Node_Id);
 638    --  The node N is an attribute reference for the 'Bit reference, where the
 639    --  prefix involves a packed array reference. This routine expands the
 640    --  necessary code for performing the bit reference in this case.
 641 
 642 end Exp_Pakd;