OLD | NEW |
---|---|
1 //===- subzero/src/IceInst.h - High-level instructions ----------*- C++ -*-===// | 1 //===- subzero/src/IceInst.h - High-level 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 Inst class and its target-independent | 10 // This file declares the Inst class and its target-independent |
(...skipping 16 matching lines...) Expand all Loading... | |
27 // Most of the validity checking will be done in the bitcode reader. | 27 // Most of the validity checking will be done in the bitcode reader. |
28 // We need a list of everything that should be validated, and tests | 28 // We need a list of everything that should be validated, and tests |
29 // for each. | 29 // for each. |
30 | 30 |
31 namespace Ice { | 31 namespace Ice { |
32 | 32 |
33 // Base instruction class for ICE. Inst has two subclasses: | 33 // Base instruction class for ICE. Inst has two subclasses: |
34 // InstHighLevel and InstTarget. High-level ICE instructions inherit | 34 // InstHighLevel and InstTarget. High-level ICE instructions inherit |
35 // from InstHighLevel, and low-level (target-specific) ICE | 35 // from InstHighLevel, and low-level (target-specific) ICE |
36 // instructions inherit from InstTarget. | 36 // instructions inherit from InstTarget. |
37 class Inst { | 37 class Inst : public llvm::ilist_node<Inst> { |
38 Inst(const Inst &) = delete; | 38 Inst(const Inst &) = delete; |
39 Inst &operator=(const Inst &) = delete; | 39 Inst &operator=(const Inst &) = delete; |
40 | 40 |
41 public: | 41 public: |
42 enum InstKind { | 42 enum InstKind { |
43 // Arbitrary (alphabetical) order, except put Unreachable first. | 43 // Arbitrary (alphabetical) order, except put Unreachable first. |
44 Unreachable, | 44 Unreachable, |
45 Alloca, | 45 Alloca, |
46 Arithmetic, | 46 Arithmetic, |
47 Assign, // not part of LLVM/PNaCl bitcode | 47 Assign, // not part of LLVM/PNaCl bitcode |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
831 protected: | 831 protected: |
832 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) | 832 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) |
833 : Inst(Func, Kind, MaxSrcs, Dest) { | 833 : Inst(Func, Kind, MaxSrcs, Dest) { |
834 assert(Kind >= Target); | 834 assert(Kind >= Target); |
835 } | 835 } |
836 ~InstTarget() override {} | 836 ~InstTarget() override {} |
837 }; | 837 }; |
838 | 838 |
839 } // end of namespace Ice | 839 } // end of namespace Ice |
840 | 840 |
841 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
| |
842 struct llvm::ilist_traits<Ice::Inst> : public llvm::ilist_default_traits< | |
843 Ice::Inst> { | |
844 Ice::Inst *createSentinel() const { | |
845 return static_cast<Ice::Inst *>(&Sentinel); | |
846 } | |
847 static void destroySentinel(Ice::Inst *) {} | |
848 Ice::Inst *provideInitialHead() const { return createSentinel(); } | |
849 Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } | |
850 static void noteHead(Ice::Inst *, Ice::Inst *) {} | |
851 | |
852 private: | |
853 mutable ilist_half_node<Ice::Inst> Sentinel; | |
854 }; | |
855 | |
856 template <> | |
857 inline void llvm::ilist_node_traits<Ice::Inst>::deleteNode(Ice::Inst *) {} | |
858 | |
841 #endif // SUBZERO_SRC_ICEINST_H | 859 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |