CIRCT 21.0.0git
Loading...
Searching...
No Matches
RTGTestOps.cpp
Go to the documentation of this file.
1//===- RTGTestOps.cpp - Implement the RTG operations ----------------------===//
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 RTGTest ops.
10//
11//===----------------------------------------------------------------------===//
12
14#include "mlir/IR/Builders.h"
15#include "llvm/ADT/APInt.h"
16
17using namespace circt;
18using namespace rtgtest;
19
20//===----------------------------------------------------------------------===//
21// CPUDeclOp
22//===----------------------------------------------------------------------===//
23
24mlir::OpFoldResult CPUDeclOp::fold(FoldAdaptor adaptor) { return getId(); }
25
26//===----------------------------------------------------------------------===//
27// ImmediateOp
28//===----------------------------------------------------------------------===//
29
30mlir::OpFoldResult ImmediateOp::fold(FoldAdaptor adaptor) {
31 return getImmAttr();
32}
33
34LogicalResult ImmediateOp::inferReturnTypes(
35 MLIRContext *context, std::optional<Location> loc, ValueRange operands,
36 DictionaryAttr attributes, OpaqueProperties properties,
37 mlir::RegionRange regions, SmallVectorImpl<Type> &inferredReturnTypes) {
38 inferredReturnTypes.push_back(
39 cast<TypedAttr>(properties.as<Properties *>()->getImm()).getType());
40 return success();
41}
42
43//===----------------------------------------------------------------------===//
44// ConstantTestOp
45//===----------------------------------------------------------------------===//
46
47mlir::OpFoldResult ConstantTestOp::fold(FoldAdaptor adaptor) {
48 return getValueAttr();
49}
50
51//===----------------------------------------------------------------------===//
52// TableGen generated logic.
53//===----------------------------------------------------------------------===//
54
55// Provide the autogenerated implementation guts for the Op classes.
56#define GET_OP_CLASSES
57#include "circt/Dialect/RTGTest/IR/RTGTest.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.