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

Side by Side Diff: src/IceCfgNode.cpp

Issue 1113133002: Subzero: Also dump live-end info for stack vars under -asm-verbose. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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 | « no previous file | no next file » | 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/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) 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 CfgNode class, including the complexities 10 // This file implements the CfgNode class, including the complexities
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 return; 817 return;
818 bool First = true; 818 bool First = true;
819 Variable *Dest = Instr->getDest(); 819 Variable *Dest = Instr->getDest();
820 if (Dest && Dest->hasReg()) 820 if (Dest && Dest->hasReg())
821 ++LiveRegCount[Dest->getRegNum()]; 821 ++LiveRegCount[Dest->getRegNum()];
822 for (SizeT I = 0; I < Instr->getSrcSize(); ++I) { 822 for (SizeT I = 0; I < Instr->getSrcSize(); ++I) {
823 Operand *Src = Instr->getSrc(I); 823 Operand *Src = Instr->getSrc(I);
824 SizeT NumVars = Src->getNumVars(); 824 SizeT NumVars = Src->getNumVars();
825 for (SizeT J = 0; J < NumVars; ++J) { 825 for (SizeT J = 0; J < NumVars; ++J) {
826 const Variable *Var = Src->getVar(J); 826 const Variable *Var = Src->getVar(J);
827 if (Var->hasReg()) { 827 if (Instr->isLastUse(Var) &&
828 if (Instr->isLastUse(Var) && --LiveRegCount[Var->getRegNum()] == 0) { 828 (!Var->hasReg() || --LiveRegCount[Var->getRegNum()] == 0)) {
829 if (First) 829 if (First)
830 Str << " \t# END="; 830 Str << " \t# END=";
831 else 831 else
832 Str << ","; 832 Str << ",";
833 Var->emit(Func); 833 Var->emit(Func);
834 First = false; 834 First = false;
835 }
836 } 835 }
837 } 836 }
838 } 837 }
839 } 838 }
840 839
841 void updateStats(Cfg *Func, const Inst *I) { 840 void updateStats(Cfg *Func, const Inst *I) {
842 if (!ALLOW_DUMP) 841 if (!ALLOW_DUMP)
843 return; 842 return;
844 // Update emitted instruction count, plus fill/spill count for 843 // Update emitted instruction count, plus fill/spill count for
845 // Variable operands without a physical register. 844 // Variable operands without a physical register.
(...skipping 17 matching lines...) Expand all
863 void CfgNode::emit(Cfg *Func) const { 862 void CfgNode::emit(Cfg *Func) const {
864 if (!ALLOW_DUMP) 863 if (!ALLOW_DUMP)
865 return; 864 return;
866 Func->setCurrentNode(this); 865 Func->setCurrentNode(this);
867 Ostream &Str = Func->getContext()->getStrEmit(); 866 Ostream &Str = Func->getContext()->getStrEmit();
868 Liveness *Liveness = Func->getLiveness(); 867 Liveness *Liveness = Func->getLiveness();
869 bool DecorateAsm = 868 bool DecorateAsm =
870 Liveness && Func->getContext()->getFlags().getDecorateAsm(); 869 Liveness && Func->getContext()->getFlags().getDecorateAsm();
871 Str << getAsmName() << ":\n"; 870 Str << getAsmName() << ":\n";
872 std::vector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters()); 871 std::vector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters());
873 if (DecorateAsm) 872 if (DecorateAsm) {
874 emitRegisterUsage(Str, Func, this, true, LiveRegCount); 873 const bool IsLiveIn = true;
874 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
875 }
875 876
876 for (const Inst &I : Phis) { 877 for (const Inst &I : Phis) {
877 if (I.isDeleted()) 878 if (I.isDeleted())
878 continue; 879 continue;
879 // Emitting a Phi instruction should cause an error. 880 // Emitting a Phi instruction should cause an error.
880 I.emit(Func); 881 I.emit(Func);
881 } 882 }
882 for (const Inst &I : Insts) { 883 for (const Inst &I : Insts) {
883 if (I.isDeleted()) 884 if (I.isDeleted())
884 continue; 885 continue;
885 if (I.isRedundantAssign()) { 886 if (I.isRedundantAssign()) {
886 Variable *Dest = I.getDest(); 887 Variable *Dest = I.getDest();
887 if (DecorateAsm && Dest->hasReg() && !I.isLastUse(I.getSrc(0))) 888 if (DecorateAsm && Dest->hasReg() && !I.isLastUse(I.getSrc(0)))
888 ++LiveRegCount[Dest->getRegNum()]; 889 ++LiveRegCount[Dest->getRegNum()];
889 continue; 890 continue;
890 } 891 }
891 I.emit(Func); 892 I.emit(Func);
892 if (DecorateAsm) 893 if (DecorateAsm)
893 emitLiveRangesEnded(Str, Func, &I, LiveRegCount); 894 emitLiveRangesEnded(Str, Func, &I, LiveRegCount);
894 Str << "\n"; 895 Str << "\n";
895 updateStats(Func, &I); 896 updateStats(Func, &I);
896 } 897 }
897 if (DecorateAsm) 898 if (DecorateAsm) {
898 emitRegisterUsage(Str, Func, this, false, LiveRegCount); 899 const bool IsLiveIn = false;
900 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
901 }
899 } 902 }
900 903
901 // Helper class for emitIAS(). 904 // Helper class for emitIAS().
902 namespace { 905 namespace {
903 class BundleEmitHelper { 906 class BundleEmitHelper {
904 BundleEmitHelper() = delete; 907 BundleEmitHelper() = delete;
905 BundleEmitHelper(const BundleEmitHelper &) = delete; 908 BundleEmitHelper(const BundleEmitHelper &) = delete;
906 BundleEmitHelper &operator=(const BundleEmitHelper &) = delete; 909 BundleEmitHelper &operator=(const BundleEmitHelper &) = delete;
907 910
908 public: 911 public:
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 if (!First) 1202 if (!First)
1200 Str << ", "; 1203 Str << ", ";
1201 First = false; 1204 First = false;
1202 Str << "%" << I->getName(); 1205 Str << "%" << I->getName();
1203 } 1206 }
1204 Str << "\n"; 1207 Str << "\n";
1205 } 1208 }
1206 } 1209 }
1207 1210
1208 } // end of namespace Ice 1211 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698