[llvm-commits] [llvm] r75135 - /llvm/trunk/lib/Transforms/Utils/SSI.cpp
Nick Lewycky
nicholas at mxc.ca
Thu Jul 9 08:33:15 PDT 2009
Author: nicholas
Date: Thu Jul 9 10:33:14 2009
New Revision: 75135
URL: http://llvm.org/viewvc/llvm-project?rev=75135&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Utils/SSI.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSI.cpp?rev=75135&r1=75134&r2=75135&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSI.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSI.cpp Thu Jul 9 10:33:14 2009
@@ -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 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 @@
created.insert(PN);
need = true;
defsites[i].push_back(BB_next);
+ ++NumSigmaInserted;
}
}
}
@@ -143,6 +148,7 @@
created.insert(PN);
defsites[i].push_back(BB_dominated);
+ ++NumPhiInserted;
}
}
}
@@ -388,3 +394,40 @@
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");
More information about the llvm-commits
mailing list