1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2017-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 /*========================== begin_copyright_notice ============================
10 
11 This file is distributed under the University of Illinois Open Source License.
12 See LICENSE.TXT for details.
13 
14 ============================= end_copyright_notice ===========================*/
15 
16 /*========================== begin_copyright_notice ============================
17 
18 Copyright (C) 2014 Advanced Micro Devices, Inc. All rights reserved.
19 
20 Permission is hereby granted, free of charge, to any person obtaining a
21 copy of this software and associated documentation files (the "Software"),
22 to deal with the Software without restriction, including without limitation
23 the rights to use, copy, modify, merge, publish, distribute, sublicense,
24 and/or sell copies of the Software, and to permit persons to whom the
25 Software is furnished to do so, subject to the following conditions:
26 
27 Redistributions of source code must retain the above copyright notice,
28 this list of conditions and the following disclaimers.
29 Redistributions in binary form must reproduce the above copyright notice,
30 this list of conditions and the following disclaimers in the documentation
31 and/or other materials provided with the distribution.
32 Neither the names of Advanced Micro Devices, Inc., nor the names of its
33 contributors may be used to endorse or promote products derived from this
34 Software without specific prior written permission.
35 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38 CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
41 THE SOFTWARE.
42 
43 ============================= end_copyright_notice ===========================*/
44 
45 // This file defines SPIR-V extended instructions.
46 
47 #ifndef SPIRVBUILTIN_HPP_
48 #define SPIRVBUILTIN_HPP_
49 
50 #include "SPIRVUtil.h"
51 #include "OpenCL.std.h"
52 #include "SPIRV.DebugInfo.h"
53 
54 #include <string>
55 #include <vector>
56 
57 namespace igc_spv{
58 
59 
60 inline bool
isOpenCLBuiltinSet(SPIRVExtInstSetKind Set)61 isOpenCLBuiltinSet (SPIRVExtInstSetKind Set) {
62   return Set == SPIRVEIS_OpenCL;
63 }
64 
65 inline bool
isSPIRVDebugInfoSet(SPIRVExtInstSetKind Set)66 isSPIRVDebugInfoSet(SPIRVExtInstSetKind Set) {
67     return Set == SPIRVEIS_DebugInfo ||
68         Set == SPIRVEIS_OpenCL_DebugInfo_100;
69 }
70 
71 typedef igc_OpenCLLIB::Entrypoints OCLExtOpKind;
72 typedef SPIRVDebugInfo::Entrypoints OCLExtOpDbgKind;
73 
74 template<> inline void
init()75 SPIRVMap<OCLExtOpKind, std::string>::init() {
76 #define _OCL_EXT_OP(name, num) add(igc_OpenCLLIB::name, #name);
77 #include "OpenCL.stdfuncs.h"
78 #undef _OCL_EXT_OP
79 }
SPIRV_DEF_NAMEMAP(OCLExtOpKind,OCLExtOpMap)80 SPIRV_DEF_NAMEMAP(OCLExtOpKind, OCLExtOpMap)
81 
82 template<> inline void
83 SPIRVMap<OCLExtOpDbgKind, std::string>::init() {
84 #define _OCL_EXT_OP(name, num) add(SPIRVDebugInfo::name, #name);
85 #include "SPIRV.DebugInfofuncs.h"
86 #undef _OCL_EXT_OP
87 }
88 SPIRV_DEF_NAMEMAP(OCLExtOpDbgKind, OCLExtOpDbgMap)
89 
90 }
91 
92 #endif
93