• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- subzero/src/IceTypes.def - X-macros for 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 defines properties of ICE primitive types in the form of x-macros.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SUBZERO_SRC_ICETYPES_DEF
15#define SUBZERO_SRC_ICETYPES_DEF
16
17// Attributes of each target architecture.
18// NOTES on is_elf64:
19// 1- At some point NaCl would like to use ELF32 for all ILP32 sandboxes, but
20// for now the 64-bit architectures use ELF64:
21//   https://code.google.com/p/nativeclient/issues/detail?id=349
22//
23// 2- native code is always emitted as ELF32.
24//
25// TODO(jpp): set ABI e_flags for AArch64.
26#define TARGETARCH_TABLE                                                       \
27  /* enum value, printable string, is_elf64,   e_machine, e_flags */           \
28  X(Target_X8632, "x86-32", false, EM_386,     0)                              \
29  X(Target_X8664, "x86-64", true,  EM_X86_64,  0)                              \
30  X(Target_ARM32, "arm32",  false, EM_ARM,     EF_ARM_EABI_VER5)               \
31  X(Target_ARM64, "arm64",  true,  EM_AARCH64, 0)                              \
32  X(Target_MIPS32,"mips32", false, EM_MIPS,    EF_MIPS_ABI_O32|EF_MIPS_ARCH_32)\
33//#define X(tag, str, is_elf64, e_machine, e_flags)
34
35#define ICETYPE_TABLE                                                          \
36  /* enum value, log_2(size), align, # elts, element type, */                  \
37  /*     printable string (size and alignment in bytes), */                    \
38  /*     register class string */                                              \
39  X(void,  -1,  0,  1, void, "void",        "void")                            \
40  X(i1,     0,  1,  1, i1,   "i1",          "i1")                              \
41  X(i8,     0,  1,  1, i8,   "i8",          "i8")                              \
42  X(i16,    1,  1,  1, i16,  "i16",         "i16")                             \
43  X(i32,    2,  1,  1, i32,  "i32",         "i32")                             \
44  X(i64,    3,  1,  1, i64,  "i64",         "i64")                             \
45  X(f32,    2,  4,  1, f32,  "float",       "f32")                             \
46  X(f64,    3,  8,  1, f64,  "double",      "f64")                             \
47  X(v4i1,   4,  1,  4, i1,   "<4 x i1>",    "v4i1")                            \
48  X(v8i1,   4,  1,  8, i1,   "<8 x i1>",    "v8i1")                            \
49  X(v16i1,  4,  1, 16, i1,   "<16 x i1>",   "v16i1")                           \
50  X(v16i8,  4,  1, 16, i8,   "<16 x i8>",   "v16i8")                           \
51  X(v8i16,  4,  2,  8, i16,  "<8 x i16>",   "v8i16")                           \
52  X(v4i32,  4,  4,  4, i32,  "<4 x i32>",   "v4i32")                           \
53  X(v4f32,  4,  4,  4, f32,  "<4 x float>", "v4f32")                           \
54//#define X(tag, sizeLog2, align, elts, elty, str, rcstr)
55
56// Dictionary:
57//   V - Is vector type.
58//   I - Is integer value (scalar or vector).
59//   F - Is floating point value (scalar or vector).
60//   IA - Is integer arithmetic type
61//   B - Is Boolean type (scalar or vector).
62//   P  - true if can be used for parameter of call.
63//   CR - Result type of compare instruction for argument type
64//        (IceType_void if disallowed)
65#define ICETYPE_PROPS_TABLE                                                    \
66  /* Enum Value    V  I  F IA  B  P  CR */                                     \
67  X(void,          0, 0, 0, 0, 0, 0, void)                                     \
68  X(i1,            0, 1, 0, 0, 1, 0, i1)                                       \
69  X(i8,            0, 1, 0, 1, 0, 0, i1)                                       \
70  X(i16,           0, 1, 0, 1, 0, 0, i1)                                       \
71  X(i32,           0, 1, 0, 1, 0, 1, i1)                                       \
72  X(i64,           0, 1, 0, 1, 0, 1, i1)                                       \
73  X(f32,           0, 0, 1, 0, 0, 1, i1)                                       \
74  X(f64,           0, 0, 1, 0, 0, 1, i1)                                       \
75  X(v4i1,          1, 1, 0, 0, 1, 1, v4i1)                                     \
76  X(v8i1,          1, 1, 0, 0, 1, 1, v8i1)                                     \
77  X(v16i1,         1, 1, 0, 0, 1, 1, v16i1)                                    \
78  X(v16i8,         1, 1, 0, 1, 0, 1, v16i1)                                    \
79  X(v8i16,         1, 1, 0, 1, 0, 1, v8i1)                                     \
80  X(v4i32,         1, 1, 0, 1, 0, 1, v4i1)                                     \
81  X(v4f32,         1, 0, 1, 0, 0, 1, v4i1)                                     \
82//#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsBoolean, IsParam,
83//          CompareResult)
84
85#endif // SUBZERO_SRC_ICETYPES_DEF
86