Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceTypes.h - Primitive ICE types -------------*- 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 a few properties of the primitive types allowed |
| 11 | // in Subzero. Every Subzero source file is expected to include |
| 12 | // IceTypes.h. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef SUBZERO_SRC_ICETYPES_H |
| 17 | #define SUBZERO_SRC_ICETYPES_H |
| 18 | |
| 19 | #include "IceTypes.def" |
| 20 | |
| 21 | namespace Ice { |
| 22 | |
| 23 | enum Type { |
Matt Wala | 928f129 | 2014-07-07 16:50:46 -0700 | [diff] [blame^] | 24 | #define X(tag, size, align, elts, elty, str) tag, |
Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 25 | ICETYPE_TABLE |
| 26 | #undef X |
Jim Stichnoth | 4376d29 | 2014-05-23 13:39:02 -0700 | [diff] [blame] | 27 | IceType_NUM |
Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 30 | enum TargetArch { |
| 31 | Target_X8632, |
| 32 | Target_X8664, |
| 33 | Target_ARM32, |
| 34 | Target_ARM64 |
| 35 | }; |
| 36 | |
| 37 | enum OptLevel { |
| 38 | Opt_m1, |
| 39 | Opt_0, |
| 40 | Opt_1, |
| 41 | Opt_2 |
| 42 | }; |
| 43 | |
Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 44 | size_t typeWidthInBytes(Type Ty); |
| 45 | size_t typeAlignInBytes(Type Ty); |
Matt Wala | 928f129 | 2014-07-07 16:50:46 -0700 | [diff] [blame^] | 46 | size_t typeNumElements(Type Ty); |
| 47 | Type typeElementType(Type Ty); |
| 48 | |
| 49 | inline bool isVectorType(Type Ty) { return typeNumElements(Ty) > 1; } |
Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 50 | |
| 51 | template <> Ostream &operator<<(class Ostream &Str, const Type &Ty); |
| 52 | |
| 53 | } // end of namespace Ice |
| 54 | |
| 55 | #endif // SUBZERO_SRC_ICETYPES_H |