13#include "llvm/IR/IntrinsicsSPIRV.h"
23 SPIRV::BuiltIn::BuiltIn BI;
26 const MDNode *MD = GV->getMetadata(
"spirv.Decorations");
28 const auto *Dec = dyn_cast<MDNode>(Op);
29 if (!Dec || Dec->getNumOperands() == 0)
32 mdconst::dyn_extract<ConstantInt>(Dec->getOperand(0));
33 return Id && Id->getZExtValue() == SPIRV::Decoration::BuiltIn;
43 unsigned AS = LI->getPointerAddressSpace();
61 case Intrinsic::spv_generic_cast_to_ptr_explicit:
72 auto IntrID =
II->getIntrinsicID();
74 case Intrinsic::spv_generic_cast_to_ptr_explicit: {
76 unsigned DstAS =
II->getType()->getPointerAddressSpace();
77 return NewAS == DstAS ? NewV
87 return ST->canUseExtension(SPIRV::Extension::SPV_INTEL_masked_gather_scatter);
91 return ST->canUseExtension(SPIRV::Extension::SPV_INTEL_masked_gather_scatter);
uint64_t IntrinsicInst * II
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
A wrapper class for inspecting calls to intrinsic functions.
ArrayRef< MDOperand > operands() const
Tracking metadata reference owned by Metadata.
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
Value * rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV, Value *NewV) const override
bool isLegalMaskedScatter(Type *DataType, Align Alignment) const override
bool collectFlatAddressOperands(SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const override
bool isLegalMaskedGather(Type *DataType, Align Alignment) const override
ValueUniformity getValueUniformity(const Value *V) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVMContext & getContext() const
All values hold a context through their type.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool getSpirvBuiltInIdByName(llvm::StringRef Name, SPIRV::BuiltIn::BuiltIn &BI)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI const Value * getUnderlyingObject(const Value *V, unsigned MaxLookup=MaxLookupSearchDepth, bool MustPreserveProvenance=false)
This method strips off any GEP address adjustments, pointer casts or llvm.threadlocal....
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
bool isEntryPoint(const Function &F)
DWARFExpression::Operation Op
ValueUniformity
Enum describing how values behave with respect to uniformity and divergence, to answer the question: ...
@ NeverUniform
The result value can never be assumed to be uniform.
@ Default
The result value is uniform if and only if all operands are uniform.
This struct is a compact representation of a valid (non-zero power of two) alignment.