LLVM  16.0.0git
SPIRVBuiltins.h
Go to the documentation of this file.
1 //===-- SPIRVBuiltins.h - SPIR-V Built-in Functions -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Lowering builtin function calls and types using their demangled names.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_SPIRV_SPIRVBUILTINS_H
14 #define LLVM_LIB_TARGET_SPIRV_SPIRVBUILTINS_H
15 
16 #include "SPIRVGlobalRegistry.h"
19 
20 namespace llvm {
21 namespace SPIRV {
22 /// Lowers a builtin funtion call using the provided \p DemangledCall skeleton
23 /// and external instruction \p Set.
24 ///
25 /// \return the lowering success status if the called function is a recognized
26 /// builtin, None otherwise.
27 ///
28 /// \p DemangledCall is the skeleton of the lowered builtin function call.
29 /// \p Set is the external instruction set containing the given builtin.
30 /// \p OrigRet is the single original virtual return register if defined,
31 /// Register(0) otherwise.
32 /// \p OrigRetTy is the type of the \p OrigRet.
33 /// \p Args are the arguments of the lowered builtin call.
34 Optional<bool> lowerBuiltin(const StringRef DemangledCall,
35  InstructionSet::InstructionSet Set,
36  MachineIRBuilder &MIRBuilder,
37  const Register OrigRet, const Type *OrigRetTy,
38  const SmallVectorImpl<Register> &Args,
39  SPIRVGlobalRegistry *GR);
40 /// Handles the translation of the provided special opaque/builtin type \p Type
41 /// to SPIR-V type. Generates the corresponding machine instructions for the
42 /// target type or gets the already existing OpType<...> register from the
43 /// global registry \p GR.
44 ///
45 /// \return A machine instruction representing the OpType<...> SPIR-V type.
46 ///
47 /// \p Type is the special opaque/builtin type to be lowered.
48 SPIRVType *lowerBuiltinType(const StructType *Type,
50  MachineIRBuilder &MIRBuilder,
51  SPIRVGlobalRegistry *GR);
52 } // namespace SPIRV
53 } // namespace llvm
54 #endif // LLVM_LIB_TARGET_SPIRV_SPIRVBUILTINS_H
llvm::SPIRV::lowerBuiltin
Optional< bool > lowerBuiltin(const StringRef DemangledCall, SPIRV::InstructionSet::InstructionSet Set, MachineIRBuilder &MIRBuilder, const Register OrigRet, const Type *OrigRetTy, const SmallVectorImpl< Register > &Args, SPIRVGlobalRegistry *GR)
Definition: SPIRVBuiltins.cpp:1724
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
CallLowering.h
MachineIRBuilder.h
llvm::AMDGPU::HSAMD::AccessQualifier
AccessQualifier
Access qualifiers.
Definition: AMDGPUMetadata.h:58
llvm::SPIRVType
const MachineInstr SPIRVType
Definition: SPIRVGlobalRegistry.h:25
llvm::SPIRV::lowerBuiltinType
SPIRVType * lowerBuiltinType(const StructType *OpaqueType, SPIRV::AccessQualifier::AccessQualifier AccessQual, MachineIRBuilder &MIRBuilder, SPIRVGlobalRegistry *GR)
Definition: SPIRVBuiltins.cpp:1984
SPIRVGlobalRegistry.h
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394