xref: /freebsd/contrib/llvm-project/llvm/lib/Target/DirectX/DXILOpBuilder.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1972a253aSDimitry Andric //===- DXILOpBuilder.h - Helper class for build DIXLOp functions ----------===//
2972a253aSDimitry Andric //
3972a253aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4972a253aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5972a253aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6972a253aSDimitry Andric //
7972a253aSDimitry Andric //===----------------------------------------------------------------------===//
8972a253aSDimitry Andric ///
9972a253aSDimitry Andric /// \file This file contains class to help build DXIL op functions.
10972a253aSDimitry Andric //===----------------------------------------------------------------------===//
11972a253aSDimitry Andric 
12972a253aSDimitry Andric #ifndef LLVM_LIB_TARGET_DIRECTX_DXILOPBUILDER_H
13972a253aSDimitry Andric #define LLVM_LIB_TARGET_DIRECTX_DXILOPBUILDER_H
14972a253aSDimitry Andric 
15972a253aSDimitry Andric #include "DXILConstants.h"
16*0fca6ea1SDimitry Andric #include "llvm/ADT/SmallVector.h"
17972a253aSDimitry Andric 
18972a253aSDimitry Andric namespace llvm {
19972a253aSDimitry Andric class Module;
20972a253aSDimitry Andric class IRBuilderBase;
21972a253aSDimitry Andric class CallInst;
22972a253aSDimitry Andric class Value;
23972a253aSDimitry Andric class Type;
24972a253aSDimitry Andric class FunctionType;
25972a253aSDimitry Andric class Use;
26972a253aSDimitry Andric 
27bdd1243dSDimitry Andric namespace dxil {
28972a253aSDimitry Andric 
29972a253aSDimitry Andric class DXILOpBuilder {
30972a253aSDimitry Andric public:
DXILOpBuilder(Module & M,IRBuilderBase & B)31972a253aSDimitry Andric   DXILOpBuilder(Module &M, IRBuilderBase &B) : M(M), B(B) {}
32*0fca6ea1SDimitry Andric   /// Create an instruction that calls DXIL Op with return type, specified
33*0fca6ea1SDimitry Andric   /// opcode, and call arguments. \param OpCode Opcode of the DXIL Op call
34*0fca6ea1SDimitry Andric   /// constructed \param ReturnTy Return type of the DXIL Op call constructed
35*0fca6ea1SDimitry Andric   /// \param OverloadTy Overload type of the DXIL Op call constructed
36*0fca6ea1SDimitry Andric   /// \return DXIL Op call constructed
37*0fca6ea1SDimitry Andric   CallInst *createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
38*0fca6ea1SDimitry Andric                              Type *OverloadTy, SmallVector<Value *> Args);
39*0fca6ea1SDimitry Andric   Type *getOverloadTy(dxil::OpCode OpCode, FunctionType *FT);
40bdd1243dSDimitry Andric   static const char *getOpCodeName(dxil::OpCode DXILOp);
41972a253aSDimitry Andric 
42972a253aSDimitry Andric private:
43972a253aSDimitry Andric   Module &M;
44972a253aSDimitry Andric   IRBuilderBase &B;
45972a253aSDimitry Andric };
46972a253aSDimitry Andric 
47bdd1243dSDimitry Andric } // namespace dxil
48972a253aSDimitry Andric } // namespace llvm
49972a253aSDimitry Andric 
50972a253aSDimitry Andric #endif
51