Give a back pointer to the IPModRef object to the FunctionModRefInfo object

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-11-06 19:07:13 +00:00
parent fc928245ad
commit 2110808fd8
3 changed files with 14 additions and 8 deletions

View File

@ -113,6 +113,7 @@ public:
class FunctionModRefInfo {
const Function& F; // The function
IPModRef& IPModRefObj; // The IPModRef Object owning this
const DSGraph& funcTDGraph; // Top-down DS graph for function
const DSGraph& funcLocalGraph; // Local DS graph for function
ModRefInfo funcModRefInfo; // ModRefInfo for the function body
@ -127,6 +128,7 @@ class FunctionModRefInfo {
public:
/* ctor */ FunctionModRefInfo (const Function& func,
IPModRef& IPModRefObj,
const DSGraph& tdg,
const DSGraph& ldg);
/* dtor */ ~FunctionModRefInfo ();

View File

@ -44,9 +44,10 @@ void ModRefInfo::dump() const
// This constructor computes a node numbering for the TD graph.
//
FunctionModRefInfo::FunctionModRefInfo(const Function& func,
IPModRef& ipmro,
const DSGraph& tdg,
const DSGraph& ldg)
: F(func),
: F(func), IPModRefObj(ipmro),
funcTDGraph(tdg),
funcLocalGraph(ldg),
funcModRefInfo(tdg.getGraphSize())
@ -76,7 +77,7 @@ unsigned FunctionModRefInfo::getNodeId(const Value* value) const {
// Dummy function that will be replaced with one that inlines
// the callee's BU graph into the caller's TD graph.
//
const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph,
static const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph,
const CallInst& callInst)
{
return &funcTDGraph; // TEMPORARY
@ -203,9 +204,9 @@ FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
{
FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func];
assert (funcInfo != NULL || computeIfMissing);
if (funcInfo == NULL && computeIfMissing)
if (funcInfo == NULL)
{ // Create a new FunctionModRefInfo object
funcInfo = new FunctionModRefInfo(func, // inserts into map
funcInfo = new FunctionModRefInfo(func, *this, // inserts into map
getAnalysis<TDDataStructures>().getDSGraph(func),
getAnalysis<LocalDataStructures>().getDSGraph(func));
funcInfo->computeModRef(func); // computes the mod/ref info
@ -219,6 +220,7 @@ FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
void IPModRef::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LocalDataStructures>();
AU.addRequired<BUDataStructures>();
AU.addRequired<TDDataStructures>();
}

View File

@ -44,9 +44,10 @@ void ModRefInfo::dump() const
// This constructor computes a node numbering for the TD graph.
//
FunctionModRefInfo::FunctionModRefInfo(const Function& func,
IPModRef& ipmro,
const DSGraph& tdg,
const DSGraph& ldg)
: F(func),
: F(func), IPModRefObj(ipmro),
funcTDGraph(tdg),
funcLocalGraph(ldg),
funcModRefInfo(tdg.getGraphSize())
@ -76,7 +77,7 @@ unsigned FunctionModRefInfo::getNodeId(const Value* value) const {
// Dummy function that will be replaced with one that inlines
// the callee's BU graph into the caller's TD graph.
//
const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph,
static const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph,
const CallInst& callInst)
{
return &funcTDGraph; // TEMPORARY
@ -203,9 +204,9 @@ FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
{
FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func];
assert (funcInfo != NULL || computeIfMissing);
if (funcInfo == NULL && computeIfMissing)
if (funcInfo == NULL)
{ // Create a new FunctionModRefInfo object
funcInfo = new FunctionModRefInfo(func, // inserts into map
funcInfo = new FunctionModRefInfo(func, *this, // inserts into map
getAnalysis<TDDataStructures>().getDSGraph(func),
getAnalysis<LocalDataStructures>().getDSGraph(func));
funcInfo->computeModRef(func); // computes the mod/ref info
@ -219,6 +220,7 @@ FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
void IPModRef::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LocalDataStructures>();
AU.addRequired<BUDataStructures>();
AU.addRequired<TDDataStructures>();
}