Files
gps/tools/local/circt/include/mlir/Dialect/Func/IR/FuncOps.h.inc
T
2026-07-12 11:01:51 +03:00

1636 lines
78 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Op Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: FuncOps.td *|
|* *|
\*===----------------------------------------------------------------------===*/
namespace mlir::func {
/// indirect call operation
/// The `func.call_indirect` operation represents an indirect call to a value
/// of function type. The operands and result types of the call must match the
/// specified function type.
///
/// Function values can be created with the
/// [`func.constant` operation](#funcconstant-constantop).
///
/// Example:
///
/// ```mlir
/// %func = func.constant @my_func : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
/// %result = func.call_indirect %func(%0, %1) : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
/// ```
class CallIndirectOp;
} // namespace mlir::func
namespace mlir::func {
/// call operation
/// The `func.call` operation represents a direct call to a function that is
/// within the same symbol scope as the call. The operands and result types of
/// the call must match the specified function type. The callee is encoded as a
/// symbol reference attribute named "callee".
///
/// Example:
///
/// ```mlir
/// %2 = func.call @my_add(%0, %1) : (f32, f32) -> f32
/// ```
class CallOp;
} // namespace mlir::func
namespace mlir::func {
/// constant
/// The `func.constant` operation produces an SSA value from a symbol reference
/// to a `func.func` operation
///
/// Example:
///
/// ```mlir
/// // Reference to function @myfn.
/// %2 = func.constant @myfn : (tensor<16xf32>, f32) -> tensor<16xf32>
///
/// // Equivalent generic forms
/// %2 = "func.constant"() { value = @myfn } : () -> ((tensor<16xf32>, f32) -> tensor<16xf32>)
/// ```
///
/// MLIR does not allow direct references to functions in SSA operands because
/// the compiler is multithreaded, and disallowing SSA values to directly
/// reference a function simplifies this
/// ([rationale](../Rationale/Rationale.md#multithreading-the-compiler)).
class ConstantOp;
} // namespace mlir::func
namespace mlir::func {
/// An operation with a name containing a single `SSACFG` region
/// Operations within the function cannot implicitly capture values defined
/// outside of the function, i.e. Functions are `IsolatedFromAbove`. All
/// external references must use function arguments or attributes that establish
/// a symbolic connection (e.g. symbols referenced by name via a string
/// attribute like SymbolRefAttr). An external function declaration (used when
/// referring to a function declared in some other module) has no body. While
/// the MLIR textual form provides a nice inline syntax for function arguments,
/// they are internally represented as “block arguments” to the first block in
/// the region.
///
/// Only dialect attribute names may be specified in the attribute dictionaries
/// for function arguments, results, or the function itself.
///
/// Example:
///
/// ```mlir
/// // External function definitions.
/// func.func private @abort()
/// func.func private @scribble(i32, i64, memref<? x 128 x f32, #layout_map0>) -> f64
///
/// // A function that returns its argument twice:
/// func.func @count(%x: i64) -> (i64, i64)
/// attributes {fruit = "banana"} {
/// return %x, %x: i64, i64
/// }
///
/// // A function with an argument attribute
/// func.func private @example_fn_arg(%x: i32 {swift.self = unit})
///
/// // A function with a result attribute
/// func.func private @example_fn_result() -> (f64 {dialectName.attrName = 0 : i64})
///
/// // A function with an attribute
/// func.func private @example_fn_attr() attributes {dialectName.attrName = false}
/// ```
class FuncOp;
} // namespace mlir::func
namespace mlir::func {
/// Function return operation
/// The `func.return` operation represents a return operation within a function.
/// The operation takes variable number of operands and produces no results.
/// The operand number and types must match the signature of the function
/// that contains the operation.
///
/// Example:
///
/// ```mlir
/// func.func @foo() -> (i32, f8) {
/// ...
/// return %0, %1 : i32, f8
/// }
/// ```
class ReturnOp;
} // namespace mlir::func
#ifdef GET_OP_CLASSES
#undef GET_OP_CLASSES
namespace mlir::func {
//===----------------------------------------------------------------------===//
// ::mlir::func::CallIndirectOp declarations
//===----------------------------------------------------------------------===//
namespace detail {
class CallIndirectOpGenericAdaptorBase {
public:
struct Properties {
using arg_attrsTy = ::mlir::ArrayAttr;
arg_attrsTy arg_attrs;
auto getArgAttrs() const {
auto &propStorage = this->arg_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setArgAttrs(const ::mlir::ArrayAttr &propValue) {
this->arg_attrs = propValue;
}
using res_attrsTy = ::mlir::ArrayAttr;
res_attrsTy res_attrs;
auto getResAttrs() const {
auto &propStorage = this->res_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setResAttrs(const ::mlir::ArrayAttr &propValue) {
this->res_attrs = propValue;
}
bool operator==(const Properties &rhs) const {
return
rhs.arg_attrs == this->arg_attrs &&
rhs.res_attrs == this->res_attrs &&
true;
}
bool operator!=(const Properties &rhs) const {
return !(*this == rhs);
}
};
protected:
::mlir::DictionaryAttr odsAttrs;
::std::optional<::mlir::OperationName> odsOpName;
Properties properties;
::mlir::RegionRange odsRegions;
public:
CallIndirectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
odsOpName.emplace("func.call_indirect", odsAttrs.getContext());
}
CallIndirectOpGenericAdaptorBase(CallIndirectOp op);
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
const Properties &getProperties() {
return properties;
}
::mlir::DictionaryAttr getAttributes() {
return odsAttrs;
}
::mlir::ArrayAttr getArgAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
};
} // namespace detail
template <typename RangeT>
class CallIndirectOpGenericAdaptor : public detail::CallIndirectOpGenericAdaptorBase {
using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
using Base = detail::CallIndirectOpGenericAdaptorBase;
static constexpr int odsIndex_callee = 0;
static constexpr int odsIndex_callee_operands = 1;
public:
CallIndirectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
CallIndirectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CallIndirectOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
CallIndirectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CallIndirectOpGenericAdaptor(values, attrs, Properties{}, {}) {}
CallIndirectOpGenericAdaptor(RangeT values, const CallIndirectOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
template <typename LateInst = CallIndirectOp, typename = std::enable_if_t<std::is_same_v<LateInst, CallIndirectOp>>>
CallIndirectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return Base::getODSOperandIndexAndLength(index, odsOperands.size());
}
RangeT getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(odsOperands.begin(), valueRange.first),
std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
}
ValueT getCallee() {
return (*getODSOperands(0).begin());
}
RangeT getCalleeOperands() {
return getODSOperands(1);
}
RangeT getOperands() {
return odsOperands;
}
private:
RangeT odsOperands;
};
class CallIndirectOpAdaptor : public CallIndirectOpGenericAdaptor<::mlir::ValueRange> {
public:
using CallIndirectOpGenericAdaptor::CallIndirectOpGenericAdaptor;
CallIndirectOpAdaptor(CallIndirectOp op);
::llvm::LogicalResult verify(::mlir::Location loc);
};
class CallIndirectOp : public ::mlir::Op<CallIndirectOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ArgAndResultAttrsOpInterface::Trait, ::mlir::CallOpInterface::Trait> {
public:
using Op::Op;
using Op::print;
using Adaptor = CallIndirectOpAdaptor;
template <typename RangeT>
using GenericAdaptor = CallIndirectOpGenericAdaptor<RangeT>;
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
static constexpr int odsIndex_callee = 0;
static constexpr int odsIndex_callee_operands = 1;
using Properties = FoldAdaptor::Properties;
static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("res_attrs")};
return ::llvm::ArrayRef(attrNames);
}
::mlir::StringAttr getArgAttrsAttrName() {
return getAttributeNameForIndex(0);
}
static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 0);
}
::mlir::StringAttr getResAttrsAttrName() {
return getAttributeNameForIndex(1);
}
static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 1);
}
static constexpr ::llvm::StringLiteral getOperationName() {
return ::llvm::StringLiteral("func.call_indirect");
}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
::mlir::Operation::operand_range getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(getOperation()->operand_begin(), valueRange.first),
std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
}
::mlir::TypedValue<::mlir::FunctionType> getCallee() {
return ::llvm::cast<::mlir::TypedValue<::mlir::FunctionType>>(*getODSOperands(0).begin());
}
::mlir::Operation::operand_range getCalleeOperands() {
return getODSOperands(1);
}
::mlir::OpOperand &getCalleeMutable() {
auto range = getODSOperandIndexAndLength(0);
return getOperation()->getOpOperand(range.first);
}
::mlir::MutableOperandRange getCalleeOperandsMutable();
std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
::mlir::Operation::result_range getODSResults(unsigned index) {
auto valueRange = getODSResultIndexAndLength(index);
return {std::next(getOperation()->result_begin(), valueRange.first),
std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
}
::mlir::Operation::result_range getResults() {
return getODSResults(0);
}
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
static llvm::hash_code computePropertiesHash(const Properties &prop);
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
void writeProperties(::mlir::DialectBytecodeWriter &writer);
::mlir::ArrayAttr getArgAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
void setArgAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().arg_attrs = attr;
}
void setResAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().res_attrs = attr;
}
::mlir::Attribute removeArgAttrsAttr() {
auto attr = getProperties().arg_attrs;
getProperties().arg_attrs = {};
return attr;
}
::mlir::Attribute removeResAttrsAttr() {
auto attr = getProperties().res_attrs;
getProperties().res_attrs = {};
return attr;
}
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value callee, ValueRange operands = {});
static CallIndirectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value callee, ValueRange operands = {});
static CallIndirectOp create(::mlir::ImplicitLocOpBuilder &builder, Value callee, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::Value callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs);
static CallIndirectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::Value callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs);
static CallIndirectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::Value callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs);
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static CallIndirectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static CallIndirectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static CallIndirectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static CallIndirectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
::llvm::LogicalResult verifyInvariantsImpl();
::llvm::LogicalResult verifyInvariants();
static ::llvm::LogicalResult canonicalize(CallIndirectOp op, ::mlir::PatternRewriter &rewriter);
static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
void print(::mlir::OpAsmPrinter &_odsPrinter);
private:
::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
return getAttributeNameForIndex((*this)->getName(), index);
}
static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
assert(index < 2 && "invalid attribute index");
assert(name.getStringRef() == getOperationName() && "invalid operation name");
assert(name.isRegistered() && "Operation isn't registered, missing a "
"dependent dialect loading?");
return name.getAttributeNames()[index];
}
public:
// TODO: Remove once migrated callers.
ValueRange operands() { return getCalleeOperands(); }
/// Get the argument operands to the called function.
operand_range getArgOperands() {
return {arg_operand_begin(), arg_operand_end()};
}
MutableOperandRange getArgOperandsMutable() {
return getCalleeOperandsMutable();
}
operand_iterator arg_operand_begin() { return ++operand_begin(); }
operand_iterator arg_operand_end() { return operand_end(); }
/// Return the callee of this operation.
CallInterfaceCallable getCallableForCallee() { return getCallee(); }
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
setOperand(0, cast<Value>(callee));
}
};
} // namespace mlir::func
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::CallIndirectOp)
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::detail::CallIndirectOpGenericAdaptorBase::Properties)
namespace mlir::func {
//===----------------------------------------------------------------------===//
// ::mlir::func::CallOp declarations
//===----------------------------------------------------------------------===//
namespace detail {
class CallOpGenericAdaptorBase {
public:
struct Properties {
using arg_attrsTy = ::mlir::ArrayAttr;
arg_attrsTy arg_attrs;
auto getArgAttrs() const {
auto &propStorage = this->arg_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setArgAttrs(const ::mlir::ArrayAttr &propValue) {
this->arg_attrs = propValue;
}
using calleeTy = ::mlir::FlatSymbolRefAttr;
calleeTy callee;
auto getCallee() const {
auto &propStorage = this->callee;
return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage);
}
void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) {
this->callee = propValue;
}
using no_inlineTy = ::mlir::UnitAttr;
no_inlineTy no_inline;
auto getNoInline() const {
auto &propStorage = this->no_inline;
return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage);
}
void setNoInline(const ::mlir::UnitAttr &propValue) {
this->no_inline = propValue;
}
using res_attrsTy = ::mlir::ArrayAttr;
res_attrsTy res_attrs;
auto getResAttrs() const {
auto &propStorage = this->res_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setResAttrs(const ::mlir::ArrayAttr &propValue) {
this->res_attrs = propValue;
}
bool operator==(const Properties &rhs) const {
return
rhs.arg_attrs == this->arg_attrs &&
rhs.callee == this->callee &&
rhs.no_inline == this->no_inline &&
rhs.res_attrs == this->res_attrs &&
true;
}
bool operator!=(const Properties &rhs) const {
return !(*this == rhs);
}
};
protected:
::mlir::DictionaryAttr odsAttrs;
::std::optional<::mlir::OperationName> odsOpName;
Properties properties;
::mlir::RegionRange odsRegions;
public:
CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
odsOpName.emplace("func.call", odsAttrs.getContext());
}
CallOpGenericAdaptorBase(CallOp op);
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
const Properties &getProperties() {
return properties;
}
::mlir::DictionaryAttr getAttributes() {
return odsAttrs;
}
::mlir::FlatSymbolRefAttr getCalleeAttr() {
auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee);
return attr;
}
::llvm::StringRef getCallee();
::mlir::ArrayAttr getArgAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
::mlir::UnitAttr getNoInlineAttr();
bool getNoInline();
};
} // namespace detail
template <typename RangeT>
class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase {
using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
using Base = detail::CallOpGenericAdaptorBase;
static constexpr int odsIndex_operands = 0;
public:
CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CallOpGenericAdaptor(values, attrs, Properties{}, {}) {}
CallOpGenericAdaptor(RangeT values, const CallOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
template <typename LateInst = CallOp, typename = std::enable_if_t<std::is_same_v<LateInst, CallOp>>>
CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return Base::getODSOperandIndexAndLength(index, odsOperands.size());
}
RangeT getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(odsOperands.begin(), valueRange.first),
std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
}
RangeT getOperands() {
return getODSOperands(0);
}
private:
RangeT odsOperands;
};
class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> {
public:
using CallOpGenericAdaptor::CallOpGenericAdaptor;
CallOpAdaptor(CallOp op);
::llvm::LogicalResult verify(::mlir::Location loc);
};
class CallOp : public ::mlir::Op<CallOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ArgAndResultAttrsOpInterface::Trait, ::mlir::CallOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::SymbolUserOpInterface::Trait> {
public:
using Op::Op;
using Op::print;
using Adaptor = CallOpAdaptor;
template <typename RangeT>
using GenericAdaptor = CallOpGenericAdaptor<RangeT>;
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
static constexpr int odsIndex_operands = 0;
using Properties = FoldAdaptor::Properties;
static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("callee"), ::llvm::StringRef("no_inline"), ::llvm::StringRef("res_attrs")};
return ::llvm::ArrayRef(attrNames);
}
::mlir::StringAttr getArgAttrsAttrName() {
return getAttributeNameForIndex(0);
}
static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 0);
}
::mlir::StringAttr getCalleeAttrName() {
return getAttributeNameForIndex(1);
}
static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 1);
}
::mlir::StringAttr getNoInlineAttrName() {
return getAttributeNameForIndex(2);
}
static ::mlir::StringAttr getNoInlineAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 2);
}
::mlir::StringAttr getResAttrsAttrName() {
return getAttributeNameForIndex(3);
}
static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 3);
}
static constexpr ::llvm::StringLiteral getOperationName() {
return ::llvm::StringLiteral("func.call");
}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
::mlir::Operation::operand_range getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(getOperation()->operand_begin(), valueRange.first),
std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
}
::mlir::Operation::operand_range getOperands() {
return getODSOperands(0);
}
::mlir::MutableOperandRange getOperandsMutable();
std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
::mlir::Operation::result_range getODSResults(unsigned index) {
auto valueRange = getODSResultIndexAndLength(index);
return {std::next(getOperation()->result_begin(), valueRange.first),
std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
}
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
static llvm::hash_code computePropertiesHash(const Properties &prop);
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
void writeProperties(::mlir::DialectBytecodeWriter &writer);
::mlir::FlatSymbolRefAttr getCalleeAttr() {
return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee);
}
::llvm::StringRef getCallee();
::mlir::ArrayAttr getArgAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
::mlir::UnitAttr getNoInlineAttr() {
return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_inline);
}
bool getNoInline();
void setCalleeAttr(::mlir::FlatSymbolRefAttr attr) {
getProperties().callee = attr;
}
void setCallee(::llvm::StringRef attrValue);
void setArgAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().arg_attrs = attr;
}
void setResAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().res_attrs = attr;
}
void setNoInlineAttr(::mlir::UnitAttr attr) {
getProperties().no_inline = attr;
}
void setNoInline(bool attrValue);
::mlir::Attribute removeArgAttrsAttr() {
auto attr = getProperties().arg_attrs;
getProperties().arg_attrs = {};
return attr;
}
::mlir::Attribute removeResAttrsAttr() {
auto attr = getProperties().res_attrs;
getProperties().res_attrs = {};
return attr;
}
::mlir::Attribute removeNoInlineAttr() {
auto attr = getProperties().no_inline;
getProperties().no_inline = {};
return attr;
}
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, FuncOp callee, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, FuncOp callee, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, SymbolRefAttr callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, SymbolRefAttr callee, TypeRange results, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, StringAttr callee, TypeRange results, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef callee, TypeRange results, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef callee, TypeRange results, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, FlatSymbolRefAttr callee, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, FlatSymbolRefAttr callee, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, FlatSymbolRefAttr callee, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, StringAttr callee, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, StringAttr callee, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, StringAttr callee, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, StringRef callee, ValueRange operands = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, StringRef callee, ValueRange operands = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, StringRef callee, ValueRange operands = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
::llvm::LogicalResult verifyInvariantsImpl();
::llvm::LogicalResult verifyInvariants();
::llvm::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable);
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
void print(::mlir::OpAsmPrinter &_odsPrinter);
private:
::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
return getAttributeNameForIndex((*this)->getName(), index);
}
static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
assert(index < 4 && "invalid attribute index");
assert(name.getStringRef() == getOperationName() && "invalid operation name");
assert(name.isRegistered() && "Operation isn't registered, missing a "
"dependent dialect loading?");
return name.getAttributeNames()[index];
}
public:
FunctionType getCalleeType();
/// Get the argument operands to the called function.
operand_range getArgOperands() {
return {arg_operand_begin(), arg_operand_end()};
}
MutableOperandRange getArgOperandsMutable() {
return getOperandsMutable();
}
operand_iterator arg_operand_begin() { return operand_begin(); }
operand_iterator arg_operand_end() { return operand_end(); }
/// Return the callee of this operation.
CallInterfaceCallable getCallableForCallee() {
return (*this)->getAttrOfType<SymbolRefAttr>("callee");
}
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
(*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
};
} // namespace mlir::func
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::CallOp)
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::detail::CallOpGenericAdaptorBase::Properties)
namespace mlir::func {
//===----------------------------------------------------------------------===//
// ::mlir::func::ConstantOp declarations
//===----------------------------------------------------------------------===//
namespace detail {
class ConstantOpGenericAdaptorBase {
public:
struct Properties {
using valueTy = ::mlir::FlatSymbolRefAttr;
valueTy value;
auto getValue() const {
auto &propStorage = this->value;
return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage);
}
void setValue(const ::mlir::FlatSymbolRefAttr &propValue) {
this->value = propValue;
}
bool operator==(const Properties &rhs) const {
return
rhs.value == this->value &&
true;
}
bool operator!=(const Properties &rhs) const {
return !(*this == rhs);
}
};
protected:
::mlir::DictionaryAttr odsAttrs;
::std::optional<::mlir::OperationName> odsOpName;
Properties properties;
::mlir::RegionRange odsRegions;
public:
ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
odsOpName.emplace("func.constant", odsAttrs.getContext());
}
ConstantOpGenericAdaptorBase(ConstantOp op);
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
return {index, 1};
}
const Properties &getProperties() {
return properties;
}
::mlir::DictionaryAttr getAttributes() {
return odsAttrs;
}
::mlir::FlatSymbolRefAttr getValueAttr() {
auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().value);
return attr;
}
::llvm::StringRef getValue();
};
} // namespace detail
template <typename RangeT>
class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase {
using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
using Base = detail::ConstantOpGenericAdaptorBase;
public:
ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConstantOpGenericAdaptor(values, attrs, Properties{}, {}) {}
ConstantOpGenericAdaptor(RangeT values, const ConstantOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
template <typename LateInst = ConstantOp, typename = std::enable_if_t<std::is_same_v<LateInst, ConstantOp>>>
ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return Base::getODSOperandIndexAndLength(index, odsOperands.size());
}
RangeT getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(odsOperands.begin(), valueRange.first),
std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
}
RangeT getOperands() {
return odsOperands;
}
private:
RangeT odsOperands;
};
class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> {
public:
using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor;
ConstantOpAdaptor(ConstantOp op);
::llvm::LogicalResult verify(::mlir::Location loc);
};
class ConstantOp : public ::mlir::Op<ConstantOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::Type>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> {
public:
using Op::Op;
using Op::print;
using Adaptor = ConstantOpAdaptor;
template <typename RangeT>
using GenericAdaptor = ConstantOpGenericAdaptor<RangeT>;
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
using Properties = FoldAdaptor::Properties;
using ::mlir::OpAsmOpInterface::Trait<ConstantOp>::getAsmBlockArgumentNames;
using ::mlir::OpAsmOpInterface::Trait<ConstantOp>::getAsmBlockNames;
using ::mlir::OpAsmOpInterface::Trait<ConstantOp>::getDefaultDialect;
static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")};
return ::llvm::ArrayRef(attrNames);
}
::mlir::StringAttr getValueAttrName() {
return getAttributeNameForIndex(0);
}
static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 0);
}
static constexpr ::llvm::StringLiteral getOperationName() {
return ::llvm::StringLiteral("func.constant");
}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return {index, 1};
}
::mlir::Operation::operand_range getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(getOperation()->operand_begin(), valueRange.first),
std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
}
std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
return {index, 1};
}
::mlir::Operation::result_range getODSResults(unsigned index) {
auto valueRange = getODSResultIndexAndLength(index);
return {std::next(getOperation()->result_begin(), valueRange.first),
std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
}
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
static llvm::hash_code computePropertiesHash(const Properties &prop);
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
void writeProperties(::mlir::DialectBytecodeWriter &writer);
::mlir::FlatSymbolRefAttr getValueAttr() {
return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().value);
}
::llvm::StringRef getValue();
void setValueAttr(::mlir::FlatSymbolRefAttr attr) {
getProperties().value = attr;
}
void setValue(::llvm::StringRef attrValue);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::FlatSymbolRefAttr value);
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::FlatSymbolRefAttr value);
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::FlatSymbolRefAttr value);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr value);
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr value);
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr value);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef value);
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::llvm::StringRef value);
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::llvm::StringRef value);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
::llvm::LogicalResult verifyInvariantsImpl();
::llvm::LogicalResult verifyInvariants();
::mlir::OpFoldResult fold(FoldAdaptor adaptor);
::llvm::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable);
void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn);
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
void print(::mlir::OpAsmPrinter &_odsPrinter);
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
private:
::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
return getAttributeNameForIndex((*this)->getName(), index);
}
static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
assert(index < 1 && "invalid attribute index");
assert(name.getStringRef() == getOperationName() && "invalid operation name");
assert(name.isRegistered() && "Operation isn't registered, missing a "
"dependent dialect loading?");
return name.getAttributeNames()[index];
}
public:
/// Returns true if a constant operation can be built with the given value
/// and result type.
static bool isBuildableWith(Attribute value, Type type);
};
} // namespace mlir::func
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::ConstantOp)
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::detail::ConstantOpGenericAdaptorBase::Properties)
namespace mlir::func {
//===----------------------------------------------------------------------===//
// ::mlir::func::FuncOp declarations
//===----------------------------------------------------------------------===//
namespace detail {
class FuncOpGenericAdaptorBase {
public:
struct Properties {
using arg_attrsTy = ::mlir::ArrayAttr;
arg_attrsTy arg_attrs;
auto getArgAttrs() const {
auto &propStorage = this->arg_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setArgAttrs(const ::mlir::ArrayAttr &propValue) {
this->arg_attrs = propValue;
}
using function_typeTy = ::mlir::TypeAttr;
function_typeTy function_type;
auto getFunctionType() const {
auto &propStorage = this->function_type;
return ::llvm::cast<::mlir::TypeAttr>(propStorage);
}
void setFunctionType(const ::mlir::TypeAttr &propValue) {
this->function_type = propValue;
}
using no_inlineTy = ::mlir::UnitAttr;
no_inlineTy no_inline;
auto getNoInline() const {
auto &propStorage = this->no_inline;
return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage);
}
void setNoInline(const ::mlir::UnitAttr &propValue) {
this->no_inline = propValue;
}
using res_attrsTy = ::mlir::ArrayAttr;
res_attrsTy res_attrs;
auto getResAttrs() const {
auto &propStorage = this->res_attrs;
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage);
}
void setResAttrs(const ::mlir::ArrayAttr &propValue) {
this->res_attrs = propValue;
}
using sym_nameTy = ::mlir::StringAttr;
sym_nameTy sym_name;
auto getSymName() const {
auto &propStorage = this->sym_name;
return ::llvm::cast<::mlir::StringAttr>(propStorage);
}
void setSymName(const ::mlir::StringAttr &propValue) {
this->sym_name = propValue;
}
using sym_visibilityTy = ::mlir::StringAttr;
sym_visibilityTy sym_visibility;
auto getSymVisibility() const {
auto &propStorage = this->sym_visibility;
return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage);
}
void setSymVisibility(const ::mlir::StringAttr &propValue) {
this->sym_visibility = propValue;
}
bool operator==(const Properties &rhs) const {
return
rhs.arg_attrs == this->arg_attrs &&
rhs.function_type == this->function_type &&
rhs.no_inline == this->no_inline &&
rhs.res_attrs == this->res_attrs &&
rhs.sym_name == this->sym_name &&
rhs.sym_visibility == this->sym_visibility &&
true;
}
bool operator!=(const Properties &rhs) const {
return !(*this == rhs);
}
};
protected:
::mlir::DictionaryAttr odsAttrs;
::std::optional<::mlir::OperationName> odsOpName;
Properties properties;
::mlir::RegionRange odsRegions;
public:
FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
odsOpName.emplace("func.func", odsAttrs.getContext());
}
FuncOpGenericAdaptorBase(FuncOp op);
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
return {index, 1};
}
const Properties &getProperties() {
return properties;
}
::mlir::DictionaryAttr getAttributes() {
return odsAttrs;
}
::mlir::StringAttr getSymNameAttr() {
auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
return attr;
}
::llvm::StringRef getSymName();
::mlir::TypeAttr getFunctionTypeAttr() {
auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type);
return attr;
}
::mlir::FunctionType getFunctionType();
::mlir::StringAttr getSymVisibilityAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility);
return attr;
}
::std::optional< ::llvm::StringRef > getSymVisibility();
::mlir::ArrayAttr getArgAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
return attr;
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
::mlir::UnitAttr getNoInlineAttr();
bool getNoInline();
::mlir::Region &getBody() {
return *odsRegions[0];
}
::mlir::RegionRange getRegions() {
return odsRegions;
}
};
} // namespace detail
template <typename RangeT>
class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase {
using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
using Base = detail::FuncOpGenericAdaptorBase;
public:
FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FuncOpGenericAdaptor(values, attrs, Properties{}, {}) {}
FuncOpGenericAdaptor(RangeT values, const FuncOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
template <typename LateInst = FuncOp, typename = std::enable_if_t<std::is_same_v<LateInst, FuncOp>>>
FuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return Base::getODSOperandIndexAndLength(index, odsOperands.size());
}
RangeT getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(odsOperands.begin(), valueRange.first),
std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
}
RangeT getOperands() {
return odsOperands;
}
private:
RangeT odsOperands;
};
class FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> {
public:
using FuncOpGenericAdaptor::FuncOpGenericAdaptor;
FuncOpAdaptor(FuncOp op);
::llvm::LogicalResult verify(::mlir::Location loc);
};
class FuncOp : public ::mlir::Op<FuncOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AffineScope, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::SymbolOpInterface::Trait, ::mlir::ArgAndResultAttrsOpInterface::Trait, ::mlir::CallableOpInterface::Trait, ::mlir::FunctionOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpAsmOpInterface::Trait> {
public:
using Op::Op;
using Op::print;
using Adaptor = FuncOpAdaptor;
template <typename RangeT>
using GenericAdaptor = FuncOpGenericAdaptor<RangeT>;
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
using Properties = FoldAdaptor::Properties;
static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("no_inline"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility")};
return ::llvm::ArrayRef(attrNames);
}
::mlir::StringAttr getArgAttrsAttrName() {
return getAttributeNameForIndex(0);
}
static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 0);
}
::mlir::StringAttr getFunctionTypeAttrName() {
return getAttributeNameForIndex(1);
}
static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 1);
}
::mlir::StringAttr getNoInlineAttrName() {
return getAttributeNameForIndex(2);
}
static ::mlir::StringAttr getNoInlineAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 2);
}
::mlir::StringAttr getResAttrsAttrName() {
return getAttributeNameForIndex(3);
}
static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 3);
}
::mlir::StringAttr getSymNameAttrName() {
return getAttributeNameForIndex(4);
}
static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 4);
}
::mlir::StringAttr getSymVisibilityAttrName() {
return getAttributeNameForIndex(5);
}
static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) {
return getAttributeNameForIndex(name, 5);
}
static constexpr ::llvm::StringLiteral getOperationName() {
return ::llvm::StringLiteral("func.func");
}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return {index, 1};
}
::mlir::Operation::operand_range getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(getOperation()->operand_begin(), valueRange.first),
std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
}
std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
return {index, 1};
}
::mlir::Operation::result_range getODSResults(unsigned index) {
auto valueRange = getODSResultIndexAndLength(index);
return {std::next(getOperation()->result_begin(), valueRange.first),
std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
}
::mlir::Region &getBody() {
return (*this)->getRegion(0);
}
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
static llvm::hash_code computePropertiesHash(const Properties &prop);
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
void writeProperties(::mlir::DialectBytecodeWriter &writer);
::mlir::StringAttr getSymNameAttr() {
return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
}
::llvm::StringRef getSymName();
::mlir::TypeAttr getFunctionTypeAttr() {
return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type);
}
::mlir::FunctionType getFunctionType();
::mlir::StringAttr getSymVisibilityAttr() {
return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility);
}
::std::optional< ::llvm::StringRef > getSymVisibility();
::mlir::ArrayAttr getArgAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
}
::std::optional< ::mlir::ArrayAttr > getArgAttrs();
::mlir::ArrayAttr getResAttrsAttr() {
return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
}
::std::optional< ::mlir::ArrayAttr > getResAttrs();
::mlir::UnitAttr getNoInlineAttr() {
return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_inline);
}
bool getNoInline();
void setSymNameAttr(::mlir::StringAttr attr) {
getProperties().sym_name = attr;
}
void setSymName(::llvm::StringRef attrValue);
void setFunctionTypeAttr(::mlir::TypeAttr attr) {
getProperties().function_type = attr;
}
void setFunctionType(::mlir::FunctionType attrValue);
void setSymVisibilityAttr(::mlir::StringAttr attr) {
getProperties().sym_visibility = attr;
}
void setSymVisibility(::std::optional<::llvm::StringRef> attrValue);
void setArgAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().arg_attrs = attr;
}
void setResAttrsAttr(::mlir::ArrayAttr attr) {
getProperties().res_attrs = attr;
}
void setNoInlineAttr(::mlir::UnitAttr attr) {
getProperties().no_inline = attr;
}
void setNoInline(bool attrValue);
::mlir::Attribute removeSymVisibilityAttr() {
auto attr = getProperties().sym_visibility;
getProperties().sym_visibility = {};
return attr;
}
::mlir::Attribute removeArgAttrsAttr() {
auto attr = getProperties().arg_attrs;
getProperties().arg_attrs = {};
return attr;
}
::mlir::Attribute removeResAttrsAttr() {
auto attr = getProperties().res_attrs;
getProperties().res_attrs = {};
return attr;
}
::mlir::Attribute removeNoInlineAttr() {
auto attr = getProperties().no_inline;
getProperties().no_inline = {};
return attr;
}
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef<NamedAttribute> attrs = {}, ArrayRef<DictionaryAttr> argAttrs = {});
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, FunctionType type, ArrayRef<NamedAttribute> attrs = {}, ArrayRef<DictionaryAttr> argAttrs = {});
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, FunctionType type, ArrayRef<NamedAttribute> attrs = {}, ArrayRef<DictionaryAttr> argAttrs = {});
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline = nullptr);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline = false);
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
void print(::mlir::OpAsmPrinter &p);
::llvm::LogicalResult verifyInvariantsImpl();
::llvm::LogicalResult verifyInvariants();
::llvm::LogicalResult verifyRegions();
static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
private:
::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
return getAttributeNameForIndex((*this)->getName(), index);
}
static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
assert(index < 6 && "invalid attribute index");
assert(name.getStringRef() == getOperationName() && "invalid operation name");
assert(name.isRegistered() && "Operation isn't registered, missing a "
"dependent dialect loading?");
return name.getAttributeNames()[index];
}
public:
static FuncOp create(Location location, StringRef name, FunctionType type,
ArrayRef<NamedAttribute> attrs = {});
static FuncOp create(Location location, StringRef name, FunctionType type,
Operation::dialect_attr_range attrs);
static FuncOp create(Location location, StringRef name, FunctionType type,
ArrayRef<NamedAttribute> attrs,
ArrayRef<DictionaryAttr> argAttrs);
/// Create a deep copy of this function and all of its blocks, remapping any
/// operands that use values outside of the function using the map that is
/// provided (leaving them alone if no entry is present). If the mapper
/// contains entries for function arguments, these arguments are not
/// included in the new function. Replaces references to cloned sub-values
/// with the corresponding value that is copied, and adds those mappings to
/// the mapper.
FuncOp clone(IRMapping &mapper);
FuncOp clone();
/// Clone the internal blocks and attributes from this function into dest.
/// Any cloned blocks are appended to the back of dest. This function
/// asserts that the attributes of the current function and dest are
/// compatible.
void cloneInto(FuncOp dest, IRMapping &mapper);
//===------------------------------------------------------------------===//
// FunctionOpInterface Methods
//===------------------------------------------------------------------===//
/// Returns the region on the current operation that is callable. This may
/// return null in the case of an external callable object, e.g. an external
/// function.
::mlir::Region *getCallableRegion() { return isExternal() ? nullptr : &getBody(); }
/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }
/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }
//===------------------------------------------------------------------===//
// OpAsmOpInterface Methods
//===------------------------------------------------------------------===//
/// Allow the dialect prefix to be omitted.
static StringRef getDefaultDialect() { return "func"; }
//===------------------------------------------------------------------===//
// SymbolOpInterface Methods
//===------------------------------------------------------------------===//
bool isDeclaration() { return isExternal(); }
};
} // namespace mlir::func
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::FuncOp)
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::detail::FuncOpGenericAdaptorBase::Properties)
namespace mlir::func {
//===----------------------------------------------------------------------===//
// ::mlir::func::ReturnOp declarations
//===----------------------------------------------------------------------===//
namespace detail {
class ReturnOpGenericAdaptorBase {
public:
using Properties = ::mlir::EmptyProperties;
protected:
::mlir::DictionaryAttr odsAttrs;
::std::optional<::mlir::OperationName> odsOpName;
Properties properties;
::mlir::RegionRange odsRegions;
public:
ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
odsOpName.emplace("func.return", odsAttrs.getContext());
}
ReturnOpGenericAdaptorBase(ReturnOp op);
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
const Properties &getProperties() {
return properties;
}
::mlir::DictionaryAttr getAttributes() {
return odsAttrs;
}
};
} // namespace detail
template <typename RangeT>
class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase {
using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
using Base = detail::ReturnOpGenericAdaptorBase;
static constexpr int odsIndex_operands = 0;
public:
ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReturnOpGenericAdaptor(values, attrs, Properties{}, {}) {}
ReturnOpGenericAdaptor(RangeT values, const ReturnOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
template <typename LateInst = ReturnOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReturnOp>>>
ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
return Base::getODSOperandIndexAndLength(index, odsOperands.size());
}
RangeT getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(odsOperands.begin(), valueRange.first),
std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
}
RangeT getOperands() {
return getODSOperands(0);
}
private:
RangeT odsOperands;
};
class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> {
public:
using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor;
ReturnOpAdaptor(ReturnOp op);
::llvm::LogicalResult verify(::mlir::Location loc);
};
class ReturnOp : public ::mlir::Op<ReturnOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent<FuncOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> {
public:
using Op::Op;
using Op::print;
using Adaptor = ReturnOpAdaptor;
template <typename RangeT>
using GenericAdaptor = ReturnOpGenericAdaptor<RangeT>;
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
static constexpr int odsIndex_operands = 0;
using Properties = FoldAdaptor::Properties;
using ::mlir::RegionBranchTerminatorOpInterface::Trait<ReturnOp>::getMutableSuccessorOperands;
using ::mlir::RegionBranchTerminatorOpInterface::Trait<ReturnOp>::getSuccessorRegions;
static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
return {};
}
static constexpr ::llvm::StringLiteral getOperationName() {
return ::llvm::StringLiteral("func.return");
}
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
::mlir::Operation::operand_range getODSOperands(unsigned index) {
auto valueRange = getODSOperandIndexAndLength(index);
return {std::next(getOperation()->operand_begin(), valueRange.first),
std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
}
::mlir::Operation::operand_range getOperands() {
return getODSOperands(0);
}
::mlir::MutableOperandRange getOperandsMutable();
std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
return {index, 1};
}
::mlir::Operation::result_range getODSResults(unsigned index) {
auto valueRange = getODSResultIndexAndLength(index);
return {std::next(getOperation()->result_begin(), valueRange.first),
std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
}
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
static llvm::hash_code computePropertiesHash(const Properties &prop);
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState);
static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location);
static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder);
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands);
static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands);
static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands);
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
::llvm::LogicalResult verifyInvariantsImpl();
::llvm::LogicalResult verifyInvariants();
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
void print(::mlir::OpAsmPrinter &_odsPrinter);
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
public:
};
} // namespace mlir::func
MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::ReturnOp)
#endif // GET_OP_CLASSES