@@ -1246,6 +1246,12 @@ raw_ostream &operator <<(raw_ostream &OS, AMDGPUOperand::Modifiers Mods) {
12461246//  AsmParser
12471247// ===----------------------------------------------------------------------===//
12481248
1249+ //  TODO: define GET_SUBTARGET_FEATURE_NAME
1250+ #define  GET_REGISTER_MATCHER 
1251+ #include  " AMDGPUGenAsmMatcher.inc" 
1252+ #undef  GET_REGISTER_MATCHER
1253+ #undef  GET_SUBTARGET_FEATURE_NAME
1254+ 
12491255//  Holds info related to the current kernel, e.g. count of SGPRs used.
12501256//  Kernel scope begins at .amdgpu_hsa_kernel directive, ends at next
12511257//  .amdgpu_hsa_kernel or at EOF.
@@ -1536,6 +1542,10 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
15361542 return  AMDGPU::isGFX10_BEncoding (getSTI ());
15371543 }
15381544
1545+  bool  isWave32 () const  { return  getAvailableFeatures ()[Feature_isWave32Bit]; }
1546+ 
1547+  bool  isWave64 () const  { return  getAvailableFeatures ()[Feature_isWave64Bit]; }
1548+ 
15391549 bool  hasInv2PiInlineImm () const  {
15401550 return  getFeatureBits ()[AMDGPU::FeatureInv2PiInlineImm];
15411551 }
@@ -1603,6 +1613,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
16031613 return  &MII;
16041614 }
16051615
1616+  //  FIXME: This should not be used. Instead, should use queries derived from
1617+  //  getAvailableFeatures().
16061618 const  FeatureBitset &getFeatureBits () const  {
16071619 return  getSTI ().getFeatureBits ();
16081620 }
@@ -2259,9 +2271,8 @@ bool AMDGPUOperand::isSDWAInt32Operand() const {
22592271}
22602272
22612273bool  AMDGPUOperand::isBoolReg () const  {
2262-  auto  FB = AsmParser->getFeatureBits ();
2263-  return  isReg () && ((FB[AMDGPU::FeatureWavefrontSize64] && isSCSrc_b64 ()) ||
2264-  (FB[AMDGPU::FeatureWavefrontSize32] && isSCSrc_b32 ()));
2274+  return  isReg () && ((AsmParser->isWave64 () && isSCSrc_b64 ()) ||
2275+  (AsmParser->isWave32 () && isSCSrc_b32 ()));
22652276}
22662277
22672278uint64_t  AMDGPUOperand::applyInputFPModifiers (uint64_t  Val, unsigned  Size) const 
@@ -5025,9 +5036,8 @@ bool AMDGPUAsmParser::validateDPP(const MCInst &Inst,
50255036
50265037//  Check if VCC register matches wavefront size
50275038bool  AMDGPUAsmParser::validateVccOperand (MCRegister Reg) const  {
5028-  auto  FB = getFeatureBits ();
5029-  return  (FB[AMDGPU::FeatureWavefrontSize64] && Reg == AMDGPU::VCC) ||
5030-  (FB[AMDGPU::FeatureWavefrontSize32] && Reg == AMDGPU::VCC_LO);
5039+  return  (Reg == AMDGPU::VCC && isWave64 ()) ||
5040+  (Reg == AMDGPU::VCC_LO && isWave32 ());
50315041}
50325042
50335043//  One unique literal can be used. VOP3 literal is only allowed in GFX10+
@@ -5717,7 +5727,7 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
57175727 //  Check if this instruction may be used with a different wavesize.
57185728 if  (isGFX10Plus () && getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] &&
57195729 !getFeatureBits ()[AMDGPU::FeatureWavefrontSize32]) {
5720- 
5730+   //  FIXME: Use getAvailableFeatures, and do not manually recompute 
57215731 FeatureBitset FeaturesWS32 = getFeatureBits ();
57225732 FeaturesWS32.flip (AMDGPU::FeatureWavefrontSize64)
57235733 .flip (AMDGPU::FeatureWavefrontSize32);
@@ -6472,10 +6482,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
64726482 if  (C.code_properties  & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
64736483 if  (!isGFX10Plus ())
64746484 return  TokError (" enable_wavefront_size32=1 is only allowed on GFX10+" 
6475-  if  (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6485+  if  (!isWave32 () )
64766486 return  TokError (" enable_wavefront_size32=1 requires +WavefrontSize32" 
64776487 } else  {
6478-  if  (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6488+  if  (!isWave64 () )
64796489 return  TokError (" enable_wavefront_size32=0 requires +WavefrontSize64" 
64806490 }
64816491 }
@@ -6484,10 +6494,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
64846494 if  (C.wavefront_size  == 5 ) {
64856495 if  (!isGFX10Plus ())
64866496 return  TokError (" wavefront_size=5 is only allowed on GFX10+" 
6487-  if  (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize32] )
6497+  if  (!isWave32 () )
64886498 return  TokError (" wavefront_size=5 requires +WavefrontSize32" 
64896499 } else  if  (C.wavefront_size  == 6 ) {
6490-  if  (!getFeatureBits ()[AMDGPU::FeatureWavefrontSize64] )
6500+  if  (!isWave64 () )
64916501 return  TokError (" wavefront_size=6 requires +WavefrontSize64" 
64926502 }
64936503 }
@@ -10390,7 +10400,6 @@ LLVMInitializeAMDGPUAsmParser() {
1039010400 RegisterMCAsmParser<AMDGPUAsmParser> B (getTheGCNTarget ());
1039110401}
1039210402
10393- #define  GET_REGISTER_MATCHER 
1039410403#define  GET_MATCHER_IMPLEMENTATION 
1039510404#define  GET_MNEMONIC_SPELL_CHECKER 
1039610405#define  GET_MNEMONIC_CHECKER 
0 commit comments