aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-07-09 15:33:14 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-07-09 15:33:14 +0000
commit09b2978da2d8750abc8c80a3d6618b8b497435db (patch)
tree6acd61b5a4957a743d5e6fb9fbfed11055a9003f /lib/Transforms
parent1a4ac6a5bf598ffa7305fb5363402ac84dea1e0e (diff)
downloadexternal_llvm-09b2978da2d8750abc8c80a3d6618b8b497435db.zip
external_llvm-09b2978da2d8750abc8c80a3d6618b8b497435db.tar.gz
external_llvm-09b2978da2d8750abc8c80a3d6618b8b497435db.tar.bz2
Add some statistics to SSI so we can see what it's up to.
Add an -ssi-everything pass which calls createSSI on everything in the function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/SSI.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/SSI.cpp b/lib/Transforms/Utils/SSI.cpp
index 4c4dd37..caafb31 100644
--- a/lib/Transforms/Utils/SSI.cpp
+++ b/lib/Transforms/Utils/SSI.cpp
@@ -23,6 +23,7 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/SSI.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/Dominators.h"
using namespace llvm;
@@ -32,6 +33,9 @@ static const std::string SSI_SIG = "SSI_sigma";
static const unsigned UNSIGNED_INFINITE = ~0U;
+STATISTIC(NumSigmaInserted, "Number of sigma functions inserted");
+STATISTIC(NumPhiInserted, "Number of phi functions inserted");
+
void SSI::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominanceFrontier>();
AU.addRequired<DominatorTree>();
@@ -100,6 +104,7 @@ void SSI::insertSigmaFunctions(SmallVectorImpl<Instruction *> &value) {
created.insert(PN);
need = true;
defsites[i].push_back(BB_next);
+ ++NumSigmaInserted;
}
}
}
@@ -143,6 +148,7 @@ void SSI::insertPhiFunctions(SmallVectorImpl<Instruction *> &value) {
created.insert(PN);
defsites[i].push_back(BB_dominated);
+ ++NumPhiInserted;
}
}
}
@@ -388,3 +394,40 @@ FunctionPass *llvm::createSSIPass() { return new SSI(); }
char SSI::ID = 0;
static RegisterPass<SSI> X("ssi", "Static Single Information Construction");
+/// SSIEverything - A pass that runs createSSI on every non-void variable,
+/// intended for debugging.
+namespace {
+ struct VISIBILITY_HIDDEN SSIEverything : public FunctionPass {
+ static char ID; // Pass identification, replacement for typeid
+ SSIEverything() : FunctionPass((intptr_t)&ID) {}
+
+ bool runOnFunction(Function &F);
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.addRequired<SSI>();
+ }
+ };
+}
+
+bool SSIEverything::runOnFunction(Function &F) {
+ SmallVector<Instruction *, 16> Insts;
+ SSI &ssi = getAnalysis<SSI>();
+
+ if (F.isDeclaration() || F.isIntrinsic()) return false;
+
+ for (Function::iterator B = F.begin(), BE = F.end(); B != BE; ++B)
+ for (BasicBlock::iterator I = B->begin(), E = B->end(); I != E; ++I)
+ if (I->getType() != Type::VoidTy)
+ Insts.push_back(I);
+
+ ssi.createSSI(Insts);
+ return true;
+}
+
+/// createSSIEverythingPass - The public interface to this file...
+///
+FunctionPass *llvm::createSSIEverythingPass() { return new SSIEverything(); }
+
+char SSIEverything::ID = 0;
+static RegisterPass<SSIEverything>
+Y("ssi-everything", "Static Single Information Construction");