@@ -1247,6 +1247,12 @@ raw_ostream &operator <<(raw_ostream &OS, AMDGPUOperand::Modifiers Mods) {
12471247// AsmParser
12481248// ===----------------------------------------------------------------------===//
12491249
1250+ // TODO: define GET_SUBTARGET_FEATURE_NAME
1251+ #define GET_REGISTER_MATCHER
1252+ #include " AMDGPUGenAsmMatcher.inc"
1253+ #undef GET_REGISTER_MATCHER
1254+ #undef GET_SUBTARGET_FEATURE_NAME
1255+
12501256// Holds info related to the current kernel, e.g. count of SGPRs used.
12511257// Kernel scope begins at .amdgpu_hsa_kernel directive, ends at next
12521258// .amdgpu_hsa_kernel or at EOF.
@@ -1545,6 +1551,10 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
15451551 return AMDGPU::isGFX10_BEncoding (getSTI ());
15461552 }
15471553
1554+ bool isWave32 () const { return getAvailableFeatures ()[Feature_isWave32Bit]; }
1555+
1556+ bool isWave64 () const { return getAvailableFeatures ()[Feature_isWave64Bit]; }
1557+
15481558 bool hasInv2PiInlineImm () const {
15491559 return getFeatureBits ()[AMDGPU::FeatureInv2PiInlineImm];
15501560 }
@@ -1608,6 +1618,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
16081618 return &MII;
16091619 }
16101620
1621+ // FIXME: This should not be used. Instead, should use queries derived from
1622+ // getAvailableFeatures().
16111623 const FeatureBitset &getFeatureBits () const {
16121624 return getSTI ().getFeatureBits ();
16131625 }
@@ -2264,9 +2276,8 @@ bool AMDGPUOperand::isSDWAInt32Operand() const {
22642276}
22652277
22662278bool AMDGPUOperand::isBoolReg () const {
2267- auto FB = AsmParser->getFeatureBits ();
2268- return isReg () && ((FB[AMDGPU::FeatureWavefrontSize64] && isSCSrc_b64 ()) ||
2269- (FB[AMDGPU::FeatureWavefrontSize32] && isSCSrc_b32 ()));
2279+ return isReg () && ((AsmParser->isWave64 () && isSCSrc_b64 ()) ||
2280+ (AsmParser->isWave32 () && isSCSrc_b32 ()));
22702281}
22712282
22722283uint64_t AMDGPUOperand::applyInputFPModifiers (uint64_t Val, unsigned Size) const
@@ -4984,9 +4995,8 @@ bool AMDGPUAsmParser::validateDPP(const MCInst &Inst,
49844995
49854996// Check if VCC register matches wavefront size
49864997bool AMDGPUAsmParser::validateVccOperand (MCRegister Reg) const {
4987- auto FB = getFeatureBits ();
4988- return (FB[AMDGPU::FeatureWavefrontSize64] && Reg == AMDGPU::VCC) ||
4989- (FB[AMDGPU::FeatureWavefrontSize32] && Reg == AMDGPU::VCC_LO);
4998+ return (Reg == AMDGPU::VCC && isWave64 ()) ||
4999+ (Reg == AMDGPU::VCC_LO && isWave32 ());
49905000}
49915001
49925002// One unique literal can be used. VOP3 literal is only allowed in GFX10+
@@ -5671,7 +5681,7 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
56715681 // Check if this instruction may be used with a different wavesize.
56725682 if (isGFX10Plus () && getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] &&
56735683 !getFeatureBits ()[AMDGPU::FeatureWavefrontSize32]) {
5674-
5684+ // FIXME: Use getAvailableFeatures, and do not manually recompute
56755685 FeatureBitset FeaturesWS32 = getFeatureBits ();
56765686 FeaturesWS32.flip (AMDGPU::FeatureWavefrontSize64)
56775687 .flip (AMDGPU::FeatureWavefrontSize32);
@@ -6426,10 +6436,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
64266436 if (C.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
64276437 if (!isGFX10Plus ())
64286438 return TokError (" enable_wavefront_size32=1 is only allowed on GFX10+" );
6429- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6439+ if (!isWave32 () )
64306440 return TokError (" enable_wavefront_size32=1 requires +WavefrontSize32" );
64316441 } else {
6432- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6442+ if (!isWave64 () )
64336443 return TokError (" enable_wavefront_size32=0 requires +WavefrontSize64" );
64346444 }
64356445 }
@@ -6438,10 +6448,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
64386448 if (C.wavefront_size == 5 ) {
64396449 if (!isGFX10Plus ())
64406450 return TokError (" wavefront_size=5 is only allowed on GFX10+" );
6441- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6451+ if (!isWave32 () )
64426452 return TokError (" wavefront_size=5 requires +WavefrontSize32" );
64436453 } else if (C.wavefront_size == 6 ) {
6444- if (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6454+ if (!isWave64 () )
64456455 return TokError (" wavefront_size=6 requires +WavefrontSize64" );
64466456 }
64476457 }
@@ -10344,7 +10354,6 @@ LLVMInitializeAMDGPUAsmParser() {
1034410354 RegisterMCAsmParser<AMDGPUAsmParser> B (getTheGCNTarget ());
1034510355}
1034610356
10347- #define GET_REGISTER_MATCHER
1034810357#define GET_MATCHER_IMPLEMENTATION
1034910358#define GET_MNEMONIC_SPELL_CHECKER
1035010359#define GET_MNEMONIC_CHECKER
0 commit comments