OSDN Git Service

2003-12-11 Ed Falis <falis@gnat.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / layout.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                               L A Y O U T                                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 2000-2001 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package does front-end layout of types and objects. The result is
28 --  to annotate the tree with information on size and alignment of types
29 --  and objects. How much layout is performed depends on the setting of the
30 --  target dependent parameter Backend_Layout.
31
32 with Types; use Types;
33
34 package Layout is
35
36    --  The following procedures are called from Freeze, so all entities
37    --  for types and objects that get frozen (which should be all such
38    --  entities which are seen by the back end) will get layed out by one
39    --  of these two procedures.
40
41    procedure Layout_Type (E : Entity_Id);
42    --  This procedure may set or adjust the fields Esize, RM_Size and
43    --  Alignment in the non-generic type or subtype entity E. If the
44    --  Backend_Layout switch is False, then it is guaranteed that all
45    --  three fields will be properly set on return. Regardless of the
46    --  Backend_Layout value, it is guaranteed that all discrete types
47    --  will have both Esize and RM_Size fields set on return (since
48    --  these are static values). Note that Layout_Type is not called
49    --  for generic types, since these play no part in code generation,
50    --  and hence representation aspects are irrelevant.
51
52    procedure Layout_Object (E : Entity_Id);
53    --  E is either a variable (E_Variable), a constant (E_Constant),
54    --  a loop parameter (E_Loop_Parameter), or a formal parameter of
55    --  a non-generic subprogram (E_In_Parameter, E_In_Out_Parameter,
56    --  or E_Out_Parameter). This procedure may set or adjust the
57    --  Esize and Alignment fields of E. If Backend_Layout is False,
58    --  then it is guaranteed that both fields will be properly set
59    --  on return. If the Esize is still unknown in the latter case,
60    --  it means that the object must be allocated dynamically, since
61    --  its length is not known at compile time.
62
63    procedure Set_Discrete_RM_Size (Def_Id : Entity_Id);
64    --  Set proper RM_Size for discrete size, this is normally the minimum
65    --  number of bits to accommodate the range given, except in the case
66    --  where the subtype statically matches the first subtype, in which
67    --  case the size must be copied from the first subtype. For generic
68    --  types, the RM_Size is simply set to zero. This routine also sets
69    --  the Is_Constrained flag in Def_Id.
70
71    procedure Set_Prim_Alignment (E : Entity_Id);
72    --  The front end always sets alignments for primitive types by calling this
73    --  procedure. Note that we have to do this for discrete types (since the
74    --  Alignment attribute is static), so we might as well do it for all
75    --  scalar types, since the processing is the same.
76
77 end Layout;