tree-optimization/113126 - vector extension compare optimization
[official-gcc.git] / gcc / flag-types.h
blob5062f59bc8fcfd5faaa18b6805b026551961a5c2
1 /* Compilation switch flag type definitions for GCC.
2 Copyright (C) 1987-2024 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_FLAG_TYPES_H
21 #define GCC_FLAG_TYPES_H
23 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
25 enum debug_info_type
27 DINFO_TYPE_NONE, /* No debug info. */
28 DINFO_TYPE_DWARF2, /* Dwarf v2 debug info. */
29 DINFO_TYPE_VMS, /* VMS debug info. */
30 DINFO_TYPE_CTF, /* CTF debug info. */
31 DINFO_TYPE_BTF, /* BTF debug info. */
32 DINFO_TYPE_BTF_WITH_CORE, /* BTF debug info with CO-RE relocations. */
33 DINFO_TYPE_MAX = DINFO_TYPE_BTF_WITH_CORE /* Marker only. */
36 #define NO_DEBUG (0U)
37 /* Write DWARF2 debug info (using dwarf2out.cc). */
38 #define DWARF2_DEBUG (1U << DINFO_TYPE_DWARF2)
39 /* Write VMS debug info (using vmsdbgout.cc). */
40 #define VMS_DEBUG (1U << DINFO_TYPE_VMS)
41 /* Write CTF debug info (using ctfout.cc). */
42 #define CTF_DEBUG (1U << DINFO_TYPE_CTF)
43 /* Write BTF debug info (using btfout.cc). */
44 #define BTF_DEBUG (1U << DINFO_TYPE_BTF)
45 /* Write BTF debug info for BPF CO-RE usecase (using btfout.cc). */
46 #define BTF_WITH_CORE_DEBUG (1U << DINFO_TYPE_BTF_WITH_CORE)
48 /* Note: Adding new definitions to handle -combination- of debug formats,
49 like VMS_AND_DWARF2_DEBUG is not recommended. This definition remains
50 here for historical reasons. */
51 /* Write VMS debug info (using vmsdbgout.cc) and DWARF v2 debug info (using
52 dwarf2out.cc). */
53 #define VMS_AND_DWARF2_DEBUG ((VMS_DEBUG | DWARF2_DEBUG))
55 enum debug_info_levels
57 DINFO_LEVEL_NONE, /* Write no debugging info. */
58 DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */
59 DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */
60 DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */
63 /* CTF debug info levels.
64 CTF debug info levels are untied with DWARF debug info levels because CTF
65 may co-exist with DWARF. */
66 enum ctf_debug_info_levels
68 CTFINFO_LEVEL_NONE = 0, /* Write no CTF debug info. */
69 CTFINFO_LEVEL_TERSE = 1, /* Write CTF information to support tracebacks
70 only. Not Implemented. */
71 CTFINFO_LEVEL_NORMAL = 2 /* Write CTF type information for all entities
72 (functions, data objects, variables etc.)
73 at file-scope or global-scope only. */
76 /* A major contribution to object and executable size is debug
77 information size. A major contribution to debug information
78 size is struct descriptions replicated in several object files.
79 The following function determines whether or not debug information
80 should be generated for a given struct. The indirect parameter
81 indicates that the struct is being handled indirectly, via
82 a pointer. See opts.cc for the implementation. */
84 enum debug_info_usage
86 DINFO_USAGE_DFN, /* A struct definition. */
87 DINFO_USAGE_DIR_USE, /* A direct use, such as the type of a variable. */
88 DINFO_USAGE_IND_USE, /* An indirect use, such as through a pointer. */
89 DINFO_USAGE_NUM_ENUMS /* The number of enumerators. */
92 /* A major contribution to object and executable size is debug
93 information size. A major contribution to debug information size
94 is struct descriptions replicated in several object files. The
95 following flags attempt to reduce this information. The basic
96 idea is to not emit struct debugging information in the current
97 compilation unit when that information will be generated by
98 another compilation unit.
100 Debug information for a struct defined in the current source
101 file should be generated in the object file. Likewise the
102 debug information for a struct defined in a header should be
103 generated in the object file of the corresponding source file.
104 Both of these case are handled when the base name of the file of
105 the struct definition matches the base name of the source file
106 of the current compilation unit. This matching emits minimal
107 struct debugging information.
109 The base file name matching rule above will fail to emit debug
110 information for structs defined in system headers. So a second
111 category of files includes system headers in addition to files
112 with matching bases.
114 The remaining types of files are library headers and application
115 headers. We cannot currently distinguish these two types. */
117 enum debug_struct_file
119 DINFO_STRUCT_FILE_NONE, /* Debug no structs. */
120 DINFO_STRUCT_FILE_BASE, /* Debug structs defined in files with the
121 same base name as the compilation unit. */
122 DINFO_STRUCT_FILE_SYS, /* Also debug structs defined in system
123 header files. */
124 DINFO_STRUCT_FILE_ANY /* Debug structs defined in all files. */
127 /* Balance between GNAT encodings and standard DWARF to emit. */
129 enum dwarf_gnat_encodings
131 DWARF_GNAT_ENCODINGS_ALL = 0, /* Emit all GNAT encodings, then emit as
132 much standard DWARF as possible so it
133 does not conflict with GNAT
134 encodings. */
135 DWARF_GNAT_ENCODINGS_GDB = 1, /* Emit as much standard DWARF as possible
136 as long as GDB handles them. Emit GNAT
137 encodings for the rest. */
138 DWARF_GNAT_ENCODINGS_MINIMAL = 2 /* Emit all the standard DWARF we can.
139 Emit GNAT encodings for the rest. */
142 /* Enumerate Objective-c instance variable visibility settings. */
144 enum ivar_visibility
146 IVAR_VISIBILITY_PRIVATE,
147 IVAR_VISIBILITY_PROTECTED,
148 IVAR_VISIBILITY_PUBLIC,
149 IVAR_VISIBILITY_PACKAGE
152 /* The stack reuse level. */
153 enum stack_reuse_level
155 SR_NONE,
156 SR_NAMED_VARS,
157 SR_ALL
160 /* Control Flow Redundancy hardening options for noreturn calls. */
161 enum hardcfr_noret
163 HCFRNR_NEVER,
164 HCFRNR_NOTHROW,
165 HCFRNR_NO_XTHROW,
166 HCFRNR_UNSPECIFIED,
167 HCFRNR_ALWAYS,
170 /* The live patching level. */
171 enum live_patching_level
173 LIVE_PATCHING_NONE = 0,
174 LIVE_PATCHING_INLINE_ONLY_STATIC,
175 LIVE_PATCHING_INLINE_CLONE
178 /* The algorithm used for basic block reordering. */
179 enum reorder_blocks_algorithm
181 REORDER_BLOCKS_ALGORITHM_SIMPLE,
182 REORDER_BLOCKS_ALGORITHM_STC
185 /* The algorithm used for the integrated register allocator (IRA). */
186 enum ira_algorithm
188 IRA_ALGORITHM_CB,
189 IRA_ALGORITHM_PRIORITY
192 /* The regions used for the integrated register allocator (IRA). */
193 enum ira_region
195 IRA_REGION_ONE,
196 IRA_REGION_ALL,
197 IRA_REGION_MIXED,
200 /* The options for excess precision. */
201 enum excess_precision
203 EXCESS_PRECISION_DEFAULT,
204 EXCESS_PRECISION_FAST,
205 EXCESS_PRECISION_STANDARD,
206 EXCESS_PRECISION_FLOAT16
209 /* The options for which values of FLT_EVAL_METHOD are permissible. */
210 enum permitted_flt_eval_methods
212 PERMITTED_FLT_EVAL_METHODS_DEFAULT,
213 PERMITTED_FLT_EVAL_METHODS_TS_18661,
214 PERMITTED_FLT_EVAL_METHODS_C11
217 /* Type of stack check.
219 Stack checking is designed to detect infinite recursion and stack
220 overflows for Ada programs. Furthermore stack checking tries to ensure
221 in that scenario that enough stack space is left to run a signal handler.
223 -fstack-check= does not prevent stack-clash style attacks. For that
224 you want -fstack-clash-protection. */
225 enum stack_check_type
227 /* Do not check the stack. */
228 NO_STACK_CHECK = 0,
230 /* Check the stack generically, i.e. assume no specific support
231 from the target configuration files. */
232 GENERIC_STACK_CHECK,
234 /* Check the stack and rely on the target configuration files to
235 check the static frame of functions, i.e. use the generic
236 mechanism only for dynamic stack allocations. */
237 STATIC_BUILTIN_STACK_CHECK,
239 /* Check the stack and entirely rely on the target configuration
240 files, i.e. do not use the generic mechanism at all. */
241 FULL_BUILTIN_STACK_CHECK
244 /* Type of callgraph information. */
245 enum callgraph_info_type
247 /* No information. */
248 NO_CALLGRAPH_INFO = 0,
250 /* Naked callgraph. */
251 CALLGRAPH_INFO_NAKED = 1,
253 /* Callgraph decorated with stack usage information. */
254 CALLGRAPH_INFO_STACK_USAGE = 2,
256 /* Callgraph decoration with dynamic allocation information. */
257 CALLGRAPH_INFO_DYNAMIC_ALLOC = 4
260 /* Floating-point contraction mode. */
261 enum fp_contract_mode {
262 FP_CONTRACT_OFF = 0,
263 FP_CONTRACT_ON = 1,
264 FP_CONTRACT_FAST = 2
267 /* Scalar storage order kind. */
268 enum scalar_storage_order_kind {
269 SSO_NATIVE = 0,
270 SSO_BIG_ENDIAN,
271 SSO_LITTLE_ENDIAN
274 /* Vectorizer cost-model. Except for DEFAULT, the values are ordered from
275 the most conservative to the least conservative. */
276 enum vect_cost_model {
277 VECT_COST_MODEL_VERY_CHEAP = -3,
278 VECT_COST_MODEL_CHEAP = -2,
279 VECT_COST_MODEL_DYNAMIC = -1,
280 VECT_COST_MODEL_UNLIMITED = 0,
281 VECT_COST_MODEL_DEFAULT = 1
284 /* Automatic variable initialization type. */
285 enum auto_init_type {
286 AUTO_INIT_UNINITIALIZED = 0,
287 AUTO_INIT_PATTERN = 1,
288 AUTO_INIT_ZERO = 2
291 /* Different instrumentation modes. */
292 enum sanitize_code {
293 /* AddressSanitizer. */
294 SANITIZE_ADDRESS = 1UL << 0,
295 SANITIZE_USER_ADDRESS = 1UL << 1,
296 SANITIZE_KERNEL_ADDRESS = 1UL << 2,
297 /* ThreadSanitizer. */
298 SANITIZE_THREAD = 1UL << 3,
299 /* LeakSanitizer. */
300 SANITIZE_LEAK = 1UL << 4,
301 /* UndefinedBehaviorSanitizer. */
302 SANITIZE_SHIFT_BASE = 1UL << 5,
303 SANITIZE_SHIFT_EXPONENT = 1UL << 6,
304 SANITIZE_DIVIDE = 1UL << 7,
305 SANITIZE_UNREACHABLE = 1UL << 8,
306 SANITIZE_VLA = 1UL << 9,
307 SANITIZE_NULL = 1UL << 10,
308 SANITIZE_RETURN = 1UL << 11,
309 SANITIZE_SI_OVERFLOW = 1UL << 12,
310 SANITIZE_BOOL = 1UL << 13,
311 SANITIZE_ENUM = 1UL << 14,
312 SANITIZE_FLOAT_DIVIDE = 1UL << 15,
313 SANITIZE_FLOAT_CAST = 1UL << 16,
314 SANITIZE_BOUNDS = 1UL << 17,
315 SANITIZE_ALIGNMENT = 1UL << 18,
316 SANITIZE_NONNULL_ATTRIBUTE = 1UL << 19,
317 SANITIZE_RETURNS_NONNULL_ATTRIBUTE = 1UL << 20,
318 SANITIZE_OBJECT_SIZE = 1UL << 21,
319 SANITIZE_VPTR = 1UL << 22,
320 SANITIZE_BOUNDS_STRICT = 1UL << 23,
321 SANITIZE_POINTER_OVERFLOW = 1UL << 24,
322 SANITIZE_BUILTIN = 1UL << 25,
323 SANITIZE_POINTER_COMPARE = 1UL << 26,
324 SANITIZE_POINTER_SUBTRACT = 1UL << 27,
325 SANITIZE_HWADDRESS = 1UL << 28,
326 SANITIZE_USER_HWADDRESS = 1UL << 29,
327 SANITIZE_KERNEL_HWADDRESS = 1UL << 30,
328 /* Shadow Call Stack. */
329 SANITIZE_SHADOW_CALL_STACK = 1UL << 31,
330 SANITIZE_SHIFT = SANITIZE_SHIFT_BASE | SANITIZE_SHIFT_EXPONENT,
331 SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE
332 | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN
333 | SANITIZE_SI_OVERFLOW | SANITIZE_BOOL | SANITIZE_ENUM
334 | SANITIZE_BOUNDS | SANITIZE_ALIGNMENT
335 | SANITIZE_NONNULL_ATTRIBUTE
336 | SANITIZE_RETURNS_NONNULL_ATTRIBUTE
337 | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR
338 | SANITIZE_POINTER_OVERFLOW | SANITIZE_BUILTIN,
339 SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST
340 | SANITIZE_BOUNDS_STRICT
343 /* Different settings for zeroing subset of registers. */
344 namespace zero_regs_flags {
345 const unsigned int UNSET = 0;
346 const unsigned int SKIP = 1UL << 0;
347 const unsigned int ONLY_USED = 1UL << 1;
348 const unsigned int ONLY_GPR = 1UL << 2;
349 const unsigned int ONLY_ARG = 1UL << 3;
350 const unsigned int ENABLED = 1UL << 4;
351 const unsigned int LEAFY_MODE = 1UL << 5;
352 const unsigned int USED_GPR_ARG = ENABLED | ONLY_USED | ONLY_GPR | ONLY_ARG;
353 const unsigned int USED_GPR = ENABLED | ONLY_USED | ONLY_GPR;
354 const unsigned int USED_ARG = ENABLED | ONLY_USED | ONLY_ARG;
355 const unsigned int USED = ENABLED | ONLY_USED;
356 const unsigned int ALL_GPR_ARG = ENABLED | ONLY_GPR | ONLY_ARG;
357 const unsigned int ALL_GPR = ENABLED | ONLY_GPR;
358 const unsigned int ALL_ARG = ENABLED | ONLY_ARG;
359 const unsigned int ALL = ENABLED;
360 const unsigned int LEAFY_GPR_ARG = ENABLED | LEAFY_MODE | ONLY_GPR | ONLY_ARG;
361 const unsigned int LEAFY_GPR = ENABLED | LEAFY_MODE | ONLY_GPR;
362 const unsigned int LEAFY_ARG = ENABLED | LEAFY_MODE | ONLY_ARG;
363 const unsigned int LEAFY = ENABLED | LEAFY_MODE;
366 /* Settings of flag_incremental_link. */
367 enum incremental_link {
368 INCREMENTAL_LINK_NONE,
369 /* Do incremental linking and produce binary. */
370 INCREMENTAL_LINK_NOLTO,
371 /* Do incremental linking and produce IL. */
372 INCREMENTAL_LINK_LTO
375 /* Different trace modes. */
376 enum sanitize_coverage_code {
377 /* Trace PC. */
378 SANITIZE_COV_TRACE_PC = 1 << 0,
379 /* Trace Comparison. */
380 SANITIZE_COV_TRACE_CMP = 1 << 1
383 /* flag_vtable_verify initialization levels. */
384 enum vtv_priority {
385 VTV_NO_PRIORITY = 0, /* i.E. Do NOT do vtable verification. */
386 VTV_STANDARD_PRIORITY = 1,
387 VTV_PREINIT_PRIORITY = 2
390 /* flag_lto_partition initialization values. */
391 enum lto_partition_model {
392 LTO_PARTITION_NONE = 0,
393 LTO_PARTITION_ONE = 1,
394 LTO_PARTITION_BALANCED = 2,
395 LTO_PARTITION_1TO1 = 3,
396 LTO_PARTITION_MAX = 4
399 /* flag_lto_linker_output initialization values. */
400 enum lto_linker_output {
401 LTO_LINKER_OUTPUT_UNKNOWN,
402 LTO_LINKER_OUTPUT_REL,
403 LTO_LINKER_OUTPUT_NOLTOREL,
404 LTO_LINKER_OUTPUT_DYN,
405 LTO_LINKER_OUTPUT_PIE,
406 LTO_LINKER_OUTPUT_EXEC
409 /* gfortran -finit-real= values. */
411 enum gfc_init_local_real
413 GFC_INIT_REAL_OFF = 0,
414 GFC_INIT_REAL_ZERO,
415 GFC_INIT_REAL_NAN,
416 GFC_INIT_REAL_SNAN,
417 GFC_INIT_REAL_INF,
418 GFC_INIT_REAL_NEG_INF
421 /* gfortran -fcoarray= values. */
423 enum gfc_fcoarray
425 GFC_FCOARRAY_NONE = 0,
426 GFC_FCOARRAY_SINGLE,
427 GFC_FCOARRAY_LIB
431 /* gfortran -fconvert= values; used for unformatted I/O.
432 Keep in sync with GFC_CONVERT_* in gcc/fortran/libgfortran.h. */
433 enum gfc_convert
435 GFC_FLAG_CONVERT_NATIVE = 0,
436 GFC_FLAG_CONVERT_SWAP,
437 GFC_FLAG_CONVERT_BIG,
438 GFC_FLAG_CONVERT_LITTLE,
439 GFC_FLAG_CONVERT_R16_IEEE = 4,
440 GFC_FLAG_CONVERT_R16_IEEE_SWAP,
441 GFC_FLAG_CONVERT_R16_IEEE_BIG,
442 GFC_FLAG_CONVERT_R16_IEEE_LITTLE,
443 GFC_FLAG_CONVERT_R16_IBM = 8,
444 GFC_FLAG_CONVERT_R16_IBM_SWAP,
445 GFC_FLAG_CONVERT_R16_IBM_BIG,
446 GFC_FLAG_CONVERT_R16_IBM_LITTLE,
450 /* Inline String Operations functions. */
451 enum ilsop_fn
453 ILSOP_NONE = 0,
454 ILSOP_MEMSET = 1 << 0,
455 ILSOP_MEMCPY = 1 << 1,
456 ILSOP_MEMMOVE = 1 << 2,
457 ILSOP_MEMCMP = 1 << 3,
458 ILSOP_ALL = -1
461 /* Control-Flow Protection values. */
462 enum cf_protection_level
464 CF_NONE = 0,
465 CF_BRANCH = 1 << 0,
466 CF_RETURN = 1 << 1,
467 CF_FULL = CF_BRANCH | CF_RETURN,
468 CF_SET = 1 << 2,
469 CF_CHECK = 1 << 3
472 /* Parloops schedule type. */
473 enum parloops_schedule_type
475 PARLOOPS_SCHEDULE_STATIC = 0,
476 PARLOOPS_SCHEDULE_DYNAMIC,
477 PARLOOPS_SCHEDULE_GUIDED,
478 PARLOOPS_SCHEDULE_AUTO,
479 PARLOOPS_SCHEDULE_RUNTIME
482 /* Ranger debug mode. */
483 enum ranger_debug
485 RANGER_DEBUG_NONE = 0,
486 RANGER_DEBUG_TRACE = 1,
487 RANGER_DEBUG_CACHE = 2,
488 RANGER_DEBUG_GORI = 4,
489 RANGER_DEBUG_TRACE_GORI = (RANGER_DEBUG_TRACE | RANGER_DEBUG_GORI),
490 RANGER_DEBUG_TRACE_CACHE = (RANGER_DEBUG_TRACE | RANGER_DEBUG_CACHE),
491 RANGER_DEBUG_ALL = (RANGER_DEBUG_GORI | RANGER_DEBUG_CACHE
492 | RANGER_DEBUG_TRACE)
495 /* Jump threader verbose dumps. */
496 enum threader_debug
498 THREADER_DEBUG_NONE = 0,
499 THREADER_DEBUG_ALL = 1
502 /* Modes of OpenACC 'kernels' constructs handling. */
503 enum openacc_kernels
505 OPENACC_KERNELS_DECOMPOSE,
506 OPENACC_KERNELS_PARLOOPS
509 /* Modes of OpenACC privatization diagnostics. */
510 enum openacc_privatization
512 OPENACC_PRIVATIZATION_QUIET,
513 OPENACC_PRIVATIZATION_NOISY
516 /* Targets for -fopenmp-target-simd-clone. */
517 enum omp_target_simd_clone_device_kind
519 OMP_TARGET_SIMD_CLONE_NONE = 0,
520 OMP_TARGET_SIMD_CLONE_HOST = 1,
521 OMP_TARGET_SIMD_CLONE_NOHOST = 2,
522 OMP_TARGET_SIMD_CLONE_ANY = 3
525 #endif
527 #endif /* ! GCC_FLAG_TYPES_H */