File tree Expand file tree Collapse file tree 3 files changed +39
-16
lines changed
include/llvm/GenXIntrinsics Expand file tree Collapse file tree 3 files changed +39
-16
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ SPDX-License-Identifier: MIT
17
17
#define GENX_METADATA_H
18
18
19
19
namespace llvm {
20
+
21
+ class MDNode ;
22
+ class Function ;
23
+
20
24
namespace genx {
21
25
22
26
namespace FunctionMD {
@@ -68,22 +72,7 @@ enum KernelMDOp {
68
72
BarrierCnt // Barrier count
69
73
};
70
74
71
- inline MDNode *GetOldStyleKernelMD (Function const &F) {
72
- auto *KernelMD = static_cast <MDNode *>(nullptr );
73
- auto *KernelMDs = F.getParent ()->getNamedMetadata (FunctionMD::GenXKernels);
74
- if (!KernelMDs)
75
- return KernelMD;
76
-
77
- for (unsigned I = 0 , E = KernelMDs->getNumOperands (); I < E; ++I) {
78
- auto *Kernel = mdconst::dyn_extract<Function>(
79
- KernelMDs->getOperand (I)->getOperand (KernelMDOp::FunctionRef));
80
- if (Kernel == &F) {
81
- KernelMD = KernelMDs->getOperand (I);
82
- break ;
83
- }
84
- }
85
- return KernelMD;
86
- }
75
+ MDNode *GetOldStyleKernelMD (const Function &F);
87
76
88
77
} // namespace genx
89
78
} // namespace llvm
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ if(BUILD_EXTERNAL)
23
23
GenXSPIRVWriterAdaptor.cpp
24
24
GenXVersion.cpp
25
25
AdaptorsCommon.cpp
26
+ GenXMetadata.cpp
26
27
)
27
28
llvm_update_compile_flags (LLVMGenXIntrinsics )
28
29
add_dependencies (LLVMGenXIntrinsics GenXIntrinsicsGen )
50
51
GenXSPIRVWriterAdaptor.cpp
51
52
GenXVersion.cpp
52
53
AdaptorsCommon.cpp
54
+ GenXMetadata.cpp
53
55
ADDITIONAL_HEADER_DIRS
54
56
${GENX_INTRINSICS_MAIN_INCLUDE_DIR} /llvm/GenXIntrinsics
55
57
Original file line number Diff line number Diff line change
1
+ /* ========================== begin_copyright_notice ============================
2
+
3
+ Copyright (C) 2021 Intel Corporation
4
+
5
+ SPDX-License-Identifier: MIT
6
+
7
+ ============================= end_copyright_notice ===========================*/
8
+
9
+ #include " llvm/GenXIntrinsics/GenXMetadata.h"
10
+
11
+ #include < llvm/IR/Function.h>
12
+ #include < llvm/IR/Metadata.h>
13
+ #include < llvm/IR/Module.h>
14
+
15
+ using namespace llvm ;
16
+
17
+ MDNode *llvm::genx::GetOldStyleKernelMD (Function const &F) {
18
+ auto *KernelMD = static_cast <MDNode *>(nullptr );
19
+ auto *KernelMDs = F.getParent ()->getNamedMetadata (FunctionMD::GenXKernels);
20
+ if (!KernelMDs)
21
+ return KernelMD;
22
+
23
+ for (unsigned I = 0 , E = KernelMDs->getNumOperands (); I < E; ++I) {
24
+ auto *Kernel = mdconst::dyn_extract<Function>(
25
+ KernelMDs->getOperand (I)->getOperand (KernelMDOp::FunctionRef));
26
+ if (Kernel == &F) {
27
+ KernelMD = KernelMDs->getOperand (I);
28
+ break ;
29
+ }
30
+ }
31
+ return KernelMD;
32
+ }
You can’t perform that action at this time.
0 commit comments