OLD | NEW |
1 //===- subzero/src/IceSwitchLowering.h - Switch lowering --------*- C++ -*-===// | 1 //===- subzero/src/IceSwitchLowering.h - Switch lowering --------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool tryAppend(const CaseCluster &New); | 74 bool tryAppend(const CaseCluster &New); |
75 }; | 75 }; |
76 | 76 |
77 /// Store the jump table data so that it can be emitted later in the correct ELF | 77 /// Store the jump table data so that it can be emitted later in the correct ELF |
78 /// section once the offsets from the start of the function are known. | 78 /// section once the offsets from the start of the function are known. |
79 class JumpTableData { | 79 class JumpTableData { |
80 JumpTableData() = delete; | 80 JumpTableData() = delete; |
81 JumpTableData &operator=(const JumpTableData &) = delete; | 81 JumpTableData &operator=(const JumpTableData &) = delete; |
82 | 82 |
83 public: | 83 public: |
84 JumpTableData(IceString FuncName, SizeT Id, SizeT NumTargets) | 84 using TargetList = std::vector<intptr_t>; |
85 : FuncName(FuncName), Id(Id) { | 85 |
86 TargetOffsets.reserve(NumTargets); | 86 JumpTableData(const IceString &FuncName, SizeT Id, |
87 } | 87 const TargetList &TargetOffsets) |
| 88 : FuncName(FuncName), Id(Id), TargetOffsets(TargetOffsets) {} |
88 JumpTableData(const JumpTableData &) = default; | 89 JumpTableData(const JumpTableData &) = default; |
89 JumpTableData(JumpTableData &&) = default; | 90 JumpTableData(JumpTableData &&) = default; |
90 JumpTableData &operator=(JumpTableData &&) = default; | 91 JumpTableData &operator=(JumpTableData &&) = default; |
91 | 92 |
92 void pushTarget(intptr_t Offset) { TargetOffsets.emplace_back(Offset); } | |
93 | |
94 const IceString &getFunctionName() const { return FuncName; } | 93 const IceString &getFunctionName() const { return FuncName; } |
95 SizeT getId() const { return Id; } | 94 SizeT getId() const { return Id; } |
96 const std::vector<intptr_t> &getTargetOffsets() const { | 95 const TargetList &getTargetOffsets() const { return TargetOffsets; } |
97 return TargetOffsets; | |
98 } | |
99 | 96 |
100 private: | 97 private: |
101 IceString FuncName; | 98 IceString FuncName; |
102 SizeT Id; | 99 SizeT Id; |
103 std::vector<intptr_t> TargetOffsets; | 100 TargetList TargetOffsets; |
104 }; | 101 }; |
105 | 102 |
106 using JumpTableDataList = std::vector<JumpTableData>; | 103 using JumpTableDataList = std::vector<JumpTableData>; |
107 | 104 |
108 } // end of namespace Ice | 105 } // end of namespace Ice |
109 | 106 |
110 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H | 107 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H |
OLD | NEW |