| 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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 class InstJumpTable : public InstHighLevel { | 907 class InstJumpTable : public InstHighLevel { |
| 908 InstJumpTable() = delete; | 908 InstJumpTable() = delete; |
| 909 InstJumpTable(const InstJumpTable &) = delete; | 909 InstJumpTable(const InstJumpTable &) = delete; |
| 910 InstJumpTable &operator=(const InstJumpTable &) = delete; | 910 InstJumpTable &operator=(const InstJumpTable &) = delete; |
| 911 | 911 |
| 912 public: | 912 public: |
| 913 static InstJumpTable *create(Cfg *Func, SizeT NumTargets, CfgNode *Default) { | 913 static InstJumpTable *create(Cfg *Func, SizeT NumTargets, CfgNode *Default) { |
| 914 return new (Func->allocate<InstJumpTable>()) | 914 return new (Func->allocate<InstJumpTable>()) |
| 915 InstJumpTable(Func, NumTargets, Default); | 915 InstJumpTable(Func, NumTargets, Default); |
| 916 } | 916 } |
| 917 void emit(const Cfg *Func) const override; | |
| 918 void emitIAS(const Cfg *Func) const override; | |
| 919 void addTarget(SizeT TargetIndex, CfgNode *Target) { | 917 void addTarget(SizeT TargetIndex, CfgNode *Target) { |
| 920 assert(TargetIndex < NumTargets); | 918 assert(TargetIndex < NumTargets); |
| 921 Targets[TargetIndex] = Target; | 919 Targets[TargetIndex] = Target; |
| 922 } | 920 } |
| 923 bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; | 921 bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; |
| 924 IceString getName(const Cfg *Func) const; | 922 SizeT getId() const { return Id; } |
| 923 SizeT getNumTargets() const { return NumTargets; } |
| 924 CfgNode *getTarget(SizeT I) const { |
| 925 assert(I < NumTargets); |
| 926 return Targets[I]; |
| 927 } |
| 925 void dump(const Cfg *Func) const override; | 928 void dump(const Cfg *Func) const override; |
| 926 static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; } | 929 static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; } |
| 927 | 930 |
| 931 static IceString makeName(const IceString &FuncName, SizeT Id) { |
| 932 return ".L" + FuncName + "$jumptable$__" + std::to_string(Id); |
| 933 } |
| 934 |
| 928 private: | 935 private: |
| 929 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default); | 936 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default); |
| 930 void destroy(Cfg *Func) override { | 937 void destroy(Cfg *Func) override { |
| 931 Func->deallocateArrayOf<CfgNode *>(Targets); | 938 Func->deallocateArrayOf<CfgNode *>(Targets); |
| 932 Inst::destroy(Func); | 939 Inst::destroy(Func); |
| 933 } | 940 } |
| 934 | 941 |
| 935 const SizeT LabelNumber; | 942 const SizeT Id; |
| 936 const SizeT NumTargets; | 943 const SizeT NumTargets; |
| 937 CfgNode **Targets; | 944 CfgNode **Targets; |
| 938 }; | 945 }; |
| 939 | 946 |
| 940 /// The Target instruction is the base class for all target-specific | 947 /// The Target instruction is the base class for all target-specific |
| 941 /// instructions. | 948 /// instructions. |
| 942 class InstTarget : public Inst { | 949 class InstTarget : public Inst { |
| 943 InstTarget() = delete; | 950 InstTarget() = delete; |
| 944 InstTarget(const InstTarget &) = delete; | 951 InstTarget(const InstTarget &) = delete; |
| 945 InstTarget &operator=(const InstTarget &) = delete; | 952 InstTarget &operator=(const InstTarget &) = delete; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 975 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 982 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| 976 void deleteNode(Ice::Inst *) {} | 983 void deleteNode(Ice::Inst *) {} |
| 977 | 984 |
| 978 private: | 985 private: |
| 979 mutable ilist_half_node<Ice::Inst> Sentinel; | 986 mutable ilist_half_node<Ice::Inst> Sentinel; |
| 980 }; | 987 }; |
| 981 | 988 |
| 982 } // end of namespace llvm | 989 } // end of namespace llvm |
| 983 | 990 |
| 984 #endif // SUBZERO_SRC_ICEINST_H | 991 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |