OLD | NEW |
---|---|
(Empty) | |
1 //===- subzero/src/IceIntrinsics.h - List of Ice Intrinsics -----*- C++ -*-===// | |
2 // | |
3 // The Subzero Code Generator | |
4 // | |
5 // This file is distributed under the University of Illinois Open Source | |
6 // License. See LICENSE.TXT for details. | |
7 // | |
8 //===----------------------------------------------------------------------===// | |
9 // | |
10 // This file declares the kinds of intrinsics supported by PNaCl. | |
11 // | |
12 //===----------------------------------------------------------------------===// | |
13 | |
14 #ifndef SUBZERO_SRC_ICEINTRINSICS_H | |
15 #define SUBZERO_SRC_ICEINTRINSICS_H | |
16 | |
17 #include "IceDefs.h" | |
18 | |
19 namespace Ice { | |
20 | |
21 // Some intrinsics allow overloading by type. This enum collapses all | |
22 // overloads into a single ID, but the type can still be recovered by the | |
23 // type of the intrinsic function call's return value and parameters. | |
24 enum IntrinsicID { | |
25 UnknownIntrinsic = 0, | |
26 // Arbitrary (alphabetical) order. | |
27 AtomicCmpxchg, | |
28 AtomicFence, | |
29 AtomicFenceAll, | |
30 AtomicIsLockFree, | |
31 AtomicLoad, | |
32 AtomicRMW, | |
33 AtomicStore, | |
34 Bswap, | |
35 Ctlz, | |
36 Ctpop, | |
37 Cttz, | |
38 Longjmp, | |
39 Memcpy, | |
40 Memmove, | |
41 Memset, | |
42 NaClReadTP, | |
43 Setjmp, | |
44 Sqrt, | |
45 Stacksave, | |
46 Stackrestore, | |
47 Trap | |
48 }; | |
49 | |
50 // Basic attributes related to each intrinsic. We may want to have more | |
51 // attributes (e.g., Setjmp returns twice) once the lowering cares | |
52 // about such attributes, and the attributes representation that can be | |
53 // shared with general function calls. | |
54 struct IntrinsicInfo { | |
55 IntrinsicID ID : 16; | |
56 bool HasSideEffects : 1; | |
57 }; | |
JF
2014/06/10 03:50:41
I'd make this a 31-bit field followed by a 1-bit f
jvoung (off chromium)
2014/06/16 20:51:58
Done.
Though I would like to enforce that Intrins
| |
58 bool operator==(const IntrinsicInfo &A, const IntrinsicInfo &B); | |
59 | |
60 extern const IntrinsicInfo UnknownIntrinsicInfo; | |
61 | |
62 // TODO(jvoung): May want to switch to something like LLVM's StringMap. | |
63 typedef std::map<IceString, IntrinsicInfo> IntrinsicMap; | |
JF
2014/06/10 03:50:41
It would be better to turn all of this into a clas
jvoung (off chromium)
2014/06/16 20:51:58
Done.
| |
64 | |
65 // Fills/Turns OutMap into a map from intrinsic name (e.g., | |
66 // "nacl.atomic.load.i8") into the intrinsic's information. The map assumes | |
67 // that the "llvm." prefix has been stripped from the function name already. | |
68 void BuildIntrinsicMap(IntrinsicMap *OutMap); | |
69 | |
70 } // end of namespace Ice | |
71 | |
72 #endif // SUBZERO_SRC_ICEINTRINSICS_H | |
OLD | NEW |