Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index 8f51f43765b138a684f9bd3054c8d14b344b42af..23467add898b299904e5463c2650e1aca4efb39f 100644 |
--- a/src/IceCfg.cpp |
+++ b/src/IceCfg.cpp |
@@ -69,14 +69,13 @@ bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } |
void Cfg::translate() { |
if (hasError()) |
return; |
+ TimerMarker T("translate", getContext()); |
dump("Initial CFG"); |
- Timer T_translate; |
// The set of translation passes and their order are determined by |
// the target. |
getTarget()->translate(); |
- T_translate.printElapsedUs(getContext(), "translate()"); |
dump("Final output"); |
} |
@@ -88,6 +87,7 @@ void Cfg::computePredecessors() { |
} |
void Cfg::renumberInstructions() { |
+ TimerMarker T("renumberInstructions", getContext()); |
NextInstNumber = 1; |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->renumberInstructions(); |
@@ -96,6 +96,7 @@ void Cfg::renumberInstructions() { |
// placePhiLoads() must be called before placePhiStores(). |
void Cfg::placePhiLoads() { |
+ TimerMarker T("placePhiLoads", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->placePhiLoads(); |
} |
@@ -103,34 +104,40 @@ void Cfg::placePhiLoads() { |
// placePhiStores() must be called after placePhiLoads(). |
void Cfg::placePhiStores() { |
+ TimerMarker T("placePhiStores", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->placePhiStores(); |
} |
} |
void Cfg::deletePhis() { |
+ TimerMarker T("deletePhis", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->deletePhis(); |
} |
} |
void Cfg::doArgLowering() { |
+ TimerMarker T("doArgLowering", getContext()); |
getTarget()->lowerArguments(); |
} |
void Cfg::doAddressOpt() { |
+ TimerMarker T("doAddressOpt", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->doAddressOpt(); |
} |
} |
void Cfg::doNopInsertion() { |
+ TimerMarker T("doNopInsertion", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->doNopInsertion(); |
} |
} |
void Cfg::genCode() { |
+ TimerMarker T("genCode", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->genCode(); |
} |
@@ -138,6 +145,7 @@ void Cfg::genCode() { |
// Compute the stack frame layout. |
void Cfg::genFrame() { |
+ TimerMarker T("genFrame", getContext()); |
getTarget()->addProlog(Entry); |
// TODO: Consider folding epilog generation into the final |
// emission/assembly pass to avoid an extra iteration over the node |
@@ -154,6 +162,7 @@ void Cfg::genFrame() { |
// completely with a single block. It is a quick single pass and |
// doesn't need to iterate until convergence. |
void Cfg::livenessLightweight() { |
+ TimerMarker T("livenessLightweight", getContext()); |
getVMetadata()->init(); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
(*I)->livenessLightweight(); |
@@ -161,6 +170,7 @@ void Cfg::livenessLightweight() { |
} |
void Cfg::liveness(LivenessMode Mode) { |
+ TimerMarker T("liveness", getContext()); |
Live.reset(new Liveness(this, Mode)); |
getVMetadata()->init(); |
Live->init(); |
@@ -199,7 +209,6 @@ void Cfg::liveness(LivenessMode Mode) { |
// Collect timing for just the portion that constructs the live |
// range intervals based on the end-of-live-range computation, for a |
// finer breakdown of the cost. |
- Timer T_liveRange; |
// Make a final pass over instructions to delete dead instructions |
// and build each Variable's live range. |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
@@ -241,7 +250,6 @@ void Cfg::liveness(LivenessMode Mode) { |
if (Var->getWeight().isInf()) |
Var->setLiveRangeInfiniteWeight(); |
} |
- T_liveRange.printElapsedUs(getContext(), "live range construction"); |
dump(); |
} |
} |
@@ -249,6 +257,7 @@ void Cfg::liveness(LivenessMode Mode) { |
// Traverse every Variable of every Inst and verify that it |
// appears within the Variable's computed live range. |
bool Cfg::validateLiveness() const { |
+ TimerMarker T("validateLiveness", getContext()); |
bool Valid = true; |
Ostream &Str = Ctx->getStrDump(); |
for (NodeList::const_iterator I1 = Nodes.begin(), E1 = Nodes.end(); I1 != E1; |
@@ -296,18 +305,19 @@ bool Cfg::validateLiveness() const { |
} |
void Cfg::doBranchOpt() { |
+ TimerMarker T("doBranchOpt", getContext()); |
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
NodeList::iterator NextNode = I; |
++NextNode; |
- (*I)->doBranchOpt(*NextNode); |
+ (*I)->doBranchOpt(NextNode == E ? NULL : *NextNode); |
Jim Stichnoth
2014/09/28 14:26:39
This was a bug pointed out by valgrind.
|
} |
} |
// ======================== Dump routines ======================== // |
void Cfg::emit() { |
+ TimerMarker T("emit", getContext()); |
Ostream &Str = Ctx->getStrEmit(); |
- Timer T_emit; |
if (!Ctx->testAndSetHasEmittedFirstMethod()) { |
// Print a helpful command for assembling the output. |
// TODO: have the Target emit the header |
@@ -339,7 +349,6 @@ void Cfg::emit() { |
(*I)->emit(this); |
} |
Str << "\n"; |
- T_emit.printElapsedUs(Ctx, "emit()"); |
} |
// Dumps the IR with an optional introductory message. |