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

Side by Side Diff: src/IceOperand.cpp

Issue 686913005: Turn off dump/emit routines when building minimal subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 1 month 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
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 return NULL; // conservative answer 420 return NULL; // conservative answer
421 SizeT VarNum = Var->getIndex(); 421 SizeT VarNum = Var->getIndex();
422 return Metadata[VarNum].getNode(); 422 return Metadata[VarNum].getNode();
423 } 423 }
424 424
425 const InstDefList VariablesMetadata::NoDefinitions; 425 const InstDefList VariablesMetadata::NoDefinitions;
426 426
427 // ======================== dump routines ======================== // 427 // ======================== dump routines ======================== //
428 428
429 void Variable::emit(const Cfg *Func) const { 429 void Variable::emit(const Cfg *Func) const {
430 Func->getTarget()->emitVariable(this); 430 if (ALLOW_DUMP)
431 Func->getTarget()->emitVariable(this);
431 } 432 }
432 433
433 void Variable::dump(const Cfg *Func, Ostream &Str) const { 434 void Variable::dump(const Cfg *Func, Ostream &Str) const {
435 if (!ALLOW_DUMP)
436 return;
434 if (Func == NULL) { 437 if (Func == NULL) {
435 Str << "%" << getName(); 438 Str << "%" << getName();
436 return; 439 return;
437 } 440 }
438 if (Func->getContext()->isVerbose(IceV_RegOrigins) || 441 if (Func->getContext()->isVerbose(IceV_RegOrigins) ||
439 (!hasReg() && !Func->getTarget()->hasComputedFrame())) 442 (!hasReg() && !Func->getTarget()->hasComputedFrame()))
440 Str << "%" << getName(); 443 Str << "%" << getName();
441 if (hasReg()) { 444 if (hasReg()) {
442 if (Func->getContext()->isVerbose(IceV_RegOrigins)) 445 if (Func->getContext()->isVerbose(IceV_RegOrigins))
443 Str << ":"; 446 Str << ":";
444 Str << Func->getTarget()->getRegName(RegNum, getType()); 447 Str << Func->getTarget()->getRegName(RegNum, getType());
445 } else if (Func->getTarget()->hasComputedFrame()) { 448 } else if (Func->getTarget()->hasComputedFrame()) {
446 if (Func->getContext()->isVerbose(IceV_RegOrigins)) 449 if (Func->getContext()->isVerbose(IceV_RegOrigins))
447 Str << ":"; 450 Str << ":";
448 Str << "[" << Func->getTarget()->getRegName( 451 Str << "[" << Func->getTarget()->getRegName(
449 Func->getTarget()->getFrameOrStackReg(), IceType_i32); 452 Func->getTarget()->getFrameOrStackReg(), IceType_i32);
450 int32_t Offset = getStackOffset(); 453 int32_t Offset = getStackOffset();
451 if (Offset) { 454 if (Offset) {
452 if (Offset > 0) 455 if (Offset > 0)
453 Str << "+"; 456 Str << "+";
454 Str << Offset; 457 Str << Offset;
455 } 458 }
456 Str << "]"; 459 Str << "]";
457 } 460 }
458 } 461 }
459 462
460 void ConstantRelocatable::emitWithoutDollar(GlobalContext *Ctx) const { 463 void ConstantRelocatable::emitWithoutDollar(GlobalContext *Ctx) const {
464 if (!ALLOW_DUMP)
465 return;
461 Ostream &Str = Ctx->getStrEmit(); 466 Ostream &Str = Ctx->getStrEmit();
462 if (SuppressMangling) 467 if (SuppressMangling)
463 Str << Name; 468 Str << Name;
464 else 469 else
465 Str << Ctx->mangleName(Name); 470 Str << Ctx->mangleName(Name);
466 if (Offset) { 471 if (Offset) {
467 if (Offset > 0) 472 if (Offset > 0)
468 Str << "+"; 473 Str << "+";
469 Str << Offset; 474 Str << Offset;
470 } 475 }
471 } 476 }
472 477
473 void ConstantRelocatable::emit(GlobalContext *Ctx) const { 478 void ConstantRelocatable::emit(GlobalContext *Ctx) const {
479 if (!ALLOW_DUMP)
480 return;
474 Ostream &Str = Ctx->getStrEmit(); 481 Ostream &Str = Ctx->getStrEmit();
475 Str << "$"; 482 Str << "$";
476 emitWithoutDollar(Ctx); 483 emitWithoutDollar(Ctx);
477 } 484 }
478 485
479 void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const { 486 void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const {
487 if (!ALLOW_DUMP)
488 return;
480 Str << "@"; 489 Str << "@";
481 if (Func && !SuppressMangling) { 490 if (Func && !SuppressMangling) {
482 Str << Func->getContext()->mangleName(Name); 491 Str << Func->getContext()->mangleName(Name);
483 } else { 492 } else {
484 Str << Name; 493 Str << Name;
485 } 494 }
486 if (Offset) 495 if (Offset)
487 Str << "+" << Offset; 496 Str << "+" << Offset;
488 } 497 }
489 498
490 void LiveRange::dump(Ostream &Str) const { 499 void LiveRange::dump(Ostream &Str) const {
500 if (!ALLOW_DUMP)
501 return;
491 Str << "(weight=" << Weight << ") "; 502 Str << "(weight=" << Weight << ") ";
492 bool First = true; 503 bool First = true;
493 for (const RangeElementType &I : Range) { 504 for (const RangeElementType &I : Range) {
494 if (!First) 505 if (!First)
495 Str << ", "; 506 Str << ", ";
496 First = false; 507 First = false;
497 Str << "[" << I.first << ":" << I.second << ")"; 508 Str << "[" << I.first << ":" << I.second << ")";
498 } 509 }
499 } 510 }
500 511
501 Ostream &operator<<(Ostream &Str, const LiveRange &L) { 512 Ostream &operator<<(Ostream &Str, const LiveRange &L) {
513 if (!ALLOW_DUMP)
514 return Str;
502 L.dump(Str); 515 L.dump(Str);
503 return Str; 516 return Str;
504 } 517 }
505 518
506 Ostream &operator<<(Ostream &Str, const RegWeight &W) { 519 Ostream &operator<<(Ostream &Str, const RegWeight &W) {
520 if (!ALLOW_DUMP)
521 return Str;
507 if (W.getWeight() == RegWeight::Inf) 522 if (W.getWeight() == RegWeight::Inf)
508 Str << "Inf"; 523 Str << "Inf";
509 else 524 else
510 Str << W.getWeight(); 525 Str << W.getWeight();
511 return Str; 526 return Str;
512 } 527 }
513 528
514 } // end of namespace Ice 529 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.cpp » ('j') | tests_lit/reader_tests/alloca.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698