Skip to content

Commit b1aef25

Browse files
Minor comment fixups.
1 parent 9ac6a8c commit b1aef25

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ class ARMAsmParser : public MCTargetAsmParser {
694694
Match_RequiresThumb2,
695695
Match_RequiresV8,
696696
Match_RequiresFlagSetting,
697-
Match_RequiresDestinationRegisterMatchASourceRegister,
698697
#define GET_OPERAND_DIAGNOSTIC_TYPES
699698
#include "ARMGenAsmMatcher.inc"
700699

@@ -6686,7 +6685,7 @@ bool operandsContainWide(OperandVector &Operands, unsigned MnemonicOpsEndInd) {
66866685
return true;
66876686
}
66886687
return false;
6689-
};
6688+
}
66906689

66916690
// Some Thumb instructions have two operand forms that are not
66926691
// available as three operand, convert to two operand form if possible.
@@ -11071,8 +11070,10 @@ unsigned ARMAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
1107111070
case ARM::tMUL:
1107211071
// The second source operand must be the same register as the destination
1107311072
// operand.
11073+
// FIXME: Ideally this would be handled by ARMGenAsmMatcher and
11074+
// emitAsmTiedOperandConstraints.
1107411075
if (Inst.getOperand(0).getReg() != Inst.getOperand(3).getReg())
11075-
return Match_RequiresDestinationRegisterMatchASourceRegister;
11076+
return Match_InvalidTiedOperand;
1107611077
break;
1107711078
default:
1107811079
break;
@@ -12597,6 +12598,8 @@ ARMAsmParser::FilterNearMisses(SmallVectorImpl<NearMissInfo> &NearMissesIn,
1259712598
SmallSet<FeatureBitset, 4> FeatureMissesSeen;
1259812599
bool ReportedTooFewOperands = false;
1259912600

12601+
unsigned MnemonicOpsEndInd = getMnemonicOpsEndInd(Operands);
12602+
1260012603
// Process the near-misses in reverse order, so that we see more general ones
1260112604
// first, and so can avoid emitting more specific ones.
1260212605
for (NearMissInfo &I : reverse(NearMissesIn)) {
@@ -12705,9 +12708,16 @@ ARMAsmParser::FilterNearMisses(SmallVectorImpl<NearMissInfo> &NearMissesIn,
1270512708
case Match_RequiresFlagSetting:
1270612709
Message.Message = "no flag-preserving variant of this instruction available";
1270712710
break;
12708-
case Match_RequiresDestinationRegisterMatchASourceRegister:
12709-
Message.Message = "destination register must match a source register";
12711+
case Match_InvalidTiedOperand: {
12712+
ARMOperand &Op = static_cast<ARMOperand &>(*Operands[0]);
12713+
if (Op.isToken() && Op.getToken() == "mul") {
12714+
Message.Message = "destination register must match a source register";
12715+
Message.Loc = Operands[MnemonicOpsEndInd]->getStartLoc();
12716+
} else {
12717+
llvm_unreachable("Match_InvalidTiedOperand only used for tMUL.");
12718+
}
1271012719
break;
12720+
}
1271112721
case Match_InvalidOperand:
1271212722
Message.Message = "invalid operand for instruction";
1271312723
break;
@@ -12907,6 +12917,10 @@ unsigned ARMAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
1290712917
if (hasV8Ops() && Op.isReg() && Op.getReg() == ARM::SP)
1290812918
return Match_Success;
1290912919
return Match_rGPR;
12920+
// Note: This mutates the operand which could cause issues for future
12921+
// matches if this one fails later.
12922+
// It would be better to do this in addVecList but as this doesn't have access
12923+
// to MRI this isn't possible.
1291012924
// If trying to match a VecListDPair with a Q register, convert Q to list.
1291112925
case MCK_VecListDPair:
1291212926
if (Op.isQReg() && !hasMVE()) {
@@ -12917,6 +12931,7 @@ unsigned ARMAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
1291712931
return Match_Success;
1291812932
}
1291912933
return Match_InvalidOperand;
12934+
// Note: This mutates the operand (see above).
1292012935
// If trying to match a VecListDPair with a D register, convert D singleton
1292112936
// list.
1292212937
case MCK_VecListOneD:

0 commit comments

Comments
 (0)