LLVM 22.0.0git
Namespaces | Classes | Typedefs | Enumerations | Functions
llvm::SPIRV Namespace Reference

Namespaces

namespace  AccessQualifier
 
namespace  AddressingModel
 
namespace  BuiltIn
 
namespace  Capability
 
namespace  CooperativeMatrixLayout
 
namespace  CooperativeMatrixOperands
 
namespace  Decoration
 
namespace  Dim
 
namespace  Environment
 
namespace  ExecutionMode
 
namespace  ExecutionModel
 
namespace  Extension
 
namespace  FPFastMathMode
 
namespace  FPRoundingMode
 
namespace  FunctionControl
 
namespace  FunctionParameterAttribute
 
namespace  GLSLExtInst
 
namespace  GroupOperation
 
namespace  ImageChannelDataType
 
namespace  ImageChannelOrder
 
namespace  ImageFormat
 
namespace  ImageOperand
 
namespace  InstructionSet
 
namespace  KernelEnqueueFlags
 
namespace  KernelProfilingInfo
 
namespace  LinkageType
 
namespace  LoopControl
 
namespace  MatrixMultiplyAccumulateOperands
 
namespace  MemoryModel
 
namespace  MemoryOperand
 
namespace  MemorySemantics
 
namespace  NonSemanticExtInst
 
namespace  Opcode
 
namespace  OpenCLExtInst
 
namespace  OperandCategory
 
namespace  SamplerAddressingMode
 
namespace  SamplerFilterMode
 
namespace  Scope
 
namespace  SelectionControl
 
namespace  SourceLanguage
 
namespace  SpecConstantOpOperands
 
namespace  StorageClass
 

Classes

struct  AtomicFloatingBuiltin
 
struct  BuiltinType
 
struct  CapabilityEntry
 
class  ConvergenceRegion
 
class  ConvergenceRegionInfo
 
struct  ConvertBuiltin
 
struct  DemangledBuiltin
 
struct  EnvironmentEntry
 
struct  ExtendedBuiltin
 
struct  ExtensionEntry
 
struct  GetBuiltin
 
struct  GroupBuiltin
 
struct  GroupUniformBuiltin
 
union  ImageAttrs
 
struct  ImageQueryBuiltin
 
struct  IncomingCall
 
struct  IntegerDotProductBuiltin
 
struct  IntelSubgroupsBuiltin
 
struct  ModuleAnalysisInfo
 
struct  NativeBuiltin
 
struct  OpenCLType
 
struct  RequirementHandler
 
struct  Requirements
 
struct  SymbolicOperand
 
struct  VectorLoadStoreBuiltin
 

Typedefs

using MIHandle = std::tuple< const MachineInstr *, Register, size_t >
 
using IRHandle = std::tuple< const void *, unsigned, unsigned >
 
using IRHandleMF = std::pair< IRHandle, const MachineFunction * >
 
using InstrList = SmallVector< const MachineInstr * >
 
using LocalToGlobalRegTable = std::map< Register, MCRegister >
 
using RegisterAliasMapTy = std::map< const MachineFunction *, LocalToGlobalRegTable >
 

Enumerations

enum  InstFlags { INST_PRINTER_WIDTH16 = 1 }
 
enum  AsmComments { ASM_PRINTER_WIDTH16 = MachineInstr::TAsmComments }
 
enum  SpecialTypeKind {
  STK_Empty = 0 , STK_Image , STK_SampledImage , STK_Sampler ,
  STK_Pipe , STK_DeviceEvent , STK_ElementPointer , STK_Type ,
  STK_Value , STK_MachineInstr , STK_VkBuffer , STK_ExplictLayoutType ,
  STK_Last = -1
}
 
enum  ModuleSectionType {
  MB_EntryPoints , MB_DebugNames , MB_DebugStrings , MB_DebugModuleProcessed ,
  MB_AliasingInsts , MB_Annotations , MB_TypeConstVars , MB_NonSemanticGlobalDI ,
  MB_ExtFuncDecls , NUM_MODULE_SECTIONS
}
 

Functions

