diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-06 18:38:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-06 18:38:18 +0000 |
commit | 2f05c9a206bd02c52637ebd271393e625d340b0c (patch) | |
tree | 21d18cb74470a5e90533a3ad25bdd6d770ee7f45 /llvm/lib/Analysis | |
parent | 41677800629562a79f32bcf909e3fb6400903e76 (diff) | |
download | bcm5719-llvm-2f05c9a206bd02c52637ebd271393e625d340b0c.tar.gz bcm5719-llvm-2f05c9a206bd02c52637ebd271393e625d340b0c.zip |
Remove a couple of #includes, move some code from .h file
llvm-svn: 4575
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/IPA/IPModRef.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/IPA/IPModRef.cpp b/llvm/lib/Analysis/IPA/IPModRef.cpp index e4d0062f386..22d7caa92fe 100644 --- a/llvm/lib/Analysis/IPA/IPModRef.cpp +++ b/llvm/lib/Analysis/IPA/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 @@ FunctionModRefInfo::~FunctionModRefInfo() 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 @@ bool IPModRef::run(Module &theModule) } +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"; |