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

Side by Side Diff: src/IceInstX8632.h

Issue 570713006: Subzero: Refactor Operand::dump(). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use a more general dump function Created 6 years, 3 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 | « no previous file | 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 17 matching lines...) Expand all
28 // OperandX8632 extends the Operand hierarchy. Its subclasses are 28 // OperandX8632 extends the Operand hierarchy. Its subclasses are
29 // OperandX8632Mem and VariableSplit. 29 // OperandX8632Mem and VariableSplit.
30 class OperandX8632 : public Operand { 30 class OperandX8632 : public Operand {
31 public: 31 public:
32 enum OperandKindX8632 { 32 enum OperandKindX8632 {
33 k__Start = Operand::kTarget, 33 k__Start = Operand::kTarget,
34 kMem, 34 kMem,
35 kSplit 35 kSplit
36 }; 36 };
37 virtual void emit(const Cfg *Func) const = 0; 37 virtual void emit(const Cfg *Func) const = 0;
38 void dump(const Cfg *Func) const; 38 using Operand::dump;
39 virtual void dump(const Cfg *, Ostream &Str) const {
40 Str << "<OperandX8632>";
41 }
39 42
40 protected: 43 protected:
41 OperandX8632(OperandKindX8632 Kind, Type Ty) 44 OperandX8632(OperandKindX8632 Kind, Type Ty)
42 : Operand(static_cast<OperandKind>(Kind), Ty) {} 45 : Operand(static_cast<OperandKind>(Kind), Ty) {}
43 virtual ~OperandX8632() {} 46 virtual ~OperandX8632() {}
44 47
45 private: 48 private:
46 OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION; 49 OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION;
47 OperandX8632 &operator=(const OperandX8632 &) LLVM_DELETED_FUNCTION; 50 OperandX8632 &operator=(const OperandX8632 &) LLVM_DELETED_FUNCTION;
48 }; 51 };
(...skipping 16 matching lines...) Expand all
65 SegmentRegisters SegmentReg = DefaultSegment) { 68 SegmentRegisters SegmentReg = DefaultSegment) {
66 return new (Func->allocate<OperandX8632Mem>()) 69 return new (Func->allocate<OperandX8632Mem>())
67 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg); 70 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg);
68 } 71 }
69 Variable *getBase() const { return Base; } 72 Variable *getBase() const { return Base; }
70 Constant *getOffset() const { return Offset; } 73 Constant *getOffset() const { return Offset; }
71 Variable *getIndex() const { return Index; } 74 Variable *getIndex() const { return Index; }
72 uint16_t getShift() const { return Shift; } 75 uint16_t getShift() const { return Shift; }
73 SegmentRegisters getSegmentRegister() const { return SegmentReg; } 76 SegmentRegisters getSegmentRegister() const { return SegmentReg; }
74 virtual void emit(const Cfg *Func) const; 77 virtual void emit(const Cfg *Func) const;
75 virtual void dump(const Cfg *Func) const; 78 using OperandX8632::dump;
79 virtual void dump(const Cfg *Func, Ostream &Str) const;
76 80
77 static bool classof(const Operand *Operand) { 81 static bool classof(const Operand *Operand) {
78 return Operand->getKind() == static_cast<OperandKind>(kMem); 82 return Operand->getKind() == static_cast<OperandKind>(kMem);
79 } 83 }
80 84
81 private: 85 private:
82 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset, 86 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset,
83 Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg); 87 Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg);
84 OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; 88 OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
85 OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; 89 OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
(...skipping 14 matching lines...) Expand all
100 class VariableSplit : public OperandX8632 { 104 class VariableSplit : public OperandX8632 {
101 public: 105 public:
102 enum Portion { 106 enum Portion {
103 Low, 107 Low,
104 High 108 High
105 }; 109 };
106 static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) { 110 static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) {
107 return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, Part); 111 return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, Part);
108 } 112 }
109 virtual void emit(const Cfg *Func) const; 113 virtual void emit(const Cfg *Func) const;
110 virtual void dump(const Cfg *Func) const; 114 using OperandX8632::dump;
115 virtual void dump(const Cfg *Func, Ostream &Str) const;
111 116
112 static bool classof(const Operand *Operand) { 117 static bool classof(const Operand *Operand) {
113 return Operand->getKind() == static_cast<OperandKind>(kSplit); 118 return Operand->getKind() == static_cast<OperandKind>(kSplit);
114 } 119 }
115 120
116 private: 121 private:
117 VariableSplit(Cfg *Func, Variable *Var, Portion Part) 122 VariableSplit(Cfg *Func, Variable *Var, Portion Part)
118 : OperandX8632(kSplit, IceType_i32), Func(Func), Var(Var), Part(Part) { 123 : OperandX8632(kSplit, IceType_i32), Func(Func), Var(Var), Part(Part) {
119 assert(Var->getType() == IceType_f64); 124 assert(Var->getType() == IceType_f64);
120 Vars = Func->allocateArrayOf<Variable *>(1); 125 Vars = Func->allocateArrayOf<Variable *>(1);
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; 1245 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const;
1241 template <> void InstX8632Psll::emit(const Cfg *Func) const; 1246 template <> void InstX8632Psll::emit(const Cfg *Func) const;
1242 template <> void InstX8632Psra::emit(const Cfg *Func) const; 1247 template <> void InstX8632Psra::emit(const Cfg *Func) const;
1243 template <> void InstX8632Psub::emit(const Cfg *Func) const; 1248 template <> void InstX8632Psub::emit(const Cfg *Func) const;
1244 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; 1249 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const;
1245 template <> void InstX8632Subss::emit(const Cfg *Func) const; 1250 template <> void InstX8632Subss::emit(const Cfg *Func) const;
1246 1251
1247 } // end of namespace Ice 1252 } // end of namespace Ice
1248 1253
1249 #endif // SUBZERO_SRC_ICEINSTX8632_H 1254 #endif // SUBZERO_SRC_ICEINSTX8632_H
OLDNEW
« no previous file with comments | « no previous file | src/IceInstX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698