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. -function-splitting=all.
49 // This option cannot be set via the command line.
50 None // Do not use Basic Block Sections.
51};
52
53/// Late function splitting mode. Decides which functions are eligible to have
54/// their cold blocks moved into a separate section.
56 None, // Hard off. Never create a cold section, even for functions
57 // which have a basic block sections profile. Such functions
58 // are still laid out using the profile, but are emitted as a
59 // single contiguous section.
60 BBSectionsOnly, // Split only functions that have a basic block sections
61 // profile. Functions without one are not split, even if
62 // they have PGO/SamplePGO data. This is the default, and
63 // matches the behavior without -fsplit-machine-functions.
64 All // Split functions using the basic block sections profile
65 // where it is available, and PGO/AutoFDO elsewhere.
66};
67
68/// Enable abort calls when global instruction selection fails to lower/select
69/// an instruction.
71 Disable, // Disable the abort.
72 Enable, // Enable the abort.
73 DisableWithDiag // Disable the abort but emit a diagnostic on failure.
74};
75
76/// Indicates when and how the Swift async frame pointer bit should be set.
78 /// Determine whether to set the bit statically or dynamically based
79 /// on the deployment target.
81 /// Always set the bit.
83 /// Never set the bit.
85};
86
87/// \brief Enumeration value for AMDGPU code object version, which is the
88/// code object version times 100.
91 COV_2 = 200, // Unsupported.
92 COV_3 = 300, // Unsupported.
93 COV_4 = 400,
94 COV_5 = 500,
95 COV_6 = 600,
96};
97
99public:
117
118 /// NoZerosInBSS - By default some codegens place zero-initialized data to
119 /// .bss section. This flag disables such behaviour (necessary, e.g. for
120 /// crt*.o compiling).
121 unsigned NoZerosInBSS : 1;
122
123 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
124 /// specified on the commandline. When the flag is on, participating targets
125 /// will perform tail call optimization on all calls which use the fastcc
126 /// calling convention and which satisfy certain target-independent
127 /// criteria (being at the end of a function, having the same return type
128 /// as their parent function, etc.), using an alternate ABI if necessary.
130
131 /// StackSymbolOrdering - When true, this will allow CodeGen to order
132 /// the local stack symbols (for code size, code locality, or any other
133 /// heuristics). When false, the local symbols are left in whatever order
134 /// they were generated. Default is true.
136
137 /// EnableFastISel - This flag enables fast-path instruction selection
138 /// which trades away generated code quality in favor of reducing
139 /// compile time.
140 unsigned EnableFastISel : 1;
141
142 /// EnableGlobalISel - This flag enables global instruction selection.
143 unsigned EnableGlobalISel : 1;
144
145 /// EnableGlobalISelAbort - Control abort behaviour when global instruction
146 /// selection fails to lower/select an instruction.
148
149 /// Control when and how the Swift async frame pointer bit should
150 /// be set.
153
154 /// UseInitArray - Use .init_array instead of .ctors for static
155 /// constructors.
156 unsigned UseInitArray : 1;
157
158 /// Emit functions into separate sections.
159 unsigned FunctionSections : 1;
160
161 /// Emit data into separate sections.
162 unsigned DataSections : 1;
163
164 /// Do not emit visibility attribute for xcoff.
166
167 /// Emit XCOFF traceback table.
169
170 unsigned UniqueSectionNames : 1;
171
172 /// Use unique names for basic block sections.
174
175 /// Emit named sections with the same name into different sections.
177
178 /// Emit target-specific trap instruction for 'unreachable' IR instructions.
179 unsigned TrapUnreachable : 1;
180
181 /// Do not emit a trap instruction for 'unreachable' IR instructions behind
182 /// noreturn calls, even if TrapUnreachable is true.
184
185 /// Bit size of immediate TLS offsets (0 == use the default).
186 unsigned TLSSize : 8;
187
188 /// EmulatedTLS - This flag enables emulated TLS model, using emutls
189 /// function in the runtime library..
190 unsigned EmulatedTLS : 1;
191
192 /// EnableTLSDESC - This flag enables TLS Descriptors.
193 unsigned EnableTLSDESC : 1;
194
195 /// This flag enables InterProcedural Register Allocation (IPRA).
196 unsigned EnableIPRA : 1;
197
198 /// Emit section containing metadata on function stack sizes.
200
201 /// Enables the MachineOutliner pass.
203
204 /// Enables the StaticDataSplitter pass.
206
207 /// Enable Machine verifier at the end of default codegen pipelines. (Only
208 /// used with NPM)
210
211 /// Emit address-significance table.
212 unsigned EmitAddrsig : 1;
213
214 // Emit the SHT_LLVM_BB_ADDR_MAP section containing basic block address
215 // which can be used to map virtual addresses to machine basic blocks.
216 unsigned BBAddrMap : 1;
217
218 /// Emit basic blocks into separate sections.
220
221 /// Which functions are eligible for late function splitting.
224
225 /// Memory Buffer that contains information on sampled basic blocks and used
226 /// to selectively generate basic block sections.
227 std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
228
229 /// Emit section containing call graph metadata.
231
232 /// The flag enables call site info production. It is used only for debug
233 /// info, and it is restricted only to optimized code. This can be used for
234 /// something else, so that should be controlled in the frontend.
235 unsigned EmitCallSiteInfo : 1;
236 /// When set to true, the EnableDebugEntryValues option forces production
237 /// of debug entry values even if the target does not officially support
238 /// it. Useful for testing purposes only. This flag should never be checked
239 /// directly, always use \ref TargetMachine::shouldEmitDebugEntryValues
240 /// instead.
242
243 // When set to true, use experimental new debug variable location tracking,
244 // which seeks to follow the values of variables rather than their location,
245 // post isel.
247
248 /// Emit DWARF debug frame section.
250
251 /// Emit XRay Function Index section
252 unsigned XRayFunctionIndex : 1;
253
254 /// When set to true, don't use DWARF extensions in later DWARF versions.
255 /// By default, it is set to false.
256 unsigned DebugStrictDwarf : 1;
257
258 /// Enable JustMyCode instrumentation.
259 unsigned JMCInstrument : 1;
260
261 /// Enable the CFIFixup pass.
262 unsigned EnableCFIFixup : 1;
263
264 /// When set to true, enable MisExpect Diagnostics
265 /// By default, it is set to false
266 unsigned MisExpect : 1;
267
268 /// When set to true, const objects with relocatable address values are put
269 /// into the RO data section.
271
272 /// When set to true, call/return argument extensions of narrow integers
273 /// are verified in the target backend if it cares about them. This is off
274 /// by default and enabled explicitly by each front-end separately.
276
277 /// Name of the stack usage file (i.e., .su file) if user passes
278 /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
279 /// passed on the command line.
280 std::string StackUsageFile;
281
282 /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
283 unsigned LoopAlignment = 0;
284
285 /// Which debugger to tune for.
287
288 /// Vector math library to use.
290
291public:
292 /// Machine level options.
294
295 /// Stores the filename/path of the final .o/.obj file, to be written in the
296 /// debug information. This is used for emitting the CodeView S_OBJNAME
297 /// record.
299};
300
301} // namespace llvm
302
303#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.
FunctionSplittingMode FunctionSplitting
Which functions are eligible for late function splitting.
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.
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 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.
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.
BasicBlockSection
VectorLibrary
List of known vector-functions libraries.
DebuggerKind
Identify a debugger for "tuning" the debug info.
Definition CodeGen.h:231
@ Default
No specific tuning requested.
Definition CodeGen.h:232
FunctionSplittingMode
Late function splitting mode.
@ 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