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