| 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 IceString getName(const Cfg *Func) const { |
| 924 return makeName(Func->getFunctionName(), Id); |
| 925 } |
| 926 SizeT getNumTargets() const { return NumTargets; } |
| 927 CfgNode *getTarget(SizeT I) const { |
| 928 assert(I < NumTargets); |
| 929 return Targets[I]; |
| 930 } |
| 925 void dump(const Cfg *Func) const override; | 931 void dump(const Cfg *Func) const override; |
| 926 static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; } | 932 static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; } |
| 927 | 933 |
| 934 static IceString makeName(const IceString &FuncName, SizeT Id) { |
| 935 return ".L" + FuncName + "$jumptable$__" + std::to_string(Id); |
| 936 } |
| 937 |
| 928 private: | 938 private: |
| 929 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default); | 939 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default); |
| 930 void destroy(Cfg *Func) override { | 940 void destroy(Cfg *Func) override { |
| 931 Func->deallocateArrayOf<CfgNode *>(Targets); | 941 Func->deallocateArrayOf<CfgNode *>(Targets); |
| 932 Inst::destroy(Func); | 942 Inst::destroy(Func); |
| 933 } | 943 } |
| 934 | 944 |
| 935 const SizeT LabelNumber; | 945 const SizeT Id; |
| 936 const SizeT NumTargets; | 946 const SizeT NumTargets; |
| 937 CfgNode **Targets; | 947 CfgNode **Targets; |
| 938 }; | 948 }; |
| 939 | 949 |
| 940 /// The Target instruction is the base class for all target-specific | 950 /// The Target instruction is the base class for all target-specific |
| 941 /// instructions. | 951 /// instructions. |
| 942 class InstTarget : public Inst { | 952 class InstTarget : public Inst { |
| 943 InstTarget() = delete; | 953 InstTarget() = delete; |
| 944 InstTarget(const InstTarget &) = delete; | 954 InstTarget(const InstTarget &) = delete; |
| 945 InstTarget &operator=(const InstTarget &) = delete; | 955 InstTarget &operator=(const InstTarget &) = delete; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 975 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 985 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| 976 void deleteNode(Ice::Inst *) {} | 986 void deleteNode(Ice::Inst *) {} |
| 977 | 987 |
| 978 private: | 988 private: |
| 979 mutable ilist_half_node<Ice::Inst> Sentinel; | 989 mutable ilist_half_node<Ice::Inst> Sentinel; |
| 980 }; | 990 }; |
| 981 | 991 |
| 982 } // end of namespace llvm | 992 } // end of namespace llvm |
| 983 | 993 |
| 984 #endif // SUBZERO_SRC_ICEINST_H | 994 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |