From fc928245adb01708fcfdd3a7505d57a758b1026a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 6 Nov 2002 18:38:18 +0000 Subject: 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 --- lib/Analysis/DataStructure/IPModRef.cpp | 40 ++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'lib/Analysis/DataStructure/IPModRef.cpp') diff --git a/lib/Analysis/DataStructure/IPModRef.cpp b/lib/Analysis/DataStructure/IPModRef.cpp index e4d0062f38..22d7caa92f 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 -#include -#include - - //---------------------------------------------------------------------------- // 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)) + .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().getDSGraph(func), + getAnalysis().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(); + AU.addRequired(); +} + + void IPModRef::print(std::ostream &O) const { O << "\n========== Results of Interprocedural Mod/Ref Analysis ==========\n"; -- cgit v1.2.3-18-g5258