14#include "mlir/IR/Builders.h"
15#include "mlir/IR/DialectImplementation.h"
16#include "llvm/ADT/TypeSwitch.h"
25#define GET_TYPEDEF_CLASSES
26#include "circt/Dialect/RTGTest/IR/RTGTestTypes.cpp.inc"
32bool IntegerRegisterType::isValidContentType(Type type)
const {
33 return llvm::isa<rtg::ImmediateType>(type);
36Attribute IntegerRegisterType::parseContentValue(llvm::StringRef valueString,
37 Type contentType)
const {
38 auto immType = dyn_cast<rtg::ImmediateType>(contentType);
43 if (valueString.getAsInteger(16, intValue))
46 if (intValue.getBitWidth() < immType.getWidth()) {
47 intValue = intValue.zext(immType.getWidth());
49 if (!intValue.isIntN(immType.getWidth()))
51 intValue = intValue.trunc(immType.getWidth());
54 return rtg::ImmediateAttr::get(getContext(), intValue);
57std::string IntegerRegisterType::getIntrinsicLabel(Attribute value,
58 llvm::StringRef
id)
const {
59 return "spike.pre.printreg.x" +
61 cast<rtg::RegisterAttrInterface>(value).getClassIndex()) +
69void circt::rtgtest::RTGTestDialect::registerTypes() {
71#define GET_TYPEDEF_LIST
72#include "circt/Dialect/RTGTest/IR/RTGTestTypes.cpp.inc"
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.