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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // algorithm has converged, and then a separate pass permanently | 121 // algorithm has converged, and then a separate pass permanently |
122 // deletes dead instructions. | 122 // deletes dead instructions. |
123 bool liveness(InstNumberT InstNumber, LivenessBV &Live, Liveness *Liveness, | 123 bool liveness(InstNumberT InstNumber, LivenessBV &Live, Liveness *Liveness, |
124 LiveBeginEndMap *LiveBegin, LiveBeginEndMap *LiveEnd); | 124 LiveBeginEndMap *LiveBegin, LiveBeginEndMap *LiveEnd); |
125 | 125 |
126 // Get the number of native instructions that this instruction | 126 // Get the number of native instructions that this instruction |
127 // ultimately emits. By default, high-level instructions don't | 127 // ultimately emits. By default, high-level instructions don't |
128 // result in any native instructions, and a target-specific | 128 // result in any native instructions, and a target-specific |
129 // instruction results in a single native instruction. | 129 // instruction results in a single native instruction. |
130 virtual uint32_t getEmitInstCount() const { return 0; } | 130 virtual uint32_t getEmitInstCount() const { return 0; } |
131 virtual void emit(const Cfg *Func) const = 0; | 131 // TODO(stichnot): Change Inst back to abstract once the g++ build |
132 virtual void emitIAS(const Cfg *Func) const = 0; | 132 // issue is fixed. llvm::ilist<Ice::Inst> doesn't work under g++ |
| 133 // because the resize(size_t, Ice::Inst) method is incorrectly |
| 134 // declared and thus doesn't allow the abstract class Ice::Inst. |
| 135 // The method should be declared resize(size_t, const Ice::Inst &). |
| 136 // virtual void emit(const Cfg *Func) const = 0; |
| 137 // virtual void emitIAS(const Cfg *Func) const = 0; |
| 138 virtual void emit(const Cfg *) const { |
| 139 llvm_unreachable("emit on abstract class"); |
| 140 } |
| 141 virtual void emitIAS(const Cfg *Func) const { emit(Func); } |
133 virtual void dump(const Cfg *Func) const; | 142 virtual void dump(const Cfg *Func) const; |
134 virtual void dumpExtras(const Cfg *Func) const; | 143 virtual void dumpExtras(const Cfg *Func) const; |
135 void dumpDecorated(const Cfg *Func) const; | 144 void dumpDecorated(const Cfg *Func) const; |
136 void emitSources(const Cfg *Func) const; | 145 void emitSources(const Cfg *Func) const; |
137 void dumpSources(const Cfg *Func) const; | 146 void dumpSources(const Cfg *Func) const; |
138 void dumpDest(const Cfg *Func) const; | 147 void dumpDest(const Cfg *Func) const; |
139 virtual bool isRedundantAssign() const { return false; } | 148 virtual bool isRedundantAssign() const { return false; } |
140 | 149 |
141 virtual ~Inst() {} | 150 virtual ~Inst() {} |
142 | 151 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 protected: | 837 protected: |
829 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) | 838 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) |
830 : Inst(Func, Kind, MaxSrcs, Dest) { | 839 : Inst(Func, Kind, MaxSrcs, Dest) { |
831 assert(Kind >= Target); | 840 assert(Kind >= Target); |
832 } | 841 } |
833 ~InstTarget() override {} | 842 ~InstTarget() override {} |
834 }; | 843 }; |
835 | 844 |
836 } // end of namespace Ice | 845 } // end of namespace Ice |
837 | 846 |
| 847 namespace llvm { |
| 848 |
838 // Override the default ilist traits so that Inst's private ctor and | 849 // Override the default ilist traits so that Inst's private ctor and |
839 // deleted dtor aren't invoked. | 850 // deleted dtor aren't invoked. |
840 template <> | 851 template <> |
841 struct llvm::ilist_traits<Ice::Inst> | 852 struct ilist_traits<Ice::Inst> : public ilist_default_traits<Ice::Inst> { |
842 : public llvm::ilist_default_traits<Ice::Inst> { | |
843 Ice::Inst *createSentinel() const { | 853 Ice::Inst *createSentinel() const { |
844 return static_cast<Ice::Inst *>(&Sentinel); | 854 return static_cast<Ice::Inst *>(&Sentinel); |
845 } | 855 } |
846 static void destroySentinel(Ice::Inst *) {} | 856 static void destroySentinel(Ice::Inst *) {} |
847 Ice::Inst *provideInitialHead() const { return createSentinel(); } | 857 Ice::Inst *provideInitialHead() const { return createSentinel(); } |
848 Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } | 858 Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } |
849 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 859 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
850 void deleteNode(Ice::Inst *) {} | 860 void deleteNode(Ice::Inst *) {} |
851 | 861 |
852 private: | 862 private: |
853 mutable ilist_half_node<Ice::Inst> Sentinel; | 863 mutable ilist_half_node<Ice::Inst> Sentinel; |
854 }; | 864 }; |
855 | 865 |
| 866 } // end of namespace llvm |
| 867 |
856 #endif // SUBZERO_SRC_ICEINST_H | 868 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |