<s> if ( HSAMD :: fromString ( HSAMetadataString , HSAMetadata ) ) return false ; return EmitHSAMetadata (


<s> auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ; EmitNote ( ElfNote :: NoteNameV2 , DescSZ , ELF :: NT_AMD_HSA_ISA_NAME , [ & ] ( MCELFStreamer & OS ) { OS . emitLabel ( DescBegin ) ; OS . emitBytes ( getTargetID ( ) -> toString ( ) ) ; OS . emitLabel ( DescEnd ) ; } )


<s> bool <ISA_LIT>TargetELFStreamer :: EmitISAVersion ( ) { auto & Context = getContext ( ) ; auto * DescBegin = Context . createTempSymbol ( ) ; auto * DescEnd = Context . createTempSymbol ( ) ; auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ; EmitNote ( ElfNote :: NoteNameV2 , DescSZ , ELF :: NT_AMD_HSA_ISA_NAME , [ & ] ( MCELFStreamer & OS ) { OS . emitLabel ( DescBegin ) ; OS . emitBytes ( getTargetID ( ) -> toString ( ) ) ; OS . emitLabel ( DescEnd ) ; } )


<s> S . emitValue ( DescSZ , <NUM_LIT> ) ; S . emitInt32 ( NoteType ) ; S . emitBytes ( Name ) ; S . emitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; EmitDesc ( S ) ; S . emitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT>


<s> MCA . setELFHeaderEFlags ( getEFlags ( ) ) ; std :: string Blob ; const char * Vendor = getPALMetadata ( ) -> getVendor ( ) ; unsigned Type = getPALMetadata ( ) -> getType ( ) ; getPALMetadata ( ) -> toBlob ( Type , Blob ) ; if ( Blob . empty ( ) ) return ; EmitNote ( Vendor , MCConstantExpr :: create ( Blob . size ( ) , getContext ( ) ) , Type , [ & ] ( MCELFStreamer & OS ) {


<s> void <ISA_LIT>TargetELFStreamer :: finish ( ) { MCAssembler & MCA = getStreamer ( ) . getAssembler ( ) ; MCA . setELFHeaderEFlags ( getEFlags ( ) ) ; std :: string Blob ; const char * Vendor = getPALMetadata (


<s> unsigned <ISA_LIT>TargetELFStreamer :: getEFlags ( ) { switch ( STI . getTargetTriple ( ) . getArch ( ) ) { default : llvm_unreachable ( <STR_LIT> ) ; case Triple :: r600 : return getEFlags<ISA_LIT> ( ) ; case Triple :: amdgcn : return getEFlagsAMDGCN


<s> unsigned <ISA_LIT>TargetELFStreamer :: getEFlags ( ) { switch ( STI . getTargetTriple ( ) . getArch ( ) ) { default : llvm_unreachable ( <STR_LIT> ) ; case Triple :: r600 : return getEFlags<ISA_LIT> ( ) ; case Triple :: amdgcn : return getEFlagsAMDGCN (


<s> assert ( STI . getTargetTriple ( ) . getOS ( ) == Triple :: AMDHSA ) ; if ( Optional < uint8_t > HsaAbiVer = getHsaAbiVersion ( & STI ) ) { switch ( * HsaAbiVer ) { case ELF :: ELFABIVER<ISA_LIT>ON_AMDGPU_HSA_V2 : case ELF :: ELFABIVER<ISA_LIT>ON_AMDGPU_HSA_V3 : return getEFlagsV3 (


<s> unsigned <ISA_LIT>TargetELFStreamer :: getEFlagsMesa3D ( ) { assert ( STI . getTargetTriple ( ) . getOS ( ) == Triple :: Mesa3D ) ; return getEFlagsV3 (


<s> unsigned <ISA_LIT>TargetELFStreamer :: getEFlagsV3 ( ) { unsigned EFlagsV3 = <NUM_LIT> ; EFlagsV3 |= getElfMach ( STI . getCPU ( ) ) ; if ( getTargetID ( ) -> isXnackOnOrAny ( ) ) EFlagsV3 |= ELF


<s> EFlagsV3 |= getElfMach ( STI . getCPU ( ) ) ; if ( getTargetID ( ) -> isXnackOnOrAny ( ) ) EFlagsV3 |= ELF :: EF_<ISA_LIT>_FEATURE_XNACK_V3 ; if ( getTargetID ( ) -> isSramEccOnOrAny ( ) ) EFlagsV3 |= ELF :: EF_<ISA_LIT>_FEATURE_SRAMECC_V3 ; return


<s> case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX602 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX602 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX705 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX805 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ; case GK_GFX906 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 ; case GK_GFX908 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 ; case GK_GFX909 : return

ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 ;


<s> MCStreamer & OS = getStreamer ( ) ; OS . PushSection ( ) ; OS . SwitchSection ( <STR_LIT> ( OS . getContext ( ) ) ) ; OS . EmitBytes ( StringRef ( ( const char * ) & Header , sizeof ( Header ) ) ) ; OS . PopSection


<s> MCSectionELF * Note = OS . getContext ( ) . getELFSection ( <STR_LIT> , ELF :: SHT_NOTE , <NUM_LIT> ) ; unsigned NameSZ = <NUM_LIT> ; OS . PushSection ( ) ; OS . SwitchSection ( Note ) ; OS . EmitIntValue ( NameSZ , <NUM_LIT> ) ; OS . EmitIntValue ( <NUM_LIT> , <NUM_LIT>


<s> S . EmitIntValue ( NameSZ , <NUM_LIT> ) ; S . EmitValue ( DescSZ , <NUM_LIT> ) ; S . EmitIntValue ( Type , <NUM_LIT> ) ; S . EmitBytes ( StringRef ( ElfNote :: NoteName , NameSZ ) ) ; S . EmitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; EmitDesc ( S )


<s> if ( ! VerifiedYamlString ) return false ; auto & Context = getContext ( ) ; auto * DescBegin = Context . createTempSymbol ( ) ; auto * DescEnd = Context . createTempSymbol ( ) ; auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ; Emit<ISA_LIT>Note ( DescSZ , ElfNote :: NT_<ISA_LIT>_HSA_CODE_OBJECT_METADATA , [ & ] ( MCELFStreamer & OS ) { OS . EmitLabel ( DescBegin ) ; OS . EmitBytes ( VerifiedYamlString . get ( ) ) ; OS . EmitLabel (


<s> EmitCodeObjectMetadata ( CodeObjectMetadataStreamer . toYamlString ( ) . get ( )


<s> CodeObjectMetadataStreamer . end ( ) ; EmitCodeObjectMetadata ( CodeObjectMetadataStreamer . toYamlString ( ) . get (


<s> void <ISA_LIT>TargetStreamer :: EmitKernelCodeObjectMetadata ( const Function & Func , const amd_kernel_code_t & KernelCode ) { CodeObjectMetadataStreamer . emitKernel ( Func ,


<s> CodeObjectMetadataStreamer . emitKernel ( Func , KernelCode


<s> case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF ::


<s> switch ( ElfMach ) { default : llvm_unreachable ( <STR_LIT> ) ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> : AK = GK_<ISA_LIT> ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 : AK = GK_R630 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 : AK = GK_RS880 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 : AK = GK_RV670 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 : AK = GK_RV710 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 : AK = GK_RV730 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 : AK = GK_RV770 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR : AK = GK_CEDAR ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS : AK = GK_CYPRESS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER : AK = GK_JUNIPER ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD : AK = GK_REDWOOD ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO : AK = GK_SUMO ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS : AK = GK_BARTS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS : AK = GK_CAICOS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN : AK = GK_CAYMAN ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS : AK = GK_TURKS ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 : AK = GK_GFX600 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 : AK = GK_GFX601 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX602 : AK = GK_GFX602 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 : AK = GK_GFX700 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 : AK = GK_GFX701 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 : AK = GK_GFX702 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 : AK = GK_GFX705 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 : AK = GK_GFX805 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 : AK


<s> case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 : AK = GK_GFX702 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 : AK = GK_GFX705 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 : AK = GK_GFX805 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 : AK = GK_GFX810 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 : AK = GK_GFX900 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 : AK = GK_GFX902 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 : AK = GK_GFX904 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 : AK = GK_GFX906 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 : AK = GK_GFX908 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 : AK = GK_GFX909 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX90A : AK = GK_GFX90A ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX90C : AK = GK_GFX90C ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1010 : AK = GK_GFX1010 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1011 : AK = GK_GFX1011 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1012 : AK = GK_GFX1012 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1030 : AK = GK_GFX1030 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1031 : AK =


<s> switch ( AK ) { case GK_<ISA_LIT> : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> ; case GK_R630 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 ; case GK_RS880 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 ; case GK_RV670 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 ; case GK_RV710 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 ; case GK_RV730 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ; case GK_RV770 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ; case GK_CEDAR : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ; case GK_CYPRESS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ; case GK_JUNIPER : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ; case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX602 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX602 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX705 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX805 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ; case GK_GFX906 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 ; case GK_GFX908 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 ; case GK_GFX909 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 ; case GK_GFX90A : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX90A ; case GK_GFX90C : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX90C ; case GK_GFX1010 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1010 ; case GK_GFX1011 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1011 ; case GK_GFX1012 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1012 ; case GK_GFX1030 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1030 ; case GK_GFX1031 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1031 ; case GK_GFX1032 : return

ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1032 ;


<s> MCStreamer & OS = getStreamer ( ) ; OS . PushSection ( ) ; OS . EmitValueToAlignment ( <NUM_LIT> , Encoded_s_code_end , <NUM_LIT> ) ; for ( unsigned I = <NUM_LIT> ; I < <NUM_LIT> ; ++ I ) OS . EmitIntValue ( Encoded_s_code_end , <NUM_LIT> ) ; OS . PopSection (


<s> MCStreamer & OS = getStreamer ( ) ; OS . PushSection ( ) ; OS . EmitValueToAlignment ( <NUM_LIT> , Encoded_s_code_end , <NUM_LIT> ) ; for ( unsigned I = <NUM_LIT> ; I < <NUM_LIT> ; ++ I ) OS . EmitIntValue ( Encoded_s_code_end


<s> KernelCodeSymbol -> setBinding ( ELF :: STB_LOCAL ) ; Streamer . EmitLabel ( KernelDescriptorSymbol ) ; Streamer . EmitBytes ( StringRef ( ( const char * ) & ( KernelDescriptor ) , offsetof ( amdhsa :: kernel_descriptor_t , kernel_code_entry_byte_offset ) ) ) ; Streamer . EmitValue ( MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( KernelCodeSymbol , MCSymbolRefExpr :: VK_<ISA_LIT>_REL64 , Context ) , MCSymbolRefExpr :: create ( KernelDescriptorSymbol , MCSymbolRefExpr :: VK_None , Context ) , Context ) , sizeof (

KernelDescriptor . kernel_code_entry_byte_offset ) ) ;


<s> void <ISA_LIT>TargetELFStreamer :: EmitAmdhsaKernelDescriptor ( const MCSubtargetInfo & STI , StringRef KernelName , const amdhsa :: kernel_descriptor_t & KernelDescriptor , uint64_t NextVGPR , uint64_t NextSGPR , bool ReserveVCC , bool ReserveFlatScr , bool ReserveXNACK ) { auto & Streamer = getStreamer ( ) ; auto & Context = Streamer . getContext ( ) ; MCSymbolELF * KernelDescriptorSymbol = cast < MCSymbolELF > ( Context . getOrCreateSymbol ( Twine ( KernelName ) + Twine ( <STR_LIT> ) ) ) ; KernelDescriptorSymbol -> setBinding ( ELF :: STB_GLOBAL ) ; KernelDescriptorSymbol -> setType ( ELF ::


<s> auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ; EmitNote ( ElfNote :: NoteNameV3 , DescSZ , ELF :: NT_<ISA_LIT>_METADATA , [ & ] ( MCELFStreamer & OS ) { OS . EmitLabel ( DescBegin ) ; OS . EmitBytes ( StrOS . str


<s> bool <ISA_LIT>TargetELFStreamer :: EmitPALMetadata ( const PALMD :: Metadata & PALMetadata ) { EmitNote ( ElfNote :: NoteNameV2 , MCConstantExpr :: create ( PALMetadata . size ( ) * sizeof ( uint32_t ) , getContext ( ) ) , ELF :: NT_AMD_<ISA_LIT>_PAL_METADATA , [ & ] ( MCELFStreamer & OS ) { for ( auto I : PALMetadata ) OS . EmitIntValue ( I , sizeof ( uint32_t ) ) ; } )


<s> if ( AK == <STR_LIT> :: GK_NONE ) AK = parseArch<ISA_LIT> ( GPU ) ; switch ( AK ) { case GK_<ISA_LIT> : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> ; case GK_R630 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 ; case GK_RS880 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 ; case GK_RV670 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 ; case GK_RV710 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 ; case GK_RV730 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ; case GK_RV770 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ; case GK_CEDAR : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ; case GK_CYPRESS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ; case GK_JUNIPER : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ; case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX801 : return ELF ::


<s> case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ; case GK_GFX906 : return

ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 ;


<s> uint16_t VendorNameSize = VendorName . size ( ) + <NUM_LIT> ; uint16_t ArchNameSize = ArchName . size ( ) + <NUM_LIT> ; unsigned DescSZ = sizeof ( VendorNameSize ) + sizeof ( ArchNameSize ) + sizeof ( Major ) + sizeof ( Minor ) + sizeof ( Stepping ) + VendorNameSize + ArchNameSize ; EmitNote ( ElfNote :: NoteNameV2 , MCConstantExpr :: create ( DescSZ , getContext ( ) ) , ElfNote :: NT_<ISA_LIT>_HSA_ISA , [ & ] ( MCELFStreamer & OS ) { OS . emitIntValue ( VendorNameSize


<s> auto & Context = S . getContext ( ) ; auto NameSZ = Name . size ( ) + <NUM_LIT> ; S . PushSection ( ) ; S . SwitchSection ( Context . getELFSection ( ElfNote :: SectionName , ELF :: SHT_NOTE , ELF :: SHF_ALLOC ) ) ; S . emitIntValue ( NameSZ , <NUM_LIT> ) ; S . emitValue ( DescSZ , <NUM_LIT> ) ; S . emitIntValue ( NoteType , <NUM_LIT> ) ; S . emitBytes ( Name ) ; S . emitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; EmitDesc ( S ) ; S . emitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; S . PopSection (


<s> auto & Context = S . getContext ( ) ; auto NameSZ = Name . size ( ) + <NUM_LIT> ; S . PushSection ( ) ; S . SwitchSection ( Context . getELFSection ( ElfNote :: SectionName

, ELF :: SHT_NOTE , ELF :: SHF_ALLOC ) ) ;


<s> OS . SwitchSection ( OS . getContext ( ) . getObjectFileInfo ( ) -> getTextSection ( ) ) ; OS . EmitBytes ( StringRef ( ( const char * ) & Header , sizeof ( Header ) ) ) ; OS . PopSection


<s> KernelDescriptorSymbol -> setOther ( KernelCodeSymbol -> getOther ( ) ) ; KernelDescriptorSymbol -> setVisibility ( KernelCodeSymbol -> getVisibility ( ) ) ; KernelDescriptorSymbol -> setType ( ELF :: STT_OBJECT ) ; KernelDescriptorSymbol -> setSize ( MCConstantExpr :: create ( sizeof ( KernelDescriptor ) , Context ) ) ; if ( KernelCodeSymbol -> getVisibility ( ) == ELF :: STV_DEFAULT ) KernelCodeSymbol -> setVisibility ( ELF :: STV_PROTECTED ) ; Streamer . emitLabel ( KernelDescriptorSymbol ) ; Streamer . emitInt32 ( KernelDescriptor . group_segment_fixed_size ) ; Streamer . emitInt32 ( KernelDescriptor . private_segment_fixed_size ) ; for ( uint8_t Res : KernelDescriptor . reserved0 ) Streamer . emitInt8 ( Res ) ; Streamer . emitValue ( MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( KernelCodeSymbol , MCSymbolRefExpr :: VK_<ISA_LIT>_REL64 , Context ) , MCSymbolRefExpr :: create ( KernelDescriptorSymbol , MCSymbolRefExpr :: VK_None , Context ) , Context ) , sizeof ( KernelDescriptor . kernel_code_entry_byte_offset ) ) ; for ( uint8_t Res : KernelDescriptor . reserved1 ) Streamer . emitInt8 ( Res ) ; Streamer . emitInt32 ( KernelDescriptor . compute_pgm_rsrc3 ) ; Streamer . emitInt32 ( KernelDescriptor


<s> case GK_RV730 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ; case GK_RV770 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ; case GK_CEDAR : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ; case GK_CYPRESS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ; case GK_JUNIPER : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ; case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX602 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX602 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX705 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 ; case GK_GFX801 : return ELF ::


<s> <ISA_LIT>TargetELFStreamer :: <ISA_LIT>TargetELFStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) : <ISA_LIT>TargetStreamer ( S ) , Streamer ( S ) { MCAssembler & MCA = getStreamer ( ) . getAssembler ( ) ; unsigned EFlags = MCA . getELFHeaderEFlags (


<s> <ISA_LIT>TargetELFStreamer :: <ISA_LIT>TargetELFStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) : <ISA_LIT>TargetStreamer ( S ) , Streamer ( S ) { MCAssembler & MCA = getStreamer ( ) . getAssembler ( ) ; unsigned EFlags = MCA . getELFHeaderEFlags ( ) ; EFlags &= ~ ELF :: EF_<ISA_LIT>_MACH ; EFlags |= getMACH ( STI . getCPU ( )


<s> void <ISA_LIT>TargetELFStreamer :: Emit<ISA_LIT>Note ( const MCExpr * DescSZ , unsigned NoteType , function_ref < void ( MCELFStreamer & ) > EmitDesc ) { auto & S = getStreamer ( ) ; auto & Context = S . getContext ( ) ; auto NameSZ = sizeof ( ElfNote :: NoteName ) ; S . PushSection ( ) ; S . SwitchSection ( Context . getELFSection ( ElfNote :: SectionName , ELF :: SHT_NOTE , ELF :: SHF_ALLOC ) ) ; S . EmitIntValue ( NameSZ , <NUM_LIT> ) ; S . EmitValue ( DescSZ , <NUM_LIT> ) ; S . EmitIntValue ( NoteType , <NUM_LIT> ) ; S . EmitBytes ( StringRef ( ElfNote :: NoteName , NameSZ ) ) ; S . EmitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT>


<s> void <ISA_LIT>TargetELFStreamer :: EmitDirectiveHSACodeObjectVersion ( uint32_t Major , uint32_t Minor ) { Emit<ISA_LIT>Note ( MCConstantExpr :: create ( <NUM_LIT> , getContext ( ) ) ,


<s> if ( HSAMD :: toString ( HSAMetadata , HSAMetadataString ) ) return false ; auto & Context = getContext ( ) ; auto * DescBegin = Context . createTempSymbol ( ) ; auto * DescEnd = Context . createTempSymbol ( ) ; auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin ,


<s> auto Entry = MachTable ; for ( ; Entry -> Name && Mach != Entry -> Mach ; ++ Entry ) ; return Entry ->


compute_pgm_rsrc1 , amdhsa :: COMPUTE_PGM_RSRC1_ENABLE_DX10_CLAMP ) ;


<s> case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX602 : AK = GK_GFX602 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 : AK = GK_GFX700 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 : AK = GK_GFX701 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 : AK = GK_GFX702 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 : AK = GK_GFX705 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 : AK = GK_GFX805 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 : AK = GK_GFX810 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 : AK = GK_GFX900 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 : AK = GK_GFX902 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 : AK = GK_GFX904 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 : AK = GK_GFX906 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 : AK = GK_GFX908 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 : AK = GK_GFX909 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1010 : AK = GK_GFX1010 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1011 : AK = GK_GFX1011 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1012 : AK = GK_GFX1012 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1030 : AK = GK_GFX1030 ;


<s> StringRef <ISA_LIT>TargetStreamer :: getArchNameFromElfMach ( unsigned ElfMach ) { <STR_LIT> AK ; switch ( ElfMach ) { default : llvm_unreachable ( <STR_LIT> ) ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> : AK = GK_<ISA_LIT> ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 : AK = GK_R630 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 : AK = GK_RS880 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 : AK = GK_RV670 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 : AK = GK_RV710 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 : AK = GK_RV730 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 : AK = GK_RV770 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR : AK = GK_CEDAR ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS : AK = GK_CYPRESS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER : AK = GK_JUNIPER ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD : AK = GK_REDWOOD ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO : AK = GK_SUMO ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS : AK = GK_BARTS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS : AK = GK_CAICOS


<s> case GK_GFX705 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX705 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX805 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX805 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ; case GK_GFX906 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 ; case GK_GFX908 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 ; case GK_GFX909 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 ; case GK_GFX1010 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1010 ; case GK_GFX1011 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1011 ; case GK_GFX1012 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1012 ; case GK_GFX1030 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1030 ; case GK_GFX1031 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1031 ; case GK_NONE : return ELF :: EF_<ISA_LIT>_MACH_NONE ; } llvm_unreachable ( <STR_LIT>


<s> StringRef <ISA_LIT>TargetStreamer :: getArchNameFromElfMach ( unsigned ElfMach ) { <STR_LIT> AK ; switch ( ElfMach ) { case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> : AK = GK_<ISA_LIT> ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 : AK = GK_R630 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 : AK = GK_RS880 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 : AK = GK_RV670 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 : AK = GK_RV710 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 : AK = GK_RV730 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 : AK = GK_RV770 ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR : AK = GK_CEDAR ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS : AK = GK_CYPRESS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER : AK = GK_JUNIPER ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD : AK = GK_REDWOOD ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO : AK = GK_SUMO ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS : AK = GK_BARTS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS : AK = GK_CAICOS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN : AK = GK_CAYMAN ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS : AK = GK_TURKS ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 : AK = GK_GFX600 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 : AK = GK_GFX601 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 : AK = GK_GFX700 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 : AK = GK_GFX701 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 : AK = GK_GFX702 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 :


<s> EFlags &= ~ ELF :: EF_<ISA_LIT>_MACH ; EFlags |= getElfMach ( STI . getCPU ( ) ) ; EFlags &= ~ ELF :: EF_<ISA_LIT>_XNACK ; if ( <STR_LIT> ( STI ) ) EFlags |= ELF ::


<s> case GK_<ISA_LIT> : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> ; case GK_R630 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 ; case GK_RS880 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 ; case GK_RV670 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 ; case GK_RV710 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 ; case GK_RV730 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ; case GK_RV770 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ; case GK_CEDAR : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ; case GK_CYPRESS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ; case GK_JUNIPER : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ; case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return

ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ;


<s> unsigned <ISA_LIT>TargetStreamer :: getMACH ( StringRef GPU ) const { return llvm :: StringSwitch < unsigned > ( GPU ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_<ISA_LIT> ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_R630 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RS880 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV670 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV710 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ) . Case ( <STR_LIT> , ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704

) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ) . Case ( <STR_LIT> , ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ) . Default ( ELF :: EF_<ISA_LIT>_MACH_NONE ) ;


<s> <ISA_LIT>TargetELFStreamer :: <ISA_LIT>TargetELFStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) : <ISA_LIT>TargetStreamer ( S ) , Streamer ( S ) , Os ( STI . getTargetTriple ( ) . getOS ( ) ) { MCAssembler & MCA = getStreamer ( ) . getAssembler ( ) ; unsigned EFlags = MCA . getELFHeaderEFlags ( ) ; EFlags &= ~ ELF :: EF_<ISA_LIT>_MACH ; EFlags |= getElfMach ( STI . getCPU ( ) ) ; EFlags &= ~ ELF :: EF_<ISA_LIT>_XNACK ; if ( <STR_LIT> ( STI ) ) EFlags |= ELF :: EF_<ISA_LIT>_XNACK ; EFlags &= ~ ELF :: EF_<ISA_LIT>_SRAM_ECC ; if ( <STR_LIT> ( STI ) ) EFlags |=


<s> assert ( isPowerOf2_32 ( Align ) ) ; MCSymbolELF * SymbolELF = cast < MCSymbolELF > ( Symbol ) ; SymbolELF -> setType ( ELF :: STT_OBJECT ) ; if ( ! SymbolELF -> isBindingSet ( ) ) { SymbolELF -> setBinding (


<s> MCSymbolELF * Symbol = cast < MCSymbolELF > ( getStreamer ( ) . getContext (

) . getOrCreateSymbol ( SymbolName ) ) ;


<s> void <ISA_LIT>TargetELFStreamer :: EmitAmdhsaKernelDescriptor ( const MCSubtargetInfo & STI , StringRef KernelName , const amdhsa :: kernel_descriptor_t & KernelDescriptor , uint64_t NextVGPR , uint64_t NextSGPR , bool ReserveVCC , bool ReserveFlatScr , bool ReserveXNACK ) { auto & Streamer = getStreamer ( ) ; auto & Context = Streamer . getContext ( ) ; MCSymbolELF * KernelCodeSymbol = cast < MCSymbolELF > ( Context . getOrCreateSymbol ( Twine ( KernelName ) ) ) ; MCSymbolELF * KernelDescriptorSymbol = cast < MCSymbolELF > ( Context . getOrCreateSymbol ( Twine ( KernelName ) + Twine ( <STR_LIT> ) ) ) ; KernelDescriptorSymbol -> setBinding ( KernelCodeSymbol -> getBinding


<s> void <ISA_LIT>TargetELFStreamer :: EmitAMDKernelCodeT ( const amd_kernel_code_t & Header ) { MCStreamer & OS = getStreamer ( ) ; OS . PushSection


<s> bool <ISA_LIT>TargetELFStreamer :: EmitCodeEnd ( ) { const uint32_t Encoded_s_code_end = <NUM_LIT> ; MCStreamer & OS = getStreamer ( ) ; OS . PushSection ( ) ; OS . emitValueToAlignment ( <NUM_LIT> , Encoded_s_code_end , <NUM_LIT> ) ; for ( unsigned I = <NUM_LIT> ; I < <NUM_LIT> ; ++ I ) OS .


<s> bool <ISA_LIT>TargetELFStreamer :: EmitHSAMetadata ( const <STR_LIT> :: Metadata & HSAMetadata ) { std :: string HSAMetadataString ; if ( HSAMD :: toString ( HSAMetadata , HSAMetadataString ) ) return false ; auto & Context = getContext ( ) ; auto * DescBegin = Context . createTempSymbol ( ) ; auto * DescEnd = Context . createTempSymbol ( ) ; auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd ,

Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ;


<s> if ( ! HSAMetadataDoc . fromYAML ( HSAMetadataString ) )


<s> auto * DescBegin = Context . createTempSymbol ( ) ; auto * DescEnd = Context . createTempSymbol ( ) ; auto * DescSZ = MCBinaryExpr :: createSub ( MCSymbolRefExpr :: create ( DescEnd , Context ) , MCSymbolRefExpr :: create ( DescBegin , Context ) , Context ) ; EmitNote ( ElfNote :: NoteNameV2 , DescSZ , ELF :: NT_AMD_<ISA_LIT>_ISA , [ & ] ( MCELFStreamer & OS ) { OS . emitLabel ( DescBegin


<s> auto & S = getStreamer ( ) ; auto & Context = S . getContext ( ) ; auto NameSZ = Name . size ( ) + <NUM_LIT> ; unsigned NoteFlags = <NUM_LIT> ; if ( Os == Triple :: AMDHSA ) NoteFlags = ELF :: SHF_ALLOC ; S . PushSection ( ) ; S . SwitchSection ( Context . getELFSection ( ElfNote :: SectionName , ELF :: SHT_NOTE , NoteFlags ) ) ; S . emitInt32 ( NameSZ ) ; S . emitValue ( DescSZ , <NUM_LIT> ) ; S . emitInt32 ( NoteType ) ; S . emitBytes ( Name ) ; S . emitValueToAlignment ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT>


<s> auto & S = getStreamer ( ) ; auto & Context = S . getContext ( ) ; auto NameSZ = Name . size ( ) + <NUM_LIT> ; unsigned NoteFlags = <NUM_LIT> ; if ( Os == Triple :: AMDHSA ) NoteFlags = ELF :: SHF_ALLOC ; S . PushSection ( ) ; S . SwitchSection ( Context . getELFSection ( ElfNote :: SectionName , ELF :: SHT_NOTE , NoteFlags ) ) ; S . emitInt32 ( NameSZ )


<s> if ( Blob . empty ( ) ) return ; EmitNote ( Vendor , MCConstantExpr :: create ( Blob . size ( ) , getContext ( ) ) , Type , [ & ] ( MCELFStreamer & OS )


<s> case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 : AK = GK_GFX810 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 : AK = GK_GFX900 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 : AK = GK_GFX902 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 : AK = GK_GFX904 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 : AK = GK_GFX906 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 : AK = GK_GFX908 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 : AK = GK_GFX909 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1010 : AK = GK_GFX1010 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1011 : AK = GK_GFX1011 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX1012 : AK = GK_GFX1012


<s> case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS : AK = GK_BARTS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS : AK = GK_CAICOS ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN : AK = GK_CAYMAN ; break ; case ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS : AK = GK_TURKS ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 : AK = GK_GFX600 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 : AK = GK_GFX601 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 : AK = GK_GFX700 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 : AK = GK_GFX701 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 : AK = GK_GFX702 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 : AK = GK_GFX703 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 : AK = GK_GFX704 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 : AK = GK_GFX801 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 : AK = GK_GFX802 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 : AK = GK_GFX803 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 : AK = GK_GFX810 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 : AK = GK_GFX900 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 : AK = GK_GFX902 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 : AK = GK_GFX904 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 : AK = GK_GFX906 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 : AK = GK_GFX908 ; break ; case ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX909 : AK =


<s> case GK_RV730 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV730 ; case GK_RV770 : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_RV770 ; case GK_CEDAR : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CEDAR ; case GK_CYPRESS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CYPRESS ; case GK_JUNIPER : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_JUNIPER ; case GK_REDWOOD : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_REDWOOD ; case GK_SUMO : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_SUMO ; case GK_BARTS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_BARTS ; case GK_CAICOS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAICOS ; case GK_CAYMAN : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_CAYMAN ; case GK_TURKS : return ELF :: EF_AMDGPU_MACH_<ISA_LIT>_TURKS ; case GK_GFX600 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX600 ; case GK_GFX601 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX601 ; case GK_GFX700 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX700 ; case GK_GFX701 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX701 ; case GK_GFX702 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX702 ; case GK_GFX703 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX703 ; case GK_GFX704 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX704 ; case GK_GFX801 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX801 ; case GK_GFX802 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX802 ; case GK_GFX803 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX803 ; case GK_GFX810 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX810 ; case GK_GFX900 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX900 ; case GK_GFX902 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX902 ; case GK_GFX904 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX904 ; case GK_GFX906 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX906 ; case GK_GFX908 : return ELF :: EF_<ISA_LIT>_MACH_AMDGCN_GFX908 ; case GK_GFX909 : return ELF ::


<s> MCELFStreamer & <ISA_LIT>TargetELFStreamer :: getStreamer


<s> return static_cast < MCELFStreamer & >


<s> PtrArg = getUnderlyingObject ( PtrArg ) ; if ( const AllocaInst * AI = dyn_cast < AllocaInst > ( PtrArg ) ) { if ( ! AI -> isStaticAlloca ( ) || ! AIVisited . insert ( AI ) . second ) continue ; AllocaSize += DL . getTypeAllocSize ( AI -> getAllocatedType ( ) ) ; if ( AllocaSize > ArgAllocaCutoff ) { AllocaSize =


<s> const FeatureBitset & CalleeBits = CalleeST -> getFeatureBits ( ) ; FeatureBitset RealCallerBits = CallerBits & ~ InlineFeatureIgnoreList ; FeatureBitset RealCalleeBits = CalleeBits & ~ InlineFeatureIgnoreList ; if ( ( RealCallerBits & RealCalleeBits ) != RealCalleeBits ) return false ; <STR_LIT> CallerMode ( * Caller ) ; <STR_LIT> CalleeMode ( * Callee ) ; if ( ! CallerMode . isInlineCompatible ( CalleeMode ) ) return false ; if ( Callee -> hasFnAttribute ( Attribute :: AlwaysInline ) || Callee -> hasFnAttribute ( Attribute :: InlineHint ) ) return true ; if ( InlineMaxBB ) { if ( Callee -> size ( ) == <NUM_LIT> ) return true ; size_t BBSize = Caller -> size ( ) + Callee -> size


<s> GCNTTIImpl :: GCNTTIImpl ( const <ISA_LIT>TargetMachine * TM , const Function & F ) : BaseT ( TM , F . getParent ( ) -> getDataLayout ( ) ) , ST ( static_cast < const GCNSubtarget * > ( TM -> getSubtargetImpl ( F ) ) ) , TLI ( ST

-> getTargetLowering ( ) ) , CommonTTI ( TM , F ) , IsGraphics ( <STR_LIT> ( F . getCallingConv ( ) ) ) {


<s> inline int get64BitInstrCost ( ) const { return ST -> hasHalfRate64Ops ( ) ? getHalfRateInstrCost (


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT> ) return BaseT :: getArithmeticReductionCost ( Opcode , Ty , FMF , CostKind ) ; std :: pair < InstructionCost , MVT > LT = TLI -> getTypeLegalizationCost ( DL , Ty ) ; return LT . first


<s> unsigned getFlatAddressSpace ( ) const { if ( IsGraphicsShader ) return - <NUM_LIT> ; return ST -> hasFlatAddressSpace ( ) ? ST -> get<ISA_LIT>AS ( ) . FLAT_ADDRESS

: ST -> get<ISA_LIT>AS ( ) . UNKNOWN_ADDRESS_SPACE ;


<s> static inline int getFullRateInstrCost ( ) { return TargetTransformInfo :: TCC_Basic


<s> static inline int getHalfRateInstrCost


<s> InstructionCost GCNTTIImpl :: getIntrinsicInstrCost ( const IntrinsicCostAttributes & ICA , TTI :: TargetCostKind CostKind ) { if ( ICA . getID ( ) == <STR_LIT> ) return <NUM_LIT> ; if ( ! intrinsicHasPackedVectorBenefit ( ICA . getID ( ) ) ) return BaseT :: getIntrinsicInstrCost ( ICA , CostKind ) ; Type * RetTy = ICA . getReturnType ( ) ; std :: pair < InstructionCost , MVT > LT = TLI -> getTypeLegalizationCost ( DL , RetTy ) ; unsigned NElts = LT . second . isVector ( ) ? LT . second . getVectorNumElements ( ) : <NUM_LIT> ; <STR_LIT> SLT = LT . second . getScalarType ( ) . SimpleTy ; if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( CostKind ) ; if ( ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) || ( ST -> hasPackedFP32Ops ( ) && SLT == <STR_LIT> ) ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; unsigned InstRate = getQuarterRateInstrCost ( CostKind ) ; switch ( ICA . getID ( ) ) { case <STR_LIT> : InstRate = ST -> hasFastFMAF32 ( ) ? getHalfRateInstrCost ( CostKind ) : getQuarterRateInstrCost (


<s> if ( AddrSpace == <ISA_LIT>AS :: PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; return <NUM_LIT>


<s> return <NUM_LIT> ; } if ( AddrSpace == <ISA_LIT>AS :: PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; return


<s> if ( VecRegBitWidth > <NUM_LIT> && VecTy -> getScalarSizeInBits ( ) <

<NUM_LIT> ) return <NUM_LIT> / LoadSize ;


<s> unsigned GCNTTIImpl :: getMaximumVF ( unsigned ElemWidth , unsigned Opcode ) const { if ( Opcode == Instruction :: Load || Opcode == Instruction :: Store ) return <NUM_LIT> * <NUM_LIT> / ElemWidth ; return ( ElemWidth == <NUM_LIT> && ST -> has16BitInsts ( ) ) ? <NUM_LIT> : ( ElemWidth ==

<NUM_LIT> && ST -> hasPackedFP32Ops ( ) ) ? <NUM_LIT> : <NUM_LIT> ;


<s> if ( Opcode == Instruction :: Load || Opcode == Instruction :: Store ) return <NUM_LIT> * <NUM_LIT> / ElemWidth ; return ( ElemWidth == <NUM_LIT> && ST -> has16BitInsts ( ) ) ? <NUM_LIT> : ( ElemWidth == <NUM_LIT> && ST -> hasPackedFP32Ops


<s> unsigned GCNTTIImpl :: getMaxInterleaveFactor ( unsigned VF ) { if ( VF == <NUM_LIT> )


<s> if ( AtomicElementSize ) return Type :: getIntNTy ( Context , * AtomicElementSize * <NUM_LIT> ) ; unsigned MinAlign = std :: min ( SrcAlign , DestAlign ) ; if ( MinAlign == <NUM_LIT> ) return Type :: getInt16Ty ( Context ) ; if ( SrcAddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || SrcAddrSpace == <ISA_LIT>AS :: REGION_ADDRESS || DestAddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || DestAddrSpace == <ISA_LIT>AS :: REGION_ADDRESS ) { return FixedVectorType :: get ( Type :: getInt32Ty ( Context ) , <NUM_LIT> ) ; } return FixedVectorType :: get ( Type :: getInt32Ty ( Context )


<s> Type * I64Ty = Type :: getInt64Ty ( Context ) ; while ( RemainingBytes >= <NUM_LIT> ) { OpsOut . push_back ( I64Ty ) ; RemainingBytes -= <NUM_LIT> ; } Type * I32Ty = Type :: getInt32Ty ( Context ) ; while ( RemainingBytes >= <NUM_LIT> ) { OpsOut . push_back ( I32Ty ) ; RemainingBytes -= <NUM_LIT> ; } } Type * I16Ty = Type :: getInt16Ty ( Context ) ; while ( RemainingBytes >= <NUM_LIT> ) { OpsOut . push_back ( I16Ty ) ; RemainingBytes -= <NUM_LIT> ; } Type * I8Ty = Type :: getInt8Ty ( Context ) ; while ( RemainingBytes ) { OpsOut . push_back (


<s> InstructionCost GCNTTIImpl :: getMinMaxReductionCost ( VectorType * Ty , VectorType * CondTy , bool IsUnsigned , TTI :: TargetCostKind CostKind ) { EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT> ) return BaseT :: getMinMaxReductionCost ( Ty , CondTy ,


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) !=

<NUM_LIT> ) return BaseT :: getMinMaxReductionCost ( Ty , CondTy , IsUnsigned , CostKind ) ;


<s> unsigned GCNTTIImpl :: getMinVectorRegisterBitWidth (


<s> unsigned GCNTTIImpl :: getNumberOfRegisters ( unsigned


<s> void GCNTTIImpl :: getPeelingPreferences ( Loop * L , ScalarEvolution & SE , TTI :: PeelingPreferences & PP ) { CommonTTI . getPeelingPreferences ( L , SE , PP


<s> assert ( isPowerOf2_32 ( TyWidth ) && <STR_LIT>


<s> TTI :: PopcntSupportKind getPopcntSupport ( unsigned TyWidth ) { assert ( isPowerOf2_32 ( TyWidth ) &&


<s> return <NUM_LIT> * TargetTransformInfo


<s> unsigned GCNTTIImpl :: getStoreVectorFactor ( unsigned VF , unsigned StoreSize , unsigned ChainSizeInBytes , VectorType * VecTy ) const { unsigned VecRegBitWidth = VF * StoreSize


<s> auto * Ordering = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; auto * Volatile = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; if ( ! Ordering || ! Volatile ) return false ; unsigned OrderingVal = Ordering -> getZExtValue ( ) ; if ( OrderingVal > static_cast < unsigned > ( AtomicOrdering :: SequentiallyConsistent ) ) return false ; Info . PtrVal = Inst -> getArgOperand ( <NUM_LIT> ) ; Info . Ordering = static_cast < AtomicOrdering > ( OrderingVal ) ; Info . ReadMem = true ; Info . WriteMem = true ; Info . IsVolatile = ! Volatile -> isZero ( ) ; return true ; } default : return


<s> void GCNTTIImpl :: getUnrollingPreferences ( Loop * L , ScalarEvolution & SE , TTI :: UnrollingPreferences

& UP , OptimizationRemarkEmitter * ORE ) {


<s> void GCNTTIImpl :: getUnrollingPreferences ( Loop * L , ScalarEvolution & SE , TTI :: UnrollingPreferences & UP , OptimizationRemarkEmitter * ORE ) { CommonTTI . getUnrollingPreferences ( L , SE , UP


<s> switch ( Opcode ) { case Instruction :: ExtractElement : case Instruction :: InsertElement : { unsigned EltSize = DL . getTypeSizeInBits ( cast < VectorType > ( ValTy ) -> getElementType ( ) ) ; if ( EltSize < <NUM_LIT> ) { if ( EltSize == <NUM_LIT> && Index == <NUM_LIT> && ST -> has16BitInsts ( ) ) return <NUM_LIT> ; return BaseT :: getVectorInstrCost ( Opcode , ValTy , Index ) ; } return Index == ~ <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ; } default : return BaseT :: getVectorInstrCost ( Opcode , ValTy ,


<s> unsigned getVectorSplitCost ( ) { return


<s> return false ; } const ExtractValueInst * ExtValue = dyn_cast < ExtractValueInst > ( V ) ; if ( ! ExtValue ) return false ; const CallInst * CI = dyn_cast < CallInst > ( ExtValue -> getOperand ( <NUM_LIT> ) ) ; if ( ! CI ) return false ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( CI ) ) { switch ( Intrinsic -> getIntrinsicID ( ) ) { default : return false ; case <STR_LIT> : case <STR_LIT> : { ArrayRef < unsigned > Indices = ExtValue -> getIndices ( ) ; return Indices . size ( ) == <NUM_LIT> && Indices [


<s> if ( TargetOutputIdx != - <NUM_LIT> && TargetOutputIdx != OutputIdx ++ ) continue ; TLI -> ComputeConstraintToUse ( TC , SDValue ( ) ) ; const TargetRegisterClass * RC = TLI -> getRegForInlineAsmConstraint ( TRI , TC . ConstraintCode , TC . ConstraintVT ) . second ; if ( ! RC || ! TRI -> isSGPRClass ( RC


<s> bool GCNTTIImpl :: isLegalToVectorizeLoadChain ( unsigned ChainSizeInBytes , Align Alignment , unsigned AddrSpace ) const { return isLegalToVectorizeMemChain ( ChainSizeInBytes , Alignment ,


<s> return ( Alignment >= <NUM_LIT> || ST -> hasUnalignedScratchAccess ( )

) && ChainSizeInBytes <= ST -> getMaxPrivateElementSize ( ) ;


<s> bool GCNTTIImpl :: isLegalToVectorizeStoreChain ( unsigned ChainSizeInBytes , Align Alignment , unsigned AddrSpace


<s> if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> ( Intrinsic -> getIntrinsicID ( ) ) ; if ( const CallInst * CI = dyn_cast < CallInst > ( V ) ) { if ( CI -> isInlineAsm ( ) ) return isInlineAsmSourceOfDivergence ( CI ) ; return true ; } if ( isa < InvokeInst > ( V ) ) return true ; return false


<s> case <STR_LIT> : { unsigned TrueAS = IntrID == <STR_LIT> ? <ISA_LIT>AS :: LOCAL_ADDRESS : <ISA_LIT>AS :: PRIVATE_ADDRESS ; unsigned NewAS = NewV -> getType ( ) -> getPointerAddressSpace ( ) ; LLVMContext & Ctx = NewV -> getType ( ) -> getContext ( ) ; ConstantInt * NewVal = ( TrueAS == NewAS ) ? ConstantInt :: getTrue ( Ctx ) : ConstantInt :: getFalse ( Ctx ) ; return NewVal ; } case <STR_LIT> : { unsigned OldAS = OldV -> getType ( ) -> getPointerAddressSpace ( ) ; unsigned NewAS = NewV -> getType ( ) -> getPointerAddressSpace ( ) ; Value * MaskOp = II -> getArgOperand ( <NUM_LIT> ) ; Type * MaskTy = MaskOp -> getType ( ) ; bool DoTruncate = false ; const GCNTargetMachine & TM = static_cast < const GCNTargetMachine & > ( getTLI ( ) -> getTargetMachine ( ) ) ; if ( ! TM . isNoopAddrSpaceCast ( OldAS , NewAS ) ) { if ( DL . getPointerSizeInBits ( OldAS ) != <NUM_LIT> || DL . getPointerSizeInBits ( NewAS ) != <NUM_LIT> ) return nullptr ; KnownBits Known = computeKnownBits ( MaskOp , DL , <NUM_LIT> , nullptr , II ) ; if ( Known . countMinLeadingOnes ( ) < <NUM_LIT> ) return nullptr ; DoTruncate = true ; } IRBuilder < > B ( II ) ; if ( DoTruncate ) { MaskTy = B . getInt32Ty ( ) ; MaskOp = B . CreateTrunc ( MaskOp ,


<s> bool GCNTTIImpl :: useGPUDivergenceAnalysis (


<s> static inline int getHalfRateInstrCost ( TTI ::


<s> static inline int getHalfRateInstrCost ( TTI :: TargetCostKind CostKind ) { return CostKind == TTI :: TCK_CodeSize ? <NUM_LIT> : <NUM_LIT> *


<s> InstructionCost getVectorSplitCost ( )


<s> assert ( isPowerOf2_32 ( TyWidth ) && <STR_LIT> ) ; return ST -> hasBCNT ( TyWidth ) ? TTI ::

PSK_FastHardware : TTI :: PSK_Software ;


<s> const <ISA_LIT>Subtarget * getST ( ) const { return


<s> const GCNSubtarget * CalleeST = static_cast < const GCNSubtarget * > ( TM . getSubtargetImpl ( * Callee ) ) ; const FeatureBitset & CallerBits = CallerST -> getFeatureBits ( ) ; const FeatureBitset & CalleeBits = CalleeST -> getFeatureBits ( ) ; FeatureBitset RealCallerBits = CallerBits & ~


<s> return BaseT :: getArithmeticInstrCost ( Opcode , Ty , Opd1Info , Opd2Info , Opd1PropInfo , Opd2PropInfo ) ; } std :: pair < int , MVT > LT = TLI -> getTypeLegalizationCost ( DL , Ty ) ; int ISD = TLI -> InstructionOpcodeToISD ( Opcode ) ; unsigned NElts = LT . second . isVector ( ) ? LT . second . getVectorNumElements ( ) : <NUM_LIT> ; <STR_LIT> SLT = LT . second . getScalarType ( ) . SimpleTy ; switch ( ISD ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return get64BitInstrCost ( ) * LT . first * NElts ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return getFullRateInstrCost ( ) * LT . first * NElts ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return LT . first * NElts * getFullRateInstrCost ( ) ; case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return QuarterRateCost * NElts * LT . first ; } case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( ) ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) return LT . first * NElts * getFullRateInstrCost ( ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { int Cost = <NUM_LIT> * get64BitInstrCost ( ) + <NUM_LIT> * getQuarterRateInstrCost ( ) ; if ( ! ST -> hasUsableDivScaleConditionOutput ( ) ) Cost += <NUM_LIT> * getFullRateInstrCost ( ) ; return LT . first *


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( ! OrigTy . isSimple ( ) ) { return BaseT :: getArithmeticInstrCost ( Opcode , Ty , Opd1Info , Opd2Info , Opd1PropInfo , Opd2PropInfo ) ; } std :: pair < int , MVT > LT = TLI -> getTypeLegalizationCost ( DL , Ty ) ; int ISD = TLI -> InstructionOpcodeToISD ( Opcode ) ; unsigned NElts = LT . second . isVector ( ) ? LT . second . getVectorNumElements ( ) : <NUM_LIT> ; <STR_LIT> SLT = LT . second . getScalarType ( ) . SimpleTy ; switch ( ISD ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return get64BitInstrCost ( ) * LT . first * NElts ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return getFullRateInstrCost ( ) * LT . first * NElts ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return LT . first * NElts * getFullRateInstrCost ( ) ; case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = (


<s> unsigned getInliningThresholdMultiplier (


<s> return getIntrinsicInstrCost < Type > ( ID , RetTy ,


<s> if ( AddrSpace == <ISA_LIT>AS :: FLAT_ADDRESS || AddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || AddrSpace == <ISA_LIT>AS :: REGION_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == <ISA_LIT>AS :: PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; llvm_unreachable ( <STR_LIT> )


<s> void <ISA_LIT>TTIImpl :: getUnrollingPreferences ( Loop * L , ScalarEvolution & SE , TTI :: UnrollingPreferences & UP ) { const Function & F = * L -> getHeader ( ) -> getParent ( ) ; UP . Threshold = <STR_LIT> ( F , <STR_LIT> , <NUM_LIT> ) ; UP . MaxCount = std :: numeric_limits < unsigned > :: max ( ) ; UP . Partial = true ; const unsigned MaxAlloca = ( <NUM_LIT> - <NUM_LIT> ) * <NUM_LIT> ; unsigned ThresholdPrivate = UnrollThresholdPrivate ; unsigned ThresholdLocal = UnrollThresholdLocal ; unsigned MaxBoost = std :: max ( ThresholdPrivate , ThresholdLocal ) ; for ( const BasicBlock * BB : L -> getBlocks ( ) ) { const DataLayout & DL = BB -> getModule ( ) -> getDataLayout ( ) ; unsigned LocalGEPsSeen = <NUM_LIT> ; if ( llvm :: any_of ( L -> getSubLoops ( ) , [ BB ] ( const Loop * SubLoop ) { return SubLoop -> contains ( BB ) ; } ) ) continue ; for ( const Instruction & I : * BB ) { if ( const BranchInst * Br = dyn_cast < BranchInst > ( & I ) ) { if ( UP . Threshold < MaxBoost && Br -> isConditional ( ) ) { BasicBlock * Succ0 = Br -> getSuccessor ( <NUM_LIT> ) ; BasicBlock * Succ1 = Br -> getSuccessor ( <NUM_LIT> ) ; if ( ( L -> contains ( Succ0 ) && L -> isLoopExiting ( Succ0 ) ) || ( L -> contains ( Succ1 ) && L -> isLoopExiting ( Succ1 ) ) ) continue ; if ( dependsOnLocalPhi ( L , Br -> getCondition ( ) ) ) { UP . Threshold += UnrollThresholdIf ; LLVM_DEBUG ( dbgs ( ) << <STR_LIT> << UP . Threshold << <STR_LIT> << * L << <STR_LIT> << * Br << '\n' ) ; if ( UP . Threshold >= MaxBoost ) return ; } } continue ; } const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP ) continue ; unsigned AS = GEP -> getAddressSpace ( ) ; unsigned Threshold = <NUM_LIT> ; if ( AS == <ISA_LIT>AS :: PRIVATE_ADDRESS ) Threshold = ThresholdPrivate ; else if ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS || AS == <ISA_LIT>AS :: REGION_ADDRESS ) Threshold = ThresholdLocal ; else continue ; if ( UP . Threshold >= Threshold ) continue ; if ( AS == <ISA_LIT>AS :: PRIVATE_ADDRESS ) { const Value * Ptr = GEP -> getPointerOperand ( ) ; const AllocaInst * Alloca = dyn_cast < AllocaInst > ( GetUnderlyingObject ( Ptr ,


<s> if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: PRIVATE_ADDRESS || Load -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: FLAT_ADDRESS ; if ( isa < AtomicRMWInst > ( V ) || isa < AtomicCmpXchgInst > ( V ) )


<s> bool GCNTTIImpl :: isSourceOfDivergence ( const Value * V ) const { if ( const Argument * A = dyn_cast < Argument > ( V ) ) return ! isArgPassedInSGPR ( A ) ; if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: PRIVATE_ADDRESS || Load -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: FLAT_ADDRESS ; if ( isa < AtomicRMWInst > ( V ) || isa < AtomicCmpXchgInst > ( V ) ) return true ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> ( Intrinsic -> getIntrinsicID ( ) ) ; if ( isa < CallInst > ( V ) || isa < InvokeInst


<s> if ( const PHINode * PHI = dyn_cast < PHINode > ( V ) ) { if ( none_of ( L -> getSubLoops ( ) , [ PHI ] ( const Loop * SubLoop ) { return SubLoop -> contains ( PHI ) ; }


<s> case <STR_LIT> : { if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } return LT . first * NElts * getFullRateInstrCost ( ) ; } case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } return QuarterRateCost * NElts * LT . first ; } case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( ) ; if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) return LT . first * NElts * getFullRateInstrCost ( ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { int Cost = <NUM_LIT> * get64BitInstrCost ( ) + <NUM_LIT> * getQuarterRateInstrCost ( ) ; if ( ST -> getGeneration ( ) == <ISA_LIT>Subtarget :: SOUTHERN_ISLANDS ) Cost += <NUM_LIT> * getFullRateInstrCost ( ) ; return LT . first * Cost * NElts ; } if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) { assert ( ! ST -> hasFP32Denormals ( ) &&


<s> unsigned <ISA_LIT>TTIImpl :: getCFInstrCost ( unsigned Opcode ) { switch ( Opcode ) { case Instruction :: Br : case Instruction :: Ret : return


<s> return <NUM_LIT> ; default : return BaseT :: getCFInstrCost ( Opcode )


<s> if ( AddrSpace == AS . PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; if ( ST -> getGeneration ( ) <= <ISA_LIT>Subtarget :: NORTHERN_ISLANDS && ( AddrSpace == AS . PARAM_D_ADDRESS || AddrSpace == AS

. PARAM_I_ADDRESS || ( AddrSpace >= AS . CONSTANT_BUFFER_0 && AddrSpace <= AS . CONSTANT_BUFFER_15 ) ) ) return <NUM_LIT> ;


<s> unsigned <ISA_LIT>TTIImpl :: getMaxInterleaveFactor ( unsigned VF


<s> if ( Vec ) return <NUM_LIT> ; if ( ST -> getGeneration ( ) >= <ISA_LIT>Subtarget :: SOUTHERN_ISLANDS ) return


<s> unsigned <ISA_LIT>TTIImpl :: getRegisterBitWidth ( bool Vector ) const { return Vector ? <NUM_LIT> : <NUM_LIT>


<s> if ( VT -> getNumElements ( ) == <NUM_LIT> && DL . getTypeSizeInBits ( VT -> getElementType ( ) ) == <NUM_LIT> ) { switch ( Kind ) { case TTI :: SK_Broadcast : case TTI :: SK_Reverse : case TTI :: SK_PermuteSingleSrc : return


<s> if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) { switch ( Intrinsic -> getIntrinsicID ( ) ) { default : return


<s> switch ( CC ) { case CallingConv :: <ISA_LIT>_KERNEL : case CallingConv :: SPIR_KERNEL : return true ; case CallingConv :: <ISA_LIT>_VS : case CallingConv :: <ISA_LIT>_HS : case CallingConv :: <ISA_LIT>_GS : case CallingConv :: <ISA_LIT>_PS : case CallingConv ::


<s> return isLegalToVectorizeMemChain ( ChainSizeInBytes , Alignment ,


<s> bool <ISA_LIT>TTIImpl :: isLegalToVectorizeMemChain ( unsigned ChainSizeInBytes , unsigned Alignment , unsigned AddrSpace ) const { if ( AddrSpace == ST -> get<ISA_LIT>AS (


<s> bool <ISA_LIT>TTIImpl :: isLegalToVectorizeStoreChain ( unsigned ChainSizeInBytes , unsigned Alignment , unsigned AddrSpace ) const { return isLegalToVectorizeMemChain ( ChainSizeInBytes ,


<s> bool <ISA_LIT>TTIImpl :: isLegalToVectorizeStoreChain ( unsigned ChainSizeInBytes , unsigned Alignment , unsigned AddrSpace ) const { return isLegalToVectorizeMemChain ( ChainSizeInBytes , Alignment , AddrSpace


<s> if ( const Argument * A = dyn_cast < Argument > ( V ) ) return ! isArgPassedInSGPR ( A ) ; if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load

-> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS ;


<s> const FeatureBitset & CallerBits = TM . getSubtargetImpl ( * Caller ) -> getFeatureBits ( ) ; const FeatureBitset & CalleeBits = TM . getSubtargetImpl ( *


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return get64BitInstrCost ( ) * LT . first * NElts ; return getFullRateInstrCost ( ) * LT . first * NElts ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } return LT . first * NElts * getFullRateInstrCost ( ) ; case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } return QuarterRateCost * NElts * LT . first ; } case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( ) ; if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) return LT . first * NElts * getFullRateInstrCost ( ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { int Cost = <NUM_LIT> * get64BitInstrCost ( ) + <NUM_LIT> * getQuarterRateInstrCost ( ) ; if ( ST -> getGeneration ( ) == <ISA_LIT>Subtarget :: SOUTHERN_ISLANDS ) Cost += <NUM_LIT> * getFullRateInstrCost ( ) ; return LT . first * Cost * NElts ; } if ( ! Args . empty ( ) && match ( Args [ <NUM_LIT> ] , PatternMatch :: m_FPOne ( ) ) ) { if ( ( SLT == <STR_LIT> && ! ST -> hasFP32Denormals ( ) ) || ( SLT == <STR_LIT> && ST -> has16BitInsts ( ) ) ) { return LT . first * getQuarterRateInstrCost ( ) * NElts ; } } if ( SLT == <STR_LIT> && ST -> has16BitInsts ( ) ) { int Cost = <NUM_LIT> * getFullRateInstrCost ( ) + <NUM_LIT> * getQuarterRateInstrCost ( ) ; return LT . first * Cost * NElts ; } if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) { int Cost = <NUM_LIT> * getFullRateInstrCost ( ) + <NUM_LIT> * getQuarterRateInstrCost ( ) ; if ( ! ST -> hasFP32Denormals (


<s> unsigned <ISA_LIT>TTIImpl :: getMaxInterleaveFactor ( unsigned VF ) { if ( VF == <NUM_LIT> )


<s> if ( VF == <NUM_LIT> ) return <NUM_LIT> ; return <NUM_LIT>


<s> return getHardwareNumberOfRegisters ( Vec )


<s> unsigned <ISA_LIT>TTIImpl :: getRegisterBitWidth (


<s> const unsigned MaxAlloca = ( <NUM_LIT> - <NUM_LIT> ) * <NUM_LIT> ; unsigned ThresholdPrivate = UnrollThresholdPrivate ; unsigned ThresholdLocal = UnrollThresholdLocal ; unsigned MaxBoost = std :: max ( ThresholdPrivate , ThresholdLocal ) ; <ISA_LIT>AS ASST = ST -> get<ISA_LIT>AS ( ) ; for ( const BasicBlock * BB : L -> getBlocks ( ) ) { const DataLayout & DL = BB -> getModule ( ) -> getDataLayout ( ) ; unsigned LocalGEPsSeen = <NUM_LIT> ; if ( llvm :: any_of ( L -> getSubLoops ( ) , [ BB ] ( const Loop * SubLoop ) { return SubLoop -> contains ( BB ) ; } ) ) continue ; for ( const Instruction & I : * BB ) { if ( const BranchInst * Br = dyn_cast < BranchInst > ( & I ) ) { if ( UP . Threshold < MaxBoost && Br -> isConditional ( ) ) { if ( L -> isLoopExiting ( Br -> getSuccessor ( <NUM_LIT> ) ) || L -> isLoopExiting ( Br -> getSuccessor ( <NUM_LIT> ) ) ) continue ; if ( dependsOnLocalPhi ( L , Br -> getCondition ( ) ) ) { UP . Threshold += UnrollThresholdIf ; DEBUG ( dbgs ( ) << <STR_LIT> << UP . Threshold << <STR_LIT> << * L << <STR_LIT> << * Br << '\n' ) ; if ( UP . Threshold >= MaxBoost ) return ; } } continue ; } const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP ) continue ; unsigned AS = GEP -> getAddressSpace ( ) ; unsigned Threshold = <NUM_LIT> ; if ( AS == ASST . PRIVATE_ADDRESS ) Threshold = ThresholdPrivate ; else if ( AS == ASST . LOCAL_ADDRESS ) Threshold


<s> } const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP ) continue ; unsigned AS = GEP -> getAddressSpace ( ) ; unsigned Threshold = <NUM_LIT> ; if ( AS == ASST . PRIVATE_ADDRESS ) Threshold = ThresholdPrivate ; else if ( AS == ASST . LOCAL_ADDRESS ) Threshold = ThresholdLocal ; else continue ; if ( UP . Threshold >= Threshold ) continue ; if ( AS == ASST . PRIVATE_ADDRESS ) { const Value * Ptr = GEP -> getPointerOperand ( ) ; const AllocaInst * Alloca = dyn_cast < AllocaInst > ( GetUnderlyingObject ( Ptr , DL ) ) ; if ( ! Alloca || ! Alloca -> isStaticAlloca ( ) ) continue ; Type * Ty = Alloca -> getAllocatedType ( ) ; unsigned AllocaSize = Ty -> isSized ( ) ? DL . getTypeAllocSize ( Ty ) : <NUM_LIT> ; if ( AllocaSize > MaxAlloca ) continue ; } else if ( AS == ASST . LOCAL_ADDRESS ) { LocalGEPsSeen ++ ; if ( LocalGEPsSeen > <NUM_LIT> || L -> getLoopDepth ( ) > <NUM_LIT> || ( ! isa < GlobalVariable > ( GEP -> getPointerOperand ( ) ) && ! isa < Argument > ( GEP -> getPointerOperand ( ) ) ) ) continue ; } bool HasLoopDef = false ; for ( const Value * Op : GEP -> operands ( ) ) { const Instruction * Inst = dyn_cast < Instruction > ( Op ) ; if ( ! Inst || L -> isLoopInvariant ( Op ) ) continue ; if ( llvm :: any_of ( L -> getSubLoops ( ) , [ Inst ] ( const Loop * SubLoop ) { return SubLoop -> contains ( Inst ) ; } ) ) continue ; HasLoopDef = true ; break ; } if ( ! HasLoopDef ) continue ; UP . Threshold =


<s> GCNTTIImpl :: GCNTTIImpl ( const <ISA_LIT>TargetMachine * TM , const Function & F ) : BaseT ( TM , F . getParent ( ) -> getDataLayout ( ) ) , ST ( static_cast < const GCNSubtarget * > ( TM -> getSubtargetImpl ( F ) ) ) , TLI ( ST -> getTargetLowering ( ) ) , CommonTTI ( TM , F ) , IsGraphics ( <STR_LIT> ( F . getCallingConv ( ) ) ) , MaxVGPRs ( ST -> getMaxNumVGPRs ( std ::

max ( ST -> getWavesPerEU ( F ) . first , ST -> getWavesPerEUForWorkGroup ( ST -> getFlatWorkGroupSizes ( F ) . second ) ) ) ) {


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return LT . first * NElts * getFullRateInstrCost ( ) ; case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( CostKind ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return QuarterRateCost * NElts * LT . first ; } case <STR_LIT> : if ( CxtI && CxtI -> hasOneUse ( ) ) if ( const auto * FAdd = dyn_cast < BinaryOperator > ( * CxtI -> user_begin ( ) ) ) { const int OPC = TLI -> InstructionOpcodeToISD ( FAdd -> getOpcode ( ) ) ; if ( OPC == <STR_LIT> || OPC == <STR_LIT> ) { if ( ST -> hasMadMacF32Insts ( ) && SLT == <STR_LIT> && ! HasFP32Denormals ) return TargetTransformInfo :: TCC_Free ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> && ! HasFP64FP16Denormals ) return TargetTransformInfo :: TCC_Free ; const TargetOptions & Options = TLI -> getTargetMachine ( ) . Options ; if ( Options . AllowFPOpFusion == FPOpFusion :: Fast || Options . UnsafeFPMath || ( FAdd -> hasAllowContract ( ) && CxtI -> hasAllowContract ( ) ) ) return TargetTransformInfo :: TCC_Free ; } } LLVM_FALLTHROUGH ; case <STR_LIT> : case <STR_LIT> : if ( ST -> hasPackedFP32Ops ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( CostKind ) ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) return LT . first * NElts * getFullRateInstrCost ( ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { int Cost = <NUM_LIT> * get64BitInstrCost ( CostKind ) + getQuarterRateInstrCost ( CostKind ) + <NUM_LIT> * getHalfRateInstrCost ( CostKind ) ; if ( ! ST -> hasUsableDivScaleConditionOutput ( ) ) Cost += <NUM_LIT> * getFullRateInstrCost ( ) ; return LT . first * Cost * NElts ; } if ( ! Args . empty ( ) && match ( Args [ <NUM_LIT> ] , PatternMatch :: m_FPOne ( ) ) ) { if ( ( SLT == <STR_LIT> && ! HasFP32Denormals ) || ( SLT == <STR_LIT> && ST -> has16BitInsts ( ) ) ) { return LT . first * getQuarterRateInstrCost (


<s> unsigned GCNTTIImpl :: getHardwareNumberOfRegisters ( bool Vec )


<s> unsigned GCNTTIImpl :: getHardwareNumberOfRegisters ( bool Vec ) const { return MaxVGPRs


<s> if ( ! OrigTy . isSimple ( ) ) { if ( CostKind != TTI :: TCK_CodeSize ) return BaseT :: getIntrinsicInstrCost ( ICA , CostKind ) ; if ( ICA . isTypeBasedOnly ( ) ) return getTypeBasedIntrinsicInstrCost ( ICA , CostKind ) ; unsigned RetVF = ( RetTy -> isVectorTy ( ) ? cast < FixedVectorType > ( RetTy ) -> getNumElements ( ) : <NUM_LIT> ) ; const IntrinsicInst * I = ICA . getInst ( ) ; const SmallVectorImpl < const Value * > & Args = ICA . getArgs ( ) ; FastMathFlags FMF = ICA . getFlags ( ) ; InstructionCost ScalarizationCost = InstructionCost :: getInvalid ( ) ; if ( RetVF > <NUM_LIT> ) { ScalarizationCost = <NUM_LIT> ; if ( ! RetTy -> isVoidTy ( ) ) ScalarizationCost += getScalarizationOverhead ( cast < VectorType > ( RetTy ) , true , false ) ; ScalarizationCost += getOperandsScalarizationOverhead ( Args , ICA . getArgTypes ( ) ) ; } IntrinsicCostAttributes Attrs ( ICA . getID ( ) , RetTy , ICA . getArgTypes ( ) , FMF , I , ScalarizationCost ) ; return getIntrinsicInstrCost ( Attrs , CostKind ) ; } std :: pair < InstructionCost , MVT > LT = TLI -> getTypeLegalizationCost ( DL , RetTy ) ; unsigned NElts = LT . second . isVector ( ) ? LT . second . getVectorNumElements ( ) : <NUM_LIT> ; <STR_LIT> SLT = LT . second . getScalarType ( ) . SimpleTy ; if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( CostKind ) ; if ( ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) || ( ST -> hasPackedFP32Ops ( ) && SLT == <STR_LIT> ) ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; unsigned InstRate = getQuarterRateInstrCost


<s> const TargetRegisterClass * RC = TRI -> getRegClass ( RCID ) ; unsigned NumVGPRs = ( TRI -> getRegSizeInBits ( * RC ) + <NUM_LIT> ) / <NUM_LIT> ; return getHardwareNumberOfRegisters ( false


<s> Kind = improveShuffleKindFromMask ( Kind , Mask ) ; if ( ST -> hasVOP3PInsts ( ) ) { if ( cast < FixedVectorType > ( VT ) -> getNumElements ( ) == <NUM_LIT> && DL . getTypeSizeInBits ( VT -> getElementType ( ) ) == <NUM_LIT> ) { switch ( Kind ) { case TTI :: SK_Broadcast : case TTI :: SK_Reverse : case TTI :: SK_PermuteSingleSrc : return <NUM_LIT> ; default : break ; } } } return BaseT :: getShuffleCost ( Kind , VT


<s> const TargetMachine & TM = getTLI ( ) -> getTargetMachine ( ) ; const FeatureBitset & CallerBits = TM . getSubtargetImpl ( * Caller ) -> getFeatureBits ( ) ; const FeatureBitset & CalleeBits = TM . getSubtargetImpl ( * Callee ) -> getFeatureBits ( ) ; FeatureBitset RealCallerBits = CallerBits & ~ InlineFeatureIgnoreList ; FeatureBitset RealCalleeBits = CalleeBits & ~ InlineFeatureIgnoreList ; if ( ( RealCallerBits & RealCalleeBits ) != RealCalleeBits ) return false ; <STR_LIT> CallerMode ( * Caller ) ; <STR_LIT> CalleeMode ( * Callee ) ; return CallerMode . isInlineCompatible ( CalleeMode


<s> unsigned LocalGEPsSeen = <NUM_LIT> ; if ( llvm :: any_of ( L -> getSubLoops ( ) , [ BB ] ( const Loop * SubLoop ) { return SubLoop -> contains ( BB ) ; } ) ) continue ; for ( const Instruction & I : * BB ) { if ( const BranchInst * Br = dyn_cast < BranchInst > ( & I ) ) { if ( UP . Threshold < MaxBoost && Br -> isConditional ( ) ) { BasicBlock * Succ0 = Br -> getSuccessor ( <NUM_LIT> ) ; BasicBlock * Succ1 = Br -> getSuccessor ( <NUM_LIT> ) ; if ( ( L -> contains ( Succ0 ) && L -> isLoopExiting ( Succ0 ) ) || ( L -> contains ( Succ1 ) && L -> isLoopExiting ( Succ1 ) ) ) continue ; if ( dependsOnLocalPhi ( L , Br -> getCondition ( ) ) ) { UP . Threshold += UnrollThresholdIf ; LLVM_DEBUG ( dbgs ( ) << <STR_LIT> << UP . Threshold << <STR_LIT> << * L << <STR_LIT> << * Br << '\n' ) ; if ( UP . Threshold >= MaxBoost ) return ; } } continue ; } const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP ) continue ; unsigned AS = GEP -> getAddressSpace ( ) ; unsigned Threshold = <NUM_LIT> ; if ( AS == <ISA_LIT>AS :: PRIVATE_ADDRESS ) Threshold = ThresholdPrivate ; else if ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS || AS == <ISA_LIT>AS :: REGION_ADDRESS ) Threshold = ThresholdLocal ; else continue ; if ( UP . Threshold >= Threshold ) continue ; if ( AS == <ISA_LIT>AS :: PRIVATE_ADDRESS ) { const Value * Ptr = GEP -> getPointerOperand ( ) ; const AllocaInst * Alloca = dyn_cast < AllocaInst > ( GetUnderlyingObject ( Ptr , DL ) ) ; if ( ! Alloca || ! Alloca -> isStaticAlloca ( ) ) continue ; Type * Ty = Alloca -> getAllocatedType ( ) ; unsigned AllocaSize = Ty -> isSized ( ) ? DL . getTypeAllocSize ( Ty ) : <NUM_LIT> ; if ( AllocaSize > MaxAlloca ) continue ; } else if ( AS == <ISA_LIT>AS :: LOCAL_ADDRESS || AS == <ISA_LIT>AS :: REGION_ADDRESS ) { LocalGEPsSeen ++


<s> } if ( const InsertElementInst * IE = dyn_cast < InsertElementInst > ( U ) ) { ConstantInt * CI = dyn_cast < ConstantInt > ( IE -> getOperand ( <NUM_LIT> ) ) ; unsigned Idx = - <NUM_LIT> ; if ( CI ) Idx = CI -> getZExtValue ( ) ; return getVectorInstrCost ( IE -> getOpcode ( ) , IE -> getType ( ) , Idx ) ; } if ( const IntrinsicInst * II = dyn_cast < IntrinsicInst > ( U ) ) { SmallVector < Value * , <NUM_LIT> > Args ( II -> arg_operands ( ) ) ; FastMathFlags FMF ; if ( auto * FPMO = dyn_cast < FPMathOperator > ( II ) ) FMF = FPMO -> getFastMathFlags ( ) ; return getIntrinsicInstrCost ( II -> getIntrinsicID ( ) , II ->


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( IsPairwise || ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT> ) return BaseT :: getArithmeticReductionCost ( Opcode , Ty , IsPairwise ) ; std :: pair < int , MVT > LT = TLI -> getTypeLegalizationCost ( DL , Ty ) ; return LT . first *


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( IsPairwise || ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT> ) return BaseT :: getArithmeticReductionCost ( Opcode ,


<s> static inline int getHalfRateInstrCost ( TTI :: TargetCostKind CostKind = TTI


<s> if ( ST -> getGeneration ( ) <= <ISA_LIT>Subtarget :: NORTHERN_ISLANDS ) return <NUM_LIT> ; return <NUM_LIT> ; } if ( AddrSpace == AS . FLAT_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == AS . LOCAL_ADDRESS || AddrSpace == AS . REGION_ADDRESS ) return ST -> useDS128 ( ) ? <NUM_LIT> : <NUM_LIT> ; if ( AddrSpace == AS . PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; if ( ST -> getGeneration ( ) <= <ISA_LIT>Subtarget :: NORTHERN_ISLANDS && ( AddrSpace == AS . PARAM_D_ADDRESS || AddrSpace == AS . PARAM_I_ADDRESS || ( AddrSpace >= AS . CONSTANT_BUFFER_0 && AddrSpace <= AS . CONSTANT_BUFFER_15 ) ) ) return <NUM_LIT> ; llvm_unreachable ( <STR_LIT>


<s> if ( VecRegBitWidth > <NUM_LIT> && VecTy -> getScalarSizeInBits ( ) < <NUM_LIT> ) return <NUM_LIT> / LoadSize ; return VF


<s> if ( IsPairwise || ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT>

) return BaseT :: getMinMaxReductionCost ( Ty , CondTy , IsPairwise , IsUnsigned ) ;


<s> static inline int getQuarterRateInstrCost ( TTI :: TargetCostKind CostKind = TTI :: TCK_RecipThroughput ) { return CostKind == TTI :: TCK_CodeSize ? <NUM_LIT>

: <NUM_LIT> * TargetTransformInfo :: TCC_Basic ;


<s> static inline int getQuarterRateInstrCost ( TTI :: TargetCostKind CostKind = TTI :: TCK_RecipThroughput ) { return CostKind == TTI :: TCK_CodeSize ? <NUM_LIT> : <NUM_LIT> * TargetTransformInfo


<s> unsigned <ISA_LIT>TTIImpl :: getStoreVectorFactor ( unsigned VF , unsigned StoreSize , unsigned ChainSizeInBytes , VectorType * VecTy ) const { unsigned VecRegBitWidth = VF * StoreSize ; if ( VecRegBitWidth > <NUM_LIT> ) return <NUM_LIT> /


<s> unsigned OrderingVal = Ordering -> getZExtValue ( ) ; if ( OrderingVal > static_cast < unsigned > ( AtomicOrdering :: SequentiallyConsistent ) ) return false ; Info . PtrVal = Inst -> getArgOperand ( <NUM_LIT> ) ; Info . Ordering = static_cast < AtomicOrdering > ( OrderingVal ) ; Info . ReadMem


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : { auto * Ordering = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; auto * Volatile = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; if ( ! Ordering || ! Volatile ) return false ; unsigned OrderingVal = Ordering -> getZExtValue (


<s> <ISA_LIT>AS ASST = ST -> get<ISA_LIT>AS ( ) ; for ( const BasicBlock * BB : L -> getBlocks ( ) ) { const DataLayout & DL = BB -> getModule ( ) -> getDataLayout ( ) ; unsigned LocalGEPsSeen = <NUM_LIT> ; if ( llvm :: any_of ( L -> getSubLoops ( ) , [ BB ] ( const Loop * SubLoop ) { return SubLoop -> contains ( BB ) ; } ) ) continue ; for ( const Instruction & I : * BB ) { if ( const BranchInst * Br = dyn_cast < BranchInst > ( & I ) ) { if ( UP . Threshold < MaxBoost && Br -> isConditional ( ) ) { if ( L -> isLoopExiting ( Br -> getSuccessor ( <NUM_LIT> ) ) || L -> isLoopExiting ( Br -> getSuccessor ( <NUM_LIT> ) ) ) continue ; if ( dependsOnLocalPhi ( L , Br -> getCondition ( ) ) ) { UP . Threshold += UnrollThresholdIf ; LLVM_DEBUG ( dbgs ( ) << <STR_LIT> << UP . Threshold << <STR_LIT> << * L << <STR_LIT> << * Br << '\n' ) ; if ( UP . Threshold >= MaxBoost ) return ; } } continue ; } const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP ) continue ; unsigned AS = GEP -> getAddressSpace ( ) ; unsigned Threshold = <NUM_LIT> ; if ( AS == ASST . PRIVATE_ADDRESS ) Threshold = ThresholdPrivate ; else if ( AS == ASST . LOCAL_ADDRESS ) Threshold = ThresholdLocal ; else continue ; if ( UP . Threshold >= Threshold ) continue ; if ( AS == ASST . PRIVATE_ADDRESS ) { const Value * Ptr = GEP -> getPointerOperand ( ) ; const AllocaInst * Alloca = dyn_cast < AllocaInst > ( GetUnderlyingObject ( Ptr , DL ) ) ; if ( ! Alloca || ! Alloca -> isStaticAlloca


<s> if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS ; if ( isa < AtomicRMWInst > ( V ) || isa < AtomicCmpXchgInst > ( V ) ) return true ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> ( Intrinsic -> getIntrinsicID ( ) ) ; if ( isa < CallInst > ( V ) || isa < InvokeInst > ( V )


<s> if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> ( Intrinsic -> getIntrinsicID ( ) ) ; if ( isa < CallInst > ( V ) || isa < InvokeInst


<s> bool GCNTTIImpl :: areInlineCompatible ( const Function * Caller , const Function * Callee ) const { const TargetMachine & TM = getTLI ( ) -> getTargetMachine ( ) ; const FeatureBitset & CallerBits = TM . getSubtargetImpl ( * Caller ) -> getFeatureBits ( ) ; const FeatureBitset & CalleeBits = TM . getSubtargetImpl ( * Callee ) -> getFeatureBits ( ) ; FeatureBitset RealCallerBits = CallerBits &


<s> const FeatureBitset & CallerBits = TM . getSubtargetImpl ( * Caller ) -> getFeatureBits ( ) ; const FeatureBitset & CalleeBits = TM . getSubtargetImpl ( * Callee ) -> getFeatureBits ( ) ; FeatureBitset RealCallerBits = CallerBits & ~ InlineFeatureIgnoreList ; FeatureBitset RealCalleeBits = CalleeBits & ~ InlineFeatureIgnoreList


<s> if ( AddrSpace == <ISA_LIT>AS :: FLAT_ADDRESS || AddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || AddrSpace == <ISA_LIT>AS :: REGION_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == <ISA_LIT>AS :: PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; llvm_unreachable (


<s> unsigned GCNTTIImpl :: getLoadStoreVecRegBitWidth ( unsigned AddrSpace ) const { if ( AddrSpace == <ISA_LIT>AS :: GLOBAL_ADDRESS || AddrSpace == <ISA_LIT>AS :: CONSTANT_ADDRESS || AddrSpace == <ISA_LIT>AS :: CONSTANT_ADDRESS_32BIT ) { return <NUM_LIT> ; } if ( AddrSpace == <ISA_LIT>AS :: FLAT_ADDRESS || AddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || AddrSpace == <ISA_LIT>AS :: REGION_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == <ISA_LIT>AS :: PRIVATE_ADDRESS ) return <NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ; llvm_unreachable ( <STR_LIT>


<s> unsigned <ISA_LIT>TTIImpl :: getRegisterBitWidth ( bool Vector ) { return Vector ? <NUM_LIT> : <NUM_LIT>


<s> UP . Partial = true ; for ( const BasicBlock * BB : L -> getBlocks ( ) ) { const DataLayout & DL = BB -> getModule ( ) -> getDataLayout ( ) ; for ( const Instruction & I : * BB ) { const GetElementPtrInst * GEP = dyn_cast < GetElementPtrInst > ( & I ) ; if ( ! GEP || GEP -> getAddressSpace ( )

!= <ISA_LIT>AS :: PRIVATE_ADDRESS ) continue ;


<s> if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == <ISA_LIT>AS :: PRIVATE_ADDRESS ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) { const TargetMachine & TM = getTLI ( ) -> getTargetMachine ( ) ; return isIntrinsicSourceOfDivergence ( TM . getIntrinsicInfo ( ) , Intrinsic ) ; } if ( isa < CallInst > ( V ) || isa < InvokeInst > (


<s> <ISA_LIT>AS AS = ST -> get<ISA_LIT>AS ( ) ; if ( AddrSpace == AS . GLOBAL_ADDRESS || AddrSpace == AS . CONSTANT_ADDRESS || AddrSpace == AS . CONSTANT_ADDRESS_32BIT ) { if ( ST -> getGeneration ( ) <= <ISA_LIT>Subtarget :: NORTHERN_ISLANDS ) return <NUM_LIT> ; return <NUM_LIT> ; } if ( AddrSpace == AS . FLAT_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == AS . LOCAL_ADDRESS || AddrSpace == AS . REGION_ADDRESS ) return <NUM_LIT> ; if ( AddrSpace == AS . PRIVATE_ADDRESS ) return

<NUM_LIT> * ST -> getMaxPrivateElementSize ( ) ;


<s> const GCNSubtarget * CallerST = static_cast < const GCNSubtarget * > ( TM . getSubtargetImpl ( * Caller ) ) ; const GCNSubtarget * CalleeST = static_cast < const GCNSubtarget * > ( TM . getSubtargetImpl ( * Callee ) ) ; const FeatureBitset & CallerBits = CallerST -> getFeatureBits


<s> case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return get64BitInstrCost ( ) * LT . first * NElts ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return getFullRateInstrCost ( ) * LT . first * NElts ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) { return <NUM_LIT> * getFullRateInstrCost ( ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return LT . first * NElts * getFullRateInstrCost ( ) ; case <STR_LIT> : { const int QuarterRateCost = getQuarterRateInstrCost ( ) ; if ( SLT == <STR_LIT> ) { const int FullRateCost = getFullRateInstrCost ( ) ; return ( <NUM_LIT> * QuarterRateCost + ( <NUM_LIT> * <NUM_LIT> ) * FullRateCost ) * LT . first * NElts ; } if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; return QuarterRateCost * NElts * LT . first ; } case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( ) ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts = ( NElts + <NUM_LIT> ) / <NUM_LIT> ; if ( SLT == <STR_LIT> || SLT == <STR_LIT> ) return LT . first * NElts *


<s> unsigned <ISA_LIT>TTIImpl :: getCFInstrCost ( unsigned Opcode , TTI :: TargetCostKind CostKind ) { if ( CostKind == TTI :: TCK_CodeSize || CostKind == TTI :: TCK_SizeAndLatency ) return Opcode == Instruction :: PHI ? <NUM_LIT> : <NUM_LIT> ; switch ( Opcode ) { case Instruction :: Br


<s> unsigned <ISA_LIT>TTIImpl :: getHardwareNumberOfRegisters ( bool Vec ) const { return <NUM_LIT>


<s> return BaseT :: getIntrinsicInstrCost ( ICA , CostKind ) ; } std :: pair < int , MVT > LT = TLI -> getTypeLegalizationCost ( DL , RetTy ) ; unsigned NElts = LT . second . isVector ( ) ? LT . second . getVectorNumElements ( ) : <NUM_LIT> ; <STR_LIT> SLT = LT . second . getScalarType ( ) . SimpleTy ; if ( SLT == <STR_LIT> ) return LT . first * NElts * get64BitInstrCost ( ) ; if ( ST -> has16BitInsts ( ) && SLT == <STR_LIT> ) NElts =


<s> if ( ( AddrSpace == <ISA_LIT>AS :: PARAM_D_ADDRESS || AddrSpace == <ISA_LIT>AS :: PARAM_I_ADDRESS || ( AddrSpace >= <ISA_LIT>AS :: CONSTANT_BUFFER_0 && AddrSpace <= <ISA_LIT>AS :: CONSTANT_BUFFER_15


<s> unsigned <ISA_LIT>TTIImpl :: getMaxInterleaveFactor


<s> Type * GCNTTIImpl :: getMemcpyLoopLoweringType ( LLVMContext & Context , Value * Length , unsigned SrcAddrSpace , unsigned DestAddrSpace , unsigned SrcAlign , unsigned DestAlign ) const { unsigned MinAlign = std :: min ( SrcAlign , DestAlign ) ; if ( MinAlign == <NUM_LIT> ) return Type :: getInt16Ty ( Context ) ; if ( SrcAddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || SrcAddrSpace == <ISA_LIT>AS :: REGION_ADDRESS || DestAddrSpace == <ISA_LIT>AS :: LOCAL_ADDRESS || DestAddrSpace == <ISA_LIT>AS :: REGION_ADDRESS ) { return FixedVectorType :: get ( Type :: getInt32Ty ( Context ) , <NUM_LIT> ) ; } return FixedVectorType :: get ( Type :: getInt32Ty ( Context ) , <NUM_LIT>


<s> EVT OrigTy = TLI -> getValueType ( DL , Ty ) ; if ( IsPairwise || ! ST -> hasVOP3PInsts ( ) || OrigTy . getScalarSizeInBits ( ) != <NUM_LIT> ) return BaseT :: getMinMaxReductionCost ( Ty , CondTy , IsPairwise , IsUnsigned , CostKind ) ; std :: pair < int , MVT > LT = TLI -> getTypeLegalizationCost ( DL , Ty ) ; return LT . first * getHalfRateInstrCost


<s> unsigned <ISA_LIT>TTIImpl :: getMinVectorRegisterBitWidth ( ) const { return


<s> unsigned <ISA_LIT>TTIImpl :: getNumberOfRegisters ( bool Vec )


<s> unsigned <ISA_LIT>TTIImpl :: getRegisterBitWidth ( bool Vector ) const { return <NUM_LIT>


<s> if ( cast < FixedVectorType > ( VT ) -> getNumElements ( ) == <NUM_LIT> && DL . getTypeSizeInBits ( VT -> getElementType ( ) ) == <NUM_LIT> ) { switch ( Kind ) { case TTI :: SK_Broadcast


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : { auto * Ordering = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; auto * Volatile = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; if ( ! Ordering || ! Volatile ) return false ; unsigned OrderingVal = Ordering -> getZExtValue ( ) ; if ( OrderingVal > static_cast < unsigned > ( AtomicOrdering :: SequentiallyConsistent ) ) return false ; Info . PtrVal = Inst ->


<s> case Instruction :: ExtractElement : case Instruction :: InsertElement : { unsigned EltSize = DL . getTypeSizeInBits ( cast < VectorType > ( ValTy ) -> getElementType ( ) ) ; if ( EltSize <


<s> bool GCNTTIImpl :: isInlineAsmSourceOfDivergence ( const CallInst * CI , ArrayRef < unsigned > Indices ) const { if ( Indices . size ( ) > <NUM_LIT> ) return true ; const DataLayout & DL = CI -> getModule ( ) -> getDataLayout ( ) ; const <ISA_LIT>RegisterInfo * TRI = ST -> getRegisterInfo ( ) ; TargetLowering :: AsmOperandInfoVector TargetConstraints = TLI -> ParseConstraints ( DL , ST -> getRegisterInfo ( ) , * CI ) ; const int TargetOutputIdx = Indices . empty ( ) ? - <NUM_LIT> : Indices [ <NUM_LIT> ] ; int OutputIdx = <NUM_LIT> ; for ( auto & TC : TargetConstraints ) { if ( TC . Type != InlineAsm :: isOutput ) continue ; if ( TargetOutputIdx != - <NUM_LIT> && TargetOutputIdx != OutputIdx ++ ) continue ; TLI -> ComputeConstraintToUse ( TC , SDValue ( ) ) ; Register AssignedReg ; const TargetRegisterClass * RC ; std :: tie ( AssignedReg , RC ) = TLI -> getRegForInlineAsmConstraint ( TRI ,

TC . ConstraintCode , TC . ConstraintVT ) ;


<s> return isLegalToVectorizeMemChain ( ChainSizeInBytes , Alignment , AddrSpace


<s> bool <ISA_LIT>TTIImpl :: isLegalToVectorizeStoreChain ( unsigned ChainSizeInBytes , unsigned Alignment , unsigned AddrSpace ) const { return isLegalToVectorizeMemChain ( ChainSizeInBytes , Alignment , AddrSpace


<s> LLVMContext & Ctx = NewV -> getType ( ) -> getContext ( ) ; ConstantInt * NewVal = ( TrueAS == NewAS ) ? ConstantInt :: getTrue ( Ctx ) : ConstantInt :: getFalse ( Ctx ) ; return NewVal ; } case <STR_LIT> : { unsigned OldAS = OldV -> getType ( ) -> getPointerAddressSpace ( ) ; unsigned NewAS = NewV -> getType ( ) -> getPointerAddressSpace ( ) ; Value * MaskOp = II -> getArgOperand ( <NUM_LIT> ) ; Type * MaskTy = MaskOp -> getType ( ) ; bool DoTruncate = false ; if ( ! getTLI ( ) -> isNoopAddrSpaceCast ( OldAS , NewAS ) ) { if ( DL . getPointerSizeInBits ( OldAS ) != <NUM_LIT> || DL . getPointerSizeInBits ( NewAS ) != <NUM_LIT> ) return nullptr ; KnownBits Known = computeKnownBits ( MaskOp , DL , <NUM_LIT> , nullptr , II ) ; if ( Known . countMinLeadingOnes ( ) < <NUM_LIT> ) return nullptr ; DoTruncate = true ; } IRBuilder < > B ( II


<s> case <STR_LIT> : { auto * Ordering = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; auto * Volatile = dyn_cast < ConstantInt > ( Inst -> getArgOperand ( <NUM_LIT> ) ) ; if ( ! Ordering || ! Volatile ) return false ; unsigned OrderingVal = Ordering -> getZExtValue ( ) ; if ( OrderingVal > static_cast < unsigned > ( AtomicOrdering :: SequentiallyConsistent ) ) return false ; Info . PtrVal = Inst -> getArgOperand ( <NUM_LIT> ) ; Info . Ordering = static_cast < AtomicOrdering > ( OrderingVal ) ; Info . ReadMem =


<s> if ( AddrSpace == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS ) return false ; return true


<s> if ( AddrSpace == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS )


<s> if ( const Argument * A = dyn_cast < Argument > ( V ) ) return ! isArgPassedInSGPR ( A ) ; if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS || Load -> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . FLAT_ADDRESS ; if ( isa < AtomicRMWInst > ( V ) || isa < AtomicCmpXchgInst > ( V ) ) return true ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> (


<s> if ( const Argument * A = dyn_cast < Argument > ( V ) ) return ! isArgPassedInSGPR ( A ) ; if ( const LoadInst * Load = dyn_cast < LoadInst > ( V ) ) return Load -> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . PRIVATE_ADDRESS || Load -> getPointerAddressSpace ( ) == ST -> get<ISA_LIT>AS ( ) . FLAT_ADDRESS ; if ( isa < AtomicRMWInst > ( V ) || isa < AtomicCmpXchgInst > ( V ) ) return true ; if ( const IntrinsicInst * Intrinsic = dyn_cast < IntrinsicInst > ( V ) ) return <STR_LIT> ( Intrinsic -> getIntrinsicID ( ) ) ; if ( isa < CallInst > ( V ) || isa < InvokeInst > ( V ) )


<s> if ( ST -> getGeneration ( ) <= <ISA_LIT>Subtarget :: NORTHERN_ISLANDS && ( AddrSpace == <ISA_LIT>AS :: PARAM_D_ADDRESS || AddrSpace == <ISA_LIT>AS :: PARAM_I_ADDRESS || ( AddrSpace >= <ISA_LIT>AS :: CONSTANT_BUFFER_0 && AddrSpace <= <ISA_LIT>AS

:: CONSTANT_BUFFER_15 ) ) ) return <NUM_LIT> ;


<s> switch ( Opcode ) { case Instruction :: ExtractElement : case Instruction :: InsertElement : return Index == ~ <NUM_LIT> ? <NUM_LIT>


<s> if ( F -> getAttributes ( ) . hasAttribute ( A -> getArgNo ( ) + <NUM_LIT> , Attribute :: InReg ) || F -> getAttributes ( ) . hasAttribute ( A -> getArgNo ( ) + <NUM_LIT> , Attribute :: ByVal ) ) return true ; return false


<s> static bool isArgPassedInSGPR ( const Argument * A ) { const Function * F = A -> getParent ( ) ; if ( ! <STR_LIT> ( F -> getCallingConv ( ) ) ) return true ; if ( F -> getAttributes ( ) . hasAttribute ( A -> getArgNo ( ) + <NUM_LIT> , Attribute :: InReg ) || F -> getAttributes ( ) .

hasAttribute ( A -> getArgNo ( ) + <NUM_LIT> , Attribute :: ByVal ) ) return true ;


<s> explicit GCNTTIImpl ( const <ISA_LIT>TargetMachine * TM , const Function & F ) : BaseT ( TM , F . getParent ( ) -> getDataLayout ( ) ) , ST ( static_cast < const GCNSubtarget * > ( TM -> getSubtargetImpl ( F ) ) ) , TLI ( ST -> getTargetLowering ( ) ) , CommonTTI ( TM

, F ) , IsGraphics ( <STR_LIT> ( F . getCallingConv ( ) ) ) , MaxVGPRs ( ST -> getMaxNumVGPRs ( std :: max ( ST -> getWavesPerEU ( F ) . first , ST -> getWavesPerEUForWorkGroup ( ST -> getFlatWorkGroupSizes ( F ) . second ) ) ) ) {