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/Module.h b/linux-x64/clang/include/llvm/IR/Module.h
index f458680..3664b27 100644
--- a/linux-x64/clang/include/llvm/IR/Module.h
+++ b/linux-x64/clang/include/llvm/IR/Module.h
@@ -46,6 +46,8 @@
class GVMaterializer;
class LLVMContext;
class MemoryBuffer;
+class ModuleSummaryIndex;
+class Pass;
class RandomNumberGenerator;
template <class PtrType> class SmallPtrSetImpl;
class StructType;
@@ -78,6 +80,8 @@
using NamedMDListType = ilist<NamedMDNode>;
/// The type of the comdat "symbol" table.
using ComdatSymTabType = StringMap<Comdat>;
+ /// The type for mapping names to named metadata.
+ using NamedMDSymTabType = StringMap<NamedMDNode *>;
/// The Global Variable iterator.
using global_iterator = GlobalListType::iterator;
@@ -153,6 +157,11 @@
/// converted result in MFB.
static bool isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB);
+ /// Check if the given module flag metadata represents a valid module flag,
+ /// and store the flag behavior, the key string and the value metadata.
+ static bool isValidModuleFlag(const MDNode &ModFlag, ModFlagBehavior &MFB,
+ MDString *&Key, Metadata *&Val);
+
struct ModuleFlagEntry {
ModFlagBehavior Behavior;
MDString *Key;
@@ -174,7 +183,7 @@
IFuncListType IFuncList; ///< The IFuncs in the module
NamedMDListType NamedMDList; ///< The named metadata in the module
std::string GlobalScopeAsm; ///< Inline Asm at global scope.
- ValueSymbolTable *ValSymTab; ///< Symbol table for values
+ std::unique_ptr<ValueSymbolTable> ValSymTab; ///< Symbol table for values
ComdatSymTabType ComdatSymTab; ///< Symbol table for COMDATs
std::unique_ptr<MemoryBuffer>
OwnedMemoryBuffer; ///< Memory buffer directly owned by this
@@ -186,7 +195,7 @@
///< recorded in bitcode.
std::string TargetTriple; ///< Platform target triple Module compiled on
///< Format: (arch)(sub)-(vendor)-(sys0-(abi)
- void *NamedMDSymTab; ///< NamedMDNode names.
+ NamedMDSymTabType NamedMDSymTab; ///< NamedMDNode names.
DataLayout DL; ///< DataLayout associated with the module
friend class Constant;
@@ -256,7 +265,7 @@
/// when other randomness consuming passes are added or removed. In
/// addition, the random stream will be reproducible across LLVM
/// versions when the pass does not change.
- std::unique_ptr<RandomNumberGenerator> createRNG(const Pass* P) const;
+ std::unique_ptr<RandomNumberGenerator> createRNG(const StringRef Name) const;
/// Return true if size-info optimization remark is enabled, false
/// otherwise.
@@ -270,22 +279,22 @@
/// @{
/// Set the module identifier.
- void setModuleIdentifier(StringRef ID) { ModuleID = ID; }
+ void setModuleIdentifier(StringRef ID) { ModuleID = std::string(ID); }
/// Set the module's original source file name.
- void setSourceFileName(StringRef Name) { SourceFileName = Name; }
+ void setSourceFileName(StringRef Name) { SourceFileName = std::string(Name); }
/// Set the data layout
void setDataLayout(StringRef Desc);
void setDataLayout(const DataLayout &Other);
/// Set the target triple.
- void setTargetTriple(StringRef T) { TargetTriple = T; }
+ void setTargetTriple(StringRef T) { TargetTriple = std::string(T); }
/// Set the module-scope inline assembly blocks.
/// A trailing newline is added if the input doesn't have one.
void setModuleInlineAsm(StringRef Asm) {
- GlobalScopeAsm = Asm;
+ GlobalScopeAsm = std::string(Asm);
if (!GlobalScopeAsm.empty() && GlobalScopeAsm.back() != '\n')
GlobalScopeAsm += '\n';
}
@@ -320,10 +329,6 @@
/// \see LLVMContext::getOperandBundleTagID
void getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const;
- /// Return the type with the specified name, or null if there is none by that
- /// name.
- StructType *getTypeByName(StringRef Name) const;
-
std::vector<StructType *> getIdentifiedStructTypes() const;
/// @}
@@ -490,10 +495,12 @@
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Constant *Val);
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, uint32_t Val);
void addModuleFlag(MDNode *Node);
+ /// Like addModuleFlag but replaces the old module flag if it already exists.
+ void setModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val);
-/// @}
-/// @name Materialization
-/// @{
+ /// @}
+ /// @name Materialization
+ /// @{
/// Sets the GVMaterializer to GVM. This module must not yet have a
/// Materializer. To reset the materializer for a module that already has one,
@@ -582,6 +589,7 @@
const_global_iterator global_begin() const { return GlobalList.begin(); }
global_iterator global_end () { return GlobalList.end(); }
const_global_iterator global_end () const { return GlobalList.end(); }
+ size_t global_size () const { return GlobalList.size(); }
bool global_empty() const { return GlobalList.empty(); }
iterator_range<global_iterator> globals() {
@@ -659,24 +667,8 @@
concat_iterator<const GlobalObject, const_iterator,
const_global_iterator>;
- iterator_range<global_object_iterator> global_objects() {
- return concat<GlobalObject>(functions(), globals());
- }
- iterator_range<const_global_object_iterator> global_objects() const {
- return concat<const GlobalObject>(functions(), globals());
- }
-
- global_object_iterator global_object_begin() {
- return global_objects().begin();
- }
- global_object_iterator global_object_end() { return global_objects().end(); }
-
- const_global_object_iterator global_object_begin() const {
- return global_objects().begin();
- }
- const_global_object_iterator global_object_end() const {
- return global_objects().end();
- }
+ iterator_range<global_object_iterator> global_objects();
+ iterator_range<const_global_object_iterator> global_objects() const;
using global_value_iterator =
concat_iterator<GlobalValue, iterator, global_iterator, alias_iterator,
@@ -685,23 +677,8 @@
concat_iterator<const GlobalValue, const_iterator, const_global_iterator,
const_alias_iterator, const_ifunc_iterator>;
- iterator_range<global_value_iterator> global_values() {
- return concat<GlobalValue>(functions(), globals(), aliases(), ifuncs());
- }
- iterator_range<const_global_value_iterator> global_values() const {
- return concat<const GlobalValue>(functions(), globals(), aliases(),
- ifuncs());
- }
-
- global_value_iterator global_value_begin() { return global_values().begin(); }
- global_value_iterator global_value_end() { return global_values().end(); }
-
- const_global_value_iterator global_value_begin() const {
- return global_values().begin();
- }
- const_global_value_iterator global_value_end() const {
- return global_values().end();
- }
+ iterator_range<global_value_iterator> global_values();
+ iterator_range<const_global_value_iterator> global_values() const;
/// @}
/// @name Named Metadata Iteration
@@ -873,9 +850,15 @@
/// Returns profile summary metadata. When IsCS is true, use the context
/// sensitive profile summary.
- Metadata *getProfileSummary(bool IsCS);
+ Metadata *getProfileSummary(bool IsCS) const;
/// @}
+ /// Returns whether semantic interposition is to be respected.
+ bool getSemanticInterposition() const;
+
+ /// Set whether semantic interposition is to be respected.
+ void setSemanticInterposition(bool);
+
/// Returns true if PLT should be avoided for RTLib calls.
bool getRtLibUseGOT() const;
@@ -896,6 +879,10 @@
/// Take ownership of the given memory buffer.
void setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB);
+
+ /// Set the partial sample profile ratio in the profile summary module flag,
+ /// if applicable.
+ void setPartialSampleProfileRatio(const ModuleSummaryIndex &Index);
};
/// Given "llvm.used" or "llvm.compiler.used" as a global name, collect