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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 int32_t Offset = getStackOffset(); | 415 int32_t Offset = getStackOffset(); |
416 if (Offset) { | 416 if (Offset) { |
417 if (Offset > 0) | 417 if (Offset > 0) |
418 Str << "+"; | 418 Str << "+"; |
419 Str << Offset; | 419 Str << Offset; |
420 } | 420 } |
421 Str << "]"; | 421 Str << "]"; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 void ConstantRelocatable::emitWithoutDollar(GlobalContext *Ctx) const { | 425 template <> void ConstantInteger32::emit(TargetLowering *Target) const { |
426 if (!ALLOW_DUMP) | 426 Target->emit(this); |
427 return; | |
428 Ostream &Str = Ctx->getStrEmit(); | |
429 if (SuppressMangling) | |
430 Str << Name; | |
431 else | |
432 Str << Ctx->mangleName(Name); | |
433 if (Offset) { | |
434 if (Offset > 0) | |
435 Str << "+"; | |
436 Str << Offset; | |
437 } | |
438 } | 427 } |
439 | 428 |
440 void ConstantRelocatable::emit(GlobalContext *Ctx) const { | 429 template <> void ConstantInteger64::emit(TargetLowering *Target) const { |
441 if (!ALLOW_DUMP) | 430 Target->emit(this); |
442 return; | 431 } |
443 Ostream &Str = Ctx->getStrEmit(); | 432 |
444 Str << "$"; | 433 template <> void ConstantFloat::emit(TargetLowering *Target) const { |
445 emitWithoutDollar(Ctx); | 434 Target->emit(this); |
| 435 } |
| 436 |
| 437 template <> void ConstantDouble::emit(TargetLowering *Target) const { |
| 438 Target->emit(this); |
| 439 } |
| 440 |
| 441 void ConstantRelocatable::emit(TargetLowering *Target) const { |
| 442 Target->emit(this); |
| 443 } |
| 444 |
| 445 void ConstantRelocatable::emitWithoutPrefix(TargetLowering *Target) const { |
| 446 Target->emitWithoutPrefix(this); |
446 } | 447 } |
447 | 448 |
448 void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const { | 449 void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const { |
449 if (!ALLOW_DUMP) | 450 if (!ALLOW_DUMP) |
450 return; | 451 return; |
451 Str << "@"; | 452 Str << "@"; |
452 if (Func && !SuppressMangling) { | 453 if (Func && !SuppressMangling) { |
453 Str << Func->getContext()->mangleName(Name); | 454 Str << Func->getContext()->mangleName(Name); |
454 } else { | 455 } else { |
455 Str << Name; | 456 Str << Name; |
456 } | 457 } |
457 if (Offset) | 458 if (Offset) |
458 Str << "+" << Offset; | 459 Str << "+" << Offset; |
459 } | 460 } |
460 | 461 |
| 462 void ConstantUndef::emit(TargetLowering *Target) const { Target->emit(this); } |
| 463 |
461 void LiveRange::dump(Ostream &Str) const { | 464 void LiveRange::dump(Ostream &Str) const { |
462 if (!ALLOW_DUMP) | 465 if (!ALLOW_DUMP) |
463 return; | 466 return; |
464 Str << "(weight=" << Weight << ") "; | 467 Str << "(weight=" << Weight << ") "; |
465 bool First = true; | 468 bool First = true; |
466 for (const RangeElementType &I : Range) { | 469 for (const RangeElementType &I : Range) { |
467 if (!First) | 470 if (!First) |
468 Str << ", "; | 471 Str << ", "; |
469 First = false; | 472 First = false; |
470 Str << "[" << I.first << ":" << I.second << ")"; | 473 Str << "[" << I.first << ":" << I.second << ")"; |
(...skipping 11 matching lines...) Expand all Loading... |
482 if (!ALLOW_DUMP) | 485 if (!ALLOW_DUMP) |
483 return Str; | 486 return Str; |
484 if (W.getWeight() == RegWeight::Inf) | 487 if (W.getWeight() == RegWeight::Inf) |
485 Str << "Inf"; | 488 Str << "Inf"; |
486 else | 489 else |
487 Str << W.getWeight(); | 490 Str << W.getWeight(); |
488 return Str; | 491 return Str; |
489 } | 492 } |
490 | 493 |
491 } // end of namespace Ice | 494 } // end of namespace Ice |
OLD | NEW |