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"));
47 const std::string &FS,
50 PointerSize(TM.getPointerSizeInBits( 0)), InstrInfo(),
51 FrameLowering(initSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
53 switch (TT.getSubArch()) {
80 initAvailableExtensions();
81 initAvailableExtInstSets();
83 GR = std::make_unique<SPIRVGlobalRegistry>(PointerSize);
84 CallLoweringInfo = std::make_unique<SPIRVCallLowering>(TLInfo, GR.get());
85 InlineAsmInfo = std::make_unique<SPIRVInlineAsmLowering>(TLInfo);
86 Legalizer = std::make_unique<SPIRVLegalizerInfo>(*
this);
87 RegBankInfo = std::make_unique<SPIRVRegisterBankInfo>();
99 return AvailableExtensions.
contains(E);
103 SPIRV::InstructionSet::InstructionSet E)
const {
104 return AvailableExtInstSets.
contains(E);
123void SPIRVSubtarget::initAvailableExtensions() {
124 AvailableExtensions.
clear();
133void SPIRVSubtarget::initAvailableExtInstSets() {
134 AvailableExtInstSets.
clear();
136 AvailableExtInstSets.
insert(SPIRV::InstructionSet::GLSL_std_450);
138 AvailableExtInstSets.
insert(SPIRV::InstructionSet::OpenCL_std);
142 SPIRV::Extension::SPV_AMD_shader_trinary_minmax_extension)) {
143 AvailableExtInstSets.
insert(
144 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)
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.