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

Side by Side Diff: src/IceCfg.cpp

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 5 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
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 /// \file 10 /// \file
(...skipping 16 matching lines...) Expand all
27 #include "IceTargetLowering.h" 27 #include "IceTargetLowering.h"
28 28
29 namespace Ice { 29 namespace Ice {
30 30
31 ICE_TLS_DEFINE_FIELD(const Cfg *, Cfg, CurrentCfg); 31 ICE_TLS_DEFINE_FIELD(const Cfg *, Cfg, CurrentCfg);
32 32
33 ArenaAllocator<> *getCurrentCfgAllocator() { 33 ArenaAllocator<> *getCurrentCfgAllocator() {
34 return Cfg::getCurrentCfgAllocator(); 34 return Cfg::getCurrentCfgAllocator();
35 } 35 }
36 36
37 Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber) 37 Cfg::Cfg(GlobalContext *MyCtx, uint32_t MySequenceNumber)
38 : Ctx(Ctx), SequenceNumber(SequenceNumber), 38 : Ctx(MyCtx), SequenceNumber(MySequenceNumber),
39 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial), 39 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial),
40 Allocator(new ArenaAllocator<>()), Live(nullptr), 40 Allocator(new ArenaAllocator<>()), Live(nullptr),
41 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(), 41 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(),
42 this)), 42 this)),
43 VMetadata(new VariablesMetadata(this)), 43 VMetadata(new VariablesMetadata(this)),
44 TargetAssembler(TargetLowering::createAssembler( 44 TargetAssembler(TargetLowering::createAssembler(
45 Ctx->getFlags().getTargetArch(), this)) { 45 Ctx->getFlags().getTargetArch(), this)) {
46 assert(!Ctx->isIRGenerationDisabled() && 46 assert(!Ctx->isIRGenerationDisabled() &&
47 "Attempt to build cfg when IR generation disabled"); 47 "Attempt to build cfg when IR generation disabled");
48 } 48 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 renumberInstructions(); 560 renumberInstructions();
561 getVMetadata()->init(VMK_Uses); 561 getVMetadata()->init(VMK_Uses);
562 liveness(Liveness_Basic); 562 liveness(Liveness_Basic);
563 dump("After recomputing liveness for -decorate-asm"); 563 dump("After recomputing liveness for -decorate-asm");
564 } 564 }
565 OstreamLocker L(Ctx); 565 OstreamLocker L(Ctx);
566 Ostream &Str = Ctx->getStrEmit(); 566 Ostream &Str = Ctx->getStrEmit();
567 IceString MangledName = getContext()->mangleName(getFunctionName()); 567 IceString MangledName = getContext()->mangleName(getFunctionName());
568 emitTextHeader(MangledName, Ctx, getAssembler<>()); 568 emitTextHeader(MangledName, Ctx, getAssembler<>());
569 for (CfgNode *Node : Nodes) 569 for (CfgNode *Node : Nodes)
570 Node->emit(this); 570 Node->emit();
571 Str << "\n"; 571 Str << "\n";
572 } 572 }
573 573
574 void Cfg::emitIAS() { 574 void Cfg::emitIAS() {
575 TimerMarker T(TimerStack::TT_emit, this); 575 TimerMarker T(TimerStack::TT_emit, this);
576 // The emitIAS() routines emit into the internal assembler buffer, 576 // The emitIAS() routines emit into the internal assembler buffer,
577 // so there's no need to lock the streams. 577 // so there's no need to lock the streams.
578 for (CfgNode *Node : Nodes) 578 for (CfgNode *Node : Nodes)
579 Node->emitIAS(this); 579 Node->emitIAS();
580 } 580 }
581 581
582 // Dumps the IR with an optional introductory message. 582 // Dumps the IR with an optional introductory message.
583 void Cfg::dump(const IceString &Message) { 583 void Cfg::dump(const IceString &Message) {
584 if (!BuildDefs::dump()) 584 if (!BuildDefs::dump())
585 return; 585 return;
586 if (!isVerbose()) 586 if (!isVerbose())
587 return; 587 return;
588 OstreamLocker L(Ctx); 588 OstreamLocker L(Ctx);
589 Ostream &Str = Ctx->getStrDump(); 589 Ostream &Str = Ctx->getStrDump();
(...skipping 23 matching lines...) Expand all
613 Str << getVMetadata()->isMultiBlock(Var); 613 Str << getVMetadata()->isMultiBlock(Var);
614 else 614 else
615 Str << "?"; 615 Str << "?";
616 Str << " weight=" << Var->getWeight() << " "; 616 Str << " weight=" << Var->getWeight() << " ";
617 Var->dump(this); 617 Var->dump(this);
618 Str << " LIVE=" << Var->getLiveRange() << "\n"; 618 Str << " LIVE=" << Var->getLiveRange() << "\n";
619 } 619 }
620 } 620 }
621 // Print each basic block 621 // Print each basic block
622 for (CfgNode *Node : Nodes) 622 for (CfgNode *Node : Nodes)
623 Node->dump(this); 623 Node->dump();
624 if (isVerbose(IceV_Instructions)) 624 if (isVerbose(IceV_Instructions))
625 Str << "}\n"; 625 Str << "}\n";
626 } 626 }
627 627
628 } // end of namespace Ice 628 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssembler.h ('k') | src/IceCfgNode.h » ('j') | src/IceConverter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698