std::optional< IntrinsicInst * > getConvergenceToken (BasicBlock *BB)
 
std::optional< const IntrinsicInst * > getConvergenceToken (const BasicBlock *BB)
 
ConvergenceRegionInfo getConvergenceRegions (Function &F, DominatorTree &DT, LoopInfo &LI)
 
unsigned getIDFromRegister (unsigned Reg)
 
std::string lookupBuiltinNameHelper (StringRef DemangledCall, FPDecorationId *DecorationId)
 Parses the name part of the demangled builtin call.
 
std::tuple< int, unsigned, unsignedmapBuiltinToOpcode (const StringRef DemangledCall, SPIRV::InstructionSet::InstructionSet Set)
 Helper function for finding a builtin function attributes by a demangled function name.
 
std::optional< boollowerBuiltin (const StringRef DemangledCall, SPIRV::InstructionSet::InstructionSet Set, MachineIRBuilder &MIRBuilder, const Register OrigRet, const Type *OrigRetTy, const SmallVectorImpl< Register > &Args, SPIRVGlobalRegistry *GR)
 
TypeparseBuiltinCallArgumentType (StringRef TypeStr, LLVMContext &Ctx)
 
bool parseBuiltinTypeStr (SmallVector< StringRef, 10 > &BuiltinArgsTypeStrs, const StringRef DemangledCall, LLVMContext &Ctx)
 
TypeparseBuiltinCallArgumentBaseType (const StringRef DemangledCall, unsigned ArgIdx, LLVMContext &Ctx)
 Parses the provided ArgIdx argument base type in the DemangledCall skeleton.
 
TargetExtTypeparseBuiltinTypeNameToTargetExtType (std::string TypeName, LLVMContext &Context)
 Translates a string representing a SPIR-V or OpenCL builtin type to a TargetExtType that can be further lowered with lowerBuiltinType().
 
SPIRVTypelowerBuiltinType (const Type *OpaqueType, SPIRV::AccessQualifier::AccessQualifier AccessQual, MachineIRBuilder &MIRBuilder, SPIRVGlobalRegistry *GR)
 
std::optional< boollowerBuiltin (const StringRef DemangledCall, InstructionSet::InstructionSet Set, MachineIRBuilder &MIRBuilder, const Register OrigRet, const Type *OrigRetTy, const SmallVectorImpl< Register > &Args, SPIRVGlobalRegistry *GR)
 Lowers a builtin function call using the provided DemangledCall skeleton and external instruction Set.
 
SPIRVTypelowerBuiltinType (const Type *Type, AccessQualifier::AccessQualifier AccessQual, MachineIRBuilder &MIRBuilder, SPIRVGlobalRegistry *GR)
 Handles the translation of the provided special opaque/builtin type Type to SPIR-V type.
 
size_t to_hash (const MachineInstr *MI)
 
MIHandle getMIKey (const MachineInstr *MI)
 
IRHandleMF getIRHandleMF (IRHandle Handle, const MachineFunction *MF)
 
IRHandle irhandle_image (const Type *SampledTy, unsigned Dim, unsigned Depth, unsigned Arrayed, unsigned MS, unsigned Sampled, unsigned ImageFormat, unsigned AQ=0)
 
IRHandle irhandle_sampled_image (const Type *SampledTy, const MachineInstr *ImageTy)
 
IRHandle irhandle_sampler ()
 
IRHandle irhandle_pipe (uint8_t AQ)
 
IRHandle irhandle_event ()
 
IRHandle irhandle_pointee (const Type *ElementType, unsigned AddressSpace)
 
IRHandle irhandle_ptr (const void *Ptr, unsigned Arg, enum SpecialTypeKind STK)
 
IRHandle irhandle_vkbuffer (const Type *ElementType, StorageClass::StorageClass SC, bool IsWriteable)
 
IRHandle irhandle_explict_layout_type (const Type *Ty)
 
IRHandle handle (const Type *Ty)
 
IRHandle handle (const Value *V)
 
IRHandle handle (const MachineInstr *KeyMI)
 
