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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // | 283 // |
284 // The down-side is that "mov c, x" can never be dead-code eliminated | 284 // The down-side is that "mov c, x" can never be dead-code eliminated |
285 // even if there are no uses of c. As unlikely as this situation is, | 285 // even if there are no uses of c. As unlikely as this situation is, |
286 // it may be prevented by running dead code elimination before | 286 // it may be prevented by running dead code elimination before |
287 // lowering. | 287 // lowering. |
288 class InstX8632Label : public InstX8632 { | 288 class InstX8632Label : public InstX8632 { |
289 public: | 289 public: |
290 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { | 290 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { |
291 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target); | 291 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target); |
292 } | 292 } |
| 293 virtual uint32_t getEmitInstCount() const { return 0; } |
293 IceString getName(const Cfg *Func) const; | 294 IceString getName(const Cfg *Func) const; |
294 virtual void emit(const Cfg *Func) const; | 295 virtual void emit(const Cfg *Func) const; |
295 virtual void dump(const Cfg *Func) const; | 296 virtual void dump(const Cfg *Func) const; |
296 | 297 |
297 private: | 298 private: |
298 InstX8632Label(Cfg *Func, TargetX8632 *Target); | 299 InstX8632Label(Cfg *Func, TargetX8632 *Target); |
299 InstX8632Label(const InstX8632Label &) LLVM_DELETED_FUNCTION; | 300 InstX8632Label(const InstX8632Label &) LLVM_DELETED_FUNCTION; |
300 InstX8632Label &operator=(const InstX8632Label &) LLVM_DELETED_FUNCTION; | 301 InstX8632Label &operator=(const InstX8632Label &) LLVM_DELETED_FUNCTION; |
301 virtual ~InstX8632Label() {} | 302 virtual ~InstX8632Label() {} |
302 SizeT Number; // used only for unique label string generation | 303 SizeT Number; // used only for unique label string generation |
(...skipping 14 matching lines...) Expand all Loading... |
317 InstX8632Br(Func, NULL, Target, NULL, Br_None); | 318 InstX8632Br(Func, NULL, Target, NULL, Br_None); |
318 } | 319 } |
319 // Create a non-terminator conditional branch to a node, with a | 320 // Create a non-terminator conditional branch to a node, with a |
320 // fallthrough to the next instruction in the current node. This is | 321 // fallthrough to the next instruction in the current node. This is |
321 // used for switch lowering. | 322 // used for switch lowering. |
322 static InstX8632Br *create(Cfg *Func, CfgNode *Target, BrCond Condition) { | 323 static InstX8632Br *create(Cfg *Func, CfgNode *Target, BrCond Condition) { |
323 return new (Func->allocate<InstX8632Br>()) | 324 return new (Func->allocate<InstX8632Br>()) |
324 InstX8632Br(Func, Target, NULL, NULL, Condition); | 325 InstX8632Br(Func, Target, NULL, NULL, Condition); |
325 } | 326 } |
326 // Create a conditional intra-block branch (or unconditional, if | 327 // Create a conditional intra-block branch (or unconditional, if |
327 // Condition==None) to a label in the current block. | 328 // Condition==Br_None) to a label in the current block. |
328 static InstX8632Br *create(Cfg *Func, InstX8632Label *Label, | 329 static InstX8632Br *create(Cfg *Func, InstX8632Label *Label, |
329 BrCond Condition) { | 330 BrCond Condition) { |
330 return new (Func->allocate<InstX8632Br>()) | 331 return new (Func->allocate<InstX8632Br>()) |
331 InstX8632Br(Func, NULL, NULL, Label, Condition); | 332 InstX8632Br(Func, NULL, NULL, Label, Condition); |
332 } | 333 } |
333 CfgNode *getTargetTrue() const { return TargetTrue; } | 334 CfgNode *getTargetTrue() const { return TargetTrue; } |
334 CfgNode *getTargetFalse() const { return TargetFalse; } | 335 CfgNode *getTargetFalse() const { return TargetFalse; } |
| 336 virtual uint32_t getEmitInstCount() const { |
| 337 if (Label) |
| 338 return 1; |
| 339 if (Condition == Br_None) |
| 340 return 1; |
| 341 if (getTargetFalse()) |
| 342 return 2; |
| 343 return 1; |
| 344 } |
335 virtual void emit(const Cfg *Func) const; | 345 virtual void emit(const Cfg *Func) const; |
336 virtual void dump(const Cfg *Func) const; | 346 virtual void dump(const Cfg *Func) const; |
337 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } | 347 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } |
338 | 348 |
339 private: | 349 private: |
340 InstX8632Br(Cfg *Func, CfgNode *TargetTrue, CfgNode *TargetFalse, | 350 InstX8632Br(Cfg *Func, CfgNode *TargetTrue, CfgNode *TargetFalse, |
341 InstX8632Label *Label, BrCond Condition); | 351 InstX8632Label *Label, BrCond Condition); |
342 InstX8632Br(const InstX8632Br &) LLVM_DELETED_FUNCTION; | 352 InstX8632Br(const InstX8632Br &) LLVM_DELETED_FUNCTION; |
343 InstX8632Br &operator=(const InstX8632Br &) LLVM_DELETED_FUNCTION; | 353 InstX8632Br &operator=(const InstX8632Br &) LLVM_DELETED_FUNCTION; |
344 virtual ~InstX8632Br() {} | 354 virtual ~InstX8632Br() {} |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; | 1255 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; |
1246 template <> void InstX8632Psll::emit(const Cfg *Func) const; | 1256 template <> void InstX8632Psll::emit(const Cfg *Func) const; |
1247 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1257 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
1248 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1258 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
1249 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1259 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
1250 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1260 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
1251 | 1261 |
1252 } // end of namespace Ice | 1262 } // end of namespace Ice |
1253 | 1263 |
1254 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1264 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |