Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1231)

Side by Side Diff: src/IceOperand.cpp

Issue 1129263005: Convert Constant->emit() definitions to allow multiple targets to define them. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: report fatal Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698