1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #ifndef VC_GENXOPTS_UTILS_INTERNALMETADATA_H 10 #define VC_GENXOPTS_UTILS_INTERNALMETADATA_H 11 12 #include "llvm/IR/Function.h" 13 14 namespace llvm { 15 namespace genx { 16 17 namespace VariableMD { 18 inline constexpr const char VCPredefinedVariable[] = "VCPredefinedVariable"; 19 } // namespace VariableMD 20 21 namespace FunctionMD { 22 inline constexpr const char GenXKernelInternal[] = "genx.kernel.internal"; 23 inline constexpr const char VCEmulationRoutine[] = "VC.Emulation.Routine"; 24 25 // amount of stack calculated for kernel 26 // no attribute means that GenXStackUsage pass failed (recursion, etc) 27 // attribute created by GenXStackUsage and used to create patch token 28 inline constexpr const char VCStackAmount[] = "VC.Stack.Amount"; 29 } 30 31 namespace InstMD { 32 // SVMBlockType metadata serves interesting purpose: 33 // Finalizer now don't support properly SVM gathers/scatters less then dword 34 // So we are extending everything to 32 but preserving real type in metadata 35 // To use it later in CISA builder when we are creating gather/scatter 36 inline constexpr const char SVMBlockType[] = "SVMBlockType"; 37 38 // These two are used in prologue/epilogue insertion 39 inline constexpr const char FuncArgSize[] = "FuncArgSize"; 40 inline constexpr const char FuncRetSize[] = "FuncRetSize"; 41 } 42 43 namespace internal { 44 45 namespace KernelMDOp { 46 enum { 47 FunctionRef, 48 OffsetInArgs, // Implicit arguments offset in the byval argument 49 ArgIndexes, // Kernel argument index. Index may not be equal to the IR argNo 50 // in the case of linearization 51 LinearizationArgs, 52 BTIndices, 53 Last 54 }; 55 } 56 namespace ArgLinearizationMDOp { 57 enum { 58 Explicit, 59 Linearization, 60 Last 61 }; 62 } 63 namespace LinearizationMDOp { 64 enum { 65 Argument, 66 Offset, 67 Last 68 }; 69 } 70 71 // ExternalMD is created by vc-intrinsics. Internal has to be created by VC BE. 72 // This creates initial internal metadata structure. Definition in 73 // KernelInfo.cpp 74 void createInternalMD(Function &F); 75 void replaceInternalFunctionRef(const Function &From, Function &To); 76 77 } // namespace internal 78 } // namespace genx 79 } // namespace llvm 80 81 #endif // VC_GENXOPTS_UTILS_INTERNALMETADATA_H 82