Skip to content

Commit b8e0f3e

Browse files
[ARM] Change the type of CC and VCC code in splitMnemonic. (#83413)
This changes the type of `PredicationCode` and `VPTPredicationCode` from `unsigned` to `ARMCC::CondCodes` and `ARMVCC::VPTCodes` resp' for clarity and correctness.
1 parent 756166e commit b8e0f3e

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,10 @@ class ARMAsmParser : public MCTargetAsmParser {
506506

507507
bool isMnemonicVPTPredicable(StringRef Mnemonic, StringRef ExtraToken);
508508
StringRef splitMnemonic(StringRef Mnemonic, StringRef ExtraToken,
509-
unsigned &PredicationCode,
510-
unsigned &VPTPredicationCode, bool &CarrySetting,
511-
unsigned &ProcessorIMod, StringRef &ITMask);
509+
ARMCC::CondCodes &PredicationCode,
510+
ARMVCC::VPTCodes &VPTPredicationCode,
511+
bool &CarrySetting, unsigned &ProcessorIMod,
512+
StringRef &ITMask);
512513
void getMnemonicAcceptInfo(StringRef Mnemonic, StringRef ExtraToken,
513514
StringRef FullInst, bool &CanAcceptCarrySet,
514515
bool &CanAcceptPredicationCode,
@@ -6283,10 +6284,9 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr::VariantKind &RefKind) {
62836284
//
62846285
// FIXME: Would be nice to autogen this.
62856286
// FIXME: This is a bit of a maze of special cases.
6286-
StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic,
6287-
StringRef ExtraToken,
6288-
unsigned &PredicationCode,
6289-
unsigned &VPTPredicationCode,
6287+
StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic, StringRef ExtraToken,
6288+
ARMCC::CondCodes &PredicationCode,
6289+
ARMVCC::VPTCodes &VPTPredicationCode,
62906290
bool &CarrySetting,
62916291
unsigned &ProcessorIMod,
62926292
StringRef &ITMask) {
@@ -6340,7 +6340,7 @@ StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic,
63406340
unsigned CC = ARMCondCodeFromString(Mnemonic.substr(Mnemonic.size()-2));
63416341
if (CC != ~0U) {
63426342
Mnemonic = Mnemonic.slice(0, Mnemonic.size() - 2);
6343-
PredicationCode = CC;
6343+
PredicationCode = static_cast<ARMCC::CondCodes>(CC);
63446344
}
63456345
}
63466346

@@ -6384,10 +6384,11 @@ StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic,
63846384
Mnemonic != "vqmovnt" && Mnemonic != "vqmovunt" &&
63856385
Mnemonic != "vqmovnt" && Mnemonic != "vmovnt" && Mnemonic != "vqdmullt" &&
63866386
Mnemonic != "vpnot" && Mnemonic != "vcvtt" && Mnemonic != "vcvt") {
6387-
unsigned CC = ARMVectorCondCodeFromString(Mnemonic.substr(Mnemonic.size()-1));
6388-
if (CC != ~0U) {
6387+
unsigned VCC =
6388+
ARMVectorCondCodeFromString(Mnemonic.substr(Mnemonic.size() - 1));
6389+
if (VCC != ~0U) {
63896390
Mnemonic = Mnemonic.slice(0, Mnemonic.size()-1);
6390-
VPTPredicationCode = CC;
6391+
VPTPredicationCode = static_cast<ARMVCC::VPTCodes>(VCC);
63916392
}
63926393
return Mnemonic;
63936394
}
@@ -6966,8 +6967,8 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
69666967
StringRef ExtraToken = Name.slice(Next, Name.find(' ', Next + 1));
69676968

69686969
// Split out the predication code and carry setting flag from the mnemonic.
6969-
unsigned PredicationCode;
6970-
unsigned VPTPredicationCode;
6970+
ARMCC::CondCodes PredicationCode;
6971+
ARMVCC::VPTCodes VPTPredicationCode;
69716972
unsigned ProcessorIMod;
69726973
bool CarrySetting;
69736974
StringRef ITMask;

0 commit comments

Comments
 (0)