mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-20 11:08:27 +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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f881ae0a32
commit
6ca7f41f5b
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user