| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 virtual void dump(const Cfg *Func) const; | 160 virtual void dump(const Cfg *Func) const; |
| 161 virtual void dumpExtras(const Cfg *Func) const; | 161 virtual void dumpExtras(const Cfg *Func) const; |
| 162 void dumpDecorated(const Cfg *Func) const; | 162 void dumpDecorated(const Cfg *Func) const; |
| 163 void emitSources(const Cfg *Func) const; | 163 void emitSources(const Cfg *Func) const; |
| 164 void dumpSources(const Cfg *Func) const; | 164 void dumpSources(const Cfg *Func) const; |
| 165 void dumpDest(const Cfg *Func) const; | 165 void dumpDest(const Cfg *Func) const; |
| 166 virtual bool isRedundantAssign() const { return false; } | 166 virtual bool isRedundantAssign() const { return false; } |
| 167 | 167 |
| 168 virtual ~Inst() = default; | 168 virtual ~Inst() = default; |
| 169 | 169 |
| 170 void setCfgNode(CfgNode *node) { BasicBlock = node; } |
| 171 CfgNode *getCfgNode() const { return BasicBlock; } |
| 172 |
| 170 protected: | 173 protected: |
| 171 Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest); | 174 Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest); |
| 172 void addSource(Operand *Src) { | 175 void addSource(Operand *Src) { |
| 173 assert(Src); | 176 assert(Src); |
| 174 assert(NumSrcs < MaxSrcs); | 177 assert(NumSrcs < MaxSrcs); |
| 175 Srcs[NumSrcs++] = Src; | 178 Srcs[NumSrcs++] = Src; |
| 176 } | 179 } |
| 177 void setLastUse(SizeT VarIndex) { | 180 void setLastUse(SizeT VarIndex) { |
| 178 if (VarIndex < CHAR_BIT * sizeof(LiveRangesEnded)) | 181 if (VarIndex < CHAR_BIT * sizeof(LiveRangesEnded)) |
| 179 LiveRangesEnded |= (((LREndedBits)1u) << VarIndex); | 182 LiveRangesEnded |= (((LREndedBits)1u) << VarIndex); |
| 180 } | 183 } |
| 181 void resetLastUses() { LiveRangesEnded = 0; } | 184 void resetLastUses() { LiveRangesEnded = 0; } |
| 182 /// The destroy() method lets the instruction cleanly release any memory that | 185 /// The destroy() method lets the instruction cleanly release any memory that |
| 183 /// was allocated via the Cfg's allocator. | 186 /// was allocated via the Cfg's allocator. |
| 184 virtual void destroy(Cfg *Func) { Func->deallocateArrayOf<Operand *>(Srcs); } | 187 virtual void destroy(Cfg *Func) { Func->deallocateArrayOf<Operand *>(Srcs); } |
| 185 | 188 |
| 189 /// The CfgNode that contains this instruction |
| 190 CfgNode *BasicBlock = nullptr; |
| 191 |
| 186 const InstKind Kind; | 192 const InstKind Kind; |
| 187 /// Number is the instruction number for describing live ranges. | 193 /// Number is the instruction number for describing live ranges. |
| 188 InstNumberT Number; | 194 InstNumberT Number; |
| 189 /// Deleted means irrevocably deleted. | 195 /// Deleted means irrevocably deleted. |
| 190 bool Deleted = false; | 196 bool Deleted = false; |
| 191 /// Dead means one of two things depending on context: (1) pending deletion | 197 /// Dead means one of two things depending on context: (1) pending deletion |
| 192 /// after liveness analysis converges, or (2) marked for deletion during | 198 /// after liveness analysis converges, or (2) marked for deletion during |
| 193 /// lowering due to a folded bool operation. | 199 /// lowering due to a folded bool operation. |
| 194 bool Dead = false; | 200 bool Dead = false; |
| 195 /// HasSideEffects means the instruction is something like a function call or | 201 /// HasSideEffects means the instruction is something like a function call or |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 InstPhi(const InstPhi &) = delete; | 622 InstPhi(const InstPhi &) = delete; |
| 617 InstPhi &operator=(const InstPhi &) = delete; | 623 InstPhi &operator=(const InstPhi &) = delete; |
| 618 | 624 |
| 619 public: | 625 public: |
| 620 static InstPhi *create(Cfg *Func, SizeT MaxSrcs, Variable *Dest) { | 626 static InstPhi *create(Cfg *Func, SizeT MaxSrcs, Variable *Dest) { |
| 621 return new (Func->allocate<InstPhi>()) InstPhi(Func, MaxSrcs, Dest); | 627 return new (Func->allocate<InstPhi>()) InstPhi(Func, MaxSrcs, Dest); |
| 622 } | 628 } |
| 623 void addArgument(Operand *Source, CfgNode *Label); | 629 void addArgument(Operand *Source, CfgNode *Label); |
| 624 Operand *getOperandForTarget(CfgNode *Target) const; | 630 Operand *getOperandForTarget(CfgNode *Target) const; |
| 625 CfgNode *getLabel(SizeT Index) const { return Labels[Index]; } | 631 CfgNode *getLabel(SizeT Index) const { return Labels[Index]; } |
| 632 void setLabel(SizeT Index, CfgNode *Label) { Labels[Index] = Label; } |
| 626 void livenessPhiOperand(LivenessBV &Live, CfgNode *Target, | 633 void livenessPhiOperand(LivenessBV &Live, CfgNode *Target, |
| 627 Liveness *Liveness); | 634 Liveness *Liveness); |
| 628 Inst *lower(Cfg *Func); | 635 Inst *lower(Cfg *Func); |
| 629 void dump(const Cfg *Func) const override; | 636 void dump(const Cfg *Func) const override; |
| 630 static bool classof(const Inst *Instr) { return Instr->getKind() == Phi; } | 637 static bool classof(const Inst *Instr) { return Instr->getKind() == Phi; } |
| 631 | 638 |
| 632 private: | 639 private: |
| 633 InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest); | 640 InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest); |
| 634 void destroy(Cfg *Func) override { | 641 void destroy(Cfg *Func) override { |
| 635 Func->deallocateArrayOf<CfgNode *>(Labels); | 642 Func->deallocateArrayOf<CfgNode *>(Labels); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 1004 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| 998 void deleteNode(Ice::Inst *) {} | 1005 void deleteNode(Ice::Inst *) {} |
| 999 | 1006 |
| 1000 private: | 1007 private: |
| 1001 mutable ilist_half_node<Ice::Inst> Sentinel; | 1008 mutable ilist_half_node<Ice::Inst> Sentinel; |
| 1002 }; | 1009 }; |
| 1003 | 1010 |
| 1004 } // end of namespace llvm | 1011 } // end of namespace llvm |
| 1005 | 1012 |
| 1006 #endif // SUBZERO_SRC_ICEINST_H | 1013 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |