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 // Cache the possibly-overridden optimization level once translation begins. |
| 201 // It would be nicer to do this in the constructor, but we need to wait until |
| 202 // after setFunctionName() has a chance to be called. |
| 203 OptimizationLevel = |
| 204 getFlags().matchForceO2(getFunctionName(), getSequenceNumber()) |
| 205 ? Opt_2 |
| 206 : getFlags().getOptLevel(); |
200 if (BuildDefs::timers()) { | 207 if (BuildDefs::timers()) { |
201 const std::string TimingFocusOn = getFlags().getTimingFocusOn(); | 208 if (getFlags().matchTimingFocus(getFunctionName(), getSequenceNumber())) { |
202 if (!TimingFocusOn.empty()) { | 209 setFocusedTiming(); |
203 const std::string Name = getFunctionName().toString(); | 210 getContext()->resetTimer(GlobalContext::TSK_Default); |
204 if (TimingFocusOn == "*" || TimingFocusOn == Name) { | |
205 setFocusedTiming(); | |
206 getContext()->resetTimer(GlobalContext::TSK_Default); | |
207 } | |
208 } | 211 } |
209 } | 212 } |
210 if (BuildDefs::dump()) { | 213 if (BuildDefs::dump()) { |
211 if (isVerbose(IceV_Status)) { | 214 if (isVerbose(IceV_Status) && |
| 215 getFlags().matchTestStatus(getFunctionName(), getSequenceNumber())) { |
212 getContext()->getStrDump() << ">>>Translating " | 216 getContext()->getStrDump() << ">>>Translating " |
213 << getFunctionNameAndSize() << "\n"; | 217 << getFunctionNameAndSize() |
| 218 << " seq=" << getSequenceNumber() << "\n"; |
214 } | 219 } |
215 } | 220 } |
216 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); | 221 TimerMarker T_func(getContext(), getFunctionName().toStringOrEmpty()); |
217 TimerMarker T(TimerStack::TT_translate, this); | 222 TimerMarker T(TimerStack::TT_translate, this); |
218 | 223 |
219 dump("Initial CFG"); | 224 dump("Initial CFG"); |
220 | 225 |
221 if (getFlags().getEnableBlockProfile()) { | 226 if (getFlags().getEnableBlockProfile()) { |
222 profileBlocks(); | 227 profileBlocks(); |
223 // TODO(jpp): this is fragile, at best. Figure out a better way of | 228 // TODO(jpp): this is fragile, at best. Figure out a better way of |
224 // detecting exit functions. | 229 // detecting exit functions. |
225 if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { | 230 if (getFunctionName().toStringOrEmpty() == "exit") { |
226 addCallToProfileSummary(); | 231 addCallToProfileSummary(); |
227 } | 232 } |
228 dump("Profiled CFG"); | 233 dump("Profiled CFG"); |
229 } | 234 } |
230 | 235 |
231 // Create the Hi and Lo variables where a split was needed | 236 // Create the Hi and Lo variables where a split was needed |
232 for (Variable *Var : Variables) | 237 for (Variable *Var : Variables) |
233 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 238 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) |
234 Var64On32->initHiLo(this); | 239 Var64On32->initHiLo(this); |
235 | 240 |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1171 } |
1167 } | 1172 } |
1168 // Print each basic block | 1173 // Print each basic block |
1169 for (CfgNode *Node : Nodes) | 1174 for (CfgNode *Node : Nodes) |
1170 Node->dump(this); | 1175 Node->dump(this); |
1171 if (isVerbose(IceV_Instructions)) | 1176 if (isVerbose(IceV_Instructions)) |
1172 Str << "}\n"; | 1177 Str << "}\n"; |
1173 } | 1178 } |
1174 | 1179 |
1175 } // end of namespace Ice | 1180 } // end of namespace Ice |
OLD | NEW |