annotate gcc/ada/targparm.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- T A R G P A R M --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1999-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package obtains parameters from the target runtime version of System,
kono
parents:
diff changeset
27 -- to indicate parameters relevant to the target environment.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 -- Conceptually, these parameters could be obtained using rtsfind, but
kono
parents:
diff changeset
30 -- we do not do this for four reasons:
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- 1. Compiling System for every compilation wastes time
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- 2. This compilation impedes debugging by adding extra compile steps
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- 3. There are recursion problems coming from compiling System itself
kono
parents:
diff changeset
37 -- or any of its children.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -- 4. The binder also needs the parameters, and we do not want to have
kono
parents:
diff changeset
40 -- to drag a lot of front end stuff into the binder.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 -- For all these reasons, we read in the source of System, and then scan
kono
parents:
diff changeset
43 -- it at the text level to extract the parameter values.
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 -- Note however, that later on, when the ali file is written, we make sure
kono
parents:
diff changeset
46 -- that the System file is at least parsed, so that the checksum is properly
kono
parents:
diff changeset
47 -- computed and set in the ali file. This partially negates points 1 and 2
kono
parents:
diff changeset
48 -- above although just parsing is quick and does not impact debugging much.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 -- The parameters acquired by this routine from system.ads fall into four
kono
parents:
diff changeset
51 -- categories:
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 -- 1. Configuration pragmas, that must appear at the start of the file.
kono
parents:
diff changeset
54 -- Any such pragmas automatically apply to any unit compiled in the
kono
parents:
diff changeset
55 -- presence of this system file. Only a limited set of such pragmas
kono
parents:
diff changeset
56 -- may appear as documented in the corresponding section below.
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 -- 2. Target parameters. These are boolean constants that are defined
kono
parents:
diff changeset
59 -- in the private part of the package giving fixed information
kono
parents:
diff changeset
60 -- about the target architecture, and the capabilities of the
kono
parents:
diff changeset
61 -- code generator and run-time library.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 -- 3. Identification information. This is an optional string constant
kono
parents:
diff changeset
64 -- that gives the name of the run-time library configuration. This
kono
parents:
diff changeset
65 -- line may be omitted for a version of system.ads to be used with
kono
parents:
diff changeset
66 -- the full Ada 95 run time.
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 -- 4. Other characteristics of package System. At the current time the
kono
parents:
diff changeset
69 -- only item in this category is whether type Address is private.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 with Rident; use Rident;
kono
parents:
diff changeset
72 with Namet; use Namet;
kono
parents:
diff changeset
73 with Types; use Types;
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 package Targparm is
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 ---------------------------
kono
parents:
diff changeset
78 -- Configuration Pragmas --
kono
parents:
diff changeset
79 ---------------------------
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 -- The following switches get set if the corresponding configuration
kono
parents:
diff changeset
82 -- pragma is scanned from the source of system.ads. No other pragmas
kono
parents:
diff changeset
83 -- are permitted to appear at the start of the system.ads source file.
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 -- If a pragma Discard_Names appears, then Opt.Global_Discard_Names is
kono
parents:
diff changeset
86 -- set to True to indicate that all units must be compiled in this mode.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- If a pragma Locking_Policy appears, then Opt.Locking_Policy is set
kono
parents:
diff changeset
89 -- to the first character of the policy name, and Opt.Locking_Policy_Sloc
kono
parents:
diff changeset
90 -- is set to System_Location.
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 -- If a pragma Normalize_Scalars appears, then Opt.Normalize_Scalars
kono
parents:
diff changeset
93 -- is set True, as well as Opt.Init_Or_Norm_Scalars.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 -- If a pragma Queuing_Policy appears, then Opt.Queuing_Policy is set
kono
parents:
diff changeset
96 -- to the first character of the policy name, and Opt.Queuing_Policy_Sloc
kono
parents:
diff changeset
97 -- is set to System_Location.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 -- If a pragma Task_Dispatching_Policy appears, then the flag
kono
parents:
diff changeset
100 -- Opt.Task_Dispatching_Policy is set to the first character of the
kono
parents:
diff changeset
101 -- policy name, and Opt.Task_Dispatching_Policy_Sloc is set to
kono
parents:
diff changeset
102 -- System_Location.
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 -- If a pragma Polling (On) appears, then the flag Opt.Polling_Required
kono
parents:
diff changeset
105 -- is set to True.
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 -- If a pragma Detect_Blocking appears, then the flag Opt.Detect_Blocking
kono
parents:
diff changeset
108 -- is set to True.
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 -- If a pragma Suppress_Exception_Locations appears, then the flag
kono
parents:
diff changeset
111 -- Opt.Exception_Locations_Suppressed is set to True.
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- If a pragma Profile with a valid profile argument appears, then
kono
parents:
diff changeset
114 -- the appropriate restrictions and policy flags are set.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 -- The only other pragma allowed is a pragma Restrictions that specifies
kono
parents:
diff changeset
117 -- a restriction that will be imposed on all units in the partition. Note
kono
parents:
diff changeset
118 -- that in this context, only one restriction can be specified in a single
kono
parents:
diff changeset
119 -- pragma, and the pragma must appear on its own on a single source line.
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 -- If package System contains exactly the line "type Address is private;"
kono
parents:
diff changeset
122 -- then the flag Opt.Address_Is_Private is set True, otherwise this flag
kono
parents:
diff changeset
123 -- is set False.
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 Restrictions_On_Target : Restrictions_Info := No_Restrictions;
kono
parents:
diff changeset
126 -- Records restrictions specified by system.ads. Only the Set and Value
kono
parents:
diff changeset
127 -- members are modified. The Violated and Count fields are never modified.
kono
parents:
diff changeset
128 -- Note that entries can be set either by a pragma Restrictions or by
kono
parents:
diff changeset
129 -- a pragma Profile.
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 -------------------
kono
parents:
diff changeset
132 -- Run Time Name --
kono
parents:
diff changeset
133 -------------------
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- This parameter should be regarded as read only by all clients of
kono
parents:
diff changeset
136 -- of package. The only way they get modified is by calling the
kono
parents:
diff changeset
137 -- Get_Target_Parameters routine which reads the values from a provided
kono
parents:
diff changeset
138 -- text buffer containing the source of the system package.
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 -- The corresponding string constant is placed immediately at the start
kono
parents:
diff changeset
141 -- of the private part of system.ads if is present, e.g. in the form:
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 -- Run_Time_Name : constant String := "Zero Footprint Run Time";
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 -- the corresponding messages will look something like
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 -- xxx not supported (Zero Footprint Run Time)
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 Run_Time_Name_On_Target : Name_Id := No_Name;
kono
parents:
diff changeset
150 -- Set to appropriate names table entry Id value if a Run_Time_Name
kono
parents:
diff changeset
151 -- string constant is defined in system.ads. This name is used only
kono
parents:
diff changeset
152 -- for the configurable run-time case, and is used to parameterize
kono
parents:
diff changeset
153 -- messages that complain about non-supported run-time features.
kono
parents:
diff changeset
154 -- The name should contain only letters A-Z, digits 1-9, spaces,
kono
parents:
diff changeset
155 -- and underscores.
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 --------------------------
kono
parents:
diff changeset
158 -- Executable Extension --
kono
parents:
diff changeset
159 --------------------------
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 Executable_Extension_On_Target : Name_Id := No_Name;
kono
parents:
diff changeset
162 -- Executable extension on the target. This name is useful for setting
kono
parents:
diff changeset
163 -- the executable extension in a dynamic way, e.g. depending on the
kono
parents:
diff changeset
164 -- run time used, rather than using a configure-time macro as done by
kono
parents:
diff changeset
165 -- Get_Target_Executable_Suffix. If not set (No_Name), instead use
kono
parents:
diff changeset
166 -- System.OS_Lib.Get_Target_Executable_Suffix.
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 -----------------------
kono
parents:
diff changeset
169 -- Target Parameters --
kono
parents:
diff changeset
170 -----------------------
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 -- The following parameters correspond to the variables defined in the
kono
parents:
diff changeset
173 -- private part of System (without the terminating _On_Target). Note
kono
parents:
diff changeset
174 -- that it is required that all parameters defined here be specified
kono
parents:
diff changeset
175 -- in the target specific version of system.ads. Thus, to add a new
kono
parents:
diff changeset
176 -- parameter, add it to all system*.ads files. (There is a defaulting
kono
parents:
diff changeset
177 -- mechanism, but we don't normally take advantage of it, as explained
kono
parents:
diff changeset
178 -- below.)
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 -- The default values here are used if no value is found in system.ads.
kono
parents:
diff changeset
181 -- This should normally happen if the special version of system.ads used
kono
parents:
diff changeset
182 -- by the compiler itself is in use or if the value is only relevant to a
kono
parents:
diff changeset
183 -- particular target (e.g. AAMP). The default values are suitable for use
kono
parents:
diff changeset
184 -- in normal environments. This approach allows the possibility of new
kono
parents:
diff changeset
185 -- versions of the compiler (possibly with new system parameters added)
kono
parents:
diff changeset
186 -- being used to compile older versions of the compiler sources, as well as
kono
parents:
diff changeset
187 -- avoiding duplicating values in all system-*.ads files for flags that are
kono
parents:
diff changeset
188 -- used on a few platforms only.
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 -- All these parameters should be regarded as read only by all clients
kono
parents:
diff changeset
191 -- of the package. The only way they get modified is by calling the
kono
parents:
diff changeset
192 -- Get_Target_Parameters routine which reads the values from a provided
kono
parents:
diff changeset
193 -- text buffer containing the source of the system package.
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 -------------------------------
kono
parents:
diff changeset
196 -- Backend Arithmetic Checks --
kono
parents:
diff changeset
197 -------------------------------
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 -- Divide and overflow checks are either done in the front end or
kono
parents:
diff changeset
200 -- back end. The front end will generate checks when required unless
kono
parents:
diff changeset
201 -- the corresponding parameter here is set to indicate that the back
kono
parents:
diff changeset
202 -- end will generate the required checks (or that the checks are
kono
parents:
diff changeset
203 -- automatically performed by the hardware in an appropriate form).
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 Backend_Divide_Checks_On_Target : Boolean := False;
kono
parents:
diff changeset
206 -- Set True if the back end generates divide checks, or if the hardware
kono
parents:
diff changeset
207 -- checks automatically. Set False if the front end must generate the
kono
parents:
diff changeset
208 -- required tests using explicit expanded code.
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 Backend_Overflow_Checks_On_Target : Boolean := False;
kono
parents:
diff changeset
211 -- Set True if the back end generates arithmetic overflow checks, or if
kono
parents:
diff changeset
212 -- the hardware checks automatically. Set False if the front end must
kono
parents:
diff changeset
213 -- generate the required tests using explicit expanded code.
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 -----------------------------------
kono
parents:
diff changeset
216 -- Control of Exception Handling --
kono
parents:
diff changeset
217 -----------------------------------
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 -- GNAT implements three methods of implementing exceptions:
kono
parents:
diff changeset
220
kono
parents:
diff changeset
221 -- Front-End Longjmp/Setjmp Exceptions
kono
parents:
diff changeset
222
kono
parents:
diff changeset
223 -- This approach uses longjmp/setjmp to handle exceptions. It
kono
parents:
diff changeset
224 -- uses less storage, and can often propagate exceptions faster,
kono
parents:
diff changeset
225 -- at the expense of (sometimes considerable) overhead in setting
kono
parents:
diff changeset
226 -- up an exception handler.
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 -- The generation of the setjmp and longjmp calls is handled by
kono
parents:
diff changeset
229 -- the front end of the compiler (this includes gigi in the case
kono
parents:
diff changeset
230 -- of the standard GCC back end). It does not use any back end
kono
parents:
diff changeset
231 -- support (such as the GCC3 exception handling mechanism). When
kono
parents:
diff changeset
232 -- this approach is used, the compiler generates special exception
kono
parents:
diff changeset
233 -- handlers for handling cleanups (AT-END actions) when an exception
kono
parents:
diff changeset
234 -- is raised.
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 -- Back-End Zero Cost Exceptions
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 -- With this approach, the back end handles the generation and
kono
parents:
diff changeset
239 -- handling of exceptions. For example, the GCC3 exception handling
kono
parents:
diff changeset
240 -- mechanisms are used in this mode. The front end simply generates
kono
parents:
diff changeset
241 -- code for explicit exception handlers, and AT-END cleanup handlers
kono
parents:
diff changeset
242 -- are simply passed unchanged to the backend for generating cleanups
kono
parents:
diff changeset
243 -- both in the exceptional and non-exceptional cases.
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 -- As the name implies, this approach uses a table-based mechanism,
kono
parents:
diff changeset
246 -- which incurs no setup when entering a region covered by handlers
kono
parents:
diff changeset
247 -- but requires complex unwinding to walk up the call chain and search
kono
parents:
diff changeset
248 -- for handlers at propagation time.
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 -- Back-End Setjmp/Longjmp Exceptions
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 -- With this approach, the back end also handles the generation and
kono
parents:
diff changeset
253 -- handling of exceptions, using setjmp/longjmp to set up receivers and
kono
parents:
diff changeset
254 -- propagate. AT-END actions on exceptional paths are also taken care
kono
parents:
diff changeset
255 -- of by the back end and the front end doesn't need to generate
kono
parents:
diff changeset
256 -- explicit exception handlers for these.
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 -- Control of Available Methods and Defaults
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 -- The following switches specify whether we're using a front-end or a
kono
parents:
diff changeset
261 -- back-end mechanism and whether this is a zero-cost or a sjlj scheme.
kono
parents:
diff changeset
262
kono
parents:
diff changeset
263 -- The per-switch default values correspond to the default value of
kono
parents:
diff changeset
264 -- Opt.Exception_Mechanism.
kono
parents:
diff changeset
265
kono
parents:
diff changeset
266 ZCX_By_Default_On_Target : Boolean := False;
kono
parents:
diff changeset
267 -- Indicates if zero cost scheme for exceptions
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 Frontend_Exceptions_On_Target : Boolean := True;
kono
parents:
diff changeset
270 -- Indicates if we're using a front-end scheme for exceptions
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 ------------------------------------
kono
parents:
diff changeset
273 -- Run-Time Library Configuration --
kono
parents:
diff changeset
274 ------------------------------------
kono
parents:
diff changeset
275
kono
parents:
diff changeset
276 -- In configurable run-time mode, the system run-time may not support
kono
parents:
diff changeset
277 -- the full Ada language. The effect of setting this switch is to let
kono
parents:
diff changeset
278 -- the compiler know that it is not surprising (i.e. the system is not
kono
parents:
diff changeset
279 -- misconfigured) if run-time library units or entities within units are
kono
parents:
diff changeset
280 -- not present in the run-time.
kono
parents:
diff changeset
281
kono
parents:
diff changeset
282 Configurable_Run_Time_On_Target : Boolean := False;
kono
parents:
diff changeset
283 -- Indicates that the system.ads file is for a configurable run-time
kono
parents:
diff changeset
284 --
kono
parents:
diff changeset
285 -- This has some specific effects as follows
kono
parents:
diff changeset
286 --
kono
parents:
diff changeset
287 -- The binder generates the gnat_argc/argv/envp variables in the
kono
parents:
diff changeset
288 -- binder file instead of being imported from the run-time library.
kono
parents:
diff changeset
289 -- If Command_Line_Args_On_Target is set to False, then the
kono
parents:
diff changeset
290 -- generation of these variables is suppressed completely.
kono
parents:
diff changeset
291 --
kono
parents:
diff changeset
292 -- The binder generates the gnat_exit_status variable in the binder
kono
parents:
diff changeset
293 -- file instead of being imported from the run-time library. If
kono
parents:
diff changeset
294 -- Exit_Status_Supported_On_Target is set to False, then the
kono
parents:
diff changeset
295 -- generation of this variable is suppressed entirely.
kono
parents:
diff changeset
296 --
kono
parents:
diff changeset
297 -- The routine __gnat_break_start is defined within the binder file
kono
parents:
diff changeset
298 -- instead of being imported from the run-time library.
kono
parents:
diff changeset
299 --
kono
parents:
diff changeset
300 -- The variable __gnat_exit_status is generated within the binder file
kono
parents:
diff changeset
301 -- instead of being imported from the run-time library.
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 Suppress_Standard_Library_On_Target : Boolean := False;
kono
parents:
diff changeset
304 -- If this flag is True, then the standard library is not included by
kono
parents:
diff changeset
305 -- default in the executable (see unit System.Standard_Library in file
kono
parents:
diff changeset
306 -- s-stalib.ads for details of what this includes). This is for example
kono
parents:
diff changeset
307 -- set True for the zero foot print case, where these files should not
kono
parents:
diff changeset
308 -- be included by default.
kono
parents:
diff changeset
309 --
kono
parents:
diff changeset
310 -- This flag has some other related effects:
kono
parents:
diff changeset
311 --
kono
parents:
diff changeset
312 -- The generation of global variables in the bind file is suppressed,
kono
parents:
diff changeset
313 -- with the exception of the priority of the environment task, which
kono
parents:
diff changeset
314 -- is needed by the Ravenscar run-time.
kono
parents:
diff changeset
315 --
kono
parents:
diff changeset
316 -- The calls to __gnat_initialize and __gnat_finalize are omitted
kono
parents:
diff changeset
317 --
kono
parents:
diff changeset
318 -- All finalization and initialization (controlled types) is omitted
kono
parents:
diff changeset
319
kono
parents:
diff changeset
320 Preallocated_Stacks_On_Target : Boolean := False;
kono
parents:
diff changeset
321 -- If this flag is True, then the expander preallocates all task stacks
kono
parents:
diff changeset
322 -- at compile time. If the flag is False, then task stacks are not pre-
kono
parents:
diff changeset
323 -- allocated, and task stack allocation is the responsibility of the
kono
parents:
diff changeset
324 -- run-time (which typically delegates the task to the underlying
kono
parents:
diff changeset
325 -- operating system environment).
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 ---------------------
kono
parents:
diff changeset
328 -- Duration Format --
kono
parents:
diff changeset
329 ---------------------
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 -- By default, type Duration is a 64-bit fixed-point type with a delta
kono
parents:
diff changeset
332 -- and small of 10**(-9) (i.e. it is a count in nanoseconds). This flag
kono
parents:
diff changeset
333 -- allows that standard format to be modified.
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 Duration_32_Bits_On_Target : Boolean := False;
kono
parents:
diff changeset
336 -- If True, then Duration is represented in 32 bits and the delta and
kono
parents:
diff changeset
337 -- small values are set to 20.0*(10**(-3)) (i.e. it is a count in units
kono
parents:
diff changeset
338 -- of 20 milliseconds).
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 ------------------------------------
kono
parents:
diff changeset
341 -- Back-End Code Generation Flags --
kono
parents:
diff changeset
342 ------------------------------------
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 -- These flags indicate possible limitations in what the code generator
kono
parents:
diff changeset
345 -- can handle. They will all be True for a full run-time, but one or more
kono
parents:
diff changeset
346 -- of these may be false for a configurable run-time, and if a feature is
kono
parents:
diff changeset
347 -- used at the source level, and the corresponding flag is false, then an
kono
parents:
diff changeset
348 -- error message will be issued saying the feature is not supported.
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350 Atomic_Sync_Default_On_Target : Boolean := True;
kono
parents:
diff changeset
351 -- Access to atomic variables requires memory barrier synchronization in
kono
parents:
diff changeset
352 -- the general case to ensure proper behavior when such accesses are used
kono
parents:
diff changeset
353 -- on a multi-processor to synchronize tasks (e.g. by using spin locks).
kono
parents:
diff changeset
354 -- The setting of this flag determines the default behavior. Normally this
kono
parents:
diff changeset
355 -- is True, which will mean that appropriate synchronization instructions
kono
parents:
diff changeset
356 -- are generated by default. If it is False, then the default will be that
kono
parents:
diff changeset
357 -- these synchronization instructions are not generated. This may be a more
kono
parents:
diff changeset
358 -- appropriate default in some cases, e.g. on embedded targets which do not
kono
parents:
diff changeset
359 -- allow the possibility of multi-processors. The default can be overridden
kono
parents:
diff changeset
360 -- using pragmas Enable/Disable_Atomic_Synchronization and also by use of
kono
parents:
diff changeset
361 -- the corresponding debug flags -gnatd.e and -gnatd.d.
kono
parents:
diff changeset
362
kono
parents:
diff changeset
363 Support_Aggregates_On_Target : Boolean := True;
kono
parents:
diff changeset
364 -- In the general case, the use of aggregates may generate calls
kono
parents:
diff changeset
365 -- to run-time routines in the C library, including memset, memcpy,
kono
parents:
diff changeset
366 -- memmove, and bcopy. This flag is set to True if these routines
kono
parents:
diff changeset
367 -- are available. If any of these routines is not available, then
kono
parents:
diff changeset
368 -- this flag is False, and the use of aggregates is not permitted.
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 Support_Atomic_Primitives_On_Target : Boolean := False;
kono
parents:
diff changeset
371 -- If this flag is True, then the back-end support GCC built-in atomic
kono
parents:
diff changeset
372 -- operations for memory model such as atomic load or atomic compare
kono
parents:
diff changeset
373 -- exchange (see the GCC manual for more information). If the flag is
kono
parents:
diff changeset
374 -- False, then the back-end doesn't provide this support. Note this flag is
kono
parents:
diff changeset
375 -- set to True only if the target supports all atomic primitives up to 64
kono
parents:
diff changeset
376 -- bits. ??? To be modified.
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 Support_Composite_Assign_On_Target : Boolean := True;
kono
parents:
diff changeset
379 -- The assignment of composite objects other than small records and
kono
parents:
diff changeset
380 -- arrays whose size is 64-bits or less and is set by an explicit
kono
parents:
diff changeset
381 -- size clause may generate calls to memcpy, memmove, and bcopy.
kono
parents:
diff changeset
382 -- If versions of all these routines are available, then this flag
kono
parents:
diff changeset
383 -- is set to True. If any of these routines is not available, then
kono
parents:
diff changeset
384 -- the flag is set False, and composite assignments are not allowed.
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 Support_Composite_Compare_On_Target : Boolean := True;
kono
parents:
diff changeset
387 -- If this flag is True, then the back end supports bit-wise comparison
kono
parents:
diff changeset
388 -- of composite objects for equality, either generating inline code or
kono
parents:
diff changeset
389 -- calling appropriate (and available) run-time routines. If this flag
kono
parents:
diff changeset
390 -- is False, then the back end does not provide this support, and the
kono
parents:
diff changeset
391 -- front end uses component by component comparison for composites.
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 Support_Long_Shifts_On_Target : Boolean := True;
kono
parents:
diff changeset
394 -- If True, the back end supports 64-bit shift operations. If False, then
kono
parents:
diff changeset
395 -- the source program may not contain explicit 64-bit shifts. In addition,
kono
parents:
diff changeset
396 -- the code generated for packed arrays will avoid the use of long shifts.
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 Support_Nondefault_SSO_On_Target : Boolean := True;
kono
parents:
diff changeset
399 -- If True, the back end supports the non-default Scalar_Storage_Order
kono
parents:
diff changeset
400 -- (i.e. allows non-confirming Scalar_Storage_Order attribute definition
kono
parents:
diff changeset
401 -- clauses).
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 --------------------
kono
parents:
diff changeset
404 -- Indirect Calls --
kono
parents:
diff changeset
405 --------------------
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 Always_Compatible_Rep_On_Target : Boolean := True;
kono
parents:
diff changeset
408 -- If True, the Can_Use_Internal_Rep flag (see Einfo) is set to False in
kono
parents:
diff changeset
409 -- all cases. This corresponds to the traditional code generation
kono
parents:
diff changeset
410 -- strategy. False allows the front end to choose a policy that partly or
kono
parents:
diff changeset
411 -- entirely eliminates dynamically generated trampolines.
kono
parents:
diff changeset
412
kono
parents:
diff changeset
413 -------------------------------
kono
parents:
diff changeset
414 -- Control of Stack Checking --
kono
parents:
diff changeset
415 -------------------------------
kono
parents:
diff changeset
416
kono
parents:
diff changeset
417 -- GNAT provides three methods of implementing exceptions:
kono
parents:
diff changeset
418
kono
parents:
diff changeset
419 -- GCC Probing Mechanism
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 -- This approach uses the standard GCC mechanism for
kono
parents:
diff changeset
422 -- stack checking. The method assumes that accessing
kono
parents:
diff changeset
423 -- storage immediately beyond the end of the stack
kono
parents:
diff changeset
424 -- will result in a trap that is converted to a storage
kono
parents:
diff changeset
425 -- error by the runtime system. This mechanism has
kono
parents:
diff changeset
426 -- minimal overhead, but requires complex hardware,
kono
parents:
diff changeset
427 -- operating system and run-time support. Probing is
kono
parents:
diff changeset
428 -- the default method where it is available. The stack
kono
parents:
diff changeset
429 -- size for the environment task depends on the operating
kono
parents:
diff changeset
430 -- system and cannot be set in a system-independent way.
kono
parents:
diff changeset
431
kono
parents:
diff changeset
432 -- GCC Stack-limit Mechanism
kono
parents:
diff changeset
433
kono
parents:
diff changeset
434 -- This approach uses the GCC stack limits mechanism.
kono
parents:
diff changeset
435 -- It relies on comparing the stack pointer with the
kono
parents:
diff changeset
436 -- values of a global symbol. If the check fails, a
kono
parents:
diff changeset
437 -- trap is explicitly generated. The advantage is
kono
parents:
diff changeset
438 -- that the mechanism requires no memory protection,
kono
parents:
diff changeset
439 -- but operating system and run-time support are
kono
parents:
diff changeset
440 -- needed to manage the per-task values of the symbol.
kono
parents:
diff changeset
441 -- This is the default method after probing where it
kono
parents:
diff changeset
442 -- is available.
kono
parents:
diff changeset
443
kono
parents:
diff changeset
444 -- GNAT Stack-limit Checking
kono
parents:
diff changeset
445
kono
parents:
diff changeset
446 -- This method relies on comparing the stack pointer
kono
parents:
diff changeset
447 -- with per-task stack limits. If the check fails, an
kono
parents:
diff changeset
448 -- exception is explicitly raised. The advantage is
kono
parents:
diff changeset
449 -- that the method requires no extra system dependent
kono
parents:
diff changeset
450 -- runtime support and can be used on systems without
kono
parents:
diff changeset
451 -- memory protection as well, but at the cost of more
kono
parents:
diff changeset
452 -- overhead for doing the check. This is the fallback
kono
parents:
diff changeset
453 -- method if the above two are not supported.
kono
parents:
diff changeset
454
kono
parents:
diff changeset
455 Stack_Check_Probes_On_Target : Boolean := False;
kono
parents:
diff changeset
456 -- Indicates if the GCC probing mechanism is used
kono
parents:
diff changeset
457
kono
parents:
diff changeset
458 Stack_Check_Limits_On_Target : Boolean := False;
kono
parents:
diff changeset
459 -- Indicates if the GCC stack-limit mechanism is used
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 -- Both flags cannot be simultaneously set to True. If neither
kono
parents:
diff changeset
462 -- is, the target independent fallback method is used.
kono
parents:
diff changeset
463
kono
parents:
diff changeset
464 Stack_Check_Default_On_Target : Boolean := False;
kono
parents:
diff changeset
465 -- Indicates if stack checking is on by default
kono
parents:
diff changeset
466
kono
parents:
diff changeset
467 ----------------------------
kono
parents:
diff changeset
468 -- Command Line Arguments --
kono
parents:
diff changeset
469 ----------------------------
kono
parents:
diff changeset
470
kono
parents:
diff changeset
471 -- For most ports of GNAT, command line arguments are supported. The
kono
parents:
diff changeset
472 -- following flag is set to False for targets that do not support
kono
parents:
diff changeset
473 -- command line arguments (VxWorks and AAMP). Note that support of
kono
parents:
diff changeset
474 -- command line arguments is not required on such targets (RM A.15(13)).
kono
parents:
diff changeset
475
kono
parents:
diff changeset
476 Command_Line_Args_On_Target : Boolean := True;
kono
parents:
diff changeset
477 -- Set False if no command line arguments on target. Note that if this
kono
parents:
diff changeset
478 -- is False in with Configurable_Run_Time_On_Target set to True, then
kono
parents:
diff changeset
479 -- this causes suppression of generation of the argv/argc variables
kono
parents:
diff changeset
480 -- used to record command line arguments.
kono
parents:
diff changeset
481
kono
parents:
diff changeset
482 -- Similarly, most ports support the use of an exit status, but AAMP
kono
parents:
diff changeset
483 -- is an exception (as allowed by RM A.15(18-20))
kono
parents:
diff changeset
484
kono
parents:
diff changeset
485 Exit_Status_Supported_On_Target : Boolean := True;
kono
parents:
diff changeset
486 -- Set False if returning of an exit status is not supported on target.
kono
parents:
diff changeset
487 -- Note that if this False in with Configurable_Run_Time_On_Target
kono
parents:
diff changeset
488 -- set to True, then this causes suppression of the gnat_exit_status
kono
parents:
diff changeset
489 -- variable used to record the exit status.
kono
parents:
diff changeset
490
kono
parents:
diff changeset
491 -----------------------
kono
parents:
diff changeset
492 -- Main Program Name --
kono
parents:
diff changeset
493 -----------------------
kono
parents:
diff changeset
494
kono
parents:
diff changeset
495 -- When the binder generates the main program to be used to create the
kono
parents:
diff changeset
496 -- executable, the main program name is main by default (to match the
kono
parents:
diff changeset
497 -- usual Unix practice). If this parameter is set to True, then the
kono
parents:
diff changeset
498 -- name is instead by default taken from the actual Ada main program
kono
parents:
diff changeset
499 -- name (just the name of the child if the main program is a child unit).
kono
parents:
diff changeset
500 -- In either case, this value can be overridden using -M name.
kono
parents:
diff changeset
501
kono
parents:
diff changeset
502 Use_Ada_Main_Program_Name_On_Target : Boolean := False;
kono
parents:
diff changeset
503 -- Set True to use the Ada main program name as the main name
kono
parents:
diff changeset
504
kono
parents:
diff changeset
505 ----------------------------------------------
kono
parents:
diff changeset
506 -- Boolean-Valued Floating-Point Attributes --
kono
parents:
diff changeset
507 ----------------------------------------------
kono
parents:
diff changeset
508
kono
parents:
diff changeset
509 -- The constants below give the values for representation oriented
kono
parents:
diff changeset
510 -- floating-point attributes that are the same for all float types
kono
parents:
diff changeset
511 -- on the target. These are all boolean values.
kono
parents:
diff changeset
512
kono
parents:
diff changeset
513 -- A value is only True if the target reliably supports the corresponding
kono
parents:
diff changeset
514 -- feature. Reliably here means that support is guaranteed for all
kono
parents:
diff changeset
515 -- possible settings of the relevant compiler switches (like -mieee),
kono
parents:
diff changeset
516 -- since we cannot control the user setting of those switches.
kono
parents:
diff changeset
517
kono
parents:
diff changeset
518 -- The attributes cannot dependent on the current setting of compiler
kono
parents:
diff changeset
519 -- switches, since the values must be static and consistent throughout
kono
parents:
diff changeset
520 -- the partition. We probably should add such consistency checks in future,
kono
parents:
diff changeset
521 -- but for now we don't do this.
kono
parents:
diff changeset
522
kono
parents:
diff changeset
523 -- Note: the compiler itself does not use floating-point, so the
kono
parents:
diff changeset
524 -- settings of the defaults here are not really relevant.
kono
parents:
diff changeset
525
kono
parents:
diff changeset
526 -- Note: in some cases, proper support of some of these floating point
kono
parents:
diff changeset
527 -- features may require a specific switch (e.g. -mieee on the Alpha)
kono
parents:
diff changeset
528 -- to be used to obtain full RM compliant support.
kono
parents:
diff changeset
529
kono
parents:
diff changeset
530 Denorm_On_Target : Boolean := False;
kono
parents:
diff changeset
531 -- Set to False on targets that do not reliably support denormals
kono
parents:
diff changeset
532
kono
parents:
diff changeset
533 Machine_Rounds_On_Target : Boolean := True;
kono
parents:
diff changeset
534 -- Set to False for targets where S'Machine_Rounds is False
kono
parents:
diff changeset
535
kono
parents:
diff changeset
536 Machine_Overflows_On_Target : Boolean := False;
kono
parents:
diff changeset
537 -- Set to True for targets where S'Machine_Overflows is True
kono
parents:
diff changeset
538
kono
parents:
diff changeset
539 Signed_Zeros_On_Target : Boolean := True;
kono
parents:
diff changeset
540 -- Set to False on targets that do not reliably support signed zeros
kono
parents:
diff changeset
541
kono
parents:
diff changeset
542 -------------------------------------------
kono
parents:
diff changeset
543 -- Boolean-Valued Fixed-Point Attributes --
kono
parents:
diff changeset
544 -------------------------------------------
kono
parents:
diff changeset
545
kono
parents:
diff changeset
546 Fractional_Fixed_Ops_On_Target : Boolean := False;
kono
parents:
diff changeset
547 -- Set to True for targets that support fixed-by-fixed multiplication
kono
parents:
diff changeset
548 -- and division for fixed-point types with a small value equal to
kono
parents:
diff changeset
549 -- 2 ** (-(T'Object_Size - 1)) and whose values have an absolute
kono
parents:
diff changeset
550 -- value less than 1.0.
kono
parents:
diff changeset
551
kono
parents:
diff changeset
552 -----------------
kono
parents:
diff changeset
553 -- Subprograms --
kono
parents:
diff changeset
554 -----------------
kono
parents:
diff changeset
555
kono
parents:
diff changeset
556 -- These subprograms are used to initialize the target parameter values
kono
parents:
diff changeset
557 -- from the system.ads file. Note that this is only done once, so if more
kono
parents:
diff changeset
558 -- than one call is made to either routine, the second and subsequent
kono
parents:
diff changeset
559 -- calls are ignored. It also reads restriction pragmas from system.ads
kono
parents:
diff changeset
560 -- and records them, though as further detailed below, the caller has some
kono
parents:
diff changeset
561 -- control over the handling of No_Dependence restrictions.
kono
parents:
diff changeset
562
kono
parents:
diff changeset
563 type Make_Id_Type is access function (Str : Text_Buffer) return Node_Id;
kono
parents:
diff changeset
564 -- Parameter type for Get_Target_Parameters for function that creates an
kono
parents:
diff changeset
565 -- identifier node with Sloc value System_Location and given string as the
kono
parents:
diff changeset
566 -- Chars value.
kono
parents:
diff changeset
567
kono
parents:
diff changeset
568 type Make_SC_Type is access function (Pre, Sel : Node_Id) return Node_Id;
kono
parents:
diff changeset
569 -- Parameter type for Get_Target_Parameters for function that creates a
kono
parents:
diff changeset
570 -- selected component with Sloc value System_Location and given Prefix
kono
parents:
diff changeset
571 -- (Pre) and Selector (Sel) values.
kono
parents:
diff changeset
572
kono
parents:
diff changeset
573 type Set_NOD_Type is access procedure (Unit : Node_Id);
kono
parents:
diff changeset
574 -- Parameter type for Get_Target_Parameters that records a Restriction
kono
parents:
diff changeset
575 -- No_Dependence for the given unit (identifier or selected component).
kono
parents:
diff changeset
576
kono
parents:
diff changeset
577 type Set_NSA_Type is access procedure (Asp : Name_Id; OK : out Boolean);
kono
parents:
diff changeset
578 -- Parameter type for Get_Target_Parameters that records a Restriction
kono
parents:
diff changeset
579 -- No_Specification_Of_Aspect. Asp is the aspect name. OK is set True
kono
parents:
diff changeset
580 -- if this is an OK aspect name, and False if it is not an aspect name.
kono
parents:
diff changeset
581
kono
parents:
diff changeset
582 type Set_NUA_Type is access procedure (Attr : Name_Id; OK : out Boolean);
kono
parents:
diff changeset
583 -- Parameter type for Get_Target_Parameters that records a Restriction
kono
parents:
diff changeset
584 -- No_Use_Of_Attribute. Attr is the attribute name. OK is set True if
kono
parents:
diff changeset
585 -- this is an OK attribute name, and False if it is not an attribute name.
kono
parents:
diff changeset
586
kono
parents:
diff changeset
587 type Set_NUP_Type is access procedure (Prag : Name_Id; OK : out Boolean);
kono
parents:
diff changeset
588 -- Parameter type for Get_Target_Parameters that records a Restriction
kono
parents:
diff changeset
589 -- No_Use_Of_Pragma. Prag is the pragma name. OK is set True if this is
kono
parents:
diff changeset
590 -- an OK pragma name, and False if it is not a recognized pragma name.
kono
parents:
diff changeset
591
kono
parents:
diff changeset
592 procedure Get_Target_Parameters
kono
parents:
diff changeset
593 (System_Text : Source_Buffer_Ptr;
kono
parents:
diff changeset
594 Source_First : Source_Ptr;
kono
parents:
diff changeset
595 Source_Last : Source_Ptr;
kono
parents:
diff changeset
596 Make_Id : Make_Id_Type := null;
kono
parents:
diff changeset
597 Make_SC : Make_SC_Type := null;
kono
parents:
diff changeset
598 Set_NOD : Set_NOD_Type := null;
kono
parents:
diff changeset
599 Set_NSA : Set_NSA_Type := null;
kono
parents:
diff changeset
600 Set_NUA : Set_NUA_Type := null;
kono
parents:
diff changeset
601 Set_NUP : Set_NUP_Type := null);
kono
parents:
diff changeset
602 -- Called at the start of execution to obtain target parameters from the
kono
parents:
diff changeset
603 -- source of package System. The parameters provide the source text to be
kono
parents:
diff changeset
604 -- scanned (in System_Text (Source_First .. Source_Last)). If the three
kono
parents:
diff changeset
605 -- subprograms Make_Id, Make_SC, and Set_NOD are left at their default
kono
parents:
diff changeset
606 -- value of null, Get_Target_Parameters will ignore pragma Restrictions
kono
parents:
diff changeset
607 -- (No_Dependence) lines; otherwise it will use these three subprograms to
kono
parents:
diff changeset
608 -- record them. Similarly, if Set_NUP is left at its default value of null,
kono
parents:
diff changeset
609 -- then any occurrences of pragma Restrictions (No_Use_Of_Pragma => XXX)
kono
parents:
diff changeset
610 -- will be ignored; otherwise it will use this procedure to record the
kono
parents:
diff changeset
611 -- pragma. Similarly for the NSA and NUA cases.
kono
parents:
diff changeset
612
kono
parents:
diff changeset
613 procedure Get_Target_Parameters
kono
parents:
diff changeset
614 (Make_Id : Make_Id_Type := null;
kono
parents:
diff changeset
615 Make_SC : Make_SC_Type := null;
kono
parents:
diff changeset
616 Set_NOD : Set_NOD_Type := null;
kono
parents:
diff changeset
617 Set_NSA : Set_NSA_Type := null;
kono
parents:
diff changeset
618 Set_NUA : Set_NUA_Type := null;
kono
parents:
diff changeset
619 Set_NUP : Set_NUP_Type := null);
kono
parents:
diff changeset
620 -- This version reads in system.ads using Osint. The idea is that the
kono
parents:
diff changeset
621 -- caller uses the first version if they have to read system.ads anyway
kono
parents:
diff changeset
622 -- (e.g. the compiler) and uses this simpler interface if system.ads is
kono
parents:
diff changeset
623 -- not otherwise needed.
kono
parents:
diff changeset
624
kono
parents:
diff changeset
625 end Targparm;