18#include <mlir/IR/Builders.h>
19#include <mlir/IR/DialectImplementation.h>
21#include <llvm/ADT/TypeSwitch.h>
26#define GET_TYPEDEF_CLASSES
30#define GET_ATTRDEF_CLASSES
44 auto podType = llvm::dyn_cast<PodType>(type);
50 SmallVector<AffineMapAttr> maps;
55 return llvm::all_of(podType.getRecords(), [](RecordAttr record) {
56 return llzk::canMaterializeValueCopy(record.getType());
61 auto podType = llvm::dyn_cast<PodType>(type);
65 for (RecordAttr record : podType.getRecords()) {
67 return "POD record '" + record.getName().getValue().str() +
71 return "POD copy requires affine-map instantiation operands that cannot be recovered";
76 auto podType = llvm::dyn_cast<PodType>(
source.getType());
82 for (RecordAttr record : podType.getRecords()) {
90 return destination.getResult();
100auto PODDialect::initialize() ->
void {
108 #define GET_TYPEDEF_LIST
113 #define GET_ATTRDEF_LIST
118 addInterfaces<LLZKDialectBytecodeInterface<PODDialect>, PODValueCopyDialectInterface>();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Dialect hook for materializing independent storage for mutable value types.
virtual std::string getValueCopyFailureReason(mlir::Type type) const
Explain why this dialect cannot copy type. Called only after support is rejected.
static NewPodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llzk::pod::InitializedRecords initialValues={})
static ReadPodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name)
static WritePodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value)
void collectPodMapAttrs(Type type, SmallVector< AffineMapAttr > &mapAttrs)
std::string getValueCopyFailureReason(Type type)
FailureOr< Value > materializeValueCopy(OpBuilder &builder, Location loc, Value source)
bool canMaterializeValueCopy(Type type)