mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-03 10:54:42 +00:00
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. llvm-svn: 75135
This commit is contained in:
parent
946c6e3df5
commit
02ee56adb2
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/SSI.h"
|
#include "llvm/Transforms/Utils/SSI.h"
|
||||||
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -32,6 +33,9 @@ static const std::string SSI_SIG = "SSI_sigma";
|
|||||||
|
|
||||||
static const unsigned UNSIGNED_INFINITE = ~0U;
|
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 {
|
void SSI::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequired<DominanceFrontier>();
|
AU.addRequired<DominanceFrontier>();
|
||||||
AU.addRequired<DominatorTree>();
|
AU.addRequired<DominatorTree>();
|
||||||
@ -100,6 +104,7 @@ void SSI::insertSigmaFunctions(SmallVectorImpl<Instruction *> &value) {
|
|||||||
created.insert(PN);
|
created.insert(PN);
|
||||||
need = true;
|
need = true;
|
||||||
defsites[i].push_back(BB_next);
|
defsites[i].push_back(BB_next);
|
||||||
|
++NumSigmaInserted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,6 +148,7 @@ void SSI::insertPhiFunctions(SmallVectorImpl<Instruction *> &value) {
|
|||||||
created.insert(PN);
|
created.insert(PN);
|
||||||
|
|
||||||
defsites[i].push_back(BB_dominated);
|
defsites[i].push_back(BB_dominated);
|
||||||
|
++NumPhiInserted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,3 +394,40 @@ FunctionPass *llvm::createSSIPass() { return new SSI(); }
|
|||||||
char SSI::ID = 0;
|
char SSI::ID = 0;
|
||||||
static RegisterPass<SSI> X("ssi", "Static Single Information Construction");
|
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");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user