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

Side by Side Diff: src/IceOperand.h

Issue 619983002: Subzero: Remove LLVM_DELETED_FUNCTION. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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/IceLiveness.h ('k') | src/IceRNG.h » ('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/IceOperand.h - High-level operands -----------*- C++ -*-===// 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- 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 Operand class and its target-independent 10 // This file declares the Operand class and its target-independent
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 : Ty(Ty), Kind(Kind), NumVars(0), Vars(NULL) {} 79 : Ty(Ty), Kind(Kind), NumVars(0), Vars(NULL) {}
80 Operand(Operand &&O) = default; 80 Operand(Operand &&O) = default;
81 81
82 const Type Ty; 82 const Type Ty;
83 const OperandKind Kind; 83 const OperandKind Kind;
84 // Vars and NumVars are initialized by the derived class. 84 // Vars and NumVars are initialized by the derived class.
85 SizeT NumVars; 85 SizeT NumVars;
86 Variable **Vars; 86 Variable **Vars;
87 87
88 private: 88 private:
89 Operand(const Operand &) LLVM_DELETED_FUNCTION; 89 Operand(const Operand &) = delete;
90 Operand &operator=(const Operand &) LLVM_DELETED_FUNCTION; 90 Operand &operator=(const Operand &) = delete;
91 }; 91 };
92 92
93 template<class StreamType> 93 template<class StreamType>
94 inline StreamType &operator<<(StreamType &Str, const Operand &Op) { 94 inline StreamType &operator<<(StreamType &Str, const Operand &Op) {
95 Op.dump(Str); 95 Op.dump(Str);
96 return Str; 96 return Str;
97 } 97 }
98 98
99 // Constant is the abstract base class for constants. All 99 // Constant is the abstract base class for constants. All
100 // constants are allocated from a global arena and are pooled. 100 // constants are allocated from a global arena and are pooled.
(...skipping 16 matching lines...) Expand all
117 Vars = NULL; 117 Vars = NULL;
118 NumVars = 0; 118 NumVars = 0;
119 } 119 }
120 ~Constant() override {} 120 ~Constant() override {}
121 // PoolEntryID is an integer that uniquely identifies the constant 121 // PoolEntryID is an integer that uniquely identifies the constant
122 // within its constant pool. It is used for building the constant 122 // within its constant pool. It is used for building the constant
123 // pool in the object code and for referencing its entries. 123 // pool in the object code and for referencing its entries.
124 const uint32_t PoolEntryID; 124 const uint32_t PoolEntryID;
125 125
126 private: 126 private:
127 Constant(const Constant &) LLVM_DELETED_FUNCTION; 127 Constant(const Constant &) = delete;
128 Constant &operator=(const Constant &) LLVM_DELETED_FUNCTION; 128 Constant &operator=(const Constant &) = delete;
129 }; 129 };
130 130
131 // ConstantPrimitive<> wraps a primitive type. 131 // ConstantPrimitive<> wraps a primitive type.
132 template <typename T, Operand::OperandKind K> 132 template <typename T, Operand::OperandKind K>
133 class ConstantPrimitive : public Constant { 133 class ConstantPrimitive : public Constant {
134 public: 134 public:
135 static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value, 135 static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value,
136 uint32_t PoolEntryID) { 136 uint32_t PoolEntryID) {
137 return new (Ctx->allocate<ConstantPrimitive>()) 137 return new (Ctx->allocate<ConstantPrimitive>())
138 ConstantPrimitive(Ty, Value, PoolEntryID); 138 ConstantPrimitive(Ty, Value, PoolEntryID);
139 } 139 }
140 T getValue() const { return Value; } 140 T getValue() const { return Value; }
141 using Constant::emit; 141 using Constant::emit;
142 // The target needs to implement this for each ConstantPrimitive 142 // The target needs to implement this for each ConstantPrimitive
143 // specialization. 143 // specialization.
144 void emit(GlobalContext *Ctx) const override; 144 void emit(GlobalContext *Ctx) const override;
145 using Constant::dump; 145 using Constant::dump;
146 void dump(const Cfg *, Ostream &Str) const override { Str << getValue(); } 146 void dump(const Cfg *, Ostream &Str) const override { Str << getValue(); }
147 147
148 static bool classof(const Operand *Operand) { 148 static bool classof(const Operand *Operand) {
149 return Operand->getKind() == K; 149 return Operand->getKind() == K;
150 } 150 }
151 151
152 private: 152 private:
153 ConstantPrimitive(Type Ty, T Value, uint32_t PoolEntryID) 153 ConstantPrimitive(Type Ty, T Value, uint32_t PoolEntryID)
154 : Constant(K, Ty, PoolEntryID), Value(Value) {} 154 : Constant(K, Ty, PoolEntryID), Value(Value) {}
155 ConstantPrimitive(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; 155 ConstantPrimitive(const ConstantPrimitive &) = delete;
156 ConstantPrimitive &operator=(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; 156 ConstantPrimitive &operator=(const ConstantPrimitive &) = delete;
157 ~ConstantPrimitive() override {} 157 ~ConstantPrimitive() override {}
158 const T Value; 158 const T Value;
159 }; 159 };
160 160
161 typedef ConstantPrimitive<uint32_t, Operand::kConstInteger32> ConstantInteger32; 161 typedef ConstantPrimitive<uint32_t, Operand::kConstInteger32> ConstantInteger32;
162 typedef ConstantPrimitive<uint64_t, Operand::kConstInteger64> ConstantInteger64; 162 typedef ConstantPrimitive<uint64_t, Operand::kConstInteger64> ConstantInteger64;
163 typedef ConstantPrimitive<float, Operand::kConstFloat> ConstantFloat; 163 typedef ConstantPrimitive<float, Operand::kConstFloat> ConstantFloat;
164 typedef ConstantPrimitive<double, Operand::kConstDouble> ConstantDouble; 164 typedef ConstantPrimitive<double, Operand::kConstDouble> ConstantDouble;
165 165
166 template <> inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const { 166 template <> inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const {
167 if (getType() == IceType_i1) 167 if (getType() == IceType_i1)
168 Str << (getValue() ? "true" : "false"); 168 Str << (getValue() ? "true" : "false");
169 else 169 else
170 Str << static_cast<int32_t>(getValue()); 170 Str << static_cast<int32_t>(getValue());
171 } 171 }
172 172
173 template <> inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const { 173 template <> inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const {
174 assert(getType() == IceType_i64); 174 assert(getType() == IceType_i64);
175 Str << static_cast<int64_t>(getValue()); 175 Str << static_cast<int64_t>(getValue());
176 } 176 }
177 177
178 // RelocatableTuple bundles the parameters that are used to 178 // RelocatableTuple bundles the parameters that are used to
179 // construct an ConstantRelocatable. It is done this way so that 179 // construct an ConstantRelocatable. It is done this way so that
180 // ConstantRelocatable can fit into the global constant pool 180 // ConstantRelocatable can fit into the global constant pool
181 // template mechanism. 181 // template mechanism.
182 class RelocatableTuple { 182 class RelocatableTuple {
183 RelocatableTuple &operator=(const RelocatableTuple &) LLVM_DELETED_FUNCTION; 183 RelocatableTuple &operator=(const RelocatableTuple &) = delete;
184 184
185 public: 185 public:
186 RelocatableTuple(const int64_t Offset, const IceString &Name, 186 RelocatableTuple(const int64_t Offset, const IceString &Name,
187 bool SuppressMangling) 187 bool SuppressMangling)
188 : Offset(Offset), Name(Name), SuppressMangling(SuppressMangling) {} 188 : Offset(Offset), Name(Name), SuppressMangling(SuppressMangling) {}
189 RelocatableTuple(const RelocatableTuple &Other) 189 RelocatableTuple(const RelocatableTuple &Other)
190 : Offset(Other.Offset), Name(Other.Name), 190 : Offset(Other.Offset), Name(Other.Name),
191 SuppressMangling(Other.SuppressMangling) {} 191 SuppressMangling(Other.SuppressMangling) {}
192 192
193 const int64_t Offset; 193 const int64_t Offset;
(...skipping 25 matching lines...) Expand all
219 static bool classof(const Operand *Operand) { 219 static bool classof(const Operand *Operand) {
220 OperandKind Kind = Operand->getKind(); 220 OperandKind Kind = Operand->getKind();
221 return Kind == kConstRelocatable; 221 return Kind == kConstRelocatable;
222 } 222 }
223 223
224 private: 224 private:
225 ConstantRelocatable(Type Ty, int64_t Offset, const IceString &Name, 225 ConstantRelocatable(Type Ty, int64_t Offset, const IceString &Name,
226 bool SuppressMangling, uint32_t PoolEntryID) 226 bool SuppressMangling, uint32_t PoolEntryID)
227 : Constant(kConstRelocatable, Ty, PoolEntryID), Offset(Offset), 227 : Constant(kConstRelocatable, Ty, PoolEntryID), Offset(Offset),
228 Name(Name), SuppressMangling(SuppressMangling) {} 228 Name(Name), SuppressMangling(SuppressMangling) {}
229 ConstantRelocatable(const ConstantRelocatable &) LLVM_DELETED_FUNCTION; 229 ConstantRelocatable(const ConstantRelocatable &) = delete;
230 ConstantRelocatable & 230 ConstantRelocatable &operator=(const ConstantRelocatable &) = delete;
231 operator=(const ConstantRelocatable &) LLVM_DELETED_FUNCTION;
232 ~ConstantRelocatable() override {} 231 ~ConstantRelocatable() override {}
233 const int64_t Offset; // fixed offset to add 232 const int64_t Offset; // fixed offset to add
234 const IceString Name; // optional for debug/dump 233 const IceString Name; // optional for debug/dump
235 bool SuppressMangling; 234 bool SuppressMangling;
236 }; 235 };
237 236
238 // ConstantUndef represents an unspecified bit pattern. Although it is 237 // ConstantUndef represents an unspecified bit pattern. Although it is
239 // legal to lower ConstantUndef to any value, backends should try to 238 // legal to lower ConstantUndef to any value, backends should try to
240 // make code generation deterministic by lowering ConstantUndefs to 0. 239 // make code generation deterministic by lowering ConstantUndefs to 0.
241 class ConstantUndef : public Constant { 240 class ConstantUndef : public Constant {
242 public: 241 public:
243 static ConstantUndef *create(GlobalContext *Ctx, Type Ty, 242 static ConstantUndef *create(GlobalContext *Ctx, Type Ty,
244 uint32_t PoolEntryID) { 243 uint32_t PoolEntryID) {
245 return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID); 244 return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID);
246 } 245 }
247 246
248 using Constant::emit; 247 using Constant::emit;
249 using Constant::dump; 248 using Constant::dump;
250 // The target needs to implement this. 249 // The target needs to implement this.
251 void emit(GlobalContext *Ctx) const override; 250 void emit(GlobalContext *Ctx) const override;
252 void dump(const Cfg *, Ostream &Str) const override { Str << "undef"; } 251 void dump(const Cfg *, Ostream &Str) const override { Str << "undef"; }
253 252
254 static bool classof(const Operand *Operand) { 253 static bool classof(const Operand *Operand) {
255 return Operand->getKind() == kConstUndef; 254 return Operand->getKind() == kConstUndef;
256 } 255 }
257 256
258 private: 257 private:
259 ConstantUndef(Type Ty, uint32_t PoolEntryID) 258 ConstantUndef(Type Ty, uint32_t PoolEntryID)
260 : Constant(kConstUndef, Ty, PoolEntryID) {} 259 : Constant(kConstUndef, Ty, PoolEntryID) {}
261 ConstantUndef(const ConstantUndef &) LLVM_DELETED_FUNCTION; 260 ConstantUndef(const ConstantUndef &) = delete;
262 ConstantUndef &operator=(const ConstantUndef &) LLVM_DELETED_FUNCTION; 261 ConstantUndef &operator=(const ConstantUndef &) = delete;
263 ~ConstantUndef() override {} 262 ~ConstantUndef() override {}
264 }; 263 };
265 264
266 // RegWeight is a wrapper for a uint32_t weight value, with a 265 // RegWeight is a wrapper for a uint32_t weight value, with a
267 // special value that represents infinite weight, and an addWeight() 266 // special value that represents infinite weight, and an addWeight()
268 // method that ensures that W+infinity=infinity. 267 // method that ensures that W+infinity=infinity.
269 class RegWeight { 268 class RegWeight {
270 public: 269 public:
271 RegWeight() : Weight(0) {} 270 RegWeight() : Weight(0) {}
272 RegWeight(uint32_t Weight) : Weight(Weight) {} 271 RegWeight(uint32_t Weight) : Weight(Weight) {}
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 RangeType Range; 336 RangeType Range;
338 RegWeight Weight; 337 RegWeight Weight;
339 }; 338 };
340 339
341 Ostream &operator<<(Ostream &Str, const LiveRange &L); 340 Ostream &operator<<(Ostream &Str, const LiveRange &L);
342 341
343 // Variable represents an operand that is register-allocated or 342 // Variable represents an operand that is register-allocated or
344 // stack-allocated. If it is register-allocated, it will ultimately 343 // stack-allocated. If it is register-allocated, it will ultimately
345 // have a non-negative RegNum field. 344 // have a non-negative RegNum field.
346 class Variable : public Operand { 345 class Variable : public Operand {
347 Variable(const Variable &) LLVM_DELETED_FUNCTION; 346 Variable(const Variable &) = delete;
348 Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; 347 Variable &operator=(const Variable &) = delete;
349 Variable(Variable &&V) = default; 348 Variable(Variable &&V) = default;
350 349
351 public: 350 public:
352 static Variable *create(Cfg *Func, Type Ty, SizeT Index, 351 static Variable *create(Cfg *Func, Type Ty, SizeT Index,
353 const IceString &Name) { 352 const IceString &Name) {
354 return new (Func->allocate<Variable>()) 353 return new (Func->allocate<Variable>())
355 Variable(kVariable, Ty, Index, Name); 354 Variable(kVariable, Ty, Index, Name);
356 } 355 }
357 356
358 SizeT getIndex() const { return Number; } 357 SizeT getIndex() const { return Number; }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 MultiBlockState getMultiBlock() const { return MultiBlock; } 491 MultiBlockState getMultiBlock() const { return MultiBlock; }
493 const Inst *getFirstDefinition() const; 492 const Inst *getFirstDefinition() const;
494 const Inst *getSingleDefinition() const; 493 const Inst *getSingleDefinition() const;
495 const InstDefList &getDefinitions() const { return Definitions; } 494 const InstDefList &getDefinitions() const { return Definitions; }
496 const CfgNode *getNode() const { return SingleUseNode; } 495 const CfgNode *getNode() const { return SingleUseNode; }
497 void markUse(const Inst *Instr, const CfgNode *Node, bool IsFromDef, 496 void markUse(const Inst *Instr, const CfgNode *Node, bool IsFromDef,
498 bool IsImplicit); 497 bool IsImplicit);
499 void markDef(const Inst *Instr, const CfgNode *Node); 498 void markDef(const Inst *Instr, const CfgNode *Node);
500 499
501 private: 500 private:
502 VariableTracking &operator=(const VariableTracking &) LLVM_DELETED_FUNCTION; 501 VariableTracking &operator=(const VariableTracking &) = delete;
503 MultiDefState MultiDef; 502 MultiDefState MultiDef;
504 MultiBlockState MultiBlock; 503 MultiBlockState MultiBlock;
505 const CfgNode *SingleUseNode; 504 const CfgNode *SingleUseNode;
506 const CfgNode *SingleDefNode; 505 const CfgNode *SingleDefNode;
507 // All definitions of the variable are collected here, in the order 506 // All definitions of the variable are collected here, in the order
508 // encountered. Definitions in the same basic block are in 507 // encountered. Definitions in the same basic block are in
509 // instruction order, but there's no guarantee for the basic block 508 // instruction order, but there's no guarantee for the basic block
510 // order. 509 // order.
511 InstDefList Definitions; 510 InstDefList Definitions;
512 }; 511 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // entry block. 552 // entry block.
554 bool isMultiBlock(const Variable *Var) const; 553 bool isMultiBlock(const Variable *Var) const;
555 // Returns the node that the given Variable is used in, assuming 554 // Returns the node that the given Variable is used in, assuming
556 // isMultiBlock() returns false. Otherwise, NULL is returned. 555 // isMultiBlock() returns false. Otherwise, NULL is returned.
557 const CfgNode *getLocalUseNode(const Variable *Var) const; 556 const CfgNode *getLocalUseNode(const Variable *Var) const;
558 557
559 private: 558 private:
560 const Cfg *Func; 559 const Cfg *Func;
561 std::vector<VariableTracking> Metadata; 560 std::vector<VariableTracking> Metadata;
562 const static InstDefList NoDefinitions; 561 const static InstDefList NoDefinitions;
563 VariablesMetadata(const VariablesMetadata &) LLVM_DELETED_FUNCTION; 562 VariablesMetadata(const VariablesMetadata &) = delete;
564 VariablesMetadata &operator=(const VariablesMetadata &) LLVM_DELETED_FUNCTION; 563 VariablesMetadata &operator=(const VariablesMetadata &) = delete;
565 }; 564 };
566 565
567 } // end of namespace Ice 566 } // end of namespace Ice
568 567
569 #endif // SUBZERO_SRC_ICEOPERAND_H 568 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« no previous file with comments | « src/IceLiveness.h ('k') | src/IceRNG.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698