* arm.md (reload_mulsi3, reload_mulsi_compare0, reload_muladdsi)
[official-gcc.git] / gcc / ada / lib-writ.ads
bloba75e7628dbca4fce67b07cca982cb3688850d409
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . W R I T --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 -- --
26 ------------------------------------------------------------------------------
28 -- This package contains the routines for writing the library information
30 package Lib.Writ is
32 -----------------------------------
33 -- Format of Library Information --
34 -----------------------------------
36 -- Note: the contents of the ali file are summarized in the GNAT
37 -- user's guide, so if any non-trivial changes are made to this
38 -- section, they should be reflected in the user's guide.
40 -- This section describes the format of the library information that is
41 -- associated with object files. The exact method of this association is
42 -- potentially implementation dependent and is described and implemented
43 -- in package From the point of view of the description here, all we
44 -- need to know is that the information is represented as a string of
45 -- characters that is somehow associated with an object file, and can be
46 -- retrieved. If no library information exists for a given object file,
47 -- then we take this as equivalent to the non-existence of the object
48 -- file, as if source file has not been previously compiled.
50 -- The library information is written as a series of lines of the form:
52 -- Key_Character parameter parameter ...
54 ------------------
55 -- Header Lines --
56 ------------------
58 -- The initial header lines in the file give information about the
59 -- compilation environment, and identify other special information
60 -- such as main program parameters.
62 -- ----------------
63 -- -- V Version --
64 -- ----------------
66 -- V "xxxxxxxxxxxxxxxx"
68 -- This line indicates the library output version, as defined in
69 -- Gnatvsn. It ensures that separate object modules of a program are
70 -- consistent. It has to be changed if anything changes which would
71 -- affect successful binding of separately compiled modules.
72 -- Examples of such changes are modifications in the format of the
73 -- library info described in this package, or modifications to
74 -- calling sequences, or to the way that data is represented.
76 -- ---------------------
77 -- -- M Main Program --
78 -- ---------------------
80 -- M type [priority] [T=time-slice] W=?
82 -- This line appears only if the main unit for this file is
83 -- suitable for use as a main program. The parameters are:
85 -- type
87 -- P for a parameterless procedure
88 -- F for a function returning a value of integral type
89 -- (used for writing a main program returning an exit status)
91 -- priority
93 -- Present only if there was a valid pragma Priority in the
94 -- corresponding unit to set the main task priority. It is
95 -- an unsigned decimal integer.
97 -- T=time-slice
99 -- Present only if there was a valid pragma Time_Slice in the
100 -- corresponding unit. It is an unsigned decimal integer in
101 -- the range 0 .. 10**9 giving the time slice value in units
102 -- of milliseconds. The actual significance of this parameter
103 -- is target dependent.
105 -- W=?
107 -- This parameter indicates the wide character encoding
108 -- method used when compiling the main program file. The ?
109 -- character is the single character used in the -gnatW?
110 -- switch. This is used to provide the default wide-character
111 -- encoding for Wide_Text_IO files.
113 -- -----------------
114 -- -- A Argument --
115 -- -----------------
117 -- A argument
119 -- One of these lines appears for each of the arguments present
120 -- in the call to the gnat1 program. This can be used if it is
121 -- necessary to reconstruct this call (e.g. for fix and continue)
123 -- -------------------
124 -- -- P Parameters --
125 -- -------------------
127 -- P <<parameters>>
129 -- Indicates various information that applies to the compilation
130 -- of the corresponding source unit. Parameters is a sequence of
131 -- zero or more two letter codes that indicate configuration
132 -- pragmas and other parameters that apply:
134 -- Present if the unit uses tasking directly or indirectly and
135 -- has one or more valid xxx_Policy pragmas that apply to the unit.
136 -- The arguments are as follows:
138 -- CE Compilation errors. If this is present it means that the
139 -- ali file resulted from a compilation with the -gnatQ
140 -- switch set, and illegalities were detected. The ali
141 -- file contents may not be completely reliable, but the
142 -- format will be correct and complete. Note that NO is
143 -- always present if CE is present.
145 -- FD Configuration pragmas apply to all the units in this
146 -- file specifying a possibly non-standard floating point
147 -- format (VAX float with Long_Float using D_Float)
149 -- FG Configuration pragmas apply to all the units in this
150 -- file specifying a possibly non-standard floating point
151 -- format (VAX float with Long_Float using G_Float)
153 -- FI Configuration pragmas apply to all the units in this
154 -- file specifying a possibly non-standard floating point
155 -- format (IEEE Float)
157 -- Lx A valid Locking_Policy pragma applies to all the units
158 -- in this file, where x is the first character (upper case)
159 -- of the policy name (e.g. 'C' for Ceiling_Locking)
161 -- NO No object. This flag indicates that the units in this
162 -- file were not compiled to produce an object. This can
163 -- occur as a result of the use of -gnatc, or if no object
164 -- can be produced (e.g. when a package spec is compiled
165 -- instead of the body, or a subunit on its own).
167 -- NR No_Run_Time pragma in effect for all units in this file
169 -- NS Normalize_Scalars pragma in effect for all units in
170 -- this file
172 -- Qx A valid Queueing_Policy pragma applies to all the units
173 -- in this file, where x is the first character (upper case)
174 -- of the policy name (e.g. 'P' for Priority_Queueing).
176 -- Tx A valid Task_Dispatching_Policy pragma applies to all
177 -- the units in this file, where x is the first character
178 -- (upper case) of the corresponding policy name (e.g. 'F'
179 -- for FIFO_Within_Priorities).
181 -- UA Unreserve_All_Interrupts pragma was processed in one or
182 -- more units in this file
184 -- UX Generated code contains unit exception table pointer
185 -- (i.e. it uses zero-cost exceptions, and there is at
186 -- least one subprogram present).
188 -- ZX Units in this file use zero-cost exceptions and have
189 -- generated exception tables. If ZX is not present, the
190 -- longjmp/setjmp exception scheme is in use.
192 -- Note that language defined units never output policy (Lx,Tx,Qx)
193 -- parameters. Language defined units must correctly handle all
194 -- possible cases. These values are checked for consistency by the
195 -- binder and then copied to the generated binder output file.
197 -- ---------------------
198 -- -- R Restrictions --
199 -- ---------------------
201 -- R <<restriction-characters>>
203 -- This line records information regarding restrictions. The
204 -- parameter is a string of characters, one for each entry in
205 -- Restrict.Compilation_Unit_Restrictions, in order. There are
206 -- three settings possible settings for each restriction:
208 -- r Restricted. Unit was compiled under control of a pragma
209 -- Restrictions for the corresponding restriction. In
210 -- this case the unit certainly does not violate the
211 -- Restriction, since this would have been detected by
212 -- the compiler.
214 -- n Not used. The unit was not compiled under control of a
215 -- pragma Restrictions for the corresponding restriction,
216 -- and does not make any use of the referenced feature.
218 -- v Violated. The unit was not compiled under control of a
219 -- pragma Restrictions for the corresponding restriction,
220 -- and it does indeed use the referenced feature.
222 -- This information is used in the binder to check consistency,
223 -- i.e. to detect cases where one unit has "r" and another unit
224 -- has "v", which is not permitted, since these restrictions
225 -- are partition-wide.
227 ----------------------------
228 -- Compilation Unit Lines --
229 ----------------------------
231 -- Following these header lines, a set of information lines appears for
232 -- each compilation unit that appears in the corresponding object file.
233 -- In particular, when a package body or subprogram body is compiled,
234 -- there will be two sets of information, one for the spec and one for
235 -- the body. with the entry for the body appearing first. This is the
236 -- only case in which a single ALI file contains more than one unit (in
237 -- particular note that subunits do *not* count as compilation units for
238 -- this purpose, and generate no library information, since they are
239 -- inlined).
241 -- --------------------
242 -- -- U Unit Header --
243 -- --------------------
245 -- The lines for each compilation unit have the following form.
247 -- U unit-name source-name version <<attributes>>
249 -- This line identifies the unit to which this section of the
250 -- library information file applies. The first three parameters are
251 -- the unit name in internal format, as described in package Uname,
252 -- and the name of the source file containing the unit.
254 -- Version is the version given as eight hexadecimal characters
255 -- with upper case letters. This value is the exclusive or of the
256 -- source checksums of the unit and all its semantically dependent
257 -- units.
259 -- The <<attributes>> are a series of two letter codes indicating
260 -- information about the unit:
262 -- DE Dynamic Elaboration. This unit was compiled with the
263 -- dynamic elaboration model, as set by either the -gnatE
264 -- switch or pragma Elaboration_Checks (Dynamic).
266 -- EB Unit has pragma Elaborate_Body
268 -- EE Elaboration entity is present which must be set true when
269 -- the unit is elaborated. The name of the elaboration entity
270 -- is formed from the unit name in the usual way. If EE is
271 -- present, then this boolean must be set True as part of the
272 -- elaboration processing routine generated by the binder.
273 -- Note that EE can be set even if NE is set. This happens
274 -- when the boolean is needed solely for checking for the
275 -- case of access before elaboration.
277 -- GE Unit is a generic declaration, or corresponding body
279 -- IL Unit source uses a style with identifiers in all lower
280 -- IU case (IL) or all upper case (IU). If the standard mixed-
281 -- case usage is detected, or the compiler cannot determine
282 -- the style, then no I parameter will appear.
284 -- IS Initialize_Scalars pragma applies to this unit
286 -- KM Unit source uses a style with keywords in mixed case
287 -- KU (KM) or all upper case (KU). If the standard lower-case
288 -- usage is detected, or the compiler cannot determine the
289 -- style, then no K parameter will appear.
291 -- NE Unit has no elaboration routine. All subprogram bodies
292 -- and specs are in this category. Package bodies and specs
293 -- may or may not have NE set, depending on whether or not
294 -- elaboration code is required. Set if N_Compilation_Unit
295 -- node has flag Has_No_Elaboration_Code set.
297 -- PK Unit is package, rather than a subprogram
299 -- PU Unit has pragma Pure
301 -- PR Unit has pragma Preelaborate
303 -- RA Unit declares a Remote Access to Class-Wide (RACW) type
305 -- RC Unit has pragma Remote_Call_Interface
307 -- RT Unit has pragma Remote_Types
309 -- SP Unit has pragma Shared_Passive.
311 -- SU Unit is a subprogram, rather than a package
313 -- The attributes may appear in any order, separated by spaces.
315 -- ---------------------
316 -- -- W Withed Units --
317 -- ---------------------
319 -- Following each U line, is a series of lines of the form
321 -- W unit-name [source-name lib-name] [E] [EA] [ED]
323 -- One of these lines is present for each unit that is mentioned in
324 -- an explicit with clause by the current unit. The first parameter
325 -- is the unit name in internal format. The second parameter is the
326 -- file name of the file that must be compiled to compile this unit
327 -- (which is usually the file for the body, except for packages
328 -- which have no body). The third parameter is the file name of the
329 -- library information file that contains the results of compiling
330 -- this unit. The optional modifiers are used as follows:
332 -- E pragma Elaborate applies to this unit
334 -- EA pragma Elaborate_All applies to this unit
336 -- ED Elaborate_All_Desirable set for this unit, which means
337 -- that there is no Elaborate_All, but the analysis suggests
338 -- that Program_Error may be raised if the Elaborate_All
339 -- conditions cannot be satisfied. The binder will attempt
340 -- to treat ED as EA if it can.
342 -- The parameter source-name and lib-name are omitted for the case
343 -- of a generic unit compiled with earlier versions of GNAT which
344 -- did not generate object or ali files for generics.
346 -- -----------------------
347 -- -- L Linker_Options --
348 -- -----------------------
350 -- Following the W lines (if any, or the U line if not), are an
351 -- optional series of lines that indicates the usage of the pragma
352 -- Linker_Options in the associated unit. For each appearence of a
353 -- pragma Linker_Options (or Link_With) in the unit, a line is
354 -- present with the form:
356 -- L "string"
358 -- where string is the string from the unit line enclosed in quotes.
359 -- Within the quotes the following can occur:
361 -- c graphic characters in range 20-7E other than " or {
362 -- "" indicating a single " character
363 -- {hh} indicating a character whose code is hex hh (0-9,A-F)
364 -- {00} [ASCII.NUL] is used as a separator character
365 -- to separate multiple arguments of a single
366 -- Linker_Options pragma.
368 -- For further details, see Stringt.Write_String_Table_Entry. Note
369 -- that wide characters in the form {hhhh} cannot be produced, since
370 -- pragma Linker_Option accepts only String, not Wide_String.
372 -- The L lines are required to appear in the same order as the
373 -- corresponding Linker_Options (or Link_With) pragmas appear in
374 -- the source file, so that this order is preserved by the binder
375 -- in constructing the set of linker arguments.
377 ---------------------
378 -- Reference Lines --
379 ---------------------
381 -- The reference lines contain information about references from
382 -- any of the units in the compilation (including, body version
383 -- and version attributes, linker options pragmas and source
384 -- dependencies.
386 -- ------------------------------------
387 -- -- E External Version References --
388 -- ------------------------------------
390 -- One of these lines is present for each use of 'Body_Version or
391 -- 'Version in any of the units of the compilation. These are used
392 -- by the linker to determine which version symbols must be output.
393 -- The format is simply:
395 -- E name
397 -- where name is the external name, i.e. the unit name with either
398 -- a S or a B for spec or body version referenced (Body_Version
399 -- always references the body, Version references the Spec, except
400 -- in the case of a reference to a subprogram with no separate spec).
401 -- Upper half and wide character codes are encoded using the same
402 -- method as in Namet (Uhh for upper half, Whhhh for wide character,
403 -- where hh are hex digits).
405 -- ---------------------
406 -- -- D Dependencies --
407 -- ---------------------
409 -- The dependency lines indicate the source files on which the compiled
410 -- units depend. This is used by the binder for consistency checking.
411 -- These lines are also referenced by the cross-reference information.
413 -- D source-name time-stamp checksum [subunit-name] line:file-name
415 -- The time-stamp field contains the time stamp of the
416 -- corresponding source file. See types.ads for details on
417 -- time stamp representation.
419 -- The checksum is an 8-hex digit representation of the source
420 -- file checksum, with letters given in lower case.
422 -- The subunit name is present only if the dependency line is for
423 -- a subunit. It contains the fully qualified name of the subunit
424 -- in all lower case letters.
426 -- The line:file-name entry is present only if a Source_Reference
427 -- pragma appeared in the source file identified by source-name.
428 -- In this case, it gives the information from this pragma. Note
429 -- that this allows cross-reference information to be related back
430 -- to the original file. Note: the reason the line number comes
431 -- first is that a leading digit immediately identifies this as
432 -- a Source_Reference entry, rather than a subunit-name.
434 -- A line number of zero for line: in this entry indicates that
435 -- there is more than one source reference pragma. In this case,
436 -- the line numbers in the cross-reference are correct, and refer
437 -- to the original line number, but there is no information that
438 -- allows a reader of the ALI file to determine the exact mapping
439 -- of physical line numbers back to the original source.
441 -- Note: blank lines are ignored when the library information is
442 -- read, and separate sections of the file are separated by blank
443 -- lines to ease readability. Blanks between fields are also
444 -- ignored.
446 -- For entries corresponding to files that were not present (and
447 -- thus resulted in error messages), or for files that are not
448 -- part of the dependency set, both the time stamp and checksum
449 -- are set to all zero characters. These dummy entries are ignored
450 -- by the binder in dependency checking, but must be present for
451 -- proper interpretation of the cross-reference data.
453 --------------------------
454 -- Cross-Reference Data --
455 --------------------------
457 -- The cross-reference data follows the dependency lines. See
458 -- the spec of Lib.Xref for details on the format of this data.
460 -----------------
461 -- Subprograms --
462 -----------------
464 procedure Ensure_System_Dependency;
465 -- This procedure ensures that a dependency is created on system.ads.
466 -- Even if there is no semantic dependency, Targparm has read the
467 -- file to acquire target parameters, so we need a source dependency.
469 procedure Write_ALI (Object : Boolean);
470 -- This procedure writes the library information for the current main unit
471 -- The Object parameter is true if an object file is created, and false
472 -- otherwise.
474 -- Note: in the case where we are not generating code (-gnatc mode), this
475 -- routine only writes an ALI file if it cannot find an existing up to
476 -- date ALI file. If it *can* find an existing up to date ALI file, then
477 -- it reads this file and sets the Lib.Compilation_Arguments table from
478 -- the A lines in this file.
480 end Lib.Writ;