Skip to content

Commit 17c4a5d

Browse files
committed
Set OperandType to OPERAND_IMMEDIATE for immediate operands
1 parent b320e5e commit 17c4a5d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

llvm/lib/Target/LoongArch/LoongArchInstrInfo.td

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,50 +218,61 @@ def GPRMemAtomic : RegisterOperand<GPR> {
218218
def grlenimm : Operand<GRLenVT>;
219219
def imm32 : Operand<GRLenVT> {
220220
let ParserMatchClass = ImmAsmOperand<"", 32, "">;
221+
let OperandType = "OPERAND_IMMEDIATE";
221222
}
222223

223224
def uimm1 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<1>(Imm);}]>{
224225
let ParserMatchClass = UImmAsmOperand<1>;
226+
let OperandType = "OPERAND_IMMEDIATE";
225227
}
226228

227229
def uimm2 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<2>(Imm);}]> {
228230
let ParserMatchClass = UImmAsmOperand<2>;
231+
let OperandType = "OPERAND_IMMEDIATE";
229232
}
230233

231234
def uimm2_plus1 : Operand<GRLenVT>,
232235
ImmLeaf<GRLenVT, [{return isUInt<2>(Imm - 1);}]> {
233236
let ParserMatchClass = UImmAsmOperand<2, "plus1">;
234237
let EncoderMethod = "getImmOpValueSub1";
235238
let DecoderMethod = "decodeUImmOperand<2, 1>";
239+
let OperandType = "OPERAND_IMMEDIATE";
236240
}
237241

238242
def uimm3 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<3>(Imm);}]> {
239243
let ParserMatchClass = UImmAsmOperand<3>;
244+
let OperandType = "OPERAND_IMMEDIATE";
240245
}
241246

242247
def uimm4 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<4>(Imm);}]> {
243248
let ParserMatchClass = UImmAsmOperand<4>;
249+
let OperandType = "OPERAND_IMMEDIATE";
244250
}
245251

246252
def uimm5 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<5>(Imm);}]> {
247253
let ParserMatchClass = UImmAsmOperand<5>;
254+
let OperandType = "OPERAND_IMMEDIATE";
248255
}
249256

250257
def uimm6 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<6>(Imm);}]> {
251258
let ParserMatchClass = UImmAsmOperand<6>;
259+
let OperandType = "OPERAND_IMMEDIATE";
252260
}
253261

254262
def uimm7 : Operand<GRLenVT> {
255263
let ParserMatchClass = UImmAsmOperand<7>;
264+
let OperandType = "OPERAND_IMMEDIATE";
256265
}
257266

258267
def uimm8 : Operand<GRLenVT>, ImmLeaf<GRLenVT, [{return isUInt<8>(Imm);}]> {
259268
let ParserMatchClass = UImmAsmOperand<8>;
269+
let OperandType = "OPERAND_IMMEDIATE";
260270
}
261271

262272
class UImm12Operand : Operand<GRLenVT>,
263273
ImmLeaf <GRLenVT, [{return isUInt<12>(Imm);}]> {
264274
let DecoderMethod = "decodeUImmOperand<12>";
275+
let OperandType = "OPERAND_IMMEDIATE";
265276
}
266277

