Chromium Code Reviews| Index: src/IceInst.h |
| diff --git a/src/IceInst.h b/src/IceInst.h |
| index 7c96e3f9e9b4cd74e4162bca5303f05ae3350e30..14d1455955cf4f6ef9b268ddfdbe8dc5632f7802 100644 |
| --- a/src/IceInst.h |
| +++ b/src/IceInst.h |
| @@ -34,7 +34,7 @@ namespace Ice { |
| // InstHighLevel and InstTarget. High-level ICE instructions inherit |
| // from InstHighLevel, and low-level (target-specific) ICE |
| // instructions inherit from InstTarget. |
| -class Inst { |
| +class Inst : public llvm::ilist_node<Inst> { |
| Inst(const Inst &) = delete; |
| Inst &operator=(const Inst &) = delete; |
| @@ -838,4 +838,22 @@ protected: |
| } // end of namespace Ice |
| +template <> |
|
jvoung (off chromium)
2014/11/06 21:20:53
Can you leave a comment about why the default trai
Jim Stichnoth
2014/11/06 21:31:58
Done. (It's also the private ctor that needs to b
|
| +struct llvm::ilist_traits<Ice::Inst> : public llvm::ilist_default_traits< |
| + Ice::Inst> { |
| + Ice::Inst *createSentinel() const { |
| + return static_cast<Ice::Inst *>(&Sentinel); |
| + } |
| + static void destroySentinel(Ice::Inst *) {} |
| + Ice::Inst *provideInitialHead() const { return createSentinel(); } |
| + Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } |
| + static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| + |
| +private: |
| + mutable ilist_half_node<Ice::Inst> Sentinel; |
| +}; |
| + |
| +template <> |
| +inline void llvm::ilist_node_traits<Ice::Inst>::deleteNode(Ice::Inst *) {} |
| + |
| #endif // SUBZERO_SRC_ICEINST_H |