summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-08-23 05:17:11 +0000
committerMatthias Braun <matze@braunis.de>2016-08-23 05:17:11 +0000
commit7f66202d38148a7c5b1cf6723de9d442f5566e46 (patch)
tree286a6404f2a0fcd2d8842ed5ab363c42857bc854 /llvm/lib/CodeGen/MachineModuleInfo.cpp
parentfd936841ebefb39a383fe651126998f6728efcbc (diff)
downloadbcm5719-llvm-7f66202d38148a7c5b1cf6723de9d442f5566e46.tar.gz
bcm5719-llvm-7f66202d38148a7c5b1cf6723de9d442f5566e46.zip
Revert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses"
Reverting while tracking down a use after free. This reverts commit r279502. llvm-svn: 279503
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp54
1 files changed, 5 insertions, 49 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 4b4c69319a9..244e3fbc4e8 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -13,7 +13,6 @@
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/MachineFunctionInitializer.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Constants.h"
@@ -187,19 +186,15 @@ void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) {
//===----------------------------------------------------------------------===//
-MachineModuleInfo::MachineModuleInfo(const TargetMachine &TM,
- const MCAsmInfo &MAI,
+MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI,
const MCRegisterInfo &MRI,
- const MCObjectFileInfo *MOFI,
- MachineFunctionInitializer *MFI)
- : ImmutablePass(ID), TM(TM), Context(&MAI, &MRI, MOFI, nullptr, false),
- MFInitializer(MFI) {
+ const MCObjectFileInfo *MOFI)
+ : ImmutablePass(ID), Context(&MAI, &MRI, MOFI, nullptr, false) {
initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
}
MachineModuleInfo::MachineModuleInfo()
- : ImmutablePass(ID), TM(*((TargetMachine*)nullptr)),
- Context(nullptr, nullptr, nullptr) {
+ : ImmutablePass(ID), Context(nullptr, nullptr, nullptr) {
llvm_unreachable("This MachineModuleInfo constructor should never be called, "
"MMI should always be explicitly constructed by "
"LLVMTargetMachine");
@@ -218,7 +213,7 @@ bool MachineModuleInfo::doInitialization(Module &M) {
DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;
PersonalityTypeCache = EHPersonality::Unknown;
AddrLabelSymbols = nullptr;
- TheModule = &M;
+ TheModule = nullptr;
return false;
}
@@ -466,42 +461,3 @@ try_next:;
FilterIds.push_back(0); // terminator
return FilterID;
}
-
-MachineFunction &MachineModuleInfo::getMachineFunction(const Function &F) {
- // Shortcut for the common case where a sequence of MachineFunctionPasses
- // all query for the same Function.
- if (LastRequest == &F)
- return *LastResult;
-
- auto I = MachineFunctions.insert(
- std::make_pair(&F, std::unique_ptr<MachineFunction>()));
- MachineFunction *MF;
- if (I.second) {
- // No pre-existing machine function, create a new one.
- unsigned FunctionNum = (unsigned)MachineFunctions.size() - 1;
- MF = new MachineFunction(&F, TM, FunctionNum, *this);
- // Update the set entry.
- I.first->second.reset(MF);
-
- if (MFInitializer)
- if (MFInitializer->initializeMachineFunction(*MF))
- report_fatal_error("Unable to initialize machine function");
- } else {
- MF = I.first->second.get();
- }
-
- LastRequest = &F;
- LastResult = MF;
- return *MF;
-}
-
-void MachineModuleInfo::deleteMachineFunction(MachineFunction &MF) {
- if (LastResult == &MF) {
- LastRequest = nullptr;
- LastResult = nullptr;
- }
-
- auto I = MachineFunctions.find(MF.getFunction());
- assert(I != MachineFunctions.end() && "MachineFunction is known");
- I->second.reset(nullptr);
-}
OpenPOWER on IntegriCloud