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 /// \file | 10 /// \file |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Variable *getDest() const { return Dest; } | 104 Variable *getDest() const { return Dest; } |
105 | 105 |
106 SizeT getSrcSize() const { return Srcs.size(); } | 106 SizeT getSrcSize() const { return Srcs.size(); } |
107 Operand *getSrc(SizeT I) const { | 107 Operand *getSrc(SizeT I) const { |
108 assert(I < getSrcSize()); | 108 assert(I < getSrcSize()); |
109 return Srcs[I]; | 109 return Srcs[I]; |
110 } | 110 } |
111 void replaceSource(SizeT Index, Operand *Replacement) { | 111 void replaceSource(SizeT Index, Operand *Replacement) { |
112 assert(Index < getSrcSize()); | 112 assert(Index < getSrcSize()); |
113 assert(!isDeleted()); | 113 assert(!isDeleted()); |
114 assert(LiveRangesEnded == 0); | |
115 // Invalidates liveness info because the use Srcs[Index] is removed. | |
116 Srcs[Index] = Replacement; | 114 Srcs[Index] = Replacement; |
117 } | 115 } |
118 | 116 |
119 bool isLastUse(const Operand *Src) const; | 117 bool isLastUse(const Operand *Src) const; |
120 void spliceLivenessInfo(Inst *OrigInst, Inst *SpliceAssn); | 118 void spliceLivenessInfo(Inst *OrigInst, Inst *SpliceAssn); |
121 | 119 |
122 /// Returns a list of out-edges corresponding to a terminator instruction, | 120 /// Returns a list of out-edges corresponding to a terminator instruction, |
123 /// which is the last instruction of the block. The list must not contain | 121 /// which is the last instruction of the block. The list must not contain |
124 /// duplicates. | 122 /// duplicates. |
125 virtual NodeList getTerminatorEdges() const { | 123 virtual NodeList getTerminatorEdges() const { |
(...skipping 18 matching lines...) Expand all Loading... |
144 /// "var_dest=var_src" assignment where the dest and src are both variables. | 142 /// "var_dest=var_src" assignment where the dest and src are both variables. |
145 virtual bool isVarAssign() const { return false; } | 143 virtual bool isVarAssign() const { return false; } |
146 | 144 |
147 /// Returns true if the instruction has a possible side effect of changing | 145 /// Returns true if the instruction has a possible side effect of changing |
148 /// memory, in which case a memory load should not be reordered with respect | 146 /// memory, in which case a memory load should not be reordered with respect |
149 /// to this instruction. It should really be pure virtual, but we can't | 147 /// to this instruction. It should really be pure virtual, but we can't |
150 /// because of g++ and llvm::ilist<>, so we implement it as | 148 /// because of g++ and llvm::ilist<>, so we implement it as |
151 /// report_fatal_error(). | 149 /// report_fatal_error(). |
152 virtual bool isMemoryWrite() const; | 150 virtual bool isMemoryWrite() const; |
153 | 151 |
| 152 /// Returns true if the (target-specific) instruction represents an |
| 153 /// intra-block label, i.e. branch target. This is meant primarily for |
| 154 /// Cfg::splitLocalVars(). |
| 155 virtual bool isLabel() const { return false; } |
| 156 /// If the (target-specific) instruction represents an intra-block branch to |
| 157 /// some Label instruction, return that Label branch target instruction; |
| 158 /// otherwise return nullptr. |
| 159 virtual const Inst *getIntraBlockBranchTarget() const { return nullptr; } |
| 160 |
154 void livenessLightweight(Cfg *Func, LivenessBV &Live); | 161 void livenessLightweight(Cfg *Func, LivenessBV &Live); |
155 /// Calculates liveness for this instruction. Returns true if this instruction | 162 /// Calculates liveness for this instruction. Returns true if this instruction |
156 /// is (tentatively) still live and should be retained, and false if this | 163 /// is (tentatively) still live and should be retained, and false if this |
157 /// instruction is (tentatively) dead and should be deleted. The decision is | 164 /// instruction is (tentatively) dead and should be deleted. The decision is |
158 /// tentative until the liveness dataflow algorithm has converged, and then a | 165 /// tentative until the liveness dataflow algorithm has converged, and then a |
159 /// separate pass permanently deletes dead instructions. | 166 /// separate pass permanently deletes dead instructions. |
160 bool liveness(InstNumberT InstNumber, LivenessBV &Live, Liveness *Liveness, | 167 bool liveness(InstNumberT InstNumber, LivenessBV &Live, Liveness *Liveness, |
161 LiveBeginEndMap *LiveBegin, LiveBeginEndMap *LiveEnd); | 168 LiveBeginEndMap *LiveBegin, LiveBeginEndMap *LiveEnd); |
162 | 169 |
163 /// Get the number of native instructions that this instruction ultimately | 170 /// Get the number of native instructions that this instruction ultimately |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 | 1154 |
1148 inline Inst *iteratorToInst(InstList::iterator Iter) { return &*Iter; } | 1155 inline Inst *iteratorToInst(InstList::iterator Iter) { return &*Iter; } |
1149 | 1156 |
1150 inline const Inst *iteratorToInst(InstList::const_iterator Iter) { | 1157 inline const Inst *iteratorToInst(InstList::const_iterator Iter) { |
1151 return &*Iter; | 1158 return &*Iter; |
1152 } | 1159 } |
1153 | 1160 |
1154 } // end of namespace Ice | 1161 } // end of namespace Ice |
1155 | 1162 |
1156 #endif // SUBZERO_SRC_ICEINST_H | 1163 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |