Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/lib/SPIRV/SPIRVToOCL.h

raw
1 //===- SPIRVToOCL.h - Converts SPIR-V to LLVM ------------------*- C++ -*-===//
2 //
3 // The LLVM/SPIR-V Translator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 // Copyright (c) 2014 Advanced Micro Devices, Inc. All rights reserved.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal with the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // Redistributions of source code must retain the above copyright notice,
18 // this list of conditions and the following disclaimers.
19 // Redistributions in binary form must reproduce the above copyright notice,
20 // this list of conditions and the following disclaimers in the documentation
21 // and/or other materials provided with the distribution.
22 // Neither the names of Advanced Micro Devices, Inc., nor the names of its
23 // contributors may be used to endorse or promote products derived from this
24 // Software without specific prior written permission.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 // CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
31 // THE SOFTWARE.
32 //
33 //===----------------------------------------------------------------------===//
34 /// \file
35 ///
36 /// This file contains declaration of SPIRVToOCL class which implements
37 /// common transform of SPIR-V builtins to OCL builtins.
38 ///
39 //===----------------------------------------------------------------------===//
40
41 #ifndef SPIRVTOOCL_H
42 #define SPIRVTOOCL_H
43
44 #include "OCLUtil.h"
45 #include "SPIRVBuiltinHelper.h"
46 #include "SPIRVInternal.h"
47 #include "llvm/IR/InstVisitor.h"
48 #include "llvm/IR/PassManager.h"
49 #include "llvm/Pass.h"
50
51 #include <string>
52
53 namespace SPIRV {
54
55 class SPIRVToOCLBase : public InstVisitor<SPIRVToOCLBase>,
56 protected BuiltinCallHelper {
57 public:
58 SPIRVToOCLBase()
59 : BuiltinCallHelper(ManglingRules::OpenCL, translateOpaqueType),
60 M(nullptr), Ctx(nullptr) {}
61 virtual ~SPIRVToOCLBase() {}
62
63 virtual bool runSPIRVToOCL(Module &M) = 0;
64
65 void visitCallInst(CallInst &CI);
66
67 // SPIR-V reader should translate vector casts into OCL built-ins because
68 // such conversions are not defined neither by OpenCL C/C++ nor
69 // by SPIR 1.2/2.0 standards. So, it is safer to convert such casts into
70 // appropriate calls to conversion built-ins defined by the standards.
71 void visitCastInst(CastInst &CI);
72
73 /// Transform __spirv_ImageQuerySize[Lod] into vector of the same length
74 /// containing {[get_image_width | get_image_dim], get_image_array_size}
75 /// for all images except image1d_t which is always converted into
76 /// get_image_width returning scalar result.
77 void visitCallSPIRVImageQuerySize(CallInst *CI);
78
79 /// Transform __spirv_(NonUniform)Group* to {work_group|sub_group}_*.
80 ///
81 /// Special handling of work_group_broadcast.
82 /// __spirv_GroupBroadcast(a, vec3(x, y, z))
83 /// =>
84 /// work_group_broadcast(a, x, y, z)
85 ///
86 /// Special handling of sub_group_all, sub_group_any,
87 /// sub_group_non_uniform_all, sub_group_non_uniform_any, sub_group_ballot,
88 /// sub_group_clustered_logical_[and/or/xor].
89 /// retTy func(i1 arg)
90 /// =>
91 /// retTy func(i32 arg)
92 ///
93 /// Special handling of sub_group_all, sub_group_any,
94 /// sub_group_non_uniform_all,
95 /// sub_group_non_uniform_any, sub_group_non_uniform_all_equal.
96 /// i1 func
97 /// =>
98 /// i32 func
99 void visitCallSPIRVGroupBuiltin(CallInst *CI, Op OC);
100
101 /// Transform __spirv_{PipeOpName} to OCL pipe builtin functions.
102 void visitCallSPIRVPipeBuiltin(CallInst *CI, Op OC);
103
104 /// Transform __spirv_OpOpSubgroupImageMediaBlockReadINTEL =>
105 /// intel_sub_group_media_block_read
106 /// __spirv_OpSubgroupImageMediaBlockWriteINTEL =>
107 /// intel_sub_group_media_block_write
108 void visitCallSPIRVImageMediaBlockBuiltin(CallInst *CI, Op OC);
109
110 /// Transform __spirv_OpGenericCastToPtrExplicit_To{Global|Local|Private} to
111 /// to_{global|local|private} OCL builtin.
112 void visitCallGenericCastToPtrExplicitBuiltIn(CallInst *CI, Op OC);
113
114 /// Transform __spirv_OpBuildINDRange_{1|2|3}D to
115 /// ndrange_{1|2|3}D OCL builtin.
116 void visitCallBuildNDRangeBuiltIn(CallInst *CI, Op OC,
117 StringRef DemangledName);
118
119 /// Transform __spirv_*Convert_R{ReturnType}{_sat}{_rtp|_rtn|_rtz|_rte} to
120 /// convert_{ReturnType}_{sat}{_rtp|_rtn|_rtz|_rte}
121 /// example: <2 x i8> __spirv_SatConvertUToS(<2 x i32>) =>
122 /// convert_uchar2_sat(int2)
123 void visitCallSPIRVCvtBuiltin(CallInst *CI, Op OC, StringRef DemangledName);
124
125 /// Transform
126 /// __spirv_AsyncGroupCopy(ScopeWorkGroup, dst, src, n, stride, event)
127 /// => async_work_group_strided_copy(dst, src, n, stride, event)
128 void visitCallAsyncWorkGroupCopy(CallInst *CI, Op OC);
129
130 /// Transform __spirv_GroupWaitEvents(Scope, NumEvents, EventsList)
131 /// => wait_group_events(NumEvents, EventsList)
132 void visitCallGroupWaitEvents(CallInst *CI, Op OC);
133
134 /// Transform __spirv_ImageSampleExplicitLod__{ReturnType} to read_imade
135 void visitCallSPIRVImageSampleExplicitLodBuiltIn(CallInst *CI, Op OC);
136
137 /// Transform __spirv_ImageWrite to write_image
138 void visitCallSPIRVImageWriteBuiltIn(CallInst *CI, Op OC);
139
140 /// Transform __spirv_ImageRead to read_image
141 void visitCallSPIRVImageReadBuiltIn(CallInst *CI, Op OC);
142
143 /// Transform __spirv_ImageQueryOrder to get_image_channel_order
144 // __spirv_ImageQueryFormat to get_image_channel_data_type
145 void visitCallSPIRVImageQueryBuiltIn(CallInst *CI, Op OC);
146
147 /// Transform subgroup Intel opcodes
148 /// example: __spirv_SubgroupBlockWriteINTEL
149 /// => intel_sub_group_block_write_ul
150 void visitCallSPIRVSubgroupINTELBuiltIn(CallInst *CI, Op OC);
151
152 /// Transform AVC INTEL Evaluate opcodes
153 /// example: __spirv_SubgroupAvcImeEvaluateWithSingleReference
154 /// => intel_sub_group_avc_ime_evaluate_with_single_reference
155 void visitCallSPIRVAvcINTELEvaluateBuiltIn(CallInst *CI, Op OC);
156
157 /// Transform AVC INTEL general opcodes
158 /// example: __spirv_SubgroupAvcMceGetDefaultInterBaseMultiReferencePenalty
159 /// =>
160 /// intel_sub_group_avc_mce_get_default_inter_base_multi_reference_penalty
161 void visitCallSPIRVAvcINTELInstructionBuiltin(CallInst *CI, Op OC);
162
163 /// Transform __spirv_GenericPtrMemSemantics to:
164 /// %0 = call spirv_func i32 @_Z9get_fence
165 /// %1 = shl i31 %0, 8
166 void visitCallSPIRVGenericPtrMemSemantics(CallInst *CI);
167
168 /// Transform __spirv_ConvertFToBF16INTELDv(N)_f to:
169 /// intel_convert_bfloat16(N)_as_ushort(N)Dv(N)_f;
170 /// and transform __spirv_ConvertBF16ToFINTELDv(N)_s to:
171 /// intel_convert_as_bfloat16(N)_float(N)Dv(N)_t;
172 /// where N is vector size
173 void visitCallSPIRVBFloat16Conversions(CallInst *CI, Op OC);
174
175 /// Transform __spirv_* builtins to OCL 2.0 builtins.
176 /// No change with arguments.
177 void visitCallSPIRVBuiltin(CallInst *CI, Op OC);
178
179 /// Transform __spirv_* builtins (originates from builtin variables) to OCL
180 /// builtins.
181 /// No change with arguments.
182 /// e.g.
183 /// _Z33__spirv_BuiltInGlobalInvocationIdi(x) -> get_global_id(x)
184 void visitCallSPIRVBuiltin(CallInst *CI, SPIRVBuiltinVariableKind Kind);
185
186 /// Transform __spirv_ocl* instructions (OpenCL Extended Instruction Set)
187 /// to OpenCL builtins.
188 void visitCallSPIRVOCLExt(CallInst *CI, OCLExtOpKind Kind);
189
190 /// Transform __spirv_ocl_vstore* to corresponding vstore OpenCL instruction
191 void visitCallSPIRVVStore(CallInst *CI, OCLExtOpKind Kind);
192
193 /// Transform __spirv_ocl_vloadn to OpenCL vload[2|4|8|16]
194 void visitCallSPIRVVLoadn(CallInst *CI, OCLExtOpKind Kind);
195
196 /// Transform __spirv_ocl_printf to (i8 addrspace(2)*, ...) @printf
197 void visitCallSPIRVPrintf(CallInst *CI, OCLExtOpKind Kind);
198
199 /// Get prefix work_/sub_ for OCL group builtin functions.
200 /// Assuming the first argument of \param CI is a constant integer for
201 /// workgroup/subgroup scope enums.
202 std::string getGroupBuiltinPrefix(CallInst *CI);
203
204 /// Transform __spirv_OpAtomicCompareExchange and
205 /// __spirv_OpAtomicCompareExchangeWeak
206 virtual void visitCallSPIRVAtomicCmpExchg(CallInst *CI) = 0;
207
208 /// Transform __spirv_OpAtomicIIncrement/OpAtomicIDecrement to:
209 /// - OCL2.0: atomic_fetch_add_explicit/atomic_fetch_sub_explicit
210 /// - OCL1.2: atomic_inc/atomic_dec
211 virtual void visitCallSPIRVAtomicIncDec(CallInst *CI, Op OC) = 0;
212
213 /// Transform __spirv_Atomic* to atomic_*.
214 /// __spirv_Atomic*(atomic_op, scope, sema, ops, ...) =>
215 /// atomic_*(atomic_op, ops, ..., order(sema), map(scope))
216 virtual void visitCallSPIRVAtomicBuiltin(CallInst *CI, Op OC) = 0;
217
218 /// Transform __spirv_MemoryBarrier to:
219 /// - OCL2.0: atomic_work_item_fence.__spirv_MemoryBarrier(scope, sema) =>
220 /// atomic_work_item_fence(flag(sema), order(sema), map(scope))
221 /// - OCL1.2: mem_fence
222 virtual void visitCallSPIRVMemoryBarrier(CallInst *CI) = 0;
223
224 /// Transform __spirv_ControlBarrier to:
225 /// - OCL2.0: work_group_barrier or sub_group barrier
226 /// - OCL1.2: barrier
227 virtual void visitCallSPIRVControlBarrier(CallInst *CI) = 0;
228
229 /// Transform split __spirv_ControlBarrierArriveINTEL and
230 /// __spirv_ControlBarrierWaitINTEL barrier to:
231 /// - OCL2.0: overload with a memory_scope argument
232 /// - OCL1.2: overload with no memory_scope argument
233 virtual void visitCallSPIRVSplitBarrierINTEL(CallInst *CI, Op OC) = 0;
234
235 /// Transform __spirv_EnqueueKernel to __enqueue_kernel
236 virtual void visitCallSPIRVEnqueueKernel(CallInst *CI, Op OC) = 0;
237
238 /// Transform __spirv_Any and __spirv_All to OpenCL builtin.
239 void visitCallSPIRVAnyAll(CallInst *CI, Op OC);
240
241 /// Transform relational builtin, e.g. __spirv_IsNan, to OpenCL builtin.
242 void visitCallSPIRVRelational(CallInst *CI, Op OC);
243
244 /// Conduct generic mutations for all atomic builtins
245 virtual CallInst *mutateCommonAtomicArguments(CallInst *CI, Op OC) = 0;
246
247 /// Transform __spirv_Opcode to ocl-version specific builtin name
248 /// using separate maps for OpenCL 1.2 and OpenCL 2.0
249 virtual void mutateAtomicName(CallInst *CI, Op OC) = 0;
250
251 // Transform FP atomic opcode to corresponding OpenCL function name
252 virtual std::string mapFPAtomicName(Op OC) = 0;
253
254 void translateOpaqueTypes();
255
256 private:
257 /// Transform uniform group opcode to corresponding OpenCL function name,
258 /// example: GroupIAdd(Reduce) => group_iadd => work_group_reduce_add |
259 /// sub_group_reduce_add
260 std::string getUniformArithmeticBuiltinName(CallInst *CI, Op OC);
261 /// Transform non-uniform group opcode to corresponding OpenCL function name,
262 /// example: GroupNonUniformIAdd(Reduce) => group_non_uniform_iadd =>
263 /// sub_group_non_uniform_reduce_add
264 std::string getNonUniformArithmeticBuiltinName(CallInst *CI, Op OC);
265 /// Transform ballot bit count opcode to corresponding OpenCL function name,
266 /// example: GroupNonUniformBallotBitCount(Reduce) =>
267 /// group_ballot_bit_count_iadd => sub_group_ballot_bit_count
268 std::string getBallotBuiltinName(CallInst *CI, Op OC);
269 /// Transform OpGroupNonUniformRotateKHR to corresponding OpenCL function
270 /// name.
271 std::string getRotateBuiltinName(CallInst *CI, Op OC);
272 /// Transform group opcode to corresponding OpenCL function name
273 std::string groupOCToOCLBuiltinName(CallInst *CI, Op OC);
274 /// Transform SPV-IR image opaque type into OpenCL representation,
275 /// example: spirv.Image._void_1_0_0_0_0_0_1 => opencl.image2d_wo_t
276 static std::string
277 getOCLImageOpaqueType(SmallVector<std::string, 8> &Postfixes);
278 /// Transform SPV-IR pipe opaque type into OpenCL representation,
279 /// example: spirv.Pipe._0 => opencl.pipe_ro_t
280 static std::string
281 getOCLPipeOpaqueType(SmallVector<std::string, 8> &Postfixes);
282
283 static std::string translateOpaqueType(StringRef STName);
284
285 /// Mutate the call instruction based on (optional) image operands at position
286 /// ImOpArgIndex. The new function name will be based on NewFuncName, and the
287 /// type suffix based on Ty and whether the image operand was signed.
288 BuiltinCallMutator mutateCallImageOperands(CallInst *CI,
289 StringRef NewFuncName, Type *Ty,
290 unsigned ImOpArgIndex);
291
292 protected:
293 Module *M;
294 LLVMContext *Ctx;
295 };
296
297 class SPIRVToOCLLegacy : public ModulePass {
298 protected:
299 SPIRVToOCLLegacy(char &ID) : ModulePass(ID) {}
300
301 public:
302 bool runOnModule(Module &M) override = 0;
303 };
304
305 class SPIRVToOCL12Base : public SPIRVToOCLBase {
306 public:
307 bool runSPIRVToOCL(Module &M) override;
308
309 /// Transform __spirv_MemoryBarrier to atomic_work_item_fence.
310 /// __spirv_MemoryBarrier(scope, sema) =>
311 /// atomic_work_item_fence(flag(sema), order(sema), map(scope))
312 void visitCallSPIRVMemoryBarrier(CallInst *CI) override;
313
314 /// Transform __spirv_ControlBarrier to barrier.
315 /// __spirv_ControlBarrier(execScope, memScope, sema) =>
316 /// barrier(flag(sema))
317 void visitCallSPIRVControlBarrier(CallInst *CI) override;
318
319 /// Transform split __spirv_ControlBarrierArriveINTEL and
320 /// __spirv_ControlBarrierWaitINTEL barrier to overloads without a
321 /// memory_scope argument.
322 void visitCallSPIRVSplitBarrierINTEL(CallInst *CI, Op OC) override;
323
324 /// Transform __spirv_OpAtomic functions. It firstly conduct generic
325 /// mutations for all builtins and then mutate some of them seperately
326 void visitCallSPIRVAtomicBuiltin(CallInst *CI, Op OC) override;
327
328 /// Transform __spirv_OpAtomicIIncrement / OpAtomicIDecrement to
329 /// atomic_inc / atomic_dec
330 void visitCallSPIRVAtomicIncDec(CallInst *CI, Op OC) override;
331
332 /// Transform __spirv_OpAtomicUMin/SMin/UMax/SMax into
333 /// atomic_min/atomic_max, as there is no distinction in OpenCL 1.2
334 /// between signed and unsigned version of those functions
335 void visitCallSPIRVAtomicUMinUMax(CallInst *CI, Op OC);
336
337 /// Transform __spirv_OpAtomicLoad to atomic_add(*ptr, 0)
338 void visitCallSPIRVAtomicLoad(CallInst *CI);
339
340 /// Transform __spirv_OpAtomicStore to atomic_xchg(*ptr, value)
341 void visitCallSPIRVAtomicStore(CallInst *CI);
342
343 /// Transform __spirv_OpAtomicFlagClear to atomic_xchg(*ptr, 0)
344 /// with ignoring the result
345 void visitCallSPIRVAtomicFlagClear(CallInst *CI);
346
347 /// Transform __spirv_OpAtomicFlagTestAndTest to
348 /// (bool)atomic_xchg(*ptr, 1)
349 void visitCallSPIRVAtomicFlagTestAndSet(CallInst *CI);
350
351 /// Transform __spirv_OpAtomicCompareExchange/Weak into atomic_cmpxchg
352 /// OpAtomicCompareExchangeWeak is not "weak" at all, but instead has
353 /// the same semantics as OpAtomicCompareExchange.
354 void visitCallSPIRVAtomicCmpExchg(CallInst *CI) override;
355
356 /// Trigger assert, since OpenCL 1.2 doesn't support enqueue_kernel
357 void visitCallSPIRVEnqueueKernel(CallInst *CI, Op OC) override;
358
359 /// Conduct generic mutations for all atomic builtins
360 CallInst *mutateCommonAtomicArguments(CallInst *CI, Op OC) override;
361
362 /// Transform atomic builtin name into correct ocl-dependent name
363 void mutateAtomicName(CallInst *CI, Op OC) override;
364
365 // Transform FP atomic opcode to corresponding OpenCL function name
366 std::string mapFPAtomicName(Op OC) override;
367
368 /// Transform SPIR-V atomic instruction opcode into OpenCL 1.2 builtin name.
369 /// Depending on the type, the return name starts with "atomic_" for 32-bit
370 /// types or with "atom_" for 64-bit types, as specified by
371 /// cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics extensions.
372 std::string mapAtomicName(Op OC, Type *Ty);
373 };
374
375 class SPIRVToOCL12Pass : public llvm::PassInfoMixin<SPIRVToOCL12Pass>,
376 public SPIRVToOCL12Base {
377 public:
378 llvm::PreservedAnalyses run(llvm::Module &M,
379 llvm::ModuleAnalysisManager &MAM) {
380 return runSPIRVToOCL(M) ? llvm::PreservedAnalyses::none()
381 : llvm::PreservedAnalyses::all();
382 }
383 };
384
385 class SPIRVToOCL12Legacy : public SPIRVToOCL12Base, public SPIRVToOCLLegacy {
386 public:
387 SPIRVToOCL12Legacy() : SPIRVToOCLLegacy(ID) {
388 initializeSPIRVToOCL12LegacyPass(*PassRegistry::getPassRegistry());
389 }
390 bool runOnModule(Module &M) override;
391
392 static char ID;
393 };
394
395 class SPIRVToOCL20Base : public SPIRVToOCLBase {
396 public:
397 bool runSPIRVToOCL(Module &M) override;
398
399 /// Transform __spirv_MemoryBarrier to atomic_work_item_fence.
400 /// __spirv_MemoryBarrier(scope, sema) =>
401 /// atomic_work_item_fence(flag(sema), order(sema), map(scope))
402 void visitCallSPIRVMemoryBarrier(CallInst *CI) override;
403
404 /// Transform __spirv_ControlBarrier to work_group_barrier/sub_group_barrier.
405 /// If execution scope is ScopeWorkgroup:
406 /// __spirv_ControlBarrier(execScope, memScope, sema) =>
407 /// work_group_barrier(flag(sema), map(memScope))
408 /// Otherwise:
409 /// __spirv_ControlBarrier(execScope, memScope, sema) =>
410 /// sub_group_barrier(flag(sema), map(memScope))
411 void visitCallSPIRVControlBarrier(CallInst *CI) override;
412
413 /// Transform split __spirv_ControlBarrierArriveINTEL and
414 /// __spirv_ControlBarrierWaitINTEL barrier to overloads with a
415 /// memory_scope argument.
416 void visitCallSPIRVSplitBarrierINTEL(CallInst *CI, Op OC) override;
417
418 /// Transform __spirv_Atomic* to atomic_*.
419 /// __spirv_Atomic*(atomic_op, scope, sema, ops, ...) =>
420 /// atomic_*(generic atomic_op, ops, ..., order(sema), map(scope))
421 void visitCallSPIRVAtomicBuiltin(CallInst *CI, Op OC) override;
422
423 /// Transform __spirv_OpAtomicIIncrement / OpAtomicIDecrement to
424 /// atomic_fetch_add_explicit / atomic_fetch_sub_explicit
425 void visitCallSPIRVAtomicIncDec(CallInst *CI, Op OC) override;
426
427 /// Transform __spirv_EnqueueKernel to __enqueue_kernel
428 void visitCallSPIRVEnqueueKernel(CallInst *CI, Op OC) override;
429
430 /// Conduct generic mutations for all atomic builtins
431 CallInst *mutateCommonAtomicArguments(CallInst *CI, Op OC) override;
432
433 /// Transform atomic builtin name into correct ocl-dependent name
434 void mutateAtomicName(CallInst *CI, Op OC) override;
435
436 // Transform FP atomic opcode to corresponding OpenCL function name
437 std::string mapFPAtomicName(Op OC) override;
438
439 /// Transform __spirv_OpAtomicCompareExchange/Weak into
440 /// atomic_compare_exchange_strong_explicit
441 /// OpAtomicCompareExchangeWeak is not "weak" at all, but instead has
442 /// the same semantics as OpAtomicCompareExchange.
443 void visitCallSPIRVAtomicCmpExchg(CallInst *CI) override;
444 };
445
446 class SPIRVToOCL20Pass : public llvm::PassInfoMixin<SPIRVToOCL20Pass>,
447 public SPIRVToOCL20Base {
448 public:
449 llvm::PreservedAnalyses run(llvm::Module &M,
450 llvm::ModuleAnalysisManager &MAM) {
451 return runSPIRVToOCL(M) ? llvm::PreservedAnalyses::none()
452 : llvm::PreservedAnalyses::all();
453 }
454 };
455
456 class SPIRVToOCL20Legacy : public SPIRVToOCLLegacy, public SPIRVToOCL20Base {
457 public:
458 SPIRVToOCL20Legacy() : SPIRVToOCLLegacy(ID) {
459 initializeSPIRVToOCL20LegacyPass(*PassRegistry::getPassRegistry());
460 }
461 bool runOnModule(Module &M) override;
462 static char ID;
463 };
464
465 /// Add passes for translating SPIR-V Instructions to the desired
466 /// representation in LLVM IR (such as OpenCL builtins or SPIR-V Friendly IR).
467 void addSPIRVBIsLoweringPass(ModulePassManager &PassMgr,
468 SPIRV::BIsRepresentation BIsRep);
469
470 } // namespace SPIRV
471
472 #endif // SPIRVTOOCL_H