| 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 |
| 11 /// \brief Helpers for switch lowering. | 11 /// \brief Helpers for switch lowering. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICESWITCHLOWERING_H | 15 #ifndef SUBZERO_SRC_ICESWITCHLOWERING_H |
| 16 #define SUBZERO_SRC_ICESWITCHLOWERING_H | 16 #define SUBZERO_SRC_ICESWITCHLOWERING_H |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceStringPool.h" | 19 #include "IceStringPool.h" |
| 20 | 20 |
| 21 #include <string> |
| 22 |
| 21 namespace Ice { | 23 namespace Ice { |
| 22 | 24 |
| 23 class CaseCluster; | 25 class CaseCluster; |
| 24 | 26 |
| 25 using CaseClusterArray = CfgVector<CaseCluster>; | 27 using CaseClusterArray = CfgVector<CaseCluster>; |
| 26 | 28 |
| 27 /// A cluster of cases can be tested by a common method during switch lowering. | 29 /// A cluster of cases can be tested by a common method during switch lowering. |
| 28 class CaseCluster { | 30 class CaseCluster { |
| 29 CaseCluster() = delete; | 31 CaseCluster() = delete; |
| 30 | 32 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 80 |
| 79 /// Store the jump table data so that it can be emitted later in the correct ELF | 81 /// Store the jump table data so that it can be emitted later in the correct ELF |
| 80 /// section once the offsets from the start of the function are known. | 82 /// section once the offsets from the start of the function are known. |
| 81 class JumpTableData { | 83 class JumpTableData { |
| 82 JumpTableData() = delete; | 84 JumpTableData() = delete; |
| 83 JumpTableData &operator=(const JumpTableData &) = delete; | 85 JumpTableData &operator=(const JumpTableData &) = delete; |
| 84 | 86 |
| 85 public: | 87 public: |
| 86 using TargetList = std::vector<intptr_t>; | 88 using TargetList = std::vector<intptr_t>; |
| 87 | 89 |
| 88 JumpTableData(GlobalString FuncName, SizeT Id, | 90 JumpTableData(GlobalString Name, GlobalString FuncName, SizeT Id, |
| 89 const TargetList &TargetOffsets) | 91 const TargetList &TargetOffsets) |
| 90 : FuncName(FuncName), Id(Id), TargetOffsets(TargetOffsets) {} | 92 : Name(Name), FuncName(FuncName), Id(Id), TargetOffsets(TargetOffsets) {} |
| 91 JumpTableData(const JumpTableData &) = default; | 93 JumpTableData(const JumpTableData &) = default; |
| 92 JumpTableData(JumpTableData &&) = default; | 94 JumpTableData(JumpTableData &&) = default; |
| 93 JumpTableData &operator=(JumpTableData &&) = default; | 95 JumpTableData &operator=(JumpTableData &&) = default; |
| 94 | 96 |
| 95 const GlobalString getFunctionName() const { return FuncName; } | 97 GlobalString getName() const { return Name; } |
| 98 GlobalString getFunctionName() const { return FuncName; } |
| 96 SizeT getId() const { return Id; } | 99 SizeT getId() const { return Id; } |
| 97 const TargetList &getTargetOffsets() const { return TargetOffsets; } | 100 const TargetList &getTargetOffsets() const { return TargetOffsets; } |
| 101 std::string getSectionName() const { |
| 102 if (FuncName.hasStdString()) { |
| 103 return FuncName.toString() + "$jumptable"; |
| 104 } |
| 105 return std::to_string(FuncName.getID()) + "$jumptable"; |
| 106 } |
| 98 | 107 |
| 99 private: | 108 private: |
| 109 GlobalString Name; |
| 100 GlobalString FuncName; | 110 GlobalString FuncName; |
| 101 SizeT Id; | 111 SizeT Id; |
| 102 TargetList TargetOffsets; | 112 TargetList TargetOffsets; |
| 103 }; | 113 }; |
| 104 | 114 |
| 105 using JumpTableDataList = std::vector<JumpTableData>; | 115 using JumpTableDataList = std::vector<JumpTableData>; |
| 106 | 116 |
| 107 } // end of namespace Ice | 117 } // end of namespace Ice |
| 108 | 118 |
| 109 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H | 119 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H |
| OLD | NEW |