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

Side by Side Diff: src/IceCfg.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/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 // This file implements the Cfg class, including constant pool 10 // This file implements the Cfg class, including constant pool
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { 389 for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) {
390 auto NextNode = I; 390 auto NextNode = I;
391 ++NextNode; 391 ++NextNode;
392 (*I)->doBranchOpt(NextNode == E ? NULL : *NextNode); 392 (*I)->doBranchOpt(NextNode == E ? NULL : *NextNode);
393 } 393 }
394 } 394 }
395 395
396 // ======================== Dump routines ======================== // 396 // ======================== Dump routines ======================== //
397 397
398 void Cfg::emitTextHeader(const IceString &MangledName) { 398 void Cfg::emitTextHeader(const IceString &MangledName) {
399 // Note: Still used by emit IAS.
399 Ostream &Str = Ctx->getStrEmit(); 400 Ostream &Str = Ctx->getStrEmit();
400 Str << "\t.text\n"; 401 Str << "\t.text\n";
401 if (Ctx->getFlags().FunctionSections) 402 if (Ctx->getFlags().FunctionSections)
402 Str << "\t.section\t.text." << MangledName << ",\"ax\",@progbits\n"; 403 Str << "\t.section\t.text." << MangledName << ",\"ax\",@progbits\n";
403 if (!getInternal() || Ctx->getFlags().DisableInternal) { 404 if (!getInternal() || Ctx->getFlags().DisableInternal) {
404 Str << "\t.globl\t" << MangledName << "\n"; 405 Str << "\t.globl\t" << MangledName << "\n";
405 Str << "\t.type\t" << MangledName << ",@function\n"; 406 Str << "\t.type\t" << MangledName << ",@function\n";
406 } 407 }
407 Str << "\t.p2align " << getTarget()->getBundleAlignLog2Bytes() << ",0x"; 408 Str << "\t.p2align " << getTarget()->getBundleAlignLog2Bytes() << ",0x";
408 for (AsmCodeByte I : getTarget()->getNonExecBundlePadding()) 409 for (AsmCodeByte I : getTarget()->getNonExecBundlePadding())
409 Str.write_hex(I); 410 Str.write_hex(I);
410 Str << "\n"; 411 Str << "\n";
411 Str << MangledName << ":\n"; 412 Str << MangledName << ":\n";
412 } 413 }
413 414
414 void Cfg::emit() { 415 void Cfg::emit() {
416 if (!ALLOW_DUMP)
417 return;
415 TimerMarker T(TimerStack::TT_emit, this); 418 TimerMarker T(TimerStack::TT_emit, this);
416 if (Ctx->getFlags().DecorateAsm) { 419 if (Ctx->getFlags().DecorateAsm) {
417 renumberInstructions(); 420 renumberInstructions();
418 getVMetadata()->init(VMK_Uses); 421 getVMetadata()->init(VMK_Uses);
419 liveness(Liveness_Basic); 422 liveness(Liveness_Basic);
420 dump("After recomputing liveness for -decorate-asm"); 423 dump("After recomputing liveness for -decorate-asm");
421 } 424 }
422 Ostream &Str = Ctx->getStrEmit(); 425 Ostream &Str = Ctx->getStrEmit();
423 if (!Ctx->testAndSetHasEmittedFirstMethod()) { 426 if (!Ctx->testAndSetHasEmittedFirstMethod()) {
424 // Print a helpful command for assembling the output. 427 // Print a helpful command for assembling the output.
(...skipping 17 matching lines...) Expand all
442 assert(!Ctx->getFlags().DecorateAsm); 445 assert(!Ctx->getFlags().DecorateAsm);
443 IceString MangledName = getContext()->mangleName(getFunctionName()); 446 IceString MangledName = getContext()->mangleName(getFunctionName());
444 emitTextHeader(MangledName); 447 emitTextHeader(MangledName);
445 for (CfgNode *Node : Nodes) 448 for (CfgNode *Node : Nodes)
446 Node->emitIAS(this); 449 Node->emitIAS(this);
447 getAssembler<Assembler>()->emitIASBytes(Ctx); 450 getAssembler<Assembler>()->emitIASBytes(Ctx);
448 } 451 }
449 452
450 // Dumps the IR with an optional introductory message. 453 // Dumps the IR with an optional introductory message.
451 void Cfg::dump(const IceString &Message) { 454 void Cfg::dump(const IceString &Message) {
455 if (!ALLOW_DUMP)
456 return;
452 if (!Ctx->isVerbose()) 457 if (!Ctx->isVerbose())
453 return; 458 return;
454 Ostream &Str = Ctx->getStrDump(); 459 Ostream &Str = Ctx->getStrDump();
455 if (!Message.empty()) 460 if (!Message.empty())
456 Str << "================ " << Message << " ================\n"; 461 Str << "================ " << Message << " ================\n";
457 setCurrentNode(getEntryNode()); 462 setCurrentNode(getEntryNode());
458 // Print function name+args 463 // Print function name+args
459 if (getContext()->isVerbose(IceV_Instructions)) { 464 if (getContext()->isVerbose(IceV_Instructions)) {
460 Str << "define "; 465 Str << "define ";
461 if (getInternal() && !Ctx->getFlags().DisableInternal) 466 if (getInternal() && !Ctx->getFlags().DisableInternal)
(...skipping 22 matching lines...) Expand all
484 } 489 }
485 } 490 }
486 // Print each basic block 491 // Print each basic block
487 for (CfgNode *Node : Nodes) 492 for (CfgNode *Node : Nodes)
488 Node->dump(this); 493 Node->dump(this);
489 if (getContext()->isVerbose(IceV_Instructions)) 494 if (getContext()->isVerbose(IceV_Instructions))
490 Str << "}\n"; 495 Str << "}\n";
491 } 496 }
492 497
493 } // end of namespace Ice 498 } // end of namespace Ice
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | src/IceCfgNode.cpp » ('j') | tests_lit/reader_tests/alloca.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698