//===- TopDownClosure.cpp - Compute the top-down interprocedure closure ---===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements the TDDataStructures class, which represents the
#include "llvm/Support/Debug.h"
#include "llvm/Support/Timer.h"
#include "llvm/ADT/Statistic.h"
+#include <iostream>
using namespace llvm;
#if 0
#endif
namespace {
- RegisterAnalysis<TDDataStructures> // Register the pass
+ RegisterPass<TDDataStructures> // Register the pass
Y("tddatastructure", "Top-down Data Structure Analysis");
Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined");
delete IndCallMap.begin()->second;
IndCallMap.erase(IndCallMap.begin());
}
-
+
ArgsRemainIncomplete.clear();
GlobalsGraph->removeTriviallyDeadNodes();
DSGraph &G = getOrCreateDSGraph(F);
if (Visited.count(&G)) return;
Visited.insert(&G);
-
+
// Recursively traverse all of the callee graphs.
- for (DSGraph::fc_iterator CI = G.fc_begin(), E = G.fc_end(); CI != E; ++CI) {
+ for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; ++CI){
Instruction *CallI = CI->getCallSite().getInstruction();
- BUDataStructures::callee_iterator I =
- BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI);
- for (; I != E; ++I)
+ for (BUDataStructures::callee_iterator I = BUInfo->callee_begin(CallI),
+ E = BUInfo->callee_end(CallI); I != E; ++I)
ComputePostOrder(*I->second, Visited, PostOrder);
}
// sites that call into this graph.
std::vector<CallerCallEdge> EdgesFromCaller;
std::map<DSGraph*, std::vector<CallerCallEdge> >::iterator
- CEI = CallerEdges.find(&DSG);
+ CEI = CallerEdges.find(&DSG);
if (CEI != CallerEdges.end()) {
std::swap(CEI->second, EdgesFromCaller);
CallerEdges.erase(CEI);
}
-
+
// Sort the caller sites to provide a by-caller-graph ordering.
std::sort(EdgesFromCaller.begin(), EdgesFromCaller.end());
getParent()->getParent()->getName() << "'");
DEBUG(std::cerr << ": " << CF.getFunctionType()->getNumParams()
<< " args\n");
-
+
// Get the formal argument and return nodes for the called function and
// merge them with the cloned subgraph.
DSCallSite T1 = DSG.getCallSiteForArguments(CF);
// so we build up a new, private, graph that represents the calls of all
// calls to this set of functions.
std::vector<Function*> Callees;
- for (BUDataStructures::ActualCalleesTy::const_iterator I =
+ for (BUDataStructures::ActualCalleesTy::const_iterator I =
BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI);
I != E; ++I)
if (!I->second->isExternal())
// If we already have this graph, recycle it.
if (IndCallRecI != IndCallMap.end() && IndCallRecI->first == Callees) {
- std::cerr << " [TD] *** Reuse of indcall graph for " << Callees.size()
- << " callees!\n";
+ DEBUG(std::cerr << " [TD] *** Reuse of indcall graph for " << Callees.size()
+ << " callees!\n");
IndCallGraph = IndCallRecI->second;
} else {
// Otherwise, create a new DSGraph to represent this.