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"
17 using namespace circt;
20 AppIDPathAttr AppIDPathAttr::getParent() {
21 ArrayRef<AppIDAttr> path = getPath();
27 Attribute 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);
43 void BlobAttr::print(AsmPrinter &odsPrinter)
const {
47 #define GET_ATTRDEF_CLASSES
48 #include "circt/Dialect/ESI/ESIAttributes.cpp.inc"
50 void ESIDialect::registerAttributes() {
52 #define GET_ATTRDEF_LIST
53 #include "circt/Dialect/ESI/ESIAttributes.cpp.inc"
Root class of the ESI type system.
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
void encodeBase64(const void *data, size_t size, std::string &out)