CIRCT 24.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 registerTypes();
22 registerAttributes();
23}
24
25mlir::Operation *
26circt::om::OMDialect::materializeConstant(mlir::OpBuilder &builder,
27 mlir::Attribute value,
28 mlir::Type type, mlir::Location loc) {
29 if (auto typedAttr = mlir::dyn_cast<mlir::TypedAttr>(value))
30 if (typedAttr.getType() == type)
31 return ConstantOp::create(builder, loc, typedAttr);
32 return nullptr;
33}
34
35// Provide implementations for the enums we use.
36#include "circt/Dialect/OM/OMEnums.cpp.inc"