41using namespace OperandCategory;
43using namespace Capability;
44using namespace InstructionSet;
45#define GET_SymbolicOperands_DECL
46#define GET_SymbolicOperands_IMPL
47#define GET_ExtensionEntries_DECL
48#define GET_ExtensionEntries_IMPL
49#define GET_CapabilityEntries_DECL
50#define GET_CapabilityEntries_IMPL
51#define GET_ExtendedBuiltins_DECL
52#define GET_ExtendedBuiltins_IMPL
53#include "SPIRVGenTables.inc"
60 SPIRV::lookupSymbolicOperandByCategoryAndValue(Category,
Value);
63 return Lookup->Mnemonic.str();
64 if (Category != SPIRV::OperandCategory::ImageOperandOperand &&
65 Category != SPIRV::OperandCategory::FPFastMathModeOperand &&
66 Category != SPIRV::OperandCategory::SelectionControlOperand &&
67 Category != SPIRV::OperandCategory::LoopControlOperand &&
68 Category != SPIRV::OperandCategory::FunctionControlOperand &&
69 Category != SPIRV::OperandCategory::MemorySemanticsOperand &&
70 Category != SPIRV::OperandCategory::MemoryOperandOperand &&
71 Category != SPIRV::OperandCategory::KernelProfilingInfoOperand)
75 std::string Separator;
77 SPIRV::lookupSymbolicOperandByCategory(Category);
79 auto TableEnd =
ArrayRef(SPIRV::SymbolicOperands).
end();
80 while (EnumValueInCategory && EnumValueInCategory->
Category == Category) {
81 if ((EnumValueInCategory->
Value != 0) &&
86 if (++EnumValueInCategory == TableEnd)
97 SPIRV::lookupSymbolicOperandByCategoryAndValue(Category,
Value);
109 SPIRV::lookupSymbolicOperandByCategoryAndValue(Category,
Value);
122 SPIRV::lookupCapabilityByCategoryAndValue(Category,
Value);
123 auto TableEnd =
ArrayRef(SPIRV::CapabilityEntries).
end();
124 while (Capability && Capability->
Category == Category &&
127 static_cast<SPIRV::Capability::Capability
>(Capability->
ReqCapability));
128 if (++Capability == TableEnd)
138 SPIRV::lookupSymbolicOperandsEnabledByExtension(
139 Extension, SPIRV::OperandCategory::CapabilityOperand);
142 auto TableEnd =
ArrayRef(SPIRV::ExtensionEntries).
end();
144 Entry->Category == SPIRV::OperandCategory::CapabilityOperand) {
148 static_cast<SPIRV::Capability::Capability
>(Entry->Value));
149 if (++Entry == TableEnd)
160 SPIRV::lookupExtensionByCategoryAndValue(Category,
Value);
163 auto TableEnd =
ArrayRef(SPIRV::ExtensionEntries).
end();
167 static_cast<SPIRV::Extension::Extension
>(
Extension->ReqExtension));
177 SPIRV::lookupSymbolicOperandByCategoryAndValue(
178 SPIRV::OperandCategory::BuiltInOperand, BuiltInValue);
181 return "__spirv_BuiltIn" +
Lookup->Mnemonic.str();
182 return "UNKNOWN_BUILTIN";
186 SPIRV::BuiltIn::BuiltIn &BI) {
187 const std::string Prefix =
"__spirv_BuiltIn";
188 if (!
Name.starts_with(Prefix))
192 SPIRV::lookupSymbolicOperandByCategoryAndMnemonic(
193 SPIRV::OperandCategory::BuiltInOperand,
194 Name.drop_front(Prefix.length()));
199 BI =
static_cast<SPIRV::BuiltIn::BuiltIn
>(
Lookup->Value);
205 case SPIRV::InstructionSet::OpenCL_std:
207 case SPIRV::InstructionSet::GLSL_std_450:
208 return "GLSL.std.450";
209 case SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100:
210 return "NonSemantic.Shader.DebugInfo.100";
211 case SPIRV::InstructionSet::SPV_AMD_shader_trinary_minmax:
212 return "SPV_AMD_shader_trinary_minmax";
214 return "UNKNOWN_EXT_INST_SET";
217SPIRV::InstructionSet::InstructionSet
220 {SPIRV::InstructionSet::GLSL_std_450, SPIRV::InstructionSet::OpenCL_std,
221 SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100}) {
231 SPIRV::lookupExtendedBuiltinBySetAndNumber(Set, InstructionNumber);
234 return "UNKNOWN_EXT_INST";
236 return Lookup->Name.str();
static cl::opt< std::set< SPIRV::Extension::Extension >, false, SPIRVExtensionsParser > Extensions("spirv-ext", cl::desc("Specify list of enabled SPIR-V extensions"))
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
LLVM Value Representation.
Represents a version number in the form major[.minor[.subminor[.build]]].
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
ExtensionList getSymbolicOperandExtensions(SPIRV::OperandCategory::OperandCategory Category, uint32_t Value)
std::string getExtInstName(SPIRV::InstructionSet::InstructionSet Set, uint32_t InstructionNumber)
CapabilityList getSymbolicOperandCapabilities(SPIRV::OperandCategory::OperandCategory Category, uint32_t Value)
std::string getExtInstSetName(SPIRV::InstructionSet::InstructionSet Set)
bool getSpirvBuiltInIdByName(llvm::StringRef Name, SPIRV::BuiltIn::BuiltIn &BI)
VersionTuple getSymbolicOperandMaxVersion(SPIRV::OperandCategory::OperandCategory Category, uint32_t Value)
CapabilityList getCapabilitiesEnabledByExtension(SPIRV::Extension::Extension Extension)
SPIRV::InstructionSet::InstructionSet getExtInstSetFromString(std::string SetName)
std::string getSymbolicOperandMnemonic(SPIRV::OperandCategory::OperandCategory Category, int32_t Value)
SmallVector< SPIRV::Extension::Extension, 8 > ExtensionList
VersionTuple getSymbolicOperandMinVersion(SPIRV::OperandCategory::OperandCategory Category, uint32_t Value)
SmallVector< SPIRV::Capability::Capability, 8 > CapabilityList
std::string getLinkStringForBuiltIn(SPIRV::BuiltIn::BuiltIn BuiltInValue)
Capability::Capability ReqCapability
OperandCategory::OperandCategory Category
Extension::Extension ReqExtension
OperandCategory::OperandCategory Category
OperandCategory::OperandCategory Category