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/CodeGen/MachineModuleInfo.h b/linux-x64/clang/include/llvm/CodeGen/MachineModuleInfo.h
index 4ff5c7f..fa900af 100644
--- a/linux-x64/clang/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/linux-x64/clang/include/llvm/CodeGen/MachineModuleInfo.h
@@ -33,6 +33,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerIntPair.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Pass.h"
@@ -53,8 +54,8 @@
//===----------------------------------------------------------------------===//
/// This class can be derived from and used by targets to hold private
/// target-specific information for each Module. Objects of type are
-/// accessed/created with MMI::getInfo and destroyed when the MachineModuleInfo
-/// is destroyed.
+/// accessed/created with MachineModuleInfo::getObjFileInfo and destroyed when
+/// the MachineModuleInfo is destroyed.
///
class MachineModuleInfoImpl {
public:
@@ -74,11 +75,17 @@
/// made by different debugging and exception handling schemes and reformated
/// for specific use.
///
-class MachineModuleInfo : public ImmutablePass {
+class MachineModuleInfo {
+ friend class MachineModuleInfoWrapperPass;
+ friend class MachineModuleAnalysis;
+
const LLVMTargetMachine &TM;
/// This is the MCContext used for the entire code generator.
MCContext Context;
+ // This is an external context, that if assigned, will be used instead of the
+ // internal context.
+ MCContext *ExternalContext = nullptr;
/// This is the LLVM Module being worked on.
const Module *TheModule;
@@ -140,28 +147,37 @@
const Function *LastRequest = nullptr; ///< Used for shortcut/cache.
MachineFunction *LastResult = nullptr; ///< Used for shortcut/cache.
+ MachineModuleInfo &operator=(MachineModuleInfo &&MMII) = delete;
+
public:
- static char ID; // Pass identification, replacement for typeid
-
explicit MachineModuleInfo(const LLVMTargetMachine *TM = nullptr);
- ~MachineModuleInfo() override;
- // Initialization and Finalization
- bool doInitialization(Module &) override;
- bool doFinalization(Module &) override;
+ explicit MachineModuleInfo(const LLVMTargetMachine *TM,
+ MCContext *ExtContext);
+
+ MachineModuleInfo(MachineModuleInfo &&MMII);
+
+ ~MachineModuleInfo();
+
+ void initialize();
+ void finalize();
const LLVMTargetMachine &getTarget() const { return TM; }
- const MCContext &getContext() const { return Context; }
- MCContext &getContext() { return Context; }
+ const MCContext &getContext() const {
+ return ExternalContext ? *ExternalContext : Context;
+ }
+ MCContext &getContext() {
+ return ExternalContext ? *ExternalContext : Context;
+ }
const Module *getModule() const { return TheModule; }
/// Returns the MachineFunction constructed for the IR function \p F.
/// Creates a new MachineFunction if none exists yet.
- MachineFunction &getOrCreateMachineFunction(const Function &F);
+ MachineFunction &getOrCreateMachineFunction(Function &F);
- /// \bried Returns the MachineFunction associated to IR function \p F if there
+ /// \brief Returns the MachineFunction associated to IR function \p F if there
/// is one, otherwise nullptr.
MachineFunction *getMachineFunction(const Function &F) const;
@@ -227,13 +243,6 @@
/// to emit them as well, return the whole set.
ArrayRef<MCSymbol *> getAddrLabelSymbolToEmit(const BasicBlock *BB);
- /// If the specified function has had any references to address-taken blocks
- /// generated, but the block got deleted, return the symbol now so we can
- /// emit it. This prevents emitting a reference to a symbol that has no
- /// definition.
- void takeDeletedSymbolsForFunction(const Function *F,
- std::vector<MCSymbol*> &Result);
-
/// \name Exception Handling
/// \{
@@ -252,8 +261,49 @@
return Personalities;
}
/// \}
+
+ // MMI owes MCContext. It should never be invalidated.
+ bool invalidate(Module &, const PreservedAnalyses &,
+ ModuleAnalysisManager::Invalidator &) {
+ return false;
+ }
}; // End class MachineModuleInfo
+class MachineModuleInfoWrapperPass : public ImmutablePass {
+ MachineModuleInfo MMI;
+
+public:
+ static char ID; // Pass identification, replacement for typeid
+ explicit MachineModuleInfoWrapperPass(const LLVMTargetMachine *TM = nullptr);
+
+ explicit MachineModuleInfoWrapperPass(const LLVMTargetMachine *TM,
+ MCContext *ExtContext);
+
+ // Initialization and Finalization
+ bool doInitialization(Module &) override;
+ bool doFinalization(Module &) override;
+
+ MachineModuleInfo &getMMI() { return MMI; }
+ const MachineModuleInfo &getMMI() const { return MMI; }
+};
+
+/// An analysis that produces \c MachineInfo for a module.
+class MachineModuleAnalysis : public AnalysisInfoMixin<MachineModuleAnalysis> {
+ friend AnalysisInfoMixin<MachineModuleAnalysis>;
+ static AnalysisKey Key;
+
+ const LLVMTargetMachine *TM;
+
+public:
+ /// Provide the result type for this analysis pass.
+ using Result = MachineModuleInfo;
+
+ MachineModuleAnalysis(const LLVMTargetMachine *TM) : TM(TM) {}
+
+ /// Run the analysis pass and produce machine module information.
+ MachineModuleInfo run(Module &M, ModuleAnalysisManager &);
+};
+
} // end namespace llvm
#endif // LLVM_CODEGEN_MACHINEMODULEINFO_H