bool type_has_layout_decoration (const Type *T)
 

Typedef Documentation

◆ InstrList

Definition at line 128 of file SPIRVModuleAnalysis.h.

◆ IRHandle

using llvm::SPIRV::IRHandle = typedef std::tuple<const void *, unsigned, unsigned>

Definition at line 50 of file SPIRVIRMapping.h.

◆ IRHandleMF

using llvm::SPIRV::IRHandleMF = typedef std::pair<IRHandle, const MachineFunction *>

Definition at line 51 of file SPIRVIRMapping.h.

◆ LocalToGlobalRegTable

Definition at line 130 of file SPIRVModuleAnalysis.h.

◆ MIHandle

using llvm::SPIRV::MIHandle = typedef std::tuple<const MachineInstr *, Register, size_t>

Definition at line 44 of file SPIRVIRMapping.h.

◆ RegisterAliasMapTy

Definition at line 131 of file SPIRVModuleAnalysis.h.

Enumeration Type Documentation

◆ AsmComments

Enumerator
ASM_PRINTER_WIDTH16 

Definition at line 61 of file SPIRVInstrInfo.h.

◆ InstFlags

Enumerator
INST_PRINTER_WIDTH16 

Definition at line 241 of file SPIRVBaseInfo.h.

◆ ModuleSectionType

Enumerator
MB_EntryPoints 
MB_DebugNames 
MB_DebugStrings 
MB_DebugModuleProcessed 
MB_AliasingInsts 
MB_Annotations 
MB_TypeConstVars 
MB_NonSemanticGlobalDI 
MB_ExtFuncDecls 
NUM_MODULE_SECTIONS 

Definition at line 31 of file SPIRVModuleAnalysis.h.

◆ SpecialTypeKind

Enumerator
STK_Empty 
STK_Image 
STK_SampledImage 
STK_Sampler 
STK_Pipe 
STK_DeviceEvent 
STK_ElementPointer 
STK_Type 
STK_Value 
STK_MachineInstr 
STK_VkBuffer 
STK_ExplictLayoutType 
STK_Last 

Definition at line 57 of file SPIRVIRMapping.h.

Function Documentation

◆ getConvergenceRegions()

ConvergenceRegionInfo llvm::SPIRV::getConvergenceRegions ( Function F,
DominatorTree DT,
LoopInfo LI 
)

◆ getConvergenceToken() [1/2]

std::optional< IntrinsicInst * > llvm::SPIRV::getConvergenceToken ( BasicBlock BB)

◆ getConvergenceToken() [2/2]

std::optional< const IntrinsicInst * > llvm::SPIRV::getConvergenceToken ( const BasicBlock BB)

Definition at line 108 of file SPIRVConvergenceRegionAnalysis.cpp.

◆ getIDFromRegister()

unsigned llvm::SPIRV::getIDFromRegister ( unsigned  Reg)
inline

Definition at line 53 of file SPIRVMCTargetDesc.h.

References assert(), and Reg.

Referenced by emitOperand(), and llvm::SPIRVInstPrinter::printOperand().

◆ getIRHandleMF()

IRHandleMF llvm::SPIRV::getIRHandleMF ( IRHandle  Handle,
const MachineFunction MF 
)
inline

Definition at line 53 of file SPIRVIRMapping.h.

Referenced by llvm::SPIRVIRMapping::add(), and llvm::SPIRVIRMapping::findMI().

◆ getMIKey()

MIHandle llvm::SPIRV::getMIKey ( const MachineInstr MI)
inline

Definition at line 46 of file SPIRVIRMapping.h.

References MI, and to_hash().

Referenced by llvm::SPIRVIRMapping::add().

◆ handle() [1/3]

IRHandle llvm::SPIRV::handle ( const MachineInstr KeyMI)
inline

Definition at line 168 of file SPIRVIRMapping.h.

References irhandle_ptr(), STK_MachineInstr, and to_hash().

◆ handle() [2/3]

IRHandle llvm::SPIRV::handle ( const Type Ty)
inline

◆ handle() [3/3]

IRHandle llvm::SPIRV::handle ( const Value V)
inline

