aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h123
1 files changed, 101 insertions, 22 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h b/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h
index 617c255641ef..3f8fe385fef3 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.h
@@ -13,10 +13,11 @@
#ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H
#define LLVM_CLANG_BASIC_CODEGENOPTIONS_H
-#include "clang/Basic/DebugInfoOptions.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/XRayInstr.h"
#include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/Frontend/Debug/Options.h"
+#include "llvm/Frontend/Driver/CodeGenOptions.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Regex.h"
#include "llvm/Target/TargetOptions.h"
@@ -26,12 +27,16 @@
#include <string>
#include <vector>
+namespace llvm {
+class PassBuilder;
+}
namespace clang {
/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
/// that this large collection of bitfields is a trivial class type.
class CodeGenOptionsBase {
friend class CompilerInvocation;
+ friend class CompilerInvocationBase;
public:
#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
@@ -54,15 +59,6 @@ public:
OnlyAlwaysInlining // Only run the always inlining pass.
};
- enum VectorLibrary {
- NoLibrary, // Don't use any vector library.
- Accelerate, // Use the Accelerate framework.
- LIBMVEC, // GLIBC vector math library.
- MASSV, // IBM MASS vector library.
- SVML, // Intel short vector math library.
- Darwin_libsystem_m // Use Darwin's libsytem_m vector functions.
- };
-
enum ObjCDispatchMethodKind {
Legacy = 0,
NonLegacy = 1,
@@ -97,6 +93,17 @@ public:
Embed_Marker // Embed a marker as a placeholder for bitcode.
};
+ enum InlineAsmDialectKind {
+ IAD_ATT,
+ IAD_Intel,
+ };
+
+ enum DebugSrcHashKind {
+ DSH_MD5,
+ DSH_SHA1,
+ DSH_SHA256,
+ };
+
// This field stores one of the allowed values for the option
// -fbasic-block-sections=. The allowed values with this option are:
// {"labels", "all", "list=<file>", "none"}.
@@ -125,15 +132,45 @@ public:
All, // Keep all frame pointers.
};
+ static StringRef getFramePointerKindName(FramePointerKind Kind) {
+ switch (Kind) {
+ case FramePointerKind::None:
+ return "none";
+ case FramePointerKind::NonLeaf:
+ return "non-leaf";
+ case FramePointerKind::All:
+ return "all";
+ }
+
+ llvm_unreachable("invalid FramePointerKind");
+ }
+
+ enum class SwiftAsyncFramePointerKind {
+ Auto, // Choose Swift async extended frame info based on deployment target.
+ Always, // Unconditionally emit Swift async extended frame info.
+ Never, // Don't emit Swift async extended frame info.
+ Default = Always,
+ };
+
enum FiniteLoopsKind {
Language, // Not specified, use language standard.
Always, // All loops are assumed to be finite.
Never, // No loop is assumed to be finite.
};
+ enum AssignmentTrackingOpts {
+ Disabled,
+ Enabled,
+ Forced,
+ };
+
/// The code model to use (-mcmodel).
std::string CodeModel;
+ /// The code model-specific large data threshold to use
+ /// (-mlarge-data-threshold).
+ uint64_t LargeDataThreshold;
+
/// The filename with path we use for coverage data files. The runtime
/// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP
/// environment variables.
@@ -168,8 +205,11 @@ public:
/// if non-empty.
std::string RecordCommandLine;
- std::map<std::string, std::string> DebugPrefixMap;
- std::map<std::string, std::string> CoveragePrefixMap;
+ llvm::SmallVector<std::pair<std::string, std::string>, 0> DebugPrefixMap;
+
+ /// Prefix replacement map for source-based code coverage to remap source
+ /// file paths in coverage mapping.
+ llvm::SmallVector<std::pair<std::string, std::string>, 0> CoveragePrefixMap;
/// The ABI to use for passing floating point arguments.
std::string FloatABI;
@@ -215,6 +255,9 @@ public:
/// Output filename for the split debug info, not used in the skeleton CU.
std::string SplitDwarfOutput;
+ /// Output filename used in the COFF debug information.
+ std::string ObjectFilenameForDebug;
+
/// The name of the relocation model to use.
llvm::Reloc::Model RelocationModel;
@@ -238,6 +281,9 @@ public:
/// Name of the profile file to use as output for with -fmemory-profile.
std::string MemoryProfileOutput;
+ /// Name of the profile file to use as input for -fmemory-profile-use.
+ std::string MemoryProfileUsePath;
+
/// Name of the profile file to use as input for -fprofile-instr-use
std::string ProfileInstrumentUsePath;
@@ -261,6 +307,10 @@ public:
/// CUDA runtime back-end for incorporating them into host-side object file.
std::string CudaGpuBinaryFileName;
+ /// List of filenames passed in using the -fembed-offload-object option. These
+ /// are offloading binaries containing device images and metadata.
+ std::vector<std::string> OffloadObjects;
+
/// The name of the file to which the backend should save YAML optimization
/// records.
std::string OptRecordFile;
@@ -287,12 +337,12 @@ public:
/// Optimization remark with an optional regular expression pattern.
struct OptRemark {
- RemarkKind Kind;
+ RemarkKind Kind = RK_Missing;
std::string Pattern;
std::shared_ptr<llvm::Regex> Regex;
/// By default, optimization remark is missing.
- OptRemark() : Kind(RK_Missing), Pattern(""), Regex(nullptr) {}
+ OptRemark() = default;
/// Returns true iff the optimization remark holds a valid regular
/// expression.
@@ -323,9 +373,6 @@ public:
/// transformation.
OptRemark OptimizationRemarkAnalysis;
- /// Set of files defining the rules for the symbol rewriting.
- std::vector<std::string> RewriteMapFiles;
-
/// Set of sanitizer checks that are non-fatal (i.e. execution should be
/// continued when possible).
SanitizerSet SanitizeRecover;
@@ -354,6 +401,9 @@ public:
/// List of dynamic shared object files to be loaded as pass plugins.
std::vector<std::string> PassPlugins;
+ /// List of pass builder callbacks.
+ std::vector<std::function<void(llvm::PassBuilder &)>> PassBuilderCallbacks;
+
/// Path to allowlist file specifying which objects
/// (files, functions) should exclusively be instrumented
/// by sanitizer coverage pass.
@@ -370,11 +420,19 @@ public:
/// On AArch64 this can only be "sp_el0".
std::string StackProtectorGuardReg;
+ /// Specify a symbol to be the guard value.
+ std::string StackProtectorGuardSymbol;
+
/// Path to ignorelist file specifying which objects
/// (files, functions) listed for instrumentation by sanitizer
/// coverage pass should actually not be instrumented.
std::vector<std::string> SanitizeCoverageIgnorelistFiles;
+ /// Path to ignorelist file specifying which objects
+ /// (files, functions) listed for instrumentation by sanitizer
+ /// binary metadata pass should not be instrumented.
+ std::vector<std::string> SanitizeMetadataIgnorelistFiles;
+
/// Name of the stack usage file (i.e., .su file) if user passes
/// -fstack-usage. If empty, it can be implied that -fstack-usage is not
/// passed on the command line.
@@ -383,7 +441,7 @@ public:
/// Executable and command-line used to create a given CompilerInvocation.
/// Most of the time this will be the full -cc1 command.
const char *Argv0 = nullptr;
- ArrayRef<const char *> CommandLineArgs;
+ std::vector<std::string> CommandLineArgs;
/// The minimum hotness value a diagnostic needs in order to be included in
/// optimization diagnostics.
@@ -398,7 +456,14 @@ public:
/// compilation.
///
/// If threshold option is not specified, it is disabled by default.
- Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
+ std::optional<uint64_t> DiagnosticsHotnessThreshold = 0;
+
+ /// The maximum percentage profiling weights can deviate from the expected
+ /// values in order to be included in misexpect diagnostics.
+ std::optional<uint32_t> DiagnosticsMisExpectTolerance = 0;
+
+ /// The name of a file to use with \c .secure_log_unique directives.
+ std::string AsSecureLogFile;
public:
// Define accessors/mutators for code generation options of enumeration type.
@@ -429,6 +494,9 @@ public:
return getProfileInstr() == ProfileCSIRInstr;
}
+ /// Check if any form of instrumentation is on.
+ bool hasProfileInstr() const { return getProfileInstr() != ProfileNone; }
+
/// Check if Clang profile use is on.
bool hasProfileClangUse() const {
return getProfileUse() == ProfileClangInstr;
@@ -445,19 +513,30 @@ public:
/// Check if type and variable info should be emitted.
bool hasReducedDebugInfo() const {
- return getDebugInfo() >= codegenoptions::DebugInfoConstructor;
+ return getDebugInfo() >= llvm::codegenoptions::DebugInfoConstructor;
}
/// Check if maybe unused type info should be emitted.
bool hasMaybeUnusedDebugInfo() const {
- return getDebugInfo() >= codegenoptions::UnusedTypeInfo;
+ return getDebugInfo() >= llvm::codegenoptions::UnusedTypeInfo;
}
// Check if any one of SanitizeCoverage* is enabled.
bool hasSanitizeCoverage() const {
return SanitizeCoverageType || SanitizeCoverageIndirectCalls ||
- SanitizeCoverageTraceCmp;
+ SanitizeCoverageTraceCmp || SanitizeCoverageTraceLoads ||
+ SanitizeCoverageTraceStores || SanitizeCoverageControlFlow;
}
+
+ // Check if any one of SanitizeBinaryMetadata* is enabled.
+ bool hasSanitizeBinaryMetadata() const {
+ return SanitizeBinaryMetadataCovered || SanitizeBinaryMetadataAtomics ||
+ SanitizeBinaryMetadataUAR;
+ }
+
+ /// Reset all of the options that are not considered when building a
+ /// module.
+ void resetNonModularOptions(StringRef ModuleFormat);
};
} // end namespace clang