CIRCT  20.0.0git
SimDialect.cpp
Go to the documentation of this file.
1 //===- SimDialect.cpp - Implement the Sim 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 Sim dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "circt/Dialect/HW/HWOps.h"
16 #include "mlir/IR/Builders.h"
17 #include "mlir/IR/BuiltinTypes.h"
18 #include "mlir/IR/DialectImplementation.h"
19 
20 using namespace circt;
21 using namespace sim;
22 
23 //===----------------------------------------------------------------------===//
24 // Dialect specification.
25 //===----------------------------------------------------------------------===//
26 
27 void SimDialect::initialize() {
28  addOperations<
29 #define GET_OP_LIST
30 #include "circt/Dialect/Sim/Sim.cpp.inc"
31  >();
32 
33  registerTypes();
34 }
35 
36 #include "circt/Dialect/Sim/SimDialect.cpp.inc"
37 
38 Operation *SimDialect::materializeConstant(::mlir::OpBuilder &builder,
39  ::mlir::Attribute value,
40  ::mlir::Type type,
41  ::mlir::Location loc) {
42 
43  if (auto fmtStrType = llvm::dyn_cast<FormatStringType>(type))
44  return builder.create<FormatLitOp>(loc, fmtStrType,
45  llvm::cast<StringAttr>(value));
46  return nullptr;
47 }
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21