xref: /llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h (revision 34a35a8b244243f5a4ad5d531007bccfeaa0b02e)
1 //===- FuncOps.h - Func Dialect Operations ----------------------*- 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 #ifndef MLIR_DIALECT_FUNC_IR_OPS_H
10 #define MLIR_DIALECT_FUNC_IR_OPS_H
11 
12 #include "mlir/Bytecode/BytecodeOpInterface.h"
13 #include "mlir/IR/Builders.h"
14 #include "mlir/IR/BuiltinTypes.h"
15 #include "mlir/IR/Dialect.h"
16 #include "mlir/IR/OpImplementation.h"
17 #include "mlir/IR/SymbolTable.h"
18 #include "mlir/Interfaces/CallInterfaces.h"
19 #include "mlir/Interfaces/ControlFlowInterfaces.h"
20 #include "mlir/Interfaces/FunctionInterfaces.h"
21 #include "mlir/Interfaces/InferTypeOpInterface.h"
22 #include "mlir/Interfaces/SideEffectInterfaces.h"
23 
24 namespace mlir {
25 class PatternRewriter;
26 } // namespace mlir
27 
28 #define GET_OP_CLASSES
29 #include "mlir/Dialect/Func/IR/FuncOps.h.inc"
30 
31 #include "mlir/Dialect/Func/IR/FuncOpsDialect.h.inc"
32 
33 namespace llvm {
34 
35 /// Allow stealing the low bits of FuncOp.
36 template <>
37 struct PointerLikeTypeTraits<mlir::func::FuncOp> {
38   static inline void *getAsVoidPointer(mlir::func::FuncOp val) {
39     return const_cast<void *>(val.getAsOpaquePointer());
40   }
41   static inline mlir::func::FuncOp getFromVoidPointer(void *p) {
42     return mlir::func::FuncOp::getFromOpaquePointer(p);
43   }
44   static constexpr int numLowBitsAvailable = 3;
45 };
46 } // namespace llvm
47 
48 #endif // MLIR_DIALECT_FUNC_IR_OPS_H
49