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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 virtual void emitIAS(const Cfg *Func) const { emit(Func); } | 155 virtual void emitIAS(const Cfg *Func) const { emit(Func); } |
156 virtual void dump(const Cfg *Func) const; | 156 virtual void dump(const Cfg *Func) const; |
157 virtual void dumpExtras(const Cfg *Func) const; | 157 virtual void dumpExtras(const Cfg *Func) const; |
158 void dumpDecorated(const Cfg *Func) const; | 158 void dumpDecorated(const Cfg *Func) const; |
159 void emitSources(const Cfg *Func) const; | 159 void emitSources(const Cfg *Func) const; |
160 void dumpSources(const Cfg *Func) const; | 160 void dumpSources(const Cfg *Func) const; |
161 void dumpDest(const Cfg *Func) const; | 161 void dumpDest(const Cfg *Func) const; |
162 virtual bool isRedundantAssign() const { return false; } | 162 virtual bool isRedundantAssign() const { return false; } |
163 | 163 |
164 virtual ~Inst() {} | 164 virtual ~Inst() = default; |
165 | 165 |
166 protected: | 166 protected: |
167 Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest); | 167 Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest); |
168 void addSource(Operand *Src) { | 168 void addSource(Operand *Src) { |
169 assert(Src); | 169 assert(Src); |
170 assert(NumSrcs < MaxSrcs); | 170 assert(NumSrcs < MaxSrcs); |
171 Srcs[NumSrcs++] = Src; | 171 Srcs[NumSrcs++] = Src; |
172 } | 172 } |
173 void setLastUse(SizeT VarIndex) { | 173 void setLastUse(SizeT VarIndex) { |
174 if (VarIndex < CHAR_BIT * sizeof(LiveRangesEnded)) | 174 if (VarIndex < CHAR_BIT * sizeof(LiveRangesEnded)) |
175 LiveRangesEnded |= (((LREndedBits)1u) << VarIndex); | 175 LiveRangesEnded |= (((LREndedBits)1u) << VarIndex); |
176 } | 176 } |
177 void resetLastUses() { LiveRangesEnded = 0; } | 177 void resetLastUses() { LiveRangesEnded = 0; } |
178 // The destroy() method lets the instruction cleanly release any | 178 // The destroy() method lets the instruction cleanly release any |
179 // memory that was allocated via the Cfg's allocator. | 179 // memory that was allocated via the Cfg's allocator. |
180 virtual void destroy(Cfg *Func) { Func->deallocateArrayOf<Operand *>(Srcs); } | 180 virtual void destroy(Cfg *Func) { Func->deallocateArrayOf<Operand *>(Srcs); } |
181 | 181 |
182 const InstKind Kind; | 182 const InstKind Kind; |
183 // Number is the instruction number for describing live ranges. | 183 // Number is the instruction number for describing live ranges. |
184 InstNumberT Number; | 184 InstNumberT Number; |
185 // Deleted means irrevocably deleted. | 185 // Deleted means irrevocably deleted. |
186 bool Deleted; | 186 bool Deleted = false; |
187 // Dead means one of two things depending on context: (1) pending | 187 // Dead means one of two things depending on context: (1) pending |
188 // deletion after liveness analysis converges, or (2) marked for | 188 // deletion after liveness analysis converges, or (2) marked for |
189 // deletion during lowering due to a folded bool operation. | 189 // deletion during lowering due to a folded bool operation. |
190 bool Dead; | 190 bool Dead = false; |
191 // HasSideEffects means the instruction is something like a function | 191 // HasSideEffects means the instruction is something like a function |
192 // call or a volatile load that can't be removed even if its Dest | 192 // call or a volatile load that can't be removed even if its Dest |
193 // variable is not live. | 193 // variable is not live. |
194 bool HasSideEffects; | 194 bool HasSideEffects = false; |
195 // IsDestNonKillable means that liveness analysis shouldn't consider | 195 // IsDestNonKillable means that liveness analysis shouldn't consider |
196 // this instruction to kill the Dest variable. This is used when | 196 // this instruction to kill the Dest variable. This is used when |
197 // lowering produces two assignments to the same variable. | 197 // lowering produces two assignments to the same variable. |
198 bool IsDestNonKillable; | 198 bool IsDestNonKillable = false; |
199 | 199 |
200 Variable *Dest; | 200 Variable *Dest; |
201 const SizeT MaxSrcs; // only used for assert | 201 const SizeT MaxSrcs; // only used for assert |
202 SizeT NumSrcs; | 202 SizeT NumSrcs = 0; |
203 Operand **Srcs; | 203 Operand **Srcs; |
204 | 204 |
205 // LiveRangesEnded marks which Variables' live ranges end in this | 205 // LiveRangesEnded marks which Variables' live ranges end in this |
206 // instruction. An instruction can have an arbitrary number of | 206 // instruction. An instruction can have an arbitrary number of |
207 // source operands (e.g. a call instruction), and each source | 207 // source operands (e.g. a call instruction), and each source |
208 // operand can contain 0 or 1 Variable (and target-specific operands | 208 // operand can contain 0 or 1 Variable (and target-specific operands |
209 // could contain more than 1 Variable). All the variables in an | 209 // could contain more than 1 Variable). All the variables in an |
210 // instruction are conceptually flattened and each variable is | 210 // instruction are conceptually flattened and each variable is |
211 // mapped to one bit position of the LiveRangesEnded bit vector. | 211 // mapped to one bit position of the LiveRangesEnded bit vector. |
212 // Only the first CHAR_BIT * sizeof(LREndedBits) variables are | 212 // Only the first CHAR_BIT * sizeof(LREndedBits) variables are |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 952 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
953 void deleteNode(Ice::Inst *) {} | 953 void deleteNode(Ice::Inst *) {} |
954 | 954 |
955 private: | 955 private: |
956 mutable ilist_half_node<Ice::Inst> Sentinel; | 956 mutable ilist_half_node<Ice::Inst> Sentinel; |
957 }; | 957 }; |
958 | 958 |
959 } // end of namespace llvm | 959 } // end of namespace llvm |
960 | 960 |
961 #endif // SUBZERO_SRC_ICEINST_H | 961 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |