22#include <mlir/CAPI/Registration.h>
23#include <mlir/CAPI/Wrap.h>
34MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Felt, llzk__felt,
FeltDialect)
45 if (mlirTypeIsNull(type)) {
46 return MlirAttribute {
nullptr};
52 return wrap(FeltConstAttr::get(unwrap(ctx), llvm::DynamicAPInt(value)));
61 MlirContext ctx, MlirStringRef str, MlirStringRef fieldName
64 if (mlirTypeIsNull(type)) {
65 return MlirAttribute {
nullptr};
75 MlirContext ctx,
const uint64_t *parts, intptr_t nParts, MlirType type
77 assert(nParts >= 0 &&
"part count must be non-negative");
78 assert((parts || nParts == 0) &&
"non-empty parts must not be null");
85 MlirContext ctx,
const uint64_t *parts, intptr_t nParts, MlirStringRef fieldName
88 if (mlirTypeIsNull(type)) {
89 return MlirAttribute {
nullptr};
95 MlirContext ctx,
const uint64_t *parts, intptr_t nParts
103 MlirContext ctx, MlirIdentifier fieldName, MlirStringRef primeStr
109 MlirContext ctx, MlirIdentifier fieldName,
const uint64_t *parts, intptr_t nParts
111 assert(nParts >= 0 &&
"part count must be non-negative");
112 assert((parts || nParts == 0) &&
"non-empty parts must not be null");
114 FieldSpecAttr::getChecked(
115 UnknownLoc::get(unwrap(ctx)), unwrap(ctx), unwrap(fieldName),
116 llvm::ArrayRef(parts, nParts)
128 UnknownLoc::get(unwrap(ctx)), unwrap(ctx), StringAttr::get(unwrap(ctx), unwrap(fieldName))
This file implements helpers for DynamicAPInt operations and conversions that LLVM does not provide.
MlirAttribute llzkFelt_FieldSpecAttrGet(MlirContext ctx, MlirIdentifier fieldName, MlirStringRef prime)
Create a llzk::felt::FieldSpecAttr Attribute with the given parameters.
MlirAttribute llzkFelt_FeltConstAttrGet(MlirContext ctx, MlirStringRef rawValue, MlirType type)
Create a llzk::felt::FeltConstAttr Attribute with the given parameters.
MlirAttribute llzkFelt_FeltConstAttrGetFromPartsInField(MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
MlirType llzkFelt_FeltTypeGetUnspecified(MlirContext ctx)
Gets the llzk::felt::FeltType without the field specified.
MlirAttribute llzkFelt_FeltConstAttrGetFromString(MlirContext ctx, MlirStringRef str, MlirType type)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in the specifie...
MlirAttribute llzkFelt_FeltConstAttrGetFromInt64InField(MlirContext ctx, int64_t value, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in the specified field.
MlirAttribute llzkFelt_FieldSpecAttrGetFromString(MlirContext ctx, MlirIdentifier fieldName, MlirStringRef primeStr)
Creates a llzk::felt::FieldSpecAttr from a base-10 representation of the prime.
MlirAttribute llzkFelt_FeltConstAttrGetFromPartsUnspecified(MlirContext ctx, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
MlirAttribute llzkFelt_FeltConstAttrGetFromInt64Unspecified(MlirContext ctx, int64_t value)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in an unspecified field.
MlirAttribute llzkFelt_FieldSpecAttrGetFromParts(MlirContext ctx, MlirIdentifier fieldName, const uint64_t *parts, intptr_t nParts)
Creates a llzk::felt::FieldSpecAttr from 64-bit parts in LSB order.
MlirAttribute llzkFelt_FeltConstAttrGetFromStringUnspecified(MlirContext ctx, MlirStringRef str)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in an unspecifi...
MlirType llzkFelt_FeltTypeGetFromRef(MlirContext ctx, MlirStringRef fieldName)
Gets a llzk::felt::FeltType referring to an already defined field.
MlirAttribute llzkFelt_FeltConstAttrGetFromParts(MlirContext ctx, const uint64_t *parts, intptr_t nParts, MlirType type)
Creates a llzk::felt::FeltConstAttr from 64-bit parts in LSB order.
MlirAttribute llzkFelt_FeltConstAttrGetFromInt64(MlirContext ctx, int64_t value, MlirType type)
Creates a llzk::felt::FeltConstAttr from a signed 64-bit integer in the specified field.
MlirAttribute llzkFelt_FeltConstAttrGetFromStringInField(MlirContext ctx, MlirStringRef str, MlirStringRef fieldName)
Creates a llzk::felt::FeltConstAttr from a base-10 representation of a signed integer in the specifie...
LLZK felt (Field ELemenT) type and operations.
static FeltType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::mlir::StringAttr fieldName)
static FeltType get(::mlir::MLIRContext *context, ::mlir::StringAttr fieldName)
auto unwrap_cast(auto &from)