summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineFunctionPass.cpp24
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenLICM.cpp8
-rw-r--r--llvm/lib/VMCore/Pass.cpp14
3 files changed, 30 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index fd8a210c4f9..2f8d4c9e7aa 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -11,11 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Function.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/ScalarEvolution.h"
-#include "llvm/Analysis/IVUsers.h"
-#include "llvm/Analysis/LiveValues.h"
-#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
using namespace llvm;
@@ -36,15 +33,18 @@ void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const {
// MachineFunctionPass preserves all LLVM IR passes, but there's no
// high-level way to express this. Instead, just list a bunch of
- // passes explicitly.
+ // passes explicitly. This does not include setPreservesCFG,
+ // because CodeGen overloads that to mean preserving the MachineBasicBlock
+ // CFG in addition to the LLVM IR CFG.
AU.addPreserved<AliasAnalysis>();
- AU.addPreserved<ScalarEvolution>();
- AU.addPreserved<IVUsers>();
- AU.addPreserved<MemoryDependenceAnalysis>();
- AU.addPreserved<LiveValues>();
- AU.addPreserved<DominatorTree>();
- AU.addPreserved<DominanceFrontier>();
- AU.addPreserved<LoopInfo>();
+ AU.addPreserved("scalar-evolution");
+ AU.addPreserved("iv-users");
+ AU.addPreserved("memdep");
+ AU.addPreserved("live-values");
+ AU.addPreserved("domtree");
+ AU.addPreserved("domfrontier");
+ AU.addPreserved("loops");
+ AU.addPreserved("lda");
FunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/Transforms/Scalar/CodeGenLICM.cpp b/llvm/lib/Transforms/Scalar/CodeGenLICM.cpp
index 9f1d148ad83..10f950e135d 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenLICM.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenLICM.cpp
@@ -22,8 +22,6 @@
#include "llvm/LLVMContext.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/ScalarEvolution.h"
-#include "llvm/Analysis/IVUsers.h"
#include "llvm/ADT/DenseMap.h"
using namespace llvm;
@@ -104,8 +102,10 @@ void CodeGenLICM::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addPreservedID(LoopSimplifyID);
AU.addPreserved<LoopInfo>();
AU.addPreserved<AliasAnalysis>();
- AU.addPreserved<ScalarEvolution>();
- AU.addPreserved<IVUsers>();
+ AU.addPreserved("scalar-evolution");
+ AU.addPreserved("iv-users");
+ AU.addPreserved("lda");
+ AU.addPreserved("live-values");
// Hoisting requires a loop preheader.
AU.addRequiredID(LoopSimplifyID);
diff --git a/llvm/lib/VMCore/Pass.cpp b/llvm/lib/VMCore/Pass.cpp
index 1278074ef53..a2831d34345 100644
--- a/llvm/lib/VMCore/Pass.cpp
+++ b/llvm/lib/VMCore/Pass.cpp
@@ -129,6 +129,9 @@ class PassRegistrar {
/// pass.
typedef std::map<intptr_t, const PassInfo*> MapType;
MapType PassInfoMap;
+
+ typedef StringMap<const PassInfo*> StringMapType;
+ StringMapType PassInfoStringMap;
/// AnalysisGroupInfo - Keep track of information for each analysis group.
struct AnalysisGroupInfo {
@@ -145,10 +148,16 @@ public:
return I != PassInfoMap.end() ? I->second : 0;
}
+ const PassInfo *GetPassInfo(const StringRef &Arg) const {
+ StringMapType::const_iterator I = PassInfoStringMap.find(Arg);
+ return I != PassInfoStringMap.end() ? I->second : 0;
+ }
+
void RegisterPass(const PassInfo &PI) {
bool Inserted =
PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),&PI)).second;
assert(Inserted && "Pass registered multiple times!"); Inserted=Inserted;
+ PassInfoStringMap[PI.getPassArgument()] = &PI;
}
void UnregisterPass(const PassInfo &PI) {
@@ -157,6 +166,7 @@ public:
// Remove pass from the map.
PassInfoMap.erase(I);
+ PassInfoStringMap.erase(PI.getPassArgument());
}
void EnumerateWith(PassRegistrationListener *L) {
@@ -227,6 +237,10 @@ const PassInfo *Pass::lookupPassInfo(intptr_t TI) {
return getPassRegistrar()->GetPassInfo(TI);
}
+const PassInfo *Pass::lookupPassInfo(const StringRef &Arg) {
+ return getPassRegistrar()->GetPassInfo(Arg);
+}
+
void PassInfo::registerPass() {
getPassRegistrar()->RegisterPass(*this);
OpenPOWER on IntegriCloud