CIRCT 22.0.0git
Loading...
Searching...
No Matches
ESIDialect.cpp
Go to the documentation of this file.
1//===- ESIDialect.cpp - ESI dialect code defs -------------------*- 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// Dialect definitions. Should be relatively standard boilerplate.
10//
11//===----------------------------------------------------------------------===//
12
21#include "circt/Support/LLVM.h"
22#include "mlir/IR/Builders.h"
23#include "mlir/IR/DialectImplementation.h"
24#include "mlir/IR/ImplicitLocOpBuilder.h"
25#include "llvm/ADT/DenseMap.h"
26#include "llvm/ADT/StringMap.h"
27#include "llvm/ADT/StringSet.h"
28#include "llvm/Support/FormatVariadic.h"
29
30using namespace circt;
31using namespace circt::esi;
32
33void ESIDialect::initialize() {
34 registerAttributes();
35 registerTypes();
36 addOperations<
37#define GET_OP_LIST
38#include "circt/Dialect/ESI/ESI.cpp.inc"
39 >();
40}
41
42Operation *ESIDialect::materializeConstant(OpBuilder &builder, Attribute value,
43 Type type, Location loc) {
44 if (isa<mlir::UnitAttr>(value))
45 return hw::ConstantOp::create(builder, loc, builder.getI1Type(), 1);
46 return builder.getContext()
47 ->getOrLoadDialect<hw::HWDialect>()
48 ->materializeConstant(builder, value, type, loc);
49}
50
51// Provide implementations for the enums we use.
52#include "circt/Dialect/ESI/ESIEnums.cpp.inc"
53
54#include "circt/Dialect/ESI/ESIDialect.cpp.inc"
create(data_type, value)
Definition hw.py:433
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.