Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: src/IceInstX8632.h

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remove TODO Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceInst.h ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 private: 45 private:
46 OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION; 46 OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION;
47 OperandX8632 &operator=(const OperandX8632 &) LLVM_DELETED_FUNCTION; 47 OperandX8632 &operator=(const OperandX8632 &) LLVM_DELETED_FUNCTION;
48 }; 48 };
49 49
50 // OperandX8632Mem represents the m32 addressing mode, with optional 50 // OperandX8632Mem represents the m32 addressing mode, with optional
51 // base and index registers, a constant offset, and a fixed shift 51 // base and index registers, a constant offset, and a fixed shift
52 // value for the index register. 52 // value for the index register.
53 class OperandX8632Mem : public OperandX8632 { 53 class OperandX8632Mem : public OperandX8632 {
54 public: 54 public:
55 enum SegmentRegisters {
56 DefaultSegment = -1,
57 #define X(val, name) \
58 val,
59 SEG_REGX8632_TABLE
60 #undef X
61 SegReg_NUM
62 };
55 static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base, 63 static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base,
56 Constant *Offset, Variable *Index = NULL, 64 Constant *Offset, Variable *Index = NULL,
57 uint32_t Shift = 0) { 65 uint16_t Shift = 0,
66 SegmentRegisters SegmentReg = DefaultSegment) {
58 return new (Func->allocate<OperandX8632Mem>()) 67 return new (Func->allocate<OperandX8632Mem>())
59 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift); 68 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg);
60 } 69 }
61 Variable *getBase() const { return Base; } 70 Variable *getBase() const { return Base; }
62 Constant *getOffset() const { return Offset; } 71 Constant *getOffset() const { return Offset; }
63 Variable *getIndex() const { return Index; } 72 Variable *getIndex() const { return Index; }
64 uint32_t getShift() const { return Shift; } 73 uint16_t getShift() const { return Shift; }
74 SegmentRegisters getSegmentRegister() const { return SegmentReg; }
65 virtual void emit(const Cfg *Func) const; 75 virtual void emit(const Cfg *Func) const;
66 virtual void dump(const Cfg *Func) const; 76 virtual void dump(const Cfg *Func) const;
67 77
68 static bool classof(const Operand *Operand) { 78 static bool classof(const Operand *Operand) {
69 return Operand->getKind() == static_cast<OperandKind>(kMem); 79 return Operand->getKind() == static_cast<OperandKind>(kMem);
70 } 80 }
71 81
72 private: 82 private:
73 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset, 83 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset,
74 Variable *Index, uint32_t Shift); 84 Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg);
75 OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; 85 OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
76 OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; 86 OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
77 virtual ~OperandX8632Mem() {} 87 virtual ~OperandX8632Mem() {}
78 Variable *Base; 88 Variable *Base;
79 Constant *Offset; 89 Constant *Offset;
80 Variable *Index; 90 Variable *Index;
81 uint32_t Shift; 91 uint16_t Shift;
92 SegmentRegisters SegmentReg : 16;
82 }; 93 };
83 94
84 // VariableSplit is a way to treat an f64 memory location as a pair 95 // VariableSplit is a way to treat an f64 memory location as a pair
85 // of i32 locations (Low and High). This is needed for some cases 96 // of i32 locations (Low and High). This is needed for some cases
86 // of the Bitcast instruction. Since it's not possible for integer 97 // of the Bitcast instruction. Since it's not possible for integer
87 // registers to access the XMM registers and vice versa, the 98 // registers to access the XMM registers and vice versa, the
88 // lowering forces the f64 to be spilled to the stack and then 99 // lowering forces the f64 to be spilled to the stack and then
89 // accesses through the VariableSplit. 100 // accesses through the VariableSplit.
90 class VariableSplit : public OperandX8632 { 101 class VariableSplit : public OperandX8632 {
91 public: 102 public:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 Sbb, 164 Sbb,
154 Shl, 165 Shl,
155 Shld, 166 Shld,
156 Shr, 167 Shr,
157 Shrd, 168 Shrd,
158 Store, 169 Store,
159 Sub, 170 Sub,
160 Subss, 171 Subss,
161 Test, 172 Test,
162 Ucomiss, 173 Ucomiss,
174 UD2,
163 Xor 175 Xor
164 }; 176 };
165 static const char *getWidthString(Type Ty); 177 static const char *getWidthString(Type Ty);
166 virtual void emit(const Cfg *Func) const = 0; 178 virtual void emit(const Cfg *Func) const = 0;
167 virtual void dump(const Cfg *Func) const; 179 virtual void dump(const Cfg *Func) const;
168 180
169 protected: 181 protected:
170 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) 182 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest)
171 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} 183 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
172 virtual ~InstX8632() {} 184 virtual ~InstX8632() {}
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 virtual void dump(const Cfg *Func) const; 536 virtual void dump(const Cfg *Func) const;
525 static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); } 537 static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); }
526 538
527 private: 539 private:
528 InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2); 540 InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2);
529 InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; 541 InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
530 InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; 542 InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
531 virtual ~InstX8632Ucomiss() {} 543 virtual ~InstX8632Ucomiss() {}
532 }; 544 };
533 545
546 // UD2 instruction.
547 class InstX8632UD2 : public InstX8632 {
548 public:
549 static InstX8632UD2 *create(Cfg *Func) {
550 return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func);
551 }
552 virtual void emit(const Cfg *Func) const;
553 virtual void dump(const Cfg *Func) const;
554 static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); }
555
556 private:
557 InstX8632UD2(Cfg *Func);
558 InstX8632UD2(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
559 InstX8632UD2 &operator=(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
560 virtual ~InstX8632UD2() {}
561 };
562
534 // Test instruction. 563 // Test instruction.
535 class InstX8632Test : public InstX8632 { 564 class InstX8632Test : public InstX8632 {
536 public: 565 public:
537 static InstX8632Test *create(Cfg *Func, Operand *Source1, Operand *Source2) { 566 static InstX8632Test *create(Cfg *Func, Operand *Source1, Operand *Source2) {
538 return new (Func->allocate<InstX8632Test>()) 567 return new (Func->allocate<InstX8632Test>())
539 InstX8632Test(Func, Source1, Source2); 568 InstX8632Test(Func, Source1, Source2);
540 } 569 }
541 virtual void emit(const Cfg *Func) const; 570 virtual void emit(const Cfg *Func) const;
542 virtual void dump(const Cfg *Func) const; 571 virtual void dump(const Cfg *Func) const;
543 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } 572 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 private: 740 private:
712 InstX8632Ret(Cfg *Func, Variable *Source); 741 InstX8632Ret(Cfg *Func, Variable *Source);
713 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; 742 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
714 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; 743 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
715 virtual ~InstX8632Ret() {} 744 virtual ~InstX8632Ret() {}
716 }; 745 };
717 746
718 } // end of namespace Ice 747 } // end of namespace Ice
719 748
720 #endif // SUBZERO_SRC_ICEINSTX8632_H 749 #endif // SUBZERO_SRC_ICEINSTX8632_H
OLDNEW
« no previous file with comments | « src/IceInst.h ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698