LLVM 23.0.0git
TargetOptions.h
Go to the documentation of this file.
1//===-- llvm/Target/TargetOptions.h - Target Options ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines command line option flags that are shared across various
10// targets.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TARGET_TARGETOPTIONS_H
15#define LLVM_TARGET_TARGETOPTIONS_H
16
22
23#include <memory>
24
25namespace llvm {
26struct fltSemantics;
27class MachineFunction;
28class MemoryBuffer;
29
30namespace FPOpFusion {
32 Fast, // Enable fusion of FP ops wherever it's profitable.
33 Standard, // Only allow fusion of 'blessed' ops (currently just fmuladd).
34 Strict // Never fuse FP-ops.
35};
36}
37
38namespace JumpTable {
40 Single, // Use a single table for all indirect jumptable calls.
41 Arity, // Use one table per number of function parameters.
42 Simplified, // Use one table per function type, with types projected
43 // into 4 types: pointer to non-function, struct,
44 // primitive, and function pointer.
45 Full // Use one table per unique function type
46};
47}
48
49namespace ThreadModel {
50enum Model {
51 POSIX, // POSIX Threads
52 Single // Single Threaded Environment
53};
54}
55
57 All, // Use Basic Block Sections for all basic blocks. A section
58 // for every basic block can significantly bloat object file sizes.
59 List, // Get list of functions & BBs from a file. Selectively enables
60 // basic block sections for a subset of basic blocks which can be
61 // used to control object size bloats from creating sections.
62 Preset, // Similar to list but the blocks are identified by passes which
63 // seek to use Basic Block Sections, e.g. MachineFunctionSplitter.
64 // This option cannot be set via the command line.
65 None // Do not use Basic Block Sections.
66};
67
68/// Identify a debugger for "tuning" the debug info.
69///
70/// The "debugger tuning" concept allows us to present a more intuitive
71/// interface that unpacks into different sets of defaults for the various
72/// individual feature-flag settings, that suit the preferences of the
73/// various debuggers. However, it's worth remembering that debuggers are
74/// not the only consumers of debug info, and some variations in DWARF might
75/// better be treated as target/platform issues. Fundamentally,
76/// o if the feature is useful (or not) to a particular debugger, regardless
77/// of the target, that's a tuning decision;
78/// o if the feature is useful (or not) on a particular platform, regardless
79/// of the debugger, that's a target decision.
80/// It's not impossible to see both factors in some specific case.
81enum class DebuggerKind {
82 Default, ///< No specific tuning requested.
83 GDB, ///< Tune debug info for gdb.
84 LLDB, ///< Tune debug info for lldb.
85 SCE, ///< Tune debug info for SCE targets (e.g. PS4).
86 DBX ///< Tune debug info for dbx.
87};
88
89/// Enable abort calls when global instruction selection fails to lower/select
90/// an instruction.
92 Disable, // Disable the abort.
93 Enable, // Enable the abort.
94 DisableWithDiag // Disable the abort but emit a diagnostic on failure.
95};
96
97/// Indicates when and how the Swift async frame pointer bit should be set.
99 /// Determine whether to set the bit statically or dynamically based
100 /// on the deployment target.
102 /// Always set the bit.
104 /// Never set the bit.
106};
107
108/// \brief Enumeration value for AMDGPU code object version, which is the
109/// code object version times 100.
112 COV_2 = 200, // Unsupported.
113 COV_3 = 300, // Unsupported.
114 COV_4 = 400,
115 COV_5 = 500,
116 COV_6 = 600,
117};
118
120public:
144
145 /// DisableFramePointerElim - This returns true if frame pointer elimination
146 /// optimization should be disabled for the given machine function.
148
149 /// FramePointerIsReserved - This returns true if the frame pointer must
150 /// always either point to a new frame record or be un-modified in the given
151 /// function.
152 LLVM_ABI bool FramePointerIsReserved(const MachineFunction &MF) const;
153
154 /// If greater than 0, override the default value of
155 /// MCAsmInfo::BinutilsVersion.
156 std::pair<int, int> BinutilsVersion{0, 0};
157
158 /// NoTrappingFPMath - This flag is enabled when the
159 /// -enable-no-trapping-fp-math is specified on the command line. This
160 /// specifies that there are no trap handlers to handle exceptions.
161 unsigned NoTrappingFPMath : 1;
162
163 /// NoSignedZerosFPMath - This flag is enabled when the
164 /// -enable-no-signed-zeros-fp-math is specified on the command line. This
165 /// specifies that optimizations are allowed to treat the sign of a zero
166 /// argument or result as insignificant.
168
169 /// EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is
170 /// specified. The code generator is then able to use both volatile and
171 /// nonvolitle vector registers. When false, the code generator only uses
172 /// volatile vector registers which is the default setting on AIX.
174
175 /// HonorSignDependentRoundingFPMath - This returns true when the
176 /// -enable-sign-dependent-rounding-fp-math is specified. If this returns
177 /// false (the default), the code generator is allowed to assume that the
178 /// rounding behavior is the default (round-to-zero for all floating point
179 /// to integer conversions, and round-to-nearest for all other arithmetic
180 /// truncations). If this is enabled (set to true), the code generator must
181 /// assume that the rounding mode may dynamically change.
184
185 /// NoZerosInBSS - By default some codegens place zero-initialized data to
186 /// .bss section. This flag disables such behaviour (necessary, e.g. for
187 /// crt*.o compiling).
188 unsigned NoZerosInBSS : 1;
189
190 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
191 /// specified on the commandline. When the flag is on, participating targets
192 /// will perform tail call optimization on all calls which use the fastcc
193 /// calling convention and which satisfy certain target-independent
194 /// criteria (being at the end of a function, having the same return type
195 /// as their parent function, etc.), using an alternate ABI if necessary.
197
198 /// StackSymbolOrdering - When true, this will allow CodeGen to order
199 /// the local stack symbols (for code size, code locality, or any other
200 /// heuristics). When false, the local symbols are left in whatever order
201 /// they were generated. Default is true.
203
204 /// EnableFastISel - This flag enables fast-path instruction selection
205 /// which trades away generated code quality in favor of reducing
206 /// compile time.
207 unsigned EnableFastISel : 1;
208
209 /// EnableGlobalISel - This flag enables global instruction selection.
210 unsigned EnableGlobalISel : 1;
211
212 /// EnableGlobalISelAbort - Control abort behaviour when global instruction
213 /// selection fails to lower/select an instruction.
215
216 /// Control when and how the Swift async frame pointer bit should
217 /// be set.
220
221 /// UseInitArray - Use .init_array instead of .ctors for static
222 /// constructors.
223 unsigned UseInitArray : 1;
224
225 /// Disable the integrated assembler.
227
228 /// Emit functions into separate sections.
229 unsigned FunctionSections : 1;
230
231 /// Emit data into separate sections.
232 unsigned DataSections : 1;
233
234 /// Do not emit visibility attribute for xcoff.
236
237 /// Emit XCOFF traceback table.
239
240 unsigned UniqueSectionNames : 1;
241
242 /// Use unique names for basic block sections.
244
245 /// Emit named sections with the same name into different sections.
247
248 /// Emit target-specific trap instruction for 'unreachable' IR instructions.
249 unsigned TrapUnreachable : 1;
250
251 /// Do not emit a trap instruction for 'unreachable' IR instructions behind
252 /// noreturn calls, even if TrapUnreachable is true.
254
255 /// Bit size of immediate TLS offsets (0 == use the default).
256 unsigned TLSSize : 8;
257
258 /// EmulatedTLS - This flag enables emulated TLS model, using emutls
259 /// function in the runtime library..
260 unsigned EmulatedTLS : 1;
261
262 /// EnableTLSDESC - This flag enables TLS Descriptors.
263 unsigned EnableTLSDESC : 1;
264
265 /// This flag enables InterProcedural Register Allocation (IPRA).
266 unsigned EnableIPRA : 1;
267
268 /// Emit section containing metadata on function stack sizes.
270
271 /// Enables the MachineOutliner pass.
273
274 /// Enables the MachineFunctionSplitter pass.
276
277 /// Enables the StaticDataSplitter pass.
279
280 /// Set if the target supports default outlining behaviour.
282
283 /// Emit address-significance table.
284 unsigned EmitAddrsig : 1;
285
286 // Emit the SHT_LLVM_BB_ADDR_MAP section containing basic block address
287 // which can be used to map virtual addresses to machine basic blocks.
288 unsigned BBAddrMap : 1;
289
290 /// Emit basic blocks into separate sections.
292
293 /// Memory Buffer that contains information on sampled basic blocks and used
294 /// to selectively generate basic block sections.
295 std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
296
297 /// Emit section containing call graph metadata.
299
300 /// The flag enables call site info production. It is used only for debug
301 /// info, and it is restricted only to optimized code. This can be used for
302 /// something else, so that should be controlled in the frontend.
303 unsigned EmitCallSiteInfo : 1;
304 /// Set if the target supports the debug entry values by default.
306 /// When set to true, the EnableDebugEntryValues option forces production
307 /// of debug entry values even if the target does not officially support
308 /// it. Useful for testing purposes only. This flag should never be checked
309 /// directly, always use \ref ShouldEmitDebugEntryValues instead.
311 /// NOTE: There are targets that still do not support the debug entry values
312 /// production.
314
315 // When set to true, use experimental new debug variable location tracking,
316 // which seeks to follow the values of variables rather than their location,
317 // post isel.
319
320 /// Emit DWARF debug frame section.
322
323 /// Emit XRay Function Index section
324 unsigned XRayFunctionIndex : 1;
325
326 /// When set to true, don't use DWARF extensions in later DWARF versions.
327 /// By default, it is set to false.
328 unsigned DebugStrictDwarf : 1;
329
330 /// Emit the hotpatch flag in CodeView debug.
331 unsigned Hotpatch : 1;
332
333 /// Enables scalar MASS conversions
335
336 /// Enable JustMyCode instrumentation.
337 unsigned JMCInstrument : 1;
338
339 /// Enable the CFIFixup pass.
340 unsigned EnableCFIFixup : 1;
341
342 /// When set to true, enable MisExpect Diagnostics
343 /// By default, it is set to false
344 unsigned MisExpect : 1;
345
346 /// When set to true, const objects with relocatable address values are put
347 /// into the RO data section.
349
350 /// When set to true, call/return argument extensions of narrow integers
351 /// are verified in the target backend if it cares about them. This is
352 /// not done with internal tools like llc that run many tests that ignore
353 /// (lack) these extensions.
355
356 /// Name of the stack usage file (i.e., .su file) if user passes
357 /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
358 /// passed on the command line.
359 std::string StackUsageFile;
360
361 /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
362 unsigned LoopAlignment = 0;
363
364 /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
365 /// on the command line. This setting may either be Default, Soft, or Hard.
366 /// Default selects the target's default behavior. Soft selects the ABI for
367 /// software floating point, but does not indicate that FP hardware may not
368 /// be used. Such a combination is unfortunately popular (e.g.
369 /// arm-apple-darwin). Hard presumes that the normal FP ABI is used.
371
372 /// AllowFPOpFusion - This flag is set by the -fp-contract=xxx option.
373 /// This controls the creation of fused FP ops that store intermediate
374 /// results in higher precision than IEEE allows (E.g. FMAs).
375 ///
376 /// Fast mode - allows formation of fused FP ops whenever they're
377 /// profitable.
378 /// Standard mode - allow fusion only for 'blessed' FP ops. At present the
379 /// only blessed op is the fmuladd intrinsic. In the future more blessed ops
380 /// may be added.
381 /// Strict mode - allow fusion only if/when it can be proven that the excess
382 /// precision won't effect the result.
383 ///
384 /// Note: This option only controls formation of fused ops by the
385 /// optimizers. Fused operations that are explicitly specified (e.g. FMA
386 /// via the llvm.fma.* intrinsic) will always be honored, regardless of
387 /// the value of this option.
389
390 /// ThreadModel - This flag specifies the type of threading model to assume
391 /// for things like atomics
393
394 /// EABIVersion - This flag specifies the EABI version
396
397 /// Which debugger to tune for.
399
400 /// Vector math library to use.
402
403public:
404 /// What exception model to use
406
407 /// Machine level options.
409
410 /// Stores the filename/path of the final .o/.obj file, to be written in the
411 /// debug information. This is used for emitting the CodeView S_OBJNAME
412 /// record.
414};
415
416} // namespace llvm
417
418#endif
#define LLVM_ABI
Definition Compiler.h:213
Utilities for dealing with flags related to floating point properties and mode controls.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
unsigned VerifyArgABICompliance
When set to true, call/return argument extensions of narrow integers are verified in the target backe...
unsigned EnableTLSDESC
EnableTLSDESC - This flag enables TLS Descriptors.
unsigned EmitStackSizeSection
Emit section containing metadata on function stack sizes.
unsigned XCOFFReadOnlyPointers
When set to true, const objects with relocatable address values are put into the RO data section.
unsigned EmitAddrsig
Emit address-significance table.
unsigned EnableAIXExtendedAltivecABI
EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is specified.
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
LLVM_ABI bool HonorSignDependentRoundingFPMath() const
HonorSignDependentRoundingFPMath - Return true if the codegen must assume that the rounding mode of t...
unsigned StackSymbolOrdering
StackSymbolOrdering - When true, this will allow CodeGen to order the local stack symbols (for code s...
MCTargetOptions MCOptions
Machine level options.
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line.
std::pair< int, int > BinutilsVersion
If greater than 0, override the default value of MCAsmInfo::BinutilsVersion.
VectorLibrary VecLib
Vector math library to use.
unsigned ForceDwarfFrameSection
Emit DWARF debug frame section.
unsigned NoZerosInBSS
NoZerosInBSS - By default some codegens place zero-initialized data to .bss section.
unsigned EmitCallSiteInfo
The flag enables call site info production.
std::string ObjectFilenameForDebug
Stores the filename/path of the final .o/.obj file, to be written in the debug information.
unsigned MisExpect
When set to true, enable MisExpect Diagnostics By default, it is set to false.
unsigned EnableMachineOutliner
Enables the MachineOutliner pass.
unsigned SeparateNamedSections
Emit named sections with the same name into different sections.
SwiftAsyncFramePointerMode SwiftAsyncFramePointer
Control when and how the Swift async frame pointer bit should be set.
unsigned SupportsDebugEntryValues
Set if the target supports the debug entry values by default.
EABI EABIVersion
EABIVersion - This flag specifies the EABI version.
unsigned Hotpatch
Emit the hotpatch flag in CodeView debug.
BasicBlockSection BBSections
Emit basic blocks into separate sections.
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
unsigned ValueTrackingVariableLocations
GlobalISelAbortMode GlobalISelAbort
EnableGlobalISelAbort - Control abort behaviour when global instruction selection fails to lower/sele...
unsigned XCOFFTracebackTable
Emit XCOFF traceback table.
DebuggerKind DebuggerTuning
Which debugger to tune for.
unsigned IgnoreXCOFFVisibility
Do not emit visibility attribute for xcoff.
unsigned NoSignedZerosFPMath
NoSignedZerosFPMath - This flag is enabled when the -enable-no-signed-zeros-fp-math is specified on t...
unsigned EnableCFIFixup
Enable the CFIFixup pass.
unsigned DebugStrictDwarf
When set to true, don't use DWARF extensions in later DWARF versions.
unsigned SupportsDefaultOutlining
Set if the target supports default outlining behaviour.
unsigned PPCGenScalarMASSEntries
Enables scalar MASS conversions.
unsigned UniqueBasicBlockSectionNames
Use unique names for basic block sections.
LLVM_ABI bool FramePointerIsReserved(const MachineFunction &MF) const
FramePointerIsReserved - This returns true if the frame pointer must always either point to a new fra...
unsigned LoopAlignment
If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
unsigned TLSSize
Bit size of immediate TLS offsets (0 == use the default).
unsigned EnableStaticDataPartitioning
Enables the StaticDataSplitter pass.
LLVM_ABI bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
std::shared_ptr< MemoryBuffer > BBSectionsFuncListBuf
Memory Buffer that contains information on sampled basic blocks and used to selectively generate basi...
unsigned FunctionSections
Emit functions into separate sections.
unsigned EnableMachineFunctionSplitter
Enables the MachineFunctionSplitter pass.
unsigned EnableIPRA
This flag enables InterProcedural Register Allocation (IPRA).
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for 'unreachable' IR instructions behind noreturn calls,...
unsigned EnableGlobalISel
EnableGlobalISel - This flag enables global instruction selection.
unsigned DataSections
Emit data into separate sections.
std::string StackUsageFile
Name of the stack usage file (i.e., .su file) if user passes -fstack-usage.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline.
ThreadModel::Model ThreadModel
ThreadModel - This flag specifies the type of threading model to assume for things like atomics.
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library.
unsigned EnableDebugEntryValues
When set to true, the EnableDebugEntryValues option forces production of debug entry values even if t...
unsigned XRayFunctionIndex
Emit XRay Function Index section.
unsigned NoTrappingFPMath
NoTrappingFPMath - This flag is enabled when the -enable-no-trapping-fp-math is specified on the comm...
unsigned DisableIntegratedAS
Disable the integrated assembler.
LLVM_ABI bool ShouldEmitDebugEntryValues() const
NOTE: There are targets that still do not support the debug entry values production.
unsigned EmitCallGraphSection
Emit section containing call graph metadata.
ExceptionHandling ExceptionModel
What exception model to use.
unsigned JMCInstrument
Enable JustMyCode instrumentation.
FPOpFusion::FPOpFusionMode AllowFPOpFusion
AllowFPOpFusion - This flag is set by the -fp-contract=xxx option.
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
CodeObjectVersionKind
Enumeration value for AMDGPU code object version, which is the code object version times 100.
ExceptionHandling
Definition CodeGen.h:53
@ None
No exception support.
Definition CodeGen.h:54
SwiftAsyncFramePointerMode
Indicates when and how the Swift async frame pointer bit should be set.
@ DeploymentBased
Determine whether to set the bit statically or dynamically based on the deployment target.
BasicBlockSection
VectorLibrary
List of known vector-functions libraries.
EABI
Definition CodeGen.h:73
DebuggerKind
Identify a debugger for "tuning" the debug info.
@ SCE
Tune debug info for SCE targets (e.g. PS4).
@ DBX
Tune debug info for dbx.
@ Default
No specific tuning requested.
@ GDB
Tune debug info for gdb.
@ LLDB
Tune debug info for lldb.
@ Always
Always emit .debug_str_offsets talbes as DWARF64 for testing.
Definition DWP.h:28
@ Default
The result values are uniform if and only if all operands are uniform.
Definition Uniformity.h:20
GlobalISelAbortMode
Enable abort calls when global instruction selection fails to lower/select an instruction.
@ Enable
Enable colors.
Definition WithColor.h:47
@ Disable
Disable colors.
Definition WithColor.h:49