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 /// \file | 10 /// \file |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 constexpr Variable *Void = nullptr; | 190 constexpr Variable *Void = nullptr; |
191 constexpr bool HasTailCall = false; | 191 constexpr bool HasTailCall = false; |
192 auto *Call = | 192 auto *Call = |
193 InstCall::create(this, NumArgs, Void, ProfileSummarySym, HasTailCall); | 193 InstCall::create(this, NumArgs, Void, ProfileSummarySym, HasTailCall); |
194 getEntryNode()->getInsts().push_front(Call); | 194 getEntryNode()->getInsts().push_front(Call); |
195 } | 195 } |
196 | 196 |
197 void Cfg::translate() { | 197 void Cfg::translate() { |
198 if (hasError()) | 198 if (hasError()) |
199 return; | 199 return; |
| 200 if (BuildDefs::timers()) { |
| 201 const std::string TimingFocusOn = getFlags().getTimingFocusOn(); |
| 202 if (!TimingFocusOn.empty()) { |
| 203 const std::string Name = getFunctionName().toString(); |
| 204 if (TimingFocusOn == "*" || TimingFocusOn == Name) { |
| 205 setFocusedTiming(); |
| 206 getContext()->resetTimer(GlobalContext::TSK_Default); |
| 207 getContext()->setTimerName(GlobalContext::TSK_Default, Name); |
| 208 } |
| 209 } |
| 210 } |
200 if (BuildDefs::dump()) { | 211 if (BuildDefs::dump()) { |
201 const std::string TimingFocusOn = getFlags().getTimingFocusOn(); | |
202 const std::string Name = getFunctionName().toString(); | |
203 if (TimingFocusOn == "*" || TimingFocusOn == Name) { | |
204 setFocusedTiming(); | |
205 getContext()->resetTimer(GlobalContext::TSK_Default); | |
206 getContext()->setTimerName(GlobalContext::TSK_Default, Name); | |
207 } | |
208 if (isVerbose(IceV_Status)) { | 212 if (isVerbose(IceV_Status)) { |
209 getContext()->getStrDump() << ">>>Translating " | 213 getContext()->getStrDump() << ">>>Translating " |
210 << getFunctionNameAndSize() << "\n"; | 214 << getFunctionNameAndSize() << "\n"; |
211 } | 215 } |
212 } | 216 } |
213 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); | 217 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); |
214 TimerMarker T(TimerStack::TT_translate, this); | 218 TimerMarker T(TimerStack::TT_translate, this); |
215 | 219 |
216 dump("Initial CFG"); | 220 dump("Initial CFG"); |
217 | 221 |
(...skipping 10 matching lines...) Expand all Loading... |
228 // Create the Hi and Lo variables where a split was needed | 232 // Create the Hi and Lo variables where a split was needed |
229 for (Variable *Var : Variables) | 233 for (Variable *Var : Variables) |
230 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 234 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) |
231 Var64On32->initHiLo(this); | 235 Var64On32->initHiLo(this); |
232 | 236 |
233 // The set of translation passes and their order are determined by the | 237 // The set of translation passes and their order are determined by the |
234 // target. | 238 // target. |
235 getTarget()->translate(); | 239 getTarget()->translate(); |
236 | 240 |
237 dump("Final output"); | 241 dump("Final output"); |
238 if (getFocusedTiming()) | 242 if (getFocusedTiming()) { |
| 243 getContext()->mergeTimersFromTLS(); |
239 getContext()->dumpTimers(); | 244 getContext()->dumpTimers(); |
| 245 } |
240 } | 246 } |
241 | 247 |
242 void Cfg::computeInOutEdges() { | 248 void Cfg::computeInOutEdges() { |
243 // Compute the out-edges. | 249 // Compute the out-edges. |
244 for (CfgNode *Node : Nodes) | 250 for (CfgNode *Node : Nodes) |
245 Node->computeSuccessors(); | 251 Node->computeSuccessors(); |
246 | 252 |
247 // Prune any unreachable nodes before computing in-edges. | 253 // Prune any unreachable nodes before computing in-edges. |
248 SizeT NumNodes = getNumNodes(); | 254 SizeT NumNodes = getNumNodes(); |
249 BitVector Reachable(NumNodes); | 255 BitVector Reachable(NumNodes); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 } | 1165 } |
1160 } | 1166 } |
1161 // Print each basic block | 1167 // Print each basic block |
1162 for (CfgNode *Node : Nodes) | 1168 for (CfgNode *Node : Nodes) |
1163 Node->dump(this); | 1169 Node->dump(this); |
1164 if (isVerbose(IceV_Instructions)) | 1170 if (isVerbose(IceV_Instructions)) |
1165 Str << "}\n"; | 1171 Str << "}\n"; |
1166 } | 1172 } |
1167 | 1173 |
1168 } // end of namespace Ice | 1174 } // end of namespace Ice |
OLD | NEW |