Chromium Code Reviews| Index: src/IceInstARM32.h |
| diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h |
| index c196d72cc3161232637dd3276b9944d4d1d1ba35..42bceee43108086c7568d90a777e1c990604d77b 100644 |
| --- a/src/IceInstARM32.h |
| +++ b/src/IceInstARM32.h |
| @@ -320,12 +320,11 @@ public: |
| Udiv, |
| Umull, |
| Uxt, |
| + Vabs, |
| Vadd, |
| Vcmp, |
| Vcvt, |
| Vdiv, |
| - Vldr, |
| - Vmov, |
| Vmrs, |
| Vmul, |
| Vsqrt, |
| @@ -783,10 +782,8 @@ using InstARM32Ldr = InstARM32Movlike<InstARM32::Ldr>; |
| /// Move instruction (variable <- flex). This is more of a pseudo-inst. If var |
| /// is a register, then we use "mov". If var is stack, then we use "str" to |
| /// store to the stack. |
| -using InstARM32Mov = InstARM32Movlike<InstARM32::Mov>; |
| -/// Represents various vector mov instruction forms (simple single source, |
| -/// single dest forms only, not the 2 GPR <-> 1 D reg forms, etc.). |
| -using InstARM32Vldr = InstARM32Movlike<InstARM32::Vldr>; |
| +//!!!!!!!!!!!!!!!!!!!!!!using InstARM32Mov = InstARM32Movlike<InstARM32::Mov>; |
|
Jim Stichnoth
2015/09/24 05:57:13
Explain this comment, or delete it?
John
2015/09/24 21:28:39
Done.
|
| + |
| /// MovT leaves the bottom bits alone so dest is also a source. This helps |
| /// indicate that a previous MovW setting dest is not dead code. |
| using InstARM32Movt = InstARM32TwoAddrGPR<InstARM32::Movt>; |
| @@ -1120,90 +1117,47 @@ private: |
| }; |
| /// Handles (some of) vmov's various formats. |
| -class InstARM32Vmov final : public InstARM32Pred { |
| - InstARM32Vmov() = delete; |
| - InstARM32Vmov(const InstARM32Vmov &) = delete; |
| - InstARM32Vmov &operator=(const InstARM32Vmov &) = delete; |
| +class InstARM32Mov final : public InstARM32Pred { |
| + InstARM32Mov() = delete; |
| + InstARM32Mov(const InstARM32Mov &) = delete; |
| + InstARM32Mov &operator=(const InstARM32Mov &) = delete; |
| public: |
| - /// RegisterPair is used to group registers in |
| - /// |
| - /// vmov D, (R, R) |
| - /// |
| - /// and |
| - /// |
| - /// vmov (R, R), D |
| - struct RegisterPair { |
| - explicit RegisterPair(Variable *V0, Variable *V1) : _0(V0), _1(V1) { |
| - assert(V0->getType() == IceType_i32); |
| - assert(V1->getType() == IceType_i32); |
| - } |
| - Variable *_0; |
| - Variable *_1; |
| - }; |
| - |
| - static InstARM32Vmov *create(Cfg *Func, Variable *Dest, Operand *Src, |
| - CondARM32::Cond Predicate) { |
| - return new (Func->allocate<InstARM32Vmov>()) |
| - InstARM32Vmov(Func, Dest, Src, Predicate); |
| - } |
| - static InstARM32Vmov *create(Cfg *Func, const RegisterPair &Dests, |
| - Variable *Src, CondARM32::Cond Predicate) { |
| - return new (Func->allocate<InstARM32Vmov>()) |
| - InstARM32Vmov(Func, Dests, Src, Predicate); |
| - } |
| - static InstARM32Vmov *create(Cfg *Func, Variable *Dest, |
| - const RegisterPair &Srcs, |
| - CondARM32::Cond Predicate) { |
| - return new (Func->allocate<InstARM32Vmov>()) |
| - InstARM32Vmov(Func, Dest, Srcs, Predicate); |
| + static InstARM32Mov *create(Cfg *Func, Variable *Dest, Operand *Src, |
| + CondARM32::Cond Predicate) { |
| + return new (Func->allocate<InstARM32Mov>()) |
| + InstARM32Mov(Func, Dest, Src, Predicate); |
| } |
| bool isRedundantAssign() const override { |
| - return Dest1 == nullptr && getSrcSize() == 1 && |
| + return !isMultiDest() && !isMultiSource() && |
| checkForRedundantAssign(getDest(), getSrc(0)); |
| } |
| bool isSimpleAssign() const override { return true; } |
| void emit(const Cfg *Func) const override; |
| void emitIAS(const Cfg *Func) const override; |
| void dump(const Cfg *Func) const override; |
| - static bool classof(const Inst *Inst) { return isClassof(Inst, Vmov); } |
| - |
| -private: |
| - InstARM32Vmov(Cfg *Func, Variable *Dest, Operand *Src, |
| - CondARM32::Cond Predicate) |
| - : InstARM32Pred(Func, InstARM32::Vmov, 1, Dest, Predicate) { |
| - addSource(Src); |
| - } |
| - |
| - InstARM32Vmov(Cfg *Func, const RegisterPair &Dests, Variable *Src, |
| - CondARM32::Cond Predicate) |
| - : InstARM32Pred(Func, InstARM32::Vmov, 1, Dests._0, Predicate), |
| - Dest1(Dests._1) { |
| - addSource(Src); |
| - } |
| - |
| - InstARM32Vmov(Cfg *Func, Variable *Dest, const RegisterPair &Srcs, |
| - CondARM32::Cond Predicate) |
| - : InstARM32Pred(Func, InstARM32::Vmov, 2, Dest, Predicate) { |
| - addSource(Srcs._0); |
| - addSource(Srcs._1); |
| - } |
| + static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); } |
| bool isMultiDest() const { |
| assert(getDest() != nullptr); |
| - return Dest1 != nullptr; |
| + return llvm::isa<Variable64On32>(getDest()); |
| } |
| bool isMultiSource() const { |
| - assert(getSrcSize() >= 1); |
| - return getSrcSize() > 1; |
| + assert(getSrcSize() == 1); |
| + return llvm::isa<Variable64On32>(getSrc(0)); |
| + } |
| + |
| +private: |
| + InstARM32Mov(Cfg *Func, Variable *Dest, Operand *Src, |
| + CondARM32::Cond Predicate) |
| + : InstARM32Pred(Func, InstARM32::Mov, 1, Dest, Predicate) { |
| + addSource(Src); |
| } |
| void emitMultiDestSingleSource(const Cfg *Func) const; |
| void emitSingleDestMultiSource(const Cfg *Func) const; |
| void emitSingleDestSingleSource(const Cfg *Func) const; |
| - |
| - Variable *Dest1 = nullptr; |
| }; |
| class InstARM32Vcmp final : public InstARM32Pred { |
| @@ -1246,15 +1200,33 @@ private: |
| InstARM32Vmrs(Cfg *Func, CondARM32::Cond Predicate); |
| }; |
| +class InstARM32Vabs final : public InstARM32Pred { |
| + InstARM32Vabs() = delete; |
| + InstARM32Vabs(const InstARM32Vabs &) = delete; |
| + InstARM32Vabs &operator=(const InstARM32Vabs &) = delete; |
| + |
| +public: |
| + static InstARM32Vabs *create(Cfg *Func, Variable *Dest, Variable *Src, |
| + CondARM32::Cond Predicate) { |
| + return new (Func->allocate<InstARM32Vabs>()) |
| + InstARM32Vabs(Func, Dest, Src, Predicate); |
| + } |
| + void emit(const Cfg *Func) const override; |
| + void emitIAS(const Cfg *Func) const override; |
| + void dump(const Cfg *Func) const override; |
| + static bool classof(const Inst *Inst) { return isClassof(Inst, Vabs); } |
| + |
| +private: |
| + InstARM32Vabs(Cfg *Func, Variable *Dest, Variable *Src, |
| + CondARM32::Cond Predicate); |
| +}; |
| // Declare partial template specializations of emit() methods that already have |
| // default implementations. Without this, there is the possibility of ODR |
| // violations and link errors. |
| template <> void InstARM32Ldr::emit(const Cfg *Func) const; |
| -template <> void InstARM32Mov::emit(const Cfg *Func) const; |
| template <> void InstARM32Movw::emit(const Cfg *Func) const; |
| template <> void InstARM32Movt::emit(const Cfg *Func) const; |
| -template <> void InstARM32Vldr::emit(const Cfg *Func) const; |
| } // end of namespace Ice |