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