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 // This file declares the kinds of intrinsics supported by PNaCl. | 10 // This file declares the kinds of intrinsics supported by PNaCl. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MemoryOrderConsume, | 81 MemoryOrderConsume, |
82 MemoryOrderAcquire, | 82 MemoryOrderAcquire, |
83 MemoryOrderRelease, | 83 MemoryOrderRelease, |
84 MemoryOrderAcquireRelease, | 84 MemoryOrderAcquireRelease, |
85 MemoryOrderSequentiallyConsistent, | 85 MemoryOrderSequentiallyConsistent, |
86 MemoryOrderNum // Invalid, keep last. | 86 MemoryOrderNum // Invalid, keep last. |
87 }; | 87 }; |
88 | 88 |
89 static bool VerifyMemoryOrder(uint64_t Order); | 89 static bool VerifyMemoryOrder(uint64_t Order); |
90 | 90 |
| 91 enum SideEffects { |
| 92 SideEffects_F=0, |
| 93 SideEffects_T=1 |
| 94 }; |
| 95 |
| 96 enum ReturnsTwice { |
| 97 ReturnsTwice_F=0, |
| 98 ReturnsTwice_T=1 |
| 99 }; |
| 100 |
91 // Basic attributes related to each intrinsic, that are relevant to | 101 // Basic attributes related to each intrinsic, that are relevant to |
92 // code generation. We will want to have more attributes (e.g., Setjmp | 102 // code generation. Perhaps the attributes representation can be shared |
93 // returns twice and which affects stack coloring) once the lowering | 103 // with general function calls, but PNaCl currently strips all |
94 // cares about such attributes. Perhaps the attributes representation | 104 // attributes from functions. |
95 // can be shared with general function calls, though most functions | |
96 // will be opaque. | |
97 struct IntrinsicInfo { | 105 struct IntrinsicInfo { |
98 IntrinsicID ID : 31; | 106 enum IntrinsicID ID : 30; |
99 bool HasSideEffects : 1; | 107 enum SideEffects HasSideEffects : 1; |
| 108 enum ReturnsTwice ReturnsTwice : 1; |
100 }; | 109 }; |
101 | 110 |
102 // The complete set of information about an intrinsic. | 111 // The complete set of information about an intrinsic. |
103 struct FullIntrinsicInfo { | 112 struct FullIntrinsicInfo { |
104 struct IntrinsicInfo Info; // Information that CodeGen would care about. | 113 struct IntrinsicInfo Info; // Information that CodeGen would care about. |
105 | 114 |
106 // Sanity check during parsing. | 115 // Sanity check during parsing. |
107 Type Signature[kMaxIntrinsicParameters]; | 116 Type Signature[kMaxIntrinsicParameters]; |
108 uint8_t NumTypes; | 117 uint8_t NumTypes; |
109 }; | 118 }; |
110 | 119 |
111 // Find the information about a given intrinsic, based on function name. | 120 // Find the information about a given intrinsic, based on function name. |
112 // The function name is expected to have the common "llvm." prefix | 121 // The function name is expected to have the common "llvm." prefix |
113 // stripped. If found, returns a reference to a FullIntrinsicInfo entry | 122 // stripped. If found, returns a reference to a FullIntrinsicInfo entry |
114 // (valid for the lifetime of the map). Otherwise returns null. | 123 // (valid for the lifetime of the map). Otherwise returns null. |
115 const FullIntrinsicInfo *find(const IceString &Name) const; | 124 const FullIntrinsicInfo *find(const IceString &Name) const; |
116 | 125 |
117 private: | 126 private: |
118 // TODO(jvoung): May want to switch to something like LLVM's StringMap. | 127 // TODO(jvoung): May want to switch to something like LLVM's StringMap. |
119 typedef std::map<IceString, FullIntrinsicInfo> IntrinsicMap; | 128 typedef std::map<IceString, FullIntrinsicInfo> IntrinsicMap; |
120 IntrinsicMap map; | 129 IntrinsicMap map; |
121 | 130 |
122 Intrinsics(const Intrinsics &) LLVM_DELETED_FUNCTION; | 131 Intrinsics(const Intrinsics &) LLVM_DELETED_FUNCTION; |
123 Intrinsics &operator=(const Intrinsics &) LLVM_DELETED_FUNCTION; | 132 Intrinsics &operator=(const Intrinsics &) LLVM_DELETED_FUNCTION; |
124 }; | 133 }; |
125 | 134 |
126 } // end of namespace Ice | 135 } // end of namespace Ice |
127 | 136 |
128 #endif // SUBZERO_SRC_ICEINTRINSICS_H | 137 #endif // SUBZERO_SRC_ICEINTRINSICS_H |
OLD | NEW |