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