[llvm-commits] [poolalloc] r133100 - /poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed Jun 15 15:37:18 PDT 2011
Author: aggarwa4
Date: Wed Jun 15 17:37:18 2011
New Revision: 133100
URL: http://llvm.org/viewvc/llvm-project?rev=133100&view=rev
Log:
Formatting changes only.
Modified:
poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp
Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp?rev=133100&r1=133099&r2=133100&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp (original)
+++ poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Wed Jun 15 17:37:18 2011
@@ -33,33 +33,33 @@
STATISTIC(numAllocators, "Number of malloc-like allocators");
STATISTIC(numDeallocators, "Number of free-like deallocators");
- bool AllocIdentify::flowsFrom(Value *Dest,Value *Src) {
- if(Dest == Src)
- return true;
- if(ReturnInst *Ret = dyn_cast<ReturnInst>(Dest)) {
- return flowsFrom(Ret->getReturnValue(), Src);
- }
- if(PHINode *PN = dyn_cast<PHINode>(Dest)) {
- Function *F = PN->getParent()->getParent();
- LoopInfo &LI = getAnalysis<LoopInfo>(*F);
- // If this is a loop phi, ignore.
- if(LI.isLoopHeader(PN->getParent()))
- return false;
- bool ret = true;
- for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
- ret = ret && flowsFrom(PN->getIncomingValue(i), Src);
- }
- return ret;
- }
- if(BitCastInst *BI = dyn_cast<BitCastInst>(Dest)) {
- return flowsFrom(BI->getOperand(0), Src);
+bool AllocIdentify::flowsFrom(Value *Dest,Value *Src) {
+ if(Dest == Src)
+ return true;
+ if(ReturnInst *Ret = dyn_cast<ReturnInst>(Dest)) {
+ return flowsFrom(Ret->getReturnValue(), Src);
+ }
+ if(PHINode *PN = dyn_cast<PHINode>(Dest)) {
+ Function *F = PN->getParent()->getParent();
+ LoopInfo &LI = getAnalysis<LoopInfo>(*F);
+ // If this is a loop phi, ignore.
+ if(LI.isLoopHeader(PN->getParent()))
+ return false;
+ bool ret = true;
+ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
+ ret = ret && flowsFrom(PN->getIncomingValue(i), Src);
}
- if(isa<ConstantPointerNull>(Dest))
- return true;
- return false;
+ return ret;
}
+ if(BitCastInst *BI = dyn_cast<BitCastInst>(Dest)) {
+ return flowsFrom(BI->getOperand(0), Src);
+ }
+ if(isa<ConstantPointerNull>(Dest))
+ return true;
+ return false;
+}
- bool isNotStored(Value *V) {
+bool isNotStored(Value *V) {
// check that V is not stroed to a location taht is accessible outside this fn
for(Value::use_iterator ui = V->use_begin(), ue = V->use_end();
ui != ue; ++ui) {
@@ -89,6 +89,7 @@
AllocIdentify::AllocIdentify() : ModulePass(&ID) {}
AllocIdentify::~AllocIdentify() {}
+
bool AllocIdentify::runOnModule(Module& M) {
allocators.insert("malloc");
More information about the llvm-commits
mailing list