[llvm] [ARM][TableGen][MC] Change the ARM mnemonic operands to be optional for ASM parsing (PR #83436)
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 03:56:41 PDT 2024
================
@@ -4054,6 +4099,65 @@ static MCRegister MatchRegisterName(StringRef Name);
/// }
+static bool isDataTypeToken(StringRef Tok) {
+ static const DenseSet<StringRef> DataTypes{
+ ".8", ".16", ".32", ".64", ".i8", ".i16", ".i32", ".i64",
+ ".u8", ".u16", ".u32", ".u64", ".s8", ".s16", ".s32", ".s64",
+ ".p8", ".p16", ".f32", ".f64", ".f", ".d"};
+ return DataTypes.contains(Tok);
+}
+
+static unsigned getMnemonicOpsEndInd(const OperandVector &Operands) {
+ unsigned MnemonicOpsEndInd = 1;
+ // Special case for CPS which has a Mnemonic side token for possibly storing
+ // ie/id variant
+ if (Operands[0]->isToken() &&
+ static_cast<ARMOperand &>(*Operands[0]).getToken() == "cps") {
+ if (Operands.size() > 1 && Operands[1]->isImm() &&
+ static_cast<ARMOperand &>(*Operands[1]).getImm()->getKind() ==
+ llvm::MCExpr::Constant &&
+ (dyn_cast<MCConstantExpr>(
+ static_cast<ARMOperand &>(*Operands[1]).getImm())
+ ->getValue() == ARM_PROC::IE ||
+ dyn_cast<MCConstantExpr>(
+ static_cast<ARMOperand &>(*Operands[1]).getImm())
+ ->getValue() == ARM_PROC::ID))
+ ++MnemonicOpsEndInd;
+ }
+
+ // In some circumstances the code code moves to the right
+ bool RHSCondCode = false;
+ while (MnemonicOpsEndInd < Operands.size()) {
+ auto Op = static_cast<ARMOperand &>(*Operands[MnemonicOpsEndInd]);
+ // Special case for it instructions which have a condition code on the RHS
+ if (Op.isITMask()) {
+ RHSCondCode = true;
+ MnemonicOpsEndInd++;
+ }
+ // Special case for it instructions which have a condition code on the RHS
----------------
statham-arm wrote:
Copy-paste error? This comment is identical to the one five lines up, but surely can't be an accurate description of _both_ clauses of this if.
https://github.com/llvm/llvm-project/pull/83436
More information about the llvm-commits
mailing list