Skip to content

Commit 9bebf25

Browse files
authored
[AMDGPU][AsmParser][NFC] Generate NamedIntOperand predicates automatically. (#90576)
Part of <#62629>.
1 parent eb6097a commit 9bebf25

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,13 @@ class AMDGPUOperand : public MCParsedAsmOperand {
376376
}
377377

378378
bool isOModSI() const { return isImmTy(ImmTyOModSI); }
379-
bool isDMask() const { return isImmTy(ImmTyDMask); }
380379
bool isDim() const { return isImmTy(ImmTyDim); }
381380
bool isR128A16() const { return isImmTy(ImmTyR128A16); }
382381
bool isOff() const { return isImmTy(ImmTyOff); }
383382
bool isExpTgt() const { return isImmTy(ImmTyExpTgt); }
384383
bool isOffen() const { return isImmTy(ImmTyOffen); }
385384
bool isIdxen() const { return isImmTy(ImmTyIdxen); }
386385
bool isAddr64() const { return isImmTy(ImmTyAddr64); }
387-
bool isOffset() const { return isImmTy(ImmTyOffset); }
388-
bool isOffset0() const { return isImmTy(ImmTyOffset0); }
389-
bool isOffset1() const { return isImmTy(ImmTyOffset1); }
390386
bool isSMEMOffsetMod() const { return isImmTy(ImmTySMEMOffsetMod); }
391387
bool isFlatOffset() const { return isImmTy(ImmTyOffset) || isImmTy(ImmTyInstOffset); }
392388
bool isGDS() const { return isImmTy(ImmTyGDS); }
@@ -396,9 +392,6 @@ class AMDGPUOperand : public MCParsedAsmOperand {
396392
bool isIndexKey16bit() const { return isImmTy(ImmTyIndexKey16bit); }
397393
bool isTFE() const { return isImmTy(ImmTyTFE); }
398394
bool isFORMAT() const { return isImmTy(ImmTyFORMAT) && isUInt<7>(getImm()); }
399-
bool isDppBankMask() const { return isImmTy(ImmTyDppBankMask); }
400-
bool isDppRowMask() const { return isImmTy(ImmTyDppRowMask); }
401-
bool isDppBoundCtrl() const { return isImmTy(ImmTyDppBoundCtrl); }
402395
bool isDppFI() const { return isImmTy(ImmTyDppFI); }
403396
bool isSDWADstSel() const { return isImmTy(ImmTySDWADstSel); }
404397
bool isSDWASrc0Sel() const { return isImmTy(ImmTySDWASrc0Sel); }
@@ -411,7 +404,6 @@ class AMDGPUOperand : public MCParsedAsmOperand {
411404
bool isOpSelHi() const { return isImmTy(ImmTyOpSelHi); }
412405
bool isNegLo() const { return isImmTy(ImmTyNegLo); }
413406
bool isNegHi() const { return isImmTy(ImmTyNegHi); }
414-
bool isByteSel() const { return isImmTy(ImmTyByteSel); }
415407

416408
bool isRegOrImm() const {
417409
return isReg() || isImm();
@@ -949,16 +941,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
949941
bool isDPP8() const;
950942
bool isDPPCtrl() const;
951943
bool isBLGP() const;
952-
bool isCBSZ() const;
953-
bool isABID() const;
954944
bool isGPRIdxMode() const;
955945
bool isS16Imm() const;
956946
bool isU16Imm() const;
957947
bool isEndpgm() const;
958-
bool isWaitVDST() const;
959-
bool isWaitEXP() const;
960-
bool isWaitVAVDst() const;
961-
bool isWaitVMVSrc() const;
962948

963949
auto getPredicate(std::function<bool(const AMDGPUOperand &Op)> P) const {
964950
return std::bind(P, *this);
@@ -8936,14 +8922,6 @@ bool AMDGPUOperand::isBLGP() const {
89368922
return isImm() && getImmTy() == ImmTyBLGP && isUInt<3>(getImm());
89378923
}
89388924

8939-
bool AMDGPUOperand::isCBSZ() const {
8940-
return isImm() && getImmTy() == ImmTyCBSZ;
8941-
}
8942-
8943-
bool AMDGPUOperand::isABID() const {
8944-
return isImm() && getImmTy() == ImmTyABID;
8945-
}
8946-
89478925
bool AMDGPUOperand::isS16Imm() const {
89488926
return isImmLiteral() && (isInt<16>(getImm()) || isUInt<16>(getImm()));
89498927
}
@@ -9664,22 +9642,6 @@ ParseStatus AMDGPUAsmParser::parseEndpgm(OperandVector &Operands) {
96649642

96659643
bool AMDGPUOperand::isEndpgm() const { return isImmTy(ImmTyEndpgm); }
96669644

9667-
//===----------------------------------------------------------------------===//
9668-
// LDSDIR
9669-
//===----------------------------------------------------------------------===//
9670-
9671-
bool AMDGPUOperand::isWaitVDST() const { return isImmTy(ImmTyWaitVDST); }
9672-
9673-
bool AMDGPUOperand::isWaitVAVDst() const { return isImmTy(ImmTyWaitVAVDst); }
9674-
9675-
bool AMDGPUOperand::isWaitVMVSrc() const { return isImmTy(ImmTyWaitVMVSrc); }
9676-
9677-
//===----------------------------------------------------------------------===//
9678-
// VINTERP
9679-
//===----------------------------------------------------------------------===//
9680-
9681-
bool AMDGPUOperand::isWaitEXP() const { return isImmTy(ImmTyWaitEXP); }
9682-
96839645
//===----------------------------------------------------------------------===//
96849646
// Split Barrier
96859647
//===----------------------------------------------------------------------===//

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,9 @@ def SDWAVopcDst : BoolRC {
10021002
class NamedIntOperand<ValueType Type, string Prefix, bit Optional = 1,
10031003
string name = NAME>
10041004
: CustomOperand<Type, Optional, name> {
1005+
let PredicateMethod =
1006+
"getPredicate([](const AMDGPUOperand &Op) -> bool { "#
1007+
"return Op.isImmTy(AMDGPUOperand::"#ImmTy#"); })";
10051008
string Validator = "[](int64_t V) { return true; }";
10061009
string ConvertMethod = "[](int64_t &V) { return "#Validator#"(V); }";
10071010
let ParserMethod =

0 commit comments

Comments
 (0)