Loading [MathJax]/extensions/tex2jax.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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// ConstantTestOp
22//===----------------------------------------------------------------------===//
23
24mlir::OpFoldResult ConstantTestOp::fold(FoldAdaptor adaptor) {
25 return getValueAttr();
26}
27
28//===----------------------------------------------------------------------===//
29// GetHartIdOp
30//===----------------------------------------------------------------------===//
31
32mlir::OpFoldResult GetHartIdOp::fold(FoldAdaptor adaptor) {
33 if (auto cpuAttr = dyn_cast_or_null<CPUAttr>(adaptor.getCpu()))
34 return IntegerAttr::get(IndexType::get(getContext()), cpuAttr.getId());
35 return {};
36}
37
38//===----------------------------------------------------------------------===//
39// TableGen generated logic.
40//===----------------------------------------------------------------------===//
41
42// Provide the autogenerated implementation guts for the Op classes.
43#define GET_OP_CLASSES
44#include "circt/Dialect/RTGTest/IR/RTGTest.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.