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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1433743002: Add POP instruction to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. 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
OLDNEW
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// 1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction 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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 continue; 1109 continue;
1110 startNextInst(Func); 1110 startNextInst(Func);
1111 Str << "\t" 1111 Str << "\t"
1112 << "vpop" 1112 << "vpop"
1113 << "\t{"; 1113 << "\t{";
1114 Op->emit(Func); 1114 Op->emit(Func);
1115 Str << "}\n"; 1115 Str << "}\n";
1116 } 1116 }
1117 } 1117 }
1118 1118
1119 void InstARM32Pop::emitIAS(const Cfg *Func) const {
1120 SizeT DestReg = 0;
1121 SizeT IntegerCount = 0;
1122 ARM32::IValueT GPRegisters = 0;
1123 for (SizeT i = 0; i < Dests.size(); ++i) {
Jim Stichnoth 2015/11/09 22:17:26 Consider using a range-based for loop: Variable
1124 Operand *Op = Dests[i];
1125 if (!isScalarIntegerType(Op->getType()))
1126 // TODO(kschimpf) Implement vpush.
1127 return emitUsingTextFixup(Func);
1128 auto *Var = llvm::dyn_cast<Variable>(Op);
1129 assert((Var && Var->hasReg()) && "pop only applies to registers");
1130 ARM32::IValueT Reg = Var->getRegNum();
Jim Stichnoth 2015/11/09 22:17:26 I think you're better off declaring this as int32_
Karl 2015/11/09 22:44:35 Forgot that Encoded_Not_GPR is negative. Changing.
1131 assert(Reg != static_cast<ARM32::IValueT>(RegARM32::Encoded_Not_GPR));
1132 DestReg = i;
1133 GPRegisters |= (1 << Reg);
1134 ++IntegerCount;
1135 }
1136 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1137 switch (IntegerCount) {
1138 case 0:
1139 return;
1140 case 1: {
1141 if (auto *Var = llvm::dyn_cast<Variable>(Dests[DestReg])) {
Jim Stichnoth 2015/11/09 22:17:26 Dests[] is a VarList, so the dyn_cast is unnecessa
Karl 2015/11/09 22:44:35 Done.
1142 // Note: Can only apply pop register if single register is not sp.
1143 assert((RegARM32::Encoded_Reg_sp != Var->getRegNum()) &&
1144 "Effects of pop register SP is undefined!");
1145 // TODO(kschimpf) ARM sandbox does not allow the single register form of
1146 // pop, and the popList form expects multiple registers. Convert this
1147 // assert to a conditional check once it has been shown that popList
1148 // works.
1149 assert(!Func->getContext()->getFlags().getUseSandboxing() &&
1150 "pop register not in ARM sandbox!");
1151 Asm->pop(Var, CondARM32::AL);
1152 break;
1153 }
1154 // Intentionally fall to next case.
1155 }
1156 default:
1157 Asm->popList(GPURegisters, CondARM32::AL);
Jim Stichnoth 2015/11/09 22:17:26 GPURegisters? Should this be GPRegisters?
1158 break;
1159 }
1160 if (Asm->needsTextFixup())
1161 emitUsingTextFixup(Func);
1162 }
1163
1119 void InstARM32Pop::dump(const Cfg *Func) const { 1164 void InstARM32Pop::dump(const Cfg *Func) const {
1120 if (!BuildDefs::dump()) 1165 if (!BuildDefs::dump())
1121 return; 1166 return;
1122 Ostream &Str = Func->getContext()->getStrDump(); 1167 Ostream &Str = Func->getContext()->getStrDump();
1123 Str << "pop" 1168 Str << "pop"
1124 << " "; 1169 << " ";
1125 for (SizeT I = 0; I < Dests.size(); ++I) { 1170 for (SizeT I = 0; I < Dests.size(); ++I) {
1126 if (I > 0) 1171 if (I > 0)
1127 Str << ", "; 1172 Str << ", ";
1128 Dests[I]->dump(Func); 1173 Dests[I]->dump(Func);
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; 1747 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>;
1703 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; 1748 template class InstARM32UnaryopFP<InstARM32::Vsqrt>;
1704 1749
1705 template class InstARM32FourAddrGPR<InstARM32::Mla>; 1750 template class InstARM32FourAddrGPR<InstARM32::Mla>;
1706 template class InstARM32FourAddrGPR<InstARM32::Mls>; 1751 template class InstARM32FourAddrGPR<InstARM32::Mls>;
1707 1752
1708 template class InstARM32CmpLike<InstARM32::Cmp>; 1753 template class InstARM32CmpLike<InstARM32::Cmp>;
1709 template class InstARM32CmpLike<InstARM32::Tst>; 1754 template class InstARM32CmpLike<InstARM32::Tst>;
1710 1755
1711 } // end of namespace Ice 1756 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698