Loading [MathJax]/extensions/tex2jax.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RTGDialect.cpp
Go to the documentation of this file.
1//===- RTGDialect.cpp - Implement the RTG 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 RTG dialect.
10//
11//===----------------------------------------------------------------------===//
12
17#include "mlir/IR/Builders.h"
18#include "mlir/IR/BuiltinTypes.h"
19#include "mlir/IR/DialectImplementation.h"
20
21using namespace circt;
22using namespace rtg;
23
24//===----------------------------------------------------------------------===//
25// Dialect specification.
26//===----------------------------------------------------------------------===//
27
28void RTGDialect::initialize() {
29 registerAttributes();
30 registerTypes();
31 // Register operations.
32 addOperations<
33#define GET_OP_LIST
34#include "circt/Dialect/RTG/IR/RTG.cpp.inc"
35 >();
36}
37
38/// Registered hook to materialize a single constant operation from a given
39/// attribute value with the desired resultant type. This method should use
40/// the provided builder to create the operation without changing the
41/// insertion position. The generated operation is expected to be constant
42/// like, i.e. single result, zero operands, non side-effecting, etc. On
43/// success, this hook should return the value generated to represent the
44/// constant value. Otherwise, it should return null on failure.
45Operation *RTGDialect::materializeConstant(OpBuilder &builder, Attribute value,
46 Type type, Location loc) {
47 if (auto attr = dyn_cast<ImmediateAttr>(value))
48 if (type == attr.getType())
49 return builder.create<ConstantOp>(loc, attr);
50
51 return nullptr;
52}
53
54#include "circt/Dialect/RTG/IR/RTGEnums.cpp.inc"
55
56#include "circt/Dialect/RTG/IR/RTGDialect.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition rtg.py:1