11#include "mlir/IR/Builders.h"
12#include "mlir/IR/BuiltinAttributes.h"
13#include "mlir/IR/DialectImplementation.h"
14#include "llvm/ADT/TypeSwitch.h"
15#include "llvm/Support/Base64.h"
20AppIDPathAttr AppIDPathAttr::getParent() {
21 ArrayRef<AppIDAttr> path = getPath();
24 return AppIDPathAttr::get(getContext(), getRoot(), path.drop_back());
27Attribute BlobAttr::parse(AsmParser &odsParser,
Type odsType) {
29 if (odsParser.parseLess() || odsParser.parseString(&base64) ||
30 odsParser.parseGreater())
32 std::vector<char>
data;
33 if (
auto err = llvm::decodeBase64(base64, data)) {
34 llvm::handleAllErrors(std::move(err), [&](
const llvm::ErrorInfoBase &eib) {
35 odsParser.emitError(odsParser.getNameLoc(), eib.message());
39 ArrayRef<uint8_t> unsignedData(
reinterpret_cast<const uint8_t *
>(
data.data()),
41 return BlobAttr::get(odsParser.getBuilder().getContext(), unsignedData);
43void BlobAttr::print(AsmPrinter &odsPrinter)
const {
44 odsPrinter <<
"<\"" << llvm::encodeBase64(getData()) <<
"\">";
47#define GET_ATTRDEF_CLASSES
48#include "circt/Dialect/ESI/ESIAttributes.cpp.inc"
50void ESIDialect::registerAttributes() {
52#define GET_ATTRDEF_LIST
53#include "circt/Dialect/ESI/ESIAttributes.cpp.inc"
Root class of the ESI type system.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.