1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2020-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 //===----------------------------------------------------------------------===//
10 //
11 // This file defines GenX kernel metadata operand numbers and other module
12 // metadata.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef GENX_METADATA_H
17 #define GENX_METADATA_H
18 
19 namespace llvm {
20 
21 class MDNode;
22 class Function;
23 
24 namespace genx {
25 
26 namespace FunctionMD {
27 static constexpr const char GenXKernels[] = "genx.kernels";
28 static constexpr const char GenXByteOffset[] = "genx_byte_offset";
29 static constexpr const char GenXVolatile[] = "genx_volatile";
30 static constexpr const char CMGenXMain[] = "CMGenxMain";
31 static constexpr const char CMStackCall[] = "CMStackCall";
32 static constexpr const char CMCallable[] = "CMCallable";
33 static constexpr const char CMEntry[] = "CMEntry";
34 static constexpr const char CMFloatControl[] = "CMFloatControl";
35 static constexpr const char CMGenxSIMT[] = "CMGenxSIMT";
36 static constexpr const char CMGenxReplicateMask[] = "CMGenxReplicateMask";
37 static constexpr const char OCLRuntime[] = "oclrt";
38 static constexpr const char ReferencedIndirectly[] = "referenced-indirectly";
39 } // namespace FunctionMD
40 
41 namespace VCModuleMD {
42 static constexpr const char VCGlobalVariable[] = "VCGlobalVariable";
43 static constexpr const char VCVolatile[] = "VCVolatile";
44 static constexpr const char VCByteOffset[] = "VCByteOffset";
45 static constexpr const char VCSingleElementVector[] = "VCSingleElementVector";
46 } // namespace VCModuleMD
47 
48 namespace VCFunctionMD {
49 static constexpr const char VCFunction[] = "VCFunction";
50 static constexpr const char VCStackCall[] = "VCStackCall";
51 static constexpr const char VCCallable[] = "VCCallable";
52 static constexpr const char VCFCEntry[] = "VCFCEntry";
53 static constexpr const char VCArgumentIOKind[] = "VCArgumentIOKind";
54 static constexpr const char VCFloatControl[] = "VCFloatControl";
55 static constexpr const char VCSLMSize[] = "VCSLMSize";
56 static constexpr const char VCArgumentKind[] = "VCArgumentKind";
57 static constexpr const char VCArgumentDesc[] = "VCArgumentDesc";
58 static constexpr const char VCSIMTCall[] = "VCSIMTCall";
59 static constexpr const char VCNamedBarrierCount[] = "VCNamedBarrierCount";
60 } // namespace VCFunctionMD
61 
62 enum KernelMDOp {
63   FunctionRef,  // Reference to Function
64   Name,         // Kernel name
65   ArgKinds,     // Reference to metadata node containing kernel arg kinds
66   SLMSize,      // SLM-size in bytes
67   ArgOffsets,   // Kernel argument offsets
68   ArgIOKinds,   // Reference to metadata node containing kernel argument
69                 // input/output kinds
70   ArgTypeDescs, // Kernel argument type descriptors
71   NBarrierCnt,  // Named barrier count
72   BarrierCnt    // Barrier count
73 };
74 
75 MDNode *GetOldStyleKernelMD(const Function &F);
76 
77 } // namespace genx
78 } // namespace llvm
79 
80 #endif
81