Chromium Code Reviews| Index: src/IceIntrinsics.h |
| diff --git a/src/IceIntrinsics.h b/src/IceIntrinsics.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cd758ca6290dcb5be908e4a69c68ca8209627df9 |
| --- /dev/null |
| +++ b/src/IceIntrinsics.h |
| @@ -0,0 +1,72 @@ |
| +//===- subzero/src/IceIntrinsics.h - List of Ice Intrinsics -----*- C++ -*-===// |
| +// |
| +// The Subzero Code Generator |
| +// |
| +// This file is distributed under the University of Illinois Open Source |
| +// License. See LICENSE.TXT for details. |
| +// |
| +//===----------------------------------------------------------------------===// |
| +// |
| +// This file declares the kinds of intrinsics supported by PNaCl. |
| +// |
| +//===----------------------------------------------------------------------===// |
| + |
| +#ifndef SUBZERO_SRC_ICEINTRINSICS_H |
| +#define SUBZERO_SRC_ICEINTRINSICS_H |
| + |
| +#include "IceDefs.h" |
| + |
| +namespace Ice { |
| + |
| +// Some intrinsics allow overloading by type. This enum collapses all |
| +// overloads into a single ID, but the type can still be recovered by the |
| +// type of the intrinsic function call's return value and parameters. |
| +enum IntrinsicID { |
| + UnknownIntrinsic = 0, |
| + // Arbitrary (alphabetical) order. |
| + AtomicCmpxchg, |
| + AtomicFence, |
| + AtomicFenceAll, |
| + AtomicIsLockFree, |
| + AtomicLoad, |
| + AtomicRMW, |
| + AtomicStore, |
| + Bswap, |
| + Ctlz, |
| + Ctpop, |
| + Cttz, |
| + Longjmp, |
| + Memcpy, |
| + Memmove, |
| + Memset, |
| + NaClReadTP, |
| + Setjmp, |
| + Sqrt, |
| + Stacksave, |
| + Stackrestore, |
| + Trap |
| +}; |
| + |
| +// Basic attributes related to each intrinsic. We may want to have more |
| +// attributes (e.g., Setjmp returns twice) once the lowering cares |
| +// about such attributes, and the attributes representation that can be |
| +// shared with general function calls. |
| +struct IntrinsicInfo { |
| + IntrinsicID ID : 16; |
| + bool HasSideEffects : 1; |
| +}; |
|
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
|
| +bool operator==(const IntrinsicInfo &A, const IntrinsicInfo &B); |
| + |
| +extern const IntrinsicInfo UnknownIntrinsicInfo; |
| + |
| +// TODO(jvoung): May want to switch to something like LLVM's StringMap. |
| +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.
|
| + |
| +// Fills/Turns OutMap into a map from intrinsic name (e.g., |
| +// "nacl.atomic.load.i8") into the intrinsic's information. The map assumes |
| +// that the "llvm." prefix has been stripped from the function name already. |
| +void BuildIntrinsicMap(IntrinsicMap *OutMap); |
| + |
| +} // end of namespace Ice |
| + |
| +#endif // SUBZERO_SRC_ICEINTRINSICS_H |