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