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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 void Cfg::translate() { | 197 void Cfg::translate() { |
198 if (hasError()) | 198 if (hasError()) |
199 return; | 199 return; |
200 if (BuildDefs::timers()) { | 200 if (BuildDefs::timers()) { |
201 const std::string TimingFocusOn = getFlags().getTimingFocusOn(); | 201 const std::string TimingFocusOn = getFlags().getTimingFocusOn(); |
202 if (!TimingFocusOn.empty()) { | 202 if (!TimingFocusOn.empty()) { |
203 const std::string Name = getFunctionName().toString(); | 203 const std::string Name = getFunctionName().toString(); |
204 if (TimingFocusOn == "*" || TimingFocusOn == Name) { | 204 if (TimingFocusOn == "*" || TimingFocusOn == Name) { |
205 setFocusedTiming(); | 205 setFocusedTiming(); |
206 getContext()->resetTimer(GlobalContext::TSK_Default); | 206 getContext()->resetTimer(GlobalContext::TSK_Default); |
207 getContext()->setTimerName(GlobalContext::TSK_Default, Name); | |
208 } | 207 } |
209 } | 208 } |
210 } | 209 } |
211 if (BuildDefs::dump()) { | 210 if (BuildDefs::dump()) { |
212 if (isVerbose(IceV_Status)) { | 211 if (isVerbose(IceV_Status)) { |
213 getContext()->getStrDump() << ">>>Translating " | 212 getContext()->getStrDump() << ">>>Translating " |
214 << getFunctionNameAndSize() << "\n"; | 213 << getFunctionNameAndSize() << "\n"; |
215 } | 214 } |
216 } | 215 } |
217 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); | 216 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); |
(...skipping 15 matching lines...) Expand all Loading... | |
233 for (Variable *Var : Variables) | 232 for (Variable *Var : Variables) |
234 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 233 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) |
235 Var64On32->initHiLo(this); | 234 Var64On32->initHiLo(this); |
236 | 235 |
237 // The set of translation passes and their order are determined by the | 236 // The set of translation passes and their order are determined by the |
238 // target. | 237 // target. |
239 getTarget()->translate(); | 238 getTarget()->translate(); |
240 | 239 |
241 dump("Final output"); | 240 dump("Final output"); |
242 if (getFocusedTiming()) { | 241 if (getFocusedTiming()) { |
243 getContext()->mergeTimersFromTLS(); | 242 // Temporarily override the thread-local timer name to be the name of the |
244 getContext()->dumpTimers(); | 243 // function. Don't do it permanently because the final timer merge at the |
244 // end expects the thread-local timer names to be the same as the global | |
245 // timer name. | |
246 std::string OrigName = | |
John
2016/04/06 13:05:32
Auto, maybe?
Jim Stichnoth
2016/04/06 13:23:58
Done.
| |
247 getContext()->getTimerName(GlobalContext::TSK_Default); | |
248 getContext()->setTimerName(GlobalContext::TSK_Default, | |
249 getFunctionName().toString()); | |
250 getContext()->dumpLocalTimers(); | |
John
2016/04/06 13:05:32
Maybe have dumpLocalTimers do the renaming?
Jim Stichnoth
2016/04/06 13:23:58
Very nice! Done.
| |
251 getContext()->setTimerName(GlobalContext::TSK_Default, OrigName); | |
245 } | 252 } |
246 } | 253 } |
247 | 254 |
248 void Cfg::fixPhiNodes() { | 255 void Cfg::fixPhiNodes() { |
249 for (auto *Node : Nodes) { | 256 for (auto *Node : Nodes) { |
250 // Fix all the phi edges since WASM can't tell how to make them correctly at | 257 // Fix all the phi edges since WASM can't tell how to make them correctly at |
251 // the beginning. | 258 // the beginning. |
252 assert(Node); | 259 assert(Node); |
253 const auto &InEdges = Node->getInEdges(); | 260 const auto &InEdges = Node->getInEdges(); |
254 for (auto &Instr : Node->getPhis()) { | 261 for (auto &Instr : Node->getPhis()) { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1167 } | 1174 } |
1168 } | 1175 } |
1169 // Print each basic block | 1176 // Print each basic block |
1170 for (CfgNode *Node : Nodes) | 1177 for (CfgNode *Node : Nodes) |
1171 Node->dump(this); | 1178 Node->dump(this); |
1172 if (isVerbose(IceV_Instructions)) | 1179 if (isVerbose(IceV_Instructions)) |
1173 Str << "}\n"; | 1180 Str << "}\n"; |
1174 } | 1181 } |
1175 | 1182 |
1176 } // end of namespace Ice | 1183 } // end of namespace Ice |
OLD | NEW |