LLVM 24.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 JumpTable {
32 Single, // Use a single table for all indirect jumptable calls.
33 Arity, // Use one table per number of function parameters.
34 Simplified, // Use one table per function type, with types projected
35 // into 4 types: pointer to non-function, struct,
36 // primitive, and function pointer.
37 Full // Use one table per unique function type
38};
39}
40
42 All, // Use Basic Block Sections for all basic blocks. A section
43 // for every basic block can significantly bloat object file sizes.
44 List, // Get list of functions & BBs from a file. Selectively enables
45 // basic block sections for a subset of basic blocks which can be
46 // used to control object size bloats from creating sections.
47 Preset, // Similar to list but the blocks are identified by passes which
48 // seek to use Basic Block Sections, e.g. MachineFunctionSplitter.
49 // This option cannot be set via the command line.
50 None // Do not use Basic Block Sections.
51};
52
53/// Identify a debugger for "tuning" the debug info.
54///
55/// The "debugger tuning" concept allows us to present a more intuitive
56/// interface that unpacks into different sets of defaults for the various
57/// individual feature-flag settings, that suit the preferences of the
58/// various debuggers. However, it's worth remembering that debuggers are
59/// not the only consumers of debug info, and some variations in DWARF might
60/// better be treated as target/platform issues. Fundamentally,
61/// o if the feature is useful (or not) to a particular debugger, regardless
62/// of the target, that's a tuning decision;
63/// o if the feature is useful (or not) on a particular platform, regardless
64/// of the debugger, that's a target decision.
65/// It's not impossible to see both factors in some specific case.
66enum class DebuggerKind {
67 Default, ///< No specific tuning requested.
68 GDB, ///< Tune debug info for gdb.
69 LLDB, ///< Tune debug info for lldb.
70 SCE, ///< Tune debug info for SCE targets (e.g. PS4).
71 DBX ///< Tune debug info for dbx.
72};
73
74/// Enable abort calls when global instruction selection fails to lower/select
75/// an instruction.
77 Disable, // Disable the abort.
78 Enable, // Enable the abort.
79 DisableWithDiag // Disable the abort but emit a diagnostic on failure.
80};
81
82/// Indicates when and how the Swift async frame pointer bit should be set.
84 /// Determine whether to set the bit statically or dynamically based
85 /// on the deployment target.
87 /// Always set the bit.
89 /// Never set the bit.
91};
92
93/// \brief Enumeration value for AMDGPU code object version, which is the
94/// code object version times 100.
97 COV_2 = 200, // Unsupported.
98 COV_3 = 300, // Unsupported.
99 COV_4 = 400,
100 COV_5 = 500,
101 COV_6 = 600,
102};
103
105public:
125
126 /// EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is
127 /// specified. The code generator is then able to use both volatile and
128 /// nonvolitle vector registers. When false, the code generator only uses
129 /// volatile vector registers which is the default setting on AIX.
131
132 /// NoZerosInBSS - By default some codegens place zero-initialized data to
133 /// .bss section. This flag disables such behaviour (necessary, e.g. for
134 /// crt*.o compiling).
135 unsigned NoZerosInBSS : 1;
136
137 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
138 /// specified on the commandline. When the flag is on, participating targets
139 /// will perform tail call optimization on all calls which use the fastcc
140 /// calling convention and which satisfy certain target-independent
141 /// criteria (being at the end of a function, having the same return type
142 /// as their parent function, etc.), using an alternate ABI if necessary.
144
145 /// StackSymbolOrdering - When true, this will allow CodeGen to order
146 /// the local stack symbols (for code size, code locality, or any other
147 /// heuristics). When false, the local symbols are left in whatever order
148 /// they were generated. Default is true.
150
151 /// EnableFastISel - This flag enables fast-path instruction selection
152 /// which trades away generated code quality in favor of reducing
153 /// compile time.
154 unsigned EnableFastISel : 1;
155
156 /// EnableGlobalISel - This flag enables global instruction selection.
157 unsigned EnableGlobalISel : 1;
158
159 /// EnableGlobalISelAbort - Control abort behaviour when global instruction
160 /// selection fails to lower/select an instruction.
162
163 /// Control when and how the Swift async frame pointer bit should
164 /// be set.
167
168 /// UseInitArray - Use .init_array instead of .ctors for static
169 /// constructors.
170 unsigned UseInitArray : 1;
171
172 /// Emit functions into separate sections.
173 unsigned FunctionSections : 1;
174
175 /// Emit data into separate sections.
176 unsigned DataSections : 1;
177
178 /// Do not emit visibility attribute for xcoff.
180
181 /// Emit XCOFF traceback table.
183
184 unsigned UniqueSectionNames : 1;
185
186 /// Use unique names for basic block sections.
188
189 /// Emit named sections with the same name into different sections.
191
192 /// Emit target-specific trap instruction for 'unreachable' IR instructions.
193 unsigned TrapUnreachable : 1;
194
195 /// Do not emit a trap instruction for 'unreachable' IR instructions behind
196 /// noreturn calls, even if TrapUnreachable is true.
198
199 /// Bit size of immediate TLS offsets (0 == use the default).
200 unsigned TLSSize : 8;
201
202 /// EmulatedTLS - This flag enables emulated TLS model, using emutls
203 /// function in the runtime library..
204 unsigned EmulatedTLS : 1;
205
206 /// EnableTLSDESC - This flag enables TLS Descriptors.
207 unsigned EnableTLSDESC : 1;
208
209 /// This flag enables InterProcedural Register Allocation (IPRA).
210 unsigned EnableIPRA : 1;
211
212 /// Emit section containing metadata on function stack sizes.
214
215 /// Enables the MachineOutliner pass.
217
218 /// Enables the MachineFunctionSplitter pass.
220
221 /// Enables the StaticDataSplitter pass.
223
224 /// Set if the target supports default outlining behaviour.
226
227 /// Enable Machine verifier at the end of default codegen pipelines. (Only
228 /// used with NPM)
230
231 /// Emit address-significance table.
232 unsigned EmitAddrsig : 1;
233
234 // Emit the SHT_LLVM_BB_ADDR_MAP section containing basic block address
235 // which can be used to map virtual addresses to machine basic blocks.
236 unsigned BBAddrMap : 1;
237
238 /// Emit basic blocks into separate sections.
240
241 /// Memory Buffer that contains information on sampled basic blocks and used
242 /// to selectively generate basic block sections.
243 std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
244
245 /// Emit section containing call graph metadata.
247
248 /// The flag enables call site info production. It is used only for debug
249 /// info, and it is restricted only to optimized code. This can be used for
250 /// something else, so that should be controlled in the frontend.
251 unsigned EmitCallSiteInfo : 1;
252 /// Set if the target supports the debug entry values by default.
254 /// When set to true, the EnableDebugEntryValues option forces production
255 /// of debug entry values even if the target does not officially support
256 /// it. Useful for testing purposes only. This flag should never be checked
257 /// directly, always use \ref ShouldEmitDebugEntryValues instead.
259 /// NOTE: There are targets that still do not support the debug entry values
260 /// production.
262
263 // When set to true, use experimental new debug variable location tracking,
264 // which seeks to follow the values of variables rather than their location,
265 // post isel.
267
268 /// Emit DWARF debug frame section.
270
271 /// Emit XRay Function Index section
272 unsigned XRayFunctionIndex : 1;
273
274 /// When set to true, don't use DWARF extensions in later DWARF versions.
275 /// By default, it is set to false.
276 unsigned DebugStrictDwarf : 1;
277
278 /// Emit the hotpatch flag in CodeView debug.
279 unsigned Hotpatch : 1;
280
281 /// Enable JustMyCode instrumentation.
282 unsigned JMCInstrument : 1;
283
284 /// Enable the CFIFixup pass.
285 unsigned EnableCFIFixup : 1;
286
287 /// When set to true, enable MisExpect Diagnostics
288 /// By default, it is set to false
289 unsigned MisExpect : 1;
290
291 /// When set to true, const objects with relocatable address values are put
292 /// into the RO data section.
294
295 /// When set to true, call/return argument extensions of narrow integers
296 /// are verified in the target backend if it cares about them. This is
297 /// not done with internal tools like llc that run many tests that ignore
298 /// (lack) these extensions.
300
301 /// Name of the stack usage file (i.e., .su file) if user passes
302 /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
303 /// passed on the command line.
304 std::string StackUsageFile;
305
306 /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
307 unsigned LoopAlignment = 0;
308
309 /// ThreadModel - This flag specifies the type of threading model to assume
310 /// for things like atomics
312
313 /// EABIVersion - This flag specifies the EABI version
315
316 /// Which debugger to tune for.
318
319 /// Vector math library to use.
321
322public:
323 /// What exception model to use
325
326 /// Machine level options.
328
329 /// Stores the filename/path of the final .o/.obj file, to be written in the
330 /// debug information. This is used for emitting the CodeView S_OBJNAME
331 /// record.
333};
334
335} // namespace llvm
336
337#endif
#define LLVM_ABI
Definition Compiler.h:215
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.
unsigned StackSymbolOrdering
StackSymbolOrdering - When true, this will allow CodeGen to order the local stack symbols (for code s...
MCTargetOptions MCOptions
Machine level options.
llvm::ThreadModel ThreadModel
ThreadModel - This flag specifies the type of threading model to assume for things like atomics.
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 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 EnableCFIFixup
Enable the CFIFixup pass.
unsigned EnableDefaultMachineVerifier
Enable Machine verifier at the end of default codegen pipelines.
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 UniqueBasicBlockSectionNames
Use unique names for basic block sections.
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.
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.
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.
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.
This is an optimization pass for GlobalISel generic memory operations.
CodeObjectVersionKind
Enumeration value for AMDGPU code object version, which is the code object version times 100.
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.
ThreadModel
The threading model to assume for lowering, e.g. of atomics.
Definition CodeGen.h:141
ExceptionHandling
Definition CodeGen.h:54
@ None
No exception support.
Definition CodeGen.h:55
BasicBlockSection
VectorLibrary
List of known vector-functions libraries.
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:32
@ Default
The result value is 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