Remove a couple of #includes, move some code from .h file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4575 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/IPModRef.cpp b/lib/Analysis/DataStructure/IPModRef.cpp
index e4d0062..22d7caa 100644
--- a/lib/Analysis/DataStructure/IPModRef.cpp
+++ b/lib/Analysis/DataStructure/IPModRef.cpp
@@ -4,22 +4,15 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Analysis/IPModRef.h"
#include "llvm/Analysis/DataStructure.h"
#include "llvm/Analysis/DSGraph.h"
-#include "llvm/Analysis/IPModRef.h"
#include "llvm/Module.h"
-#include "llvm/Function.h"
#include "llvm/iOther.h"
-#include "llvm/Pass.h"
#include "Support/Statistic.h"
#include "Support/STLExtras.h"
#include "Support/StringExtras.h"
-#include <algorithm>
-#include <utility>
-#include <vector>
-
-
//----------------------------------------------------------------------------
// Private constants and data
//----------------------------------------------------------------------------
@@ -73,6 +66,12 @@
callSiteModRefInfo.clear();
}
+unsigned FunctionModRefInfo::getNodeId(const Value* value) const {
+ return getNodeId(funcTDGraph.getNodeForValue(const_cast<Value*>(value))
+ .getNode());
+}
+
+
// Dummy function that will be replaced with one that inlines
// the callee's BU graph into the caller's TD graph.
@@ -199,6 +198,31 @@
}
+FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
+ bool computeIfMissing)
+{
+ FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func];
+ assert (funcInfo != NULL || computeIfMissing);
+ if (funcInfo == NULL && computeIfMissing)
+ { // Create a new FunctionModRefInfo object
+ funcInfo = new FunctionModRefInfo(func, // inserts into map
+ getAnalysis<TDDataStructures>().getDSGraph(func),
+ getAnalysis<LocalDataStructures>().getDSGraph(func));
+ funcInfo->computeModRef(func); // computes the mod/ref info
+ }
+ return *funcInfo;
+}
+
+// getAnalysisUsage - This pass requires top-down data structure graphs.
+// It modifies nothing.
+//
+void IPModRef::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addRequired<LocalDataStructures>();
+ AU.addRequired<TDDataStructures>();
+}
+
+
void IPModRef::print(std::ostream &O) const
{
O << "\n========== Results of Interprocedural Mod/Ref Analysis ==========\n";