<s> inline bool isFlatGlobalAddrSpace ( unsigned AS ) { return AS == <ISA_LIT>AS :: GLOBAL_ADDRESS || AS == <ISA_LIT>AS :: FLAT_ADDRESS || AS == <ISA_LIT>AS

:: CONSTANT_ADDRESS || AS > <ISA_LIT>AS :: MAX_<ISA_LIT>_ADDRESS ;


<s> bool doFinalization ( Module & M ) override { Result . reset ( ) ; return false


<s> Result . reset ( new <ISA_LIT>AAResult ( M . getDataLayout ( ) ) ) ; return false


<s> bool invalidate ( Function & , const PreservedAnalyses & , FunctionAnalysisManager


<s> bool invalidate ( Function & , const PreservedAnalyses & , FunctionAnalysisManager :: Invalidator


<s> return <ISA_LIT>AAResult ( F . getParent ( ) -> getDataLayout ( )


<s> <ISA_LIT>AAResult run ( Function & F , AnalysisManager < Function > & AM ) { return <ISA_LIT>AAResult ( F . getParent (


<s> AliasResult Result = ASAliasRules . getAliasResult ( asA , asB ) ; if ( Result == NoAlias ) return Result ; return AAResultBase :: alias ( LocA , LocB


<s> unsigned asA = LocA . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; unsigned asB = LocB . Ptr -> getType ( ) -> getPointerAddressSpace


<s> case CallingConv :: <ISA_LIT>_LS : case CallingConv :: <ISA_LIT>_HS : case CallingConv :: <ISA_LIT>_ES : case CallingConv :: <ISA_LIT>_GS : case CallingConv :: <ISA_LIT>_VS : case CallingConv :: <ISA_LIT>_PS : case CallingConv :: <ISA_LIT>_CS : case CallingConv :: <ISA_LIT>_KERNEL : case CallingConv :: SPIR_KERNEL : break ; } unsigned ArgNo = Arg -> getArgNo ( ) ; if ( F -> hasParamAttribute ( ArgNo , Attribute :: NoAlias ) && ( F -> hasParamAttribute ( ArgNo , Attribute :: ReadNone ) || F -> hasParamAttribute ( ArgNo , Attribute :: ReadOnly ) ) ) { return true ; } } return AAResultBase :: pointsToConstantMemory (


<s> <ISA_LIT>AAWrapperPass :: <ISA_LIT>AAWrapperPass ( ) : ImmutablePass ( ID


<s> unsigned asB = LocB . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; AliasResult Result = getAliasResult ( asA , asB ) ; if ( Result == NoAlias


<s> default : return AAResultBase :: pointsToConstantMemory ( Loc , AAQI , OrLocal ) ; case CallingConv :: <ISA_LIT>_LS : case CallingConv :: <ISA_LIT>_HS : case CallingConv :: <ISA_LIT>_ES : case CallingConv :: <ISA_LIT>_GS : case CallingConv :: <ISA_LIT>_VS : case CallingConv :: <ISA_LIT>_PS : case CallingConv :: <ISA_LIT>_CS : case CallingConv :: <ISA_LIT>_KERNEL : case CallingConv :: SPIR_KERNEL : break ; } unsigned ArgNo = Arg -> getArgNo ( ) ; if ( F -> hasParamAttribute ( ArgNo , Attribute :: NoAlias ) && ( F -> hasParamAttribute ( ArgNo , Attribute :: ReadNone ) || F -> hasParamAttribute ( ArgNo , Attribute :: ReadOnly ) ) ) { return true


<s> if ( const GlobalVariable * GV = dyn_cast < GlobalVariable > ( Base ) ) { if ( GV -> isConstant ( ) ) return true ; } else if ( const Argument * Arg = dyn_cast < Argument > ( Base ) ) { const Function * F = Arg -> getParent ( ) ; switch ( F -> getCallingConv ( ) ) { default : return AAResultBase :: pointsToConstantMemory ( Loc , AAQI , OrLocal ) ; case CallingConv :: <ISA_LIT>_LS : case CallingConv :: <ISA_LIT>_HS : case CallingConv :: <ISA_LIT>_ES : case CallingConv :: <ISA_LIT>_GS : case CallingConv :: <ISA_LIT>_VS : case CallingConv :: <ISA_LIT>_PS : case CallingConv :: <ISA_LIT>_CS : case CallingConv :: <ISA_LIT>_KERNEL : case CallingConv ::


<s> break ; } unsigned ArgNo = Arg -> getArgNo ( ) ; if ( F -> getAttributes ( ) . hasAttribute ( ArgNo + <NUM_LIT> , Attribute :: NoAlias ) && ( F -> getAttributes ( ) . hasAttribute ( ArgNo + <NUM_LIT> , Attribute :: ReadNone ) || F -> getAttributes ( ) . hasAttribute ( ArgNo + <NUM_LIT> , Attribute :: ReadOnly ) ) ) { return true ; } } return AAResultBase :: pointsToConstantMemory ( Loc , OrLocal


<s> bool <ISA_LIT>AAResult :: pointsToConstantMemory ( const MemoryLocation & Loc , AAQueryInfo & AAQI , bool OrLocal ) { unsigned AS = Loc . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; if ( AS == <ISA_LIT>AS :: CONSTANT_ADDRESS || AS == <ISA_LIT>AS :: CONSTANT_ADDRESS_32BIT ) return true ; const Value * Base = GetUnderlyingObject ( Loc . Ptr , DL ) ; AS = Base -> getType ( ) -> getPointerAddressSpace ( ) ; if ( AS == <ISA_LIT>AS :: CONSTANT_ADDRESS || AS == <ISA_LIT>AS :: CONSTANT_ADDRESS_32BIT ) return true ; if ( const GlobalVariable * GV = dyn_cast < GlobalVariable > ( Base ) ) { if ( GV -> isConstant ( )


<s> std :: swap ( asA , asB ) ; std :: swap ( A , B ) ; } if ( asA == <ISA_LIT>AS :: FLAT_ADDRESS && ( asB == <ISA_LIT>AS :: LOCAL_ADDRESS || asB == <ISA_LIT>AS :: PRIVATE_ADDRESS ) ) { const auto * ObjA = getUnderlyingObject ( A . Ptr -> stripPointerCastsAndInvariantGroups ( ) ) ; if ( const LoadInst * LI = dyn_cast < LoadInst > ( ObjA ) ) { if ( LI -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: CONSTANT_ADDRESS ) return NoAlias ; } else if ( const Argument * Arg = dyn_cast < Argument > ( ObjA


<s> AliasResult <ISA_LIT>AAResult :: alias ( const MemoryLocation & LocA , const MemoryLocation & LocB , AAQueryInfo & AAQI ) { unsigned asA = LocA . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; unsigned asB = LocB . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; AliasResult Result = getAliasResult ( asA , asB ) ; if ( Result == NoAlias ) return Result ; MemoryLocation A = LocA ; MemoryLocation B = LocB ; if ( asA != <ISA_LIT>AS :: FLAT_ADDRESS ) { std :: swap ( asA , asB ) ; std :: swap ( A , B ) ; } if ( asA == <ISA_LIT>AS :: FLAT_ADDRESS && ( asB == <ISA_LIT>AS :: LOCAL_ADDRESS || asB == <ISA_LIT>AS :: PRIVATE_ADDRESS ) ) { const auto * ObjA = getUnderlyingObject ( A . Ptr -> stripPointerCastsAndInvariantGroups ( ) ) ; if ( const LoadInst * LI = dyn_cast < LoadInst


<s> if ( AS1 > <ISA_LIT>AS :: MAX_<ISA_LIT>_ADDRESS ||

AS2 > <ISA_LIT>AS :: MAX_<ISA_LIT>_ADDRESS ) return MayAlias ;


<s> unsigned AS = Loc . Ptr -> getType ( ) -> getPointerAddressSpace ( ) ; if ( AS == <ISA_LIT>AS :: CONSTANT_ADDRESS || AS == <ISA_LIT>AS :: CONSTANT_ADDRESS_32BIT ) return true ; const Value * Base = getUnderlyingObject ( Loc . Ptr ) ; AS = Base -> getType ( ) -> getPointerAddressSpace ( ) ; if ( AS == <ISA_LIT>AS :: CONSTANT_ADDRESS || AS == <ISA_LIT>AS :: CONSTANT_ADDRESS_32BIT ) return true ; if ( const GlobalVariable * GV = dyn_cast < GlobalVariable > ( Base ) ) { if ( GV -> isConstant ( ) ) return true ; } else if ( const Argument * Arg = dyn_cast < Argument > ( Base ) ) { const Function * F = Arg -> getParent ( ) ; switch ( F -> getCallingConv ( ) ) { default : return AAResultBase :: pointsToConstantMemory ( Loc , AAQI , OrLocal ) ; case CallingConv :: <ISA_LIT>_LS : case CallingConv :: <ISA_LIT>_HS : case CallingConv :: <ISA_LIT>_ES : case CallingConv


<s> ImmutablePass * llvm :: create<ISA_LIT>AAWrapperPass ( )


<s> ImmutablePass * llvm :: create<ISA_LIT>ExternalAAWrapperPass ( ) { return new <ISA_LIT>ExternalAAWrapper


<s> bool invalidate ( Function & , const PreservedAnalyses & ) { return false


<s> return <ISA_LIT>AAResult ( F . getParent ( ) -> getDataLayout ( ) , Triple ( F . getParent ( ) -> getTargetTriple (


<s> return <ISA_LIT>AAResult ( F . getParent ( ) -> getDataLayout ( ) ,

Triple ( F . getParent ( ) -> getTargetTriple ( ) ) ) ;


<s> <ISA_LIT>AlwaysInline ( bool GlobalOpt = false ) : ModulePass ( ID ) ,


<s> StringRef getPassName ( ) const override { return <STR_LIT>


<s> std :: vector < GlobalAlias * > AliasesToRemove ; std :: vector < Function * > FuncsToClone ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } if ( GlobalOpt ) { for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } } for ( Function & F : M ) { if ( ! F . hasLocalLinkage ( ) && ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F . hasFnAttribute ( Attribute :: NoInline ) ) FuncsToClone . push_back ( & F ) ; } for ( Function * F


<s> static bool alwaysInlineImpl ( Module & M , bool GlobalOpt ) { std :: vector < GlobalAlias * > AliasesToRemove ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToAlwaysInline ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToNoInline ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } if ( GlobalOpt ) { for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } } for ( GlobalVariable & GV : M . globals ( ) ) { unsigned AS = GV . getAddressSpace ( ) ; if ( ( AS == <ISA_LIT>AS :: REGION_ADDRESS ) || ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS && ! <ISA_LIT>TargetMachine :: EnableLowerModuleLDS ) ) recursivelyVisitUsers ( GV , FuncsToAlwaysInline ) ; } if ( ! <ISA_LIT>TargetMachine :: EnableFunctionCalls || StressCalls ) { auto IncompatAttr = StressCalls ? Attribute :: AlwaysInline : Attribute :: NoInline ; for ( Function & F


<s> User * U = Stack . pop_back_val ( ) ; if ( ! Visited . insert ( U ) . second ) continue ; if ( Instruction * I = dyn_cast < Instruction > ( U ) ) { Function * F = I -> getParent ( ) -> getParent ( ) ; if ( ! <STR_LIT> ( F -> getCallingConv ( ) ) ) { F -> removeFnAttr ( Attribute :: NoInline ) ; FuncsToAlwaysInline . insert ( F ) ; Stack . push_back ( F ) ; } continue ; } append_range ( Stack , U


<s> PreservedAnalyses <ISA_LIT>AlwaysInlinePass :: run ( Module & M , ModuleAnalysisManager & AM ) { alwaysInlineImpl ( M , GlobalOpt ) ; return PreservedAnalyses ::


<s> bool <ISA_LIT>AlwaysInline :: runOnModule ( Module & M ) { return alwaysInlineImpl ( M


<s> return alwaysInlineImpl ( M , GlobalOpt


<s> if ( Instruction * I = dyn_cast < Instruction > ( U ) ) { Function * F = I -> getParent ( ) -> getParent ( ) ; if ( ! <STR_LIT> ( F -> getCallingConv ( ) ) ) { FuncsToAlwaysInline . insert ( F ) ; Stack . push_back ( F


<s> for ( User * U : GV . users ( ) ) Stack . push_back ( U ) ; while ( ! Stack . empty ( ) ) { User * U = Stack . pop_back_val ( ) ; if ( ! Visited . insert ( U ) . second ) continue ; if ( Instruction * I = dyn_cast < Instruction > ( U


<s> unsigned AS = GV . getAddressSpace ( ) ; if ( AS != <ISA_LIT>AS :: LOCAL_ADDRESS && AS != <ISA_LIT>AS :: REGION_ADDRESS ) continue ; recursivelyVisitUsers ( GV , FuncsToAlwaysInline ) ; } if ( ! <ISA_LIT>TargetMachine :: EnableFunctionCalls || StressCalls ) { auto IncompatAttr = StressCalls ? Attribute :: AlwaysInline : Attribute :: NoInline ; for ( Function & F : M ) { if ( ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F .


<s> std :: vector < GlobalAlias * > AliasesToRemove ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToAlwaysInline ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToNoInline ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } if ( GlobalOpt ) { for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } } for ( GlobalVariable & GV : M . globals ( ) ) { unsigned AS = GV . getAddressSpace ( ) ; if ( AS != <ISA_LIT>AS :: LOCAL_ADDRESS && AS != <ISA_LIT>AS :: REGION_ADDRESS ) continue ; recursivelyVisitUsers ( GV , FuncsToAlwaysInline ) ; } if ( ! <ISA_LIT>TargetMachine :: EnableFunctionCalls || StressCalls ) { auto IncompatAttr = StressCalls ? Attribute :: AlwaysInline : Attribute :: NoInline ; for ( Function & F : M ) { if ( ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F . hasFnAttribute ( IncompatAttr ) ) { if ( StressCalls ) { if ( ! FuncsToAlwaysInline . count ( & F ) ) FuncsToNoInline . insert ( & F ) ; } else FuncsToAlwaysInline . insert ( & F ) ; } } } for ( Function * F : FuncsToAlwaysInline ) F -> addFnAttr ( Attribute :: AlwaysInline ) ; for ( Function * F : FuncsToNoInline ) F -> addFnAttr ( Attribute :: NoInline ) ; return ! FuncsToAlwaysInline . empty ( ) || ! FuncsToNoInline


<s> std :: vector < GlobalAlias * > AliasesToRemove ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToAlwaysInline ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToNoInline ; Triple TT ( M . getTargetTriple ( ) ) ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { if ( TT . getArch ( ) == Triple :: amdgcn && A . getLinkage ( ) != GlobalValue :: InternalLinkage ) continue ; A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( &


<s> for ( GlobalVariable & GV : M . globals ( ) ) { unsigned AS = GV . getAddressSpace ( ) ; if ( ( AS == <ISA_LIT>AS :: REGION_ADDRESS ) || ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS && ( ! <ISA_LIT>TargetMachine :: EnableLowerModuleLDS || ! GV . hasInitializer ( ) ) ) ) recursivelyVisitUsers ( GV , FuncsToAlwaysInline ) ; } if ( ! <ISA_LIT>TargetMachine :: EnableFunctionCalls || StressCalls ) { auto IncompatAttr = StressCalls ? Attribute :: AlwaysInline : Attribute :: NoInline ; for ( Function & F : M ) { if ( ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F . hasFnAttribute ( IncompatAttr ) ) { if ( StressCalls ) { if ( ! FuncsToAlwaysInline . count ( & F ) ) FuncsToNoInline


<s> std :: vector < GlobalAlias * > AliasesToRemove ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToAlwaysInline ; SmallPtrSet < Function * , <NUM_LIT> > FuncsToNoInline ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } if ( GlobalOpt ) { for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } } for ( GlobalVariable & GV : M . globals ( ) ) { unsigned AS = GV . getAddressSpace ( ) ; if ( ( AS == <ISA_LIT>AS :: REGION_ADDRESS ) || ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS && ( ! <ISA_LIT>TargetMachine :: EnableLowerModuleLDS || ! GV . hasInitializer ( ) ) ) ) recursivelyVisitUsers (


<s> SmallPtrSet < Function * , <NUM_LIT> > FuncsToNoInline ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } if ( GlobalOpt ) { for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } } for ( GlobalVariable & GV : M . globals ( ) ) { unsigned AS = GV . getAddressSpace ( ) ; if ( ( AS == <ISA_LIT>AS :: REGION_ADDRESS ) || ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS && ( ! <ISA_LIT>TargetMachine :: EnableLowerModuleLDS || ! GV . hasInitializer ( ) ) ) ) recursivelyVisitUsers ( GV , FuncsToAlwaysInline ) ; } if ( ! <ISA_LIT>TargetMachine :: EnableFunctionCalls || StressCalls ) { auto IncompatAttr = StressCalls ? Attribute :: AlwaysInline : Attribute :: NoInline ; for ( Function & F : M ) { if ( ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F . hasFnAttribute ( IncompatAttr ) ) { if ( StressCalls ) { if ( ! FuncsToAlwaysInline . count ( & F ) ) FuncsToNoInline . insert ( & F ) ; } else FuncsToAlwaysInline . insert ( & F ) ; } } } for ( Function * F : FuncsToAlwaysInline ) F -> addFnAttr ( Attribute :: AlwaysInline ) ; for ( Function * F : FuncsToNoInline ) F -> addFnAttr ( Attribute :: NoInline ) ; return ! FuncsToAlwaysInline . empty ( )


<s> for ( User * U : GV . users ( ) ) Stack . push_back ( U ) ; while ( ! Stack . empty ( ) ) { User * U = Stack . pop_back_val ( ) ; if ( ! Visited . insert ( U ) . second ) continue ; if ( Instruction * I = dyn_cast <


<s> std :: vector < GlobalAlias * > AliasesToRemove ; std :: vector < Function * > FuncsToClone ; for ( GlobalAlias & A : M . aliases ( ) ) { if ( Function * F = dyn_cast < Function > ( A . getAliasee ( ) ) ) { A . replaceAllUsesWith ( F ) ; AliasesToRemove . push_back ( & A ) ; } } for ( GlobalAlias * A : AliasesToRemove ) { A -> eraseFromParent ( ) ; } for ( Function & F : M ) { if ( ! F . hasLocalLinkage ( ) && ! F . isDeclaration ( ) && ! F . use_empty ( ) && ! F . hasFnAttribute ( Attribute :: NoInline ) ) FuncsToClone . push_back ( & F ) ; } for ( Function * F :


<s> void <ISA_LIT>AnnotateKernelFeatures :: addAttrToCallers ( Function * Intrin , StringRef AttrName ) { SmallPtrSet < Function * , <NUM_LIT> > SeenFuncs ; for ( User * U : Intrin -> users ( ) ) { CallInst * CI = cast < CallInst > ( U ) ; Function * CallingFunction = CI -> getParent ( ) -> getParent ( ) ; if ( SeenFuncs . insert ( CallingFunction ) . second ) CallingFunction -> addFnAttr (


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { AU . setPreservesAll (


<s> for ( CallGraphNode * I : SCC ) { Function * F = I -> getFunction ( ) ; if ( ! F || F -> isDeclaration ( ) || <STR_LIT> ( F -> getCallingConv ( ) ) ) continue ; Changed |= addFeatureAttributes ( * F ) ; } return Changed


<s> if ( ! F || F -> isDeclaration ( ) || <STR_LIT> ( F -> getCallingConv ( ) ) ) continue ; Changed |= addFeatureAttributes ( * F ) ; } return Changed


<s> bool HaveCall = false ; bool HasIndirectCall = false ; bool IsFunc = ! <STR_LIT> ( F . getCallingConv ( ) ) ; CallingConv :: ID CC = F . getCallingConv ( ) ; bool CallingConvSupportsAllImplicits = ( CC != CallingConv :: <ISA_LIT>_Gfx ) ; if ( CallingConvSupportsAllImplicits && F . hasAddressTaken ( nullptr , true , true , true ) ) { for ( StringRef AttrName : ImplicitAttrNames ) { F . addFnAttr ( AttrName ) ; } Changed = true ; } for ( BasicBlock & BB : F ) { for ( Instruction & I : BB ) { if ( isa < AllocaInst > ( I ) ) { HaveStackObjects = true ; continue ; } if ( auto * CB = dyn_cast < CallBase > ( & I ) ) { const Function * Callee = dyn_cast < Function > ( CB -> getCalledOperand ( ) -> stripPointerCasts ( ) ) ; if ( ! Callee ) { if ( ! CB -> isInlineAsm ( ) ) { HasIndirectCall = true ; HaveCall = true ; } continue ; } <STR_LIT> IID = Callee -> getIntrinsicID ( ) ; if ( IID == <STR_LIT> ) { HaveCall = true ; copyFeaturesToFunction ( F , * Callee


<s> NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT>


<s> } ; static const StringRef HSAIntrinsicToAttr [ ] [ <NUM_LIT> ] = { { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } } ; bool Changed = addAttrsForIntrinsics ( M , IntrinsicToAttr ) ; if ( TT . getOS ( ) == Triple :: AMDHSA || TT . getOS ( ) == Triple :: Mesa3D ) { Changed |= addAttrsForIntrinsics ( M ,


<s> if ( IID == <STR_LIT> ) { HaveCall = true ; copyFeaturesToFunction ( F , * Callee , NeedQueuePtr ) ; Changed = true ; } else { bool NonKernelOnly = false ; if ( ! IsFunc && IID == <STR_LIT> ) { F . addFnAttr ( <STR_LIT> ) ; } else { StringRef AttrName = intrinsicToAttrName ( IID , NonKernelOnly , NeedQueuePtr ) ; if ( ! AttrName . empty ( ) && ( IsFunc || ! NonKernelOnly ) ) { F . addFnAttr ( AttrName ) ; Changed = true ; } } } } if ( NeedQueuePtr || ( ! IsFunc && HasApertureRegs ) ) continue ; if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( ! HasApertureRegs && castRequiresQueuePtr ( ASC ) ) { NeedQueuePtr = true ; continue ; } } for ( const Use & U : I . operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC )


<s> <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> } ; if ( handleAttr ( Parent , Callee , <STR_LIT> ) ) NeedQueuePtr = true ; for ( StringRef AttrName : AttrNames ) handleAttr ( Parent , Callee


<s> static void copyFeaturesToFunction ( Function & Parent , const Function & Callee , bool & NeedQueuePtr ) { static constexpr StringLiteral AttrNames


<s> static void copyFeaturesToFunction ( Function & Parent , const Function & Callee


<s> if ( handleAttr ( Parent , Callee , <STR_LIT> ) ) NeedQueuePtr = true ; for ( StringRef AttrName : ImplicitAttrNames ) handleAttr ( Parent , Callee ,


<s> return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : IsQueuePtr =


<s> static bool isDSAddress ( const Constant * C ) { const GlobalValue * GV = dyn_cast < GlobalValue > ( C ) ; if ( ! GV ) return


<s> bool Changed = false ; for ( auto * Node : reverse ( NodeList ) ) { Function * Caller = Node -> getFunction ( ) ; for ( auto I : * Node ) { Function * Callee = std :: get < <NUM_LIT> >


<s> } Function * F = I -> getFunction ( ) ; if ( ! F || F -> isDeclaration ( ) || <STR_LIT> ( F -> getCallingConv ( ) ) ) continue ; Changed |= addFeatureAttributes ( * F


<s> return castRequiresQueuePtr ( ASC -> getSrcAddressSpace ( )


<s> { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> }


<s> static void copyFeaturesToFunction ( Function & Parent , const Function & Callee , bool & NeedQueuePtr ) { static const StringRef AttrNames [ ] = { { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } , { <STR_LIT> } } ; if ( handleAttr ( Parent , Callee , <STR_LIT> ) ) NeedQueuePtr


<s> bool <ISA_LIT>AnnotateKernelFeatures :: doInitialization ( CallGraph & CG ) { auto * TPC = getAnalysisIfAvailable < TargetPassConfig


<s> auto * TPC = getAnalysisIfAvailable < TargetPassConfig > ( ) ; if ( ! TPC ) report_fatal_error ( <STR_LIT>


<s> NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case


<s> unsigned SrcAS = CE -> getOperand ( <NUM_LIT> ) -> getType ( ) -> getPointerAddressSpace ( ) ; return castRequiresQueuePtr ( SrcAS , AS ) ; } return false


<s> static bool castRequiresQueuePtr ( const AddrSpaceCastInst * ASC ) { unsigned SrcAS = ASC -> getSrcAddressSpace


<s> bool <ISA_LIT>AnnotateKernelFeatures :: hasAddrSpaceCast ( const Function & F ) { for ( const BasicBlock & BB : F ) { for ( const Instruction & I : BB ) { if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( castRequiresQueuePtr ( ASC


<s> } } ; static const StringRef HSAIntrinsicToAttr [ ] [ <NUM_LIT> ] = { { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } } ; bool Changed = addAttrsForIntrinsics ( M , IntrinsicToAttr ) ; if ( TT . getOS ( ) == Triple :: AMDHSA ) { Changed |= addAttrsForIntrinsics ( M , HSAIntrinsicToAttr ) ; for ( Function & F : M ) { if ( F . hasFnAttribute ( <STR_LIT>


<s> if ( ! Callee ) continue ; <STR_LIT> IID = Callee -> getIntrinsicID ( ) ; if ( IID == <STR_LIT> ) { copyFeaturesToFunction ( F , * Callee , NeedQueuePtr ) ; Changed = true ; } else { StringRef AttrName = intrinsicToAttrName ( IID , NeedQueuePtr ) ; if ( ! AttrName . empty ( ) ) { F . addFnAttr ( AttrName ) ; Changed = true ; } } } if ( NeedQueuePtr || HasApertureRegs ) continue ; if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( castRequiresQueuePtr ( ASC , AS ) ) { NeedQueuePtr = true ; continue ; } } for ( const Use & U : I . operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC ) continue ; if ( visitConstantExprsRecursively ( OpC , ConstantExprVisited , AS ) ) { NeedQueuePtr = true ; break ; } } } } if ( NeedQueuePtr


<s> static const StringRef HSAIntrinsicToAttr [ ] [ <NUM_LIT> ] = { { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> ,


<s> for ( const Instruction & I : BB ) { if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( castRequiresQueuePtr ( ASC , AS ) ) return true ; } for ( const Use & U : I . operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC ) continue ; if ( visitConstantExprsRecursively ( OpC , ConstantExprVisited , AS ) ) return true ; } } } return false


<s> { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } } ; bool Changed = addAttrsForIntrinsics ( M , IntrinsicToAttr ) ; if ( TT . getOS ( ) == Triple :: AMDHSA ) { Changed |= addAttrsForIntrinsics ( M , HSAIntrinsicToAttr ) ; for ( Function & F : M ) { if ( F . hasFnAttribute (


<s> StringRef AttrName = intrinsicToAttrName ( IID , NonKernelOnly , NeedQueuePtr ) ; if ( ! AttrName . empty ( ) && ( IsFunc || ! NonKernelOnly ) ) { F . addFnAttr ( AttrName ) ; Changed = true ; } } } if ( NeedQueuePtr || HasApertureRegs ) continue ; if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( castRequiresQueuePtr ( ASC , AS ) ) { NeedQueuePtr = true ; continue ; } } for ( const Use & U : I . operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC ) continue ; if ( visitConstantExprsRecursively ( OpC , ConstantExprVisited , AS ) ) { NeedQueuePtr = true


<s> } ; static const StringRef HSAIntrinsicToAttr [ ] [ <NUM_LIT> ] = { { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } } ; bool Changed = addAttrsForIntrinsics ( M , IntrinsicToAttr ) ; if ( TT . getOS ( ) == Triple :: AMDHSA ) Changed |= addAttrsForIntrinsics ( M ,


<s> } } } } if ( NeedQueuePtr || ( ! IsFunc && HasApertureRegs ) ) continue ; if ( const AddrSpaceCastInst * ASC = dyn_cast < AddrSpaceCastInst > ( & I ) ) { if ( ! HasApertureRegs && castRequiresQueuePtr ( ASC ) ) { NeedQueuePtr = true ; continue ; } } for ( const Use & U : I . operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC ) continue ; if ( visitConstantExprsRecursively ( OpC , ConstantExprVisited , IsFunc , HasApertureRegs ) ) { NeedQueuePtr = true ; break ; } } } } if ( NeedQueuePtr ) { F . addFnAttr ( <STR_LIT> ) ; Changed = true ; } if ( ! IsFunc && HaveCall ) { F . addFnAttr ( <STR_LIT> ) ; Changed = true


<s> Triple TT ( M . getTargetTriple ( ) ) ; AS = <STR_LIT> ( M ) ; static const StringRef IntrinsicToAttr [ ] [ <NUM_LIT> ] = { { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } , { <STR_LIT> , <STR_LIT> } } ; static const StringRef HSAIntrinsicToAttr [ ]


<s> <STR_LIT> , <STR_LIT> } } ; bool Changed = addAttrsForIntrinsics ( M , IntrinsicToAttr ) ; if ( TT . getOS ( ) == Triple :: AMDHSA || TT . getOS ( ) == Triple :: Mesa3D ) { Changed |= addAttrsForIntrinsics ( M , HSAIntrinsicToAttr ) ; for ( Function & F : M ) { if ( F . hasFnAttribute ( <STR_LIT>


<s> bool NeedQueuePtr = false ; bool HaveCall = false ; bool IsFunc = ! <STR_LIT> ( F . getCallingConv ( ) ) ; for ( BasicBlock & BB : F ) { for ( Instruction & I : BB ) { CallSite CS ( & I ) ; if ( CS ) { Function * Callee = CS . getCalledFunction ( ) ; if ( ! Callee ) { if ( ! CS . isInlineAsm ( ) ) HaveCall = true ; continue ; } <STR_LIT> IID = Callee -> getIntrinsicID ( ) ; if ( IID == <STR_LIT> ) { HaveCall = true ; copyFeaturesToFunction ( F , * Callee , NeedQueuePtr ) ; Changed = true ; } else { bool NonKernelOnly = false ; StringRef AttrName = intrinsicToAttrName ( IID


<s> static bool castRequiresQueuePtr ( const AddrSpaceCastInst * ASC


<s> return new <ISA_LIT>AnnotateKernelFeatures


<s> if ( ! TPC ) report_fatal_error ( <STR_LIT> ) ; TM = & TPC -> getTM < TargetMachine > ( ) ; return


<s> if ( ! TPC ) report_fatal_error ( <STR_LIT> ) ; TM = & TPC -> getTM <


<s> AU . setPreservesAll ( ) ; CallGraphSCCPass :: getAnalysisUsage (


<s> switch ( ID ) { case <STR_LIT> : NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : NonKernelOnly = true ; return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : case <STR_LIT> : return <STR_LIT> ; case <STR_LIT>


<s> for ( CallGraphNode * I : SCC ) { Function * F = I -> getFunction ( ) ; if ( ! F || F -> isDeclaration ( )


<s> bool <ISA_LIT>AnnotateKernelFeatures :: visitConstantExpr ( const ConstantExpr * CE ) { if ( CE -> getOpcode ( ) == Instruction :: AddrSpaceCast ) { unsigned SrcAS = CE -> getOperand ( <NUM_LIT> ) -> getType ( )


<s> while ( ! Stack . empty ( ) ) { const Constant * C = Stack . pop_back_val ( ) ; if ( const auto * CE = dyn_cast < ConstantExpr > ( C ) ) { if ( visitConstantExpr ( CE ) ) return true ; } for ( const Use & U : C -> operands ( ) ) { const auto * OpC = dyn_cast < Constant > ( U ) ; if ( ! OpC


<s> bool NotClobbered = false ; if ( PtrI ) NotClobbered = ! isClobberedInFunction ( & I ) ; else if ( isa < Argument > ( Ptr ) || isa < GlobalValue > ( Ptr ) ) { if ( isGlobalLoad ( I ) && ! isClobberedInFunction ( & I ) ) { NotClobbered = true ; if ( noClobberClones . count ( Ptr ) ) { PtrI = noClobberClones [ Ptr ] ; } else { Function * F = I . getParent ( ) -> getParent ( ) ; Value * Idx = Constant :: getIntegerValue ( Type :: getInt32Ty ( Ptr -> getContext ( ) ) , APInt ( <NUM_LIT> , <NUM_LIT> ) ) ; PtrI = GetElementPtrInst :: Create ( Ptr -> getType ( ) -> getPointerElementType ( ) , Ptr , ArrayRef < Value * > ( Idx ) , Twine ( <STR_LIT> ) , F -> getEntryBlock ( ) . getFirstNonPHI ( ) ) ; } I . replaceUsesOfWith ( Ptr , PtrI ) ; } } if ( PtrI ) { setUniformMetadata ( PtrI


<s> bool <ISA_LIT>AnnotateUniformValues :: isClobberedInFunction ( LoadInst * Load ) { const MemoryAccess * MA = MSSA -> getWalker ( ) -> getClobberingMemoryAccess ( Load


<s> MSSA = & getAnalysis < MemorySSAWrapperPass > ( ) . getMSSA ( ) ; isEntryFunc = <STR_LIT> ( F . getCallingConv ( ) ) ; visit ( F ) ; noClobberClones . clear ( ) ; return true


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { AU . addRequired < DivergenceAnalysis > ( ) ; AU . setPreservesAll


<s> DA = & getAnalysis < DivergenceAnalysis > ( ) ; visit (


<s> if ( skipFunction ( F ) ) return false ; DA = & getAnalysis <


<s> void <ISA_LIT>AnnotateUniformValues :: visitLoadInst ( LoadInst & I ) { Value * Ptr = I . getPointerOperand ( ) ; if ( ! DA -> isUniform ( Ptr )


<s> Checklist . insert ( L -> block_begin ( ) , L -> block_end ( ) ) ; Start = L -> getHeader ( ) ; } DFS ( Start , Checklist ) ; for ( auto & BB : Checklist ) { BasicBlock :: iterator StartIt = ( BB == Load -> getParent ( ) ) ? BasicBlock :: iterator ( Load ) : BB -> end ( ) ; if ( MDR -> getPointerDependencyFrom ( MemoryLocation ( Ptr ) , true , StartIt , BB , Load ) . isClobber


<s> DA = & getAnalysis < DivergenceAnalysis > ( ) ; MDR = & getAnalysis < MemoryDependenceWrapperPass > ( ) . getMemDep ( ) ; LI = & getAnalysis < LoopInfoWrapperPass > ( ) . getLoopInfo ( ) ; isKernelFunc = F . getCallingConv ( ) == CallingConv :: <ISA_LIT>_KERNEL ; visit ( F


<s> Value * Idx = Constant :: getIntegerValue ( Type :: getInt32Ty ( Ptr -> getContext ( ) ) , APInt ( <NUM_LIT> , <NUM_LIT> ) ) ; PtrI = GetElementPtrInst :: Create ( Ptr -> getType ( ) -> getPointerElementType ( ) , Ptr , ArrayRef < Value * > ( Idx ) , Twine ( <STR_LIT> ) , F -> getEntryBlock ( ) . getFirstNonPHI ( ) ) ; } I . replaceUsesOfWith ( Ptr , PtrI ) ; } } if ( PtrI


<s> AMDGPUA<ISA_LIT> = <STR_LIT> ( M ) ; return false


<s> MDR = & getAnalysis < MemoryDependenceWrapperPass > ( ) . getMemDep ( ) ; LI = & getAnalysis < LoopInfoWrapperPass > ( ) . getLoopInfo ( ) ; isEntryFunc = <STR_LIT> ( F . getCallingConv ( ) ) ; visit ( F ) ; noClobberClones . clear (


<s> MDR = & getAnalysis < MemoryDependenceWrapperPass > ( ) . getMemDep ( ) ; LI = & getAnalysis < LoopInfoWrapperPass > ( ) . getLoopInfo


<s> if ( DA -> isUniform ( & I ) ) setUniformMetadata ( I . getParent ( ) -> getTerminator


<s> } else { Function * F = I . getParent ( ) -> getParent ( ) ; Value * Idx = Constant :: getIntegerValue ( Type :: getInt32Ty ( Ptr -> getContext ( ) ) , APInt ( <NUM_LIT> , <NUM_LIT> ) ) ; PtrI = GetElementPtrInst :: Create ( Ptr -> getType ( ) -> getPointerElementType ( ) , Ptr , ArrayRef < Value * > ( Idx ) , Twine ( <STR_LIT> ) , F -> getEntryBlock ( ) . getFirstNonPHI ( ) ) ; } I . replaceUsesOfWith ( Ptr , PtrI ) ; } } if ( PtrI ) { setUniformMetadata ( PtrI ) ; if ( NotClobbered ) setNoClobberMetadata


<s> AU . addRequired < LegacyDivergenceAnalysis > ( ) ; AU . addRequired < MemorySSAWrapperPass > ( ) ; AU . addRequired < AAResultsWrapperPass > (


<s> case <STR_LIT> : case <STR_LIT> : return false ; default : break ; } } const auto checkNoAlias = [ this , Load ] ( auto I ) -> bool { return I && AA -> isNoAlias ( I -> getPointerOperand ( ) , Load -> getPointerOperand ( ) ) ; } ; if ( checkNoAlias ( dyn_cast < AtomicCmpXchgInst > ( DefInst ) ) || checkNoAlias ( dyn_cast < AtomicRMWInst > ( DefInst ) ) ) return false ; return true ; } ; LLVM_DEBUG ( dbgs ( ) << <STR_LIT> << * Load << '\n' ) ; while ( ! WorkList . empty ( ) ) { MemoryAccess * MA = WorkList . pop_back_val ( ) ; if ( ! Visited . insert ( MA ) .


<s> AA = & getAnalysis < AAResultsWrapperPass > ( ) . getAAResults ( ) ; isEntryFunc = <STR_LIT> ( F . getCallingConv ( ) ) ; visit ( F


<s> Value * Ptr = I . getPointerOperand ( ) ; if ( ! DA -> isUniform ( Ptr ) ) return ; if ( Instruction * PtrI = dyn_cast < Instruction > ( Ptr ) ) PtrI -> setMetadata ( <STR_LIT> , MDNode :: get ( I


<s> const Loop * L = LI -> getLoopFor ( Start ) ; if ( L ) { const Loop * P = L ; do { L = P ; P = P -> getParentLoop ( ) ; } while ( P ) ; Checklist . insert ( L -> block_begin ( ) , L -> block_end ( )


<s> void setNoClobberMetadata ( Instruction * I ) { I -> setMetadata ( <STR_LIT> , MDNode :: get ( I -> getContext ( ) , { }


<s> void setUniformMetadata ( Instruction * I ) { I -> setMetadata ( <STR_LIT> , MDNode :: get ( I


<s> Instruction * PtrI = dyn_cast < Instruction > ( Ptr ) ; if ( PtrI ) setUniformMetadata ( PtrI ) ; if ( ! isEntryFunc ) return ; bool GlobalLoad = I . getPointerAddressSpace ( ) == <ISA_LIT>AS :: GLOBAL_ADDRESS ; if ( GlobalLoad && ! <STR_LIT> ( & I , MSSA ,


<s> Instruction * PtrI = dyn_cast < Instruction > ( Ptr ) ; if ( PtrI ) setUniformMetadata ( PtrI ) ; if ( ! isEntryFunc ) return ; bool GlobalLoad = I . getPointerAddressSpace ( ) == <ISA_LIT>AS :: GLOBAL_ADDRESS ; if ( GlobalLoad && ! <STR_LIT> ( & I , MSSA , AA ) ) setNoClobberMetadata ( &


<s> return new <ISA_LIT>AnnotateUniformValues ( )


<s> FunctionPass * llvm :: create<ISA_LIT>AnnotateUniformValues ( ) { return new <ISA_LIT>AnnotateUniformValues


<s> bool <ISA_LIT>AnnotateUniformValues :: doInitialization ( Module & M ) { return false


<s> AU . addRequired < LegacyDivergenceAnalysis > ( ) ; AU . addRequired < MemoryDependenceWrapperPass > ( ) ; AU . addRequired < LoopInfoWrapperPass > ( ) ; AU . setPreservesAll


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { AU . addRequired < LegacyDivergenceAnalysis > ( ) ; AU . addRequired < MemoryDependenceWrapperPass > ( ) ; AU . addRequired < LoopInfoWrapperPass >


<s> StringRef getPassName ( ) const override


<s> if ( L ) { const Loop * P = L ; do { L = P ; P = P -> getParentLoop ( ) ; } while ( P ) ; Checklist . insert ( L -> block_begin ( ) , L -> block_end ( ) ) ; Start = L -> getHeader ( ) ; } DFS ( Start ,


<s> DA = & getAnalysis < LegacyDivergenceAnalysis > ( ) ; MDR = & getAnalysis < MemoryDependenceWrapperPass > ( ) . getMemDep ( ) ; LI = & getAnalysis < LoopInfoWrapperPass > ( ) . getLoopInfo ( ) ; isKernelFunc = F . getCallingConv (


<s> MDR = & getAnalysis < MemoryDependenceWrapperPass > ( ) . getMemDep ( ) ; LI = & getAnalysis < LoopInfoWrapperPass > ( ) . getLoopInfo ( ) ; isKernelFunc = F . getCallingConv ( ) == CallingConv :: <ISA_LIT>_KERNEL ; visit ( F ) ; noClobberClones . clear ( ) ; return true


<s> static void setNoClobberMetadata ( Instruction * I ) { I -> setMetadata ( <STR_LIT> , MDNode :: get ( I -> getContext ( ) ,


<s> void <ISA_LIT>AnnotateUniformValues :: visitBranchInst ( BranchInst & I ) { if ( I . isUnconditional ( ) ) return ; Value * Cond = I


<s> if ( I . isUnconditional ( ) ) return ; Value * Cond = I . getCondition ( ) ; if ( ! DA -> isUniform ( Cond ) )


<s> Function * F = I . getParent ( ) -> getParent ( ) ; Value * Idx = Constant :: getIntegerValue ( Type :: getInt32Ty ( Ptr -> getContext ( ) ) , APInt ( <NUM_LIT> , <NUM_LIT> ) ) ; PtrI = GetElementPtrInst :: Create ( Ptr -> getType ( ) -> getPointerElementType ( ) , Ptr , ArrayRef < Value * > ( Idx ) , Twine ( <STR_LIT> ) , F -> getEntryBlock ( ) . getFirstNonPHI ( ) ) ; } I . replaceUsesOfWith ( Ptr , PtrI ) ; } } if ( PtrI


<s> if ( isa < Argument > ( Ptr ) || isa < GlobalValue > ( Ptr ) ) { if ( noClobberClones . count ( Ptr ) ) { PtrI = noClobberClones [ Ptr ] ; } else { Function * F = I . getParent ( ) -> getParent ( ) ; Value * Idx = Constant :: getIntegerValue ( Type :: getInt32Ty ( Ptr -> getContext ( ) ) , APInt ( <NUM_LIT> , <NUM_LIT> ) ) ; PtrI = GetElementPtrInst :: Create ( Ptr -> getType ( ) -> getPointerElementType ( ) , Ptr , ArrayRef < Value * > ( Idx ) , Twine ( <STR_LIT> ) , F -> getEntryBlock ( ) . getFirstNonPHI ( ) ) ; } I . replaceUsesOfWith ( Ptr , PtrI ) ; } } if ( PtrI ) { setUniformMetadata ( PtrI ) ; if ( NotClobbered ) setNoClobberMetadata


<s> const <ISA_LIT>FunctionArgInfo & lookupFuncArgInfo ( const Function & F ) const { auto I = ArgInfoMap . find ( & F ) ; if ( I == ArgInfoMap . end ( ) ) { assert ( F . isDeclaration ( ) ) ; return


<s> const <ISA_LIT>FunctionArgInfo & lookupFuncArgInfo ( const Function & F ) const { auto I = ArgInfoMap . find ( &


<s> static ArgDescriptor createArg ( const ArgDescriptor & Arg , unsigned Mask ) { return ArgDescriptor ( Arg . Reg , Mask , Arg . IsStack , Arg


<s> return ArgDescriptor ( Arg . Reg , Mask , Arg .


<s> return ArgDescriptor ( Reg , Mask , false


<s> static ArgDescriptor createStack ( Register Reg , unsigned Mask = ~ <NUM_LIT> ) { return ArgDescriptor ( Reg , Mask ,


<s> return ArgDescriptor ( Offset , Mask , true ,


<s> static ArgDescriptor createStack ( unsigned Offset , unsigned Mask =


<s> void ArgDescriptor :: print ( raw_ostream & OS , const TargetRegisterInfo * TRI ) const { if ( ! isSet ( ) ) { OS <<


<s> if ( isRegister ( ) ) OS << <STR_LIT> << printReg ( getRegister ( ) , TRI ) << '\n' ; else OS << <STR_LIT> << getStackOffset (


<s> return std :: make_tuple ( ImplicitBufferPtr ? & ImplicitBufferPtr : nullptr , & <STR_LIT> , LLT :: pointer ( <ISA_LIT>AS :: CONSTANT_ADDRESS , <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( WorkGroupIDX ? & WorkGroupIDX : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( WorkGroupIDY ? & WorkGroupIDY : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( WorkGroupIDZ ? & WorkGroupIDZ : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( PrivateSegmentWaveByteOffset ? & PrivateSegmentWaveByteOffset : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( KernargSegmentPtr ? & KernargSegmentPtr : nullptr , & <STR_LIT> , LLT :: pointer ( <ISA_LIT>AS :: CONSTANT_ADDRESS , <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( ImplicitArgPtr ? & ImplicitArgPtr : nullptr , & <STR_LIT> , LLT :: pointer ( <ISA_LIT>AS :: CONSTANT_ADDRESS , <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( DispatchID ? & DispatchID : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( FlatScratchInit ? & FlatScratchInit : nullptr , & <STR_LIT> , LLT :: scalar ( <NUM_LIT> ) ) ; case <STR_LIT> : return std :: make_tuple ( DispatchPtr ? & DispatchPtr : nullptr , & <STR_LIT> , LLT :: pointer ( <ISA_LIT>AS :: CONSTANT_ADDRESS , <NUM_LIT> ) ) ; case


<s> if ( I == ArgInfoMap . end ( ) ) return FixedABIFunctionInfo ; return I -> second


<s> const <ISA_LIT>FunctionArgInfo & <ISA_LIT>ArgumentUsageInfo :: lookupFuncArgInfo ( const Function & F ) const { auto I = ArgInfoMap . find (


<s> AI . PrivateSegmentBuffer = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . DispatchPtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . QueuePtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . ImplicitArgPtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . DispatchID = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDX = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDY = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDZ = ArgDescriptor :: createRegister ( <STR_LIT> ) ; const unsigned Mask = <NUM_LIT> ; AI . WorkItemIDX = ArgDescriptor ::


<s> AI . ImplicitArgPtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . DispatchID = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDX = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDY = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDZ = ArgDescriptor :: createRegister ( <STR_LIT> ) ; const unsigned Mask =


<s> return ArgDescriptor ( Arg . Reg , Mask , Arg . IsStack , Arg


<s> static constexpr ArgDescriptor createRegister ( Register Reg , unsigned Mask = ~


<s> static constexpr ArgDescriptor createStack ( unsigned Offset , unsigned Mask


<s> return ArgDescriptor ( Offset , Mask , true , true


<s> bool <ISA_LIT>ArgumentUsageInfo :: doFinalization ( Module & M


<s> bool <ISA_LIT>ArgumentUsageInfo :: doInitialization ( Module & M ) { return false


<s> bool <ISA_LIT>ArgumentUsageInfo :: doInitialization ( Module & M ) { return


<s> <ISA_LIT>FunctionArgInfo AI ; AI . PrivateSegmentBuffer = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . DispatchPtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . QueuePtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . ImplicitArgPtr = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . DispatchID = ArgDescriptor :: createRegister ( <STR_LIT> ) ; AI . WorkGroupIDX = ArgDescriptor ::


<s> Value = adjustFixupValue ( Fixup , Value , & Asm . getContext ( ) ) ; if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup .


<s> Value = adjustFixupValue ( Fixup , Value , & Asm . getContext ( ) ) ; if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= Data .


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCSubtargetInfo & STI , const MCRegisterInfo & MRI


<s> std :: unique_ptr < MCObjectTargetWriter >

createObjectTargetWriter ( ) const override {


<s> return ( ( ( int64_t ( Value ) / <NUM_LIT> ) -


<s> bool <ISA_LIT>AsmBackend :: fixupNeedsRelaxation ( const MCFixup & Fixup , uint64_t Value , const MCRelaxableFragment * DF , const MCAsmLayout


<s> const static MCFixupKindInfo Infos [ <STR_LIT> ] = { { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo


<s> { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } , } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend


<s> return <NUM_LIT> ; case FK_SecRel_1 : case FK_Data_1 : return <NUM_LIT> ; case FK_SecRel_2 : case FK_Data_2 : return <NUM_LIT> ; case FK_SecRel_4 : case FK_Data_4 : case FK_PCRel_4 : return <NUM_LIT> ; case FK_SecRel_8 : case FK_Data_8 : return <NUM_LIT>


<s> unsigned <ISA_LIT>AsmBackend :: getMinimumNopSize ( ) const { return


<s> if ( ! STI . getFeatureBits ( ) [ <STR_LIT> ] ) return false ; if ( <STR_LIT> ( Inst . getOpcode ( ) ) >= <NUM_LIT> ) return true ; return


<s> unsigned RelaxedOpcode = <STR_LIT> ( Inst . getOpcode ( ) ) ; Res . setOpcode


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( raw_ostream & OS , uint64_t Count , const MCSubtargetInfo * STI ) const { OS . write_zeros ( Count % <NUM_LIT> ) ; Count /= <NUM_LIT> ; const uint32_t Encoded_S_NOP_0 = <NUM_LIT> ; for ( uint64_t I = <NUM_LIT> ; I != Count ; ++ I ) <STR_LIT> :: write

< uint32_t > ( OS , Encoded_S_NOP_0 , Endian ) ;


<s> return new ELF<ISA_LIT>AsmBackend ( T , TargetTriple .


<s> MCObjectWriter * createObjectWriter ( raw_pwrite_stream & OS ) const override { return create<ISA_LIT>ELFObjectWriter ( Is64Bit , OS


<s> const static MCFixupKindInfo Infos [ <STR_LIT> ] = { { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo ( Kind ) ; return Infos [ Kind


<s> unsigned getNumFixupKinds ( ) const override


<s> unsigned getNumFixupKinds ( ) const override { return


<s> OW -> WriteZeros ( Count ) ; return true


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( uint64_t Count , MCObjectWriter * OW ) const { OW -> WriteZeros ( Count ) ; return true


<s> case <STR_LIT> : { int64_t BrImm = ( SignedValue - <NUM_LIT> ) / <NUM_LIT> ; if ( Ctx && ! isInt < <NUM_LIT> > ( BrImm ) ) Ctx -> reportError ( Fixup . getLoc ( ) , <STR_LIT> ) ; return BrImm ; } case FK_Data_1 : case FK_Data_2 : case FK_Data_4


<s> void <ISA_LIT>AsmBackend :: applyFixup ( const MCAssembler & Asm , const MCFixup & Fixup , const MCValue & Target , MutableArrayRef < char > Data , uint64_t Value , bool IsResolved ) const { Value = adjustFixupValue ( Fixup , Value , &


<s> MCObjectWriter * createObjectWriter ( raw_pwrite_stream &


<s> MCObjectWriter * createObjectWriter ( raw_pwrite_stream & OS ) const override { return create<ISA_LIT>ELFObjectWriter ( Is64Bit ,


<s> ELF<ISA_LIT>AsmBackend ( const Target & T , const Triple & TT ) : <ISA_LIT>AsmBackend ( T ) , Is64Bit ( TT . getArch ( ) == Triple :: amdgcn ) , HasRelocationAddend ( TT . getOS ( ) == Triple


<s> Count /= <NUM_LIT> ; const uint32_t Encoded_S_NOP_0 = <NUM_LIT> ; for ( uint64_t I = <NUM_LIT> ; I != Count ; ++ I ) OW -> write32 ( Encoded_S_NOP_0 ) ; return


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( uint64_t Count , MCObjectWriter * OW ) const { OW -> WriteZeros ( Count % <NUM_LIT> ) ; Count /= <NUM_LIT> ; const uint32_t Encoded_S_NOP_0 = <NUM_LIT> ; for ( uint64_t I = <NUM_LIT> ; I != Count ;

++ I ) OW -> write32 ( Encoded_S_NOP_0 ) ;


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCSubtargetInfo & STI , const MCRegisterInfo & MRI , const MCTargetOptions & Options ) { return new ELF<ISA_LIT>AsmBackend ( T ,


<s> return create<ISA_LIT>ELFObjectWriter ( Is64Bit , OSABI , HasRelocationAddend


<s> return create<ISA_LIT>ELFObjectWriter ( Is64Bit , OSABI ,


<s> const uint32_t Encoded_S_NOP_0 = <NUM_LIT> ; for ( uint64_t I = <NUM_LIT> ; I != Count ; ++ I ) <STR_LIT> :: write < uint32_t > ( OS ,


<s> for ( uint64_t I = <NUM_LIT> ; I != Count ; ++ I ) <STR_LIT> :: write < uint32_t >


<s> if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup .


<s> unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= DataSize && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |=

static_cast < uint8_t > ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ;


<s> MCInst Res ; unsigned RelaxedOpcode = <STR_LIT> ( Inst . getOpcode ( ) ) ; Res . setOpcode ( RelaxedOpcode ) ; Res . addOperand ( Inst . getOperand ( <NUM_LIT> )


<s> std :: unique_ptr < MCObjectWriter > createObjectWriter ( raw_pwrite_stream & OS ) const override { return create<ISA_LIT>ELFObjectWriter ( Is64Bit , OSABI , HasRelocationAddend


<s> if ( ! isInt < <NUM_LIT> > ( BrImm ) ) report_fatal_error ( <STR_LIT> ) ; uint16_t * Dst = ( uint16_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = BrImm ; break ; } case <STR_LIT> : { uint32_t * Dst = ( uint32_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = Value + <NUM_LIT> ; break ; } default : { unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset (


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCRegisterInfo & MRI , const Triple


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCRegisterInfo & MRI


<s> int64_t SignedValue = static_cast < int64_t > ( Value ) ; switch ( Fixup . getKind ( ) ) { case <STR_LIT> : { int64_t BrImm = ( SignedValue - <NUM_LIT> ) / <NUM_LIT> ; if ( Ctx && ! isInt < <NUM_LIT> > ( BrImm ) ) Ctx -> reportError ( Fixup . getLoc ( ) , <STR_LIT> ) ; return BrImm ; } case FK_Data_1 : case FK_Data_2 : case FK_Data_4 : case FK_Data_8 : case FK_PCRel_4 : case FK_SecRel_4 : return Value


<s> int64_t BrImm = ( SignedValue - <NUM_LIT> ) / <NUM_LIT> ; if ( Ctx && ! isInt < <NUM_LIT> > ( BrImm ) )

Ctx -> reportError ( Fixup . getLoc ( ) , <STR_LIT> ) ;


<s> if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= Data . size ( ) && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |= static_cast

< uint8_t > ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ;


<s> for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |= static_cast < uint8_t

> ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ;


<s> if ( ! IsResolved && Fixup . getValue ( ) -> evaluateAsValue ( Res , Layout ) && Res . isAbsolute ( ) ) { Value = Res . getConstant ( ) ; IsResolved = true


<s> bool mayNeedRelaxation ( const MCInst & Inst , const MCSubtargetInfo & STI )


<s> if ( ! isInt < <NUM_LIT> > ( BrImm ) ) report_fatal_error ( <STR_LIT> ) ; uint16_t * Dst = ( uint16_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = BrImm ; break ; } default : { unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset


<s> return <NUM_LIT> ; case FK_SecRel_4 : case FK_Data_4 : case FK_PCRel_4 : return <NUM_LIT> ; case FK_SecRel_8 : case FK_Data_8 : return <NUM_LIT>


<s> void relaxInstruction ( const MCInst & Inst , const MCSubtargetInfo & STI , MCInst &


<s> void relaxInstruction ( const MCInst & Inst , const MCSubtargetInfo & STI , MCInst & Res ) const override { assert ( ! <STR_LIT>


<s> switch ( ( unsigned ) Fixup . getKind ( ) ) { default : llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : { uint16_t * Dst = ( uint16_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = ( Value - <NUM_LIT> ) / <NUM_LIT> ; break ; } case <STR_LIT> : { uint32_t * Dst = ( uint32_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst


<s> for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |= static_cast < uint8_t > ( ( Value


<s> for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |= static_cast < uint8_t > ( ( Value >>


<s> if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; uint32_t Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= Data . size ( ) && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) Data [ Offset + i ] |= static_cast < uint8_t > ( ( Value >>


<s> void <ISA_LIT>AsmBackend :: applyFixup ( const MCFixup & Fixup , char * Data , unsigned DataSize , uint64_t Value , bool IsPCRel ) const { switch ( ( unsigned ) Fixup . getKind ( ) ) { case <STR_LIT> : { uint16_t * Dst = ( uint16_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = ( Value - <NUM_LIT> ) / <NUM_LIT> ; break ; } case <STR_LIT>


<s> uint16_t * Dst = ( uint16_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = ( Value - <NUM_LIT> ) / <NUM_LIT> ; break ; } case <STR_LIT> : { uint32_t * Dst = ( uint32_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = Value ; break ; } case <STR_LIT> : { uint32_t * Dst = ( uint32_t * ) ( Data + Fixup . getOffset ( ) ) ; * Dst = Value + <NUM_LIT> ; break ; } default : { unsigned NumBytes = getFixupKindNumBytes ( Fixup . getKind ( ) ) ; if ( ! Value ) return ; MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= DataSize


<s> <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo ( Kind ) ; return Infos [ Kind - FirstTargetFixupKind


<s> <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo (


<s> void addImmOperands ( MCInst & Inst ,


<s> Inst . addOperand ( MCOperand :: createImm


<s> Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ( getReg ( ) , * Reg


<s> void addRegOrImmOperands ( MCInst & Inst , unsigned N ) const { if ( isReg ( ) )


<s> Inst . addOperand ( MCOperand :: createImm ( Reg . Modifiers == - <NUM_LIT> ? <NUM_LIT> : Reg


<s> void addRegWithInputModsOperands ( MCInst & Inst , unsigned N ) const { Inst . addOperand ( MCOperand :: createImm ( Reg . Modifiers ==

- <NUM_LIT> ? <NUM_LIT> : Reg . Modifiers ) ) ;


<s> if ( isImm ( ) ) addImmOperands ( Inst , N ) ; else { assert ( isExpr (


<s> uint64_t TSFlags = MII . get ( Inst . getOpcode ( ) ) . TSFlags ; if ( ( getForcedEncodingSize ( ) == <NUM_LIT> && ( TSFlags & <STR_LIT> ) ) || ( getForcedEncodingSize ( ) == <NUM_LIT> && ! ( TSFlags &

<STR_LIT> ) ) ) return Match_InvalidOperand ;


<s> if ( ( getForcedEncodingSize ( ) == <NUM_LIT> && ( TSFlags & <STR_LIT> ) ) || (

getForcedEncodingSize ( ) == <NUM_LIT> && ! ( TSFlags & <STR_LIT> ) ) ) return Match_InvalidOperand ;


<s> if ( Mul != <NUM_LIT> && Mul != <NUM_LIT> && Mul != <NUM_LIT> ) return false ; Mul >>= <NUM_LIT>


<s> static bool ConvertOmodMul ( int64_t & Mul ) { if ( Mul != <NUM_LIT> && Mul != <NUM_LIT>


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateExpr ( const class MCExpr * Expr , SMLoc S ) { auto Op = llvm :: make_unique < <ISA_LIT>Operand > ( Expression ) ; Op -> Expr = Expr ; Op -> StartLoc = S ; Op -> EndLoc = S


<s> Op -> Expr = Expr ; Op -> StartLoc = S ; Op -> EndLoc = S ; return


<s> Op -> Imm . Val = Val ; Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Type = Type ; Op -> StartLoc =


<s> Op -> Reg . STI = STI ; Op -> Reg . Modifiers = - <NUM_LIT> ; Op -> Reg . IsForcedVOP3 = ForceVOP3 ; Op -> StartLoc = S ; Op -> EndLoc =


<s> auto Res = llvm :: make_unique < <ISA_LIT>Operand > ( Token ) ; Res -> Tok . Data = Str . data ( ) ; Res -> Tok . Length = Str . size ( ) ; Res -> StartLoc


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateToken ( StringRef Str , SMLoc Loc , bool HasExplicitEncodingSize = true ) { auto Res = llvm :: make_unique <


<s> if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) && Op . getToken ( ) == <STR_LIT> ) { GDSOnly = true ; continue ; } OptionalIdx [ Op . getImmTy ( ) ] = i ; } unsigned OffsetIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyOffset ] ; ( ( <ISA_LIT>Operand & ) * Operands [ OffsetIdx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; if ( ! GDSOnly ) { unsigned GD<ISA_LIT>dx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyGDS ] ; ( ( <ISA_LIT>Operand & ) * Operands [ GD<ISA_LIT>dx ] ) . addImmOperands ( Inst ,


<s> void <ISA_LIT>AsmParser :: cvtDSOffset01 ( MCInst & Inst , const OperandVector & Operands ) { std :: map < enum <ISA_LIT>Operand :: ImmTy , unsigned > OptionalIdx ; for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } OptionalIdx [ Op . getImmTy ( ) ] = i ; } unsigned Offset0Idx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyDSOffset0 ] ; unsigned Offset1Idx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyDSOffset1 ] ; unsigned GD<ISA_LIT>dx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyGDS ] ; ( ( <ISA_LIT>Operand & ) * Operands [ Offset0Idx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; ( ( <ISA_LIT>Operand & ) * Operands [ Offset1Idx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; ( ( <ISA_LIT>Operand & ) * Operands [ GD<ISA_LIT>dx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; Inst . addOperand ( MCOperand ::


<s> if ( OptionalIdx . count ( <ISA_LIT>Operand :: ImmTyGLC ) ) { unsigned GLCIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyGLC ] ; ( ( <ISA_LIT>Operand & ) * Operands [ GLCIdx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; } unsigned SLCIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTySLC ] ; unsigned TFEIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyTFE ] ; ( ( <ISA_LIT>Operand & ) * Operands [ SLCIdx ] ) . addImmOperands ( Inst


<s> Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyNone ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) ) { continue ; } assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } assert ( OptionalIdx . size ( ) == <NUM_LIT> ) ; unsigned OffsetIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyOffset ] ; unsigned GLCIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyGLC ] ; unsigned SLCIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTySLC ] ; unsigned TFEIdx = OptionalIdx [ <ISA_LIT>Operand :: ImmTyTFE ] ; ( ( <ISA_LIT>Operand & ) * Operands [ OffsetIdx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; ( ( <ISA_LIT>Operand & ) * Operands [ GLCIdx ] ) . addImmOperands ( Inst


<s> return Token . endswith ( <STR_LIT> ) || Token . endswith


<s> unsigned getForcedEncodingSize ( ) const { return ForcedEncodingSize


<s> switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> :


<s> MCTargetStreamer & TS = * getParser ( ) . getStreamer ( ) . getTargetStreamer ( ) ; return static_cast < <ISA_LIT>TargetStreamer & > (


<s> bool hasSGPR102_SGPR103 ( ) const { return ! isVI


<s> bool isCI ( ) const { return <STR_LIT> ( getSTI (


<s> return isImm ( ) && isUInt < <NUM_LIT> > ( getImm


<s> assert ( isImm ( ) ) ; return Imm . Type ==


<s> bool isDSOffset0 ( ) const { assert ( isImm ( ) ) ; return Imm . Type


<s> return isImm ( ) && ( ( Imm . Val <= <NUM_LIT> && Imm . Val >= - <NUM_LIT> ) || ( F == <NUM_LIT> || F == <NUM_LIT> || F == - <NUM_LIT> ||


<s> bool isMem ( ) const override { return false


<s> bool <ISA_LIT>Operand :: isMubufOffset ( ) const { return isImm ( ) && isUInt < <NUM_LIT> > ( getImm


<s> bool isReg ( ) const override { return Kind == Register && Reg . Modifiers == -


<s> return Reg . TRI -> getRegClass ( RCID ) . contains (


<s> bool isRegOrImm ( ) const { return isReg ( )


<s> return Kind == Register && ( Reg . IsForcedVOP3 || Reg . Modifiers != - <NUM_LIT>


<s> return Kind == Register && ( Reg . IsForcedVOP3 || Reg . Modifiers != -


<s> bool isSCSrc64 ( ) const { return ( isReg ( ) && isRegClass ( <STR_LIT> ) ) ||


<s> bool <ISA_LIT>Operand :: isSMRDOffset ( ) const { return isImm ( ) && isUInt < <NUM_LIT> > ( getImm (


<s> bool <ISA_LIT>Operand :: isSMRDOffset ( ) const { return isImm ( ) && isUInt < <NUM_LIT>


<s> bool isSoppBrTarget ( ) const { return isExpr ( ) || isImm


<s> bool isToken ( ) const override { return Kind ==


<s> return isInlineImm ( ) || ( isReg ( ) &&


<s> bool isVCSrc64 ( ) const { return isInlineImm ( ) || ( isReg ( ) && isRegClass ( <STR_LIT> )


<s> bool isVI ( ) const { return <STR_LIT> ( getSTI ( ) )


<s> bool isVSrc32 ( ) const { return isImm ( ) || ( isReg ( ) && isRegClass


<s> bool isVSrc32 ( ) const { return isImm ( ) || ( isReg (


<s> bool isVSrc64 ( ) const { return isImm ( ) || ( isReg ( ) && isRegClass (


<s> RegisterMCAsmParser < <ISA_LIT>AsmParser >


<s> switch ( MatchInstructionImpl ( Operands , Inst , ErrorInfo , MatchingInlineAsm ) ) { default : break ; case Match_Success : Inst . setLoc ( IDLoc ) ; Out . EmitInstruction ( Inst , getSTI ( ) ) ; return false ; case Match_MissingFeature : return Error ( IDLoc , <STR_LIT> ) ; case Match_MnemonicFail : return Error ( IDLoc , <STR_LIT> ) ; case Match_InvalidOperand : { SMLoc ErrorLoc = IDLoc ; if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) { if ( isForcedVOP3 ( ) ) { <ISA_LIT>Operand & LastOp = ( ( <ISA_LIT>Operand & ) * Operands [ Operands . size ( ) - <NUM_LIT> ] ) ; if ( LastOp . isRegKind ( ) || ( LastOp . isImm ( ) && LastOp . getImmTy

( ) != <ISA_LIT>Operand :: ImmTyNone ) ) {


<s> if ( ( ParsedOp . isImm ( ) && ParsedOp . getImmTy ( ) == OOp . Type ) || ( ParsedOp . isToken ( ) && ParsedOp . getToken ( ) == OOp . Name ) ) return true ; } return


<s> static bool operandsHasOptionalOp ( const OperandVector & Operands , const OptionalOperand & OOp ) { for ( unsigned i = <NUM_LIT> ; i < Operands . size ( ) ; i ++ ) { const <ISA_LIT>Operand & ParsedOp = ( ( const <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( ( ParsedOp . isImm ( ) && ParsedOp . getImmTy ( ) == OOp . Type ) || ( ParsedOp . isToken ( ) && ParsedOp . getToken (


<s> Parser . Lex ( ) ; if ( getLexer ( ) . is ( AsmToken :: Amp ) || getLexer ( ) . is ( AsmToken :: Comma ) ) Parser . Lex ( ) ; int CntShift ; int CntMask ; if ( CntName == <STR_LIT> ) { CntMask = <NUM_LIT> ; CntShift = <NUM_LIT> ; } else if ( CntName == <STR_LIT> ) { CntMask = <NUM_LIT> ; CntShift =


<s> if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaModuleGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaProgramGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSADataGlobalAgent ( ) ; if ( IDVal == <STR_LIT> )


<s> StringRef KernelName = Parser . getTok ( ) . getString ( ) ; getTargetStreamer ( ) . Emit<ISA_LIT>SymbolType ( KernelName


<s> bool <ISA_LIT>AsmParser :: ParseDirective<ISA_LIT>HsaKernel ( ) { if ( getLexer ( ) . isNot ( AsmToken :: Identifier ) ) return TokError ( <STR_LIT> ) ; StringRef KernelName = Parser . getTok ( ) . getString


<s> StringRef GlobalName = Parser . getTok ( ) . getIdentifier ( ) ; getTargetStreamer ( ) . Emit<ISA_LIT>HsaModuleScopeGlobal ( GlobalName


<s> while ( getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Identifier ) ) return TokError ( <STR_LIT> ) ; StringRef ID = getLexer ( ) . getTok ( ) . getIdentifier ( ) ; Lex ( ) ; if ( ID == <STR_LIT> )


<s> bool <ISA_LIT>AsmParser :: ParseDirectiveHSACodeObjectISA ( ) { uint32_t Major ; uint32_t Minor ; uint32_t Stepping ; StringRef VendorName ; StringRef ArchName ; if ( getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) { <STR_LIT> Isa = <STR_LIT> ( getSTI ( ) . getFeatureBits ( ) ) ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectISA ( Isa . Major , Isa . Minor , Isa . Stepping , <STR_LIT> , <STR_LIT> ) ; return false ; } if ( ParseDirectiveMajorMinor ( Major , Minor ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return TokError ( <STR_LIT> ) ; Stepping = getLexer ( ) . getTok ( ) . getIntVal ( ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: String ) ) return TokError ( <STR_LIT> ) ; VendorName = getLexer ( ) . getTok ( ) . getStringContents ( ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: String ) ) return TokError ( <STR_LIT> ) ; ArchName = getLexer ( ) . getTok ( ) . getStringContents (


<s> <STR_LIT> Isa = <STR_LIT> ( getSTI ( ) . getFeatureBits ( ) ) ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectISA ( Isa . Major , Isa . Minor , Isa . Stepping , <STR_LIT> , <STR_LIT> ) ; return false ; } if ( ParseDirectiveMajorMinor ( Major , Minor ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return TokError ( <STR_LIT> ) ; Stepping = getLexer ( ) . getTok ( ) . getIntVal ( ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: String ) ) return TokError ( <STR_LIT> ) ; VendorName = getLexer ( ) . getTok ( ) . getStringContents (


<s> uint32_t Major ; uint32_t Minor ; if ( ParseDirectiveMajorMinor ( Major , Minor ) ) return true ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectVersion ( Major , Minor ) ; return


<s> uint32_t Minor ; if ( ParseDirectiveMajorMinor ( Major , Minor ) ) return true ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectVersion ( Major , Minor ) ; return


<s> bool <ISA_LIT>AsmParser :: ParseDirectiveMajorMinor ( uint32_t & Major , uint32_t & Minor ) { if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return TokError ( <STR_LIT> ) ; Major = getLexer ( ) . getTok ( ) . getIntVal ( ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex (


<s> if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return TokError ( <STR_LIT> ) ; Minor = getLexer ( ) . getTok ( ) . getIntVal ( ) ; Lex ( ) ; return


<s> return parseOptionalOps ( DSOptionalOpsOff01 , Operands


<s> SMLoc S = Parser . getTok ( ) . getLoc ( ) ; <ISA_LIT>AsmParser :: OperandMatchResultTy Res = parseIntWithPrefix ( <STR_LIT> , Operands , <ISA_LIT>Operand :: ImmTyOffset ) ; if ( Res == MatchOperand_NoMatch ) { Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , S , <ISA_LIT>Operand :: ImmTyOffset ) ) ; Res = MatchOperand_Success


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseDSOptionalOps ( OperandVector & Operands


<s> return parseOptionalOps ( FlatAtomicOptionalOps , Operands


<s> if ( Name . endswith ( <STR_LIT> ) ) setForcedEncodingSize ( <NUM_LIT> ) ; else if ( Name . endswith ( <STR_LIT> ) ) setForcedEncodingSize ( <NUM_LIT> ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateToken ( Name , NameLoc ) ) ; while ( ! getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) { <ISA_LIT>AsmParser :: OperandMatchResultTy Res = parseOperand ( Operands , Name ) ; if ( getLexer ( ) . is ( AsmToken :: Comma ) ) Parser . Lex ( ) ; switch ( Res ) { case MatchOperand_Success : break ; case MatchOperand_ParseFail : return Error ( getLexer ( ) . getLoc ( ) , <STR_LIT> ) ; case MatchOperand_NoMatch : return Error ( getLexer ( ) . getLoc ( ) , <STR_LIT> ) ; } } <ISA_LIT>AsmParser :: OperandMatchResultTy


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseIntWithPrefix ( const char * Prefix , OperandVector & Operands , enum <ISA_LIT>Operand :: ImmTy ImmTy ) { SMLoc S = Parser . getTok ( ) . getLoc ( ) ; int64_t Offset = <NUM_LIT> ; <ISA_LIT>AsmParser :: OperandMatchResultTy Res = parseIntWithPrefix ( Prefix , Offset ) ; if ( Res != MatchOperand_Success ) return Res ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( Offset ,


<s> return parseOptionalOps ( MubufOptionalOps


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseOffset ( OperandVector & Operands ) { return parseIntWithPrefix ( <STR_LIT>


<s> case AsmToken :: Integer : { SMLoc S = Parser . getTok ( ) . getLoc ( ) ; int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return MatchOperand_ParseFail ; if ( ! isInt < <NUM_LIT> > ( IntVal ) && ! isUInt < <NUM_LIT> > ( IntVal ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Negate ) IntVal *= - <NUM_LIT> ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( IntVal , S ) ) ; return MatchOperand_Success ; } case AsmToken :: Real : { SMLoc S = Parser . getTok ( ) . getLoc ( ) ; int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return MatchOperand_ParseFail ; APFloat F ( ( float ) BitsToDouble ( IntVal ) ) ; if ( Negate ) F . changeSign ( ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( F . bitcastToAPInt ( ) . getZExtValue ( ) , S ) ) ; return MatchOperand_Success ; } case AsmToken :: Identifier : { SMLoc S , E ; unsigned RegNo ; if ( ! ParseRegister ( RegNo , S , E ) ) { bool HasModifiers = operandsHaveModifiers ( Operands ) ; unsigned Modifiers = <NUM_LIT> ; if ( Negate ) Modifiers |= <NUM_LIT> ; if ( Abs ) { if ( getLexer ( ) . getKind ( ) != AsmToken

:: Pipe ) return MatchOperand_ParseFail ;


<s> Res = parseNamedBit ( Op . Name , Operands , Op . Type ) ; if ( Res == MatchOperand_NoMatch ) continue ; return Res ; } Res = parseIntWithPrefix ( Op . Name , Value , Op . Default ) ; if ( Res == MatchOperand_NoMatch ) continue ; if ( Res != MatchOperand_Success ) return Res ; if ( Op . ConvertResult && ! Op . ConvertResult ( Value ) ) { return MatchOperand_ParseFail ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( Value , S , Op . Type ) ) ; return MatchOperand_Success ; } return


<s> bool <ISA_LIT>AsmParser :: ParseSectionDirectiveHSADataGlobalAgent ( ) { getParser ( ) . getStreamer ( ) . SwitchSection (


<s> getParser ( ) . getStreamer ( ) . SwitchSection ( <STR_LIT> ( getContext


<s> getParser ( ) . getStreamer ( ) . SwitchSection ( <STR_LIT> ( getContext ( ) ) ) ; return false


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseSLC


<s> case AsmToken :: Identifier : Operands . push_back ( <ISA_LIT>Operand :: CreateExpr ( MCSymbolRefExpr :: create ( getContext ( ) . getOrCreateSymbol ( Parser . getTok ( ) . getString ( ) ) , getContext ( ) ) , S ) ) ; Parser . Lex ( ) ; return MatchOperand_Success


<s> if ( getParser ( ) . parseAbsoluteExpression ( CntVal ) ) return MatchOperand_ParseFail ; break ; case AsmToken :: Identifier : do { if ( parseCnt ( CntVal ) ) return MatchOperand_ParseFail ; } while ( getLexer ( ) . isNot ( AsmToken :: EndOfStatement ) ) ; break ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( CntVal


<s> return parseNamedBit ( <STR_LIT> , Operands


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseUNorm ( OperandVector & Operands ) { return parseNamedBit ( <STR_LIT> , Operands


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseUNorm ( OperandVector & Operands ) { return parseNamedBit ( <STR_LIT> , Operands )


<s> void setForcedEncodingSize ( unsigned Size ) { ForcedEncodingSize =


<s> assert ( isReg ( ) ) ; Reg . Modifiers =


<s> void setModifiers ( unsigned Mods ) { assert ( isReg ( ) ) ; Reg . Modifiers = Mods


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return false ; default : return true ; } } for ( MCRegAliasIterator R ( <STR_LIT> , & MRI , true ) ; R . isValid ( ) ; ++ R ) { if ( * R == RegNo ) return false ; } return true


<s> default : return true ; } } for ( MCRegAliasIterator R ( <STR_LIT> , & MRI , true ) ; R . isValid ( ) ; ++ R ) { if ( * R == RegNo ) return false ; } return


<s> } Val = F . bitcastToAPInt ( ) . getZExtValue ( ) ; } else { Val = Negate ? - Val : Val ; } Inst . addOperand ( MCOperand :: createImm ( Val ) ) ; } else { Inst . addOperand ( MCOperand :: createImm ( getImm (


<s> if ( getSTI ( ) . getFeatureBits ( ) . none ( ) ) { copySTI ( ) . ToggleFeature ( <STR_LIT> ) ; } setAvailableFeatures ( ComputeAvailableFeatures ( getSTI ( ) . getFeatureBits ( ) ) ) ; { <STR_LIT> Isa = <STR_LIT> ( getSTI ( ) . getFeatureBits ( ) ) ; MCContext & Ctx = getContext ( ) ; MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create (


<s> } setAvailableFeatures ( ComputeAvailableFeatures ( getSTI ( ) . getFeatureBits ( ) ) ) ; { <STR_LIT> Isa = <STR_LIT> ( getSTI ( ) . getFeatureBits ( ) ) ; MCContext & Ctx = getContext ( ) ; MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Stepping ,


<s> if ( ( getForcedEncodingSize ( ) == <NUM_LIT> && ( TSFlags & <STR_LIT> ) ) || ( getForcedEncodingSize ( ) == <NUM_LIT> && ! ( TSFlags & <STR_LIT> ) ) || ( isForcedDPP ( ) && ! ( TSFlags

& <STR_LIT> ) ) || ( isForcedSDWA ( ) && ! ( TSFlags & <STR_LIT> ) ) ) return Match_InvalidOperand ;


<s> } else if ( BoundCtrl == - <NUM_LIT> ) { BoundCtrl =


<s> if ( BoundCtrl == <NUM_LIT> ) { BoundCtrl = <NUM_LIT> ; return true


<s> auto Op = llvm :: make_unique < <ISA_LIT>Operand > ( Expression ) ; Op -> Expr = Expr ; Op -> StartLoc =


<s> Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Type = Type ; Op -> Imm . Mods = { false ,


<s> Op -> Imm . Type = Type ; Op -> Imm . Mods = { false , false , false } ; Op -> StartLoc = Loc ; Op -> EndLoc = Loc ; return Op


<s> static <ISA_LIT>Operand :: Ptr CreateReg ( unsigned RegNo , SMLoc S , SMLoc E , const MCRegisterInfo * TRI , const MCSubtargetInfo * STI , bool ForceVOP3 ) { auto Op = llvm :: make_unique < <ISA_LIT>Operand


<s> Res -> Tok . Data = Str . data ( ) ; Res -> Tok . Length = Str . size (


<s> Op . addRegOrImmWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isDPPCtrl ( ) ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImm ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDppRowMask , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDppBankMask , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands ,

OptionalIdx , <ISA_LIT>Operand :: ImmTyDppBoundCtrl ) ;


<s> ( ( <ISA_LIT>Operand & ) * Operands [ I ++ ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } for ( unsigned E = Operands . size ( ) ; I != E ; ++ I )

( ( <ISA_LIT>Operand & ) * Operands [ I ] ) . addRegOrImmOperands ( Inst , <NUM_LIT> ) ;


<s> } OptionalImmIndexMap OptionalIdx ; for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isRegOrImm ( ) ) { Op . addRegOrImmOperands ( Inst , <NUM_LIT> ) ; continue ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { assert ( false


<s> } else { assert ( false ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDMask ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyUNorm ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDA ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyR128 ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx


<s> cvtMubufImpl ( Inst , Operands , false


<s> void cvtMubufAtomic ( MCInst & Inst , const OperandVector & Operands ) { cvtMubufImpl ( Inst , Operands


<s> } else if ( Op . isImm ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; if ( Inst . getOpcode ( ) == <STR_LIT> ) { return ; } switch ( BasicInstType ) { case <STR_LIT> : { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstUnused , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , <NUM_LIT> ) ; break ; } case <STR_LIT> : { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel ,


<s> for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isRegOrImmWithInputMods ( ) ) { Op . addRegOrImmWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImm ( )


<s> Op . addRegOrImmWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImm ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { assert ( false ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand ::


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) ,

<ISA_LIT>Operand :: ImmTyDppBankMask ) ;


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser ::


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand :: ImmTyDMask


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( )


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultGLC ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand ::


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc (

) , <ISA_LIT>Operand :: ImmTyDppRowMask ) ;


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand :: ImmTyOffset


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultSMRDOffset ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) ,


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultTFE ( )


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultTFE ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultUNorm ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc (


<s> int64_t Operand = <NUM_LIT> ; Operand |= Abs ? <STR_LIT> : <NUM_LIT> ; Operand |= Neg ? <STR_LIT>


<s> int64_t getFPModifiersOperand ( ) const { int64_t Operand = <NUM_LIT> ; Operand |= Abs ?


<s> int64_t getIntModifiersOperand ( ) const { int64_t Operand = <NUM_LIT> ; Operand |= Sext ? <STR_LIT> : <NUM_LIT> ; return


<s> case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } else if ( Is == IS_TTMP ) { switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } else if ( Is == IS_SGPR ) { switch ( RegWidth


<s> static unsigned getSpecialRegForName ( StringRef RegName ) { return StringSwitch < unsigned > ( RegName ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case

( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Default ( <NUM_LIT> ) ;


<s> return StringSwitch < unsigned > ( RegName ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> )

. Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Default ( <NUM_LIT> ) ;


<s> bool result = isImm ( ) && getImmTy ( ) == ImmTyDppCtrl && isUInt < <NUM_LIT> > ( getImm ( ) ) ; if ( result ) { int64_t Imm = getImm ( ) ; return ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) || ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) || ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) || ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) || ( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) ||

( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) || ( Imm == <NUM_LIT> ) ;


<s> bool isGLC ( ) const { return isImmTy (


<s> } const float F = BitsToFloat ( Imm . Val ) ; return ( Imm . Val <= <NUM_LIT> && Imm . Val >= - <NUM_LIT> ) || ( F == <NUM_LIT> || F == <NUM_LIT> || F == - <NUM_LIT> || F == <NUM_LIT> || F == - <NUM_LIT> || F == <NUM_LIT> || F ==


<s> bool isR128 ( ) const { return isImmTy (


<s> bool isReg ( ) const override { return isRegKind ( ) && ! Reg . Mods


<s> bool isRegClass ( unsigned RCID ) const { return isReg ( ) && Reg . TRI -> getRegClass ( RCID ) .


<s> return isRegKind ( ) || isInlinableImm


<s> bool isSSrc64 ( ) const { return isImm ( ) ||


<s> return isInlinableImm ( ) || isRegClass (


<s> return isInlinableImm ( ) || isRegClass ( <STR_LIT>


<s> if ( getParser ( ) . parseAbsoluteExpression ( RegLo ) ) return false ; const bool isRBrace = getLexer ( ) . is ( AsmToken :: RBrac ) ; if ( ! isRBrace && getLexer ( ) . isNot ( AsmToken :: Colon ) ) return false ; Parser . Lex ( ) ; if ( isRBrace ) { RegHi = RegLo ; } else { if ( getParser ( ) . parseAbsoluteExpression ( RegHi ) ) return false ; if ( getLexer ( ) . isNot ( AsmToken :: RBrac ) ) return false ; Parser . Lex ( ) ; } RegNum = ( unsigned ) RegLo ; RegWidth = ( RegHi - RegLo ) + <NUM_LIT> ; } } } else if ( getLexer ( ) . is ( AsmToken :: LBrac ) ) { Parser . Lex ( ) ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) return false ; if ( RegWidth != <NUM_LIT> ) return false ; RegisterKind RegKind1 ; unsigned Reg1 , RegNum1 , RegWidth1 ; do { if ( getLexer ( ) . is ( AsmToken :: Comma ) ) { Parser . Lex ( ) ; } else if ( getLexer ( ) . is ( AsmToken :: RBrac ) ) { Parser . Lex ( ) ; break ; } else if ( Parse<ISA_LIT>Register ( RegKind1 , Reg1 , RegNum1 , RegWidth1 ) ) { if ( RegWidth1 != <NUM_LIT> ) { return false ; } if ( RegKind1 != RegKind ) { return false ; } if ( ! AddNextRegisterToList ( Reg , RegWidth , RegKind1 , Reg1 , RegNum1 ) ) { return false ; } } else { return false ; } } while ( true ) ; } else { return false ; } switch ( RegKind ) { case IS_SPECIAL : RegNum = <NUM_LIT> ; RegWidth = <NUM_LIT>


<s> RegKind = IS_SPECIAL ; } else { unsigned RegNumIndex = <NUM_LIT> ; if ( RegName [ <NUM_LIT> ] == 'v' ) { RegNumIndex = <NUM_LIT> ; RegKind = IS_VGPR ; } else if ( RegName [ <NUM_LIT> ] == 's' ) { RegNumIndex = <NUM_LIT> ; RegKind = IS_SGPR ; } else if ( RegName . startswith ( <STR_LIT> ) ) { RegNumIndex = strlen ( <STR_LIT> ) ; RegKind = IS_TTMP ; } else { return false ; } if ( RegName . size ( ) > RegNumIndex ) { if ( RegName . substr ( RegNumIndex ) . getAsInteger ( <NUM_LIT> , RegNum ) ) return false ; Parser . Lex ( ) ; RegWidth = <NUM_LIT> ; } else { Parser . Lex ( ) ; int64_t RegLo , RegHi ; if ( getLexer ( ) . isNot ( AsmToken :: LBrac ) ) return false ; Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( RegLo ) ) return false ; const bool isRBrace = getLexer ( ) . is ( AsmToken :: RBrac ) ; if ( ! isRBrace && getLexer ( ) . isNot ( AsmToken :: Colon ) ) return false ; Parser . Lex ( ) ; if ( isRBrace ) { RegHi = RegLo ; } else { if ( getParser ( ) . parseAbsoluteExpression ( RegHi ) ) return false ; if ( getLexer ( ) . isNot ( AsmToken :: RBrac ) ) return false ; Parser . Lex ( ) ; } RegNum = ( unsigned ) RegLo ; RegWidth = ( RegHi - RegLo ) + <NUM_LIT> ; } } } else if ( getLexer ( ) . is


<s> bool <ISA_LIT>AsmParser :: ParseAMDKernelCodeTValue ( StringRef ID , amd_kernel_code_t & Header ) { SmallString < <NUM_LIT>


<s> Parser . Lex ( ) ; if ( getLexer ( ) . is ( AsmToken :: Amp ) || getLexer ( ) . is ( AsmToken :: Comma ) ) Parser . Lex ( ) ; int CntShift ; int CntMask ; if ( CntName == <STR_LIT> ) { CntMask = <NUM_LIT> ; CntShift = <NUM_LIT> ; } else if ( CntName == <STR_LIT> ) { CntMask = <NUM_LIT> ; CntShift = <NUM_LIT> ; } else if ( CntName == <STR_LIT> ) { CntMask = <NUM_LIT> ; CntShift =


<s> Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( CntVal ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: RParen ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . is ( AsmToken :: Amp ) || getLexer ( ) . is ( AsmToken :: Comma ) ) Parser . Lex ( ) ; int CntShift ; int CntMask ; if ( CntName == <STR_LIT> ) { CntMask =


<s> if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaModuleGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaProgramGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSADataGlobalAgent ( ) ; if ( IDVal == <STR_LIT> )


<s> if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectISA ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDKernelCodeT ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSAText ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> )

return ParseDirective<ISA_LIT>HsaModuleGlobal ( ) ;


<s> } Parser . Lex ( ) ; } else { HwReg . IsSymbolic = false ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( HwReg . Id ) ) return true ; } if ( getLexer ( ) . is ( AsmToken :: RParen ) ) { Parser . Lex ( ) ; return false ; } if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Offset ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Width ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: RParen


<s> Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: LParen ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . is ( AsmToken :: Identifier ) ) { HwReg . IsSymbolic = true ; HwReg . Id = ID_UNKNOWN_ ; const StringRef tok = Parser . getTok ( ) . getString ( ) ; for ( int i = ID_SYMBOLIC_FIRST_ ; i < ID_SYMBOLIC_LAST_ ; ++ i ) { if ( tok == IdSymbolic [ i ] ) { HwReg . Id = i ; break ; } } Parser . Lex ( ) ; } else { HwReg . IsSymbolic = false ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( HwReg . Id ) ) return


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseImm ( OperandVector & Operands ) { bool Minus = false ; if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) { Minus = true ; Parser . Lex ( ) ; } SMLoc S = Parser . getTok ( ) . getLoc ( ) ; switch ( getLexer ( ) . getKind ( ) ) { case AsmToken :: Integer : { int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return MatchOperand_ParseFail ; if ( ! isInt < <NUM_LIT> > ( IntVal ) && ! isUInt < <NUM_LIT> > ( IntVal ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Minus ) IntVal *= - <NUM_LIT> ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( IntVal , S ) ) ; return MatchOperand_Success ; } case AsmToken :: Real : { int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return


<s> } else if ( Name == <STR_LIT> ) { return parseIntWithPrefix ( <STR_LIT> , Operands , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> , ConvertOmodDiv ) ; } else { return


<s> <ISA_LIT>AsmParser :: OperandMatchResultTy <ISA_LIT>AsmParser :: parseOperand ( OperandVector & Operands , StringRef Mnemonic ) { OperandMatchResultTy ResTy = MatchOperandParserImpl ( Operands , Mnemonic ) ; if ( ResTy == MatchOperand_Success || ResTy == MatchOperand_ParseFail || getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) return ResTy ; ResTy = parseRegOrImm ( Operands ) ; if ( ResTy == MatchOperand_Success )


<s> OperandMatchResultTy ResTy = MatchOperandParserImpl ( Operands , Mnemonic ) ; if ( ResTy == MatchOperand_Success || ResTy == MatchOperand_ParseFail || getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) return ResTy ; ResTy = parseRegOrImm ( Operands ) ; if ( ResTy == MatchOperand_Success ) return ResTy ; if ( getLexer ( ) . getKind ( ) == AsmToken :: Identifier ) { const auto & Tok = Parser . getTok ( ) ; SMLoc S = Tok . getLoc ( ) ; const MCExpr * Expr = nullptr ; if ( ! Parser . parseExpression ( Expr )


<s> } else if ( Op . Type == <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> ) { res = parseOModOperand ( Operands ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTySdwaDstSel || Op . Type == <ISA_LIT>Operand :: ImmTySdwaSrc0Sel || Op . Type == <ISA_LIT>Operand :: ImmTySdwaSrc1Sel ) { res = parseSDWASel ( Operands , Op . Name , Op . Type ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTySdwaDstUnused


<s> if ( auto R = parseRegister ( ) ) { assert ( R -> isReg ( ) ) ; R -> Reg . IsForcedVOP3 = isForcedVOP3 ( ) ; Operands . push_back ( std :: move ( R ) ) ; return MatchOperand_Success ; } return


<s> Sext = true ; if ( getLexer ( ) . isNot ( AsmToken :: LParen ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Parser . Lex ( ) ; } auto Res = parseRegOrImm ( Operands ) ; if ( Res != MatchOperand_Success ) { return Res ; } <ISA_LIT>Operand :: Modifiers Mods = { false , false , false } ; if ( Sext ) { if ( getLexer ( ) . isNot ( AsmToken ::


<s> if ( getLexer ( ) . isNot ( AsmToken :: RParen ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Parser . Lex ( ) ; Mods . Sext = true ; } if ( Mods . hasIntModifiers ( ) ) { <ISA_LIT>Operand & Op = static_cast < <ISA_LIT>Operand & >


<s> Msg . IsSymbolic = false ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Msg . Id ) ) return true ; if ( getLexer ( ) . is ( AsmToken :: Integer ) ) if ( getParser ( ) . parseAbsoluteExpression ( Msg . Id ) ) Msg . Id = ID_UNKNOWN_ ; } if ( Msg . Id == ID_UNKNOWN_ ) return false ; if ( ! ( Msg . Id == ID_GS || Msg . Id == ID_GS_DONE || Msg . Id == ID_SYSMSG ) ) { if ( getLexer ( ) . isNot ( AsmToken :: RParen ) ) return true ; Parser . Lex ( ) ; return false ; } if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return true ; Parser . Lex ( ) ; assert ( Msg . Id == ID_GS || Msg . Id == ID_GS_DONE || Msg . Id == ID_SYSMSG ) ; Operation . Id = ID_UNKNOWN_ ; if ( getLexer ( ) . is ( AsmToken :: Identifier ) ) { Operation . IsSymbolic = true ; const char * const * S = ( Msg . Id == ID_SYSMSG ) ? OpSysSymbolic : OpGsSymbolic ; const int F = ( Msg . Id == ID_SYSMSG ) ? OP_SYS_FIRST_ : OP_GS_FIRST_ ; const int L = ( Msg . Id == ID_SYSMSG ) ? OP_SYS_LAST_ : OP_GS_LAST_ ; const StringRef Tok = Parser . getTok ( ) . getString ( ) ; for ( int i = F ; i < L ; ++ i ) { if ( Tok == S [ i ] ) { Operation . Id = i ; break ; } } Parser . Lex ( ) ; } else { Operation . IsSymbolic = false ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Operation . Id ) ) return true ; } if ( ( Msg . Id == ID_GS || Msg . Id == ID_GS_DONE ) && Operation . Id != OP_GS_NOP ) { if ( getLexer ( ) . is ( AsmToken :: RParen ) ) { Parser . Lex ( ) ; return


<s> do { if ( ! ( ( ID_INTERRUPT <= Msg . Id && Msg . Id <= ID_GS_DONE ) || Msg . Id == ID_SYSMSG ) ) { if ( Msg . IsSymbolic ) Error ( S , <STR_LIT> ) ; else Error ( S , <STR_LIT> ) ; break ; } Imm16Val = ( Msg . Id << ID_SHIFT_ ) ; if ( Msg . Id == ID_GS || Msg . Id == ID_GS_DONE ) { if ( ! ( OP_GS_FIRST_ <= Operation . Id && Operation . Id < OP_GS_LAST_ ) ) { if ( Operation . IsSymbolic ) Error ( S , <STR_LIT> ) ; else Error ( S , <STR_LIT> ) ; break ; } if ( Operation . Id == OP_GS_NOP && Msg . Id != ID_GS_DONE ) { Error ( S , <STR_LIT> ) ; break ; } Imm16Val |= ( Operation . Id << OP_SHIFT_ ) ; } if ( Msg . Id == ID_SYSMSG ) { if ( ! ( OP_SYS_FIRST_ <= Operation . Id && Operation . Id < OP_SYS_LAST_ ) ) { if ( Operation . IsSymbolic ) Error


<s> return MatchOperand_ParseFail ; } Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Identifier ) ) { return MatchOperand_ParseFail ; } Value = Parser . getTok ( ) . getString ( ) ; return


<s> int64_t CntVal = <NUM_LIT> ; SMLoc S = Parser . getTok ( ) . getLoc ( ) ; switch ( getLexer ( ) . getKind ( ) ) { default : return MatchOperand_ParseFail ; case AsmToken :: Integer : if ( getParser ( ) . parseAbsoluteExpression ( CntVal ) ) return MatchOperand_ParseFail ; break ; case AsmToken :: Identifier : do { if ( parseCnt ( CntVal ) ) return MatchOperand_ParseFail ; } while ( getLexer ( ) . isNot ( AsmToken :: EndOfStatement ) ) ; break ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( CntVal , S )


<s> unsigned <ISA_LIT>AsmParser :: validateTargetOperandClass ( MCParsedAsmOperand & Op , unsigned Kind ) { <ISA_LIT>Operand & Operand = ( <ISA_LIT>Operand & ) Op ; switch ( Kind ) { case MCK_addr64 : return Operand . isAddr64 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_gds : return Operand . isGDS ( ) ? Match_Success : Match_InvalidOperand ; case MCK_glc : return Operand . isGLC ( ) ? Match_Success : Match_InvalidOperand ; case MCK_idxen : return Operand . isIdxen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_offen : return Operand . isOffen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrc32 : return Operand . isSSrc32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget ( ) ? Match_Success


<s> return Operand . isGLC ( ) ? Match_Success : Match_InvalidOperand ; case MCK_idxen : return Operand . isIdxen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_offen : return Operand . isOffen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrc32 : return Operand . isSSrc32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget ( ) ? Match_Success : Match_InvalidOperand ; default : return


<s> if ( <STR_LIT> ( AsmParser -> getMII ( ) -> get ( Inst . getOpcode ( ) ) , Inst . getNumOperands ( ) ) ) { addLiteralImmOperand ( Inst , Imm . Val , ApplyModifiers & isImmTy ( ImmTyNone ) && Imm . Mods . hasFPModifiers ( ) ) ; } else { assert ( ! isImmTy ( ImmTyNone ) ||


<s> if ( ! Imm . IsFPImm ) { Inst . addOperand ( MCOperand :: createImm ( Literal . getLoBits ( Bitwidth ) . getZExtValue ( ) ) ) ; return ; } bool Lost ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , Literal ) ; FPLiteral . convert ( * getFltSemantics ( Bitwidth / <NUM_LIT> ) , APFloat :: rmNearestTiesToEven , & Lost ) ; Inst . addOperand ( MCOperand :: createImm ( FPLiteral . bitcastToAPInt ( ) . getZExtValue


<s> setAvailableFeatures ( ComputeAvailableFeatures ( getFeatureBits ( ) ) ) ; { <STR_LIT> ISA = <STR_LIT> ( getSTI ( ) . getCPU ( ) ) ; MCContext & Ctx = getContext ( ) ; if ( ISA . Major >= <NUM_LIT> && <STR_LIT> :: hasCodeObjectV3 ( & getSTI ( ) ) ) { MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Stepping , Ctx ) ) ; } else { MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> )


<s> Op -> Imm . Val = Val ; Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Type = Type ; Op -> Imm . Mods = Modifiers ( ) ; Op -> StartLoc = Loc


<s> static <ISA_LIT>Operand :: Ptr CreateImm ( const <ISA_LIT>AsmParser * AsmParser , int64_t Val , SMLoc Loc , ImmTy Type = ImmTyNone , bool IsFPImm = false ) { auto Op = std :: make_unique < <ISA_LIT>Operand > ( Immediate , AsmParser ) ; Op -> Imm . Val = Val ; Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Type = Type ; Op -> Imm . Mods = Modifiers ( ) ; Op -> StartLoc = Loc ; Op -> EndLoc


<s> if ( IsAtomic ) { assert ( Desc . getNumDefs ( ) == <NUM_LIT> ) ; ( ( <ISA_LIT>Operand & ) * Operands [ I - <NUM_LIT> ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } OptionalImmIndexMap OptionalIdx ; for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else if ( ! Op


<s> } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyFORMAT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyTFE ) ; if ( isGFX10 ( ) ) addOptionalImmOperand ( Inst ,

Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDLC ) ;