OLD | NEW |
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the Cfg class, including constant pool | 10 // This file implements the Cfg class, including constant pool |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ImplicitArgs.push_back(Arg); | 74 ImplicitArgs.push_back(Arg); |
75 } | 75 } |
76 | 76 |
77 // Returns whether the stack frame layout has been computed yet. This | 77 // Returns whether the stack frame layout has been computed yet. This |
78 // is used for dumping the stack frame location of Variables. | 78 // is used for dumping the stack frame location of Variables. |
79 bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } | 79 bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } |
80 | 80 |
81 void Cfg::translate() { | 81 void Cfg::translate() { |
82 if (hasError()) | 82 if (hasError()) |
83 return; | 83 return; |
| 84 // FunctionTimer conditionally pushes/pops a TimerMarker if |
| 85 // TimeEachFunction is enabled. |
| 86 std::unique_ptr<TimerMarker> FunctionTimer; |
84 if (ALLOW_DUMP) { | 87 if (ALLOW_DUMP) { |
85 const IceString &TimingFocusOn = getContext()->getFlags().TimingFocusOn; | 88 const IceString &TimingFocusOn = getContext()->getFlags().TimingFocusOn; |
86 if (TimingFocusOn == "*" || TimingFocusOn == getFunctionName()) { | 89 const IceString &Name = getFunctionName(); |
| 90 if (TimingFocusOn == "*" || TimingFocusOn == Name) { |
87 setFocusedTiming(); | 91 setFocusedTiming(); |
88 getContext()->resetTimer(GlobalContext::TSK_Default); | 92 getContext()->resetTimer(GlobalContext::TSK_Default); |
89 getContext()->setTimerName(GlobalContext::TSK_Default, getFunctionName()); | 93 getContext()->setTimerName(GlobalContext::TSK_Default, Name); |
90 } | 94 } |
| 95 if (getContext()->getFlags().TimeEachFunction) |
| 96 FunctionTimer.reset(new TimerMarker( |
| 97 getContext()->getTimerID(GlobalContext::TSK_Funcs, Name), |
| 98 getContext(), GlobalContext::TSK_Funcs)); |
91 } | 99 } |
92 TimerMarker T(TimerStack::TT_translate, this); | 100 TimerMarker T(TimerStack::TT_translate, this); |
93 | 101 |
94 dump("Initial CFG"); | 102 dump("Initial CFG"); |
95 | 103 |
96 // The set of translation passes and their order are determined by | 104 // The set of translation passes and their order are determined by |
97 // the target. | 105 // the target. |
98 getTarget()->translate(); | 106 getTarget()->translate(); |
99 | 107 |
100 dump("Final output"); | 108 dump("Final output"); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 519 } |
512 } | 520 } |
513 // Print each basic block | 521 // Print each basic block |
514 for (CfgNode *Node : Nodes) | 522 for (CfgNode *Node : Nodes) |
515 Node->dump(this); | 523 Node->dump(this); |
516 if (isVerbose(IceV_Instructions)) | 524 if (isVerbose(IceV_Instructions)) |
517 Str << "}\n"; | 525 Str << "}\n"; |
518 } | 526 } |
519 | 527 |
520 } // end of namespace Ice | 528 } // end of namespace Ice |
OLD | NEW |