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