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
This commit is contained in:
Chris Lattner 2002-11-06 18:38:18 +00:00
parent 76351e9bab
commit fc928245ad
2 changed files with 64 additions and 16 deletions

View File

@ -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";

View File

@ -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";