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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 void dump(const Cfg *Func) const override; | 847 void dump(const Cfg *Func) const override; |
848 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; } | 848 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; } |
849 | 849 |
850 private: | 850 private: |
851 InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src); | 851 InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src); |
852 }; | 852 }; |
853 | 853 |
854 /// FakeUse instruction. This creates a fake use of a variable, to keep the | 854 /// FakeUse instruction. This creates a fake use of a variable, to keep the |
855 /// instruction that produces that variable from being dead-code eliminated. | 855 /// instruction that produces that variable from being dead-code eliminated. |
856 /// This is useful in a variety of lowering situations. The FakeUse instruction | 856 /// This is useful in a variety of lowering situations. The FakeUse instruction |
857 /// has no dest, so it can itself never be dead-code eliminated. | 857 /// has no dest, so it can itself never be dead-code eliminated. A weight can |
| 858 /// be provided to provide extra bias to the register allocator - for simplicity |
| 859 /// of implementation, weight=N is handled by holding N copies of the variable |
| 860 /// as source operands. |
858 class InstFakeUse : public InstHighLevel { | 861 class InstFakeUse : public InstHighLevel { |
859 InstFakeUse() = delete; | 862 InstFakeUse() = delete; |
860 InstFakeUse(const InstFakeUse &) = delete; | 863 InstFakeUse(const InstFakeUse &) = delete; |
861 InstFakeUse &operator=(const InstFakeUse &) = delete; | 864 InstFakeUse &operator=(const InstFakeUse &) = delete; |
862 | 865 |
863 public: | 866 public: |
864 static InstFakeUse *create(Cfg *Func, Variable *Src) { | 867 static InstFakeUse *create(Cfg *Func, Variable *Src, uint32_t Weight = 1) { |
865 return new (Func->allocate<InstFakeUse>()) InstFakeUse(Func, Src); | 868 return new (Func->allocate<InstFakeUse>()) InstFakeUse(Func, Src, Weight); |
866 } | 869 } |
867 void emit(const Cfg *Func) const override; | 870 void emit(const Cfg *Func) const override; |
868 void emitIAS(const Cfg * /* Func */) const override {} | 871 void emitIAS(const Cfg * /* Func */) const override {} |
869 void dump(const Cfg *Func) const override; | 872 void dump(const Cfg *Func) const override; |
870 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } | 873 static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } |
871 | 874 |
872 private: | 875 private: |
873 InstFakeUse(Cfg *Func, Variable *Src); | 876 InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight); |
874 }; | 877 }; |
875 | 878 |
876 /// FakeKill instruction. This "kills" a set of variables by modeling a trivial | 879 /// FakeKill instruction. This "kills" a set of variables by modeling a trivial |
877 /// live range at this instruction for each (implicit) variable. The primary use | 880 /// live range at this instruction for each (implicit) variable. The primary use |
878 /// is to indicate that scratch registers are killed after a call, so that the | 881 /// is to indicate that scratch registers are killed after a call, so that the |
879 /// register allocator won't assign a scratch register to a variable whose live | 882 /// register allocator won't assign a scratch register to a variable whose live |
880 /// range spans a call. | 883 /// range spans a call. |
881 /// | 884 /// |
882 /// The FakeKill instruction also holds a pointer to the instruction that kills | 885 /// The FakeKill instruction also holds a pointer to the instruction that kills |
883 /// the set of variables, so that if that linked instruction gets dead-code | 886 /// the set of variables, so that if that linked instruction gets dead-code |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 989 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
987 void deleteNode(Ice::Inst *) {} | 990 void deleteNode(Ice::Inst *) {} |
988 | 991 |
989 private: | 992 private: |
990 mutable ilist_half_node<Ice::Inst> Sentinel; | 993 mutable ilist_half_node<Ice::Inst> Sentinel; |
991 }; | 994 }; |
992 | 995 |
993 } // end of namespace llvm | 996 } // end of namespace llvm |
994 | 997 |
995 #endif // SUBZERO_SRC_ICEINST_H | 998 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |