1 //===- BuiltinOps.h - MLIR Builtin 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 // This file contains the Builtin dialect's operations. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef MLIR_IR_BUILTINOPS_H_ 14 #define MLIR_IR_BUILTINOPS_H_ 15 16 #include "mlir/Bytecode/BytecodeOpInterface.h" 17 #include "mlir/IR/OpImplementation.h" 18 #include "mlir/IR/OwningOpRef.h" 19 #include "mlir/IR/RegionKindInterface.h" 20 #include "mlir/IR/SymbolTable.h" 21 #include "mlir/Interfaces/DataLayoutInterfaces.h" 22 #include "mlir/Interfaces/SideEffectInterfaces.h" 23 #include "llvm/Support/PointerLikeTypeTraits.h" 24 25 //===----------------------------------------------------------------------===// 26 // Dialect Operations 27 //===----------------------------------------------------------------------===// 28 29 #define GET_OP_CLASSES 30 #include "mlir/IR/BuiltinOps.h.inc" 31 32 namespace llvm { 33 /// Allow stealing the low bits of ModuleOp. 34 template <> 35 struct PointerLikeTypeTraits<mlir::ModuleOp> { 36 public: 37 static inline void *getAsVoidPointer(mlir::ModuleOp val) { 38 return const_cast<void *>(val.getAsOpaquePointer()); 39 } 40 static inline mlir::ModuleOp getFromVoidPointer(void *p) { 41 return mlir::ModuleOp::getFromOpaquePointer(p); 42 } 43 static constexpr int numLowBitsAvailable = 3; 44 }; 45 } // namespace llvm 46 47 #endif // MLIR_IR_BUILTINOPS_H_ 48