clang 22.0.0git
CodeGenOptions.h
Go to the documentation of this file.
1//===--- CodeGenOptions.h ---------------------------------------*- 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 the CodeGenOptions interface.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H
14#define LLVM_CLANG_BASIC_CODEGENOPTIONS_H
15
20#include "llvm/ADT/FloatingPointMode.h"
21#include "llvm/Frontend/Debug/Options.h"
22#include "llvm/Frontend/Driver/CodeGenOptions.h"
23#include "llvm/Support/CodeGen.h"
24#include "llvm/Support/Regex.h"
25#include "llvm/Target/TargetOptions.h"
26#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
27#include <map>
28#include <memory>
29#include <string>
30#include <vector>
31
32namespace llvm {
33class PassBuilder;
34}
35namespace clang {
36
37/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
38/// that this large collection of bitfields is a trivial class type.
40 friend class CompilerInvocation;
42
43public:
44 /// For ASTs produced with different option value, signifies their level of
45 /// compatibility.
46 enum class CompatibilityKind {
47 /// Does affect the construction of the AST in a way that does prevent
48 /// module interoperability.
50 /// Does affect the construction of the AST in a way that doesn't prevent
51 /// interoperability (that is, the value can be different between an
52 /// explicit module and the user of that module).
54 /// Does not affect the construction of the AST in any way (that is, the
55 /// value can be different between an implicit module and the user of that
56 /// module).
57 Benign,
58 };
59
61 using ProfileInstrKind = llvm::driver::ProfileInstrKind;
63 llvm::AsanDetectStackUseAfterReturnMode;
64 using AsanDtorKind = llvm::AsanDtorKind;
65 using VectorLibrary = llvm::driver::VectorLibrary;
66 using ZeroCallUsedRegsKind = llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind;
67 using WinX64EHUnwindV2Mode = llvm::WinX64EHUnwindV2Mode;
68
69 using DebugCompressionType = llvm::DebugCompressionType;
70 using EmitDwarfUnwindType = llvm::EmitDwarfUnwindType;
71 using DebugTemplateNamesKind = llvm::codegenoptions::DebugTemplateNamesKind;
72 using DebugInfoKind = llvm::codegenoptions::DebugInfoKind;
73 using DebuggerKind = llvm::DebuggerKind;
74
75#define CODEGENOPT(Name, Bits, Default, Compatibility) unsigned Name : Bits;
76#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility)
77#include "clang/Basic/CodeGenOptions.def"
78
79protected:
80#define CODEGENOPT(Name, Bits, Default, Compatibility)
81#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
82 unsigned Name : Bits;
83#include "clang/Basic/CodeGenOptions.def"
84};
85
86/// CodeGenOptions - Track various options which control how the code
87/// is optimized and passed to the backend.
89public:
91 NormalInlining, // Use the standard function inlining pass.
92 OnlyHintInlining, // Inline only (implicitly) hinted functions.
93 OnlyAlwaysInlining // Only run the always inlining pass.
94 };
95
97 Legacy = 0,
99 Mixed = 2
100 };
101
102 enum TLSModel {
107 };
108
110 SRCK_Default, // No special option was passed.
111 SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return).
112 SRCK_InRegs // Small structs in registers (-freg-struct-return).
113 };
114
116 Embed_Off, // No embedded bitcode.
117 Embed_All, // Embed both bitcode and commandline in the output.
118 Embed_Bitcode, // Embed just the bitcode in the output.
119 Embed_Marker // Embed a marker as a placeholder for bitcode.
120 };
121
123 None,
124 This,
125 All,
126 };
127
131 };
132
138 };
139
140 // This field stores one of the allowed values for the option
141 // -fbasic-block-sections=. The allowed values with this option are:
142 // {"all", "list=<file>", "none"}.
143 //
144 // "all" : Generate basic block sections for all basic blocks.
145 // "list=<file>": Generate basic block sections for a subset of basic blocks.
146 // The functions and the machine basic block ids are specified
147 // in the file.
148 // "none": Disable sections for basic blocks.
149 std::string BBSections;
150
151 // If set, override the default value of MCAsmInfo::BinutilsVersion. If
152 // DisableIntegratedAS is specified, the assembly output will consider GNU as
153 // support. "none" means that all ELF features can be used, regardless of
154 // binutils support.
155 std::string BinutilsVersion;
156
157 enum class FramePointerKind {
158 None, // Omit all frame pointers.
159 Reserved, // Maintain valid frame pointer chain.
160 NonLeaf, // Keep non-leaf frame pointers.
161 All, // Keep all frame pointers.
162 };
163
165 switch (Kind) {
167 return "none";
169 return "reserved";
171 return "non-leaf";
173 return "all";
174 }
175
176 llvm_unreachable("invalid FramePointerKind");
177 }
178
179 /// Possible exception handling behavior.
181
183 Auto, // Choose Swift async extended frame info based on deployment target.
184 Always, // Unconditionally emit Swift async extended frame info.
185 Never, // Don't emit Swift async extended frame info.
186 Default = Always,
187 };
188
190 Language, // Not specified, use language standard.
191 Always, // All loops are assumed to be finite.
192 Never, // No loop is assumed to be finite.
193 };
194
199 };
200
202 None, ///< Trap Messages are omitted. This offers the smallest debug info
203 ///< size but at the cost of making traps hard to debug.
204 Basic, ///< Trap Message is fixed per SanitizerKind. Produces smaller debug
205 ///< info than `Detailed` but is not as helpful for debugging.
206 Detailed, ///< Trap Message includes more context (e.g. the expression being
207 ///< overflowed). This is more helpful for debugging but produces
208 ///< larger debug info than `Basic`.
209 };
210
211 /// The code model to use (-mcmodel).
212 std::string CodeModel;
213
214 /// The code model-specific large data threshold to use
215 /// (-mlarge-data-threshold).
217
218 /// The filename with path we use for coverage data files. The runtime
219 /// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP
220 /// environment variables.
221 std::string CoverageDataFile;
222
223 /// The filename with path we use for coverage notes files.
224 std::string CoverageNotesFile;
225
226 /// Regexes separated by a semi-colon to filter the files to instrument.
228
229 /// Regexes separated by a semi-colon to filter the files to not instrument.
231
232 /// The version string to put into coverage files.
233 char CoverageVersion[4] = {'0', '0', '0', '0'};
234
235 /// Enable additional debugging information.
236 std::string DebugPass;
237
238 /// The string to embed in debug information as the current working directory.
240
241 /// The string to embed in coverage mapping as the current working directory.
243
244 /// The string to embed in the debug information for the compile unit, if
245 /// non-empty.
246 std::string DwarfDebugFlags;
247
248 /// The string containing the commandline for the llvm.commandline metadata,
249 /// if non-empty.
250 std::string RecordCommandLine;
251
253
254 /// Prefix replacement map for source-based code coverage to remap source
255 /// file paths in coverage mapping.
257
258 /// The ABI to use for passing floating point arguments.
259 std::string FloatABI;
260
261 /// The file to use for dumping bug report by `Debugify` for original
262 /// debug info.
264
265 /// The floating-point denormal mode to use.
266 llvm::DenormalMode FPDenormalMode = llvm::DenormalMode::getIEEE();
267
268 /// The floating-point denormal mode to use, for float.
269 llvm::DenormalMode FP32DenormalMode = llvm::DenormalMode::getIEEE();
270
271 /// The float precision limit to use, if non-empty.
273
275 /// The filename of the bitcode file to link in.
276 std::string Filename;
277 /// If true, we set attributes functions in the bitcode library according to
278 /// our CodeGenOptions, much as we set attrs on functions that we generate
279 /// ourselves.
280 bool PropagateAttrs = false;
281 /// If true, we use LLVM module internalizer.
282 bool Internalize = false;
283 /// Bitwise combination of llvm::Linker::Flags, passed to the LLVM linker.
284 unsigned LinkFlags = 0;
285 };
286
287 /// The files specified here are linked in to the module before optimizations.
288 std::vector<BitcodeFileToLink> LinkBitcodeFiles;
289
290 /// The user provided name for the "main file", if non-empty. This is useful
291 /// in situations where the input file name does not match the original input
292 /// file, for example with -save-temps.
293 std::string MainFileName;
294
295 /// The name for the split debug info file used for the DW_AT_[GNU_]dwo_name
296 /// attribute in the skeleton CU.
297 std::string SplitDwarfFile;
298
299 /// Output filename for the split debug info, not used in the skeleton CU.
300 std::string SplitDwarfOutput;
301
302 /// Output filename used in the COFF debug information.
304
305 /// The name of the relocation model to use.
306 llvm::Reloc::Model RelocationModel;
307
308 /// If not an empty string, trap intrinsics are lowered to calls to this
309 /// function instead of to trap instructions.
310 std::string TrapFuncName;
311
312 /// A list of dependent libraries.
313 std::vector<std::string> DependentLibraries;
314
315 /// A list of linker options to embed in the object file.
316 std::vector<std::string> LinkerOptions;
317
318 /// Name of the profile file to use as output for -fprofile-instr-generate,
319 /// -fprofile-generate, and -fcs-profile-generate.
321
322 /// Name of the patchable function entry section with
323 /// -fpatchable-function-entry.
325
326 /// Name of the profile file to use with -fprofile-sample-use.
327 std::string SampleProfileFile;
328
329 /// Name of the profile file to use as output for with -fmemory-profile.
331
332 /// Name of the profile file to use as input for -fmemory-profile-use.
334
335 /// Name of the profile file to use as input for -fprofile-instr-use
337
338 /// Name of the profile remapping file to apply to the profile data supplied
339 /// by -fprofile-sample-use or -fprofile-instr-use.
341
342 /// Name of the function summary index file to use for ThinLTO function
343 /// importing.
344 std::string ThinLTOIndexFile;
345
346 /// Name of a file that can optionally be written with minimized bitcode
347 /// to be used as input for the ThinLTO thin link step, which only needs
348 /// the summary and module symbol table (and not, e.g. any debug metadata).
350
351 /// Prefix to use for -save-temps output.
353
354 /// Name of file passed with -fcuda-include-gpubinary option to forward to
355 /// CUDA runtime back-end for incorporating them into host-side object file.
357
358 /// List of filenames passed in using the -fembed-offload-object option. These
359 /// are offloading binaries containing device images and metadata.
360 std::vector<std::string> OffloadObjects;
361
362 /// The name of the file to which the backend should save YAML optimization
363 /// records.
364 std::string OptRecordFile;
365
366 /// The regex that filters the passes that should be saved to the optimization
367 /// records.
368 std::string OptRecordPasses;
369
370 /// The format used for serializing remarks (default: YAML)
371 std::string OptRecordFormat;
372
373 /// The name of the partition that symbols are assigned to, specified with
374 /// -fsymbol-partition (see https://lld.llvm.org/Partitions.html).
375 std::string SymbolPartition;
376
377 /// If non-empty, allow the compiler to assume that the given source file
378 /// identifier is unique at link time.
380
382 RK_Missing, // Remark argument not present on the command line.
383 RK_Enabled, // Remark enabled via '-Rgroup'.
384 RK_EnabledEverything, // Remark enabled via '-Reverything'.
385 RK_Disabled, // Remark disabled via '-Rno-group'.
386 RK_DisabledEverything, // Remark disabled via '-Rno-everything'.
387 RK_WithPattern, // Remark pattern specified via '-Rgroup=regexp'.
388 };
389
390 /// Optimization remark with an optional regular expression pattern.
391 struct OptRemark {
393 std::string Pattern;
394 std::shared_ptr<llvm::Regex> Regex;
395
396 /// By default, optimization remark is missing.
397 OptRemark() = default;
398
399 /// Returns true iff the optimization remark holds a valid regular
400 /// expression.
401 bool hasValidPattern() const { return Regex != nullptr; }
402
403 /// Matches the given string against the regex, if there is some.
404 bool patternMatches(StringRef String) const {
405 return hasValidPattern() && Regex->match(String);
406 }
407 };
408
409 /// Selected optimizations for which we should enable optimization remarks.
410 /// Transformation passes whose name matches the contained (optional) regular
411 /// expression (and support this feature), will emit a diagnostic whenever
412 /// they perform a transformation.
414
415 /// Selected optimizations for which we should enable missed optimization
416 /// remarks. Transformation passes whose name matches the contained (optional)
417 /// regular expression (and support this feature), will emit a diagnostic
418 /// whenever they tried but failed to perform a transformation.
420
421 /// Selected optimizations for which we should enable optimization analyses.
422 /// Transformation passes whose name matches the contained (optional) regular
423 /// expression (and support this feature), will emit a diagnostic whenever
424 /// they want to explain why they decided to apply or not apply a given
425 /// transformation.
427
428 /// Set of sanitizer checks that are non-fatal (i.e. execution should be
429 /// continued when possible).
431
432 /// Set of sanitizer checks that trap rather than diagnose.
434
435 /// Set of sanitizer checks that can merge handlers (smaller code size at
436 /// the expense of debuggability).
438
439 /// Set of thresholds in a range [0.0, 1.0]: the top hottest code responsible
440 /// for the given fraction of PGO counters will be excluded from sanitization
441 /// (0.0 [default] to skip none, 1.0 to skip all).
443
444 /// Set of sanitizer checks, for which the instrumentation will be annotated
445 /// with extra debug info.
447
448 std::optional<double> AllowRuntimeCheckSkipHotCutoff;
449
450 /// List of backend command-line options for -fembed-bitcode.
451 std::vector<uint8_t> CmdArgs;
452
453 /// A list of all -fno-builtin-* function names (e.g., memset).
454 std::vector<std::string> NoBuiltinFuncs;
455
456 std::vector<std::string> Reciprocals;
457
458 /// Configuration for pointer-signing.
460
461 /// The preferred width for auto-vectorization transforms. This is intended to
462 /// override default transforms based on the width of the architected vector
463 /// registers.
464 std::string PreferVectorWidth;
465
466 /// Set of XRay instrumentation kinds to emit.
468
469 std::vector<std::string> DefaultFunctionAttrs;
470
471 /// List of dynamic shared object files to be loaded as pass plugins.
472 std::vector<std::string> PassPlugins;
473
474 /// List of pass builder callbacks.
475 std::vector<std::function<void(llvm::PassBuilder &)>> PassBuilderCallbacks;
476
477 /// List of global variables explicitly specified by the user as toc-data.
478 std::vector<std::string> TocDataVarsUserSpecified;
479
480 /// List of global variables that over-ride the toc-data default.
481 std::vector<std::string> NoTocDataVars;
482
483 /// Path to allowlist file specifying which objects
484 /// (files, functions) should exclusively be instrumented
485 /// by sanitizer coverage pass.
486 std::vector<std::string> SanitizeCoverageAllowlistFiles;
487
488 /// The guard style used for stack protector to get a initial value, this
489 /// value usually be gotten from TLS or get from __stack_chk_guard, or some
490 /// other styles we may implement in the future.
492
493 /// The TLS base register when StackProtectorGuard is "tls", or register used
494 /// to store the stack canary for "sysreg".
495 /// On x86 this can be "fs" or "gs".
496 /// On AArch64 this can only be "sp_el0".
498
499 /// Specify a symbol to be the guard value.
501
502 /// Path to ignorelist file specifying which objects
503 /// (files, functions) listed for instrumentation by sanitizer
504 /// coverage pass should actually not be instrumented.
505 std::vector<std::string> SanitizeCoverageIgnorelistFiles;
506
507 /// Path to ignorelist file specifying which objects
508 /// (files, functions) listed for instrumentation by sanitizer
509 /// binary metadata pass should not be instrumented.
510 std::vector<std::string> SanitizeMetadataIgnorelistFiles;
511
512 /// Name of the stack usage file (i.e., .su file) if user passes
513 /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
514 /// passed on the command line.
515 std::string StackUsageOutput;
516
517 /// Executable and command-line used to create a given CompilerInvocation.
518 /// Most of the time this will be the full -cc1 command.
519 const char *Argv0 = nullptr;
520 std::vector<std::string> CommandLineArgs;
521
522 /// The minimum hotness value a diagnostic needs in order to be included in
523 /// optimization diagnostics.
524 ///
525 /// The threshold is an Optional value, which maps to one of the 3 states:
526 /// 1. 0 => threshold disabled. All remarks will be printed.
527 /// 2. positive int => manual threshold by user. Remarks with hotness exceed
528 /// threshold will be printed.
529 /// 3. None => 'auto' threshold by user. The actual value is not
530 /// available at command line, but will be synced with
531 /// hotness threshold from profile summary during
532 /// compilation.
533 ///
534 /// If threshold option is not specified, it is disabled by default.
535 std::optional<uint64_t> DiagnosticsHotnessThreshold = 0;
536
537 /// The maximum percentage profiling weights can deviate from the expected
538 /// values in order to be included in misexpect diagnostics.
539 std::optional<uint32_t> DiagnosticsMisExpectTolerance = 0;
540
541 /// The name of a file to use with \c .secure_log_unique directives.
542 std::string AsSecureLogFile;
543
544 /// A list of functions that are replacable by the loader.
545 std::vector<std::string> LoaderReplaceableFunctionNames;
546 /// The name of a file that contains functions which will be compiled for
547 /// hotpatching. See -fms-secure-hotpatch-functions-file.
549
550 /// A list of functions which will be compiled for hotpatching.
551 /// See -fms-secure-hotpatch-functions-list.
552 std::vector<std::string> MSSecureHotPatchFunctionsList;
553
554public:
555 // Define accessors/mutators for code generation options of enumeration type.
556#define CODEGENOPT(Name, Bits, Default, Compatibility)
557#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
558 Type get##Name() const { return static_cast<Type>(Name); } \
559 void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
560#include "clang/Basic/CodeGenOptions.def"
561
563
564 const std::vector<std::string> &getNoBuiltinFuncs() const {
565 return NoBuiltinFuncs;
566 }
567
568 bool hasSjLjExceptions() const {
569 return getExceptionHandling() == ExceptionHandlingKind::SjLj;
570 }
571
572 bool hasSEHExceptions() const {
573 return getExceptionHandling() == ExceptionHandlingKind::WinEH;
574 }
575
576 bool hasDWARFExceptions() const {
577 return getExceptionHandling() == ExceptionHandlingKind::DwarfCFI;
578 }
579
580 bool hasWasmExceptions() const {
581 return getExceptionHandling() == ExceptionHandlingKind::Wasm;
582 }
583
584 /// Check if Clang profile instrumenation is on.
585 bool hasProfileClangInstr() const {
586 return getProfileInstr() ==
587 llvm::driver::ProfileInstrKind::ProfileClangInstr;
588 }
589
590 /// Check if IR level profile instrumentation is on.
591 bool hasProfileIRInstr() const {
592 return getProfileInstr() == llvm::driver::ProfileInstrKind::ProfileIRInstr;
593 }
594
595 /// Check if CS IR level profile instrumentation is on.
596 bool hasProfileCSIRInstr() const {
597 return getProfileInstr() ==
598 llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
599 }
600
601 /// Check if any form of instrumentation is on.
602 bool hasProfileInstr() const {
603 return getProfileInstr() != llvm::driver::ProfileInstrKind::ProfileNone;
604 }
605
606 /// Check if Clang profile use is on.
607 bool hasProfileClangUse() const {
608 return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileClangInstr;
609 }
610
611 /// Check if IR level profile use is on.
612 bool hasProfileIRUse() const {
613 return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileIRInstr ||
614 getProfileUse() == llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
615 }
616
617 /// Check if CSIR profile use is on.
618 bool hasProfileCSIRUse() const {
619 return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
620 }
621
622 /// Check if type and variable info should be emitted.
623 bool hasReducedDebugInfo() const {
624 return getDebugInfo() >= llvm::codegenoptions::DebugInfoConstructor;
625 }
626
627 /// Check if maybe unused type info should be emitted.
629 return getDebugInfo() >= llvm::codegenoptions::UnusedTypeInfo;
630 }
631
632 // Check if any one of SanitizeCoverage* is enabled.
633 bool hasSanitizeCoverage() const {
634 return SanitizeCoverageType || SanitizeCoverageIndirectCalls ||
635 SanitizeCoverageTraceCmp || SanitizeCoverageTraceLoads ||
636 SanitizeCoverageTraceStores || SanitizeCoverageControlFlow;
637 }
638
639 // Check if any one of SanitizeBinaryMetadata* is enabled.
641 return SanitizeBinaryMetadataCovered || SanitizeBinaryMetadataAtomics ||
642 SanitizeBinaryMetadataUAR;
643 }
644
645 /// Reset all of the options that are not considered when building a
646 /// module.
647 void resetNonModularOptions(StringRef ModuleFormat);
648
649 // Is the given function name one of the functions that can be replaced by the
650 // loader?
651 bool isLoaderReplaceableFunctionName(StringRef FuncName) const {
652 return llvm::is_contained(LoaderReplaceableFunctionNames, FuncName);
653 }
654};
655
656} // end namespace clang
657
658#endif
enum clang::sema::@1840::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::SanitizerKind enum.
Defines the clang::XRayInstrKind enum.
Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure that this large collection of bi...
llvm::driver::ProfileInstrKind ProfileInstrKind
llvm::AsanDtorKind AsanDtorKind
llvm::AsanDetectStackUseAfterReturnMode AsanDetectStackUseAfterReturnMode
llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind ZeroCallUsedRegsKind
llvm::codegenoptions::DebugInfoKind DebugInfoKind
llvm::DebuggerKind DebuggerKind
llvm::WinX64EHUnwindV2Mode WinX64EHUnwindV2Mode
llvm::EmitDwarfUnwindType EmitDwarfUnwindType
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
@ NotCompatible
Does affect the construction of the AST in a way that does prevent module interoperability.
@ Compatible
Does affect the construction of the AST in a way that doesn't prevent interoperability (that is,...
@ Benign
Does not affect the construction of the AST in any way (that is, the value can be different between a...
llvm::DebugCompressionType DebugCompressionType
llvm::driver::VectorLibrary VectorLibrary
llvm::codegenoptions::DebugTemplateNamesKind DebugTemplateNamesKind
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::SmallVector< std::pair< std::string, std::string >, 0 > CoveragePrefixMap
Prefix replacement map for source-based code coverage to remap source file paths in coverage mapping.
std::string StackProtectorGuardSymbol
Specify a symbol to be the guard value.
SanitizerSet SanitizeMergeHandlers
Set of sanitizer checks that can merge handlers (smaller code size at the expense of debuggability).
std::string UniqueSourceFileIdentifier
If non-empty, allow the compiler to assume that the given source file identifier is unique at link ti...
std::string MSSecureHotPatchFunctionsFile
The name of a file that contains functions which will be compiled for hotpatching.
const std::vector< std::string > & getNoBuiltinFuncs() const
std::vector< std::string > LoaderReplaceableFunctionNames
A list of functions that are replacable by the loader.
llvm::SmallVector< std::pair< std::string, std::string >, 0 > DebugPrefixMap
@ None
Trap Messages are omitted.
@ Detailed
Trap Message includes more context (e.g.
@ Basic
Trap Message is fixed per SanitizerKind.
std::string OptRecordFile
The name of the file to which the backend should save YAML optimization records.
std::string InstrProfileOutput
Name of the profile file to use as output for -fprofile-instr-generate, -fprofile-generate,...
std::string BinutilsVersion
std::string StackProtectorGuard
The guard style used for stack protector to get a initial value, this value usually be gotten from TL...
bool hasDWARFExceptions() const
std::vector< BitcodeFileToLink > LinkBitcodeFiles
The files specified here are linked in to the module before optimizations.
std::string RecordCommandLine
The string containing the commandline for the llvm.commandline metadata, if non-empty.
std::optional< uint64_t > DiagnosticsHotnessThreshold
The minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
bool hasProfileInstr() const
Check if any form of instrumentation is on.
bool hasProfileIRUse() const
Check if IR level profile use is on.
char CoverageVersion[4]
The version string to put into coverage files.
std::string FloatABI
The ABI to use for passing floating point arguments.
std::string ThinLinkBitcodeFile
Name of a file that can optionally be written with minimized bitcode to be used as input for the Thin...
bool hasProfileCSIRInstr() const
Check if CS IR level profile instrumentation is on.
std::vector< std::string > DependentLibraries
A list of dependent libraries.
std::string DebugPass
Enable additional debugging information.
llvm::Reloc::Model RelocationModel
The name of the relocation model to use.
llvm::DenormalMode FPDenormalMode
The floating-point denormal mode to use.
std::string CoverageNotesFile
The filename with path we use for coverage notes files.
std::string ProfileInstrumentUsePath
Name of the profile file to use as input for -fprofile-instr-use.
std::string SampleProfileFile
Name of the profile file to use with -fprofile-sample-use.
uint64_t LargeDataThreshold
The code model-specific large data threshold to use (-mlarge-data-threshold).
static StringRef getFramePointerKindName(FramePointerKind Kind)
std::string MemoryProfileOutput
Name of the profile file to use as output for with -fmemory-profile.
std::vector< std::function< void(llvm::PassBuilder &)> > PassBuilderCallbacks
List of pass builder callbacks.
std::string LimitFloatPrecision
The float precision limit to use, if non-empty.
std::string CodeModel
The code model to use (-mcmodel).
std::vector< std::string > TocDataVarsUserSpecified
List of global variables explicitly specified by the user as toc-data.
std::string CoverageDataFile
The filename with path we use for coverage data files.
std::vector< std::string > PassPlugins
List of dynamic shared object files to be loaded as pass plugins.
bool hasProfileClangInstr() const
Check if Clang profile instrumenation is on.
std::string DebugCompilationDir
The string to embed in debug information as the current working directory.
std::optional< uint32_t > DiagnosticsMisExpectTolerance
The maximum percentage profiling weights can deviate from the expected values in order to be included...
std::string StackUsageOutput
Name of the stack usage file (i.e., .su file) if user passes -fstack-usage.
std::string OptRecordPasses
The regex that filters the passes that should be saved to the optimization records.
std::vector< std::string > SanitizeCoverageAllowlistFiles
Path to allowlist file specifying which objects (files, functions) should exclusively be instrumented...
std::string SaveTempsFilePrefix
Prefix to use for -save-temps output.
std::string PatchableFunctionEntrySection
Name of the patchable function entry section with -fpatchable-function-entry.
XRayInstrSet XRayInstrumentationBundle
Set of XRay instrumentation kinds to emit.
std::vector< std::string > SanitizeCoverageIgnorelistFiles
Path to ignorelist file specifying which objects (files, functions) listed for instrumentation by san...
bool hasSanitizeCoverage() const
std::vector< std::string > Reciprocals
std::string MainFileName
The user provided name for the "main file", if non-empty.
std::string CudaGpuBinaryFileName
Name of file passed with -fcuda-include-gpubinary option to forward to CUDA runtime back-end for inco...
SanitizerSet SanitizeAnnotateDebugInfo
Set of sanitizer checks, for which the instrumentation will be annotated with extra debug info.
PointerAuthOptions PointerAuth
Configuration for pointer-signing.
llvm::DenormalMode FP32DenormalMode
The floating-point denormal mode to use, for float.
bool hasProfileIRInstr() const
Check if IR level profile instrumentation is on.
bool hasProfileCSIRUse() const
Check if CSIR profile use is on.
std::string CoverageCompilationDir
The string to embed in coverage mapping as the current working directory.
SanitizerSet SanitizeTrap
Set of sanitizer checks that trap rather than diagnose.
std::vector< std::string > SanitizeMetadataIgnorelistFiles
Path to ignorelist file specifying which objects (files, functions) listed for instrumentation by san...
SanitizerSet SanitizeRecover
Set of sanitizer checks that are non-fatal (i.e.
std::string ProfileExcludeFiles
Regexes separated by a semi-colon to filter the files to not instrument.
std::string AsSecureLogFile
The name of a file to use with .secure_log_unique directives.
std::string ProfileRemappingFile
Name of the profile remapping file to apply to the profile data supplied by -fprofile-sample-use or -...
bool hasReducedDebugInfo() const
Check if type and variable info should be emitted.
bool hasSanitizeBinaryMetadata() const
OptRemark OptimizationRemark
Selected optimizations for which we should enable optimization remarks.
std::string ThinLTOIndexFile
Name of the function summary index file to use for ThinLTO function importing.
const char * Argv0
Executable and command-line used to create a given CompilerInvocation.
bool hasWasmExceptions() const
bool hasSjLjExceptions() const
std::string TrapFuncName
If not an empty string, trap intrinsics are lowered to calls to this function instead of to trap inst...
SanitizerMaskCutoffs SanitizeSkipHotCutoffs
Set of thresholds in a range [0.0, 1.0]: the top hottest code responsible for the given fraction of P...
std::string SplitDwarfFile
The name for the split debug info file used for the DW_AT_[GNU_]dwo_name attribute in the skeleton CU...
std::string StackProtectorGuardReg
The TLS base register when StackProtectorGuard is "tls", or register used to store the stack canary f...
std::vector< std::string > DefaultFunctionAttrs
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
std::vector< uint8_t > CmdArgs
List of backend command-line options for -fembed-bitcode.
OptRemark OptimizationRemarkAnalysis
Selected optimizations for which we should enable optimization analyses.
std::optional< double > AllowRuntimeCheckSkipHotCutoff
std::vector< std::string > CommandLineArgs
std::vector< std::string > LinkerOptions
A list of linker options to embed in the object file.
bool hasSEHExceptions() const
std::string MemoryProfileUsePath
Name of the profile file to use as input for -fmemory-profile-use.
std::vector< std::string > MSSecureHotPatchFunctionsList
A list of functions which will be compiled for hotpatching.
void resetNonModularOptions(StringRef ModuleFormat)
Reset all of the options that are not considered when building a module.
ExceptionHandlingKind
Possible exception handling behavior.
std::string OptRecordFormat
The format used for serializing remarks (default: YAML)
bool hasProfileClangUse() const
Check if Clang profile use is on.
std::vector< std::string > OffloadObjects
List of filenames passed in using the -fembed-offload-object option.
std::string SymbolPartition
The name of the partition that symbols are assigned to, specified with -fsymbol-partition (see https:...
std::vector< std::string > NoTocDataVars
List of global variables that over-ride the toc-data default.
std::string ProfileFilterFiles
Regexes separated by a semi-colon to filter the files to instrument.
bool hasMaybeUnusedDebugInfo() const
Check if maybe unused type info should be emitted.
std::string PreferVectorWidth
The preferred width for auto-vectorization transforms.
std::string ObjectFilenameForDebug
Output filename used in the COFF debug information.
std::string SplitDwarfOutput
Output filename for the split debug info, not used in the skeleton CU.
bool isLoaderReplaceableFunctionName(StringRef FuncName) const
std::string DwarfDebugFlags
The string to embed in the debug information for the compile unit, if non-empty.
std::string DIBugsReportFilePath
The file to use for dumping bug report by Debugify for original debug info.
OptRemark OptimizationRemarkMissed
Selected optimizations for which we should enable missed optimization remarks.
The base class of CompilerInvocation.
Helper class for holding the data necessary to invoke the compiler.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
int const char * function
Definition: c++config.h:31
Optimization remark with an optional regular expression pattern.
std::shared_ptr< llvm::Regex > Regex
bool patternMatches(StringRef String) const
Matches the given string against the regex, if there is some.
OptRemark()=default
By default, optimization remark is missing.
bool hasValidPattern() const
Returns true iff the optimization remark holds a valid regular expression.