OLD | NEW |
---|---|
1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// |
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 |
11 /// \brief Declares the InstARM32 and OperandARM32 classes and their subclasses. | 11 /// \brief Declares the InstARM32 and OperandARM32 classes and their subclasses. |
12 /// | 12 /// |
13 /// This represents the machine instructions and operands used for ARM32 code | 13 /// This represents the machine instructions and operands used for ARM32 code |
14 /// selection. | 14 /// selection. |
15 /// | 15 /// |
16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
17 | 17 |
18 #ifndef SUBZERO_SRC_ICEINSTARM32_H | 18 #ifndef SUBZERO_SRC_ICEINSTARM32_H |
19 #define SUBZERO_SRC_ICEINSTARM32_H | 19 #define SUBZERO_SRC_ICEINSTARM32_H |
20 | 20 |
21 #include "IceConditionCodesARM32.h" | 21 #include "IceConditionCodesARM32.h" |
22 #include "IceDefs.h" | 22 #include "IceDefs.h" |
23 #include "IceInst.h" | 23 #include "IceInst.h" |
24 #include "IceInstARM32.def" | 24 #include "IceInstARM32.def" |
25 #include "IceOperand.h" | 25 #include "IceOperand.h" |
26 #include "IceRegistersARM32.h" | |
26 | 27 |
27 namespace Ice { | 28 namespace Ice { |
28 namespace ARM32 { | 29 namespace ARM32 { |
29 | 30 |
30 /// Encoding of an ARM 32-bit instruction. | 31 /// Encoding of an ARM 32-bit instruction. |
31 using IValueT = uint32_t; | 32 using IValueT = uint32_t; |
32 | 33 |
33 /// An Offset value (+/-) used in an ARM 32-bit instruction. | 34 /// An Offset value (+/-) used in an ARM 32-bit instruction. |
34 using IOffsetT = int32_t; | 35 using IOffsetT = int32_t; |
35 | 36 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 And, | 383 And, |
383 Asr, | 384 Asr, |
384 Bic, | 385 Bic, |
385 Br, | 386 Br, |
386 Call, | 387 Call, |
387 Clz, | 388 Clz, |
388 Cmn, | 389 Cmn, |
389 Cmp, | 390 Cmp, |
390 Dmb, | 391 Dmb, |
391 Eor, | 392 Eor, |
393 Extract, | |
394 Insert, | |
392 Label, | 395 Label, |
393 Ldr, | 396 Ldr, |
394 Ldrex, | 397 Ldrex, |
395 Lsl, | 398 Lsl, |
396 Lsr, | 399 Lsr, |
397 Mla, | 400 Mla, |
398 Mls, | 401 Mls, |
399 Mov, | 402 Mov, |
400 Movt, | 403 Movt, |
401 Movw, | 404 Movw, |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1346 void emitSingleDestMultiSource(const Cfg *Func) const; | 1349 void emitSingleDestMultiSource(const Cfg *Func) const; |
1347 void emitSingleDestSingleSource(const Cfg *Func) const; | 1350 void emitSingleDestSingleSource(const Cfg *Func) const; |
1348 | 1351 |
1349 void emitIASSingleDestSingleSource(const Cfg *Func) const; | 1352 void emitIASSingleDestSingleSource(const Cfg *Func) const; |
1350 void emitIASScalarVFPMove(const Cfg *Func) const; | 1353 void emitIASScalarVFPMove(const Cfg *Func) const; |
1351 void emitIASCoreVFPMove(const Cfg *Func) const; | 1354 void emitIASCoreVFPMove(const Cfg *Func) const; |
1352 | 1355 |
1353 Variable *DestHi = nullptr; | 1356 Variable *DestHi = nullptr; |
1354 }; | 1357 }; |
1355 | 1358 |
1359 /// Common methods between InstARM32Extract and InstARM32Insert. | |
1360 class InstARM32ExtractInsert : public InstARM32Pred { | |
1361 InstARM32ExtractInsert() = delete; | |
1362 InstARM32ExtractInsert(const InstARM32ExtractInsert &) = delete; | |
1363 InstARM32ExtractInsert &operator=(const InstARM32ExtractInsert &) = delete; | |
1364 | |
1365 protected: | |
1366 InstARM32ExtractInsert(Cfg *Func, Variable *Dest, Variable *Src0, | |
1367 uint32_t Index, CondARM32::Cond Predicate) | |
1368 : InstARM32Pred(Func, InstARM32::Extract, 1, Dest, Predicate), | |
1369 Index(Index) { | |
1370 addSource(Src0); | |
1371 } | |
1372 | |
1373 const uint32_t Index; | |
1374 | |
1375 // These next two functions find the D register that maps to the half of the Q | |
1376 // register that this instruction is accessing. | |
1377 RegARM32::AllRegisters getDRegister(const Variable *Src) const; | |
1378 uint32_t getDIndex(uint32_t NumElements) const; | |
1379 | |
1380 // For floating point values, we can read directly from an S register. This | |
John
2016/02/04 15:23:57
read/write ... from/to?
| |
1381 // function finds the right one. | |
1382 RegARM32::AllRegisters getSRegister(const Variable *Src) const; | |
1383 | |
1384 static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); } | |
1385 }; | |
1386 | |
1387 /// Generates vmov Rd, Dn[x] instructions, and their related floating point | |
1388 /// versions. | |
1389 class InstARM32Extract final : public InstARM32ExtractInsert { | |
1390 InstARM32Extract() = delete; | |
1391 InstARM32Extract(const InstARM32Extract &) = delete; | |
1392 InstARM32Extract &operator=(const InstARM32Extract &) = delete; | |
1393 | |
1394 public: | |
1395 static InstARM32Extract *create(Cfg *Func, Variable *Dest, Variable *Src0, | |
1396 uint32_t Index, CondARM32::Cond Predicate) { | |
1397 return new (Func->allocate<InstARM32Extract>()) | |
1398 InstARM32Extract(Func, Dest, Src0, Index, Predicate); | |
1399 } | |
1400 void emit(const Cfg *Func) const override; | |
1401 static bool classof(const Inst *Inst) { return isClassof(Inst, Extract); } | |
1402 | |
1403 private: | |
1404 InstARM32Extract(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index, | |
1405 CondARM32::Cond Predicate) | |
1406 : InstARM32ExtractInsert(Func, Dest, Src0, Index, Predicate) {} | |
1407 }; | |
1408 | |
1409 /// Generates vmov Dn[x], Rd instructions, and their related floating point | |
1410 /// versions. | |
1411 class InstARM32Insert final : public InstARM32ExtractInsert { | |
1412 InstARM32Insert() = delete; | |
1413 InstARM32Insert(const InstARM32Insert &) = delete; | |
1414 InstARM32Insert &operator=(const InstARM32Insert &) = delete; | |
1415 | |
1416 public: | |
1417 static InstARM32Insert *create(Cfg *Func, Variable *Dest, Variable *Src0, | |
1418 uint32_t Index, CondARM32::Cond Predicate) { | |
1419 return new (Func->allocate<InstARM32Insert>()) | |
1420 InstARM32Insert(Func, Dest, Src0, Index, Predicate); | |
1421 } | |
1422 void emit(const Cfg *Func) const override; | |
1423 static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); } | |
1424 | |
1425 private: | |
1426 InstARM32Insert(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index, | |
1427 CondARM32::Cond Predicate) | |
1428 : InstARM32ExtractInsert(Func, Dest, Src0, Index, Predicate) {} | |
1429 }; | |
1430 | |
1356 class InstARM32Vcmp final : public InstARM32Pred { | 1431 class InstARM32Vcmp final : public InstARM32Pred { |
1357 InstARM32Vcmp() = delete; | 1432 InstARM32Vcmp() = delete; |
1358 InstARM32Vcmp(const InstARM32Vcmp &) = delete; | 1433 InstARM32Vcmp(const InstARM32Vcmp &) = delete; |
1359 InstARM32Vcmp &operator=(const InstARM32Vcmp &) = delete; | 1434 InstARM32Vcmp &operator=(const InstARM32Vcmp &) = delete; |
1360 | 1435 |
1361 public: | 1436 public: |
1362 static InstARM32Vcmp *create(Cfg *Func, Variable *Src0, Variable *Src1, | 1437 static InstARM32Vcmp *create(Cfg *Func, Variable *Src0, Variable *Src1, |
1363 CondARM32::Cond Predicate) { | 1438 CondARM32::Cond Predicate) { |
1364 return new (Func->allocate<InstARM32Vcmp>()) | 1439 return new (Func->allocate<InstARM32Vcmp>()) |
1365 InstARM32Vcmp(Func, Src0, Src1, Predicate); | 1440 InstARM32Vcmp(Func, Src0, Src1, Predicate); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1442 // violations and link errors. | 1517 // violations and link errors. |
1443 | 1518 |
1444 template <> void InstARM32Ldr::emit(const Cfg *Func) const; | 1519 template <> void InstARM32Ldr::emit(const Cfg *Func) const; |
1445 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 1520 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
1446 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 1521 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
1447 | 1522 |
1448 } // end of namespace ARM32 | 1523 } // end of namespace ARM32 |
1449 } // end of namespace Ice | 1524 } // end of namespace Ice |
1450 | 1525 |
1451 #endif // SUBZERO_SRC_ICEINSTARM32_H | 1526 #endif // SUBZERO_SRC_ICEINSTARM32_H |
OLD | NEW |