25#define DEBUG_TYPE "spirv-subtarget"
27#define GET_SUBTARGETINFO_TARGET_DESC
28#define GET_SUBTARGETINFO_CTOR
29#include "SPIRVGenSubtargetInfo.inc"
33 cl::desc(
"SPIR-V Translator compatibility mode"),
39 cl::desc(
"Specify list of enabled SPIR-V extensions"));
44 const std::set<SPIRV::Extension::Extension> &AllowList) {
45 Extensions.insert(AllowList.begin(), AllowList.end());
54 const std::string &FS,
57 PointerSize(TM.getPointerSizeInBits( 0)), InstrInfo(),
58 FrameLowering(initSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
60 switch (TT.getSubArch()) {
87 initAvailableExtensions();
88 initAvailableExtInstSets();
90 GR = std::make_unique<SPIRVGlobalRegistry>(PointerSize);
91 CallLoweringInfo = std::make_unique<SPIRVCallLowering>(TLInfo, GR.get());
92 InlineAsmInfo = std::make_unique<SPIRVInlineAsmLowering>(TLInfo);
93 Legalizer = std::make_unique<SPIRVLegalizerInfo>(*
this);
94 RegBankInfo = std::make_unique<SPIRVRegisterBankInfo>();
106 return AvailableExtensions.
contains(E);
110 SPIRV::InstructionSet::InstructionSet E)
const {
111 return AvailableExtInstSets.
contains(E);
130void SPIRVSubtarget::initAvailableExtensions() {
131 AvailableExtensions.
clear();
137void SPIRVSubtarget::initAvailableExtInstSets() {
138 AvailableExtInstSets.
clear();
140 AvailableExtInstSets.
insert(SPIRV::InstructionSet::GLSL_std_450);
142 AvailableExtInstSets.
insert(SPIRV::InstructionSet::OpenCL_std);
146 SPIRV::Extension::SPV_AMD_shader_trinary_minmax_extension)) {
147 AvailableExtInstSets.
insert(
148 SPIRV::InstructionSet::SPV_AMD_shader_trinary_minmax);
static bool isAtLeastVer(VersionTuple Target, VersionTuple VerToCompareTo)
static cl::opt< bool > SPVTranslatorCompat("translator-compatibility-mode", cl::desc("SPIR-V Translator compatibility mode"), cl::Optional, cl::init(false))
static cl::opt< std::set< SPIRV::Extension::Extension >, false, SPIRVExtensionsParser > Extensions("spirv-ext", cl::desc("Specify list of enabled SPIR-V extensions"))
SPIRVSubtarget & initSubtargetDependencies(StringRef CPU, StringRef FS)
static void addExtensionsToClOpt(const std::set< SPIRV::Extension::Extension > &AllowList)
bool canDirectlyComparePointers() const
bool isAtLeastSPIRVVer(VersionTuple VerToCompareTo) const
bool isAtLeastOpenCLVer(VersionTuple VerToCompareTo) const
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool canUseExtInstSet(SPIRV::InstructionSet::InstructionSet E) const
SPIRVSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const SPIRVTargetMachine &TM)
bool canUseExtension(SPIRV::Extension::Extension E) const
bool contains(const T &V) const
Check if the SmallSet contains the given element.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Represents a version number in the form major[.minor[.subminor[.build]]].
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
InstructionSelector * createSPIRVInstructionSelector(const SPIRVTargetMachine &TM, const SPIRVSubtarget &Subtarget, const RegisterBankInfo &RBI)
Command line parser for toggling SPIR-V extensions.