-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype.easy
101 lines (80 loc) · 1.46 KB
/
type.easy
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
VoidType: {
getIR: "void";
};
UndefType: {
getIR: "undef";
};
VarargType: {
getIR: "...";
};
IntegerType: [
{
INTEGER: {};
size:;
getIR: ["i" size toText &] func;
}
] func;
FloatType: [
FloatType': [UnsupportedSizeError] func;
FloatType': [16 =] [drop "half"] pfunc;
FloatType': [32 =] [drop "float"] pfunc;
FloatType': [64 =] [drop "double"] pfunc;
FloatType': [128 =] [drop "fp128"] pfunc;
{
FLOAT: {};
size:;
getIR: size FloatType';
}
] func;
ArrayType: [
{
ARRAY: {};
size:;
type:;
getIR: ["[" size toText " x " type.getIR "]" & & & &] func;
}
] func;
StructType: [
{
STRUCT: {};
typeList:;
getIR: ["{ " typeList [.getIR] getListIR " }" & &] func;
}
] func;
PackedStructType: [
{
STRUCT: {};
typeList:;
getIR: ["<{ " typeList [.getIR] getListIR " }>" & &] func;
}
] func;
FunctionType: [
{
FUNCTION: {};
retType:inputTypes:;;
getIR: [retType.getIR " (" inputTypes [.getIR] getListIR ")" & & &] func;
}
] func;
PointerType: [
{
POINTER: {};
type:;
getIR: [type.getIR "*" &] func;
}
] func;
AliasType: [
{
ALIAS: {};
name:type:;;
getIR: ["%" name &] func;
getDefIR: ["%" name " = type " & & type.getIR LF & &] func;
}
] func;
OpaqueType: [
{
name:;
getIR: ["%" name &] func;
getDefIR: ["%" name " = opaque" LF & & &] func;
}
] func;
=: [left:right:;; left.getIR right.getIR =] [drop drop TRUE] pfunc;