Definition at line 164 of file SPIRVIRMapping.h.

References irhandle_ptr(), and STK_Value.

◆ irhandle_event()

IRHandle llvm::SPIRV::irhandle_event ( )
inline

◆ irhandle_explict_layout_type()

IRHandle llvm::SPIRV::irhandle_explict_layout_type ( const Type Ty)
inline

◆ irhandle_image()

IRHandle llvm::SPIRV::irhandle_image ( const Type SampledTy,
unsigned  Dim,
unsigned  Depth,
unsigned  Arrayed,
unsigned  MS,
unsigned  Sampled,
unsigned  ImageFormat,
unsigned  AQ = 0 
)
inline

Definition at line 98 of file SPIRVIRMapping.h.

References llvm::Depth, and STK_Image.

◆ irhandle_pipe()

IRHandle llvm::SPIRV::irhandle_pipe ( uint8_t  AQ)
inline

Definition at line 128 of file SPIRVIRMapping.h.

References STK_Pipe.

Referenced by llvm::SPIRVGlobalRegistry::getOrCreateOpTypePipe().

◆ irhandle_pointee()

IRHandle llvm::SPIRV::irhandle_pointee ( const Type ElementType,
unsigned  AddressSpace 
)
inline

◆ irhandle_ptr()

IRHandle llvm::SPIRV::irhandle_ptr ( const void *  Ptr,
unsigned  Arg,
enum SpecialTypeKind  STK 
)
inline

Definition at line 142 of file SPIRVIRMapping.h.

References Ptr.

Referenced by handle(), and irhandle_explict_layout_type().

◆ irhandle_sampled_image()

IRHandle llvm::SPIRV::irhandle_sampled_image ( const Type SampledTy,
const MachineInstr ImageTy 
)
inline

◆ irhandle_sampler()

IRHandle llvm::SPIRV::irhandle_sampler ( )
inline

Definition at line 124 of file SPIRVIRMapping.h.

References STK_Sampler.

Referenced by llvm::SPIRVGlobalRegistry::getOrCreateOpTypeSampler().

◆ irhandle_vkbuffer()

IRHandle llvm::SPIRV::irhandle_vkbuffer ( const Type ElementType,
StorageClass::StorageClass  SC,
bool  IsWriteable 
)
inline

Definition at line 147 of file SPIRVIRMapping.h.

References STK_VkBuffer.

Referenced by llvm::SPIRVGlobalRegistry::getOrCreateVulkanBufferType().

◆ lookupBuiltinNameHelper()

std::string llvm::SPIRV::lookupBuiltinNameHelper ( StringRef  DemangledCall,
FPDecorationId DecorationId 
)

Parses the name part of the demangled builtin call.

Definition at line 186 of file SPIRVBuiltins.cpp.

References llvm::demangledPostfixToDecorationId(), llvm::StringRef::rfind(), llvm::StringRef::size(), llvm::StringRef::starts_with(), and llvm::StringRef::substr().

Referenced by llvm::lookupBuiltin().

◆ lowerBuiltin() [1/2]

std::optional< bool > llvm::SPIRV::lowerBuiltin ( const StringRef  DemangledCall,
InstructionSet::InstructionSet  Set,
MachineIRBuilder MIRBuilder,
const Register  OrigRet,
const Type OrigRetTy,
const SmallVectorImpl< Register > &  Args,
SPIRVGlobalRegistry GR 
)

Lowers a builtin function call using the provided DemangledCall skeleton and external instruction Set.

Returns
the lowering success status if the called function is a recognized builtin, std::nullopt otherwise.

DemangledCall is the skeleton of the lowered builtin function call. Set is the external instruction set containing the given builtin. OrigRet is the single original virtual return register if defined, Register(0) otherwise. OrigRetTy is the type of the OrigRet. Args are the arguments of the lowered builtin call.

◆ lowerBuiltin() [2/2]

