OLD | NEW |
1 //===- subzero/src/IceInstX8632.h - x86-32 machine instructions -*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - x86-32 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 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
11 // their subclasses. This represents the machine instructions and | 11 // their subclasses. This represents the machine instructions and |
12 // operands used for x86-32 code selection. | 12 // operands used for x86-32 code selection. |
13 // | 13 // |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICEINSTX8632_H | 16 #ifndef SUBZERO_SRC_ICEINSTX8632_H |
17 #define SUBZERO_SRC_ICEINSTX8632_H | 17 #define SUBZERO_SRC_ICEINSTX8632_H |
18 | 18 |
19 #include "assembler_ia32.h" | 19 #include "assembler_ia32.h" |
| 20 #include "IceConditionCodesX8632.h" |
20 #include "IceDefs.h" | 21 #include "IceDefs.h" |
21 #include "IceInst.h" | 22 #include "IceInst.h" |
22 #include "IceConditionCodesX8632.h" | |
23 #include "IceInstX8632.def" | 23 #include "IceInstX8632.def" |
24 #include "IceOperand.h" | 24 #include "IceOperand.h" |
25 | 25 |
26 namespace Ice { | 26 namespace Ice { |
27 | 27 |
28 class TargetX8632; | 28 class TargetX8632; |
29 | 29 |
30 // OperandX8632 extends the Operand hierarchy. Its subclasses are | 30 // OperandX8632 extends the Operand hierarchy. Its subclasses are |
31 // OperandX8632Mem and VariableSplit. | 31 // OperandX8632Mem and VariableSplit. |
32 class OperandX8632 : public Operand { | 32 class OperandX8632 : public Operand { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 Xadd, | 261 Xadd, |
262 Xchg, | 262 Xchg, |
263 Xor | 263 Xor |
264 }; | 264 }; |
265 | 265 |
266 static const char *getWidthString(Type Ty); | 266 static const char *getWidthString(Type Ty); |
267 static const char *getFldString(Type Ty); | 267 static const char *getFldString(Type Ty); |
268 static CondX86::BrCond getOppositeCondition(CondX86::BrCond Cond); | 268 static CondX86::BrCond getOppositeCondition(CondX86::BrCond Cond); |
269 void dump(const Cfg *Func) const override; | 269 void dump(const Cfg *Func) const override; |
270 | 270 |
| 271 // Shared emit routines for common forms of instructions. |
| 272 // See the definition of emitTwoAddress() for a description of |
| 273 // ShiftHack. |
| 274 static void emitTwoAddress(const char *Opcode, const Inst *Inst, |
| 275 const Cfg *Func, bool ShiftHack = false); |
| 276 |
| 277 static void |
| 278 emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var, |
| 279 const Operand *Src, |
| 280 const X8632::AssemblerX8632::GPREmitterShiftOp &Emitter); |
| 281 |
271 protected: | 282 protected: |
272 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) | 283 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) |
273 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | 284 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
274 ~InstX8632() override {} | 285 ~InstX8632() override {} |
275 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { | 286 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { |
276 return Inst->getKind() == static_cast<InstKind>(MyKind); | 287 return Inst->getKind() == static_cast<InstKind>(MyKind); |
277 } | 288 } |
278 // Most instructions that operate on vector arguments require vector | 289 // Most instructions that operate on vector arguments require vector |
279 // memory operands to be fully aligned (16-byte alignment for PNaCl | 290 // memory operands to be fully aligned (16-byte alignment for PNaCl |
280 // vector types). The stack frame layout and call ABI ensure proper | 291 // vector types). The stack frame layout and call ABI ensure proper |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 private: | 669 private: |
659 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) | 670 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) |
660 : InstX8632(Func, K, 1, Dest) { | 671 : InstX8632(Func, K, 1, Dest) { |
661 addSource(Src); | 672 addSource(Src); |
662 } | 673 } |
663 ~InstX8632UnaryopXmm() override {} | 674 ~InstX8632UnaryopXmm() override {} |
664 static const char *Opcode; | 675 static const char *Opcode; |
665 static const X8632::AssemblerX8632::XmmEmitterRegOp Emitter; | 676 static const X8632::AssemblerX8632::XmmEmitterRegOp Emitter; |
666 }; | 677 }; |
667 | 678 |
668 // See the definition of emitTwoAddress() for a description of | |
669 // ShiftHack. | |
670 void emitTwoAddress(const char *Opcode, const Inst *Inst, const Cfg *Func, | |
671 bool ShiftHack = false); | |
672 | |
673 void emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var, | |
674 const Operand *Src, | |
675 const X8632::AssemblerX8632::GPREmitterShiftOp &Emitter); | |
676 | |
677 template <InstX8632::InstKindX8632 K> | 679 template <InstX8632::InstKindX8632 K> |
678 class InstX8632BinopGPRShift : public InstX8632 { | 680 class InstX8632BinopGPRShift : public InstX8632 { |
679 InstX8632BinopGPRShift() = delete; | 681 InstX8632BinopGPRShift() = delete; |
680 InstX8632BinopGPRShift(const InstX8632BinopGPRShift &) = delete; | 682 InstX8632BinopGPRShift(const InstX8632BinopGPRShift &) = delete; |
681 InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete; | 683 InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete; |
682 | 684 |
683 public: | 685 public: |
684 // Create a binary-op GPR shift instruction. | 686 // Create a binary-op GPR shift instruction. |
685 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, | 687 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, |
686 Operand *Source) { | 688 Operand *Source) { |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1705 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
1704 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1706 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
1705 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1707 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
1706 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1708 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
1707 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1709 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
1708 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1710 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
1709 | 1711 |
1710 } // end of namespace Ice | 1712 } // end of namespace Ice |
1711 | 1713 |
1712 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1714 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |