OLD | NEW |
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 OperandX8632 &operator=(const OperandX8632 &) = delete; | 51 OperandX8632 &operator=(const OperandX8632 &) = delete; |
52 }; | 52 }; |
53 | 53 |
54 // OperandX8632Mem represents the m32 addressing mode, with optional | 54 // OperandX8632Mem represents the m32 addressing mode, with optional |
55 // base and index registers, a constant offset, and a fixed shift | 55 // base and index registers, a constant offset, and a fixed shift |
56 // value for the index register. | 56 // value for the index register. |
57 class OperandX8632Mem : public OperandX8632 { | 57 class OperandX8632Mem : public OperandX8632 { |
58 public: | 58 public: |
59 enum SegmentRegisters { | 59 enum SegmentRegisters { |
60 DefaultSegment = -1, | 60 DefaultSegment = -1, |
61 #define X(val, name) val, | 61 #define X(val, name, prefix) val, |
62 SEG_REGX8632_TABLE | 62 SEG_REGX8632_TABLE |
63 #undef X | 63 #undef X |
64 SegReg_NUM | 64 SegReg_NUM |
65 }; | 65 }; |
66 static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base, | 66 static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base, |
67 Constant *Offset, Variable *Index = NULL, | 67 Constant *Offset, Variable *Index = NULL, |
68 uint16_t Shift = 0, | 68 uint16_t Shift = 0, |
69 SegmentRegisters SegmentReg = DefaultSegment) { | 69 SegmentRegisters SegmentReg = DefaultSegment) { |
70 return new (Func->allocate<OperandX8632Mem>()) | 70 return new (Func->allocate<OperandX8632Mem>()) |
71 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg); | 71 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg); |
72 } | 72 } |
73 Variable *getBase() const { return Base; } | 73 Variable *getBase() const { return Base; } |
74 Constant *getOffset() const { return Offset; } | 74 Constant *getOffset() const { return Offset; } |
75 Variable *getIndex() const { return Index; } | 75 Variable *getIndex() const { return Index; } |
76 uint16_t getShift() const { return Shift; } | 76 uint16_t getShift() const { return Shift; } |
77 SegmentRegisters getSegmentRegister() const { return SegmentReg; } | 77 SegmentRegisters getSegmentRegister() const { return SegmentReg; } |
| 78 void emitSegmentOverride(x86::AssemblerX86 *Asm) const; |
78 x86::Address toAsmAddress(Assembler *Asm) const; | 79 x86::Address toAsmAddress(Assembler *Asm) const; |
79 void emit(const Cfg *Func) const override; | 80 void emit(const Cfg *Func) const override; |
80 using OperandX8632::dump; | 81 using OperandX8632::dump; |
81 void dump(const Cfg *Func, Ostream &Str) const override; | 82 void dump(const Cfg *Func, Ostream &Str) const override; |
82 | 83 |
83 static bool classof(const Operand *Operand) { | 84 static bool classof(const Operand *Operand) { |
84 return Operand->getKind() == static_cast<OperandKind>(kMem); | 85 return Operand->getKind() == static_cast<OperandKind>(kMem); |
85 } | 86 } |
86 | 87 |
87 private: | 88 private: |
(...skipping 17 matching lines...) Expand all Loading... |
105 // accesses through the VariableSplit. | 106 // accesses through the VariableSplit. |
106 class VariableSplit : public OperandX8632 { | 107 class VariableSplit : public OperandX8632 { |
107 public: | 108 public: |
108 enum Portion { | 109 enum Portion { |
109 Low, | 110 Low, |
110 High | 111 High |
111 }; | 112 }; |
112 static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) { | 113 static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) { |
113 return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, Part); | 114 return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, Part); |
114 } | 115 } |
| 116 x86::Address toAsmAddress(const Cfg *Func) const; |
| 117 |
115 void emit(const Cfg *Func) const override; | 118 void emit(const Cfg *Func) const override; |
116 using OperandX8632::dump; | 119 using OperandX8632::dump; |
117 void dump(const Cfg *Func, Ostream &Str) const override; | 120 void dump(const Cfg *Func, Ostream &Str) const override; |
118 | 121 |
119 static bool classof(const Operand *Operand) { | 122 static bool classof(const Operand *Operand) { |
120 return Operand->getKind() == static_cast<OperandKind>(kSplit); | 123 return Operand->getKind() == static_cast<OperandKind>(kSplit); |
121 } | 124 } |
122 | 125 |
123 private: | 126 private: |
124 VariableSplit(Cfg *Func, Variable *Var, Portion Part) | 127 VariableSplit(Cfg *Func, Variable *Var, Portion Part) |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 public: | 831 public: |
829 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) { | 832 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) { |
830 return new (Func->allocate<InstX8632Movlike>()) | 833 return new (Func->allocate<InstX8632Movlike>()) |
831 InstX8632Movlike(Func, Dest, Source); | 834 InstX8632Movlike(Func, Dest, Source); |
832 } | 835 } |
833 bool isRedundantAssign() const override { | 836 bool isRedundantAssign() const override { |
834 return checkForRedundantAssign(getDest(), getSrc(0)); | 837 return checkForRedundantAssign(getDest(), getSrc(0)); |
835 } | 838 } |
836 bool isSimpleAssign() const override { return true; } | 839 bool isSimpleAssign() const override { return true; } |
837 void emit(const Cfg *Func) const override; | 840 void emit(const Cfg *Func) const override; |
838 void emitIAS(const Cfg *Func) const override { emit(Func); } | 841 void emitIAS(const Cfg *Func) const override; |
839 void dump(const Cfg *Func) const override { | 842 void dump(const Cfg *Func) const override { |
840 Ostream &Str = Func->getContext()->getStrDump(); | 843 Ostream &Str = Func->getContext()->getStrDump(); |
841 Str << Opcode << "." << getDest()->getType() << " "; | 844 Str << Opcode << "." << getDest()->getType() << " "; |
842 dumpDest(Func); | 845 dumpDest(Func); |
843 Str << ", "; | 846 Str << ", "; |
844 dumpSources(Func); | 847 dumpSources(Func); |
845 } | 848 } |
846 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 849 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
847 | 850 |
848 private: | 851 private: |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1514 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
1512 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1515 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
1513 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1516 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
1514 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1517 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
1515 | 1518 |
1516 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; | 1519 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; |
1517 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; | 1520 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; |
1518 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; | 1521 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; |
1519 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; | 1522 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; |
1520 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; | 1523 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; |
1521 template <> void InstX8632Movp::emitIAS(const Cfg *Func) const; | |
1522 template <> void InstX8632Movq::emitIAS(const Cfg *Func) const; | |
1523 template <> void InstX8632MovssRegs::emitIAS(const Cfg *Func) const; | 1524 template <> void InstX8632MovssRegs::emitIAS(const Cfg *Func) const; |
1524 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1525 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
1525 | 1526 |
1526 } // end of namespace Ice | 1527 } // end of namespace Ice |
1527 | 1528 |
1528 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1529 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |