CIRCT  20.0.0git
HWArithDialect.cpp
Go to the documentation of this file.
1 //===- HWArithDialect.cpp - Implement the HWArith dialect -----------------===//
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 implements the HWArith dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
15 #include "mlir/IR/DialectImplementation.h"
16 #include "mlir/Transforms/InliningUtils.h"
17 
18 using namespace circt;
19 using namespace circt::hwarith;
20 
21 //===----------------------------------------------------------------------===//
22 // HWArithDialect Interfaces
23 //===----------------------------------------------------------------------===//
24 
25 namespace {
26 struct HWArithInlinerInterface : public mlir::DialectInlinerInterface {
27  using mlir::DialectInlinerInterface::DialectInlinerInterface;
28  // Operations in the hwarith dialect are always legal to inline since they are
29  // pure.
30  bool isLegalToInline(Operation *, Region *, bool, IRMapping &) const final {
31  return true;
32  }
33 };
34 } // namespace
35 
36 //===----------------------------------------------------------------------===//
37 // Dialect specification.
38 //===----------------------------------------------------------------------===//
39 
40 void HWArithDialect::initialize() {
41  // Register operations.
42  addOperations<
43 #define GET_OP_LIST
44 #include "circt/Dialect/HWArith/HWArith.cpp.inc"
45  >();
46 
47  // Register interface implementations
48  addInterfaces<HWArithInlinerInterface>();
49 }
50 
51 // Provide implementations for the enums we use.
52 #include "circt/Dialect/HWArith/HWArithEnums.cpp.inc"
53 
54 #include "circt/Dialect/HWArith/HWArithDialect.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21