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 /// NoZerosInBSS - By default some codegens place zero-initialized data to
127 /// .bss section. This flag disables such behaviour (necessary, e.g. for
128 /// crt*.o compiling).
129 unsigned NoZerosInBSS : 1;
130
131 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
132 /// specified on the commandline. When the flag is on, participating targets
133 /// will perform tail call optimization on all calls which use the fastcc
134 /// calling convention and which satisfy certain target-independent
135 /// criteria (being at the end of a function, having the same return type
136 /// as their parent function, etc.), using an alternate ABI if necessary.
138
139 /// StackSymbolOrdering - When true, this will allow CodeGen to order
140 /// the local stack symbols (for code size, code locality, or any other
141 /// heuristics). When false, the local symbols are left in whatever order
142 /// they were generated. Default is true.
144
145 /// EnableFastISel - This flag enables fast-path instruction selection
146 /// which trades away generated code quality in favor of reducing
147 /// compile time.
148 unsigned EnableFastISel : 1;
149
150 /// EnableGlobalISel - This flag enables global instruction selection.
151 unsigned EnableGlobalISel : 1;
152
153 /// EnableGlobalISelAbort - Control abort behaviour when global instruction
154 /// selection fails to lower/select an instruction.
156
157 /// Control when and how the Swift async frame pointer bit should
158 /// be set.
161
162 /// UseInitArray - Use .init_array instead of .ctors for static
163 /// constructors.
164 unsigned UseInitArray : 1;
165
166 /// Emit functions into separate sections.
167 unsigned FunctionSections : 1;
168
169 /// Emit data into separate sections.
170 unsigned DataSections : 1;
171
172 /// Do not emit visibility attribute for xcoff.
174
175 /// Emit XCOFF traceback table.
177
178 unsigned UniqueSectionNames : 1;
179
180 /// Use unique names for basic block sections.
182
183 /// Emit named sections with the same name into different sections.
185
186 /// Emit target-specific trap instruction for 'unreachable' IR instructions.
187 unsigned TrapUnreachable : 1;
188
189 /// Do not emit a trap instruction for 'unreachable' IR instructions behind
190 /// noreturn calls, even if TrapUnreachable is true.
192
193 /// Bit size of immediate TLS offsets (0 == use the default).
194 unsigned TLSSize : 8;
195
196 /// EmulatedTLS - This flag enables emulated TLS model, using emutls
197 /// function in the runtime library..
198 unsigned EmulatedTLS : 1;
199
200 /// EnableTLSDESC - This flag enables TLS Descriptors.
201 unsigned EnableTLSDESC : 1;
202
203 /// This flag enables InterProcedural Register Allocation (IPRA).
204 unsigned EnableIPRA : 1;
205
206 /// Emit section containing metadata on function stack sizes.
208
209 /// Enables the MachineOutliner pass.
211
212 /// Enables the MachineFunctionSplitter pass.
214
215 /// Enables the StaticDataSplitter pass.
217
218 /// Set if the target supports default outlining behaviour.
220
221 /// Enable Machine verifier at the end of default codegen pipelines. (Only
222 /// used with NPM)
224
225 /// Emit address-significance table.
226 unsigned EmitAddrsig : 1;
227
228 // Emit the SHT_LLVM_BB_ADDR_MAP section containing basic block address
229 // which can be used to map virtual addresses to machine basic blocks.
230 unsigned BBAddrMap : 1;
231
232 /// Emit basic blocks into separate sections.
234
235 /// Memory Buffer that contains information on sampled basic blocks and used
236 /// to selectively generate basic block sections.
237 std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
238
239 /// Emit section containing call graph metadata.
241
242 /// The flag enables call site info production. It is used only for debug
243 /// info, and it is restricted only to optimized code. This can be used for
244 /// something else, so that should be controlled in the frontend.
245 unsigned EmitCallSiteInfo : 1;
246 /// Set if the target supports the debug entry values by default.
248 /// When set to true, the EnableDebugEntryValues option forces production
249 /// of debug entry values even if the target does not officially support
250 /// it. Useful for testing purposes only. This flag should never be checked
251 /// directly, always use \ref ShouldEmitDebugEntryValues instead.
253 /// NOTE: There are targets that still do not support the debug entry values
254 /// production.
256
257 // When set to true, use experimental new debug variable location tracking,
258 // which seeks to follow the values of variables rather than their location,
259 // post isel.
261
262 /// Emit DWARF debug frame section.
264
265 /// Emit XRay Function Index section
266 unsigned XRayFunctionIndex : 1;
267
268 /// When set to true, don't use DWARF extensions in later DWARF versions.
269 /// By default, it is set to false.
270 unsigned DebugStrictDwarf : 1;
271
272 /// Emit the hotpatch flag in CodeView debug.
273 unsigned Hotpatch : 1;
274
275 /// Enable JustMyCode instrumentation.
276 unsigned JMCInstrument : 1;
277
278 /// Enable the CFIFixup pass.
279 unsigned EnableCFIFixup : 1;
280
281 /// When set to true, enable MisExpect Diagnostics
282 /// By default, it is set to false
283 unsigned MisExpect : 1;
284
285 /// When set to true, const objects with relocatable address values are put
286 /// into the RO data section.
288
289 /// When set to true, call/return argument extensions of narrow integers
290 /// are verified in the target backend if it cares about them. This is
291 /// not done with internal tools like llc that run many tests that ignore
292 /// (lack) these extensions.
294
295 /// Name of the stack usage file (i.e., .su file) if user passes
296 /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
297 /// passed on the command line.
298 std::string StackUsageFile;
299
300 /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
301 unsigned LoopAlignment = 0;
302
303 /// Which debugger to tune for.
305
306 /// Vector math library to use.
308
309public:
310 /// What exception model to use
312
313 /// Machine level options.
315
316 /// Stores the filename/path of the final .o/.obj file, to be written in the
317 /// debug information. This is used for emitting the CodeView S_OBJNAME
318 /// record.
320};
321
322} // namespace llvm
323
324#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 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.
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.
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.
ExceptionHandling
Definition CodeGen.h:54
@ Default
Not specified; resolve to the target's default model.
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