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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // Updates the status of the Variables contained within the | 95 // Updates the status of the Variables contained within the |
96 // instruction. In particular, it marks where the Dest variable is | 96 // instruction. In particular, it marks where the Dest variable is |
97 // first assigned, and it tracks whether variables are live across | 97 // first assigned, and it tracks whether variables are live across |
98 // basic blocks, i.e. used in a different block from their definition. | 98 // basic blocks, i.e. used in a different block from their definition. |
99 void updateVars(CfgNode *Node); | 99 void updateVars(CfgNode *Node); |
100 | 100 |
101 void livenessLightweight(llvm::BitVector &Live); | 101 void livenessLightweight(llvm::BitVector &Live); |
102 void liveness(InstNumberT InstNumber, llvm::BitVector &Live, | 102 void liveness(InstNumberT InstNumber, llvm::BitVector &Live, |
103 Liveness *Liveness, const CfgNode *Node); | 103 Liveness *Liveness, const CfgNode *Node); |
| 104 |
| 105 // Get the number of native instructions that this instruction |
| 106 // ultimately emits. By default, high-level instructions don't |
| 107 // result in any native instructions, and a target-specific |
| 108 // instruction results in a single native instruction. |
| 109 virtual uint32_t getEmitInstCount() const { return 0; } |
104 virtual void emit(const Cfg *Func) const; | 110 virtual void emit(const Cfg *Func) const; |
105 virtual void dump(const Cfg *Func) const; | 111 virtual void dump(const Cfg *Func) const; |
106 virtual void dumpExtras(const Cfg *Func) const; | 112 virtual void dumpExtras(const Cfg *Func) const; |
107 void dumpDecorated(const Cfg *Func) const; | 113 void dumpDecorated(const Cfg *Func) const; |
108 void emitSources(const Cfg *Func) const; | 114 void emitSources(const Cfg *Func) const; |
109 void dumpSources(const Cfg *Func) const; | 115 void dumpSources(const Cfg *Func) const; |
110 void dumpDest(const Cfg *Func) const; | 116 void dumpDest(const Cfg *Func) const; |
111 virtual bool isRedundantAssign() const { return false; } | 117 virtual bool isRedundantAssign() const { return false; } |
112 | 118 |
113 virtual ~Inst() {} | 119 virtual ~Inst() {} |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 virtual ~InstFakeKill() {} | 743 virtual ~InstFakeKill() {} |
738 | 744 |
739 // This instruction is ignored if Linked->isDeleted() is true. | 745 // This instruction is ignored if Linked->isDeleted() is true. |
740 const Inst *Linked; | 746 const Inst *Linked; |
741 }; | 747 }; |
742 | 748 |
743 // The Target instruction is the base class for all target-specific | 749 // The Target instruction is the base class for all target-specific |
744 // instructions. | 750 // instructions. |
745 class InstTarget : public Inst { | 751 class InstTarget : public Inst { |
746 public: | 752 public: |
| 753 virtual uint32_t getEmitInstCount() const { return 1; } |
747 virtual void emit(const Cfg *Func) const = 0; | 754 virtual void emit(const Cfg *Func) const = 0; |
748 virtual void dump(const Cfg *Func) const; | 755 virtual void dump(const Cfg *Func) const; |
749 virtual void dumpExtras(const Cfg *Func) const; | 756 virtual void dumpExtras(const Cfg *Func) const; |
750 static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } | 757 static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } |
751 | 758 |
752 protected: | 759 protected: |
753 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) | 760 InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) |
754 : Inst(Func, Kind, MaxSrcs, Dest) { | 761 : Inst(Func, Kind, MaxSrcs, Dest) { |
755 assert(Kind >= Target); | 762 assert(Kind >= Target); |
756 } | 763 } |
757 InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; | 764 InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; |
758 InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; | 765 InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; |
759 virtual ~InstTarget() {} | 766 virtual ~InstTarget() {} |
760 }; | 767 }; |
761 | 768 |
762 } // end of namespace Ice | 769 } // end of namespace Ice |
763 | 770 |
764 #endif // SUBZERO_SRC_ICEINST_H | 771 #endif // SUBZERO_SRC_ICEINST_H |
OLD | NEW |