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