xref: /freebsd/contrib/llvm-project/llvm/lib/Target/DirectX/DXILOpBuilder.h (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1 //===- DXILOpBuilder.h - Helper class for build DIXLOp functions ----------===//
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 /// \file This file contains class to help build DXIL op functions.
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_LIB_TARGET_DIRECTX_DXILOPBUILDER_H
13 #define LLVM_LIB_TARGET_DIRECTX_DXILOPBUILDER_H
14 
15 #include "DXILConstants.h"
16 #include "llvm/ADT/SmallVector.h"
17 
18 namespace llvm {
19 class Module;
20 class IRBuilderBase;
21 class CallInst;
22 class Value;
23 class Type;
24 class FunctionType;
25 class Use;
26 
27 namespace dxil {
28 
29 class DXILOpBuilder {
30 public:
31   DXILOpBuilder(Module &M, IRBuilderBase &B) : M(M), B(B) {}
32   /// Create an instruction that calls DXIL Op with return type, specified
33   /// opcode, and call arguments. \param OpCode Opcode of the DXIL Op call
34   /// constructed \param ReturnTy Return type of the DXIL Op call constructed
35   /// \param OverloadTy Overload type of the DXIL Op call constructed
36   /// \return DXIL Op call constructed
37   CallInst *createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
38                              Type *OverloadTy, SmallVector<Value *> Args);
39   Type *getOverloadTy(dxil::OpCode OpCode, FunctionType *FT);
40   static const char *getOpCodeName(dxil::OpCode DXILOp);
41 
42 private:
43   Module &M;
44   IRBuilderBase &B;
45 };
46 
47 } // namespace dxil
48 } // namespace llvm
49 
50 #endif
51