Chromium Code Reviews| Index: src/IceInstARM32.h |
| diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h |
| index 85a9f881dc37d4fa6615ca8a4030c25bdbc0f1f9..bff76bda0cf74aa84b74076ba7addfc5c4a672c3 100644 |
| --- a/src/IceInstARM32.h |
| +++ b/src/IceInstARM32.h |
| @@ -40,6 +40,8 @@ public: |
| kMem, |
| kFlexStart, |
| kFlexImm = kFlexStart, |
| + kFlexFpImm, |
| + kFlexFpZero, |
| kFlexReg, |
| kFlexEnd = kFlexReg |
| }; |
| @@ -205,6 +207,59 @@ private: |
| uint32_t RotateAmt; |
| }; |
| +/// Modified Floating-point constant. |
| +class OperandARM32FlexFpImm : public OperandARM32Flex { |
| + OperandARM32FlexFpImm() = delete; |
| + OperandARM32FlexFpImm(const OperandARM32FlexFpImm &) = delete; |
| + OperandARM32FlexFpImm &operator=(const OperandARM32FlexFpImm &) = delete; |
| + |
| +public: |
| + static OperandARM32FlexFpImm *create(Cfg *Func, Type Ty, |
| + uint32_t ModifiedImm) { |
| + return new (Func->allocate<OperandARM32FlexFpImm>()) |
| + OperandARM32FlexFpImm(Func, Ty, ModifiedImm); |
| + } |
| + |
| + void emit(const Cfg *Func) const override; |
| + using OperandARM32::dump; |
|
sehr
2015/11/13 21:56:29
What does this using do?
John
2015/11/14 00:00:38
Operand::dump is overloaded. The
OperandARM32Fle
Jim Stichnoth
2015/11/16 23:06:26
Interesting. Maybe we (I) should later take a pas
|
| + void dump(const Cfg *Func, Ostream &Str) const override; |
| + |
| + static bool classof(const Operand *Operand) { |
| + return Operand->getKind() == static_cast<OperandKind>(kFlexFpImm); |
| + } |
| + |
| + static bool canHoldImm(Operand *C, uint32_t *ModifiedImm); |
| + |
| +private: |
| + OperandARM32FlexFpImm(Cfg *Func, Type Ty, uint32_t ModifiedImm); |
| + |
| + uint32_t ModifiedImm; |
| +}; |
| + |
| +/// An operand for representing the 0.0 immediate in vcmp. |
| +class OperandARM32FlexFpZero : public OperandARM32Flex { |
| + OperandARM32FlexFpZero() = delete; |
| + OperandARM32FlexFpZero(const OperandARM32FlexFpZero &) = delete; |
| + OperandARM32FlexFpZero &operator=(const OperandARM32FlexFpZero &) = delete; |
| + |
| +public: |
| + static OperandARM32FlexFpZero *create(Cfg *Func, Type Ty) { |
| + return new (Func->allocate<OperandARM32FlexFpZero>()) |
| + OperandARM32FlexFpZero(Func, Ty); |
| + } |
| + |
| + void emit(const Cfg *Func) const override; |
| + using OperandARM32::dump; |
| + void dump(const Cfg *Func, Ostream &Str) const override; |
| + |
| + static bool classof(const Operand *Operand) { |
| + return Operand->getKind() == static_cast<OperandKind>(kFlexFpZero); |
| + } |
| + |
| +private: |
| + OperandARM32FlexFpZero(Cfg *Func, Type Ty); |
| +}; |
| + |
| /// Shifted register variant. |
| class OperandARM32FlexReg : public OperandARM32Flex { |
| OperandARM32FlexReg() = delete; |
| @@ -312,6 +367,7 @@ public: |
| Ret, |
| Rev, |
| Rsb, |
| + Rsc, |
| Sbc, |
| Sdiv, |
| Str, |
| @@ -609,6 +665,7 @@ private: |
| InstARM32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0, |
| Operand *Src1, CondARM32::Cond Predicate, bool SetFlags) |
| : InstARM32Pred(Func, K, 2, Dest, Predicate), SetFlags(SetFlags) { |
| + HasSideEffects = SetFlags; |
| addSource(Src0); |
| addSource(Src1); |
| } |
| @@ -741,6 +798,7 @@ private: |
| InstARM32CmpLike(Cfg *Func, Variable *Src0, Operand *Src1, |
| CondARM32::Cond Predicate) |
| : InstARM32Pred(Func, K, 2, nullptr, Predicate) { |
| + HasSideEffects = true; |
| addSource(Src0); |
| addSource(Src1); |
| } |
| @@ -759,6 +817,7 @@ using InstARM32Lsr = InstARM32ThreeAddrGPR<InstARM32::Lsr>; |
| using InstARM32Mul = InstARM32ThreeAddrGPR<InstARM32::Mul>; |
| using InstARM32Orr = InstARM32ThreeAddrGPR<InstARM32::Orr>; |
| using InstARM32Rsb = InstARM32ThreeAddrGPR<InstARM32::Rsb>; |
| +using InstARM32Rsc = InstARM32ThreeAddrGPR<InstARM32::Rsc>; |
| using InstARM32Sbc = InstARM32ThreeAddrGPR<InstARM32::Sbc>; |
| using InstARM32Sdiv = InstARM32ThreeAddrGPR<InstARM32::Sdiv>; |
| using InstARM32Sub = InstARM32ThreeAddrGPR<InstARM32::Sub>; |
| @@ -1178,12 +1237,18 @@ public: |
| return new (Func->allocate<InstARM32Vcmp>()) |
| InstARM32Vcmp(Func, Src0, Src1, Predicate); |
| } |
| + static InstARM32Vcmp *create(Cfg *Func, Variable *Src0, |
| + OperandARM32FlexFpZero *Src1, |
| + CondARM32::Cond Predicate) { |
| + return new (Func->allocate<InstARM32Vcmp>()) |
| + InstARM32Vcmp(Func, Src0, Src1, Predicate); |
| + } |
| void emit(const Cfg *Func) const override; |
| void dump(const Cfg *Func) const override; |
| static bool classof(const Inst *Inst) { return isClassof(Inst, Vcmp); } |
| private: |
| - InstARM32Vcmp(Cfg *Func, Variable *Src0, Variable *Src1, |
| + InstARM32Vcmp(Cfg *Func, Variable *Src0, Operand *Src1, |
| CondARM32::Cond Predicate); |
| }; |