[llvm-commits] [poolalloc] r128655 - in /poolalloc/trunk: include/dsa/DataStructure.h lib/DSA/StdLibPass.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Thu Mar 31 11:43:44 PDT 2011
Author: aggarwa4
Date: Thu Mar 31 13:43:43 2011
New Revision: 128655
URL: http://llvm.org/viewvc/llvm-project?rev=128655&view=rev
Log:
Make stdLib pass use the allocator wrapper info.
Modified:
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/lib/DSA/StdLibPass.cpp
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=128655&r1=128654&r2=128655&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Thu Mar 31 13:43:43 2011
@@ -23,6 +23,7 @@
#include "dsa/svset.h"
#include "dsa/super_set.h"
#include "dsa/AddressTakenAnalysis.h"
+#include "dsa/AllocatorIdentification.h"
#include <map>
@@ -197,6 +198,8 @@
class StdLibDataStructures : public DataStructures {
void eraseCallsTo(Function* F);
void processRuntimeCheck (Module & M, std::string name, unsigned arg);
+ void processFunction(int x, Function *F);
+ AllocIdentify *AllocWrappersAnalysis;
public:
static char ID;
StdLibDataStructures() : DataStructures((intptr_t)&ID, "stdlib.") {}
@@ -208,6 +211,7 @@
///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LocalDataStructures>();
+ AU.addRequired<AllocIdentify>();
AU.setPreservesAll();
}
};
Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=128655&r1=128654&r2=128655&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Thu Mar 31 13:43:43 2011
@@ -12,6 +12,7 @@
#include "llvm/ADT/Statistic.h"
#include "dsa/DataStructure.h"
+#include "dsa/AllocatorIdentification.h"
#include "dsa/DSGraph.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
@@ -392,6 +393,7 @@
// Get the results from the local pass.
//
init (&getAnalysis<LocalDataStructures>(), true, true, false, false);
+ AllocWrappersAnalysis = &getAnalysis<AllocIdentify>();
//
// Fetch the DSGraphs for all defined functions within the module.
@@ -437,6 +439,32 @@
processFunction(x, F);
}
+ std::set<std::string>::iterator ai = AllocWrappersAnalysis->alloc_begin();
+ std::set<std::string>::iterator ae = AllocWrappersAnalysis->alloc_end();
+ int x;
+ for (x = 0; recFuncs[x].name; ++x) {
+ if(recFuncs[x].name == "malloc")
+ break;
+ }
+
+ for(;ai != ae; ++ai) {
+ if(Function* F = M.getFunction(*ai))
+ processFunction(x, F);
+ }
+
+ ai = AllocWrappersAnalysis->dealloc_begin();
+ ae = AllocWrappersAnalysis->dealloc_end();
+ for (x = 0; recFuncs[x].name; ++x) {
+ if(recFuncs[x].name == "free")
+ break;
+ }
+
+ for(;ai != ae; ++ai) {
+ errs() << *ai << "\n";
+ if(Function* F = M.getFunction(*ai))
+ processFunction(x, F);
+ }
+
//
// Merge return values and checked pointer values for SAFECode run-time
// checks.
More information about the llvm-commits
mailing list