OLD | NEW |
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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 if (PrintComma) | 1174 if (PrintComma) |
1175 Str << ", "; | 1175 Str << ", "; |
1176 Op->emit(Func); | 1176 Op->emit(Func); |
1177 PrintComma = true; | 1177 PrintComma = true; |
1178 } | 1178 } |
1179 } | 1179 } |
1180 Str << "}\n"; | 1180 Str << "}\n"; |
1181 } | 1181 } |
1182 } | 1182 } |
1183 | 1183 |
| 1184 void InstARM32Push::emitIAS(const Cfg *Func) const { |
| 1185 SizeT SrcReg = 0; |
| 1186 SizeT IntegerCount = 0; |
| 1187 ARM32::IValueT GPURegisters = 0; |
| 1188 for (SizeT i = 0; i < getSrcSize(); ++i) { |
| 1189 if (!isScalarIntegerType(getSrc(i)->getType())) |
| 1190 // TODO(kschimpf) Implement vpush. |
| 1191 return emitUsingTextFixup(Func); |
| 1192 auto *Var = llvm::dyn_cast<Variable>(getSrc(i)); |
| 1193 assert((Var && Var->hasReg()) && "push only applies to registers"); |
| 1194 ARM32::IValueT Reg = Var->getRegNum(); |
| 1195 assert(Reg != static_cast<ARM32::IValueT>(RegARM32::Encoded_Not_GPR)); |
| 1196 SrcReg = i; |
| 1197 GPURegisters |= (1 << Reg); |
| 1198 ++IntegerCount; |
| 1199 } |
| 1200 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 1201 switch (IntegerCount) { |
| 1202 case 0: |
| 1203 return; |
| 1204 case 1: { |
| 1205 if (auto *Var = llvm::dyn_cast<Variable>(getSrc(SrcReg))) { |
| 1206 // Note: Can only apply push register if single register is not sp. |
| 1207 assert((RegARM32::Encoded_Reg_sp != Var->getRegNum()) && |
| 1208 "Effects of push register SP is undefined!"); |
| 1209 // TODO(kschimpf) ARM sandbox does not allow the single register form of |
| 1210 // push, and the pushList form expects multiple registers. Convert this |
| 1211 // assert to a conditional check once it has been shown that pushList |
| 1212 // works. |
| 1213 assert(!Func->getContext()->getFlags().getUseSandboxing() && |
| 1214 "push register not in ARM sandbox!"); |
| 1215 Asm->push(Var, CondARM32::AL); |
| 1216 break; |
| 1217 } |
| 1218 // Intentionally fall to next case. |
| 1219 } |
| 1220 default: |
| 1221 // TODO(kschimpf) Implement pushList in assembler. |
| 1222 Asm->pushList(GPURegisters, CondARM32::AL); |
| 1223 break; |
| 1224 } |
| 1225 if (Asm->needsTextFixup()) |
| 1226 emitUsingTextFixup(Func); |
| 1227 } |
| 1228 |
1184 void InstARM32Push::dump(const Cfg *Func) const { | 1229 void InstARM32Push::dump(const Cfg *Func) const { |
1185 if (!BuildDefs::dump()) | 1230 if (!BuildDefs::dump()) |
1186 return; | 1231 return; |
1187 Ostream &Str = Func->getContext()->getStrDump(); | 1232 Ostream &Str = Func->getContext()->getStrDump(); |
1188 Str << "push" | 1233 Str << "push" |
1189 << " "; | 1234 << " "; |
1190 dumpSources(Func); | 1235 dumpSources(Func); |
1191 } | 1236 } |
1192 | 1237 |
1193 void InstARM32Ret::emit(const Cfg *Func) const { | 1238 void InstARM32Ret::emit(const Cfg *Func) const { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; | 1672 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; |
1628 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; | 1673 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; |
1629 | 1674 |
1630 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 1675 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
1631 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 1676 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
1632 | 1677 |
1633 template class InstARM32CmpLike<InstARM32::Cmp>; | 1678 template class InstARM32CmpLike<InstARM32::Cmp>; |
1634 template class InstARM32CmpLike<InstARM32::Tst>; | 1679 template class InstARM32CmpLike<InstARM32::Tst>; |
1635 | 1680 |
1636 } // end of namespace Ice | 1681 } // end of namespace Ice |
OLD | NEW |