aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/TopDownClosure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-22 00:12:00 +0000
committerChris Lattner <sabre@nondot.org>2005-03-22 00:12:00 +0000
commit24c47c5c459e91fab9865cf1b60ed527d0081f99 (patch)
tree79fad436d63f1378da8e2e83711dd1184a99a828 /lib/Analysis/DataStructure/TopDownClosure.cpp
parent612f0b74d49e4876cd2cc737ca6878327f1014eb (diff)
add some timers, don't clone aux nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index d43f9fecbf..f1aea7982c 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -19,9 +19,17 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Analysis/DataStructure/DSGraph.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Timer.h"
#include "llvm/ADT/Statistic.h"
using namespace llvm;
+#if 0
+#define TIME_REGION(VARNAME, DESC) \
+ NamedRegionTimer VARNAME(DESC)
+#else
+#define TIME_REGION(VARNAME, DESC)
+#endif
+
namespace {
RegisterAnalysis<TDDataStructures> // Register the pass
Y("tddatastructure", "Top-down Data Structure Analysis");
@@ -90,6 +98,20 @@ bool TDDataStructures::runOnModule(Module &M) {
const BUDataStructures::ActualCalleesTy &ActualCallees =
getAnalysis<BUDataStructures>().getActualCallees();
+#if 0
+{TIME_REGION(XXX, "td:Copy graphs");
+
+ // Visit each of the graphs in reverse post-order now!
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+ if (!I->isExternal())
+ getOrCreateDSGraph(*I);
+}
+//return false;
+#endif
+
+
+{TIME_REGION(XXX, "td:Compute postorder");
+
// Calculate top-down from main...
if (Function *F = M.getMainFunction())
ComputePostOrder(*F, VisitedGraph, PostOrder, ActualCallees);
@@ -99,12 +121,16 @@ bool TDDataStructures::runOnModule(Module &M) {
ComputePostOrder(*I, VisitedGraph, PostOrder, ActualCallees);
VisitedGraph.clear(); // Release memory!
+}
+
+{TIME_REGION(XXX, "td:Inline stuff");
// Visit each of the graphs in reverse post-order now!
while (!PostOrder.empty()) {
InlineCallersIntoGraph(*PostOrder.back());
PostOrder.pop_back();
}
+}
// Free the IndCallMap.
while (!IndCallMap.empty()) {
@@ -123,8 +149,9 @@ bool TDDataStructures::runOnModule(Module &M) {
DSGraph &TDDataStructures::getOrCreateDSGraph(Function &F) {
DSGraph *&G = DSInfo[&F];
if (G == 0) { // Not created yet? Clone BU graph...
- G = new DSGraph(getAnalysis<BUDataStructures>().getDSGraph(F), GlobalECs);
- G->getAuxFunctionCalls().clear();
+ G = new DSGraph(getAnalysis<BUDataStructures>().getDSGraph(F), GlobalECs,
+ DSGraph::DontCloneAuxCallNodes);
+ assert(G->getAuxFunctionCalls().empty() && "Cloned aux calls?");
G->setPrintAuxCalls();
G->setGlobalsGraph(GlobalsGraph);
}