Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/IR/LLVMContext.h b/linux-x64/clang/include/llvm/IR/LLVMContext.h
index c805045..8f8a35d 100644
--- a/linux-x64/clang/include/llvm/IR/LLVMContext.h
+++ b/linux-x64/clang/include/llvm/IR/LLVMContext.h
@@ -17,7 +17,6 @@
#include "llvm-c/Types.h"
#include "llvm/IR/DiagnosticHandler.h"
#include "llvm/Support/CBindingWrapping.h"
-#include "llvm/Support/Options.h"
#include <cstdint>
#include <memory>
#include <string>
@@ -32,12 +31,17 @@
class Module;
class OptPassGate;
template <typename T> class SmallVectorImpl;
+template <typename T> class StringMapEntry;
class SMDiagnostic;
class StringRef;
class Twine;
-class RemarkStreamer;
+class LLVMRemarkStreamer;
class raw_ostream;
+namespace remarks {
+class RemarkStreamer;
+}
+
namespace SyncScope {
typedef uint8_t ID;
@@ -72,44 +76,23 @@
// Pinned metadata names, which always have the same value. This is a
// compile-time performance optimization, not a correctness optimization.
enum : unsigned {
- MD_dbg = 0, // "dbg"
- MD_tbaa = 1, // "tbaa"
- MD_prof = 2, // "prof"
- MD_fpmath = 3, // "fpmath"
- MD_range = 4, // "range"
- MD_tbaa_struct = 5, // "tbaa.struct"
- MD_invariant_load = 6, // "invariant.load"
- MD_alias_scope = 7, // "alias.scope"
- MD_noalias = 8, // "noalias",
- MD_nontemporal = 9, // "nontemporal"
- MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
- MD_nonnull = 11, // "nonnull"
- MD_dereferenceable = 12, // "dereferenceable"
- MD_dereferenceable_or_null = 13, // "dereferenceable_or_null"
- MD_make_implicit = 14, // "make.implicit"
- MD_unpredictable = 15, // "unpredictable"
- MD_invariant_group = 16, // "invariant.group"
- MD_align = 17, // "align"
- MD_loop = 18, // "llvm.loop"
- MD_type = 19, // "type"
- MD_section_prefix = 20, // "section_prefix"
- MD_absolute_symbol = 21, // "absolute_symbol"
- MD_associated = 22, // "associated"
- MD_callees = 23, // "callees"
- MD_irr_loop = 24, // "irr_loop"
- MD_access_group = 25, // "llvm.access.group"
- MD_callback = 26, // "callback"
- MD_preserve_access_index = 27, // "llvm.preserve.*.access.index"
+#define LLVM_FIXED_MD_KIND(EnumID, Name, Value) EnumID = Value,
+#include "llvm/IR/FixedMetadataKinds.def"
+#undef LLVM_FIXED_MD_KIND
};
/// Known operand bundle tag IDs, which always have the same value. All
/// operand bundle tags that LLVM has special knowledge of are listed here.
/// Additionally, this scheme allows LLVM to efficiently check for specific
- /// operand bundle tags without comparing strings.
+ /// operand bundle tags without comparing strings. Keep this in sync with
+ /// LLVMContext::LLVMContext().
enum : unsigned {
OB_deopt = 0, // "deopt"
OB_funclet = 1, // "funclet"
OB_gc_transition = 2, // "gc-transition"
+ OB_cfguardtarget = 3, // "cfguardtarget"
+ OB_preallocated = 4, // "preallocated"
+ OB_gc_live = 5, // "gc-live"
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
@@ -126,6 +109,10 @@
/// \see LLVMContext::getOperandBundleTagID
void getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const;
+ /// getOrInsertBundleTag - Returns the Tag to use for an operand bundle of
+ /// name TagName.
+ StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef TagName) const;
+
/// getOperandBundleTagID - Maps a bundle tag to an integer ID. Every bundle
/// tag registered with an LLVMContext has an unique ID.
uint32_t getOperandBundleTagID(StringRef Tag) const;
@@ -235,31 +222,45 @@
void setDiagnosticsHotnessRequested(bool Requested);
/// Return the minimum hotness value a diagnostic would need in order
- /// to be included in optimization diagnostics. If there is no minimum, this
- /// returns None.
+ /// to be included in optimization diagnostics.
+ ///
+ /// Three possible return values:
+ /// 0 - threshold is disabled. Everything will be printed out.
+ /// positive int - threshold is set.
+ /// UINT64_MAX - threshold is not yet set, and needs to be synced from
+ /// profile summary. Note that in case of missing profile
+ /// summary, threshold will be kept at "MAX", effectively
+ /// suppresses all remarks output.
uint64_t getDiagnosticsHotnessThreshold() const;
/// Set the minimum hotness value a diagnostic needs in order to be
/// included in optimization diagnostics.
- void setDiagnosticsHotnessThreshold(uint64_t Threshold);
+ void setDiagnosticsHotnessThreshold(Optional<uint64_t> Threshold);
- /// Return the streamer used by the backend to save remark diagnostics. If it
- /// does not exist, diagnostics are not saved in a file but only emitted via
- /// the diagnostic handler.
- RemarkStreamer *getRemarkStreamer();
- const RemarkStreamer *getRemarkStreamer() const;
+ /// Return if hotness threshold is requested from PSI.
+ bool isDiagnosticsHotnessThresholdSetFromPSI() const;
- /// Set the diagnostics output used for optimization diagnostics.
- /// This filename may be embedded in a section for tools to find the
- /// diagnostics whenever they're needed.
+ /// The "main remark streamer" used by all the specialized remark streamers.
+ /// This streamer keeps generic remark metadata in memory throughout the life
+ /// of the LLVMContext. This metadata may be emitted in a section in object
+ /// files depending on the format requirements.
///
- /// If a remark streamer is already set, it will be replaced with
- /// \p RemarkStreamer.
+ /// All specialized remark streamers should convert remarks to
+ /// llvm::remarks::Remark and emit them through this streamer.
+ remarks::RemarkStreamer *getMainRemarkStreamer();
+ const remarks::RemarkStreamer *getMainRemarkStreamer() const;
+ void setMainRemarkStreamer(
+ std::unique_ptr<remarks::RemarkStreamer> MainRemarkStreamer);
+
+ /// The "LLVM remark streamer" used by LLVM to serialize remark diagnostics
+ /// comming from IR and MIR passes.
///
- /// By default, diagnostics are not saved in a file but only emitted via the
- /// diagnostic handler. Even if an output file is set, the handler is invoked
- /// for each diagnostic message.
- void setRemarkStreamer(std::unique_ptr<RemarkStreamer> RemarkStreamer);
+ /// If it does not exist, diagnostics are not saved in a file but only emitted
+ /// via the diagnostic handler.
+ LLVMRemarkStreamer *getLLVMRemarkStreamer();
+ const LLVMRemarkStreamer *getLLVMRemarkStreamer() const;
+ void
+ setLLVMRemarkStreamer(std::unique_ptr<LLVMRemarkStreamer> RemarkStreamer);
/// Get the prefix that should be printed in front of a diagnostic of
/// the given \p Severity
@@ -312,14 +313,6 @@
void emitError(const Instruction *I, const Twine &ErrorStr);
void emitError(const Twine &ErrorStr);
- /// Query for a debug option's value.
- ///
- /// This function returns typed data populated from command line parsing.
- template <typename ValT, typename Base, ValT(Base::*Mem)>
- ValT getOption() const {
- return OptionRegistry::instance().template get<ValT, Base, Mem>();
- }
-
/// Access the object which can disable optional passes and individual
/// optimizations at compile time.
OptPassGate &getOptPassGate() const;