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

Side by Side Diff: src/IceCfgNode.cpp

Issue 1158113002: Subzero: More asm-verbose fixes. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 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/IceCfg.cpp ('k') | 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 void CfgNode::emit(Cfg *Func) const { 879 void CfgNode::emit(Cfg *Func) const {
880 if (!ALLOW_DUMP) 880 if (!ALLOW_DUMP)
881 return; 881 return;
882 Func->setCurrentNode(this); 882 Func->setCurrentNode(this);
883 Ostream &Str = Func->getContext()->getStrEmit(); 883 Ostream &Str = Func->getContext()->getStrEmit();
884 Liveness *Liveness = Func->getLiveness(); 884 Liveness *Liveness = Func->getLiveness();
885 bool DecorateAsm = 885 bool DecorateAsm =
886 Liveness && Func->getContext()->getFlags().getDecorateAsm(); 886 Liveness && Func->getContext()->getFlags().getDecorateAsm();
887 Str << getAsmName() << ":\n"; 887 Str << getAsmName() << ":\n";
888 // LiveRegCount keeps track of the number of currently live
889 // variables that each register is assigned to. Normally that would
890 // be only 0 or 1, but the register allocator's AllowOverlap
891 // inference allows it to be greater than 1 for short periods.
888 std::vector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters()); 892 std::vector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters());
889 if (DecorateAsm) { 893 if (DecorateAsm) {
890 const bool IsLiveIn = true; 894 const bool IsLiveIn = true;
891 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount); 895 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
892 } 896 }
893 897
894 for (const Inst &I : Phis) { 898 for (const Inst &I : Phis) {
895 if (I.isDeleted()) 899 if (I.isDeleted())
896 continue; 900 continue;
897 // Emitting a Phi instruction should cause an error. 901 // Emitting a Phi instruction should cause an error.
898 I.emit(Func); 902 I.emit(Func);
899 } 903 }
900 for (const Inst &I : Insts) { 904 for (const Inst &I : Insts) {
901 if (I.isDeleted()) 905 if (I.isDeleted())
902 continue; 906 continue;
903 if (I.isRedundantAssign()) 907 if (I.isRedundantAssign()) {
908 // Usually, redundant assignments end the live range of the src
909 // variable and begin the live range of the dest variable, with
910 // no net effect on the liveness of their register. However, if
911 // the register allocator infers the AllowOverlap condition,
912 // then this may be a redundant assignment that does not end the
913 // src variable's live range, in which case the active variable
914 // count for that register needs to be bumped. That normally
915 // would have happened as part of emitLiveRangesEnded(), but
916 // that isn't called for redundant assignments.
917 Variable *Dest = I.getDest();
918 if (DecorateAsm && Dest->hasReg() && !I.isLastUse(I.getSrc(0)))
jvoung (off chromium) 2015/05/27 15:58:56 Just checking -- this checks !I.isLastUse(I.getSrc
Jim Stichnoth 2015/05/27 16:08:55 Sorry - I discovered that problem yesterday and up
919 ++LiveRegCount[Dest->getRegNum()];
904 continue; 920 continue;
921 }
905 I.emit(Func); 922 I.emit(Func);
906 if (DecorateAsm) 923 if (DecorateAsm)
907 emitLiveRangesEnded(Str, Func, &I, LiveRegCount); 924 emitLiveRangesEnded(Str, Func, &I, LiveRegCount);
908 Str << "\n"; 925 Str << "\n";
909 updateStats(Func, &I); 926 updateStats(Func, &I);
910 } 927 }
911 if (DecorateAsm) { 928 if (DecorateAsm) {
912 const bool IsLiveIn = false; 929 const bool IsLiveIn = false;
913 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount); 930 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
914 } 931 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 if (!First) 1232 if (!First)
1216 Str << ", "; 1233 Str << ", ";
1217 First = false; 1234 First = false;
1218 Str << "%" << I->getName(); 1235 Str << "%" << I->getName();
1219 } 1236 }
1220 Str << "\n"; 1237 Str << "\n";
1221 } 1238 }
1222 } 1239 }
1223 1240
1224 } // end of namespace Ice 1241 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698