1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#define GCS EA_GCREF
6#define BRS EA_BYREF
7#define PS EA_PTRSIZE
8#define PST (TARGET_POINTER_SIZE / sizeof(int))
9
10#ifdef _TARGET_64BIT_
11#define VTF_I32 0
12#define VTF_I64 VTF_I
13#else
14#define VTF_I32 VTF_I
15#define VTF_I64 0
16#endif
17
18/* tn - TYP_name
19 nm - name string
20 jitType - The jit compresses types that are 'equivalent', this is the jit type genActualType()
21 verType - Used for type checking
22 sz - size in bytes (genTypeSize(t))
23 sze - size in bytes for the emitter (GC types are encoded) (emitTypeSize(t))
24 asze- size in bytes for the emitter (GC types are encoded) (emitActualTypeSize(t))
25 st - stack slots (slots are sizeof(int) bytes) (genTypeStSzs())
26 al - alignment
27 tf - flags
28 howUsed - If a variable is used (referenced) as the type
29
30DEF_TP(tn ,nm , jitType, verType, sz,sze,asze, st,al, tf, howUsed )
31*/
32
33// clang-format off
34DEF_TP(UNDEF ,"<UNDEF>" , TYP_UNDEF, TI_ERROR, 0, 0, 0, 0, 0, VTF_ANY, 0 )
35DEF_TP(VOID ,"void" , TYP_VOID, TI_ERROR, 0, 0, 0, 0, 0, VTF_ANY, 0 )
36
37DEF_TP(BOOL ,"bool" , TYP_INT, TI_BYTE, 1, 1, 4, 1, 1, VTF_INT|VTF_UNS,TYPE_REF_INT)
38DEF_TP(BYTE ,"byte" , TYP_INT, TI_BYTE, 1, 1, 4, 1, 1, VTF_INT, TYPE_REF_INT)
39DEF_TP(UBYTE ,"ubyte" , TYP_INT, TI_BYTE, 1, 1, 4, 1, 1, VTF_INT|VTF_UNS,TYPE_REF_INT)
40
41DEF_TP(SHORT ,"short" , TYP_INT, TI_SHORT, 2, 2, 4, 1, 2, VTF_INT, TYPE_REF_INT)
42DEF_TP(USHORT ,"ushort" , TYP_INT, TI_SHORT, 2, 2, 4, 1, 2, VTF_INT|VTF_UNS,TYPE_REF_INT)
43
44DEF_TP(INT ,"int" , TYP_INT, TI_INT, 4, 4, 4, 1, 4, VTF_INT|VTF_I32, TYPE_REF_INT)
45DEF_TP(UINT ,"uint" , TYP_INT, TI_INT, 4, 4, 4, 1, 4, VTF_INT|VTF_UNS|VTF_I32,TYPE_REF_INT) // Only used in GT_CAST nodes
46
47DEF_TP(LONG ,"long" , TYP_LONG, TI_LONG, 8, PS, PS, 2, 8, VTF_INT|VTF_I64, TYPE_REF_LNG)
48DEF_TP(ULONG ,"ulong" , TYP_LONG, TI_LONG, 8, PS, PS, 2, 8, VTF_INT|VTF_UNS|VTF_I64,TYPE_REF_LNG) // Only used in GT_CAST nodes
49
50DEF_TP(FLOAT ,"float" , TYP_FLOAT, TI_FLOAT, 4, 4, 4, 1, 4, VTF_FLT, TYPE_REF_FLT)
51DEF_TP(DOUBLE ,"double" , TYP_DOUBLE, TI_DOUBLE,8, 8, 8, 2, 8, VTF_FLT, TYPE_REF_DBL)
52
53DEF_TP(REF ,"ref" , TYP_REF, TI_REF, PS,GCS,GCS, PST,PS, VTF_ANY|VTF_GCR|VTF_I,TYPE_REF_PTR)
54DEF_TP(BYREF ,"byref" , TYP_BYREF, TI_ERROR,PS,BRS,BRS, PST,PS, VTF_ANY|VTF_BYR|VTF_I,TYPE_REF_BYR)
55DEF_TP(STRUCT ,"struct" , TYP_STRUCT, TI_STRUCT,0, 0, 0, 1, 4, VTF_S, TYPE_REF_STC)
56
57DEF_TP(BLK ,"blk" , TYP_BLK, TI_ERROR, 0, 0, 0, 1, 4, VTF_ANY, 0 ) // blob of memory
58DEF_TP(LCLBLK ,"lclBlk" , TYP_LCLBLK, TI_ERROR, 0, 0, 0, 1, 4, VTF_ANY, 0 ) // preallocated memory for locspace
59
60#ifdef FEATURE_SIMD
61// Amd64: The size and alignment of SIMD vector varies at JIT time based on whether target arch supports AVX or SSE2.
62DEF_TP(SIMD8 ,"simd8" , TYP_SIMD8, TI_STRUCT, 8, 8, 8, 2, 8, VTF_S, TYPE_REF_STC)
63DEF_TP(SIMD12 ,"simd12" , TYP_SIMD12, TI_STRUCT,12,16, 16, 4,16, VTF_S, TYPE_REF_STC)
64DEF_TP(SIMD16 ,"simd16" , TYP_SIMD16, TI_STRUCT,16,16, 16, 4,16, VTF_S, TYPE_REF_STC)
65DEF_TP(SIMD32 ,"simd32" , TYP_SIMD32, TI_STRUCT,32,32, 32, 8,16, VTF_S, TYPE_REF_STC)
66#endif // FEATURE_SIMD
67
68DEF_TP(UNKNOWN ,"unknown" ,TYP_UNKNOWN, TI_ERROR, 0, 0, 0, 0, 0, VTF_ANY, 0 )
69// clang-format on
70
71#undef GCS
72#undef BRS
73#undef PS
74#undef PST
75#undef VTF_I32
76#undef VTF_I64
77