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

Side by Side Diff: src/IceCfgNode.cpp

Issue 1431353003: Subzero: For filetype=asm, don't print a blank line for pseudo instrs. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | src/IceInst.cpp » ('j') | 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 /// \file 10 /// \file
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 for (Variable *Var : LiveRegs) { 947 for (Variable *Var : LiveRegs) {
948 if (!First) 948 if (!First)
949 Str << ","; 949 Str << ",";
950 First = false; 950 First = false;
951 Var->emit(Func); 951 Var->emit(Func);
952 } 952 }
953 } 953 }
954 Str << "\n"; 954 Str << "\n";
955 } 955 }
956 956
957 void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr, 957 /// Returns true if some text was emitted - in which case the caller definitely
958 /// needs to emit a newline character.
959 bool emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
958 CfgVector<SizeT> &LiveRegCount) { 960 CfgVector<SizeT> &LiveRegCount) {
961 bool Printed = false;
959 if (!BuildDefs::dump()) 962 if (!BuildDefs::dump())
960 return; 963 return Printed;
961 bool First = true;
962 Variable *Dest = Instr->getDest(); 964 Variable *Dest = Instr->getDest();
963 // Normally we increment the live count for the dest register. But we 965 // Normally we increment the live count for the dest register. But we
964 // shouldn't if the instruction's IsDestRedefined flag is set, because this 966 // shouldn't if the instruction's IsDestRedefined flag is set, because this
965 // means that the target lowering created this instruction as a non-SSA 967 // means that the target lowering created this instruction as a non-SSA
966 // assignment; i.e., a different, previous instruction started the dest 968 // assignment; i.e., a different, previous instruction started the dest
967 // variable's live range. 969 // variable's live range.
968 if (!Instr->isDestRedefined() && Dest && Dest->hasReg()) 970 if (!Instr->isDestRedefined() && Dest && Dest->hasReg())
969 ++LiveRegCount[Dest->getRegNum()]; 971 ++LiveRegCount[Dest->getRegNum()];
970 FOREACH_VAR_IN_INST(Var, *Instr) { 972 FOREACH_VAR_IN_INST(Var, *Instr) {
971 bool ShouldReport = Instr->isLastUse(Var); 973 bool ShouldReport = Instr->isLastUse(Var);
972 if (ShouldReport && Var->hasReg()) { 974 if (ShouldReport && Var->hasReg()) {
973 // Don't report end of live range until the live count reaches 0. 975 // Don't report end of live range until the live count reaches 0.
974 SizeT NewCount = --LiveRegCount[Var->getRegNum()]; 976 SizeT NewCount = --LiveRegCount[Var->getRegNum()];
975 if (NewCount) 977 if (NewCount)
976 ShouldReport = false; 978 ShouldReport = false;
977 } 979 }
978 if (ShouldReport) { 980 if (ShouldReport) {
979 if (First) 981 if (Printed)
982 Str << ",";
983 else
980 Str << " \t# END="; 984 Str << " \t# END=";
981 else
982 Str << ",";
983 Var->emit(Func); 985 Var->emit(Func);
984 First = false; 986 Printed = true;
985 } 987 }
986 } 988 }
989 return Printed;
987 } 990 }
988 991
989 void updateStats(Cfg *Func, const Inst *I) { 992 void updateStats(Cfg *Func, const Inst *I) {
990 if (!BuildDefs::dump()) 993 if (!BuildDefs::dump())
991 return; 994 return;
992 // Update emitted instruction count, plus fill/spill count for Variable 995 // Update emitted instruction count, plus fill/spill count for Variable
993 // operands without a physical register. 996 // operands without a physical register.
994 if (uint32_t Count = I->getEmitInstCount()) { 997 if (uint32_t Count = I->getEmitInstCount()) {
995 Func->getContext()->statsUpdateEmitted(Count); 998 Func->getContext()->statsUpdateEmitted(Count);
996 if (Variable *Dest = I->getDest()) { 999 if (Variable *Dest = I->getDest()) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 // but that isn't called for redundant assignments. 1064 // but that isn't called for redundant assignments.
1062 Variable *Dest = I.getDest(); 1065 Variable *Dest = I.getDest();
1063 if (DecorateAsm && Dest->hasReg()) { 1066 if (DecorateAsm && Dest->hasReg()) {
1064 ++LiveRegCount[Dest->getRegNum()]; 1067 ++LiveRegCount[Dest->getRegNum()];
1065 if (I.isLastUse(I.getSrc(0))) 1068 if (I.isLastUse(I.getSrc(0)))
1066 --LiveRegCount[llvm::cast<Variable>(I.getSrc(0))->getRegNum()]; 1069 --LiveRegCount[llvm::cast<Variable>(I.getSrc(0))->getRegNum()];
1067 } 1070 }
1068 continue; 1071 continue;
1069 } 1072 }
1070 I.emit(Func); 1073 I.emit(Func);
1074 bool Printed = false;
1071 if (DecorateAsm) 1075 if (DecorateAsm)
1072 emitLiveRangesEnded(Str, Func, &I, LiveRegCount); 1076 Printed = emitLiveRangesEnded(Str, Func, &I, LiveRegCount);
1073 Str << "\n"; 1077 if (Printed || llvm::isa<InstTarget>(&I))
1078 Str << "\n";
1074 updateStats(Func, &I); 1079 updateStats(Func, &I);
1075 } 1080 }
1076 if (DecorateAsm) { 1081 if (DecorateAsm) {
1077 constexpr bool IsLiveIn = false; 1082 constexpr bool IsLiveIn = false;
1078 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount); 1083 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
1079 } 1084 }
1080 } 1085 }
1081 1086
1082 // Helper class for emitIAS(). 1087 // Helper class for emitIAS().
1083 namespace { 1088 namespace {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1411 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1407 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1412 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1408 Inst->addArg(AtomicRMWOp); 1413 Inst->addArg(AtomicRMWOp);
1409 Inst->addArg(Counter); 1414 Inst->addArg(Counter);
1410 Inst->addArg(One); 1415 Inst->addArg(One);
1411 Inst->addArg(OrderAcquireRelease); 1416 Inst->addArg(OrderAcquireRelease);
1412 Insts.push_front(Inst); 1417 Insts.push_front(Inst);
1413 } 1418 }
1414 1419
1415 } // end of namespace Ice 1420 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698