forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIRType.cpp
More file actions
65 lines (56 loc) · 1.92 KB
/
IRType.cpp
File metadata and controls
65 lines (56 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Backend.h"
int const TySize[] = {
#define IRTYPE(ucname, baseType, size, bitSize, enRegOk, dname) size,
#include "IRTypeList.h"
#undef IRTYPE
};
enum IRBaseTypes : BYTE {
IRBaseType_Illegal,
IRBaseType_Int,
IRBaseType_Uint,
IRBaseType_Float,
IRBaseType_Simd,
IRBaseType_Var,
IRBaseType_Condcode,
IRBaseType_Misc
};
int const TyBaseType[] = {
#define IRTYPE(ucname, baseType, size, bitSize, enRegOk, dname) IRBaseType_ ## baseType,
#include "IRTypeList.h"
#undef IRTYPE
};
const char16 * const TyDumpName[] = {
#define IRTYPE(ucname, baseType, size, bitSize, enRegOk, dname) _u(#dname),
#include "IRTypeList.h"
#undef IRTYPE
};
bool IRType_IsSignedInt(IRType type) { return TyBaseType[type] == IRBaseType_Int; }
bool IRType_IsUnsignedInt(IRType type) { return TyBaseType[type] == IRBaseType_Uint; }
bool IRType_IsFloat(IRType type) { return TyBaseType[type] == IRBaseType_Float; }
bool IRType_IsNative(IRType type)
{
return TyBaseType[type] > IRBaseType_Illegal && TyBaseType[type] < IRBaseType_Var;
}
bool IRType_IsNativeInt(IRType type)
{
return TyBaseType[type] > IRBaseType_Illegal && TyBaseType[type] < IRBaseType_Float;
}
bool IRType_IsInt64(IRType type) { return type == TyInt64 || type == TyUint64; }
bool IRType_IsSimd(IRType type)
{
return TyBaseType[type] == IRBaseType_Simd;
}
bool IRType_IsSimd128(IRType type)
{
return type >= TySimd128F4 && type <= TySimd128D2;
}
#if DBG_DUMP || defined(ENABLE_IR_VIEWER)
void IRType_Dump(IRType type)
{
Output::Print(TyDumpName[type]);
}
#endif