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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
//===- HexagonImmediates.td - Hexagon immediate processing -*- tablegen -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illnois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
def s32_0ImmOperand : AsmOperandClass { let Name = "s32_0Imm"; }
def s23_2ImmOperand : AsmOperandClass { let Name = "s23_2Imm"; }
def s8_0ImmOperand : AsmOperandClass { let Name = "s8_0Imm"; }
def s8_0Imm64Operand : AsmOperandClass { let Name = "s8_0Imm64"; }
def s6_0ImmOperand : AsmOperandClass { let Name = "s6_0Imm"; }
def s4_0ImmOperand : AsmOperandClass { let Name = "s4_0Imm"; }
def s4_1ImmOperand : AsmOperandClass { let Name = "s4_1Imm"; }
def s4_2ImmOperand : AsmOperandClass { let Name = "s4_2Imm"; }
def s4_3ImmOperand : AsmOperandClass { let Name = "s4_3Imm"; }
def s4_6ImmOperand : AsmOperandClass { let Name = "s4_6Imm"; }
def s3_6ImmOperand : AsmOperandClass { let Name = "s3_6Imm"; }
def u64_0ImmOperand : AsmOperandClass { let Name = "u64_0Imm"; }
def u32_0ImmOperand : AsmOperandClass { let Name = "u32_0Imm"; }
def u26_6ImmOperand : AsmOperandClass { let Name = "u26_6Imm"; }
def u16_0ImmOperand : AsmOperandClass { let Name = "u16_0Imm"; }
def u16_1ImmOperand : AsmOperandClass { let Name = "u16_1Imm"; }
def u16_2ImmOperand : AsmOperandClass { let Name = "u16_2Imm"; }
def u16_3ImmOperand : AsmOperandClass { let Name = "u16_3Imm"; }
def u11_3ImmOperand : AsmOperandClass { let Name = "u11_3Imm"; }
def u10_0ImmOperand : AsmOperandClass { let Name = "u10_0Imm"; }
def u9_0ImmOperand : AsmOperandClass { let Name = "u9_0Imm"; }
def u8_0ImmOperand : AsmOperandClass { let Name = "u8_0Imm"; }
def u7_0ImmOperand : AsmOperandClass { let Name = "u7_0Imm"; }
def u6_0ImmOperand : AsmOperandClass { let Name = "u6_0Imm"; }
def u6_1ImmOperand : AsmOperandClass { let Name = "u6_1Imm"; }
def u6_2ImmOperand : AsmOperandClass { let Name = "u6_2Imm"; }
def u6_3ImmOperand : AsmOperandClass { let Name = "u6_3Imm"; }
def u5_0ImmOperand : AsmOperandClass { let Name = "u5_0Imm"; }
def u4_0ImmOperand : AsmOperandClass { let Name = "u4_0Imm"; }
def u3_0ImmOperand : AsmOperandClass { let Name = "u3_0Imm"; }
def u2_0ImmOperand : AsmOperandClass { let Name = "u2_0Imm"; }
def u1_0ImmOperand : AsmOperandClass { let Name = "u1_0Imm"; }
def n8_0ImmOperand : AsmOperandClass { let Name = "n8_0Imm"; }
// Immediate operands.
let OperandType = "OPERAND_IMMEDIATE",
DecoderMethod = "unsignedImmDecoder" in {
def s32_0Imm : Operand<i32> { let ParserMatchClass = s32_0ImmOperand;
let DecoderMethod = "s32_0ImmDecoder"; }
def s23_2Imm : Operand<i32> { let ParserMatchClass = s23_2ImmOperand; }
def s8_0Imm : Operand<i32> { let ParserMatchClass = s8_0ImmOperand;
let DecoderMethod = "s8_0ImmDecoder"; }
def s8_0Imm64 : Operand<i64> { let ParserMatchClass = s8_0Imm64Operand;
let DecoderMethod = "s8_0ImmDecoder"; }
def s6_0Imm : Operand<i32> { let ParserMatchClass = s6_0ImmOperand;
let DecoderMethod = "s6_0ImmDecoder"; }
def s6_3Imm : Operand<i32>;
def s4_0Imm : Operand<i32> { let ParserMatchClass = s4_0ImmOperand;
let DecoderMethod = "s4_0ImmDecoder"; }
def s4_1Imm : Operand<i32> { let ParserMatchClass = s4_1ImmOperand;
let DecoderMethod = "s4_1ImmDecoder"; }
def s4_2Imm : Operand<i32> { let ParserMatchClass = s4_2ImmOperand;
let DecoderMethod = "s4_2ImmDecoder"; }
def s4_3Imm : Operand<i32> { let ParserMatchClass = s4_3ImmOperand;
let DecoderMethod = "s4_3ImmDecoder"; }
def u64_0Imm : Operand<i64> { let ParserMatchClass = u64_0ImmOperand; }
def u32_0Imm : Operand<i32> { let ParserMatchClass = u32_0ImmOperand; }
def u26_6Imm : Operand<i32> { let ParserMatchClass = u26_6ImmOperand; }
def u16_0Imm : Operand<i32> { let ParserMatchClass = u16_0ImmOperand; }
def u16_1Imm : Operand<i32> { let ParserMatchClass = u16_1ImmOperand; }
def u16_2Imm : Operand<i32> { let ParserMatchClass = u16_2ImmOperand; }
def u16_3Imm : Operand<i32> { let ParserMatchClass = u16_3ImmOperand; }
def u11_3Imm : Operand<i32> { let ParserMatchClass = u11_3ImmOperand; }
def u10_0Imm : Operand<i32> { let ParserMatchClass = u10_0ImmOperand; }
def u9_0Imm : Operand<i32> { let ParserMatchClass = u9_0ImmOperand; }
def u8_0Imm : Operand<i32> { let ParserMatchClass = u8_0ImmOperand; }
def u7_0Imm : Operand<i32> { let ParserMatchClass = u7_0ImmOperand; }
def u6_0Imm : Operand<i32> { let ParserMatchClass = u6_0ImmOperand; }
def u6_1Imm : Operand<i32> { let ParserMatchClass = u6_1ImmOperand; }
def u6_2Imm : Operand<i32> { let ParserMatchClass = u6_2ImmOperand; }
def u6_3Imm : Operand<i32> { let ParserMatchClass = u6_3ImmOperand; }
def u5_0Imm : Operand<i32> { let ParserMatchClass = u5_0ImmOperand; }
def u5_1Imm : Operand<i32>;
def u5_2Imm : Operand<i32>;
def u5_3Imm : Operand<i32>;
def u4_0Imm : Operand<i32> { let ParserMatchClass = u4_0ImmOperand; }
def u4_1Imm : Operand<i32>;
def u4_2Imm : Operand<i32>;
def u4_3Imm : Operand<i32>;
def u3_0Imm : Operand<i32> { let ParserMatchClass = u3_0ImmOperand; }
def u3_1Imm : Operand<i32>;
def u3_2Imm : Operand<i32>;
def u3_3Imm : Operand<i32>;
def u2_0Imm : Operand<i32> { let ParserMatchClass = u2_0ImmOperand; }
def u1_0Imm : Operand<i32> { let ParserMatchClass = u1_0ImmOperand; }
def n8_0Imm : Operand<i32> { let ParserMatchClass = n8_0ImmOperand; }
}
let OperandType = "OPERAND_IMMEDIATE" in {
def s4_6Imm : Operand<i32> { let ParserMatchClass = s4_6ImmOperand;
let PrintMethod = "prints4_6ImmOperand";
let DecoderMethod = "s4_6ImmDecoder";}
def s4_7Imm : Operand<i32> { let PrintMethod = "prints4_7ImmOperand";
let DecoderMethod = "s4_6ImmDecoder";}
def s3_6Imm : Operand<i32> { let ParserMatchClass = s3_6ImmOperand;
let PrintMethod = "prints3_6ImmOperand";
let DecoderMethod = "s3_6ImmDecoder";}
def s3_7Imm : Operand<i32> { let PrintMethod = "prints3_7ImmOperand";
let DecoderMethod = "s3_6ImmDecoder";}
}
def n1ConstOperand : AsmOperandClass { let Name = "n1Const"; }
def n1Const : Operand<i32> { let ParserMatchClass = n1ConstOperand; }
//
// Immediate predicates
//
def s32_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<32>(v);
}]>;
def s31_1ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<31,1>(v);
}]>;
def s30_2ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<30,2>(v);
}]>;
def s29_3ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<29,3>(v);
}]>;
def s10_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<10>(v);
}]>;
def s8_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<8>(v);
}]>;
def s8_0Imm64Pred : PatLeaf<(i64 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<8>(v);
}]>;
def s6_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<6>(v);
}]>;
def s4_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isInt<4>(v);
}]>;
def s4_1ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<4,1>(v);
}]>;
def s4_2ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<4,2>(v);
}]>;
def s4_3ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedInt<4,3>(v);
}]>;
def u32_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<32>(v);
}]>;
def u16_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<16>(v);
}]>;
def u11_3ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedUInt<11,3>(v);
}]>;
def u9_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<9>(v);
}]>;
def u8_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<8>(v);
}]>;
def u6_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<6>(v);
}]>;
def u6_1ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedUInt<6,1>(v);
}]>;
def u6_2ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isShiftedUInt<6,2>(v);
}]>;
def u5_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<5>(v);
}]>;
def u4_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<4>(v);
}]>;
def u3_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<3>(v);
}]>;
def u2_0ImmPred : PatLeaf<(i32 imm), [{
int64_t v = (int64_t)N->getSExtValue();
return isUInt<2>(v);
}]>;
// Extendable immediate operands.
def f32ExtOperand : AsmOperandClass { let Name = "f32Ext"; }
def s16_0ExtOperand : AsmOperandClass { let Name = "s16_0Ext"; }
def s12_0ExtOperand : AsmOperandClass { let Name = "s12_0Ext"; }
def s10_0ExtOperand : AsmOperandClass { let Name = "s10_0Ext"; }
def s9_0ExtOperand : AsmOperandClass { let Name = "s9_0Ext"; }
def s8_0ExtOperand : AsmOperandClass { let Name = "s8_0Ext"; }
def s7_0ExtOperand : AsmOperandClass { let Name = "s7_0Ext"; }
def s6_0ExtOperand : AsmOperandClass { let Name = "s6_0Ext"; }
def s11_0ExtOperand : AsmOperandClass { let Name = "s11_0Ext"; }
def s11_1ExtOperand : AsmOperandClass { let Name = "s11_1Ext"; }
def s11_2ExtOperand : AsmOperandClass { let Name = "s11_2Ext"; }
def s11_3ExtOperand : AsmOperandClass { let Name = "s11_3Ext"; }
def u6_0ExtOperand : AsmOperandClass { let Name = "u6_0Ext"; }
def u7_0ExtOperand : AsmOperandClass { let Name = "u7_0Ext"; }
def u8_0ExtOperand : AsmOperandClass { let Name = "u8_0Ext"; }
def u9_0ExtOperand : AsmOperandClass { let Name = "u9_0Ext"; }
def u10_0ExtOperand : AsmOperandClass { let Name = "u10_0Ext"; }
def u6_1ExtOperand : AsmOperandClass { let Name = "u6_1Ext"; }
def u6_2ExtOperand : AsmOperandClass { let Name = "u6_2Ext"; }
def u6_3ExtOperand : AsmOperandClass { let Name = "u6_3Ext"; }
def u32_0MustExtOperand : AsmOperandClass { let Name = "u32_0MustExt"; }
let OperandType = "OPERAND_IMMEDIATE", PrintMethod = "printExtOperand",
DecoderMethod = "unsignedImmDecoder" in {
def f32Ext : Operand<f32> { let ParserMatchClass = f32ExtOperand; }
def s16_0Ext : Operand<i32> { let ParserMatchClass = s16_0ExtOperand;
let DecoderMethod = "s16_0ImmDecoder"; }
def s12_0Ext : Operand<i32> { let ParserMatchClass = s12_0ExtOperand;
let DecoderMethod = "s12_0ImmDecoder"; }
def s11_0Ext : Operand<i32> { let ParserMatchClass = s11_0ExtOperand;
let DecoderMethod = "s11_0ImmDecoder"; }
def s11_1Ext : Operand<i32> { let ParserMatchClass = s11_1ExtOperand;
let DecoderMethod = "s11_1ImmDecoder"; }
def s11_2Ext : Operand<i32> { let ParserMatchClass = s11_2ExtOperand;
let DecoderMethod = "s11_2ImmDecoder"; }
def s11_3Ext : Operand<i32> { let ParserMatchClass = s11_3ExtOperand;
let DecoderMethod = "s11_3ImmDecoder"; }
def s10_0Ext : Operand<i32> { let ParserMatchClass = s10_0ExtOperand;
let DecoderMethod = "s10_0ImmDecoder"; }
def s9_0Ext : Operand<i32> { let ParserMatchClass = s9_0ExtOperand;
let DecoderMethod = "s9_0ImmDecoder"; }
def s8_0Ext : Operand<i32> { let ParserMatchClass = s8_0ExtOperand;
let DecoderMethod = "s8_0ImmDecoder"; }
def s7_0Ext : Operand<i32> { let ParserMatchClass = s7_0ExtOperand; }
def s6_0Ext : Operand<i32> { let ParserMatchClass = s6_0ExtOperand;
let DecoderMethod = "s6_0ImmDecoder"; }
def u7_0Ext : Operand<i32> { let ParserMatchClass = u7_0ExtOperand; }
def u8_0Ext : Operand<i32> { let ParserMatchClass = u8_0ExtOperand; }
def u9_0Ext : Operand<i32> { let ParserMatchClass = u9_0ExtOperand; }
def u10_0Ext : Operand<i32> { let ParserMatchClass = u10_0ExtOperand; }
def u6_0Ext : Operand<i32> { let ParserMatchClass = u6_0ExtOperand; }
def u6_1Ext : Operand<i32> { let ParserMatchClass = u6_1ExtOperand; }
def u6_2Ext : Operand<i32> { let ParserMatchClass = u6_2ExtOperand; }
def u6_3Ext : Operand<i32> { let ParserMatchClass = u6_3ExtOperand; }
def u32_0MustExt : Operand<i32> { let ParserMatchClass = u32_0MustExtOperand; }
}
// This complex pattern exists only to create a machine instruction operand
// of type "frame index". There doesn't seem to be a way to do that directly
// in the patterns.
def AddrFI : ComplexPattern<i32, 1, "SelectAddrFI", [frameindex], []>;
// These complex patterns are not strictly necessary, since global address
// folding will happen during DAG combining. For distinguishing between GA
// and GP, pat frags with HexagonCONST32 and HexagonCONST32_GP can be used.
def AddrGA : ComplexPattern<i32, 1, "SelectAddrGA", [], []>;
def AddrGP : ComplexPattern<i32, 1, "SelectAddrGP", [], []>;
// Address operands.
let PrintMethod = "printGlobalOperand" in {
def globaladdress : Operand<i32>;
def globaladdressExt : Operand<i32>;
}
let PrintMethod = "printJumpTable" in
def jumptablebase : Operand<i32>;
def brtarget : Operand<OtherVT> {
let DecoderMethod = "brtargetDecoder";
let PrintMethod = "printBrtarget";
}
def brtargetExt : Operand<OtherVT> {
let DecoderMethod = "brtargetDecoder";
let PrintMethod = "printBrtarget";
}
def calltarget : Operand<i32> {
let DecoderMethod = "brtargetDecoder";
let PrintMethod = "printBrtarget";
}
def bblabel : Operand<i32>;
def bbl : SDNode<"ISD::BasicBlock", SDTPtrLeaf, [], "BasicBlockSDNode">;
|