PR target/9164
[official-gcc.git] / gcc / ada / targparm.ads
blob4184ba577ffe3a9e517b7c335afc270b10cb77b9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- T A R G P A R M --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1999-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 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 -- --
26 ------------------------------------------------------------------------------
28 -- This package obtains parameters from the target runtime version of
29 -- System, to indicate parameters relevant to the target environment.
31 -- Conceptually, these parameters could be obtained using rtsfind, but
32 -- we do not do this for three reasons:
34 -- 1. Compiling System for every compilation wastes time
35 -- 2. This compilation impedes debugging by adding extra compile steps
36 -- 3. There are recursion problems coming from compiling System itself
37 -- or any of its children.
39 -- For all these reasons, we read in the source of System, and then scan
40 -- it at the text level to extract the parameter values.
42 -- Note however, that later on, when the ali file is written, we make sure
43 -- that the System file is at least parsed, so that the checksum is properly
44 -- computed and set in the ali file. This partially negates points 1 and 2
45 -- above although just parsing is quick and does not impact debugging much.
47 package Targparm is
49 -- The following parameters correspond to the variables defined in the
50 -- private part of System (without the terminating _On_Target). Note
51 -- that it is required that all parameters defined here be specified
52 -- in the target specific version of system.ads (there are no defaults).
54 -- All these parameters should be regarded as read only by all clients
55 -- of the package. The only way they get modified is by calling the
56 -- Get_Target_Parameters routine which reads the values from System.
58 -------------------------------
59 -- Backend Arithmetic Checks --
60 -------------------------------
62 -- Divide and overflow checks are either done in the front end or
63 -- back end. The front end will generate checks when required unless
64 -- the corresponding parameter here is set to indicate that the back
65 -- end will generate the required checks (or that the checks are
66 -- automatically performed by the hardware in an appropriate form).
68 Backend_Divide_Checks_On_Target : Boolean;
69 -- Set True if the back end generates divide checks, or if the hardware
70 -- checks automatically. Set False if the front end must generate the
71 -- required tests using explicit expanded code.
73 Backend_Overflow_Checks_On_Target : Boolean;
74 -- Set True if the back end generates arithmetic overflow checks, or if
75 -- the hardware checks automatically. Set False if the front end must
76 -- generate the required tests using explicit expanded code.
78 -----------------------------------
79 -- Control of Exception Handling --
80 -----------------------------------
82 -- GNAT provides two methods of implementing exceptions:
84 -- Longjmp/Setjmp (-gnatL)
86 -- This approach uses longjmp/setjmp to handle exceptions. It
87 -- uses less storage, and can often propagate exceptions faster,
88 -- at the expense of (sometimes considerable) overhead in setting
89 -- up an exception handler. This approach is available on all
90 -- targets, and is the default where it is the only approach.
92 -- Zero Cost (-gnatZ)
94 -- This approach uses separate exception tables. These use extra
95 -- storage, and exception propagation can be quite slow, but there
96 -- is no overhead in setting up an exception handler (it is to this
97 -- latter operation that the phrase zero-cost refers). This approach
98 -- is only available on some targets, and is the default where it is
99 -- available.
101 ZCX_By_Default_On_Target : Boolean;
102 -- Indicates if zero cost exceptions are active by default.
104 GCC_ZCX_Support_On_Target : Boolean;
105 -- Indicates that when ZCX is active the mechanism to be used is the
106 -- standard GCC ZCX mechanism (introduced in GCC 3.1)
108 Front_End_ZCX_Support_On_Target : Boolean;
109 -- Indicates that when ZCX is active (and GCC_ZCX_Support is not set)
110 -- the mechanism to be used is the GNAT front end specific ZCX mechanism
112 ---------------------------------------
113 -- High_Integrity (No Run Time) Mode --
114 ---------------------------------------
116 -- In High_Integrity mode, there is no system run-time, and the flag
117 -- Opt.No_Run_Time is set so that the language is appropriately
118 -- restricted to forbid construct that would generate run-time calls.
120 High_Integrity_Mode_On_Target : Boolean;
121 -- Indicates that this build is for a high integrity mode version of
122 -- GNAT, so that no run time is permitted.
124 -------------------------------
125 -- Control of Stack Checking --
126 -------------------------------
128 -- GNAT provides two methods of implementing exceptions:
130 -- GCC Probing Mechanism
132 -- This approach uses the standard GCC mechanism for
133 -- stack checking. The method assumes that accessing
134 -- storage immediately beyond the end of the stack
135 -- will result in a trap that is converted to a storage
136 -- error by the runtime system. This mechanism has
137 -- minimal overhead, but requires complex hardware,
138 -- operating system and run-time support. Probing is
139 -- the default method where it is available. The stack
140 -- size for the environment task depends on the operating
141 -- system and cannot be set in a system-independent way.
143 -- GNAT Stack-limit Checking
145 -- This method relies on comparing the stack pointer
146 -- with per-task stack limits. If the check fails, an
147 -- exception is explicitly raised. The advantage is
148 -- that the method requires no extra system dependent
149 -- runtime support and can be used on systems without
150 -- memory protection as well, but at the cost of more
151 -- overhead for doing the check. This method is the
152 -- default on systems that lack complete support for
153 -- probing.
155 Stack_Check_Probes_On_Target : Boolean;
156 -- Indicates if stack check probes are used, as opposed to the standard
157 -- target independent comparison method.
159 Stack_Check_Default_On_Target : Boolean;
160 -- Indicates if stack checking is on by default
162 ----------------------------
163 -- Command Line Arguments --
164 ----------------------------
166 -- For most ports of GNAT, command line arguments are supported. The
167 -- following flag is set to False for targets that do not support
168 -- command line arguments (notably VxWorks).
170 Command_Line_Args_On_Target : Boolean;
171 -- Set False if no command line arguments on target
173 -- Note: this is prepared for future use, but not yet used, since we
174 -- do not yet have a way of propagating Targparm params to the binder
176 -----------------------
177 -- Main Program Name --
178 -----------------------
180 -- When the binder generates the main program to be used to create the
181 -- executable, the main program name is main by default (to match the
182 -- usual Unix practice). If this parameter is set to True, then the
183 -- name is instead by default taken from the actual Ada main program
184 -- name (just the name of the child if the main program is a child unit).
185 -- In either case, this value can be overridden using -M name.
187 Use_Ada_Main_Program_Name_On_Target : Boolean;
188 -- Set True to use the Ada main program name as the main name
190 -- Note: this is prepared for future use, but not yet used, since we
191 -- do not yet have a way of propagating Targparm params to the binder
193 ----------------------------
194 -- Support of Long Shifts --
195 ----------------------------
197 -- In GNORT mode, we cannot call library routines, and in particular
198 -- we cannot call routines for long (64-bit) shifts if such routines
199 -- are required on the target. This comes up in the context of support
200 -- of packed arrays. We can only represent packed arrays whose length
201 -- is in the range 33- to 64-bits as modular types if long shifts are
202 -- done with inline code.
204 -- For the default version, for now we set long shifts inlined as True
205 -- This may not be quite accurate, but until we get proper separate
206 -- System's for each target, it is a safer choice.
208 Long_Shifts_Inlined_On_Target : Boolean;
209 -- Indicates if long (double word) shifts are generated using inlined
210 -- code (and thus are permissible in No_Run_Time mode).
212 ----------------------------------------------
213 -- Boolean-Valued Floating-Point Attributes --
214 ----------------------------------------------
216 -- The constants below give the values for representation oriented
217 -- floating-point attributes that are the same for all float types
218 -- on the target. These are all boolean values.
220 -- A value is only True if the target reliably supports the corresponding
221 -- feature. Reliably here means that support is guaranteed for all
222 -- possible settings of the relevant compiler switches (like -mieee),
223 -- since we cannot control the user setting of those switches.
225 -- The attributes cannot dependent on the current setting of compiler
226 -- switches, since the values must be static and consistent throughout
227 -- the partition. We probably should add such consistency checks in future,
228 -- but for now we don't do this.
230 AAMP_On_Target : Boolean;
231 -- Set to True if target is AAMP.
233 Denorm_On_Target : Boolean;
234 -- Set to False on targets that do not reliably support denormals.
235 -- Reliably here means for all settings of the relevant -m flag, so
236 -- for example, this is False on the Alpha where denormals are not
237 -- supported unless -mieee is used.
239 Machine_Rounds_On_Target : Boolean;
240 -- Set to False for targets where S'Machine_Rounds is False
242 Machine_Overflows_On_Target : Boolean;
243 -- Set to True for targets where S'Machine_Overflows is True
245 Signed_Zeros_On_Target : Boolean;
246 -- Set to False on targets that do not reliably support signed zeros.
248 OpenVMS_On_Target : Boolean;
249 -- Set to True if target is OpenVMS.
251 -------------------------------------------
252 -- Boolean-Valued Fixed-Point Attributes --
253 -------------------------------------------
255 Fractional_Fixed_Ops_On_Target : Boolean;
256 -- Set to True for targets that support fixed-by-fixed multiplication
257 -- and division for fixed-point types with a small value equal to
258 -- 2 ** (-(T'Object_Size - 1)) and whose values have an absolute
259 -- value less than 1.0.
261 --------------------------------------------------------------
262 -- Handling of Unconstrained Values Returned from Functions --
263 --------------------------------------------------------------
265 -- Functions that return variable length objects, notably unconstrained
266 -- arrays are a special case, because there is no simple obvious way of
267 -- implementing this feature. Furthermore, this capability is not present
268 -- in C++ or C, so typically the system ABI does not handle this case.
270 -- GNAT uses two different approaches
272 -- The Secondary Stack
274 -- The secondary stack is a special storage pool that is used for
275 -- this purpose. The called function places the result on the
276 -- secondary stack, and the caller uses or copies the value from
277 -- the secondary stack, and pops the secondary stack after the
278 -- value is consumed. The secondary stack is outside the system
279 -- ABI, and the important point is that although generally it is
280 -- handled in a stack like manner corresponding to the subprogram
281 -- call structure, a return from a function does NOT pop the stack.
283 -- DSP (Depressed Stack Pointer)
285 -- Some targets permit the implementation of a function call/return
286 -- protocol in which the function does not pop the main stack pointer
287 -- on return, but rather returns with the stack pointer depressed.
288 -- This is not generally permitted by any ABI, but for at least some
289 -- targets, the implementation of alloca provides a model for this
290 -- approach. If return-with-DSP is implemented, then functions that
291 -- return variable length objects do it by returning with the stack
292 -- pointer depressed, and the returned object is a pointer to the
293 -- area within the stack frame of the called procedure that contains
294 -- the returned value. The caller must then pop the main stack when
295 -- this value is consumed.
297 Functions_Return_By_DSP_On_Target : Boolean;
298 -- Set to True if target permits functions to return with using the
299 -- DSP (depressed stack pointer) approach.
301 -----------------
302 -- Data Layout --
303 -----------------
305 -- Normally when using the GCC backend, Gigi and GCC perform much of the
306 -- data layout using the standard layout capabilities of GCC. If the
307 -- parameter Backend_Layout is set to False, then the front end must
308 -- perform all data layout. For further details see the package Layout.
310 Frontend_Layout_On_Target : Boolean;
311 -- Set True if front end does layout
313 -----------------
314 -- Subprograms --
315 -----------------
317 procedure Get_Target_Parameters;
318 -- Called at the start of execution to read the source of System and
319 -- obtain and set the values of the above parameters.
321 end Targparm;