OLD | NEW |
1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- 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 TargetLoweringARM32 class, which implements the | 11 /// \brief Declares the TargetLoweringARM32 class, which implements the |
12 /// TargetLowering interface for the ARM 32-bit architecture. | 12 /// TargetLowering interface for the ARM 32-bit architecture. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
17 #define SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 17 #define SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
18 | 18 |
19 #include "IceAssemblerARM32.h" | 19 #include "IceAssemblerARM32.h" |
20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
21 #include "IceInstARM32.h" | 21 #include "IceInstARM32.h" |
22 #include "IceRegistersARM32.h" | 22 #include "IceRegistersARM32.h" |
23 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
24 | 24 |
| 25 #include <utility> |
| 26 |
25 namespace Ice { | 27 namespace Ice { |
26 namespace ARM32 { | 28 namespace ARM32 { |
27 | 29 |
28 // Class encapsulating ARM cpu features / instruction set. | 30 // Class encapsulating ARM cpu features / instruction set. |
29 class TargetARM32Features { | 31 class TargetARM32Features { |
30 TargetARM32Features() = delete; | 32 TargetARM32Features() = delete; |
31 TargetARM32Features(const TargetARM32Features &) = delete; | 33 TargetARM32Features(const TargetARM32Features &) = delete; |
32 TargetARM32Features &operator=(const TargetARM32Features &) = delete; | 34 TargetARM32Features &operator=(const TargetARM32Features &) = delete; |
33 | 35 |
34 public: | 36 public: |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 CondARM32::Cond Pred = CondARM32::AL) { | 797 CondARM32::Cond Pred = CondARM32::AL) { |
796 Context.insert<InstARM32Tst>(Src0, Src1, Pred); | 798 Context.insert<InstARM32Tst>(Src0, Src1, Pred); |
797 } | 799 } |
798 void _trap() { Context.insert<InstARM32Trap>(); } | 800 void _trap() { Context.insert<InstARM32Trap>(); } |
799 void _udiv(Variable *Dest, Variable *Src0, Variable *Src1, | 801 void _udiv(Variable *Dest, Variable *Src0, Variable *Src1, |
800 CondARM32::Cond Pred = CondARM32::AL) { | 802 CondARM32::Cond Pred = CondARM32::AL) { |
801 Context.insert<InstARM32Udiv>(Dest, Src0, Src1, Pred); | 803 Context.insert<InstARM32Udiv>(Dest, Src0, Src1, Pred); |
802 } | 804 } |
803 void _umull(Variable *DestLo, Variable *DestHi, Variable *Src0, | 805 void _umull(Variable *DestLo, Variable *DestHi, Variable *Src0, |
804 Variable *Src1, CondARM32::Cond Pred = CondARM32::AL) { | 806 Variable *Src1, CondARM32::Cond Pred = CondARM32::AL) { |
| 807 // umull requires DestLo and DestHi to be assigned to different GPRs. The |
| 808 // following lines create overlapping liveness ranges for both variables. If |
| 809 // either one of them is live, then they are both going to be live, and thus |
| 810 // assigned to different registers; if they are both dead, then DCE will |
| 811 // kick in and delete the following three instructions. |
| 812 Context.insert<InstFakeDef>(DestHi); |
805 Context.insert<InstARM32Umull>(DestLo, DestHi, Src0, Src1, Pred); | 813 Context.insert<InstARM32Umull>(DestLo, DestHi, Src0, Src1, Pred); |
806 // Model the modification to the second dest as a fake def. Note that the | 814 Context.insert<InstFakeDef>(DestHi, DestLo)->setDestRedefined(); |
807 // def is not predicated. | |
808 Context.insert<InstFakeDef>(DestHi, DestLo); | |
809 Context.insert<InstFakeUse>(DestHi); | 815 Context.insert<InstFakeUse>(DestHi); |
810 } | 816 } |
811 void _uxt(Variable *Dest, Variable *Src0, | 817 void _uxt(Variable *Dest, Variable *Src0, |
812 CondARM32::Cond Pred = CondARM32::AL) { | 818 CondARM32::Cond Pred = CondARM32::AL) { |
813 Context.insert<InstARM32Uxt>(Dest, Src0, Pred); | 819 Context.insert<InstARM32Uxt>(Dest, Src0, Pred); |
814 } | 820 } |
815 void _vabs(Variable *Dest, Variable *Src, | 821 void _vabs(Variable *Dest, Variable *Src, |
816 CondARM32::Cond Pred = CondARM32::AL) { | 822 CondARM32::Cond Pred = CondARM32::AL) { |
817 Context.insert<InstARM32Vabs>(Dest, Src, Pred); | 823 Context.insert<InstARM32Vabs>(Dest, Src, Pred); |
818 } | 824 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 void strex(Variable *Dest, Variable *Src, OperandARM32Mem *Mem, | 1039 void strex(Variable *Dest, Variable *Src, OperandARM32Mem *Mem, |
1034 CondARM32::Cond Pred); | 1040 CondARM32::Cond Pred); |
1035 | 1041 |
1036 /// Decrements sp: | 1042 /// Decrements sp: |
1037 /// | 1043 /// |
1038 /// sub sp, sp, SubAmount | 1044 /// sub sp, sp, SubAmount |
1039 /// bic sp, sp, 0xc0000000 | 1045 /// bic sp, sp, 0xc0000000 |
1040 void sub_sp(Operand *SubAmount); | 1046 void sub_sp(Operand *SubAmount); |
1041 | 1047 |
1042 private: | 1048 private: |
1043 AutoBundle Bundler; | 1049 TargetARM32 *const Target; |
1044 TargetARM32 *Target; | 1050 const InstBundleLock::Option BundleOption; |
| 1051 std::unique_ptr<AutoBundle> Bundler; |
| 1052 |
| 1053 void createAutoBundle(); |
1045 }; | 1054 }; |
1046 | 1055 |
1047 class PostLoweringLegalizer { | 1056 class PostLoweringLegalizer { |
1048 PostLoweringLegalizer() = delete; | 1057 PostLoweringLegalizer() = delete; |
1049 PostLoweringLegalizer(const PostLoweringLegalizer &) = delete; | 1058 PostLoweringLegalizer(const PostLoweringLegalizer &) = delete; |
1050 PostLoweringLegalizer &operator=(const PostLoweringLegalizer &) = delete; | 1059 PostLoweringLegalizer &operator=(const PostLoweringLegalizer &) = delete; |
1051 | 1060 |
1052 public: | 1061 public: |
1053 explicit PostLoweringLegalizer(TargetARM32 *Target) | 1062 explicit PostLoweringLegalizer(TargetARM32 *Target) |
1054 : Target(Target), StackOrFrameReg(Target->getPhysicalRegister( | 1063 : Target(Target), StackOrFrameReg(Target->getPhysicalRegister( |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 private: | 1310 private: |
1302 ~TargetHeaderARM32() = default; | 1311 ~TargetHeaderARM32() = default; |
1303 | 1312 |
1304 TargetARM32Features CPUFeatures; | 1313 TargetARM32Features CPUFeatures; |
1305 }; | 1314 }; |
1306 | 1315 |
1307 } // end of namespace ARM32 | 1316 } // end of namespace ARM32 |
1308 } // end of namespace Ice | 1317 } // end of namespace Ice |
1309 | 1318 |
1310 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 1319 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
OLD | NEW |