OLD | NEW |
1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// | 1 //===- subzero/src/IceOperand.cpp - High-level operand 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 Operand class and its target-independent | 10 // This file implements the Operand class and its target-independent |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 V.StackOffset = StackOffset; | 194 V.StackOffset = StackOffset; |
195 return V; | 195 return V; |
196 } | 196 } |
197 | 197 |
198 // ======================== dump routines ======================== // | 198 // ======================== dump routines ======================== // |
199 | 199 |
200 void Variable::emit(const Cfg *Func) const { | 200 void Variable::emit(const Cfg *Func) const { |
201 Func->getTarget()->emitVariable(this, Func); | 201 Func->getTarget()->emitVariable(this, Func); |
202 } | 202 } |
203 | 203 |
204 void Variable::dump(const Cfg *Func) const { | 204 void Variable::dump(const Cfg *Func, Ostream &Str) const { |
205 Ostream &Str = Func->getContext()->getStrDump(); | 205 if (Func == NULL) { |
| 206 Str << "%" << getName(); |
| 207 return; |
| 208 } |
206 const CfgNode *CurrentNode = Func->getCurrentNode(); | 209 const CfgNode *CurrentNode = Func->getCurrentNode(); |
207 (void)CurrentNode; // used only in assert() | 210 (void)CurrentNode; // used only in assert() |
208 assert(CurrentNode == NULL || DefNode == NULL || DefNode == CurrentNode); | 211 assert(CurrentNode == NULL || DefNode == NULL || DefNode == CurrentNode); |
209 if (Func->getContext()->isVerbose(IceV_RegOrigins) || | 212 if (Func->getContext()->isVerbose(IceV_RegOrigins) || |
210 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 213 (!hasReg() && !Func->getTarget()->hasComputedFrame())) |
211 Str << "%" << getName(); | 214 Str << "%" << getName(); |
212 if (hasReg()) { | 215 if (hasReg()) { |
213 if (Func->getContext()->isVerbose(IceV_RegOrigins)) | 216 if (Func->getContext()->isVerbose(IceV_RegOrigins)) |
214 Str << ":"; | 217 Str << ":"; |
215 Str << Func->getTarget()->getRegName(RegNum, getType()); | 218 Str << Func->getTarget()->getRegName(RegNum, getType()); |
(...skipping 18 matching lines...) Expand all Loading... |
234 Str << Name; | 237 Str << Name; |
235 else | 238 else |
236 Str << Ctx->mangleName(Name); | 239 Str << Ctx->mangleName(Name); |
237 if (Offset) { | 240 if (Offset) { |
238 if (Offset > 0) | 241 if (Offset > 0) |
239 Str << "+"; | 242 Str << "+"; |
240 Str << Offset; | 243 Str << Offset; |
241 } | 244 } |
242 } | 245 } |
243 | 246 |
244 void ConstantRelocatable::dump(GlobalContext *Ctx) const { | 247 void ConstantRelocatable::dump(const Cfg *, Ostream &Str) const { |
245 Ostream &Str = Ctx->getStrDump(); | |
246 Str << "@" << Name; | 248 Str << "@" << Name; |
247 if (Offset) | 249 if (Offset) |
248 Str << "+" << Offset; | 250 Str << "+" << Offset; |
249 } | 251 } |
250 | 252 |
251 void LiveRange::dump(Ostream &Str) const { | 253 void LiveRange::dump(Ostream &Str) const { |
252 Str << "(weight=" << Weight << ") "; | 254 Str << "(weight=" << Weight << ") "; |
253 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E; | 255 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E; |
254 ++I) { | 256 ++I) { |
255 if (I != Range.begin()) | 257 if (I != Range.begin()) |
256 Str << ", "; | 258 Str << ", "; |
257 Str << "[" << (*I).first << ":" << (*I).second << ")"; | 259 Str << "[" << (*I).first << ":" << (*I).second << ")"; |
258 } | 260 } |
259 } | 261 } |
260 | 262 |
261 Ostream &operator<<(Ostream &Str, const LiveRange &L) { | 263 Ostream &operator<<(Ostream &Str, const LiveRange &L) { |
262 L.dump(Str); | 264 L.dump(Str); |
263 return Str; | 265 return Str; |
264 } | 266 } |
265 | 267 |
266 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 268 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
267 if (W.getWeight() == RegWeight::Inf) | 269 if (W.getWeight() == RegWeight::Inf) |
268 Str << "Inf"; | 270 Str << "Inf"; |
269 else | 271 else |
270 Str << W.getWeight(); | 272 Str << W.getWeight(); |
271 return Str; | 273 return Str; |
272 } | 274 } |
273 | 275 |
274 } // end of namespace Ice | 276 } // end of namespace Ice |
OLD | NEW |