Chromium Code Reviews| Index: src/IceCfg.cpp |
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
| index 1134fdc7054a43e5d22c4d5c29dfd34251ac97f9..0e65367ec25917808094ffd2b89423f3f1090706 100644 |
| --- a/src/IceCfg.cpp |
| +++ b/src/IceCfg.cpp |
| @@ -25,8 +25,8 @@ namespace Ice { |
| Cfg::Cfg(GlobalContext *Ctx) |
| : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), |
| - IsInternalLinkage(false), HasError(false), ErrorMessage(""), Entry(NULL), |
| - NextInstNumber(1), Live(nullptr), |
| + IsInternalLinkage(false), HasError(false), FocusedTiming(false), |
| + ErrorMessage(""), Entry(NULL), NextInstNumber(1), Live(nullptr), |
| Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), |
| VMetadata(new VariablesMetadata(this)), |
| TargetAssembler( |
| @@ -69,8 +69,15 @@ bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } |
| void Cfg::translate() { |
| if (hasError()) |
| return; |
| + VerboseMask OldVerboseMask = getContext()->getVerbose(); |
| + const IceString &TimingFocusOn = getContext()->getFlags().TimingFocusOn; |
| + if (TimingFocusOn == "*" || TimingFocusOn == getFunctionName()) |
| + setFocusedTiming(); |
| + bool VerboseFocus = (getContext()->getFlags().VerboseFocusOn == getFunctionName()); |
|
jvoung (off chromium)
2014/10/06 16:30:56
80 col ?
Jim Stichnoth
2014/10/06 21:29:57
Done.
|
| + if (VerboseFocus) |
| + getContext()->setVerbose(IceV_All); |
| static TimerIdT IDtranslate = GlobalContext::getTimerID("translate"); |
| - TimerMarker T(IDtranslate, getContext()); |
| + TimerMarker T(IDtranslate, this); |
| dump("Initial CFG"); |
| @@ -79,6 +86,10 @@ void Cfg::translate() { |
| getTarget()->translate(); |
| dump("Final output"); |
| + if (getFocusedTiming()) |
| + getContext()->dumpTimers(); |
| + if (VerboseFocus) |
| + getContext()->setVerbose(OldVerboseMask); |
| } |
| void Cfg::computePredecessors() { |
| @@ -89,7 +100,7 @@ void Cfg::computePredecessors() { |
| void Cfg::renumberInstructions() { |
| static TimerIdT IDrenumberInstructions = |
| GlobalContext::getTimerID("renumberInstructions"); |
| - TimerMarker T(IDrenumberInstructions, getContext()); |
| + TimerMarker T(IDrenumberInstructions, this); |
| NextInstNumber = 1; |
| for (CfgNode *Node : Nodes) |
| Node->renumberInstructions(); |
| @@ -98,7 +109,7 @@ void Cfg::renumberInstructions() { |
| // placePhiLoads() must be called before placePhiStores(). |
| void Cfg::placePhiLoads() { |
| static TimerIdT IDplacePhiLoads = GlobalContext::getTimerID("placePhiLoads"); |
| - TimerMarker T(IDplacePhiLoads, getContext()); |
| + TimerMarker T(IDplacePhiLoads, this); |
| for (CfgNode *Node : Nodes) |
| Node->placePhiLoads(); |
| } |
| @@ -107,27 +118,27 @@ void Cfg::placePhiLoads() { |
| void Cfg::placePhiStores() { |
| static TimerIdT IDplacePhiStores = |
| GlobalContext::getTimerID("placePhiStores"); |
| - TimerMarker T(IDplacePhiStores, getContext()); |
| + TimerMarker T(IDplacePhiStores, this); |
| for (CfgNode *Node : Nodes) |
| Node->placePhiStores(); |
| } |
| void Cfg::deletePhis() { |
| static TimerIdT IDdeletePhis = GlobalContext::getTimerID("deletePhis"); |
| - TimerMarker T(IDdeletePhis, getContext()); |
| + TimerMarker T(IDdeletePhis, this); |
| for (CfgNode *Node : Nodes) |
| Node->deletePhis(); |
| } |
| void Cfg::doArgLowering() { |
| static TimerIdT IDdoArgLowering = GlobalContext::getTimerID("doArgLowering"); |
| - TimerMarker T(IDdoArgLowering, getContext()); |
| + TimerMarker T(IDdoArgLowering, this); |
| getTarget()->lowerArguments(); |
| } |
| void Cfg::doAddressOpt() { |
| static TimerIdT IDdoAddressOpt = GlobalContext::getTimerID("doAddressOpt"); |
| - TimerMarker T(IDdoAddressOpt, getContext()); |
| + TimerMarker T(IDdoAddressOpt, this); |
| for (CfgNode *Node : Nodes) |
| Node->doAddressOpt(); |
| } |
| @@ -135,14 +146,14 @@ void Cfg::doAddressOpt() { |
| void Cfg::doNopInsertion() { |
| static TimerIdT IDdoNopInsertion = |
| GlobalContext::getTimerID("doNopInsertion"); |
| - TimerMarker T(IDdoNopInsertion, getContext()); |
| + TimerMarker T(IDdoNopInsertion, this); |
| for (CfgNode *Node : Nodes) |
| Node->doNopInsertion(); |
| } |
| void Cfg::genCode() { |
| static TimerIdT IDgenCode = GlobalContext::getTimerID("genCode"); |
| - TimerMarker T(IDgenCode, getContext()); |
| + TimerMarker T(IDgenCode, this); |
| for (CfgNode *Node : Nodes) |
| Node->genCode(); |
| } |
| @@ -150,7 +161,7 @@ void Cfg::genCode() { |
| // Compute the stack frame layout. |
| void Cfg::genFrame() { |
| static TimerIdT IDgenFrame = GlobalContext::getTimerID("genFrame"); |
| - TimerMarker T(IDgenFrame, getContext()); |
| + TimerMarker T(IDgenFrame, this); |
| getTarget()->addProlog(Entry); |
| // TODO: Consider folding epilog generation into the final |
| // emission/assembly pass to avoid an extra iteration over the node |
| @@ -167,7 +178,7 @@ void Cfg::genFrame() { |
| void Cfg::livenessLightweight() { |
| static TimerIdT IDlivenessLightweight = |
| GlobalContext::getTimerID("livenessLightweight"); |
| - TimerMarker T(IDlivenessLightweight, getContext()); |
| + TimerMarker T(IDlivenessLightweight, this); |
| getVMetadata()->init(); |
| for (CfgNode *Node : Nodes) |
| Node->livenessLightweight(); |
| @@ -175,7 +186,7 @@ void Cfg::livenessLightweight() { |
| void Cfg::liveness(LivenessMode Mode) { |
| static TimerIdT IDliveness = GlobalContext::getTimerID("liveness"); |
| - TimerMarker T(IDliveness, getContext()); |
| + TimerMarker T(IDliveness, this); |
| Live.reset(new Liveness(this, Mode)); |
| getVMetadata()->init(); |
| Live->init(); |
| @@ -209,7 +220,7 @@ void Cfg::liveness(LivenessMode Mode) { |
| // Make a final pass over instructions to delete dead instructions |
| // and build each Variable's live range. |
| static TimerIdT IDliveRange = GlobalContext::getTimerID("liveRange"); |
| - TimerMarker T1(IDliveRange, getContext()); |
| + TimerMarker T1(IDliveRange, this); |
| for (CfgNode *Node : Nodes) |
| Node->livenessPostprocess(Mode, getLiveness()); |
| if (Mode == Liveness_Intervals) { |
| @@ -257,7 +268,7 @@ void Cfg::liveness(LivenessMode Mode) { |
| bool Cfg::validateLiveness() const { |
| static TimerIdT IDvalidateLiveness = |
| GlobalContext::getTimerID("validateLiveness"); |
| - TimerMarker T(IDvalidateLiveness, getContext()); |
| + TimerMarker T(IDvalidateLiveness, this); |
| bool Valid = true; |
| Ostream &Str = Ctx->getStrDump(); |
| for (CfgNode *Node : Nodes) { |
| @@ -301,7 +312,7 @@ bool Cfg::validateLiveness() const { |
| void Cfg::doBranchOpt() { |
| static TimerIdT IDdoBranchOpt = GlobalContext::getTimerID("doBranchOpt"); |
| - TimerMarker T(IDdoBranchOpt, getContext()); |
| + TimerMarker T(IDdoBranchOpt, this); |
| for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { |
| auto NextNode = I; |
| ++NextNode; |
| @@ -313,7 +324,7 @@ void Cfg::doBranchOpt() { |
| void Cfg::emit() { |
| static TimerIdT IDemit = GlobalContext::getTimerID("emit"); |
| - TimerMarker T(IDemit, getContext()); |
| + TimerMarker T(IDemit, this); |
| Ostream &Str = Ctx->getStrEmit(); |
| if (!Ctx->testAndSetHasEmittedFirstMethod()) { |
| // Print a helpful command for assembling the output. |