| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 void emit(const Cfg *Func) const override; | 775 void emit(const Cfg *Func) const override; |
| 776 void emitIAS(const Cfg * /* Func */) const override {} | 776 void emitIAS(const Cfg * /* Func */) const override {} |
| 777 void dump(const Cfg *Func) const override; | 777 void dump(const Cfg *Func) const override; |
| 778 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } | 778 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } |
| 779 | 779 |
| 780 private: | 780 private: |
| 781 InstFakeUse(Cfg *Func, Variable *Src); | 781 InstFakeUse(Cfg *Func, Variable *Src); |
| 782 ~InstFakeUse() override {} | 782 ~InstFakeUse() override {} |
| 783 }; | 783 }; |
| 784 | 784 |
| 785 // FakeKill instruction. This "kills" a set of variables by adding a | 785 // FakeKill instruction. This "kills" a set of variables by modeling |
| 786 // trivial live range at this instruction to each variable. The | 786 // a trivial live range at this instruction for each (implicit) |
| 787 // primary use is to indicate that scratch registers are killed after | 787 // variable. The primary use is to indicate that scratch registers |
| 788 // a call, so that the register allocator won't assign a scratch | 788 // are killed after a call, so that the register allocator won't |
| 789 // register to a variable whose live range spans a call. | 789 // assign a scratch register to a variable whose live range spans a |
| 790 // call. |
| 790 // | 791 // |
| 791 // The FakeKill instruction also holds a pointer to the instruction | 792 // The FakeKill instruction also holds a pointer to the instruction |
| 792 // that kills the set of variables, so that if that linked instruction | 793 // that kills the set of variables, so that if that linked instruction |
| 793 // gets dead-code eliminated, the FakeKill instruction will as well. | 794 // gets dead-code eliminated, the FakeKill instruction will as well. |
| 794 class InstFakeKill : public InstHighLevel { | 795 class InstFakeKill : public InstHighLevel { |
| 795 InstFakeKill(const InstFakeKill &) = delete; | 796 InstFakeKill(const InstFakeKill &) = delete; |
| 796 InstFakeKill &operator=(const InstFakeKill &) = delete; | 797 InstFakeKill &operator=(const InstFakeKill &) = delete; |
| 797 | 798 |
| 798 public: | 799 public: |
| 799 static InstFakeKill *create(Cfg *Func, const VarList &KilledRegs, | 800 static InstFakeKill *create(Cfg *Func, const Inst *Linked) { |
| 800 const Inst *Linked) { | 801 return new (Func->allocateInst<InstFakeKill>()) InstFakeKill(Func, Linked); |
| 801 return new (Func->allocateInst<InstFakeKill>()) | |
| 802 InstFakeKill(Func, KilledRegs, Linked); | |
| 803 } | 802 } |
| 804 const VarList &getKilledRegs() const { return KilledRegs; } | |
| 805 const Inst *getLinked() const { return Linked; } | 803 const Inst *getLinked() const { return Linked; } |
| 806 void emit(const Cfg *Func) const override; | 804 void emit(const Cfg *Func) const override; |
| 807 void emitIAS(const Cfg * /* Func */) const override {} | 805 void emitIAS(const Cfg * /* Func */) const override {} |
| 808 void dump(const Cfg *Func) const override; | 806 void dump(const Cfg *Func) const override; |
| 809 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; } | 807 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; } |
| 810 | 808 |
| 811 private: | 809 private: |
| 812 InstFakeKill(Cfg *Func, const VarList &KilledRegs, const Inst *Linked); | 810 InstFakeKill(Cfg *Func, const Inst *Linked); |
| 813 ~InstFakeKill() override {} | 811 ~InstFakeKill() override {} |
| 814 | 812 |
| 815 const VarList &KilledRegs; | |
| 816 // This instruction is ignored if Linked->isDeleted() is true. | 813 // This instruction is ignored if Linked->isDeleted() is true. |
| 817 const Inst *Linked; | 814 const Inst *Linked; |
| 818 }; | 815 }; |
| 819 | 816 |
| 820 // The Target instruction is the base class for all target-specific | 817 // The Target instruction is the base class for all target-specific |
| 821 // instructions. | 818 // instructions. |
| 822 class InstTarget : public Inst { | 819 class InstTarget : public Inst { |
| 823 InstTarget(const InstTarget &) = delete; | 820 InstTarget(const InstTarget &) = delete; |
| 824 InstTarget &operator=(const InstTarget &) = delete; | 821 InstTarget &operator=(const InstTarget &) = delete; |
| 825 | 822 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 850 Ice::Inst *provideInitialHead() const { return createSentinel(); } | 847 Ice::Inst *provideInitialHead() const { return createSentinel(); } |
| 851 Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } | 848 Ice::Inst *ensureHead(Ice::Inst *) const { return createSentinel(); } |
| 852 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 849 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| 853 void deleteNode(Ice::Inst *) {} | 850 void deleteNode(Ice::Inst *) {} |
| 854 | 851 |
| 855 private: | 852 private: |
| 856 mutable ilist_half_node<Ice::Inst> Sentinel; | 853 mutable ilist_half_node<Ice::Inst> Sentinel; |
| 857 }; | 854 }; |
| 858 | 855 |
| 859 #endif // SUBZERO_SRC_ICEINST_H | 856 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |