LLVM: lib/Target/SPIRV/SPIRVMetadata.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15
16using namespace llvm;
17
22 "Kernel attributes are attached/belong only to OpenCL kernel functions");
23
24
25 MDNode *Node = F.getMetadata(AttributeName);
26 if (Node && ArgIdx < Node->getNumOperands())
28
29
30
31
32
33
34
35
36
37
38 unsigned MDArgIdx = ArgIdx + 1;
40 F.getParent()->getNamedMetadata("opencl.kernels");
41 if (!OpenCLKernelsMD || OpenCLKernelsMD->getNumOperands() == 0)
42 return nullptr;
43
44
45
46
48 bool FoundLoweredKernelFunction = false;
51 if (MaybeValue &&
53 FoundLoweredKernelFunction = true;
54 continue;
55 }
56 if (MaybeValue && FoundLoweredKernelFunction)
57 return nullptr;
58
60 if (FoundLoweredKernelFunction && MaybeNode &&
62 AttributeName &&
63 MDArgIdx < MaybeNode->getNumOperands())
65 }
66 return nullptr;
67}
68
69namespace llvm {
70
74 "Kernel attributes are attached/belong only to OpenCL kernel functions");
76}
77
81 "Kernel attributes are attached/belong only to OpenCL kernel functions");
83}
84
85}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const MDOperand & getOperand(unsigned I) const
ArrayRef< MDOperand > operands() const
Tracking metadata reference owned by Metadata.
LLVM_ABI MDNode * getOperand(unsigned i) const
LLVM_ABI unsigned getNumOperands() const
StringRef - Represent a constant reference to a string, i.e.
@ SPIR_KERNEL
Used for SPIR kernel functions.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
MDString * getOCLKernelArgAccessQual(const Function &F, unsigned ArgIdx)
Definition SPIRVMetadata.cpp:71
MDString * getOCLKernelArgTypeQual(const Function &F, unsigned ArgIdx)
Definition SPIRVMetadata.cpp:78
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.