def InstFlag : OperandWithDefaultOps <i32, (ops (i32 0))>;
-class CustomOperandClass<string name, bit optional, string parserMethod>
+class CustomOperandClass<string name, bit optional, string parserMethod,
+ string defaultMethod>
: AsmOperandClass {
let Name = name;
let PredicateMethod = "is"#name;
let ParserMethod = parserMethod;
let RenderMethod = "addImmOperands";
let IsOptional = optional;
- let DefaultMethod = "default"#name;
+ let DefaultMethod = defaultMethod;
}
class CustomOperandProps<bit optional = 0, string name = NAME> {
+ string ImmTy = "ImmTy"#name;
string ParserMethod = "parse"#name;
+ string DefaultValue = "0";
+ string DefaultMethod = "[this]() { return "#
+ "AMDGPUOperand::CreateImm(this, "#DefaultValue#", SMLoc(), "#
+ "AMDGPUOperand::"#ImmTy#"); }";
string PrintMethod = "print"#name;
AsmOperandClass ParserMatchClass =
- CustomOperandClass<name, optional, ParserMethod>;
+ CustomOperandClass<name, optional, ParserMethod, DefaultMethod>;
string OperandType = "OPERAND_IMMEDIATE";
}
class ImmOperand<ValueType type, string name, bit optional = 0,
string printer = "print"#name>
: CustomOperand<type, optional, name> {
+ let ImmTy = "ImmTyNone";
let ParserMethod = "";
let PrintMethod = printer;
}
void cvtMubufAtomic(MCInst &Inst, const OperandVector &Operands) { cvtMubufImpl(Inst, Operands, true); }
void cvtMtbuf(MCInst &Inst, const OperandVector &Operands);
- AMDGPUOperand::Ptr defaultCPol() const;
-
- AMDGPUOperand::Ptr defaultSMRDOffset8() const;
- AMDGPUOperand::Ptr defaultSMEMOffset() const;
- AMDGPUOperand::Ptr defaultSMEMOffsetMod() const;
- AMDGPUOperand::Ptr defaultFlatOffset() const;
-
OperandMatchResultTy parseOModSI(OperandVector &Operands);
void cvtVOP3(MCInst &Inst, const OperandVector &Operands,
bool isSupportedDPPCtrl(StringRef Ctrl, const OperandVector &Operands);
int64_t parseDPPCtrlSel(StringRef Ctrl);
int64_t parseDPPCtrlPerm();
- AMDGPUOperand::Ptr defaultDppRowMask() const;
- AMDGPUOperand::Ptr defaultDppBankMask() const;
- AMDGPUOperand::Ptr defaultDppBoundCtrl() const;
- AMDGPUOperand::Ptr defaultDppFI() const;
void cvtDPP(MCInst &Inst, const OperandVector &Operands, bool IsDPP8 = false);
void cvtDPP8(MCInst &Inst, const OperandVector &Operands) {
cvtDPP(Inst, Operands, true);
bool SkipDstVcc = false,
bool SkipSrcVcc = false);
- AMDGPUOperand::Ptr defaultBLGP() const;
- AMDGPUOperand::Ptr defaultCBSZ() const;
- AMDGPUOperand::Ptr defaultABID() const;
-
OperandMatchResultTy parseEndpgm(OperandVector &Operands);
- AMDGPUOperand::Ptr defaultEndpgm() const;
- AMDGPUOperand::Ptr defaultWaitVDST() const;
- AMDGPUOperand::Ptr defaultWaitEXP() const;
OperandMatchResultTy parseVOPD(OperandVector &Operands);
};
// mubuf
//===----------------------------------------------------------------------===//
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultCPol() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyCPol);
-}
-
void AMDGPUAsmParser::cvtMubufImpl(MCInst &Inst,
const OperandVector &Operands,
bool IsAtomic) {
return isImmLiteral() && !isUInt<8>(getImm()) && isUInt<32>(getImm());
}
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultSMRDOffset8() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyNone);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultSMEMOffset() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc());
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultSMEMOffsetMod() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(),
- AMDGPUOperand::ImmTySMEMOffsetMod);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultFlatOffset() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyOffset);
-}
-
//===----------------------------------------------------------------------===//
// vop3
//===----------------------------------------------------------------------===//
return MatchOperand_Success;
}
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultDppRowMask() const {
- return AMDGPUOperand::CreateImm(this, 0xf, SMLoc(), AMDGPUOperand::ImmTyDppRowMask);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultEndpgm() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyEndpgm);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultDppBankMask() const {
- return AMDGPUOperand::CreateImm(this, 0xf, SMLoc(), AMDGPUOperand::ImmTyDppBankMask);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultDppBoundCtrl() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyDppBoundCtrl);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultDppFI() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyDppFI);
-}
-
void AMDGPUAsmParser::cvtVOP3DPP(MCInst &Inst, const OperandVector &Operands,
bool IsDPP8) {
OptionalImmIndexMap OptionalIdx;
}
}
-//===----------------------------------------------------------------------===//
-// mAI
-//===----------------------------------------------------------------------===//
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultBLGP() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyBLGP);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultCBSZ() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyCBSZ);
-}
-
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultABID() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyABID);
-}
-
/// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUAsmParser() {
RegisterMCAsmParser<AMDGPUAsmParser> A(getTheAMDGPUTarget());
// LDSDIR
//===----------------------------------------------------------------------===//
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultWaitVDST() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyWaitVDST);
-}
-
bool AMDGPUOperand::isWaitVDST() const {
return isImmTy(ImmTyWaitVDST) && isUInt<4>(getImm());
}
// VINTERP
//===----------------------------------------------------------------------===//
-AMDGPUOperand::Ptr AMDGPUAsmParser::defaultWaitEXP() const {
- return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyWaitEXP);
-}
-
bool AMDGPUOperand::isWaitEXP() const {
return isImmTy(ImmTyWaitEXP) && isUInt<3>(getImm());
}
class NamedIntOperand<ValueType Type, string Prefix, string Name = NAME,
string ConvertMethod = "nullptr">
: CustomOperand<Type, 1, Name> {
- string ImmTy = "AMDGPUOperand::ImmTy"#Name;
let ParserMethod =
"[this](OperandVector &Operands) -> OperandMatchResultTy { "#
- "return parseIntWithPrefix(\""#Prefix#"\", Operands, "#ImmTy#", "#
- ConvertMethod#"); }";
+ "return parseIntWithPrefix(\""#Prefix#"\", Operands, "#
+ "AMDGPUOperand::"#ImmTy#", "#ConvertMethod#"); }";
}
class NamedBitOperand<string Id, string Name = NAME>
: CustomOperand<i1, 1, Name> {
- string ImmTy = "AMDGPUOperand::ImmTy"#Name;
let ParserMethod =
"[this](OperandVector &Operands) -> OperandMatchResultTy { "#
- "return parseNamedBit(\""#Id#"\", Operands, "#ImmTy#"); }";
+ "return parseNamedBit(\""#Id#"\", Operands, AMDGPUOperand::"#ImmTy#"); }";
}
class DefaultOperand<CustomOperand Op, int Value>
class SDWAOperand<string Id, string Name = NAME>
: CustomOperand<i32, 1, Name> {
- string ImmTy = "AMDGPUOperand::ImmTy"#Name;
let ParserMethod =
"[this](OperandVector &Operands) -> OperandMatchResultTy { "#
- "return parseSDWASel(Operands, \""#Id#"\", "#ImmTy#"); }";
+ "return parseSDWASel(Operands, \""#Id#"\", AMDGPUOperand::"#ImmTy#"); }";
}
class ArrayOperand0<string Id, string Name = NAME>
: OperandWithDefaultOps<i32, (ops (i32 0))>,
CustomOperandProps<1, Name> {
- string ImmTy = "AMDGPUOperand::ImmTy"#Name;
let ParserMethod =
"[this](OperandVector &Operands) -> OperandMatchResultTy { "#
- "return parseOperandArrayWithPrefix(\""#Id#"\", Operands, "#ImmTy#"); }";
+ "return parseOperandArrayWithPrefix(\""#Id#"\", Operands, "#
+ "AMDGPUOperand::"#ImmTy#"); }";
}
+let ImmTy = "ImmTyOffset" in
def flat_offset : CustomOperand<i32, 1, "FlatOffset">;
def offset : NamedIntOperand<i32, "offset", "Offset">;
def offset0 : NamedIntOperand<i8, "offset0", "Offset0">;
def dpp8 : CustomOperand<i32, 0, "DPP8">;
def dpp_ctrl : CustomOperand<i32, 0, "DPPCtrl">;
+let DefaultValue = "0xf" in {
def row_mask : NamedIntOperand<i32, "row_mask", "DppRowMask">;
def bank_mask : NamedIntOperand<i32, "bank_mask", "DppBankMask">;
+}
def bound_ctrl : NamedIntOperand<i1, "bound_ctrl", "DppBoundCtrl",
"[this] (int64_t &BC) -> bool { return convertDppBoundCtrl(BC); }">;
def FI : NamedIntOperand<i32, "fi", "DppFI">;