CIRCT 23.0.0git
Loading...
Searching...
No Matches
OMDialect.cpp
Go to the documentation of this file.
1//===- OMDialect.cpp - Object Model dialect definition --------------------===//
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 Object Model dialect definition.
10//
11//===----------------------------------------------------------------------===//
12
16#include "mlir/IR/Builders.h"
17
18#include "circt/Dialect/OM/OMDialect.cpp.inc"
19
20void circt::om::OMDialect::initialize() {
21 addOperations<
22#define GET_OP_LIST
23#include "circt/Dialect/OM/OM.cpp.inc"
24 >();
25
26 registerTypes();
27 registerAttributes();
28}
29
30mlir::Operation *
31circt::om::OMDialect::materializeConstant(mlir::OpBuilder &builder,
32 mlir::Attribute value,
33 mlir::Type type, mlir::Location loc) {
34 if (auto typedAttr = mlir::dyn_cast<mlir::TypedAttr>(value))
35 if (typedAttr.getType() == type)
36 return ConstantOp::create(builder, loc, typedAttr);
37 return nullptr;
38}
39
40// Provide implementations for the enums we use.
41#include "circt/Dialect/OM/OMEnums.cpp.inc"