@@ -1297,7 +1297,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1297
1297
parseNamedBit (const char *Name, OperandVector &Operands,
1298
1298
AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone);
1299
1299
OperandMatchResultTy parseStringWithPrefix (StringRef Prefix,
1300
- StringRef &Value);
1300
+ StringRef &Value,
1301
+ SMLoc &StringLoc);
1301
1302
1302
1303
bool isModifier ();
1303
1304
bool isOperandModifier (const AsmToken &Token, const AsmToken &NextToken) const ;
@@ -5099,11 +5100,15 @@ static void addOptionalImmOperand(
5099
5100
}
5100
5101
5101
5102
OperandMatchResultTy
5102
- AMDGPUAsmParser::parseStringWithPrefix (StringRef Prefix, StringRef &Value) {
5103
+ AMDGPUAsmParser::parseStringWithPrefix (StringRef Prefix,
5104
+ StringRef &Value,
5105
+ SMLoc &StringLoc) {
5103
5106
if (!trySkipId (Prefix, AsmToken::Colon))
5104
5107
return MatchOperand_NoMatch;
5105
5108
5106
- return parseId (Value) ? MatchOperand_Success : MatchOperand_ParseFail;
5109
+ StringLoc = getLoc ();
5110
+ return parseId (Value, " expected an identifier" ) ? MatchOperand_Success
5111
+ : MatchOperand_ParseFail;
5107
5112
}
5108
5113
5109
5114
// ===----------------------------------------------------------------------===//
@@ -7523,7 +7528,8 @@ AMDGPUAsmParser::parseSDWASel(OperandVector &Operands, StringRef Prefix,
7523
7528
StringRef Value;
7524
7529
OperandMatchResultTy res;
7525
7530
7526
- res = parseStringWithPrefix (Prefix, Value);
7531
+ SMLoc StringLoc;
7532
+ res = parseStringWithPrefix (Prefix, Value, StringLoc);
7527
7533
if (res != MatchOperand_Success) {
7528
7534
return res;
7529
7535
}
@@ -7540,6 +7546,7 @@ AMDGPUAsmParser::parseSDWASel(OperandVector &Operands, StringRef Prefix,
7540
7546
.Default (0xffffffff );
7541
7547
7542
7548
if (Int == 0xffffffff ) {
7549
+ Error (StringLoc, " invalid " + Twine (Prefix) + " value" );
7543
7550
return MatchOperand_ParseFail;
7544
7551
}
7545
7552
@@ -7555,7 +7562,8 @@ AMDGPUAsmParser::parseSDWADstUnused(OperandVector &Operands) {
7555
7562
StringRef Value;
7556
7563
OperandMatchResultTy res;
7557
7564
7558
- res = parseStringWithPrefix (" dst_unused" , Value);
7565
+ SMLoc StringLoc;
7566
+ res = parseStringWithPrefix (" dst_unused" , Value, StringLoc);
7559
7567
if (res != MatchOperand_Success) {
7560
7568
return res;
7561
7569
}
@@ -7568,6 +7576,7 @@ AMDGPUAsmParser::parseSDWADstUnused(OperandVector &Operands) {
7568
7576
.Default (0xffffffff );
7569
7577
7570
7578
if (Int == 0xffffffff ) {
7579
+ Error (StringLoc, " invalid dst_unused value" );
7571
7580
return MatchOperand_ParseFail;
7572
7581
}
7573
7582
0 commit comments