std::optional< bool > llvm::SPIRV::lowerBuiltin ( const StringRef  DemangledCall,
SPIRV::InstructionSet::InstructionSet  Set,
MachineIRBuilder MIRBuilder,
const Register  OrigRet,
const Type OrigRetTy,
const SmallVectorImpl< Register > &  Args,
SPIRVGlobalRegistry GR 
)

◆ lowerBuiltinType() [1/2]

SPIRVType * llvm::SPIRV::lowerBuiltinType ( const Type OpaqueType,
SPIRV::AccessQualifier::AccessQualifier  AccessQual,
MachineIRBuilder MIRBuilder,
SPIRVGlobalRegistry GR 
)

◆ lowerBuiltinType() [2/2]

SPIRVType * llvm::SPIRV::lowerBuiltinType ( const Type Type,
AccessQualifier::AccessQualifier  AccessQual,
MachineIRBuilder MIRBuilder,
SPIRVGlobalRegistry GR 
)

Handles the translation of the provided special opaque/builtin type Type to SPIR-V type.

Generates the corresponding machine instructions for the target type or gets the already existing OpType<...> register from the global registry GR.

Returns
A machine instruction representing the OpType<...> SPIR-V type.

Type is the special opaque/builtin type to be lowered.

◆ mapBuiltinToOpcode()

std::tuple< int, unsigned, unsigned > llvm::SPIRV::mapBuiltinToOpcode ( const StringRef  DemangledCall,
SPIRV::InstructionSet::InstructionSet  Set 
)

Helper function for finding a builtin function attributes by a demangled function name.

Defined in SPIRVBuiltins.cpp.

Definition at line 2787 of file SPIRVBuiltins.cpp.

References llvm::lookupBuiltin(), and Reg.

◆ parseBuiltinCallArgumentBaseType()

Type * llvm::SPIRV::parseBuiltinCallArgumentBaseType ( const StringRef  DemangledCall,
unsigned  ArgIdx,
LLVMContext Ctx 
)

Parses the provided ArgIdx argument base type in the DemangledCall skeleton.

A base type is either a basic type (e.g. i32 for int), pointer element type (e.g. i8 for char*), or builtin type (TargetExtType).

Returns
LLVM Type or nullptr if unrecognized

DemangledCall is the skeleton of the lowered builtin function call. ArgIdx is the index of the argument to parse.

Definition at line 3012 of file SPIRVBuiltins.cpp.

References parseBuiltinCallArgumentType(), parseBuiltinTypeStr(), and llvm::SmallVectorBase< Size_T >::size().

◆ parseBuiltinCallArgumentType()

Type * llvm::SPIRV::parseBuiltinCallArgumentType ( StringRef  TypeStr,
LLVMContext Ctx 
)

◆ parseBuiltinTypeNameToTargetExtType()

TargetExtType * llvm::SPIRV::parseBuiltinTypeNameToTargetExtType ( std::string  TypeName,
LLVMContext Context 
)

Translates a string representing a SPIR-V or OpenCL builtin type to a TargetExtType that can be further lowered with lowerBuiltinType().

Returns
A TargetExtType representing the builtin SPIR-V type.

TypeName is the full string representation of the SPIR-V or OpenCL builtin type.

Definition at line 3187 of file SPIRVBuiltins.cpp.

References assert(), llvm::StringRef::contains(), Context, llvm::StringRef::find(), llvm::TargetExtType::get(), isDigit(), llvm::parseTypeString(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::report_fatal_error(), llvm::SPIRV::OpenCLType::SpirvTypeLiteral, llvm::StringRef::starts_with(), and llvm::StringRef::substr().

Referenced by llvm::SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(), lowerBuiltinType(), and parseBuiltinCallArgumentType().

◆ parseBuiltinTypeStr()

bool llvm::SPIRV::parseBuiltinTypeStr ( SmallVector< StringRef, 10 > &  BuiltinArgsTypeStrs,
const StringRef  DemangledCall,
LLVMContext Ctx 
)

◆ to_hash()

size_t llvm::SPIRV::to_hash ( const MachineInstr MI)
inline

◆ type_has_layout_decoration()

bool llvm::SPIRV::type_has_layout_decoration ( const Type T)
inline