diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:06 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:06 +0000 | 
| commit | 7ab83427af0f77b59941ceba41d509d7d097b065 (patch) | |
| tree | cc41c05b1db454e3d802f34df75e636ee922ad87 /lib/CodeGen/MachineModuleInfo.cpp | |
| parent | d288ef4c1788d3a951a7558c68312c2d320612b1 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineModuleInfo.cpp')
| -rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 16 | 
1 files changed, 9 insertions, 7 deletions
| diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index c1b72430e605..825290a438a6 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -7,14 +7,13 @@  //  //===----------------------------------------------------------------------===// +#include "llvm/CodeGen/MachineModuleInfo.h"  #include "llvm/ADT/ArrayRef.h"  #include "llvm/ADT/DenseMap.h"  #include "llvm/ADT/PostOrderIterator.h"  #include "llvm/ADT/StringRef.h"  #include "llvm/ADT/TinyPtrVector.h"  #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineFunctionInitializer.h" -#include "llvm/CodeGen/MachineModuleInfo.h"  #include "llvm/CodeGen/Passes.h"  #include "llvm/IR/BasicBlock.h"  #include "llvm/IR/DerivedTypes.h" @@ -259,7 +258,14 @@ void MachineModuleInfo::addPersonality(const Function *Personality) {  /// \} -MachineFunction &MachineModuleInfo::getMachineFunction(const Function &F) { +MachineFunction * +MachineModuleInfo::getMachineFunction(const Function &F) const { +  auto I = MachineFunctions.find(&F); +  return I != MachineFunctions.end() ? I->second.get() : nullptr; +} + +MachineFunction & +MachineModuleInfo::getOrCreateMachineFunction(const Function &F) {    // Shortcut for the common case where a sequence of MachineFunctionPasses    // all query for the same Function.    if (LastRequest == &F) @@ -273,10 +279,6 @@ MachineFunction &MachineModuleInfo::getMachineFunction(const Function &F) {      MF = new MachineFunction(&F, TM, NextFnNum++, *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();    } | 
