| OLD | NEW |
| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 private: | 275 private: |
| 276 ConstantUndef(Type Ty, uint32_t PoolEntryID) | 276 ConstantUndef(Type Ty, uint32_t PoolEntryID) |
| 277 : Constant(kConstUndef, Ty, PoolEntryID) {} | 277 : Constant(kConstUndef, Ty, PoolEntryID) {} |
| 278 ~ConstantUndef() override {} | 278 ~ConstantUndef() override {} |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 // RegWeight is a wrapper for a uint32_t weight value, with a | 281 // RegWeight is a wrapper for a uint32_t weight value, with a |
| 282 // special value that represents infinite weight, and an addWeight() | 282 // special value that represents infinite weight, and an addWeight() |
| 283 // method that ensures that W+infinity=infinity. | 283 // method that ensures that W+infinity=infinity. |
| 284 class RegWeight { | 284 class RegWeight { |
| 285 // RegWeight(const RegWeight &) = delete; | |
| 286 // RegWeight &operator=(const RegWeight &) = delete; | |
| 287 | 285 |
| 288 public: | 286 public: |
| 289 RegWeight() : Weight(0) {} | 287 RegWeight() : Weight(0) {} |
| 290 RegWeight(uint32_t Weight) : Weight(Weight) {} | 288 RegWeight(uint32_t Weight) : Weight(Weight) {} |
| 289 RegWeight(const RegWeight &) = default; |
| 290 RegWeight &operator=(const RegWeight &) = default; |
| 291 const static uint32_t Inf = ~0; // Force regalloc to give a register | 291 const static uint32_t Inf = ~0; // Force regalloc to give a register |
| 292 const static uint32_t Zero = 0; // Force regalloc NOT to give a register | 292 const static uint32_t Zero = 0; // Force regalloc NOT to give a register |
| 293 void addWeight(uint32_t Delta) { | 293 void addWeight(uint32_t Delta) { |
| 294 if (Delta == Inf) | 294 if (Delta == Inf) |
| 295 Weight = Inf; | 295 Weight = Inf; |
| 296 else if (Weight != Inf) | 296 else if (Weight != Inf) |
| 297 Weight += Delta; | 297 Weight += Delta; |
| 298 } | 298 } |
| 299 void addWeight(const RegWeight &Other) { addWeight(Other.Weight); } | 299 void addWeight(const RegWeight &Other) { addWeight(Other.Weight); } |
| 300 void setWeight(uint32_t Val) { Weight = Val; } | 300 void setWeight(uint32_t Val) { Weight = Val; } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 enum MetadataKind { | 519 enum MetadataKind { |
| 520 VMK_Uses, // Track only uses, not defs | 520 VMK_Uses, // Track only uses, not defs |
| 521 VMK_SingleDefs, // Track uses+defs, but only record single def | 521 VMK_SingleDefs, // Track uses+defs, but only record single def |
| 522 VMK_All // Track uses+defs, including full def list | 522 VMK_All // Track uses+defs, including full def list |
| 523 }; | 523 }; |
| 524 typedef std::vector<const Inst *, CfgLocalAllocator<const Inst *> > InstDefList; | 524 typedef std::vector<const Inst *, CfgLocalAllocator<const Inst *> > InstDefList; |
| 525 | 525 |
| 526 // VariableTracking tracks the metadata for a single variable. It is | 526 // VariableTracking tracks the metadata for a single variable. It is |
| 527 // only meant to be used internally by VariablesMetadata. | 527 // only meant to be used internally by VariablesMetadata. |
| 528 class VariableTracking { | 528 class VariableTracking { |
| 529 // VariableTracking(const VariableTracking &) = delete; | |
| 530 VariableTracking &operator=(const VariableTracking &) = delete; | 529 VariableTracking &operator=(const VariableTracking &) = delete; |
| 531 | 530 |
| 532 public: | 531 public: |
| 533 enum MultiDefState { | 532 enum MultiDefState { |
| 534 // TODO(stichnot): Consider using just a simple counter. | 533 // TODO(stichnot): Consider using just a simple counter. |
| 535 MDS_Unknown, | 534 MDS_Unknown, |
| 536 MDS_SingleDef, | 535 MDS_SingleDef, |
| 537 MDS_MultiDefSingleBlock, | 536 MDS_MultiDefSingleBlock, |
| 538 MDS_MultiDefMultiBlock | 537 MDS_MultiDefMultiBlock |
| 539 }; | 538 }; |
| 540 enum MultiBlockState { | 539 enum MultiBlockState { |
| 541 MBS_Unknown, | 540 MBS_Unknown, |
| 542 MBS_SingleBlock, | 541 MBS_SingleBlock, |
| 543 MBS_MultiBlock | 542 MBS_MultiBlock |
| 544 }; | 543 }; |
| 545 VariableTracking() | 544 VariableTracking() |
| 546 : MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(nullptr), | 545 : MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(nullptr), |
| 547 SingleDefNode(nullptr), FirstOrSingleDefinition(nullptr) {} | 546 SingleDefNode(nullptr), FirstOrSingleDefinition(nullptr) {} |
| 547 VariableTracking(const VariableTracking &) = default; |
| 548 MultiDefState getMultiDef() const { return MultiDef; } | 548 MultiDefState getMultiDef() const { return MultiDef; } |
| 549 MultiBlockState getMultiBlock() const { return MultiBlock; } | 549 MultiBlockState getMultiBlock() const { return MultiBlock; } |
| 550 const Inst *getFirstDefinition() const; | 550 const Inst *getFirstDefinition() const; |
| 551 const Inst *getSingleDefinition() const; | 551 const Inst *getSingleDefinition() const; |
| 552 const InstDefList &getLatterDefinitions() const { return Definitions; } | 552 const InstDefList &getLatterDefinitions() const { return Definitions; } |
| 553 const CfgNode *getNode() const { return SingleUseNode; } | 553 const CfgNode *getNode() const { return SingleUseNode; } |
| 554 void markUse(MetadataKind TrackingKind, const Inst *Instr, | 554 void markUse(MetadataKind TrackingKind, const Inst *Instr, |
| 555 const CfgNode *Node, bool IsFromDef, bool IsImplicit); | 555 const CfgNode *Node, bool IsFromDef, bool IsImplicit); |
| 556 void markDef(MetadataKind TrackingKind, const Inst *Instr, | 556 void markDef(MetadataKind TrackingKind, const Inst *Instr, |
| 557 const CfgNode *Node); | 557 const CfgNode *Node); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 private: | 621 private: |
| 622 const Cfg *Func; | 622 const Cfg *Func; |
| 623 MetadataKind Kind; | 623 MetadataKind Kind; |
| 624 std::vector<VariableTracking> Metadata; | 624 std::vector<VariableTracking> Metadata; |
| 625 const static InstDefList NoDefinitions; | 625 const static InstDefList NoDefinitions; |
| 626 }; | 626 }; |
| 627 | 627 |
| 628 } // end of namespace Ice | 628 } // end of namespace Ice |
| 629 | 629 |
| 630 #endif // SUBZERO_SRC_ICEOPERAND_H | 630 #endif // SUBZERO_SRC_ICEOPERAND_H |
| OLD | NEW |