| OLD | NEW |
| 1 //===- subzero/src/IceIntrinsics.h - List of Ice Intrinsics -----*- C++ -*-===// | 1 //===- subzero/src/IceIntrinsics.h - List of Ice Intrinsics -----*- 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 |
| 11 /// \brief Declares the kinds of intrinsics supported by PNaCl. | 11 /// \brief Declares the kinds of intrinsics supported by PNaCl. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICEINTRINSICS_H | 15 #ifndef SUBZERO_SRC_ICEINTRINSICS_H |
| 16 #define SUBZERO_SRC_ICEINTRINSICS_H | 16 #define SUBZERO_SRC_ICEINTRINSICS_H |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceStringPool.h" |
| 19 #include "IceTypes.h" | 20 #include "IceTypes.h" |
| 20 | 21 |
| 21 namespace Ice { | 22 namespace Ice { |
| 22 | 23 |
| 23 class InstCall; | 24 class InstCall; |
| 24 | 25 |
| 25 static constexpr size_t kMaxIntrinsicParameters = 6; | 26 static constexpr size_t kMaxIntrinsicParameters = 6; |
| 26 | 27 |
| 27 class Intrinsics { | 28 class Intrinsics { |
| 28 Intrinsics(const Intrinsics &) = delete; | 29 Intrinsics(const Intrinsics &) = delete; |
| 29 Intrinsics &operator=(const Intrinsics &) = delete; | 30 Intrinsics &operator=(const Intrinsics &) = delete; |
| 30 | 31 |
| 31 public: | 32 public: |
| 32 Intrinsics(); | 33 explicit Intrinsics(GlobalContext *Ctx); |
| 33 ~Intrinsics(); | 34 ~Intrinsics() = default; |
| 34 | 35 |
| 35 /// Some intrinsics allow overloading by type. This enum collapses all | 36 /// Some intrinsics allow overloading by type. This enum collapses all |
| 36 /// overloads into a single ID, but the type can still be recovered by the | 37 /// overloads into a single ID, but the type can still be recovered by the |
| 37 /// type of the intrinsic function call's return value and parameters. | 38 /// type of the intrinsic function call's return value and parameters. |
| 38 enum IntrinsicID { | 39 enum IntrinsicID { |
| 39 UnknownIntrinsic = 0, | 40 UnknownIntrinsic = 0, |
| 40 // Arbitrary (alphabetical) order. | 41 // Arbitrary (alphabetical) order. |
| 41 AtomicCmpxchg, | 42 AtomicCmpxchg, |
| 42 AtomicFence, | 43 AtomicFence, |
| 43 AtomicFenceAll, | 44 AtomicFenceAll, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 Type getArgType(SizeT Index) const; | 154 Type getArgType(SizeT Index) const; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 /// Find the information about a given intrinsic, based on function name. If | 157 /// Find the information about a given intrinsic, based on function name. If |
| 157 /// the function name does not have the common "llvm." prefix, nullptr is | 158 /// the function name does not have the common "llvm." prefix, nullptr is |
| 158 /// returned and Error is set to false. Otherwise, tries to find a reference | 159 /// returned and Error is set to false. Otherwise, tries to find a reference |
| 159 /// to a FullIntrinsicInfo entry (valid for the lifetime of the map). If | 160 /// to a FullIntrinsicInfo entry (valid for the lifetime of the map). If |
| 160 /// found, sets Error to false and returns the reference. If not found, sets | 161 /// found, sets Error to false and returns the reference. If not found, sets |
| 161 /// Error to true and returns nullptr (indicating an unknown "llvm.foo" | 162 /// Error to true and returns nullptr (indicating an unknown "llvm.foo" |
| 162 /// intrinsic). | 163 /// intrinsic). |
| 163 const FullIntrinsicInfo *find(const IceString &Name, bool &Error) const; | 164 const FullIntrinsicInfo *find(GlobalString Name, bool &Error) const; |
| 164 | 165 |
| 165 private: | 166 private: |
| 166 // TODO(jvoung): May want to switch to something like LLVM's StringMap. | 167 // TODO(jvoung): May want to switch to something like LLVM's StringMap. |
| 167 using IntrinsicMap = std::map<IceString, FullIntrinsicInfo>; | 168 using IntrinsicMap = std::unordered_map<GlobalString, FullIntrinsicInfo>; |
| 168 IntrinsicMap Map; | 169 IntrinsicMap Map; |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 } // end of namespace Ice | 172 } // end of namespace Ice |
| 172 | 173 |
| 173 #endif // SUBZERO_SRC_ICEINTRINSICS_H | 174 #endif // SUBZERO_SRC_ICEINTRINSICS_H |
| OLD | NEW |