Index: src/IceInstARM32.h |
diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h |
index 21505a185045fd2267d2d80ddf293bb971cbf65a..b40973a07b59a7d50b69d39513174e9b3e48eec7 100644 |
--- a/src/IceInstARM32.h |
+++ b/src/IceInstARM32.h |
@@ -23,6 +23,7 @@ |
#include "IceInst.h" |
#include "IceInstARM32.def" |
#include "IceOperand.h" |
+#include "IceRegistersARM32.h" |
namespace Ice { |
namespace ARM32 { |
@@ -389,6 +390,8 @@ public: |
Cmp, |
Dmb, |
Eor, |
+ Extract, |
+ Insert, |
Label, |
Ldr, |
Ldrex, |
@@ -1353,6 +1356,78 @@ private: |
Variable *DestHi = nullptr; |
}; |
+/// Common methods between InstARM32Extract and InstARM32Insert. |
+class InstARM32ExtractInsert : public InstARM32Pred { |
+ InstARM32ExtractInsert() = delete; |
+ InstARM32ExtractInsert(const InstARM32ExtractInsert &) = delete; |
+ InstARM32ExtractInsert &operator=(const InstARM32ExtractInsert &) = delete; |
+ |
+protected: |
+ InstARM32ExtractInsert(Cfg *Func, Variable *Dest, Variable *Src0, |
+ uint32_t Index, CondARM32::Cond Predicate) |
+ : InstARM32Pred(Func, InstARM32::Extract, 1, Dest, Predicate), |
+ Index(Index) { |
+ addSource(Src0); |
+ } |
+ |
+ const uint32_t Index; |
+ |
+ // These next two functions find the D register that maps to the half of the Q |
+ // register that this instruction is accessing. |
+ RegARM32::AllRegisters getDRegister(const Variable *Src) const; |
+ uint32_t getDIndex(uint32_t NumElements) const; |
+ |
+ // For floating point values, we can read directly from an S register. This |
John
2016/02/04 15:23:57
read/write ... from/to?
|
+ // function finds the right one. |
+ RegARM32::AllRegisters getSRegister(const Variable *Src) const; |
+ |
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); } |
+}; |
+ |
+/// Generates vmov Rd, Dn[x] instructions, and their related floating point |
+/// versions. |
+class InstARM32Extract final : public InstARM32ExtractInsert { |
+ InstARM32Extract() = delete; |
+ InstARM32Extract(const InstARM32Extract &) = delete; |
+ InstARM32Extract &operator=(const InstARM32Extract &) = delete; |
+ |
+public: |
+ static InstARM32Extract *create(Cfg *Func, Variable *Dest, Variable *Src0, |
+ uint32_t Index, CondARM32::Cond Predicate) { |
+ return new (Func->allocate<InstARM32Extract>()) |
+ InstARM32Extract(Func, Dest, Src0, Index, Predicate); |
+ } |
+ void emit(const Cfg *Func) const override; |
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Extract); } |
+ |
+private: |
+ InstARM32Extract(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index, |
+ CondARM32::Cond Predicate) |
+ : InstARM32ExtractInsert(Func, Dest, Src0, Index, Predicate) {} |
+}; |
+ |
+/// Generates vmov Dn[x], Rd instructions, and their related floating point |
+/// versions. |
+class InstARM32Insert final : public InstARM32ExtractInsert { |
+ InstARM32Insert() = delete; |
+ InstARM32Insert(const InstARM32Insert &) = delete; |
+ InstARM32Insert &operator=(const InstARM32Insert &) = delete; |
+ |
+public: |
+ static InstARM32Insert *create(Cfg *Func, Variable *Dest, Variable *Src0, |
+ uint32_t Index, CondARM32::Cond Predicate) { |
+ return new (Func->allocate<InstARM32Insert>()) |
+ InstARM32Insert(Func, Dest, Src0, Index, Predicate); |
+ } |
+ void emit(const Cfg *Func) const override; |
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); } |
+ |
+private: |
+ InstARM32Insert(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index, |
+ CondARM32::Cond Predicate) |
+ : InstARM32ExtractInsert(Func, Dest, Src0, Index, Predicate) {} |
+}; |
+ |
class InstARM32Vcmp final : public InstARM32Pred { |
InstARM32Vcmp() = delete; |
InstARM32Vcmp(const InstARM32Vcmp &) = delete; |