267278
def uimm12 : UImm12Operand {
@@ -275,56 +286,66 @@ def uimm12_ori : UImm12Operand {
275286
def uimm14 : Operand<GRLenVT>,
276287
ImmLeaf <GRLenVT, [{return isUInt<14>(Imm);}]> {
277288
let ParserMatchClass = UImmAsmOperand<14>;
289+
let OperandType = "OPERAND_IMMEDIATE";
278290
}
279291

280292
def uimm15 : Operand<GRLenVT>,
281293
ImmLeaf <GRLenVT, [{return isUInt<15>(Imm);}]> {
282294
let ParserMatchClass = UImmAsmOperand<15>;
295+
let OperandType = "OPERAND_IMMEDIATE";
283296
}
284297

285298
def simm5 : Operand<GRLenVT> {
286299
let ParserMatchClass = SImmAsmOperand<5>;
287300
let DecoderMethod = "decodeSImmOperand<5>";
301+
let OperandType = "OPERAND_IMMEDIATE";
288302
}
289303

290304
def simm8 : Operand<GRLenVT> {
291305
let ParserMatchClass = SImmAsmOperand<8>;
292306
let DecoderMethod = "decodeSImmOperand<8>";
307+
let OperandType = "OPERAND_IMMEDIATE";
293308
}
294309

295310
foreach I = [1, 2, 3] in {
296311
def simm8_lsl # I : Operand<GRLenVT> {
297312
let ParserMatchClass = SImmAsmOperand<8, "lsl" # I>;
298313
let EncoderMethod = "getImmOpValueAsr<" # I # ">";
299314
let DecoderMethod = "decodeSImmOperand<8," # I # ">";
315+
let OperandType = "OPERAND_IMMEDIATE";
300316
}
301317
}
302318

303319
def simm9_lsl3 : Operand<GRLenVT> {
304320
let ParserMatchClass = SImmAsmOperand<9, "lsl3">;
305321
let EncoderMethod = "getImmOpValueAsr<3>";
306322
let DecoderMethod = "decodeSImmOperand<9, 3>";
323+
let OperandType = "OPERAND_IMMEDIATE";
307324
}
308325

309326
def simm10 : Operand<GRLenVT> {
310327
let ParserMatchClass = SImmAsmOperand<10>;
328+
let OperandType = "OPERAND_IMMEDIATE";
311329
}
312330

313331
def simm10_lsl2 : Operand<GRLenVT> {
314332
let ParserMatchClass = SImmAsmOperand<10, "lsl2">;
315333
let EncoderMethod = "getImmOpValueAsr<2>";
316334
let DecoderMethod = "decodeSImmOperand<10, 2>";
335+
let OperandType = "OPERAND_IMMEDIATE";
317336
}
318337

319338
def simm11_lsl1 : Operand<GRLenVT> {
320339
let ParserMatchClass = SImmAsmOperand<11, "lsl1">;
321340
let EncoderMethod = "getImmOpValueAsr<1>";
322341
let DecoderMethod = "decodeSImmOperand<11, 1>";
342+
let OperandType = "OPERAND_IMMEDIATE";
323343
}
324344

325345
class SImm12Operand : Operand<GRLenVT>,
326346
ImmLeaf <GRLenVT, [{return isInt<12>(Imm);}]> {
327347
let DecoderMethod = "decodeSImmOperand<12>";
348+
let OperandType = "OPERAND_IMMEDIATE";
328349
}
329350

330351
def simm12 : SImm12Operand {
@@ -342,35 +363,41 @@ def simm12_lu52id : SImm12Operand {
342363
def simm13 : Operand<GRLenVT> {
343364
let ParserMatchClass = SImmAsmOperand<13>;
344365
let DecoderMethod = "decodeSImmOperand<13>";
366+
let OperandType = "OPERAND_IMMEDIATE";
345367
}
346368

347369
def simm14_lsl2 : Operand<GRLenVT>,
348370
ImmLeaf<GRLenVT, [{return isShiftedInt<14,2>(Imm);}]> {
349371
let ParserMatchClass = SImmAsmOperand<14, "lsl2">;
350372
let EncoderMethod = "getImmOpValueAsr<2>";
351373
let DecoderMethod = "decodeSImmOperand<14, 2>";
374+
let OperandType = "OPERAND_IMMEDIATE";
352375
}
353376

354377
def simm16 : Operand<GRLenVT> {
355378
let ParserMatchClass = SImmAsmOperand<16>;
356379
let DecoderMethod = "decodeSImmOperand<16>";
380+
let OperandType = "OPERAND_IMMEDIATE";
357381
}
358382

359383
def simm16_lsl2 : Operand<GRLenVT>,
360384
ImmLeaf<GRLenVT, [{return isInt<16>(Imm>>2);}]> {
361385
let ParserMatchClass = SImmAsmOperand<16, "lsl2">;
362386
let EncoderMethod = "getImmOpValueAsr<2>";
363387
let DecoderMethod = "decodeSImmOperand<16, 2>";
388+
let OperandType = "OPERAND_IMMEDIATE";
364389
}
365390

366391
def simm16_lsl2_br : Operand<OtherVT> {
367392
let ParserMatchClass = SImmAsmOperand<16, "lsl2">;
368393
let EncoderMethod = "getImmOpValueAsr<2>";
369394
let DecoderMethod = "decodeSImmOperand<16, 2>";
395+
let OperandType = "OPERAND_IMMEDIATE";
370396
}
371397

372398
class SImm20Operand : Operand<GRLenVT> {
373399
let DecoderMethod = "decodeSImmOperand<20>";
400+
let OperandType = "OPERAND_IMMEDIATE";
374401
}
375402

376403
def simm20 : SImm20Operand {
@@ -397,6 +424,7 @@ def simm21_lsl2 : Operand<OtherVT> {
397424
let ParserMatchClass = SImmAsmOperand<21, "lsl2">;
398425
let EncoderMethod = "getImmOpValueAsr<2>";
399426
let DecoderMethod = "decodeSImmOperand<21, 2>";
427+
let OperandType = "OPERAND_IMMEDIATE";
400428
}
401429

402430
def SImm26OperandB: AsmOperandClass {
@@ -412,6 +440,7 @@ def simm26_b : Operand<OtherVT> {
412440
let ParserMatchClass = SImm26OperandB;
413441
let EncoderMethod = "getImmOpValueAsr<2>";
414442
let DecoderMethod = "decodeSImmOperand<26, 2>";
443+
let OperandType = "OPERAND_IMMEDIATE";
415444
}
416445

417446
def SImm26OperandBL: AsmOperandClass {
@@ -427,6 +456,7 @@ def simm26_symbol : Operand<GRLenVT> {
427456
let ParserMatchClass = SImm26OperandBL;
428457
let EncoderMethod = "getImmOpValueAsr<2>";
429458
let DecoderMethod = "decodeSImmOperand<26, 2>";
459+
let OperandType = "OPERAND_IMMEDIATE";
430460
}
431461

432462
// A 32-bit signed immediate with the lowest 16 bits zeroed, suitable for

0 commit comments

Comments
 (0)