CIRCT 20.0.0git
Loading...
Searching...
No Matches
MooreDialect.cpp
Go to the documentation of this file.
1//===- MooreDialect.cpp - Implement the Moore 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 Moore dialect.
10//
11//===----------------------------------------------------------------------===//
12
15
16using namespace circt;
17using namespace circt::moore;
18
19//===----------------------------------------------------------------------===//
20// Dialect specification.
21//===----------------------------------------------------------------------===//
22
23void MooreDialect::initialize() {
24 // Register types and attributes.
25 registerTypes();
26 registerAttributes();
27
28 // Register operations.
29 addOperations<
30#define GET_OP_LIST
31#include "circt/Dialect/Moore/Moore.cpp.inc"
32 >();
33}
34
35Operation *MooreDialect::materializeConstant(OpBuilder &builder,
36 Attribute value, Type type,
37 Location loc) {
38 if (auto intType = dyn_cast<IntType>(type))
39 if (auto intValue = dyn_cast<FVIntegerAttr>(value))
40 return builder.create<ConstantOp>(loc, intType, intValue);
41 return nullptr;
42}
43
44#include "circt/Dialect/Moore/MooreDialect.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.