51892 lines
2.4 MiB
Plaintext
51892 lines
2.4 MiB
Plaintext
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|
|
|* *|
|
|
|* Op Definitions *|
|
|
|* *|
|
|
|* Automatically generated file, do not edit! *|
|
|
|* From: LLVMOps.td *|
|
|
|* *|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
#ifdef GET_OP_LIST
|
|
#undef GET_OP_LIST
|
|
|
|
::mlir::LLVM::AShrOp,
|
|
::mlir::LLVM::AddOp,
|
|
::mlir::LLVM::AddrSpaceCastOp,
|
|
::mlir::LLVM::AddressOfOp,
|
|
::mlir::LLVM::AliasOp,
|
|
::mlir::LLVM::AllocaOp,
|
|
::mlir::LLVM::AndOp,
|
|
::mlir::LLVM::AtomicCmpXchgOp,
|
|
::mlir::LLVM::AtomicRMWOp,
|
|
::mlir::LLVM::BitcastOp,
|
|
::mlir::LLVM::BlockAddressOp,
|
|
::mlir::LLVM::BlockTagOp,
|
|
::mlir::LLVM::BrOp,
|
|
::mlir::LLVM::CallIntrinsicOp,
|
|
::mlir::LLVM::CallOp,
|
|
::mlir::LLVM::ComdatOp,
|
|
::mlir::LLVM::ComdatSelectorOp,
|
|
::mlir::LLVM::CondBrOp,
|
|
::mlir::LLVM::ConstantOp,
|
|
::mlir::LLVM::DSOLocalEquivalentOp,
|
|
::mlir::LLVM::ExtractElementOp,
|
|
::mlir::LLVM::ExtractValueOp,
|
|
::mlir::LLVM::FAddOp,
|
|
::mlir::LLVM::FCmpOp,
|
|
::mlir::LLVM::FDivOp,
|
|
::mlir::LLVM::FMulOp,
|
|
::mlir::LLVM::FNegOp,
|
|
::mlir::LLVM::FPExtOp,
|
|
::mlir::LLVM::FPToSIOp,
|
|
::mlir::LLVM::FPToUIOp,
|
|
::mlir::LLVM::FPTruncOp,
|
|
::mlir::LLVM::FRemOp,
|
|
::mlir::LLVM::FSubOp,
|
|
::mlir::LLVM::FenceOp,
|
|
::mlir::LLVM::FreezeOp,
|
|
::mlir::LLVM::GEPOp,
|
|
::mlir::LLVM::GlobalCtorsOp,
|
|
::mlir::LLVM::GlobalDtorsOp,
|
|
::mlir::LLVM::GlobalOp,
|
|
::mlir::LLVM::ICmpOp,
|
|
::mlir::LLVM::IFuncOp,
|
|
::mlir::LLVM::IndirectBrOp,
|
|
::mlir::LLVM::InlineAsmOp,
|
|
::mlir::LLVM::InsertElementOp,
|
|
::mlir::LLVM::InsertValueOp,
|
|
::mlir::LLVM::IntToPtrOp,
|
|
::mlir::LLVM::InvokeOp,
|
|
::mlir::LLVM::LLVMFuncOp,
|
|
::mlir::LLVM::LShrOp,
|
|
::mlir::LLVM::LandingpadOp,
|
|
::mlir::LLVM::LinkerOptionsOp,
|
|
::mlir::LLVM::LoadOp,
|
|
::mlir::LLVM::MetadataAsValueOp,
|
|
::mlir::LLVM::ModuleFlagsOp,
|
|
::mlir::LLVM::MulOp,
|
|
::mlir::LLVM::NamedMetadataOp,
|
|
::mlir::LLVM::NoneTokenOp,
|
|
::mlir::LLVM::OrOp,
|
|
::mlir::LLVM::PoisonOp,
|
|
::mlir::LLVM::PtrToAddrOp,
|
|
::mlir::LLVM::PtrToIntOp,
|
|
::mlir::LLVM::ResumeOp,
|
|
::mlir::LLVM::ReturnOp,
|
|
::mlir::LLVM::SDivOp,
|
|
::mlir::LLVM::SExtOp,
|
|
::mlir::LLVM::SIToFPOp,
|
|
::mlir::LLVM::SRemOp,
|
|
::mlir::LLVM::SelectOp,
|
|
::mlir::LLVM::ShlOp,
|
|
::mlir::LLVM::ShuffleVectorOp,
|
|
::mlir::LLVM::StoreOp,
|
|
::mlir::LLVM::SubOp,
|
|
::mlir::LLVM::SwitchOp,
|
|
::mlir::LLVM::TruncOp,
|
|
::mlir::LLVM::UDivOp,
|
|
::mlir::LLVM::UIToFPOp,
|
|
::mlir::LLVM::URemOp,
|
|
::mlir::LLVM::UndefOp,
|
|
::mlir::LLVM::UnreachableOp,
|
|
::mlir::LLVM::VaArgOp,
|
|
::mlir::LLVM::XOrOp,
|
|
::mlir::LLVM::ZExtOp,
|
|
::mlir::LLVM::ZeroOp
|
|
#endif // GET_OP_LIST
|
|
|
|
#ifdef GET_OP_CLASSES
|
|
#undef GET_OP_CLASSES
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Local Utility Method Definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps1(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isSignlessInteger())) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::cast<::mlir::VectorType>(type).getElementType().isSignlessInteger()))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be signless integer or LLVM dialect-compatible vector of signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps2(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::llvm::cast<::mlir::VectorType>(type).getElementType())))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM pointer type or LLVM dialect-compatible vector of LLVM pointer type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps3(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM pointer type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps4(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger()))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps5(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isSignlessInteger())) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be signless integer or LLVM pointer type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps6(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::LLVM::LLVMStructType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM structure type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps7(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || ((type.isSignlessInteger())) || ((!::mlir::LLVM::isScalableVectorType(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be floating point LLVM type or LLVM pointer type or signless integer or LLVM dialect-compatible fixed-length vector type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps8(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::mlir::LLVM::isCompatibleOuterType(type))) && (!((::llvm::isa<::mlir::LLVM::LLVMStructType, ::mlir::LLVM::LLVMArrayType>(type)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM-compatible non-aggregate type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps9(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::mlir::LLVM::isCompatibleOuterType(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of LLVM dialect-compatible type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps10(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::mlir::LLVM::isCompatibleOuterType(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM dialect-compatible type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps11(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(1)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 1-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps12(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::mlir::LLVM::isCompatibleVectorType(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM dialect-compatible vector type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps13(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::LLVM::LLVMStructType, ::mlir::LLVM::LLVMArrayType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM aggregate type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps14(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::isCompatibleFloatingPointType(::llvm::cast<::mlir::VectorType>(type).getElementType())))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be floating point LLVM type or LLVM dialect-compatible vector of floating point LLVM type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps15(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isSignlessInteger(1))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::cast<::mlir::VectorType>(type).getElementType().isSignlessInteger(1)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 1-bit signless integer or LLVM dialect-compatible vector of 1-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps16(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isSignlessInteger())) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::cast<::mlir::VectorType>(type).getElementType().isSignlessInteger()))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of signless integer or LLVM dialect-compatible vector of signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps17(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((type.isSignlessInteger())) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::cast<::mlir::VectorType>(type).getElementType().isSignlessInteger())))) || (((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::llvm::cast<::mlir::VectorType>(type).getElementType()))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be signless integer or LLVM dialect-compatible vector of signless integer or LLVM pointer type or LLVM dialect-compatible vector of LLVM pointer type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps18(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(!((::llvm::isa<::mlir::TokenType>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of any non-token type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps19(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::mlir::LLVM::isCompatibleOuterType(type))) && ((!::llvm::isa<::mlir::LLVM::LLVMVoidType, ::mlir::LLVM::LLVMFunctionType>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be primitive LLVM type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps20(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((mlir::LLVM::isLoadableType(type))) || ((::llvm::isa<::mlir::LLVM::PointerElementTypeInterface>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM type with size, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps21(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::LLVM::LLVMMetadataType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be LLVM metadata type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_LLVMOps22(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::TokenType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be token, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps1(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: unit attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps1(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps1(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps2(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: flat symbol reference attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps2(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps2(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps3(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: any type attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps3(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps3(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps4(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: string attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps4(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps4(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps5(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM Linkage specification";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps5(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps5(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps6(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps6(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps6(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps7(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM GlobalValue Visibility";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps7(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps7(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps8(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 64-bit signless integer attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps8(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps8(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps9(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: Atomic ordering for LLVM's memory model";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps9(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps9(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps10(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM dialect access group metadata array";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps10(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps10(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps11(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM dialect alias scope array";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps11(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps11(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps12(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM dialect TBAA tag metadata array";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps12(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps12(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps13(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::AtomicBinOpAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: llvm.atomicrmw binary operations";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps13(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps13(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps14(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::BlockAddressAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps14(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps14(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps15(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::BlockTagAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps15(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps15(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps16(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps16(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps16(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps17(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM fastmath flags";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps17(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps17(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps18(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: i32 dense array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps18(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps18(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps19(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps19(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps19(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps20(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: Array of dictionary attributes";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps20(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps20(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps21(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: type attribute of LLVM function type";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps21(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps21(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps22(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::CConvAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM Calling Convention specification";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps22(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps22(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps23(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::TailCallKindAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM Calling Convention specification";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps23(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps23(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps24(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::MemoryEffectsAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps24(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps24(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps25(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::DictionaryAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: dictionary of named attribute values";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps25(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps25(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps26(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::comdat::ComdatAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM Comdat Types";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps26(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps26(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps27(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((true)))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: any attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps27(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps27(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps28(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: i64 dense array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps28(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps28(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps29(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::FCmpPredicateAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: llvm.fcmp comparison predicate";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps29(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps29(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps30(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: flat symbol ref array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps30(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps30(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps31(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit integer array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps31(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps31(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps32(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative()))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps32(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps32(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps33(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: symbol reference attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps33(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps33(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps34(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::DIGlobalVariableExpressionAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: an array of variable expressions";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps34(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps34(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps35(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::ICmpPredicateAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: llvm.icmp comparison predicate";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps35(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps35(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps36(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::AsmDialectAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ATT (0) or Intel (1) asm dialect";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps36(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps36(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps37(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::DereferenceableAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM dereferenceable attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps37(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps37(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps38(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::VScaleRangeAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps38(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps38(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps39(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::FramePointerKindAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps39(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps39(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps40(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::TargetFeaturesAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM target features attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps40(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps40(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps41(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: bool attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps41(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps41(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps42(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::DenormalFPEnvAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps42(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps42(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps43(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::VecTypeHintAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: Explicit vectorization compiler hint";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps43(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps43(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps44(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps44(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps44(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps45(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::LLVM::UWTableKindAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: ";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps45(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps45(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps46(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: string array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps46(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps46(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps47(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::LLVM::MDStringAttr>(attr))) || ((::llvm::isa<::mlir::LLVM::MDConstantAttr>(attr))) || ((::llvm::isa<::mlir::LLVM::MDFuncAttr>(attr))) || ((::llvm::isa<::mlir::LLVM::MDNodeAttr>(attr)))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: LLVM metadata attribute (md_string, md_const, md_func, or md_node)";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps47(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps47(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps48(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((true))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: integer elements attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps48(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_LLVMOps48(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_prop_constraint_LLVMOps1(
|
|
::mlir::LLVM::IntegerOverflowFlags prop, ::llvm::StringRef propName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (!(((static_cast<uint32_t>(prop) & ~3) == 0)))
|
|
return emitError() << "property '" << propName
|
|
<< "' failed to satisfy constraint: LLVM integer overflow flags";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_prop_constraint_LLVMOps1(
|
|
::mlir::Operation *op, ::mlir::LLVM::IntegerOverflowFlags prop, ::llvm::StringRef propName) {
|
|
return __mlir_ods_local_prop_constraint_LLVMOps1(prop, propName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_prop_constraint_LLVMOps2(
|
|
::mlir::LLVM::GEPNoWrapFlags prop, ::llvm::StringRef propName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (!(((static_cast<uint32_t>(prop) & ~7) == 0)))
|
|
return emitError() << "property '" << propName
|
|
<< "' failed to satisfy constraint: ::mlir::LLVM::GEPNoWrapFlags";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_prop_constraint_LLVMOps2(
|
|
::mlir::Operation *op, ::mlir::LLVM::GEPNoWrapFlags prop, ::llvm::StringRef propName) {
|
|
return __mlir_ods_local_prop_constraint_LLVMOps2(prop, propName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_LLVMOps1(
|
|
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
|
|
unsigned regionIndex) {
|
|
if (!((::llvm::hasNItems(region, 1)))) {
|
|
return op->emitOpError("region #") << regionIndex
|
|
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
|
|
<< "failed to verify constraint: region with 1 blocks";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_LLVMOps2(
|
|
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
|
|
unsigned regionIndex) {
|
|
if (!((true))) {
|
|
return op->emitOpError("region #") << regionIndex
|
|
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
|
|
<< "failed to verify constraint: any region";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AShrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AShrOpGenericAdaptorBase::AShrOpGenericAdaptorBase(AShrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr AShrOpGenericAdaptorBase::getIsExactAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isExact);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AShrOpGenericAdaptorBase::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AShrOpAdaptor::AShrOpAdaptor(AShrOp op) : AShrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AShrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (tblgen_isExact && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isExact))))
|
|
return emitError(loc, "'llvm.ashr' op attribute 'isExact' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.isExact;
|
|
auto attr = dict.get("isExact");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `isExact` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AShrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.isExact;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("isExact",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AShrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.isExact.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AShrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "isExact")
|
|
return prop.isExact;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AShrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "isExact") {
|
|
prop.isExact = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.isExact)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AShrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.isExact) attrs.append("isExact", prop.isExact);
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsExactAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "isExact", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.isExact)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AShrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.isExact);
|
|
}
|
|
|
|
bool AShrOp::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void AShrOp::setIsExact(bool attrValue) {
|
|
auto &odsProp = getProperties().isExact;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AShrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AShrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AShrOp AShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::verifyInvariantsImpl() {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_isExact, "isExact")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult AShrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AShrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("exact"))) {
|
|
result.getOrAddProperties<AShrOp::Properties>().isExact = parser.getBuilder().getUnitAttr(); }
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AShrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getIsExactAttr() && getIsExactAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "exact";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("isExact");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsExactAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("isExact");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void AShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AShrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AShrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AddOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_overflowFlags) & ~3) == 0)))
|
|
return emitError(loc, "'llvm.add' op property 'overflowFlags' failed to satisfy constraint: LLVM integer overflow flags");
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto customAttr = ::mlir::dyn_cast_if_present<::mlir::LLVM::IntegerOverflowFlagsAttr>(propAttr);
|
|
if (customAttr) {
|
|
propStorage = customAttr.getValue();
|
|
return ::mlir::success();
|
|
}
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected ::mlir::LLVM::IntegerOverflowFlagsAttr or IntegerAttr storage for ::mlir::LLVM::IntegerOverflowFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("overflowFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.overflowFlags, attr, [&]() {
|
|
return emitError() << "for `overflowFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.overflowFlags = ::mlir::LLVM::IntegerOverflowFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.overflowFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("overflowFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AddOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_value(prop.overflowFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void AddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps1(*this, tblgen_overflowFlags, "overflowFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult AddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
auto overflowFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
if (parser.parseOptionalKeyword("overflow")) {
|
|
return std::nullopt;
|
|
}
|
|
if (parser.parseLess()) {
|
|
return ::mlir::failure();
|
|
}
|
|
auto parseRes = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(parser);
|
|
if (::mlir::failed(parseRes) ||
|
|
::mlir::failed(parser.parseGreater())) {
|
|
return ::mlir::failure();
|
|
}
|
|
propStorage = *parseRes;
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<AddOp::Properties>().overflowFlags);
|
|
if (overflowFlagsPropParseResult.has_value() && failed(*overflowFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (overflowFlagsPropParseResult.has_value() && succeeded(*overflowFlagsPropParseResult)) {
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
if (getOverflowFlags() != ::mlir::LLVM::IntegerOverflowFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "overflow<" << getProperties().overflowFlags << ">";;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void AddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AddOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AddrSpaceCastOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AddrSpaceCastOpGenericAdaptorBase::AddrSpaceCastOpGenericAdaptorBase(AddrSpaceCastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
AddrSpaceCastOpAdaptor::AddrSpaceCastOpAdaptor(AddrSpaceCastOp op) : AddrSpaceCastOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AddrSpaceCastOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddrSpaceCastOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AddrSpaceCastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AddrSpaceCastOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AddrSpaceCastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AddrSpaceCastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void AddrSpaceCastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult AddrSpaceCastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddrSpaceCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<AddrSpaceCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<AddrSpaceCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void AddrSpaceCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddrSpaceCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddrSpaceCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddrSpaceCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddrSpaceCastOp AddrSpaceCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AddrSpaceCastOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddrSpaceCastOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult AddrSpaceCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddrSpaceCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void AddrSpaceCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddrSpaceCastOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AddressOfOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AddressOfOpGenericAdaptorBase::AddressOfOpGenericAdaptorBase(AddressOfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef AddressOfOpGenericAdaptorBase::getGlobalName() {
|
|
auto attr = getGlobalNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AddressOfOpAdaptor::AddressOfOpAdaptor(AddressOfOp op) : AddressOfOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AddressOfOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_global_name = getProperties().global_name; (void)tblgen_global_name;
|
|
if (!tblgen_global_name) return emitError(loc, "'llvm.mlir.addressof' op requires attribute 'global_name'");
|
|
|
|
if (tblgen_global_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_global_name))))
|
|
return emitError(loc, "'llvm.mlir.addressof' op attribute 'global_name' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddressOfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_name;
|
|
auto attr = dict.get("global_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AddressOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.global_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_name",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AddressOfOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.global_name.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AddressOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "global_name")
|
|
return prop.global_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AddressOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "global_name") {
|
|
prop.global_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_name)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AddressOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.global_name) attrs.append("global_name", prop.global_name);
|
|
}
|
|
|
|
::llvm::LogicalResult AddressOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "global_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddressOfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.global_name)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddressOfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.global_name);
|
|
}
|
|
|
|
::llvm::StringRef AddressOfOp::getGlobalName() {
|
|
auto attr = getGlobalNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void AddressOfOp::setGlobalName(::llvm::StringRef attrValue) {
|
|
getProperties().global_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, GlobalOp global, ArrayRef<NamedAttribute> attrs) {
|
|
build(odsBuilder, odsState,
|
|
LLVM::LLVMPointerType::get(odsBuilder.getContext(), global.getAddrSpace()),
|
|
global.getSymName());
|
|
odsState.addAttributes(attrs);
|
|
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, GlobalOp global, ArrayRef<NamedAttribute> attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(global)>(global), std::forward<decltype(attrs)>(attrs));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, GlobalOp global, ArrayRef<NamedAttribute> attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(global)>(global), std::forward<decltype(attrs)>(attrs));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFuncOp func, ArrayRef<NamedAttribute> attrs) {
|
|
build(odsBuilder, odsState,
|
|
LLVM::LLVMPointerType::get(odsBuilder.getContext()), func.getName());
|
|
odsState.addAttributes(attrs);
|
|
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFuncOp func, ArrayRef<NamedAttribute> attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(func)>(func), std::forward<decltype(attrs)>(attrs));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFuncOp func, ArrayRef<NamedAttribute> attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(func)>(func), std::forward<decltype(attrs)>(attrs));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AliasOp alias, ArrayRef<NamedAttribute> attrs) {
|
|
build(odsBuilder, odsState,
|
|
LLVM::LLVMPointerType::get(odsBuilder.getContext(), alias.getAddrSpace()),
|
|
alias.getSymName());
|
|
odsState.addAttributes(attrs);
|
|
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, AliasOp alias, ArrayRef<NamedAttribute> attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(alias)>(alias), std::forward<decltype(attrs)>(attrs));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, AliasOp alias, ArrayRef<NamedAttribute> attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(alias)>(alias), std::forward<decltype(attrs)>(attrs));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::FlatSymbolRefAttr global_name) {
|
|
odsState.getOrAddProperties<Properties>().global_name = global_name;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::FlatSymbolRefAttr global_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(global_name)>(global_name));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::FlatSymbolRefAttr global_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(global_name)>(global_name));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr global_name) {
|
|
odsState.getOrAddProperties<Properties>().global_name = global_name;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr global_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_name)>(global_name));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr global_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_name)>(global_name));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::llvm::StringRef global_name) {
|
|
odsState.getOrAddProperties<Properties>().global_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), global_name);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::llvm::StringRef global_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(global_name)>(global_name));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::llvm::StringRef global_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(global_name)>(global_name));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef global_name) {
|
|
odsState.getOrAddProperties<Properties>().global_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), global_name);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef global_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_name)>(global_name));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef global_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_name)>(global_name));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AddressOfOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AddressOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AddressOfOp::verifyInvariantsImpl() {
|
|
auto tblgen_global_name = getProperties().global_name; (void)tblgen_global_name;
|
|
if (!tblgen_global_name) return emitOpError("requires attribute 'global_name'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_global_name, "global_name")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AddressOfOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult AddressOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::FlatSymbolRefAttr global_nameAttr;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
if (parser.parseCustomAttributeWithFallback(global_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (global_nameAttr) result.getOrAddProperties<AddressOfOp::Properties>().global_name = global_nameAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(resRawType))
|
|
return ::mlir::failure();
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AddressOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getGlobalNameAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("global_name");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRes().getType();
|
|
}
|
|
|
|
void AddressOfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddressOfOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AddressOfOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AliasOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AliasOpGenericAdaptorBase::AliasOpGenericAdaptorBase(AliasOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::Type AliasOpGenericAdaptorBase::getAliasType() {
|
|
auto attr = getAliasTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::llvm::StringRef AliasOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::Linkage AliasOpGenericAdaptorBase::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
::mlir::UnitAttr AliasOpGenericAdaptorBase::getDsoLocalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AliasOpGenericAdaptorBase::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr AliasOpGenericAdaptorBase::getThreadLocal_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().thread_local_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AliasOpGenericAdaptorBase::getThreadLocal_() {
|
|
auto attr = getThreadLocal_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> AliasOpGenericAdaptorBase::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::VisibilityAttr AliasOpGenericAdaptorBase::getVisibility_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::Visibility AliasOpGenericAdaptorBase::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AliasOpAdaptor::AliasOpAdaptor(AliasOp op) : AliasOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AliasOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_alias_type = getProperties().alias_type; (void)tblgen_alias_type;
|
|
if (!tblgen_alias_type) return emitError(loc, "'llvm.mlir.alias' op requires attribute 'alias_type'");
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitError(loc, "'llvm.mlir.alias' op requires attribute 'linkage'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.mlir.alias' op requires attribute 'sym_name'");
|
|
auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (tblgen_alias_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_alias_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_alias_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'alias_type' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification");
|
|
|
|
if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'dso_local' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_thread_local_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_thread_local_))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'thread_local_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr");
|
|
|
|
if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_))))
|
|
return emitError(loc, "'llvm.mlir.alias' op attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_type;
|
|
auto attr = dict.get("alias_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dso_local;
|
|
auto attr = dict.get("dso_local");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.linkage;
|
|
auto attr = dict.get("linkage");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.thread_local_;
|
|
auto attr = dict.get("thread_local_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `thread_local_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto attr = dict.get("unnamed_addr");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.visibility_;
|
|
auto attr = dict.get("visibility_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AliasOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dso_local;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dso_local",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.linkage;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("linkage",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.thread_local_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("thread_local_",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unnamed_addr;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.visibility_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("visibility_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AliasOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.alias_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dso_local.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.linkage.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.thread_local_.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.visibility_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AliasOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "alias_type")
|
|
return prop.alias_type;
|
|
|
|
if (name == "dso_local")
|
|
return prop.dso_local;
|
|
|
|
if (name == "linkage")
|
|
return prop.linkage;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
|
|
if (name == "thread_local_")
|
|
return prop.thread_local_;
|
|
|
|
if (name == "unnamed_addr")
|
|
return prop.unnamed_addr;
|
|
|
|
if (name == "visibility_")
|
|
return prop.visibility_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AliasOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "alias_type") {
|
|
prop.alias_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dso_local") {
|
|
prop.dso_local = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dso_local)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "linkage") {
|
|
prop.linkage = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.linkage)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "thread_local_") {
|
|
prop.thread_local_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.thread_local_)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unnamed_addr") {
|
|
prop.unnamed_addr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unnamed_addr)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "visibility_") {
|
|
prop.visibility_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.visibility_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AliasOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.alias_type) attrs.append("alias_type", prop.alias_type);
|
|
|
|
if (prop.dso_local) attrs.append("dso_local", prop.dso_local);
|
|
|
|
if (prop.linkage) attrs.append("linkage", prop.linkage);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
|
|
if (prop.thread_local_) attrs.append("thread_local_", prop.thread_local_);
|
|
|
|
if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr);
|
|
|
|
if (prop.visibility_) attrs.append("visibility_", prop.visibility_);
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "alias_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "dso_local", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "linkage", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getThreadLocal_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "thread_local_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "unnamed_addr", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "visibility_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.alias_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.linkage)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.thread_local_)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AliasOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.alias_type);
|
|
|
|
writer.writeOptionalAttribute(prop.dso_local);
|
|
writer.writeAttribute(prop.linkage);
|
|
writer.writeAttribute(prop.sym_name);
|
|
|
|
writer.writeOptionalAttribute(prop.thread_local_);
|
|
|
|
writer.writeOptionalAttribute(prop.unnamed_addr);
|
|
|
|
writer.writeOptionalAttribute(prop.visibility_);
|
|
}
|
|
|
|
::mlir::Type AliasOp::getAliasType() {
|
|
auto attr = getAliasTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::llvm::StringRef AliasOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::Linkage AliasOp::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
bool AliasOp::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool AliasOp::getThreadLocal_() {
|
|
auto attr = getThreadLocal_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> AliasOp::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::Visibility AliasOp::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void AliasOp::setAliasType(::mlir::Type attrValue) {
|
|
getProperties().alias_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void AliasOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void AliasOp::setLinkage(::mlir::LLVM::Linkage attrValue) {
|
|
getProperties().linkage = ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AliasOp::setDsoLocal(bool attrValue) {
|
|
auto &odsProp = getProperties().dso_local;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AliasOp::setThreadLocal_(bool attrValue) {
|
|
auto &odsProp = getProperties().thread_local_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AliasOp::setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue) {
|
|
auto &odsProp = getProperties().unnamed_addr;
|
|
if (attrValue)
|
|
odsProp = ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AliasOp::setVisibility_(::mlir::LLVM::Visibility attrValue) {
|
|
getProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, Linkage linkage, StringRef name, bool dsoLocal, bool thread_local_, ArrayRef<NamedAttribute> attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(name)>(name), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(attrs)>(attrs));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, Linkage linkage, StringRef name, bool dsoLocal, bool thread_local_, ArrayRef<NamedAttribute> attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(name)>(name), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(attrs)>(attrs));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
odsState.getOrAddProperties<Properties>().alias_type = alias_type;
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = thread_local_;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
odsState.getOrAddProperties<Properties>().alias_type = alias_type;
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = thread_local_;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr alias_type, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
odsState.getOrAddProperties<Properties>().alias_type = ::mlir::TypeAttr::get(alias_type);
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
odsState.getOrAddProperties<Properties>().alias_type = ::mlir::TypeAttr::get(alias_type);
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type alias_type, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(alias_type)>(alias_type), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
for (unsigned i = 0; i != 1; ++i)
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AliasOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AliasOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
for (unsigned i = 0; i != 1; ++i)
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AliasOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AliasOp AliasOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AliasOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.visibility_)
|
|
properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default);
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::verifyInvariantsImpl() {
|
|
auto tblgen_alias_type = getProperties().alias_type; (void)tblgen_alias_type;
|
|
if (!tblgen_alias_type) return emitOpError("requires attribute 'alias_type'");
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitOpError("requires attribute 'linkage'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_alias_type, "alias_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_linkage, "linkage")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_dso_local, "dso_local")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_thread_local_, "thread_local_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_unnamed_addr, "unnamed_addr")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_visibility_, "visibility_")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps1(*this, region, "initializer", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult AliasOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.alias_type;
|
|
auto alias_typeAttrName = ::mlir::StringAttr::get(ctx, "alias_type");
|
|
auto attr = dict.get(alias_typeAttrName);
|
|
usedKeys.insert(alias_typeAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for alias_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.sym_name;
|
|
auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name");
|
|
auto attr = dict.get(sym_nameAttrName);
|
|
usedKeys.insert(sym_nameAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for sym_name in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.linkage;
|
|
auto linkageAttrName = ::mlir::StringAttr::get(ctx, "linkage");
|
|
auto attr = dict.get(linkageAttrName);
|
|
usedKeys.insert(linkageAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for linkage in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.dso_local;
|
|
auto dso_localAttrName = ::mlir::StringAttr::get(ctx, "dso_local");
|
|
auto attr = dict.get(dso_localAttrName);
|
|
usedKeys.insert(dso_localAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for dso_local in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.thread_local_;
|
|
auto thread_local_AttrName = ::mlir::StringAttr::get(ctx, "thread_local_");
|
|
auto attr = dict.get(thread_local_AttrName);
|
|
usedKeys.insert(thread_local_AttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for thread_local_ in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `thread_local_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto unnamed_addrAttrName = ::mlir::StringAttr::get(ctx, "unnamed_addr");
|
|
auto attr = dict.get(unnamed_addrAttrName);
|
|
usedKeys.insert(unnamed_addrAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for unnamed_addr in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.visibility_;
|
|
auto visibility_AttrName = ::mlir::StringAttr::get(ctx, "visibility_");
|
|
auto attr = dict.get(visibility_AttrName);
|
|
usedKeys.insert(visibility_AttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for visibility_ in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AliasOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AllocaOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AllocaOpGenericAdaptorBase::AllocaOpGenericAdaptorBase(AllocaOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::std::optional<uint64_t> AllocaOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::Type AllocaOpGenericAdaptorBase::getElemType() {
|
|
auto attr = getElemTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::mlir::UnitAttr AllocaOpGenericAdaptorBase::getInallocaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inalloca);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AllocaOpGenericAdaptorBase::getInalloca() {
|
|
auto attr = getInallocaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AllocaOpAdaptor::AllocaOpAdaptor(AllocaOp op) : AllocaOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AllocaOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type;
|
|
if (!tblgen_elem_type) return emitError(loc, "'llvm.alloca' op requires attribute 'elem_type'");
|
|
auto tblgen_inalloca = getProperties().inalloca; (void)tblgen_inalloca;
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.alloca' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_elem_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_elem_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_elem_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.alloca' op attribute 'elem_type' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_inalloca && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inalloca))))
|
|
return emitError(loc, "'llvm.alloca' op attribute 'inalloca' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.elem_type;
|
|
auto attr = dict.get("elem_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `elem_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.inalloca;
|
|
auto attr = dict.get("inalloca");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inalloca` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AllocaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.elem_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("elem_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.inalloca;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("inalloca",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AllocaOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.elem_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.inalloca.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AllocaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "elem_type")
|
|
return prop.elem_type;
|
|
|
|
if (name == "inalloca")
|
|
return prop.inalloca;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AllocaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "elem_type") {
|
|
prop.elem_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.elem_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "inalloca") {
|
|
prop.inalloca = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.inalloca)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AllocaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.elem_type) attrs.append("elem_type", prop.elem_type);
|
|
|
|
if (prop.inalloca) attrs.append("inalloca", prop.inalloca);
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getElemTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "elem_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInallocaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "inalloca", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.elem_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.inalloca)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AllocaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
writer.writeAttribute(prop.elem_type);
|
|
|
|
writer.writeOptionalAttribute(prop.inalloca);
|
|
}
|
|
|
|
::std::optional<uint64_t> AllocaOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::Type AllocaOp::getElemType() {
|
|
auto attr = getElemTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
bool AllocaOp::getInalloca() {
|
|
auto attr = getInallocaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void AllocaOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AllocaOp::setElemType(::mlir::Type attrValue) {
|
|
getProperties().elem_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void AllocaOp::setInalloca(bool attrValue) {
|
|
auto &odsProp = getProperties().inalloca;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Type elementType, Value arraySize, unsigned alignment) {
|
|
build(odsBuilder, odsState, resultType, arraySize,
|
|
alignment == 0 ? IntegerAttr()
|
|
: odsBuilder.getI64IntegerAttr(alignment),
|
|
elementType, false);
|
|
|
|
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, Type elementType, Value arraySize, unsigned alignment) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, Type elementType, Value arraySize, unsigned alignment) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
odsState.addOperands(arraySize);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().elem_type = elem_type;
|
|
if (inalloca) {
|
|
odsState.getOrAddProperties<Properties>().inalloca = inalloca;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
odsState.addOperands(arraySize);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().elem_type = elem_type;
|
|
if (inalloca) {
|
|
odsState.getOrAddProperties<Properties>().inalloca = inalloca;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
odsState.addOperands(arraySize);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().elem_type = ::mlir::TypeAttr::get(elem_type);
|
|
if (inalloca) {
|
|
odsState.getOrAddProperties<Properties>().inalloca = ((inalloca) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
odsState.addOperands(arraySize);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().elem_type = ::mlir::TypeAttr::get(elem_type);
|
|
if (inalloca) {
|
|
odsState.getOrAddProperties<Properties>().inalloca = ((inalloca) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, ::mlir::Type elem_type, /*optional*/bool inalloca) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arraySize)>(arraySize), std::forward<decltype(alignment)>(alignment), std::forward<decltype(elem_type)>(elem_type), std::forward<decltype(inalloca)>(inalloca));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AllocaOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AllocaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AllocaOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AllocaOp AllocaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::verifyInvariantsImpl() {
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type;
|
|
if (!tblgen_elem_type) return emitOpError("requires attribute 'elem_type'");
|
|
auto tblgen_inalloca = getProperties().inalloca; (void)tblgen_inalloca;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_elem_type, "elem_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_inalloca, "inalloca")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult AllocaOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.alignment;
|
|
auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment");
|
|
auto attr = dict.get(alignmentAttrName);
|
|
usedKeys.insert(alignmentAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for alignment in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.elem_type;
|
|
auto elem_typeAttrName = ::mlir::StringAttr::get(ctx, "elem_type");
|
|
auto attr = dict.get(elem_typeAttrName);
|
|
usedKeys.insert(elem_typeAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for elem_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `elem_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.inalloca;
|
|
auto inallocaAttrName = ::mlir::StringAttr::get(ctx, "inalloca");
|
|
auto attr = dict.get(inallocaAttrName);
|
|
usedKeys.insert(inallocaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for inalloca in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inalloca` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AllocaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSResultIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), getOperation()->getOpResult(idx), 0, false, ::mlir::SideEffects::AutomaticAllocationScopeResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AllocaOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AllocaOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AndOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AndOpGenericAdaptorBase::AndOpGenericAdaptorBase(AndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
AndOpAdaptor::AndOpAdaptor(AndOp op) : AndOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AndOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AndOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AndOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void AndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult AndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AndOp AndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AndOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AndOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult AndOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AndOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void AndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AndOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AtomicCmpXchgOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AtomicCmpXchgOpGenericAdaptorBase::AtomicCmpXchgOpGenericAdaptorBase(AtomicCmpXchgOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicCmpXchgOpGenericAdaptorBase::getSuccessOrdering() {
|
|
auto attr = getSuccessOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicCmpXchgOpGenericAdaptorBase::getFailureOrdering() {
|
|
auto attr = getFailureOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > AtomicCmpXchgOpGenericAdaptorBase::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> AtomicCmpXchgOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr AtomicCmpXchgOpGenericAdaptorBase::getWeakAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().weak);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AtomicCmpXchgOpGenericAdaptorBase::getWeak() {
|
|
auto attr = getWeakAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr AtomicCmpXchgOpGenericAdaptorBase::getVolatile_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AtomicCmpXchgOpGenericAdaptorBase::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AtomicCmpXchgOpAdaptor::AtomicCmpXchgOpAdaptor(AtomicCmpXchgOp op) : AtomicCmpXchgOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_failure_ordering = getProperties().failure_ordering; (void)tblgen_failure_ordering;
|
|
if (!tblgen_failure_ordering) return emitError(loc, "'llvm.cmpxchg' op requires attribute 'failure_ordering'");
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_success_ordering = getProperties().success_ordering; (void)tblgen_success_ordering;
|
|
if (!tblgen_success_ordering) return emitError(loc, "'llvm.cmpxchg' op requires attribute 'success_ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
auto tblgen_weak = getProperties().weak; (void)tblgen_weak;
|
|
|
|
if (tblgen_success_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_success_ordering))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'success_ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_failure_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_failure_ordering))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'failure_ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'syncscope' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_weak && !((::llvm::isa<::mlir::UnitAttr>(tblgen_weak))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'weak' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'volatile_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array");
|
|
|
|
if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.cmpxchg' op attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.access_groups;
|
|
auto attr = dict.get("access_groups");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto attr = dict.get("alias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.failure_ordering;
|
|
auto attr = dict.get("failure_ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `failure_ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto attr = dict.get("noalias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.success_ordering;
|
|
auto attr = dict.get("success_ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `success_ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.syncscope;
|
|
auto attr = dict.get("syncscope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `syncscope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tbaa;
|
|
auto attr = dict.get("tbaa");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.volatile_;
|
|
auto attr = dict.get("volatile_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `volatile_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.weak;
|
|
auto attr = dict.get("weak");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `weak` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AtomicCmpXchgOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.access_groups;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("access_groups",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.failure_ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("failure_ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noalias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.success_ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("success_ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.syncscope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("syncscope",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tbaa;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tbaa",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.volatile_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("volatile_",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.weak;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("weak",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AtomicCmpXchgOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.access_groups.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.failure_ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.success_ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.syncscope.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tbaa.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.volatile_.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.weak.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AtomicCmpXchgOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "access_groups")
|
|
return prop.access_groups;
|
|
|
|
if (name == "alias_scopes")
|
|
return prop.alias_scopes;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "failure_ordering")
|
|
return prop.failure_ordering;
|
|
|
|
if (name == "noalias_scopes")
|
|
return prop.noalias_scopes;
|
|
|
|
if (name == "success_ordering")
|
|
return prop.success_ordering;
|
|
|
|
if (name == "syncscope")
|
|
return prop.syncscope;
|
|
|
|
if (name == "tbaa")
|
|
return prop.tbaa;
|
|
|
|
if (name == "volatile_")
|
|
return prop.volatile_;
|
|
|
|
if (name == "weak")
|
|
return prop.weak;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "access_groups") {
|
|
prop.access_groups = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.access_groups)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alias_scopes") {
|
|
prop.alias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "failure_ordering") {
|
|
prop.failure_ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.failure_ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noalias_scopes") {
|
|
prop.noalias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noalias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "success_ordering") {
|
|
prop.success_ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.success_ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "syncscope") {
|
|
prop.syncscope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.syncscope)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tbaa") {
|
|
prop.tbaa = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tbaa)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "volatile_") {
|
|
prop.volatile_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.volatile_)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "weak") {
|
|
prop.weak = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.weak)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AtomicCmpXchgOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.access_groups) attrs.append("access_groups", prop.access_groups);
|
|
|
|
if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.failure_ordering) attrs.append("failure_ordering", prop.failure_ordering);
|
|
|
|
if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes);
|
|
|
|
if (prop.success_ordering) attrs.append("success_ordering", prop.success_ordering);
|
|
|
|
if (prop.syncscope) attrs.append("syncscope", prop.syncscope);
|
|
|
|
if (prop.tbaa) attrs.append("tbaa", prop.tbaa);
|
|
|
|
if (prop.volatile_) attrs.append("volatile_", prop.volatile_);
|
|
|
|
if (prop.weak) attrs.append("weak", prop.weak);
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "access_groups", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "alias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFailureOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "failure_ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "noalias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSuccessOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "success_ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "syncscope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "tbaa", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "volatile_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWeakAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "weak", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.failure_ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.success_ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.weak)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AtomicCmpXchgOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.access_groups);
|
|
|
|
writer.writeOptionalAttribute(prop.alias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
writer.writeAttribute(prop.failure_ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.noalias_scopes);
|
|
writer.writeAttribute(prop.success_ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.syncscope);
|
|
|
|
writer.writeOptionalAttribute(prop.tbaa);
|
|
|
|
writer.writeOptionalAttribute(prop.volatile_);
|
|
|
|
writer.writeOptionalAttribute(prop.weak);
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicCmpXchgOp::getSuccessOrdering() {
|
|
auto attr = getSuccessOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicCmpXchgOp::getFailureOrdering() {
|
|
auto attr = getFailureOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > AtomicCmpXchgOp::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> AtomicCmpXchgOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
bool AtomicCmpXchgOp::getWeak() {
|
|
auto attr = getWeakAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool AtomicCmpXchgOp::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setSuccessOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setFailureOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().syncscope;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setWeak(bool attrValue) {
|
|
auto &odsProp = getProperties().weak;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AtomicCmpXchgOp::setVolatile_(bool attrValue) {
|
|
auto &odsProp = getProperties().volatile_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value ptr, Value cmp, Value val, LLVM::AtomicOrdering successOrdering, LLVM::AtomicOrdering failureOrdering, StringRef syncscope, unsigned alignment, bool isWeak, bool isVolatile) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(successOrdering)>(successOrdering), std::forward<decltype(failureOrdering)>(failureOrdering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isWeak)>(isWeak), std::forward<decltype(isVolatile)>(isVolatile));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, Value ptr, Value cmp, Value val, LLVM::AtomicOrdering successOrdering, LLVM::AtomicOrdering failureOrdering, StringRef syncscope, unsigned alignment, bool isWeak, bool isVolatile) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(successOrdering)>(successOrdering), std::forward<decltype(failureOrdering)>(failureOrdering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isWeak)>(isWeak), std::forward<decltype(isVolatile)>(isVolatile));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = success_ordering;
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = failure_ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = weak;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = success_ordering;
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = failure_ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = weak;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = success_ordering;
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = failure_ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = weak;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering);
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering);
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering);
|
|
odsState.getOrAddProperties<Properties>().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (weak) {
|
|
odsState.getOrAddProperties<Properties>().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ptr)>(ptr), std::forward<decltype(cmp)>(cmp), std::forward<decltype(val)>(val), std::forward<decltype(success_ordering)>(success_ordering), std::forward<decltype(failure_ordering)>(failure_ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(weak)>(weak), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AtomicCmpXchgOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AtomicCmpXchgOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicCmpXchgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicCmpXchgOp AtomicCmpXchgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::verifyInvariantsImpl() {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_failure_ordering = getProperties().failure_ordering; (void)tblgen_failure_ordering;
|
|
if (!tblgen_failure_ordering) return emitOpError("requires attribute 'failure_ordering'");
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_success_ordering = getProperties().success_ordering; (void)tblgen_success_ordering;
|
|
if (!tblgen_success_ordering) return emitOpError("requires attribute 'success_ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
auto tblgen_weak = getProperties().weak; (void)tblgen_weak;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_success_ordering, "success_ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_failure_ordering, "failure_ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_syncscope, "syncscope")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_weak, "weak")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_volatile_, "volatile_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_access_groups, "access_groups")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_alias_scopes, "alias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_noalias_scopes, "noalias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_tbaa, "tbaa")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps6(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()((*this->getODSOperands(2).begin()).getType(), (*this->getODSOperands(1).begin()).getType()))))
|
|
return emitOpError("failed to verify that operand #1 and operand #2 have the same type");
|
|
if (!((std::equal_to<>()(getValAndBoolStructType((*this->getODSOperands(2).begin()).getType()), (*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that result #0 has an LLVM struct type consisting of the type of operand #2 and a bool");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicCmpXchgOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = getValAndBoolStructType(operands[2].getType());
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AtomicCmpXchgOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand ptrRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(&ptrRawOperand, 1); ::llvm::SMLoc ptrOperandsLoc;
|
|
(void)ptrOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand cmpRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cmpOperands(&cmpRawOperand, 1); ::llvm::SMLoc cmpOperandsLoc;
|
|
(void)cmpOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
|
|
(void)valOperandsLoc;
|
|
::mlir::StringAttr syncscopeAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr success_orderingAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr failure_orderingAttr;
|
|
::mlir::Type ptrRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> ptrTypes(&ptrRawType, 1);
|
|
::mlir::Type valRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("weak"))) {
|
|
result.getOrAddProperties<AtomicCmpXchgOp::Properties>().weak = parser.getBuilder().getUnitAttr(); }
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) {
|
|
result.getOrAddProperties<AtomicCmpXchgOp::Properties>().volatile_ = parser.getBuilder().getUnitAttr(); }
|
|
|
|
ptrOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(ptrRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
cmpOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(cmpRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
valOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (syncscopeAttr) result.getOrAddProperties<AtomicCmpXchgOp::Properties>().syncscope = syncscopeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"success_ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'success_ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "success_ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
success_orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<AtomicCmpXchgOp::Properties>().success_ordering = success_orderingAttr;
|
|
}
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"failure_ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'failure_ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "failure_ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
failure_orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<AtomicCmpXchgOp::Properties>().failure_ordering = failure_orderingAttr;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(ptrRawType))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valRawType = type;
|
|
}
|
|
for (::mlir::Type type : valTypes) {
|
|
(void)type;
|
|
if (!(((type.isSignlessInteger())) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))))) {
|
|
return parser.emitError(parser.getNameLoc()) << "'val' must be signless integer or LLVM pointer type, but got " << type;
|
|
}
|
|
}
|
|
result.addTypes(getValAndBoolStructType(valTypes[0]));
|
|
if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(cmpOperands, valTypes[0], cmpOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AtomicCmpXchgOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getWeakAttr() && getWeakAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "weak";
|
|
}
|
|
if ((getVolatile_Attr() && getVolatile_Attr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "volatile";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getPtr();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getCmp();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getVal();
|
|
if (getSyncscopeAttr()) {
|
|
_odsPrinter << ' ' << "syncscope";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getSyncscopeAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getSuccessOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getFailureOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("weak");
|
|
elidedAttrs.push_back("volatile_");
|
|
elidedAttrs.push_back("syncscope");
|
|
elidedAttrs.push_back("success_ordering");
|
|
elidedAttrs.push_back("failure_ordering");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getWeakAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("weak");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getVolatile_Attr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("volatile_");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getPtr().getType();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getVal().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicCmpXchgOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AtomicCmpXchgOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::AtomicRMWOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AtomicRMWOpGenericAdaptorBase::AtomicRMWOpGenericAdaptorBase(AtomicRMWOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::AtomicBinOp AtomicRMWOpGenericAdaptorBase::getBinOp() {
|
|
auto attr = getBinOpAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicRMWOpGenericAdaptorBase::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > AtomicRMWOpGenericAdaptorBase::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> AtomicRMWOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr AtomicRMWOpGenericAdaptorBase::getVolatile_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool AtomicRMWOpGenericAdaptorBase::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
AtomicRMWOpAdaptor::AtomicRMWOpAdaptor(AtomicRMWOp op) : AtomicRMWOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AtomicRMWOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_bin_op = getProperties().bin_op; (void)tblgen_bin_op;
|
|
if (!tblgen_bin_op) return emitError(loc, "'llvm.atomicrmw' op requires attribute 'bin_op'");
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
if (!tblgen_ordering) return emitError(loc, "'llvm.atomicrmw' op requires attribute 'ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (tblgen_bin_op && !((::llvm::isa<::mlir::LLVM::AtomicBinOpAttr>(tblgen_bin_op))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'bin_op' failed to satisfy constraint: llvm.atomicrmw binary operations");
|
|
|
|
if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'syncscope' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'volatile_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array");
|
|
|
|
if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.atomicrmw' op attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.access_groups;
|
|
auto attr = dict.get("access_groups");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto attr = dict.get("alias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.bin_op;
|
|
auto attr = dict.get("bin_op");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `bin_op` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto attr = dict.get("noalias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ordering;
|
|
auto attr = dict.get("ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.syncscope;
|
|
auto attr = dict.get("syncscope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `syncscope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tbaa;
|
|
auto attr = dict.get("tbaa");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.volatile_;
|
|
auto attr = dict.get("volatile_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `volatile_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute AtomicRMWOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.access_groups;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("access_groups",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.bin_op;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("bin_op",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noalias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.syncscope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("syncscope",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tbaa;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tbaa",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.volatile_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("volatile_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code AtomicRMWOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.access_groups.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.bin_op.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.syncscope.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tbaa.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.volatile_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AtomicRMWOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "access_groups")
|
|
return prop.access_groups;
|
|
|
|
if (name == "alias_scopes")
|
|
return prop.alias_scopes;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "bin_op")
|
|
return prop.bin_op;
|
|
|
|
if (name == "noalias_scopes")
|
|
return prop.noalias_scopes;
|
|
|
|
if (name == "ordering")
|
|
return prop.ordering;
|
|
|
|
if (name == "syncscope")
|
|
return prop.syncscope;
|
|
|
|
if (name == "tbaa")
|
|
return prop.tbaa;
|
|
|
|
if (name == "volatile_")
|
|
return prop.volatile_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AtomicRMWOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "access_groups") {
|
|
prop.access_groups = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.access_groups)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alias_scopes") {
|
|
prop.alias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "bin_op") {
|
|
prop.bin_op = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.bin_op)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noalias_scopes") {
|
|
prop.noalias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noalias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "ordering") {
|
|
prop.ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "syncscope") {
|
|
prop.syncscope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.syncscope)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tbaa") {
|
|
prop.tbaa = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tbaa)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "volatile_") {
|
|
prop.volatile_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.volatile_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void AtomicRMWOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.access_groups) attrs.append("access_groups", prop.access_groups);
|
|
|
|
if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.bin_op) attrs.append("bin_op", prop.bin_op);
|
|
|
|
if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes);
|
|
|
|
if (prop.ordering) attrs.append("ordering", prop.ordering);
|
|
|
|
if (prop.syncscope) attrs.append("syncscope", prop.syncscope);
|
|
|
|
if (prop.tbaa) attrs.append("tbaa", prop.tbaa);
|
|
|
|
if (prop.volatile_) attrs.append("volatile_", prop.volatile_);
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "access_groups", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "alias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBinOpAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "bin_op", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "noalias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "syncscope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "tbaa", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "volatile_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.bin_op)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AtomicRMWOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.access_groups);
|
|
|
|
writer.writeOptionalAttribute(prop.alias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
writer.writeAttribute(prop.bin_op);
|
|
|
|
writer.writeOptionalAttribute(prop.noalias_scopes);
|
|
writer.writeAttribute(prop.ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.syncscope);
|
|
|
|
writer.writeOptionalAttribute(prop.tbaa);
|
|
|
|
writer.writeOptionalAttribute(prop.volatile_);
|
|
}
|
|
|
|
::mlir::LLVM::AtomicBinOp AtomicRMWOp::getBinOp() {
|
|
auto attr = getBinOpAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering AtomicRMWOp::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > AtomicRMWOp::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> AtomicRMWOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
bool AtomicRMWOp::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void AtomicRMWOp::setBinOp(::mlir::LLVM::AtomicBinOp attrValue) {
|
|
getProperties().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AtomicRMWOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void AtomicRMWOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().syncscope;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AtomicRMWOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void AtomicRMWOp::setVolatile_(bool attrValue) {
|
|
auto &odsProp = getProperties().volatile_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVM::AtomicBinOp binOp, Value ptr, Value val, LLVM::AtomicOrdering ordering, StringRef syncscope, unsigned alignment, bool isVolatile) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(binOp)>(binOp), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVM::AtomicBinOp binOp, Value ptr, Value val, LLVM::AtomicOrdering ordering, StringRef syncscope, unsigned alignment, bool isVolatile) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(binOp)>(binOp), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = bin_op;
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = bin_op;
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = bin_op;
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op);
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op);
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(ptr);
|
|
odsState.addOperands(val);
|
|
odsState.getOrAddProperties<Properties>().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op);
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(bin_op)>(bin_op), std::forward<decltype(ptr)>(ptr), std::forward<decltype(val)>(val), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AtomicRMWOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<AtomicRMWOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AtomicRMWOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AtomicRMWOp AtomicRMWOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::verifyInvariantsImpl() {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_bin_op = getProperties().bin_op; (void)tblgen_bin_op;
|
|
if (!tblgen_bin_op) return emitOpError("requires attribute 'bin_op'");
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
if (!tblgen_ordering) return emitOpError("requires attribute 'ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_bin_op, "bin_op")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_ordering, "ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_syncscope, "syncscope")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_volatile_, "volatile_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_access_groups, "access_groups")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_alias_scopes, "alias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_noalias_scopes, "noalias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_tbaa, "tbaa")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps7(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps7(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()((*this->getODSOperands(1).begin()).getType(), (*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that result #0 and operand #1 have the same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult AtomicRMWOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 1)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[1].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AtomicRMWOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::LLVM::AtomicBinOpAttr bin_opAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand ptrRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(&ptrRawOperand, 1); ::llvm::SMLoc ptrOperandsLoc;
|
|
(void)ptrOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
|
|
(void)valOperandsLoc;
|
|
::mlir::StringAttr syncscopeAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr orderingAttr;
|
|
::mlir::Type ptrRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> ptrTypes(&ptrRawType, 1);
|
|
::mlir::Type valRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) {
|
|
result.getOrAddProperties<AtomicRMWOp::Properties>().volatile_ = parser.getBuilder().getUnitAttr(); }
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"xchg","add","sub","_and","nand","_or","_xor","max","min","umax","umin","fadd","fsub","fmax","fmin","uinc_wrap","udec_wrap","usub_cond","usub_sat","fmaximum","fminimum","fmaximumnum","fminimumnum"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"bin_op", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'bin_op' [xchg, add, sub, _and, nand, _or, _xor, max, min, umax, umin, fadd, fsub, fmax, fmin, uinc_wrap, udec_wrap, usub_cond, usub_sat, fmaximum, fminimum, fmaximumnum, fminimumnum]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicBinOp(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "bin_op attribute specification: \"" << attrStr << '"';;
|
|
|
|
bin_opAttr = ::mlir::LLVM::AtomicBinOpAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<AtomicRMWOp::Properties>().bin_op = bin_opAttr;
|
|
}
|
|
}
|
|
|
|
ptrOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(ptrRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
valOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (syncscopeAttr) result.getOrAddProperties<AtomicRMWOp::Properties>().syncscope = syncscopeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<AtomicRMWOp::Properties>().ordering = orderingAttr;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(ptrRawType))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valRawType = type;
|
|
}
|
|
for (::mlir::Type type : valTypes) {
|
|
(void)type;
|
|
if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || ((type.isSignlessInteger())) || ((!::mlir::LLVM::isScalableVectorType(type))))) {
|
|
return parser.emitError(parser.getNameLoc()) << "'val' must be floating point LLVM type or LLVM pointer type or signless integer or LLVM dialect-compatible fixed-length vector type, but got " << type;
|
|
}
|
|
}
|
|
result.addTypes(valTypes[0]);
|
|
if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AtomicRMWOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getVolatile_Attr() && getVolatile_Attr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "volatile";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getBinOp();
|
|
auto caseValueStr = stringifyAtomicBinOp(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getPtr();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getVal();
|
|
if (getSyncscopeAttr()) {
|
|
_odsPrinter << ' ' << "syncscope";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getSyncscopeAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("volatile_");
|
|
elidedAttrs.push_back("bin_op");
|
|
elidedAttrs.push_back("syncscope");
|
|
elidedAttrs.push_back("ordering");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getVolatile_Attr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("volatile_");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getPtr().getType();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getVal().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicRMWOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::AtomicRMWOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::BitcastOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(BitcastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : BitcastOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BitcastOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute BitcastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code BitcastOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> BitcastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void BitcastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void BitcastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult BitcastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BitcastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<BitcastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<BitcastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BitcastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<BitcastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult BitcastOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps8(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps8(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BitcastOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void BitcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BitcastOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::BlockAddressOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
BlockAddressOpGenericAdaptorBase::BlockAddressOpGenericAdaptorBase(BlockAddressOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::BlockAddressAttr BlockAddressOpGenericAdaptorBase::getBlockAddr() {
|
|
auto attr = getBlockAddrAttr();
|
|
return ::llvm::cast<::mlir::LLVM::BlockAddressAttr>(attr);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
BlockAddressOpAdaptor::BlockAddressOpAdaptor(BlockAddressOp op) : BlockAddressOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult BlockAddressOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_block_addr = getProperties().block_addr; (void)tblgen_block_addr;
|
|
if (!tblgen_block_addr) return emitError(loc, "'llvm.blockaddress' op requires attribute 'block_addr'");
|
|
|
|
if (tblgen_block_addr && !((::llvm::isa<::mlir::LLVM::BlockAddressAttr>(tblgen_block_addr))))
|
|
return emitError(loc, "'llvm.blockaddress' op attribute 'block_addr' failed to satisfy constraint: ");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockAddressOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.block_addr;
|
|
auto attr = dict.get("block_addr");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `block_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute BlockAddressOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.block_addr;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("block_addr",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code BlockAddressOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.block_addr.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> BlockAddressOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "block_addr")
|
|
return prop.block_addr;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void BlockAddressOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "block_addr") {
|
|
prop.block_addr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.block_addr)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void BlockAddressOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.block_addr) attrs.append("block_addr", prop.block_addr);
|
|
}
|
|
|
|
::llvm::LogicalResult BlockAddressOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBlockAddrAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps14(attr, "block_addr", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockAddressOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.block_addr)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BlockAddressOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.block_addr);
|
|
}
|
|
|
|
::mlir::LLVM::BlockAddressAttr BlockAddressOp::getBlockAddr() {
|
|
auto attr = getBlockAddrAttr();
|
|
return ::llvm::cast<::mlir::LLVM::BlockAddressAttr>(attr);
|
|
}
|
|
|
|
void BlockAddressOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
odsState.getOrAddProperties<Properties>().block_addr = block_addr;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(block_addr)>(block_addr));
|
|
auto __res__ = ::llvm::dyn_cast<BlockAddressOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(block_addr)>(block_addr));
|
|
}
|
|
|
|
void BlockAddressOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
odsState.getOrAddProperties<Properties>().block_addr = block_addr;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(block_addr)>(block_addr));
|
|
auto __res__ = ::llvm::dyn_cast<BlockAddressOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockAddressAttr block_addr) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(block_addr)>(block_addr));
|
|
}
|
|
|
|
void BlockAddressOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<BlockAddressOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BlockAddressOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BlockAddressOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<BlockAddressOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockAddressOp BlockAddressOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult BlockAddressOp::verifyInvariantsImpl() {
|
|
auto tblgen_block_addr = getProperties().block_addr; (void)tblgen_block_addr;
|
|
if (!tblgen_block_addr) return emitOpError("requires attribute 'block_addr'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps14(*this, tblgen_block_addr, "block_addr")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockAddressOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult BlockAddressOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::LLVM::BlockAddressAttr block_addrAttr;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
if (parser.parseCustomAttributeWithFallback(block_addrAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (block_addrAttr) result.getOrAddProperties<BlockAddressOp::Properties>().block_addr = block_addrAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(resRawType))
|
|
return ::mlir::failure();
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BlockAddressOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getBlockAddrAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("block_addr");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRes().getType();
|
|
}
|
|
|
|
void BlockAddressOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BlockAddressOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::BlockAddressOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::BlockTagOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
BlockTagOpGenericAdaptorBase::BlockTagOpGenericAdaptorBase(BlockTagOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::BlockTagAttr BlockTagOpGenericAdaptorBase::getTag() {
|
|
auto attr = getTagAttr();
|
|
return ::llvm::cast<::mlir::LLVM::BlockTagAttr>(attr);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
BlockTagOpAdaptor::BlockTagOpAdaptor(BlockTagOp op) : BlockTagOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult BlockTagOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_tag = getProperties().tag; (void)tblgen_tag;
|
|
if (!tblgen_tag) return emitError(loc, "'llvm.blocktag' op requires attribute 'tag'");
|
|
|
|
if (tblgen_tag && !((::llvm::isa<::mlir::LLVM::BlockTagAttr>(tblgen_tag))))
|
|
return emitError(loc, "'llvm.blocktag' op attribute 'tag' failed to satisfy constraint: ");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockTagOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tag;
|
|
auto attr = dict.get("tag");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tag` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute BlockTagOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.tag;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tag",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code BlockTagOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.tag.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> BlockTagOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "tag")
|
|
return prop.tag;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void BlockTagOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "tag") {
|
|
prop.tag = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tag)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void BlockTagOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.tag) attrs.append("tag", prop.tag);
|
|
}
|
|
|
|
::llvm::LogicalResult BlockTagOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTagAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(attr, "tag", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockTagOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.tag)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BlockTagOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.tag);
|
|
}
|
|
|
|
::mlir::LLVM::BlockTagAttr BlockTagOp::getTag() {
|
|
auto attr = getTagAttr();
|
|
return ::llvm::cast<::mlir::LLVM::BlockTagAttr>(attr);
|
|
}
|
|
|
|
void BlockTagOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::BlockTagAttr tag) {
|
|
odsState.getOrAddProperties<Properties>().tag = tag;
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::BlockTagAttr tag) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(tag)>(tag));
|
|
auto __res__ = ::llvm::dyn_cast<BlockTagOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::BlockTagAttr tag) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(tag)>(tag));
|
|
}
|
|
|
|
void BlockTagOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockTagAttr tag) {
|
|
odsState.getOrAddProperties<Properties>().tag = tag;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockTagAttr tag) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(tag)>(tag));
|
|
auto __res__ = ::llvm::dyn_cast<BlockTagOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::BlockTagAttr tag) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(tag)>(tag));
|
|
}
|
|
|
|
void BlockTagOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<BlockTagOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BlockTagOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BlockTagOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<BlockTagOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BlockTagOp BlockTagOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult BlockTagOp::verifyInvariantsImpl() {
|
|
auto tblgen_tag = getProperties().tag; (void)tblgen_tag;
|
|
if (!tblgen_tag) return emitOpError("requires attribute 'tag'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(*this, tblgen_tag, "tag")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BlockTagOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult BlockTagOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::LLVM::BlockTagAttr tagAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(tagAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (tagAttr) result.getOrAddProperties<BlockTagOp::Properties>().tag = tagAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BlockTagOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getTagAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("tag");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BlockTagOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::BlockTagOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::BrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
BrOpGenericAdaptorBase::BrOpGenericAdaptorBase(BrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> BrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LoopAnnotationAttr> BrOpGenericAdaptorBase::getLoopAnnotation() {
|
|
auto attr = getLoopAnnotationAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
BrOpAdaptor::BrOpAdaptor(BrOp op) : BrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult BrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation;
|
|
|
|
if (tblgen_loop_annotation && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(tblgen_loop_annotation))))
|
|
return emitError(loc, "'llvm.br' op attribute 'loop_annotation' failed to satisfy constraint: ");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> BrOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange BrOp::getDestOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult BrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.loop_annotation;
|
|
auto attr = dict.get("loop_annotation");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `loop_annotation` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute BrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.loop_annotation;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("loop_annotation",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code BrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.loop_annotation.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> BrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "loop_annotation")
|
|
return prop.loop_annotation;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void BrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "loop_annotation") {
|
|
prop.loop_annotation = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.loop_annotation)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void BrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.loop_annotation) attrs.append("loop_annotation", prop.loop_annotation);
|
|
}
|
|
|
|
::llvm::LogicalResult BrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLoopAnnotationAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(attr, "loop_annotation", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.loop_annotation)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.loop_annotation);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LoopAnnotationAttr> BrOp::getLoopAnnotation() {
|
|
auto attr = getLoopAnnotationAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *dest) {
|
|
build(odsBuilder, odsState, ValueRange(), dest);
|
|
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Block *dest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(dest)>(dest));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, Block *dest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(dest)>(dest));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, Block *dest) {
|
|
build(odsBuilder, odsState, operands, /*loop_annotation=*/{}, dest);
|
|
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange operands, Block *dest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(dest)>(dest));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange operands, Block *dest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(dest)>(dest));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addSuccessors(destinations);
|
|
odsState.addAttributes(attributes);
|
|
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
odsState.addOperands(destOperands);
|
|
if (loop_annotation) {
|
|
odsState.getOrAddProperties<Properties>().loop_annotation = loop_annotation;
|
|
}
|
|
odsState.addSuccessors(dest);
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destOperands)>(destOperands), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(dest)>(dest));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destOperands)>(destOperands), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(dest)>(dest));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
odsState.addOperands(destOperands);
|
|
if (loop_annotation) {
|
|
odsState.getOrAddProperties<Properties>().loop_annotation = loop_annotation;
|
|
}
|
|
odsState.addSuccessors(dest);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(destOperands)>(destOperands), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(dest)>(dest));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(destOperands)>(destOperands), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(dest)>(dest));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<BrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<BrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BrOp BrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult BrOp::verifyInvariantsImpl() {
|
|
auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(*this, tblgen_loop_annotation, "loop_annotation")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult BrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Block *destSuccessor = nullptr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> destOperandsOperands;
|
|
::llvm::SMLoc destOperandsOperandsLoc;
|
|
(void)destOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> destOperandsTypes;
|
|
|
|
if (parser.parseSuccessor(destSuccessor))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalLParen())) {
|
|
|
|
destOperandsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(destOperandsOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(destOperandsTypes))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
result.addSuccessors(destSuccessor);
|
|
if (parser.resolveOperands(destOperandsOperands, destOperandsTypes, destOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDest();
|
|
if (!getDestOperands().empty()) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getDestOperands();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestOperands().getTypes();
|
|
_odsPrinter << ")";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void BrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::BrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::CallIntrinsicOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
CallIntrinsicOpGenericAdaptorBase::CallIntrinsicOpGenericAdaptorBase(CallIntrinsicOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> CallIntrinsicOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::llvm::StringRef CallIntrinsicOpGenericAdaptorBase::getIntrin() {
|
|
auto attr = getIntrinAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr CallIntrinsicOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags CallIntrinsicOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> CallIntrinsicOpGenericAdaptorBase::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOpGenericAdaptorBase::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOpGenericAdaptorBase::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOpGenericAdaptorBase::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
CallIntrinsicOpAdaptor::CallIntrinsicOpAdaptor(CallIntrinsicOp op) : CallIntrinsicOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_intrin = getProperties().intrin; (void)tblgen_intrin;
|
|
if (!tblgen_intrin) return emitError(loc, "'llvm.call_intrinsic' op requires attribute 'intrin'");
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitError(loc, "'llvm.call_intrinsic' op requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
|
|
if (tblgen_intrin && !((::llvm::isa<::mlir::StringAttr>(tblgen_intrin))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'intrin' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
|
|
if (tblgen_op_bundle_sizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_op_bundle_sizes))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'op_bundle_sizes' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_op_bundle_tags && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_op_bundle_tags))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'op_bundle_tags' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call_intrinsic' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> CallIntrinsicOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange CallIntrinsicOp::getArgsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRangeRange CallIntrinsicOp::getOpBundleOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getOpBundleSizesAttrName()));
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> CallIntrinsicOp::getODSResultIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto attr = dict.get("arg_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.intrin;
|
|
auto attr = dict.get("intrin");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `intrin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto attr = dict.get("op_bundle_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto attr = dict.get("op_bundle_tags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.res_attrs;
|
|
auto attr = dict.get("res_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute CallIntrinsicOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.arg_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.intrin;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("intrin",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_tags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_tags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.res_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code CallIntrinsicOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.intrin.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_sizes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_tags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> CallIntrinsicOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "arg_attrs")
|
|
return prop.arg_attrs;
|
|
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
|
|
if (name == "intrin")
|
|
return prop.intrin;
|
|
|
|
if (name == "op_bundle_sizes")
|
|
return prop.op_bundle_sizes;
|
|
|
|
if (name == "op_bundle_tags")
|
|
return prop.op_bundle_tags;
|
|
|
|
if (name == "res_attrs")
|
|
return prop.res_attrs;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void CallIntrinsicOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "arg_attrs") {
|
|
prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "intrin") {
|
|
prop.intrin = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.intrin)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_sizes") {
|
|
prop.op_bundle_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_sizes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_tags") {
|
|
prop.op_bundle_tags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_tags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "res_attrs") {
|
|
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CallIntrinsicOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
|
|
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
|
|
if (prop.intrin) attrs.append("intrin", prop.intrin);
|
|
|
|
if (prop.op_bundle_sizes) attrs.append("op_bundle_sizes", prop.op_bundle_sizes);
|
|
|
|
if (prop.op_bundle_tags) attrs.append("op_bundle_tags", prop.op_bundle_tags);
|
|
|
|
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "arg_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIntrinAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "intrin", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "op_bundle_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleTagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "op_bundle_tags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "res_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.intrin)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.op_bundle_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.op_bundle_tags)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void CallIntrinsicOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.arg_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
writer.writeAttribute(prop.intrin);
|
|
writer.writeAttribute(prop.op_bundle_sizes);
|
|
|
|
writer.writeOptionalAttribute(prop.op_bundle_tags);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
writer.writeOptionalAttribute(prop.res_attrs);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::llvm::StringRef CallIntrinsicOp::getIntrin() {
|
|
auto attr = getIntrinAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags CallIntrinsicOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> CallIntrinsicOp::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOp::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOp::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallIntrinsicOp::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void CallIntrinsicOp::setIntrin(::llvm::StringRef attrValue) {
|
|
getProperties().intrin = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void CallIntrinsicOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void CallIntrinsicOp::setOpBundleSizes(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().op_bundle_sizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr intrin, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, StringAttr intrin, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr intrin, ValueRange args, FastmathFlagsAttr fastMathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastMathFlags)>(fastMathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, StringAttr intrin, ValueRange args, FastmathFlagsAttr fastMathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastMathFlags)>(fastMathFlags));
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, StringAttr intrin, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, StringAttr intrin, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTypes, StringAttr intrin, ValueRange args, FastmathFlagsAttr fastMathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastMathFlags)>(fastMathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTypes, StringAttr intrin, ValueRange args, FastmathFlagsAttr fastMathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastMathFlags)>(fastMathFlags));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
odsState.addOperands(args);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(args.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().intrin = intrin;
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (results)
|
|
odsState.addTypes(results);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type results, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(results)>(results), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type results, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(results)>(results), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
odsState.addOperands(args);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(args.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().intrin = intrin;
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
odsState.addOperands(args);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(args.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().intrin = odsBuilder.getStringAttr(intrin);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (results)
|
|
odsState.addTypes(results);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type results, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(results)>(results), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type results, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(results)>(results), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
odsState.addOperands(args);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(args.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().intrin = odsBuilder.getStringAttr(intrin);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(intrin)>(intrin), std::forward<decltype(args)>(args), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<CallIntrinsicOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void CallIntrinsicOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<CallIntrinsicOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallIntrinsicOp CallIntrinsicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void CallIntrinsicOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::verifyInvariantsImpl() {
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_intrin = getProperties().intrin; (void)tblgen_intrin;
|
|
if (!tblgen_intrin) return emitOpError("requires attribute 'intrin'");
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitOpError("requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_intrin, "intrin")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_op_bundle_sizes, "op_bundle_sizes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_op_bundle_tags, "op_bundle_tags")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_arg_attrs, "arg_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_res_attrs, "res_attrs")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "op_bundle_sizes", "op_bundle_operands", valueGroup1.size())))
|
|
return ::mlir::failure();
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
if (valueGroup0.size() > 1) {
|
|
return emitOpError("result group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup0.size();
|
|
}
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult CallIntrinsicOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.intrin;
|
|
auto intrinAttrName = ::mlir::StringAttr::get(ctx, "intrin");
|
|
auto attr = dict.get(intrinAttrName);
|
|
usedKeys.insert(intrinAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for intrin in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `intrin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto fastmathFlagsAttrName = ::mlir::StringAttr::get(ctx, "fastmathFlags");
|
|
auto attr = dict.get(fastmathFlagsAttrName);
|
|
usedKeys.insert(fastmathFlagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto op_bundle_sizesAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_sizes");
|
|
auto attr = dict.get(op_bundle_sizesAttrName);
|
|
usedKeys.insert(op_bundle_sizesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_sizes in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto op_bundle_tagsAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_tags");
|
|
auto attr = dict.get(op_bundle_tagsAttrName);
|
|
usedKeys.insert(op_bundle_tagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_tags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs");
|
|
auto attr = dict.get(arg_attrsAttrName);
|
|
usedKeys.insert(arg_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.res_attrs;
|
|
auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs");
|
|
auto attr = dict.get(res_attrsAttrName);
|
|
usedKeys.insert(res_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallIntrinsicOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::CallIntrinsicOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::CallOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LLVMFunctionType> CallOpGenericAdaptorBase::getVarCalleeType() {
|
|
auto attr = getVarCalleeTypeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOpGenericAdaptorBase::getCallee() {
|
|
auto attr = getCalleeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr CallOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags CallOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::CConvAttr CallOpGenericAdaptorBase::getCConvAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(getProperties().CConv);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv CallOpGenericAdaptorBase::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::mlir::LLVM::TailCallKindAttr CallOpGenericAdaptorBase::getTailCallKindAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::TailCallKindAttr>(getProperties().TailCallKind);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::tailcallkind::TailCallKind CallOpGenericAdaptorBase::getTailCallKind() {
|
|
auto attr = getTailCallKindAttr();
|
|
return attr.getTailCallKind();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::MemoryEffectsAttr> CallOpGenericAdaptorBase::getMemoryEffects() {
|
|
auto attr = getMemoryEffectsAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getConvergentAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().convergent);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getConvergent() {
|
|
auto attr = getConvergentAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNoUnwindAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_unwind);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNoUnwind() {
|
|
auto attr = getNoUnwindAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getWillReturnAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().will_return);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getWillReturn() {
|
|
auto attr = getWillReturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNoreturnAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().noreturn);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNoreturn() {
|
|
auto attr = getNoreturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getReturnsTwiceAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().returns_twice);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getReturnsTwice() {
|
|
auto attr = getReturnsTwiceAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getHotAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hot);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getHot() {
|
|
auto attr = getHotAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getColdAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().cold);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getCold() {
|
|
auto attr = getColdAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNoduplicateAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().noduplicate);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNoduplicate() {
|
|
auto attr = getNoduplicateAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNoCallerSavedRegistersAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_caller_saved_registers);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNoCallerSavedRegisters() {
|
|
auto attr = getNoCallerSavedRegistersAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNocallbackAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nocallback);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNocallback() {
|
|
auto attr = getNocallbackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOpGenericAdaptorBase::getModularFormat() {
|
|
auto attr = getModularFormatAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getNobuiltins() {
|
|
auto attr = getNobuiltinsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> CallOpGenericAdaptorBase::getAllocsize() {
|
|
auto attr = getAllocsizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getOptsizeAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().optsize);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getOptsize() {
|
|
auto attr = getOptsizeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getMinsizeAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().minsize);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getMinsize() {
|
|
auto attr = getMinsizeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getBuiltinAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().builtin);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getBuiltin() {
|
|
auto attr = getBuiltinAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNobuiltinAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nobuiltin);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNobuiltin() {
|
|
auto attr = getNobuiltinAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getSaveRegParamsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().save_reg_params);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getSaveRegParams() {
|
|
auto attr = getSaveRegParamsAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOpGenericAdaptorBase::getZeroCallUsedRegs() {
|
|
auto attr = getZeroCallUsedRegsAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOpGenericAdaptorBase::getTrapFuncName() {
|
|
auto attr = getTrapFuncNameAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::DictionaryAttr > CallOpGenericAdaptorBase::getDefaultFuncAttrs() {
|
|
auto attr = getDefaultFuncAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::DictionaryAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> CallOpGenericAdaptorBase::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getNoInlineAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_inline);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getNoInline() {
|
|
auto attr = getNoInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getAlwaysInlineAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().always_inline);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getAlwaysInline() {
|
|
auto attr = getAlwaysInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr CallOpGenericAdaptorBase::getInlineHintAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inline_hint);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool CallOpGenericAdaptorBase::getInlineHint() {
|
|
auto attr = getInlineHintAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
CallOpAdaptor::CallOpAdaptor(CallOp op) : CallOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_TailCallKind = getProperties().TailCallKind; (void)tblgen_TailCallKind;
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_allocsize = getProperties().allocsize; (void)tblgen_allocsize;
|
|
auto tblgen_always_inline = getProperties().always_inline; (void)tblgen_always_inline;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_builtin = getProperties().builtin; (void)tblgen_builtin;
|
|
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
|
|
auto tblgen_cold = getProperties().cold; (void)tblgen_cold;
|
|
auto tblgen_convergent = getProperties().convergent; (void)tblgen_convergent;
|
|
auto tblgen_default_func_attrs = getProperties().default_func_attrs; (void)tblgen_default_func_attrs;
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_hot = getProperties().hot; (void)tblgen_hot;
|
|
auto tblgen_inline_hint = getProperties().inline_hint; (void)tblgen_inline_hint;
|
|
auto tblgen_memory_effects = getProperties().memory_effects; (void)tblgen_memory_effects;
|
|
auto tblgen_minsize = getProperties().minsize; (void)tblgen_minsize;
|
|
auto tblgen_modular_format = getProperties().modular_format; (void)tblgen_modular_format;
|
|
auto tblgen_no_caller_saved_registers = getProperties().no_caller_saved_registers; (void)tblgen_no_caller_saved_registers;
|
|
auto tblgen_no_inline = getProperties().no_inline; (void)tblgen_no_inline;
|
|
auto tblgen_no_unwind = getProperties().no_unwind; (void)tblgen_no_unwind;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nobuiltin = getProperties().nobuiltin; (void)tblgen_nobuiltin;
|
|
auto tblgen_nobuiltins = getProperties().nobuiltins; (void)tblgen_nobuiltins;
|
|
auto tblgen_nocallback = getProperties().nocallback; (void)tblgen_nocallback;
|
|
auto tblgen_noduplicate = getProperties().noduplicate; (void)tblgen_noduplicate;
|
|
auto tblgen_noreturn = getProperties().noreturn; (void)tblgen_noreturn;
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitError(loc, "'llvm.call' op requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_optsize = getProperties().optsize; (void)tblgen_optsize;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_returns_twice = getProperties().returns_twice; (void)tblgen_returns_twice;
|
|
auto tblgen_save_reg_params = getProperties().save_reg_params; (void)tblgen_save_reg_params;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_trap_func_name = getProperties().trap_func_name; (void)tblgen_trap_func_name;
|
|
auto tblgen_var_callee_type = getProperties().var_callee_type; (void)tblgen_var_callee_type;
|
|
auto tblgen_will_return = getProperties().will_return; (void)tblgen_will_return;
|
|
auto tblgen_zero_call_used_regs = getProperties().zero_call_used_regs; (void)tblgen_zero_call_used_regs;
|
|
|
|
if (tblgen_var_callee_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_var_callee_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_var_callee_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_var_callee_type).getValue())))))
|
|
return emitError(loc, "'llvm.call' op attribute 'var_callee_type' failed to satisfy constraint: type attribute of LLVM function type");
|
|
|
|
if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee))))
|
|
return emitError(loc, "'llvm.call' op attribute 'callee' failed to satisfy constraint: flat symbol reference attribute");
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.call' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
|
|
if (tblgen_CConv && !((::llvm::isa<::mlir::LLVM::CConvAttr>(tblgen_CConv))))
|
|
return emitError(loc, "'llvm.call' op attribute 'CConv' failed to satisfy constraint: LLVM Calling Convention specification");
|
|
|
|
if (tblgen_TailCallKind && !((::llvm::isa<::mlir::LLVM::TailCallKindAttr>(tblgen_TailCallKind))))
|
|
return emitError(loc, "'llvm.call' op attribute 'TailCallKind' failed to satisfy constraint: LLVM Calling Convention specification");
|
|
|
|
if (tblgen_memory_effects && !((::llvm::isa<::mlir::LLVM::MemoryEffectsAttr>(tblgen_memory_effects))))
|
|
return emitError(loc, "'llvm.call' op attribute 'memory_effects' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_convergent && !((::llvm::isa<::mlir::UnitAttr>(tblgen_convergent))))
|
|
return emitError(loc, "'llvm.call' op attribute 'convergent' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_no_unwind && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_unwind))))
|
|
return emitError(loc, "'llvm.call' op attribute 'no_unwind' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_will_return && !((::llvm::isa<::mlir::UnitAttr>(tblgen_will_return))))
|
|
return emitError(loc, "'llvm.call' op attribute 'will_return' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_noreturn && !((::llvm::isa<::mlir::UnitAttr>(tblgen_noreturn))))
|
|
return emitError(loc, "'llvm.call' op attribute 'noreturn' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_returns_twice && !((::llvm::isa<::mlir::UnitAttr>(tblgen_returns_twice))))
|
|
return emitError(loc, "'llvm.call' op attribute 'returns_twice' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_hot && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hot))))
|
|
return emitError(loc, "'llvm.call' op attribute 'hot' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_cold && !((::llvm::isa<::mlir::UnitAttr>(tblgen_cold))))
|
|
return emitError(loc, "'llvm.call' op attribute 'cold' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_noduplicate && !((::llvm::isa<::mlir::UnitAttr>(tblgen_noduplicate))))
|
|
return emitError(loc, "'llvm.call' op attribute 'noduplicate' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_no_caller_saved_registers && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_caller_saved_registers))))
|
|
return emitError(loc, "'llvm.call' op attribute 'no_caller_saved_registers' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_nocallback && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nocallback))))
|
|
return emitError(loc, "'llvm.call' op attribute 'nocallback' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_modular_format && !((::llvm::isa<::mlir::StringAttr>(tblgen_modular_format))))
|
|
return emitError(loc, "'llvm.call' op attribute 'modular_format' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_nobuiltins && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_nobuiltins))))
|
|
return emitError(loc, "'llvm.call' op attribute 'nobuiltins' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_allocsize && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_allocsize))))
|
|
return emitError(loc, "'llvm.call' op attribute 'allocsize' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_optsize && !((::llvm::isa<::mlir::UnitAttr>(tblgen_optsize))))
|
|
return emitError(loc, "'llvm.call' op attribute 'optsize' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_minsize && !((::llvm::isa<::mlir::UnitAttr>(tblgen_minsize))))
|
|
return emitError(loc, "'llvm.call' op attribute 'minsize' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_builtin && !((::llvm::isa<::mlir::UnitAttr>(tblgen_builtin))))
|
|
return emitError(loc, "'llvm.call' op attribute 'builtin' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_nobuiltin && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nobuiltin))))
|
|
return emitError(loc, "'llvm.call' op attribute 'nobuiltin' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_save_reg_params && !((::llvm::isa<::mlir::UnitAttr>(tblgen_save_reg_params))))
|
|
return emitError(loc, "'llvm.call' op attribute 'save_reg_params' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_zero_call_used_regs && !((::llvm::isa<::mlir::StringAttr>(tblgen_zero_call_used_regs))))
|
|
return emitError(loc, "'llvm.call' op attribute 'zero_call_used_regs' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_trap_func_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_trap_func_name))))
|
|
return emitError(loc, "'llvm.call' op attribute 'trap_func_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_default_func_attrs && !((::llvm::isa<::mlir::DictionaryAttr>(tblgen_default_func_attrs))))
|
|
return emitError(loc, "'llvm.call' op attribute 'default_func_attrs' failed to satisfy constraint: dictionary of named attribute values");
|
|
|
|
if (tblgen_op_bundle_sizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_op_bundle_sizes))))
|
|
return emitError(loc, "'llvm.call' op attribute 'op_bundle_sizes' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_op_bundle_tags && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_op_bundle_tags))))
|
|
return emitError(loc, "'llvm.call' op attribute 'op_bundle_tags' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_no_inline && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_inline))))
|
|
return emitError(loc, "'llvm.call' op attribute 'no_inline' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_always_inline && !((::llvm::isa<::mlir::UnitAttr>(tblgen_always_inline))))
|
|
return emitError(loc, "'llvm.call' op attribute 'always_inline' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_inline_hint && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inline_hint))))
|
|
return emitError(loc, "'llvm.call' op attribute 'inline_hint' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array");
|
|
|
|
if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.call' op attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> CallOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange CallOp::getCalleeOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRangeRange CallOp::getOpBundleOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getOpBundleSizesAttrName()));
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> CallOp::getODSResultIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.CConv;
|
|
auto attr = dict.get("CConv");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.TailCallKind;
|
|
auto attr = dict.get("TailCallKind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `TailCallKind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.access_groups;
|
|
auto attr = dict.get("access_groups");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto attr = dict.get("alias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.allocsize;
|
|
auto attr = dict.get("allocsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `allocsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.always_inline;
|
|
auto attr = dict.get("always_inline");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `always_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto attr = dict.get("arg_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.builtin;
|
|
auto attr = dict.get("builtin");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `builtin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.callee;
|
|
auto attr = dict.get("callee");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cold;
|
|
auto attr = dict.get("cold");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cold` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.convergent;
|
|
auto attr = dict.get("convergent");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `convergent` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.default_func_attrs;
|
|
auto attr = dict.get("default_func_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `default_func_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.hot;
|
|
auto attr = dict.get("hot");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `hot` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.inline_hint;
|
|
auto attr = dict.get("inline_hint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inline_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.memory_effects;
|
|
auto attr = dict.get("memory_effects");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `memory_effects` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.minsize;
|
|
auto attr = dict.get("minsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `minsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.modular_format;
|
|
auto attr = dict.get("modular_format");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `modular_format` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_caller_saved_registers;
|
|
auto attr = dict.get("no_caller_saved_registers");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_caller_saved_registers` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_inline;
|
|
auto attr = dict.get("no_inline");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_unwind;
|
|
auto attr = dict.get("no_unwind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_unwind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto attr = dict.get("noalias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nobuiltin;
|
|
auto attr = dict.get("nobuiltin");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nobuiltins;
|
|
auto attr = dict.get("nobuiltins");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltins` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nocallback;
|
|
auto attr = dict.get("nocallback");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nocallback` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noduplicate;
|
|
auto attr = dict.get("noduplicate");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noduplicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noreturn;
|
|
auto attr = dict.get("noreturn");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noreturn` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto attr = dict.get("op_bundle_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto attr = dict.get("op_bundle_tags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.optsize;
|
|
auto attr = dict.get("optsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.res_attrs;
|
|
auto attr = dict.get("res_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.returns_twice;
|
|
auto attr = dict.get("returns_twice");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `returns_twice` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.save_reg_params;
|
|
auto attr = dict.get("save_reg_params");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `save_reg_params` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tbaa;
|
|
auto attr = dict.get("tbaa");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.trap_func_name;
|
|
auto attr = dict.get("trap_func_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `trap_func_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.var_callee_type;
|
|
auto attr = dict.get("var_callee_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `var_callee_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.will_return;
|
|
auto attr = dict.get("will_return");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `will_return` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.zero_call_used_regs;
|
|
auto attr = dict.get("zero_call_used_regs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `zero_call_used_regs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute CallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.CConv;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("CConv",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.TailCallKind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("TailCallKind",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.access_groups;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("access_groups",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.allocsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("allocsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.always_inline;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("always_inline",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arg_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.builtin;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("builtin",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.callee;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("callee",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.cold;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cold",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.convergent;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("convergent",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.default_func_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("default_func_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.hot;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("hot",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.inline_hint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("inline_hint",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.memory_effects;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("memory_effects",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.minsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("minsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.modular_format;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("modular_format",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_caller_saved_registers;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_caller_saved_registers",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_inline;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_inline",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_unwind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_unwind",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noalias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nobuiltin;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nobuiltin",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nobuiltins;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nobuiltins",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nocallback;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nocallback",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noduplicate;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noduplicate",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noreturn;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noreturn",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_tags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_tags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.optsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("optsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.res_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.returns_twice;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("returns_twice",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.save_reg_params;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("save_reg_params",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tbaa;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tbaa",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.trap_func_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("trap_func_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.var_callee_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("var_callee_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.will_return;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("will_return",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.zero_call_used_regs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("zero_call_used_regs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.CConv.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.TailCallKind.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.access_groups.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.allocsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.always_inline.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.builtin.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.callee.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.cold.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.convergent.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.default_func_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.hot.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.inline_hint.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.memory_effects.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.minsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.modular_format.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_caller_saved_registers.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_inline.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_unwind.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nobuiltin.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nobuiltins.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nocallback.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noduplicate.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noreturn.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_sizes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_tags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.optsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.returns_twice.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.save_reg_params.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tbaa.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.trap_func_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.var_callee_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.will_return.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.zero_call_used_regs.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "CConv")
|
|
return prop.CConv;
|
|
|
|
if (name == "TailCallKind")
|
|
return prop.TailCallKind;
|
|
|
|
if (name == "access_groups")
|
|
return prop.access_groups;
|
|
|
|
if (name == "alias_scopes")
|
|
return prop.alias_scopes;
|
|
|
|
if (name == "allocsize")
|
|
return prop.allocsize;
|
|
|
|
if (name == "always_inline")
|
|
return prop.always_inline;
|
|
|
|
if (name == "arg_attrs")
|
|
return prop.arg_attrs;
|
|
|
|
if (name == "builtin")
|
|
return prop.builtin;
|
|
|
|
if (name == "callee")
|
|
return prop.callee;
|
|
|
|
if (name == "cold")
|
|
return prop.cold;
|
|
|
|
if (name == "convergent")
|
|
return prop.convergent;
|
|
|
|
if (name == "default_func_attrs")
|
|
return prop.default_func_attrs;
|
|
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
|
|
if (name == "hot")
|
|
return prop.hot;
|
|
|
|
if (name == "inline_hint")
|
|
return prop.inline_hint;
|
|
|
|
if (name == "memory_effects")
|
|
return prop.memory_effects;
|
|
|
|
if (name == "minsize")
|
|
return prop.minsize;
|
|
|
|
if (name == "modular_format")
|
|
return prop.modular_format;
|
|
|
|
if (name == "no_caller_saved_registers")
|
|
return prop.no_caller_saved_registers;
|
|
|
|
if (name == "no_inline")
|
|
return prop.no_inline;
|
|
|
|
if (name == "no_unwind")
|
|
return prop.no_unwind;
|
|
|
|
if (name == "noalias_scopes")
|
|
return prop.noalias_scopes;
|
|
|
|
if (name == "nobuiltin")
|
|
return prop.nobuiltin;
|
|
|
|
if (name == "nobuiltins")
|
|
return prop.nobuiltins;
|
|
|
|
if (name == "nocallback")
|
|
return prop.nocallback;
|
|
|
|
if (name == "noduplicate")
|
|
return prop.noduplicate;
|
|
|
|
if (name == "noreturn")
|
|
return prop.noreturn;
|
|
|
|
if (name == "op_bundle_sizes")
|
|
return prop.op_bundle_sizes;
|
|
|
|
if (name == "op_bundle_tags")
|
|
return prop.op_bundle_tags;
|
|
|
|
if (name == "optsize")
|
|
return prop.optsize;
|
|
|
|
if (name == "res_attrs")
|
|
return prop.res_attrs;
|
|
|
|
if (name == "returns_twice")
|
|
return prop.returns_twice;
|
|
|
|
if (name == "save_reg_params")
|
|
return prop.save_reg_params;
|
|
|
|
if (name == "tbaa")
|
|
return prop.tbaa;
|
|
|
|
if (name == "trap_func_name")
|
|
return prop.trap_func_name;
|
|
|
|
if (name == "var_callee_type")
|
|
return prop.var_callee_type;
|
|
|
|
if (name == "will_return")
|
|
return prop.will_return;
|
|
|
|
if (name == "zero_call_used_regs")
|
|
return prop.zero_call_used_regs;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void CallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "CConv") {
|
|
prop.CConv = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.CConv)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "TailCallKind") {
|
|
prop.TailCallKind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.TailCallKind)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "access_groups") {
|
|
prop.access_groups = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.access_groups)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alias_scopes") {
|
|
prop.alias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "allocsize") {
|
|
prop.allocsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.allocsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "always_inline") {
|
|
prop.always_inline = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.always_inline)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arg_attrs") {
|
|
prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "builtin") {
|
|
prop.builtin = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.builtin)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "callee") {
|
|
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "cold") {
|
|
prop.cold = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cold)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "convergent") {
|
|
prop.convergent = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.convergent)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "default_func_attrs") {
|
|
prop.default_func_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.default_func_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "hot") {
|
|
prop.hot = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.hot)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "inline_hint") {
|
|
prop.inline_hint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.inline_hint)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "memory_effects") {
|
|
prop.memory_effects = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.memory_effects)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "minsize") {
|
|
prop.minsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.minsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "modular_format") {
|
|
prop.modular_format = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.modular_format)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_caller_saved_registers") {
|
|
prop.no_caller_saved_registers = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_caller_saved_registers)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_inline") {
|
|
prop.no_inline = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_inline)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_unwind") {
|
|
prop.no_unwind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_unwind)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noalias_scopes") {
|
|
prop.noalias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noalias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nobuiltin") {
|
|
prop.nobuiltin = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nobuiltin)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nobuiltins") {
|
|
prop.nobuiltins = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nobuiltins)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nocallback") {
|
|
prop.nocallback = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nocallback)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noduplicate") {
|
|
prop.noduplicate = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noduplicate)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noreturn") {
|
|
prop.noreturn = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noreturn)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_sizes") {
|
|
prop.op_bundle_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_sizes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_tags") {
|
|
prop.op_bundle_tags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_tags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "optsize") {
|
|
prop.optsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.optsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "res_attrs") {
|
|
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "returns_twice") {
|
|
prop.returns_twice = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.returns_twice)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "save_reg_params") {
|
|
prop.save_reg_params = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.save_reg_params)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tbaa") {
|
|
prop.tbaa = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tbaa)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "trap_func_name") {
|
|
prop.trap_func_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.trap_func_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "var_callee_type") {
|
|
prop.var_callee_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.var_callee_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "will_return") {
|
|
prop.will_return = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.will_return)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "zero_call_used_regs") {
|
|
prop.zero_call_used_regs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.zero_call_used_regs)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.CConv) attrs.append("CConv", prop.CConv);
|
|
|
|
if (prop.TailCallKind) attrs.append("TailCallKind", prop.TailCallKind);
|
|
|
|
if (prop.access_groups) attrs.append("access_groups", prop.access_groups);
|
|
|
|
if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes);
|
|
|
|
if (prop.allocsize) attrs.append("allocsize", prop.allocsize);
|
|
|
|
if (prop.always_inline) attrs.append("always_inline", prop.always_inline);
|
|
|
|
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
|
|
|
|
if (prop.builtin) attrs.append("builtin", prop.builtin);
|
|
|
|
if (prop.callee) attrs.append("callee", prop.callee);
|
|
|
|
if (prop.cold) attrs.append("cold", prop.cold);
|
|
|
|
if (prop.convergent) attrs.append("convergent", prop.convergent);
|
|
|
|
if (prop.default_func_attrs) attrs.append("default_func_attrs", prop.default_func_attrs);
|
|
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
|
|
if (prop.hot) attrs.append("hot", prop.hot);
|
|
|
|
if (prop.inline_hint) attrs.append("inline_hint", prop.inline_hint);
|
|
|
|
if (prop.memory_effects) attrs.append("memory_effects", prop.memory_effects);
|
|
|
|
if (prop.minsize) attrs.append("minsize", prop.minsize);
|
|
|
|
if (prop.modular_format) attrs.append("modular_format", prop.modular_format);
|
|
|
|
if (prop.no_caller_saved_registers) attrs.append("no_caller_saved_registers", prop.no_caller_saved_registers);
|
|
|
|
if (prop.no_inline) attrs.append("no_inline", prop.no_inline);
|
|
|
|
if (prop.no_unwind) attrs.append("no_unwind", prop.no_unwind);
|
|
|
|
if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes);
|
|
|
|
if (prop.nobuiltin) attrs.append("nobuiltin", prop.nobuiltin);
|
|
|
|
if (prop.nobuiltins) attrs.append("nobuiltins", prop.nobuiltins);
|
|
|
|
if (prop.nocallback) attrs.append("nocallback", prop.nocallback);
|
|
|
|
if (prop.noduplicate) attrs.append("noduplicate", prop.noduplicate);
|
|
|
|
if (prop.noreturn) attrs.append("noreturn", prop.noreturn);
|
|
|
|
if (prop.op_bundle_sizes) attrs.append("op_bundle_sizes", prop.op_bundle_sizes);
|
|
|
|
if (prop.op_bundle_tags) attrs.append("op_bundle_tags", prop.op_bundle_tags);
|
|
|
|
if (prop.optsize) attrs.append("optsize", prop.optsize);
|
|
|
|
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
|
|
|
|
if (prop.returns_twice) attrs.append("returns_twice", prop.returns_twice);
|
|
|
|
if (prop.save_reg_params) attrs.append("save_reg_params", prop.save_reg_params);
|
|
|
|
if (prop.tbaa) attrs.append("tbaa", prop.tbaa);
|
|
|
|
if (prop.trap_func_name) attrs.append("trap_func_name", prop.trap_func_name);
|
|
|
|
if (prop.var_callee_type) attrs.append("var_callee_type", prop.var_callee_type);
|
|
|
|
if (prop.will_return) attrs.append("will_return", prop.will_return);
|
|
|
|
if (prop.zero_call_used_regs) attrs.append("zero_call_used_regs", prop.zero_call_used_regs);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCConvAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(attr, "CConv", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTailCallKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(attr, "TailCallKind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "access_groups", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "alias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAllocsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "allocsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlwaysInlineAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "always_inline", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "arg_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBuiltinAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "builtin", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "callee", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getColdAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "cold", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getConvergentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "convergent", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDefaultFuncAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(attr, "default_func_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getHotAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "hot", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInlineHintAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "inline_hint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMemoryEffectsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(attr, "memory_effects", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMinsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "minsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getModularFormatAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "modular_format", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoCallerSavedRegistersAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_caller_saved_registers", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoInlineAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_inline", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoUnwindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_unwind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "noalias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNobuiltinAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nobuiltin", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNobuiltinsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "nobuiltins", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNocallbackAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nocallback", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoduplicateAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "noduplicate", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoreturnAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "noreturn", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "op_bundle_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleTagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "op_bundle_tags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOptsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "optsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "res_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReturnsTwiceAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "returns_twice", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSaveRegParamsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "save_reg_params", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "tbaa", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTrapFuncNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "trap_func_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVarCalleeTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(attr, "var_callee_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWillReturnAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "will_return", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getZeroCallUsedRegsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "zero_call_used_regs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.CConv)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.TailCallKind)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.allocsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.always_inline)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.builtin)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.callee)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cold)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.convergent)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.default_func_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.hot)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.inline_hint)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.memory_effects)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.minsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.modular_format)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_caller_saved_registers)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_inline)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_unwind)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nobuiltin)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nobuiltins)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nocallback)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noduplicate)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noreturn)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.op_bundle_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.op_bundle_tags)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.optsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.returns_twice)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.save_reg_params)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.trap_func_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.var_callee_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.will_return)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.zero_call_used_regs)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.CConv);
|
|
|
|
writer.writeOptionalAttribute(prop.TailCallKind);
|
|
|
|
writer.writeOptionalAttribute(prop.access_groups);
|
|
|
|
writer.writeOptionalAttribute(prop.alias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.allocsize);
|
|
|
|
writer.writeOptionalAttribute(prop.always_inline);
|
|
|
|
writer.writeOptionalAttribute(prop.arg_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.builtin);
|
|
|
|
writer.writeOptionalAttribute(prop.callee);
|
|
|
|
writer.writeOptionalAttribute(prop.cold);
|
|
|
|
writer.writeOptionalAttribute(prop.convergent);
|
|
|
|
writer.writeOptionalAttribute(prop.default_func_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
|
|
writer.writeOptionalAttribute(prop.hot);
|
|
|
|
writer.writeOptionalAttribute(prop.inline_hint);
|
|
|
|
writer.writeOptionalAttribute(prop.memory_effects);
|
|
|
|
writer.writeOptionalAttribute(prop.minsize);
|
|
|
|
writer.writeOptionalAttribute(prop.modular_format);
|
|
|
|
writer.writeOptionalAttribute(prop.no_caller_saved_registers);
|
|
|
|
writer.writeOptionalAttribute(prop.no_inline);
|
|
|
|
writer.writeOptionalAttribute(prop.no_unwind);
|
|
|
|
writer.writeOptionalAttribute(prop.noalias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.nobuiltin);
|
|
|
|
writer.writeOptionalAttribute(prop.nobuiltins);
|
|
|
|
writer.writeOptionalAttribute(prop.nocallback);
|
|
|
|
writer.writeOptionalAttribute(prop.noduplicate);
|
|
|
|
writer.writeOptionalAttribute(prop.noreturn);
|
|
writer.writeAttribute(prop.op_bundle_sizes);
|
|
|
|
writer.writeOptionalAttribute(prop.op_bundle_tags);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
writer.writeOptionalAttribute(prop.optsize);
|
|
|
|
writer.writeOptionalAttribute(prop.res_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.returns_twice);
|
|
|
|
writer.writeOptionalAttribute(prop.save_reg_params);
|
|
|
|
writer.writeOptionalAttribute(prop.tbaa);
|
|
|
|
writer.writeOptionalAttribute(prop.trap_func_name);
|
|
|
|
writer.writeOptionalAttribute(prop.var_callee_type);
|
|
|
|
writer.writeOptionalAttribute(prop.will_return);
|
|
|
|
writer.writeOptionalAttribute(prop.zero_call_used_regs);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LLVMFunctionType> CallOp::getVarCalleeType() {
|
|
auto attr = getVarCalleeTypeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOp::getCallee() {
|
|
auto attr = getCalleeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags CallOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv CallOp::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::mlir::LLVM::tailcallkind::TailCallKind CallOp::getTailCallKind() {
|
|
auto attr = getTailCallKindAttr();
|
|
return attr.getTailCallKind();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::MemoryEffectsAttr> CallOp::getMemoryEffects() {
|
|
auto attr = getMemoryEffectsAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
bool CallOp::getConvergent() {
|
|
auto attr = getConvergentAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNoUnwind() {
|
|
auto attr = getNoUnwindAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getWillReturn() {
|
|
auto attr = getWillReturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNoreturn() {
|
|
auto attr = getNoreturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getReturnsTwice() {
|
|
auto attr = getReturnsTwiceAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getHot() {
|
|
auto attr = getHotAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getCold() {
|
|
auto attr = getColdAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNoduplicate() {
|
|
auto attr = getNoduplicateAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNoCallerSavedRegisters() {
|
|
auto attr = getNoCallerSavedRegistersAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNocallback() {
|
|
auto attr = getNocallbackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOp::getModularFormat() {
|
|
auto attr = getModularFormatAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getNobuiltins() {
|
|
auto attr = getNobuiltinsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> CallOp::getAllocsize() {
|
|
auto attr = getAllocsizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
bool CallOp::getOptsize() {
|
|
auto attr = getOptsizeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getMinsize() {
|
|
auto attr = getMinsizeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getBuiltin() {
|
|
auto attr = getBuiltinAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getNobuiltin() {
|
|
auto attr = getNobuiltinAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getSaveRegParams() {
|
|
auto attr = getSaveRegParamsAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOp::getZeroCallUsedRegs() {
|
|
auto attr = getZeroCallUsedRegsAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > CallOp::getTrapFuncName() {
|
|
auto attr = getTrapFuncNameAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::DictionaryAttr > CallOp::getDefaultFuncAttrs() {
|
|
auto attr = getDefaultFuncAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::DictionaryAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> CallOp::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
bool CallOp::getNoInline() {
|
|
auto attr = getNoInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getAlwaysInline() {
|
|
auto attr = getAlwaysInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool CallOp::getInlineHint() {
|
|
auto attr = getInlineHintAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > CallOp::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void CallOp::setVarCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue) {
|
|
auto &odsProp = getProperties().var_callee_type;
|
|
if (attrValue)
|
|
odsProp = ::mlir::TypeAttr::get(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setCallee(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().callee;
|
|
if (attrValue)
|
|
odsProp = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void CallOp::setCConv(::mlir::LLVM::cconv::CConv attrValue) {
|
|
getProperties().CConv = ::mlir::LLVM::CConvAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void CallOp::setTailCallKind(::mlir::LLVM::tailcallkind::TailCallKind attrValue) {
|
|
getProperties().TailCallKind = ::mlir::LLVM::TailCallKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void CallOp::setConvergent(bool attrValue) {
|
|
auto &odsProp = getProperties().convergent;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNoUnwind(bool attrValue) {
|
|
auto &odsProp = getProperties().no_unwind;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setWillReturn(bool attrValue) {
|
|
auto &odsProp = getProperties().will_return;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNoreturn(bool attrValue) {
|
|
auto &odsProp = getProperties().noreturn;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setReturnsTwice(bool attrValue) {
|
|
auto &odsProp = getProperties().returns_twice;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setHot(bool attrValue) {
|
|
auto &odsProp = getProperties().hot;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setCold(bool attrValue) {
|
|
auto &odsProp = getProperties().cold;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNoduplicate(bool attrValue) {
|
|
auto &odsProp = getProperties().noduplicate;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNoCallerSavedRegisters(bool attrValue) {
|
|
auto &odsProp = getProperties().no_caller_saved_registers;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNocallback(bool attrValue) {
|
|
auto &odsProp = getProperties().nocallback;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setModularFormat(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().modular_format;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setAllocsize(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().allocsize;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setOptsize(bool attrValue) {
|
|
auto &odsProp = getProperties().optsize;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setMinsize(bool attrValue) {
|
|
auto &odsProp = getProperties().minsize;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setBuiltin(bool attrValue) {
|
|
auto &odsProp = getProperties().builtin;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setNobuiltin(bool attrValue) {
|
|
auto &odsProp = getProperties().nobuiltin;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setSaveRegParams(bool attrValue) {
|
|
auto &odsProp = getProperties().save_reg_params;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setZeroCallUsedRegs(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().zero_call_used_regs;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setTrapFuncName(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().trap_func_name;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setOpBundleSizes(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().op_bundle_sizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
void CallOp::setNoInline(bool attrValue) {
|
|
auto &odsProp = getProperties().no_inline;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setAlwaysInline(bool attrValue) {
|
|
auto &odsProp = getProperties().always_inline;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void CallOp::setInlineHint(bool attrValue) {
|
|
auto &odsProp = getProperties().inline_hint;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFuncOp func, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(func)>(func), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFuncOp func, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(func)>(func), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFunctionType calleeType, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFunctionType calleeType, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, StringAttr callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, StringAttr callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, FlatSymbolRefAttr callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, FlatSymbolRefAttr callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange results, StringRef callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeRange results, StringRef callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(results)>(results), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFunctionType calleeType, StringAttr callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFunctionType calleeType, StringAttr callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFunctionType calleeType, StringRef callee, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFunctionType calleeType, StringRef callee, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(callee_operands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
if (CConv) {
|
|
odsState.getOrAddProperties<Properties>().CConv = CConv;
|
|
}
|
|
if (TailCallKind) {
|
|
odsState.getOrAddProperties<Properties>().TailCallKind = TailCallKind;
|
|
}
|
|
if (memory_effects) {
|
|
odsState.getOrAddProperties<Properties>().memory_effects = memory_effects;
|
|
}
|
|
if (convergent) {
|
|
odsState.getOrAddProperties<Properties>().convergent = convergent;
|
|
}
|
|
if (no_unwind) {
|
|
odsState.getOrAddProperties<Properties>().no_unwind = no_unwind;
|
|
}
|
|
if (will_return) {
|
|
odsState.getOrAddProperties<Properties>().will_return = will_return;
|
|
}
|
|
if (noreturn) {
|
|
odsState.getOrAddProperties<Properties>().noreturn = noreturn;
|
|
}
|
|
if (returns_twice) {
|
|
odsState.getOrAddProperties<Properties>().returns_twice = returns_twice;
|
|
}
|
|
if (hot) {
|
|
odsState.getOrAddProperties<Properties>().hot = hot;
|
|
}
|
|
if (cold) {
|
|
odsState.getOrAddProperties<Properties>().cold = cold;
|
|
}
|
|
if (noduplicate) {
|
|
odsState.getOrAddProperties<Properties>().noduplicate = noduplicate;
|
|
}
|
|
if (no_caller_saved_registers) {
|
|
odsState.getOrAddProperties<Properties>().no_caller_saved_registers = no_caller_saved_registers;
|
|
}
|
|
if (nocallback) {
|
|
odsState.getOrAddProperties<Properties>().nocallback = nocallback;
|
|
}
|
|
if (modular_format) {
|
|
odsState.getOrAddProperties<Properties>().modular_format = modular_format;
|
|
}
|
|
if (nobuiltins) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltins = nobuiltins;
|
|
}
|
|
if (allocsize) {
|
|
odsState.getOrAddProperties<Properties>().allocsize = allocsize;
|
|
}
|
|
if (optsize) {
|
|
odsState.getOrAddProperties<Properties>().optsize = optsize;
|
|
}
|
|
if (minsize) {
|
|
odsState.getOrAddProperties<Properties>().minsize = minsize;
|
|
}
|
|
if (builtin) {
|
|
odsState.getOrAddProperties<Properties>().builtin = builtin;
|
|
}
|
|
if (nobuiltin) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltin = nobuiltin;
|
|
}
|
|
if (save_reg_params) {
|
|
odsState.getOrAddProperties<Properties>().save_reg_params = save_reg_params;
|
|
}
|
|
if (zero_call_used_regs) {
|
|
odsState.getOrAddProperties<Properties>().zero_call_used_regs = zero_call_used_regs;
|
|
}
|
|
if (trap_func_name) {
|
|
odsState.getOrAddProperties<Properties>().trap_func_name = trap_func_name;
|
|
}
|
|
if (default_func_attrs) {
|
|
odsState.getOrAddProperties<Properties>().default_func_attrs = default_func_attrs;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (no_inline) {
|
|
odsState.getOrAddProperties<Properties>().no_inline = no_inline;
|
|
}
|
|
if (always_inline) {
|
|
odsState.getOrAddProperties<Properties>().always_inline = always_inline;
|
|
}
|
|
if (inline_hint) {
|
|
odsState.getOrAddProperties<Properties>().inline_hint = inline_hint;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
if (result)
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(callee_operands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
if (CConv) {
|
|
odsState.getOrAddProperties<Properties>().CConv = CConv;
|
|
}
|
|
if (TailCallKind) {
|
|
odsState.getOrAddProperties<Properties>().TailCallKind = TailCallKind;
|
|
}
|
|
if (memory_effects) {
|
|
odsState.getOrAddProperties<Properties>().memory_effects = memory_effects;
|
|
}
|
|
if (convergent) {
|
|
odsState.getOrAddProperties<Properties>().convergent = convergent;
|
|
}
|
|
if (no_unwind) {
|
|
odsState.getOrAddProperties<Properties>().no_unwind = no_unwind;
|
|
}
|
|
if (will_return) {
|
|
odsState.getOrAddProperties<Properties>().will_return = will_return;
|
|
}
|
|
if (noreturn) {
|
|
odsState.getOrAddProperties<Properties>().noreturn = noreturn;
|
|
}
|
|
if (returns_twice) {
|
|
odsState.getOrAddProperties<Properties>().returns_twice = returns_twice;
|
|
}
|
|
if (hot) {
|
|
odsState.getOrAddProperties<Properties>().hot = hot;
|
|
}
|
|
if (cold) {
|
|
odsState.getOrAddProperties<Properties>().cold = cold;
|
|
}
|
|
if (noduplicate) {
|
|
odsState.getOrAddProperties<Properties>().noduplicate = noduplicate;
|
|
}
|
|
if (no_caller_saved_registers) {
|
|
odsState.getOrAddProperties<Properties>().no_caller_saved_registers = no_caller_saved_registers;
|
|
}
|
|
if (nocallback) {
|
|
odsState.getOrAddProperties<Properties>().nocallback = nocallback;
|
|
}
|
|
if (modular_format) {
|
|
odsState.getOrAddProperties<Properties>().modular_format = modular_format;
|
|
}
|
|
if (nobuiltins) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltins = nobuiltins;
|
|
}
|
|
if (allocsize) {
|
|
odsState.getOrAddProperties<Properties>().allocsize = allocsize;
|
|
}
|
|
if (optsize) {
|
|
odsState.getOrAddProperties<Properties>().optsize = optsize;
|
|
}
|
|
if (minsize) {
|
|
odsState.getOrAddProperties<Properties>().minsize = minsize;
|
|
}
|
|
if (builtin) {
|
|
odsState.getOrAddProperties<Properties>().builtin = builtin;
|
|
}
|
|
if (nobuiltin) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltin = nobuiltin;
|
|
}
|
|
if (save_reg_params) {
|
|
odsState.getOrAddProperties<Properties>().save_reg_params = save_reg_params;
|
|
}
|
|
if (zero_call_used_regs) {
|
|
odsState.getOrAddProperties<Properties>().zero_call_used_regs = zero_call_used_regs;
|
|
}
|
|
if (trap_func_name) {
|
|
odsState.getOrAddProperties<Properties>().trap_func_name = trap_func_name;
|
|
}
|
|
if (default_func_attrs) {
|
|
odsState.getOrAddProperties<Properties>().default_func_attrs = default_func_attrs;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (no_inline) {
|
|
odsState.getOrAddProperties<Properties>().no_inline = no_inline;
|
|
}
|
|
if (always_inline) {
|
|
odsState.getOrAddProperties<Properties>().always_inline = always_inline;
|
|
}
|
|
if (inline_hint) {
|
|
odsState.getOrAddProperties<Properties>().inline_hint = inline_hint;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, ::mlir::LLVM::CConvAttr CConv, ::mlir::LLVM::TailCallKindAttr TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/::mlir::UnitAttr convergent, /*optional*/::mlir::UnitAttr no_unwind, /*optional*/::mlir::UnitAttr will_return, /*optional*/::mlir::UnitAttr noreturn, /*optional*/::mlir::UnitAttr returns_twice, /*optional*/::mlir::UnitAttr hot, /*optional*/::mlir::UnitAttr cold, /*optional*/::mlir::UnitAttr noduplicate, /*optional*/::mlir::UnitAttr no_caller_saved_registers, /*optional*/::mlir::UnitAttr nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/::mlir::UnitAttr optsize, /*optional*/::mlir::UnitAttr minsize, /*optional*/::mlir::UnitAttr builtin, /*optional*/::mlir::UnitAttr nobuiltin, /*optional*/::mlir::UnitAttr save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::UnitAttr no_inline, /*optional*/::mlir::UnitAttr always_inline, /*optional*/::mlir::UnitAttr inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(callee_operands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.getOrAddProperties<Properties>().CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv);
|
|
odsState.getOrAddProperties<Properties>().TailCallKind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), TailCallKind);
|
|
if (memory_effects) {
|
|
odsState.getOrAddProperties<Properties>().memory_effects = memory_effects;
|
|
}
|
|
if (convergent) {
|
|
odsState.getOrAddProperties<Properties>().convergent = ((convergent) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (no_unwind) {
|
|
odsState.getOrAddProperties<Properties>().no_unwind = ((no_unwind) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (will_return) {
|
|
odsState.getOrAddProperties<Properties>().will_return = ((will_return) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (noreturn) {
|
|
odsState.getOrAddProperties<Properties>().noreturn = ((noreturn) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (returns_twice) {
|
|
odsState.getOrAddProperties<Properties>().returns_twice = ((returns_twice) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (hot) {
|
|
odsState.getOrAddProperties<Properties>().hot = ((hot) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (cold) {
|
|
odsState.getOrAddProperties<Properties>().cold = ((cold) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (noduplicate) {
|
|
odsState.getOrAddProperties<Properties>().noduplicate = ((noduplicate) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (no_caller_saved_registers) {
|
|
odsState.getOrAddProperties<Properties>().no_caller_saved_registers = ((no_caller_saved_registers) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nocallback) {
|
|
odsState.getOrAddProperties<Properties>().nocallback = ((nocallback) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (modular_format) {
|
|
odsState.getOrAddProperties<Properties>().modular_format = modular_format;
|
|
}
|
|
if (nobuiltins) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltins = nobuiltins;
|
|
}
|
|
if (allocsize) {
|
|
odsState.getOrAddProperties<Properties>().allocsize = allocsize;
|
|
}
|
|
if (optsize) {
|
|
odsState.getOrAddProperties<Properties>().optsize = ((optsize) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (minsize) {
|
|
odsState.getOrAddProperties<Properties>().minsize = ((minsize) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (builtin) {
|
|
odsState.getOrAddProperties<Properties>().builtin = ((builtin) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nobuiltin) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltin = ((nobuiltin) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (save_reg_params) {
|
|
odsState.getOrAddProperties<Properties>().save_reg_params = ((save_reg_params) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (zero_call_used_regs) {
|
|
odsState.getOrAddProperties<Properties>().zero_call_used_regs = zero_call_used_regs;
|
|
}
|
|
if (trap_func_name) {
|
|
odsState.getOrAddProperties<Properties>().trap_func_name = trap_func_name;
|
|
}
|
|
if (default_func_attrs) {
|
|
odsState.getOrAddProperties<Properties>().default_func_attrs = default_func_attrs;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (no_inline) {
|
|
odsState.getOrAddProperties<Properties>().no_inline = ((no_inline) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (always_inline) {
|
|
odsState.getOrAddProperties<Properties>().always_inline = ((always_inline) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (inline_hint) {
|
|
odsState.getOrAddProperties<Properties>().inline_hint = ((inline_hint) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
if (result)
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(callee_operands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.getOrAddProperties<Properties>().CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv);
|
|
odsState.getOrAddProperties<Properties>().TailCallKind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), TailCallKind);
|
|
if (memory_effects) {
|
|
odsState.getOrAddProperties<Properties>().memory_effects = memory_effects;
|
|
}
|
|
if (convergent) {
|
|
odsState.getOrAddProperties<Properties>().convergent = ((convergent) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (no_unwind) {
|
|
odsState.getOrAddProperties<Properties>().no_unwind = ((no_unwind) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (will_return) {
|
|
odsState.getOrAddProperties<Properties>().will_return = ((will_return) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (noreturn) {
|
|
odsState.getOrAddProperties<Properties>().noreturn = ((noreturn) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (returns_twice) {
|
|
odsState.getOrAddProperties<Properties>().returns_twice = ((returns_twice) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (hot) {
|
|
odsState.getOrAddProperties<Properties>().hot = ((hot) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (cold) {
|
|
odsState.getOrAddProperties<Properties>().cold = ((cold) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (noduplicate) {
|
|
odsState.getOrAddProperties<Properties>().noduplicate = ((noduplicate) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (no_caller_saved_registers) {
|
|
odsState.getOrAddProperties<Properties>().no_caller_saved_registers = ((no_caller_saved_registers) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nocallback) {
|
|
odsState.getOrAddProperties<Properties>().nocallback = ((nocallback) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (modular_format) {
|
|
odsState.getOrAddProperties<Properties>().modular_format = modular_format;
|
|
}
|
|
if (nobuiltins) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltins = nobuiltins;
|
|
}
|
|
if (allocsize) {
|
|
odsState.getOrAddProperties<Properties>().allocsize = allocsize;
|
|
}
|
|
if (optsize) {
|
|
odsState.getOrAddProperties<Properties>().optsize = ((optsize) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (minsize) {
|
|
odsState.getOrAddProperties<Properties>().minsize = ((minsize) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (builtin) {
|
|
odsState.getOrAddProperties<Properties>().builtin = ((builtin) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nobuiltin) {
|
|
odsState.getOrAddProperties<Properties>().nobuiltin = ((nobuiltin) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (save_reg_params) {
|
|
odsState.getOrAddProperties<Properties>().save_reg_params = ((save_reg_params) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (zero_call_used_regs) {
|
|
odsState.getOrAddProperties<Properties>().zero_call_used_regs = zero_call_used_regs;
|
|
}
|
|
if (trap_func_name) {
|
|
odsState.getOrAddProperties<Properties>().trap_func_name = trap_func_name;
|
|
}
|
|
if (default_func_attrs) {
|
|
odsState.getOrAddProperties<Properties>().default_func_attrs = default_func_attrs;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (no_inline) {
|
|
odsState.getOrAddProperties<Properties>().no_inline = ((no_inline) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (always_inline) {
|
|
odsState.getOrAddProperties<Properties>().always_inline = ((always_inline) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (inline_hint) {
|
|
odsState.getOrAddProperties<Properties>().inline_hint = ((inline_hint) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, ::mlir::LLVM::cconv::CConv CConv, ::mlir::LLVM::tailcallkind::TailCallKind TailCallKind, /*optional*/::mlir::LLVM::MemoryEffectsAttr memory_effects, /*optional*/bool convergent, /*optional*/bool no_unwind, /*optional*/bool will_return, /*optional*/bool noreturn, /*optional*/bool returns_twice, /*optional*/bool hot, /*optional*/bool cold, /*optional*/bool noduplicate, /*optional*/bool no_caller_saved_registers, /*optional*/bool nocallback, /*optional*/::mlir::StringAttr modular_format, /*optional*/::mlir::ArrayAttr nobuiltins, /*optional*/::mlir::DenseI32ArrayAttr allocsize, /*optional*/bool optsize, /*optional*/bool minsize, /*optional*/bool builtin, /*optional*/bool nobuiltin, /*optional*/bool save_reg_params, /*optional*/::mlir::StringAttr zero_call_used_regs, /*optional*/::mlir::StringAttr trap_func_name, /*optional*/::mlir::DictionaryAttr default_func_attrs, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/bool no_inline, /*optional*/bool always_inline, /*optional*/bool inline_hint, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(fastmathFlags)>(fastmathFlags), std::forward<decltype(CConv)>(CConv), std::forward<decltype(TailCallKind)>(TailCallKind), std::forward<decltype(memory_effects)>(memory_effects), std::forward<decltype(convergent)>(convergent), std::forward<decltype(no_unwind)>(no_unwind), std::forward<decltype(will_return)>(will_return), std::forward<decltype(noreturn)>(noreturn), std::forward<decltype(returns_twice)>(returns_twice), std::forward<decltype(hot)>(hot), std::forward<decltype(cold)>(cold), std::forward<decltype(noduplicate)>(noduplicate), std::forward<decltype(no_caller_saved_registers)>(no_caller_saved_registers), std::forward<decltype(nocallback)>(nocallback), std::forward<decltype(modular_format)>(modular_format), std::forward<decltype(nobuiltins)>(nobuiltins), std::forward<decltype(allocsize)>(allocsize), std::forward<decltype(optsize)>(optsize), std::forward<decltype(minsize)>(minsize), std::forward<decltype(builtin)>(builtin), std::forward<decltype(nobuiltin)>(nobuiltin), std::forward<decltype(save_reg_params)>(save_reg_params), std::forward<decltype(zero_call_used_regs)>(zero_call_used_regs), std::forward<decltype(trap_func_name)>(trap_func_name), std::forward<decltype(default_func_attrs)>(default_func_attrs), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(no_inline)>(no_inline), std::forward<decltype(always_inline)>(always_inline), std::forward<decltype(inline_hint)>(inline_hint), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<CallOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void CallOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
if (!properties.CConv)
|
|
properties.CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv::C);
|
|
if (!properties.TailCallKind)
|
|
properties.TailCallKind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), TailCallKind::None);
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::verifyInvariantsImpl() {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_TailCallKind = getProperties().TailCallKind; (void)tblgen_TailCallKind;
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_allocsize = getProperties().allocsize; (void)tblgen_allocsize;
|
|
auto tblgen_always_inline = getProperties().always_inline; (void)tblgen_always_inline;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_builtin = getProperties().builtin; (void)tblgen_builtin;
|
|
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
|
|
auto tblgen_cold = getProperties().cold; (void)tblgen_cold;
|
|
auto tblgen_convergent = getProperties().convergent; (void)tblgen_convergent;
|
|
auto tblgen_default_func_attrs = getProperties().default_func_attrs; (void)tblgen_default_func_attrs;
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_hot = getProperties().hot; (void)tblgen_hot;
|
|
auto tblgen_inline_hint = getProperties().inline_hint; (void)tblgen_inline_hint;
|
|
auto tblgen_memory_effects = getProperties().memory_effects; (void)tblgen_memory_effects;
|
|
auto tblgen_minsize = getProperties().minsize; (void)tblgen_minsize;
|
|
auto tblgen_modular_format = getProperties().modular_format; (void)tblgen_modular_format;
|
|
auto tblgen_no_caller_saved_registers = getProperties().no_caller_saved_registers; (void)tblgen_no_caller_saved_registers;
|
|
auto tblgen_no_inline = getProperties().no_inline; (void)tblgen_no_inline;
|
|
auto tblgen_no_unwind = getProperties().no_unwind; (void)tblgen_no_unwind;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nobuiltin = getProperties().nobuiltin; (void)tblgen_nobuiltin;
|
|
auto tblgen_nobuiltins = getProperties().nobuiltins; (void)tblgen_nobuiltins;
|
|
auto tblgen_nocallback = getProperties().nocallback; (void)tblgen_nocallback;
|
|
auto tblgen_noduplicate = getProperties().noduplicate; (void)tblgen_noduplicate;
|
|
auto tblgen_noreturn = getProperties().noreturn; (void)tblgen_noreturn;
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitOpError("requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_optsize = getProperties().optsize; (void)tblgen_optsize;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_returns_twice = getProperties().returns_twice; (void)tblgen_returns_twice;
|
|
auto tblgen_save_reg_params = getProperties().save_reg_params; (void)tblgen_save_reg_params;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_trap_func_name = getProperties().trap_func_name; (void)tblgen_trap_func_name;
|
|
auto tblgen_var_callee_type = getProperties().var_callee_type; (void)tblgen_var_callee_type;
|
|
auto tblgen_will_return = getProperties().will_return; (void)tblgen_will_return;
|
|
auto tblgen_zero_call_used_regs = getProperties().zero_call_used_regs; (void)tblgen_zero_call_used_regs;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(*this, tblgen_var_callee_type, "var_callee_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_callee, "callee")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(*this, tblgen_CConv, "CConv")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(*this, tblgen_TailCallKind, "TailCallKind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(*this, tblgen_memory_effects, "memory_effects")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_convergent, "convergent")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_unwind, "no_unwind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_will_return, "will_return")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_noreturn, "noreturn")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_returns_twice, "returns_twice")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_hot, "hot")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_cold, "cold")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_noduplicate, "noduplicate")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_caller_saved_registers, "no_caller_saved_registers")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nocallback, "nocallback")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_modular_format, "modular_format")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_nobuiltins, "nobuiltins")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_allocsize, "allocsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_optsize, "optsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_minsize, "minsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_builtin, "builtin")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nobuiltin, "nobuiltin")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_save_reg_params, "save_reg_params")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_zero_call_used_regs, "zero_call_used_regs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_trap_func_name, "trap_func_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(*this, tblgen_default_func_attrs, "default_func_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_op_bundle_sizes, "op_bundle_sizes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_op_bundle_tags, "op_bundle_tags")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_arg_attrs, "arg_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_res_attrs, "res_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_inline, "no_inline")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_always_inline, "always_inline")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_inline_hint, "inline_hint")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_access_groups, "access_groups")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_alias_scopes, "alias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_noalias_scopes, "noalias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_tbaa, "tbaa")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "op_bundle_sizes", "op_bundle_operands", valueGroup1.size())))
|
|
return ::mlir::failure();
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
if (valueGroup0.size() > 1) {
|
|
return emitOpError("result group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup0.size();
|
|
}
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult CallOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.var_callee_type;
|
|
auto var_callee_typeAttrName = ::mlir::StringAttr::get(ctx, "var_callee_type");
|
|
auto attr = dict.get(var_callee_typeAttrName);
|
|
usedKeys.insert(var_callee_typeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for var_callee_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `var_callee_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.callee;
|
|
auto calleeAttrName = ::mlir::StringAttr::get(ctx, "callee");
|
|
auto attr = dict.get(calleeAttrName);
|
|
usedKeys.insert(calleeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for callee in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto fastmathFlagsAttrName = ::mlir::StringAttr::get(ctx, "fastmathFlags");
|
|
auto attr = dict.get(fastmathFlagsAttrName);
|
|
usedKeys.insert(fastmathFlagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.CConv;
|
|
auto CConvAttrName = ::mlir::StringAttr::get(ctx, "CConv");
|
|
auto attr = dict.get(CConvAttrName);
|
|
usedKeys.insert(CConvAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for CConv in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.TailCallKind;
|
|
auto TailCallKindAttrName = ::mlir::StringAttr::get(ctx, "TailCallKind");
|
|
auto attr = dict.get(TailCallKindAttrName);
|
|
usedKeys.insert(TailCallKindAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for TailCallKind in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `TailCallKind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.memory_effects;
|
|
auto memory_effectsAttrName = ::mlir::StringAttr::get(ctx, "memory_effects");
|
|
auto attr = dict.get(memory_effectsAttrName);
|
|
usedKeys.insert(memory_effectsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for memory_effects in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `memory_effects` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.convergent;
|
|
auto convergentAttrName = ::mlir::StringAttr::get(ctx, "convergent");
|
|
auto attr = dict.get(convergentAttrName);
|
|
usedKeys.insert(convergentAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for convergent in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `convergent` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_unwind;
|
|
auto no_unwindAttrName = ::mlir::StringAttr::get(ctx, "no_unwind");
|
|
auto attr = dict.get(no_unwindAttrName);
|
|
usedKeys.insert(no_unwindAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_unwind in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_unwind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.will_return;
|
|
auto will_returnAttrName = ::mlir::StringAttr::get(ctx, "will_return");
|
|
auto attr = dict.get(will_returnAttrName);
|
|
usedKeys.insert(will_returnAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for will_return in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `will_return` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.noreturn;
|
|
auto noreturnAttrName = ::mlir::StringAttr::get(ctx, "noreturn");
|
|
auto attr = dict.get(noreturnAttrName);
|
|
usedKeys.insert(noreturnAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for noreturn in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noreturn` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.returns_twice;
|
|
auto returns_twiceAttrName = ::mlir::StringAttr::get(ctx, "returns_twice");
|
|
auto attr = dict.get(returns_twiceAttrName);
|
|
usedKeys.insert(returns_twiceAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for returns_twice in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `returns_twice` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.hot;
|
|
auto hotAttrName = ::mlir::StringAttr::get(ctx, "hot");
|
|
auto attr = dict.get(hotAttrName);
|
|
usedKeys.insert(hotAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for hot in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `hot` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.cold;
|
|
auto coldAttrName = ::mlir::StringAttr::get(ctx, "cold");
|
|
auto attr = dict.get(coldAttrName);
|
|
usedKeys.insert(coldAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for cold in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cold` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.noduplicate;
|
|
auto noduplicateAttrName = ::mlir::StringAttr::get(ctx, "noduplicate");
|
|
auto attr = dict.get(noduplicateAttrName);
|
|
usedKeys.insert(noduplicateAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for noduplicate in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noduplicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_caller_saved_registers;
|
|
auto no_caller_saved_registersAttrName = ::mlir::StringAttr::get(ctx, "no_caller_saved_registers");
|
|
auto attr = dict.get(no_caller_saved_registersAttrName);
|
|
usedKeys.insert(no_caller_saved_registersAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_caller_saved_registers in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_caller_saved_registers` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.nocallback;
|
|
auto nocallbackAttrName = ::mlir::StringAttr::get(ctx, "nocallback");
|
|
auto attr = dict.get(nocallbackAttrName);
|
|
usedKeys.insert(nocallbackAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for nocallback in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nocallback` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.modular_format;
|
|
auto modular_formatAttrName = ::mlir::StringAttr::get(ctx, "modular_format");
|
|
auto attr = dict.get(modular_formatAttrName);
|
|
usedKeys.insert(modular_formatAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for modular_format in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `modular_format` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.nobuiltins;
|
|
auto nobuiltinsAttrName = ::mlir::StringAttr::get(ctx, "nobuiltins");
|
|
auto attr = dict.get(nobuiltinsAttrName);
|
|
usedKeys.insert(nobuiltinsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for nobuiltins in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltins` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.allocsize;
|
|
auto allocsizeAttrName = ::mlir::StringAttr::get(ctx, "allocsize");
|
|
auto attr = dict.get(allocsizeAttrName);
|
|
usedKeys.insert(allocsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for allocsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `allocsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.optsize;
|
|
auto optsizeAttrName = ::mlir::StringAttr::get(ctx, "optsize");
|
|
auto attr = dict.get(optsizeAttrName);
|
|
usedKeys.insert(optsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for optsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.minsize;
|
|
auto minsizeAttrName = ::mlir::StringAttr::get(ctx, "minsize");
|
|
auto attr = dict.get(minsizeAttrName);
|
|
usedKeys.insert(minsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for minsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `minsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.builtin;
|
|
auto builtinAttrName = ::mlir::StringAttr::get(ctx, "builtin");
|
|
auto attr = dict.get(builtinAttrName);
|
|
usedKeys.insert(builtinAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for builtin in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `builtin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.nobuiltin;
|
|
auto nobuiltinAttrName = ::mlir::StringAttr::get(ctx, "nobuiltin");
|
|
auto attr = dict.get(nobuiltinAttrName);
|
|
usedKeys.insert(nobuiltinAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for nobuiltin in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltin` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.save_reg_params;
|
|
auto save_reg_paramsAttrName = ::mlir::StringAttr::get(ctx, "save_reg_params");
|
|
auto attr = dict.get(save_reg_paramsAttrName);
|
|
usedKeys.insert(save_reg_paramsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for save_reg_params in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `save_reg_params` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.zero_call_used_regs;
|
|
auto zero_call_used_regsAttrName = ::mlir::StringAttr::get(ctx, "zero_call_used_regs");
|
|
auto attr = dict.get(zero_call_used_regsAttrName);
|
|
usedKeys.insert(zero_call_used_regsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for zero_call_used_regs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `zero_call_used_regs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.trap_func_name;
|
|
auto trap_func_nameAttrName = ::mlir::StringAttr::get(ctx, "trap_func_name");
|
|
auto attr = dict.get(trap_func_nameAttrName);
|
|
usedKeys.insert(trap_func_nameAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for trap_func_name in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `trap_func_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.default_func_attrs;
|
|
auto default_func_attrsAttrName = ::mlir::StringAttr::get(ctx, "default_func_attrs");
|
|
auto attr = dict.get(default_func_attrsAttrName);
|
|
usedKeys.insert(default_func_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for default_func_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `default_func_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto op_bundle_sizesAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_sizes");
|
|
auto attr = dict.get(op_bundle_sizesAttrName);
|
|
usedKeys.insert(op_bundle_sizesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_sizes in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto op_bundle_tagsAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_tags");
|
|
auto attr = dict.get(op_bundle_tagsAttrName);
|
|
usedKeys.insert(op_bundle_tagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_tags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs");
|
|
auto attr = dict.get(arg_attrsAttrName);
|
|
usedKeys.insert(arg_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.res_attrs;
|
|
auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs");
|
|
auto attr = dict.get(res_attrsAttrName);
|
|
usedKeys.insert(res_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_inline;
|
|
auto no_inlineAttrName = ::mlir::StringAttr::get(ctx, "no_inline");
|
|
auto attr = dict.get(no_inlineAttrName);
|
|
usedKeys.insert(no_inlineAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_inline in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.always_inline;
|
|
auto always_inlineAttrName = ::mlir::StringAttr::get(ctx, "always_inline");
|
|
auto attr = dict.get(always_inlineAttrName);
|
|
usedKeys.insert(always_inlineAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for always_inline in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `always_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.inline_hint;
|
|
auto inline_hintAttrName = ::mlir::StringAttr::get(ctx, "inline_hint");
|
|
auto attr = dict.get(inline_hintAttrName);
|
|
usedKeys.insert(inline_hintAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for inline_hint in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inline_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.access_groups;
|
|
auto access_groupsAttrName = ::mlir::StringAttr::get(ctx, "access_groups");
|
|
auto attr = dict.get(access_groupsAttrName);
|
|
usedKeys.insert(access_groupsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for access_groups in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto alias_scopesAttrName = ::mlir::StringAttr::get(ctx, "alias_scopes");
|
|
auto attr = dict.get(alias_scopesAttrName);
|
|
usedKeys.insert(alias_scopesAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for alias_scopes in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto noalias_scopesAttrName = ::mlir::StringAttr::get(ctx, "noalias_scopes");
|
|
auto attr = dict.get(noalias_scopesAttrName);
|
|
usedKeys.insert(noalias_scopesAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.tbaa;
|
|
auto tbaaAttrName = ::mlir::StringAttr::get(ctx, "tbaa");
|
|
auto attr = dict.get(tbaaAttrName);
|
|
usedKeys.insert(tbaaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for tbaa in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::CallOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ComdatOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ComdatOpGenericAdaptorBase::ComdatOpGenericAdaptorBase(ComdatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef ComdatOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ComdatOpAdaptor::ComdatOpAdaptor(ComdatOp op) : ComdatOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ComdatOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.comdat' op requires attribute 'sym_name'");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.comdat' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ComdatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ComdatOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ComdatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ComdatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ComdatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ComdatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.sym_name);
|
|
}
|
|
|
|
::llvm::StringRef ComdatOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ComdatOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
ComdatOp ComdatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef symName) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(symName)>(symName));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatOp ComdatOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef symName) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(symName)>(symName));
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatOp::verifyInvariantsImpl() {
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps1(*this, region, "body", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ComdatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::StringAttr sym_nameAttr;
|
|
std::unique_ptr<::mlir::Region> bodyRegion = std::make_unique<::mlir::Region>();
|
|
|
|
if (parser.parseSymbolName(sym_nameAttr))
|
|
return ::mlir::failure();
|
|
if (sym_nameAttr) result.getOrAddProperties<ComdatOp::Properties>().sym_name = sym_nameAttr;
|
|
|
|
if (parser.parseRegion(*bodyRegion))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
result.addRegion(std::move(bodyRegion));
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ComdatOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printRegion(getBody());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("sym_name");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ComdatOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ComdatSelectorOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ComdatSelectorOpGenericAdaptorBase::ComdatSelectorOpGenericAdaptorBase(ComdatSelectorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef ComdatSelectorOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::comdat::Comdat ComdatSelectorOpGenericAdaptorBase::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ComdatSelectorOpAdaptor::ComdatSelectorOpAdaptor(ComdatSelectorOp op) : ComdatSelectorOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
if (!tblgen_comdat) return emitError(loc, "'llvm.comdat_selector' op requires attribute 'comdat'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.comdat_selector' op requires attribute 'sym_name'");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.comdat_selector' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_comdat && !((::llvm::isa<::mlir::LLVM::comdat::ComdatAttr>(tblgen_comdat))))
|
|
return emitError(loc, "'llvm.comdat_selector' op attribute 'comdat' failed to satisfy constraint: LLVM Comdat Types");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.comdat;
|
|
auto attr = dict.get("comdat");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `comdat` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ComdatSelectorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.comdat;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("comdat",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ComdatSelectorOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.comdat.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ComdatSelectorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "comdat")
|
|
return prop.comdat;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ComdatSelectorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "comdat") {
|
|
prop.comdat = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.comdat)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ComdatSelectorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.comdat) attrs.append("comdat", prop.comdat);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getComdatAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps26(attr, "comdat", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.comdat)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ComdatSelectorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.comdat);
|
|
writer.writeAttribute(prop.sym_name);
|
|
}
|
|
|
|
::llvm::StringRef ComdatSelectorOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::comdat::Comdat ComdatSelectorOp::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ComdatSelectorOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void ComdatSelectorOp::setComdat(::mlir::LLVM::comdat::Comdat attrValue) {
|
|
getProperties().comdat = ::mlir::LLVM::comdat::ComdatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().comdat = ::mlir::LLVM::comdat::ComdatAttr::get(odsBuilder.getContext(), comdat);
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().comdat = ::mlir::LLVM::comdat::ComdatAttr::get(odsBuilder.getContext(), comdat);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(comdat)>(comdat));
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ComdatSelectorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ComdatSelectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ComdatSelectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ComdatSelectorOp ComdatSelectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOp::verifyInvariantsImpl() {
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
if (!tblgen_comdat) return emitOpError("requires attribute 'comdat'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps26(*this, tblgen_comdat, "comdat")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ComdatSelectorOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ComdatSelectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::StringAttr sym_nameAttr;
|
|
::mlir::LLVM::comdat::ComdatAttr comdatAttr;
|
|
|
|
if (parser.parseSymbolName(sym_nameAttr))
|
|
return ::mlir::failure();
|
|
if (sym_nameAttr) result.getOrAddProperties<ComdatSelectorOp::Properties>().sym_name = sym_nameAttr;
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"any","exactmatch","largest","nodeduplicate","samesize"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"comdat", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'comdat' [any, exactmatch, largest, nodeduplicate, samesize]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::comdat::symbolizeComdat(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "comdat attribute specification: \"" << attrStr << '"';;
|
|
|
|
comdatAttr = ::mlir::LLVM::comdat::ComdatAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<ComdatSelectorOp::Properties>().comdat = comdatAttr;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ComdatSelectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getComdat();
|
|
auto caseValueStr = stringifyComdat(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("sym_name");
|
|
elidedAttrs.push_back("comdat");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatSelectorOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ComdatSelectorOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::CondBrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
CondBrOpGenericAdaptorBase::CondBrOpGenericAdaptorBase(CondBrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> CondBrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> CondBrOpGenericAdaptorBase::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LoopAnnotationAttr> CondBrOpGenericAdaptorBase::getLoopAnnotation() {
|
|
auto attr = getLoopAnnotationAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
CondBrOpAdaptor::CondBrOpAdaptor(CondBrOp op) : CondBrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult CondBrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation;
|
|
|
|
if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights))))
|
|
return emitError(loc, "'llvm.cond_br' op attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_loop_annotation && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(tblgen_loop_annotation))))
|
|
return emitError(loc, "'llvm.cond_br' op attribute 'loop_annotation' failed to satisfy constraint: ");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> CondBrOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange CondBrOp::getTrueDestOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange CondBrOp::getFalseDestOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult CondBrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.branch_weights;
|
|
auto attr = dict.get("branch_weights");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.loop_annotation;
|
|
auto attr = dict.get("loop_annotation");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `loop_annotation` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute CondBrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.branch_weights;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("branch_weights",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.loop_annotation;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("loop_annotation",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code CondBrOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.branch_weights.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.loop_annotation.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> CondBrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "branch_weights")
|
|
return prop.branch_weights;
|
|
|
|
if (name == "loop_annotation")
|
|
return prop.loop_annotation;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void CondBrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "branch_weights") {
|
|
prop.branch_weights = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.branch_weights)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "loop_annotation") {
|
|
prop.loop_annotation = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.loop_annotation)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CondBrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights);
|
|
|
|
if (prop.loop_annotation) attrs.append("loop_annotation", prop.loop_annotation);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult CondBrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "branch_weights", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLoopAnnotationAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(attr, "loop_annotation", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CondBrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.loop_annotation)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void CondBrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.branch_weights);
|
|
|
|
writer.writeOptionalAttribute(prop.loop_annotation);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> CondBrOp::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LoopAnnotationAttr> CondBrOp::getLoopAnnotation() {
|
|
auto attr = getLoopAnnotationAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
void CondBrOp::setBranchWeights(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().branch_weights;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value condition, Block *trueDest, ValueRange trueOperands, Block *falseDest, ValueRange falseOperands, std::optional<std::pair<uint32_t, uint32_t>> weights) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(trueOperands)>(trueOperands), std::forward<decltype(falseDest)>(falseDest), std::forward<decltype(falseOperands)>(falseOperands), std::forward<decltype(weights)>(weights));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, Value condition, Block *trueDest, ValueRange trueOperands, Block *falseDest, ValueRange falseOperands, std::optional<std::pair<uint32_t, uint32_t>> weights) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(trueOperands)>(trueOperands), std::forward<decltype(falseDest)>(falseDest), std::forward<decltype(falseOperands)>(falseOperands), std::forward<decltype(weights)>(weights));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands) {
|
|
build(odsBuilder, odsState, condition, trueDest, ValueRange(), falseDest,
|
|
falseOperands);
|
|
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest), std::forward<decltype(falseOperands)>(falseOperands));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest), std::forward<decltype(falseOperands)>(falseOperands));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, ValueRange trueOperands, ValueRange falseOperands, DenseI32ArrayAttr branchWeights, Block *trueDest, Block *falseDest) {
|
|
build(odsBuilder, odsState, condition, trueOperands, falseOperands, branchWeights,
|
|
{}, trueDest, falseDest);
|
|
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value condition, ValueRange trueOperands, ValueRange falseOperands, DenseI32ArrayAttr branchWeights, Block *trueDest, Block *falseDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueOperands)>(trueOperands), std::forward<decltype(falseOperands)>(falseOperands), std::forward<decltype(branchWeights)>(branchWeights), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, Value condition, ValueRange trueOperands, ValueRange falseOperands, DenseI32ArrayAttr branchWeights, Block *trueDest, Block *falseDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueOperands)>(trueOperands), std::forward<decltype(falseOperands)>(falseOperands), std::forward<decltype(branchWeights)>(branchWeights), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addSuccessors(destinations);
|
|
odsState.addAttributes(attributes);
|
|
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueDestOperands);
|
|
odsState.addOperands(falseDestOperands);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(trueDestOperands.size()), static_cast<int32_t>(falseDestOperands.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
if (loop_annotation) {
|
|
odsState.getOrAddProperties<Properties>().loop_annotation = loop_annotation;
|
|
}
|
|
odsState.addSuccessors(trueDest);
|
|
odsState.addSuccessors(falseDest);
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueDestOperands)>(trueDestOperands), std::forward<decltype(falseDestOperands)>(falseDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueDestOperands)>(trueDestOperands), std::forward<decltype(falseDestOperands)>(falseDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueDestOperands);
|
|
odsState.addOperands(falseDestOperands);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(trueDestOperands.size()), static_cast<int32_t>(falseDestOperands.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
if (loop_annotation) {
|
|
odsState.getOrAddProperties<Properties>().loop_annotation = loop_annotation;
|
|
}
|
|
odsState.addSuccessors(trueDest);
|
|
odsState.addSuccessors(falseDest);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueDestOperands)>(trueDestOperands), std::forward<decltype(falseDestOperands)>(falseDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueDestOperands)>(trueDestOperands), std::forward<decltype(falseDestOperands)>(falseDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(loop_annotation)>(loop_annotation), std::forward<decltype(trueDest)>(trueDest), std::forward<decltype(falseDest)>(falseDest));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<CondBrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void CondBrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<CondBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
CondBrOp CondBrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult CondBrOp::verifyInvariantsImpl() {
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_branch_weights, "branch_weights")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(*this, tblgen_loop_annotation, "loop_annotation")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps11(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult CondBrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult CondBrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
|
|
(void)conditionOperandsLoc;
|
|
::mlir::DenseI32ArrayAttr branch_weightsAttr;
|
|
::mlir::Block *trueDestSuccessor = nullptr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> trueDestOperandsOperands;
|
|
::llvm::SMLoc trueDestOperandsOperandsLoc;
|
|
(void)trueDestOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> trueDestOperandsTypes;
|
|
::mlir::Block *falseDestSuccessor = nullptr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> falseDestOperandsOperands;
|
|
::llvm::SMLoc falseDestOperandsOperandsLoc;
|
|
(void)falseDestOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> falseDestOperandsTypes;
|
|
|
|
conditionOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(conditionRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("weights"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(branch_weightsAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (branch_weightsAttr) result.getOrAddProperties<CondBrOp::Properties>().branch_weights = branch_weightsAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseSuccessor(trueDestSuccessor))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalLParen())) {
|
|
|
|
trueDestOperandsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(trueDestOperandsOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(trueDestOperandsTypes))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseSuccessor(falseDestSuccessor))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalLParen())) {
|
|
|
|
falseDestOperandsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(falseDestOperandsOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(falseDestOperandsTypes))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
result.addSuccessors(trueDestSuccessor);
|
|
result.addSuccessors(falseDestSuccessor);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(trueDestOperandsOperands.size()), static_cast<int32_t>(falseDestOperandsOperands.size())}), result.getOrAddProperties<CondBrOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
|
|
if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(trueDestOperandsOperands, trueDestOperandsTypes, trueDestOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(falseDestOperandsOperands, falseDestOperandsTypes, falseDestOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void CondBrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getCondition();
|
|
if (getBranchWeightsAttr()) {
|
|
_odsPrinter << ' ' << "weights";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printStrippedAttrOrType(getBranchWeightsAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getTrueDest();
|
|
if (!getTrueDestOperands().empty()) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getTrueDestOperands();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getTrueDestOperands().getTypes();
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getFalseDest();
|
|
if (!getFalseDestOperands().empty()) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getFalseDestOperands();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getFalseDestOperands().getTypes();
|
|
_odsPrinter << ")";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("branch_weights");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void CondBrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CondBrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::CondBrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ConstantOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::Attribute ConstantOpGenericAdaptorBase::getValue() {
|
|
auto attr = getValueAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_value = getProperties().value; (void)tblgen_value;
|
|
if (!tblgen_value) return emitError(loc, "'llvm.mlir.constant' op requires attribute 'value'");
|
|
|
|
if (tblgen_value && !((true)))
|
|
return emitError(loc, "'llvm.mlir.constant' op attribute 'value' failed to satisfy constraint: any attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.value;
|
|
auto attr = dict.get("value");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `value` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.value;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("value",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.value.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "value")
|
|
return prop.value;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "value") {
|
|
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.value) attrs.append("value", prop.value);
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(attr, "value", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.value)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.value);
|
|
}
|
|
|
|
::mlir::Attribute ConstantOp::getValue() {
|
|
auto attr = getValueAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, int64_t value) {
|
|
build(odsBuilder, odsState, type, odsBuilder.getIntegerAttr(type, value));
|
|
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, int64_t value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, int64_t value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APInt &value) {
|
|
build(odsBuilder, odsState, type, odsBuilder.getIntegerAttr(type, value));
|
|
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, const APInt &value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, const APInt &value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APFloat &value) {
|
|
build(odsBuilder, odsState, type, odsBuilder.getFloatAttr(type, value));
|
|
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, const APFloat &value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, const APFloat &value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedAttr value) {
|
|
build(odsBuilder, odsState, value.getType(), value);
|
|
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypedAttr value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, TypedAttr value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Attribute value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Attribute value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Attribute value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ConstantOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::verifyInvariantsImpl() {
|
|
auto tblgen_value = getProperties().value; (void)tblgen_value;
|
|
if (!tblgen_value) return emitOpError("requires attribute 'value'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(*this, tblgen_value, "value")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Attribute valueAttr;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseAttribute(valueAttr, ::mlir::Type{}))
|
|
return ::mlir::failure();
|
|
if (valueAttr) result.getOrAddProperties<ConstantOp::Properties>().value = valueAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttribute(getValueAttr());
|
|
_odsPrinter << ")";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("value");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ConstantOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ConstantOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::DSOLocalEquivalentOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DSOLocalEquivalentOpGenericAdaptorBase::DSOLocalEquivalentOpGenericAdaptorBase(DSOLocalEquivalentOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef DSOLocalEquivalentOpGenericAdaptorBase::getFunctionName() {
|
|
auto attr = getFunctionNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DSOLocalEquivalentOpAdaptor::DSOLocalEquivalentOpAdaptor(DSOLocalEquivalentOp op) : DSOLocalEquivalentOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_function_name = getProperties().function_name; (void)tblgen_function_name;
|
|
if (!tblgen_function_name) return emitError(loc, "'llvm.dso_local_equivalent' op requires attribute 'function_name'");
|
|
|
|
if (tblgen_function_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_function_name))))
|
|
return emitError(loc, "'llvm.dso_local_equivalent' op attribute 'function_name' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.function_name;
|
|
auto attr = dict.get("function_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `function_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DSOLocalEquivalentOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.function_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("function_name",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DSOLocalEquivalentOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.function_name.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DSOLocalEquivalentOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "function_name")
|
|
return prop.function_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "function_name") {
|
|
prop.function_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_name)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.function_name) attrs.append("function_name", prop.function_name);
|
|
}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFunctionNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "function_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.function_name)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.function_name);
|
|
}
|
|
|
|
::llvm::StringRef DSOLocalEquivalentOp::getFunctionName() {
|
|
auto attr = getFunctionNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::setFunctionName(::llvm::StringRef attrValue) {
|
|
getProperties().function_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::FlatSymbolRefAttr function_name) {
|
|
odsState.getOrAddProperties<Properties>().function_name = function_name;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::FlatSymbolRefAttr function_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(function_name)>(function_name));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::FlatSymbolRefAttr function_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(function_name)>(function_name));
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr function_name) {
|
|
odsState.getOrAddProperties<Properties>().function_name = function_name;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr function_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(function_name)>(function_name));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr function_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(function_name)>(function_name));
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::llvm::StringRef function_name) {
|
|
odsState.getOrAddProperties<Properties>().function_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), function_name);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::llvm::StringRef function_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(function_name)>(function_name));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::llvm::StringRef function_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(function_name)>(function_name));
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef function_name) {
|
|
odsState.getOrAddProperties<Properties>().function_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), function_name);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef function_name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(function_name)>(function_name));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef function_name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(function_name)>(function_name));
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<DSOLocalEquivalentOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DSOLocalEquivalentOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DSOLocalEquivalentOp DSOLocalEquivalentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOp::verifyInvariantsImpl() {
|
|
auto tblgen_function_name = getProperties().function_name; (void)tblgen_function_name;
|
|
if (!tblgen_function_name) return emitOpError("requires attribute 'function_name'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_function_name, "function_name")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DSOLocalEquivalentOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult DSOLocalEquivalentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::FlatSymbolRefAttr function_nameAttr;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
if (parser.parseCustomAttributeWithFallback(function_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (function_nameAttr) result.getOrAddProperties<DSOLocalEquivalentOp::Properties>().function_name = function_nameAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(resRawType))
|
|
return ::mlir::failure();
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getFunctionNameAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("function_name");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRes().getType();
|
|
}
|
|
|
|
void DSOLocalEquivalentOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DSOLocalEquivalentOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::DSOLocalEquivalentOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ExtractElementOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ExtractElementOpGenericAdaptorBase::ExtractElementOpGenericAdaptorBase(ExtractElementOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
ExtractElementOpAdaptor::ExtractElementOpAdaptor(ExtractElementOp op) : ExtractElementOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ExtractElementOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractElementOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ExtractElementOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ExtractElementOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ExtractElementOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ExtractElementOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ExtractElementOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractElementOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(position);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(position);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ExtractElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(position);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(vector)>(vector), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ExtractElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ExtractElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractElementOp ExtractElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractElementOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()(::llvm::cast<::mlir::VectorType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that result type matches vector element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractElementOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractElementOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = ::llvm::cast<::mlir::VectorType>(operands[0].getType()).getElementType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult ExtractElementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc;
|
|
(void)vectorOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand positionRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> positionOperands(&positionRawOperand, 1); ::llvm::SMLoc positionOperandsLoc;
|
|
(void)positionOperandsLoc;
|
|
::mlir::Type positionRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> positionTypes(&positionRawType, 1);
|
|
::mlir::Type vectorRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1);
|
|
|
|
vectorOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(vectorRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
positionOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(positionRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
positionRawType = type;
|
|
}
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
vectorRawType = type;
|
|
}
|
|
for (::mlir::Type type : vectorTypes) {
|
|
(void)type;
|
|
if (!((::mlir::LLVM::isCompatibleVectorType(type)))) {
|
|
return parser.emitError(parser.getNameLoc()) << "'vector' must be LLVM dialect-compatible vector type, but got " << type;
|
|
}
|
|
}
|
|
result.addTypes(::llvm::cast<::mlir::VectorType>(vectorTypes[0]).getElementType());
|
|
if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(positionOperands, positionTypes, positionOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtractElementOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getVector();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getPosition();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getPosition().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getVector().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ExtractElementOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractElementOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ExtractValueOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ExtractValueOpGenericAdaptorBase::ExtractValueOpGenericAdaptorBase(ExtractValueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::ArrayRef<int64_t> ExtractValueOpGenericAdaptorBase::getPosition() {
|
|
auto attr = getPositionAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ExtractValueOpAdaptor::ExtractValueOpAdaptor(ExtractValueOp op) : ExtractValueOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ExtractValueOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_position = getProperties().position; (void)tblgen_position;
|
|
if (!tblgen_position) return emitError(loc, "'llvm.extractvalue' op requires attribute 'position'");
|
|
|
|
if (tblgen_position && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_position))))
|
|
return emitError(loc, "'llvm.extractvalue' op attribute 'position' failed to satisfy constraint: i64 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.position;
|
|
auto attr = dict.get("position");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `position` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ExtractValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.position;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("position",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ExtractValueOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.position.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ExtractValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "position")
|
|
return prop.position;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ExtractValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "position") {
|
|
prop.position = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.position)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ExtractValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.position) attrs.append("position", prop.position);
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPositionAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(attr, "position", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.position)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtractValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.position);
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> ExtractValueOp::getPosition() {
|
|
auto attr = getPositionAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ExtractValueOp::setPosition(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().position = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value container, ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, Value container, ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
odsState.addOperands(container);
|
|
odsState.getOrAddProperties<Properties>().position = position;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
odsState.addOperands(container);
|
|
odsState.getOrAddProperties<Properties>().position = position;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
odsState.addOperands(container);
|
|
odsState.getOrAddProperties<Properties>().position = odsBuilder.getDenseI64ArrayAttr(position);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
odsState.addOperands(container);
|
|
odsState.getOrAddProperties<Properties>().position = odsBuilder.getDenseI64ArrayAttr(position);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::llvm::ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ExtractValueOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ExtractValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtractValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtractValueOp ExtractValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractValueOp::verifyInvariantsImpl() {
|
|
auto tblgen_position = getProperties().position; (void)tblgen_position;
|
|
if (!tblgen_position) return emitOpError("requires attribute 'position'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(*this, tblgen_position, "position")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtractValueOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ExtractValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand containerRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> containerOperands(&containerRawOperand, 1); ::llvm::SMLoc containerOperandsLoc;
|
|
(void)containerOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr positionAttr;
|
|
::mlir::Type containerRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> containerTypes(&containerRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
containerOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(containerRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(positionAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (positionAttr) result.getOrAddProperties<ExtractValueOp::Properties>().position = positionAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
containerRawType = type;
|
|
}
|
|
{
|
|
auto odsResult = parseInsertExtractValueElementType(parser, resRawType, containerRawType, positionAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(containerOperands, containerTypes, containerOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtractValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getContainer();
|
|
_odsPrinter.printStrippedAttrOrType(getPositionAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("position");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getContainer().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ';
|
|
printInsertExtractValueElementType(_odsPrinter, *this, getRes().getType(), getContainer().getType(), getPositionAttr());
|
|
}
|
|
|
|
void ExtractValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractValueOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ExtractValueOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FAddOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FAddOpGenericAdaptorBase::FAddOpGenericAdaptorBase(FAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FAddOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FAddOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FAddOpAdaptor::FAddOpAdaptor(FAddOp op) : FAddOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FAddOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fadd' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FAddOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FAddOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FAddOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FAddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FAddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FAddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FAddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FAddOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FAddOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FCmpOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FCmpOpGenericAdaptorBase::FCmpOpGenericAdaptorBase(FCmpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FCmpPredicate FCmpOpGenericAdaptorBase::getPredicate() {
|
|
auto attr = getPredicateAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FCmpOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FCmpOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FCmpOpAdaptor::FCmpOpAdaptor(FCmpOp op) : FCmpOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FCmpOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
|
|
if (!tblgen_predicate) return emitError(loc, "'llvm.fcmp' op requires attribute 'predicate'");
|
|
|
|
if (tblgen_predicate && !((::llvm::isa<::mlir::LLVM::FCmpPredicateAttr>(tblgen_predicate))))
|
|
return emitError(loc, "'llvm.fcmp' op attribute 'predicate' failed to satisfy constraint: llvm.fcmp comparison predicate");
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fcmp' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.predicate;
|
|
auto attr = dict.get("predicate");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `predicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FCmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.predicate;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("predicate",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FCmpOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.predicate.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FCmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
|
|
if (name == "predicate")
|
|
return prop.predicate;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FCmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "predicate") {
|
|
prop.predicate = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.predicate)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FCmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
|
|
if (prop.predicate) attrs.append("predicate", prop.predicate);
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(attr, "predicate", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.predicate)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FCmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
writer.writeAttribute(prop.predicate);
|
|
}
|
|
|
|
::mlir::LLVM::FCmpPredicate FCmpOp::getPredicate() {
|
|
auto attr = getPredicateAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FCmpOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FCmpOp::setPredicate(::mlir::LLVM::FCmpPredicate attrValue) {
|
|
getProperties().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FCmpOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FCmpOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FCmpOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FCmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FCmpOp FCmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FCmpOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
|
|
if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(*this, tblgen_predicate, "predicate")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that result type has i1 element type and same shape as operands");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType());
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FCmpOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.predicate;
|
|
auto predicateAttrName = ::mlir::StringAttr::get(ctx, "predicate");
|
|
auto attr = dict.get(predicateAttrName);
|
|
usedKeys.insert(predicateAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for predicate in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `predicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto fastmathFlagsAttrName = ::mlir::StringAttr::get(ctx, "fastmathFlags");
|
|
auto attr = dict.get(fastmathFlagsAttrName);
|
|
usedKeys.insert(fastmathFlagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FCmpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FCmpOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FCmpOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FDivOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FDivOpGenericAdaptorBase::FDivOpGenericAdaptorBase(FDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FDivOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FDivOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FDivOpAdaptor::FDivOpAdaptor(FDivOp op) : FDivOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FDivOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fdiv' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FDivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FDivOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FDivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FDivOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FDivOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FDivOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FDivOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FDivOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FMulOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FMulOpGenericAdaptorBase::FMulOpGenericAdaptorBase(FMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FMulOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FMulOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FMulOpAdaptor::FMulOpAdaptor(FMulOp op) : FMulOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FMulOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fmul' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FMulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FMulOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FMulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FMulOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FMulOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FMulOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FMulOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FMulOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FMulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMulOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FMulOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FNegOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FNegOpGenericAdaptorBase::FNegOpGenericAdaptorBase(FNegOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FNegOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FNegOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FNegOpAdaptor::FNegOpAdaptor(FNegOp op) : FNegOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FNegOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fneg' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FNegOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FNegOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FNegOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FNegOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FNegOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FNegOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FNegOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FNegOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(operand);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FNegOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FNegOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FNegOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FNegOp FNegOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FNegOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FNegOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FNegOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc;
|
|
(void)operandOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
operandOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(operandRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(operandOperands, resTypes[0], operandOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FNegOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperand();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FNegOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FNegOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FNegOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FPExtOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FPExtOpGenericAdaptorBase::FPExtOpGenericAdaptorBase(FPExtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FPExtOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FPExtOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FPExtOpAdaptor::FPExtOpAdaptor(FPExtOp op) : FPExtOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FPExtOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fpext' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPExtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FPExtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FPExtOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FPExtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FPExtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FPExtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FPExtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPExtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPExtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FPExtOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FPExtOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FPExtOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPExtOp FPExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FPExtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FPExtOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPExtOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult FPExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::LLVM::FastmathFlagsAttr fastmathFlagsAttr;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) {
|
|
|
|
if (parser.parseCustomAttributeWithFallback(fastmathFlagsAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (fastmathFlagsAttr) result.getOrAddProperties<FPExtOp::Properties>().fastmathFlags = fastmathFlagsAttr;
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
if (getFastmathFlagsAttr() != ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), {})) {
|
|
_odsPrinter << ' ' << "fastmath";
|
|
_odsPrinter.printStrippedAttrOrType(getFastmathFlagsAttr());
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FPExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPExtOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FPExtOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FPToSIOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FPToSIOpGenericAdaptorBase::FPToSIOpGenericAdaptorBase(FPToSIOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
FPToSIOpAdaptor::FPToSIOpAdaptor(FPToSIOp op) : FPToSIOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FPToSIOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPToSIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FPToSIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FPToSIOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FPToSIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FPToSIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void FPToSIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult FPToSIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToSIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<FPToSIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<FPToSIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void FPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToSIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToSIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToSIOp FPToSIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FPToSIOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPToSIOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult FPToSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPToSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FPToSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToSIOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FPToUIOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FPToUIOpGenericAdaptorBase::FPToUIOpGenericAdaptorBase(FPToUIOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
FPToUIOpAdaptor::FPToUIOpAdaptor(FPToUIOp op) : FPToUIOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FPToUIOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPToUIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FPToUIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FPToUIOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FPToUIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FPToUIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void FPToUIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult FPToUIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToUIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<FPToUIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<FPToUIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void FPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToUIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPToUIOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPToUIOp FPToUIOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FPToUIOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPToUIOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult FPToUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPToUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FPToUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToUIOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FPTruncOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FPTruncOpGenericAdaptorBase::FPTruncOpGenericAdaptorBase(FPTruncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FPTruncOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FPTruncOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FPTruncOpAdaptor::FPTruncOpAdaptor(FPTruncOp op) : FPTruncOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FPTruncOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fptrunc' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPTruncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FPTruncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FPTruncOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FPTruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FPTruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FPTruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FPTruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPTruncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPTruncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FPTruncOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FPTruncOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FPTruncOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FPTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FPTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FPTruncOp FPTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FPTruncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FPTruncOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FPTruncOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult FPTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::LLVM::FastmathFlagsAttr fastmathFlagsAttr;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) {
|
|
|
|
if (parser.parseCustomAttributeWithFallback(fastmathFlagsAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (fastmathFlagsAttr) result.getOrAddProperties<FPTruncOp::Properties>().fastmathFlags = fastmathFlagsAttr;
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FPTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
if (getFastmathFlagsAttr() != ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), {})) {
|
|
_odsPrinter << ' ' << "fastmath";
|
|
_odsPrinter.printStrippedAttrOrType(getFastmathFlagsAttr());
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FPTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPTruncOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FPTruncOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FRemOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FRemOpGenericAdaptorBase::FRemOpGenericAdaptorBase(FRemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FRemOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FRemOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FRemOpAdaptor::FRemOpAdaptor(FRemOp op) : FRemOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FRemOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.frem' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FRemOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FRemOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FRemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FRemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FRemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FRemOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FRemOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FRemOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FRemOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FRemOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FRemOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FRemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FRemOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FRemOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FSubOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FSubOpGenericAdaptorBase::FSubOpGenericAdaptorBase(FSubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr FSubOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FSubOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FSubOpAdaptor::FSubOpAdaptor(FSubOp op) : FSubOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FSubOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.fsub' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FSubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FSubOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FSubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FSubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FSubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FSubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags FSubOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FSubOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FSubOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FSubOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FSubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FSubOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FSubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FSubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FSubOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FSubOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FSubOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FenceOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FenceOpGenericAdaptorBase::FenceOpGenericAdaptorBase(FenceOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::AtomicOrdering FenceOpGenericAdaptorBase::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > FenceOpGenericAdaptorBase::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FenceOpAdaptor::FenceOpAdaptor(FenceOp op) : FenceOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FenceOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
if (!tblgen_ordering) return emitError(loc, "'llvm.fence' op requires attribute 'ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
|
|
if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering))))
|
|
return emitError(loc, "'llvm.fence' op attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope))))
|
|
return emitError(loc, "'llvm.fence' op attribute 'syncscope' failed to satisfy constraint: string attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FenceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ordering;
|
|
auto attr = dict.get("ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.syncscope;
|
|
auto attr = dict.get("syncscope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `syncscope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FenceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.syncscope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("syncscope",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FenceOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.syncscope.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FenceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "ordering")
|
|
return prop.ordering;
|
|
|
|
if (name == "syncscope")
|
|
return prop.syncscope;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FenceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "ordering") {
|
|
prop.ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "syncscope") {
|
|
prop.syncscope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.syncscope)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FenceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.ordering) attrs.append("ordering", prop.ordering);
|
|
|
|
if (prop.syncscope) attrs.append("syncscope", prop.syncscope);
|
|
}
|
|
|
|
::llvm::LogicalResult FenceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "syncscope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FenceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FenceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.syncscope);
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering FenceOp::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > FenceOp::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void FenceOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FenceOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().syncscope;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
assert(isCompatibleType(resultType) && "result must be an LLVM type");
|
|
assert(::llvm::isa<LLVMVoidType>(resultType) &&
|
|
"for zero-result operands, only 'void' is accepted as result type");
|
|
build(odsBuilder, odsState, operands, attributes);
|
|
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVM::AtomicOrdering ordering, StringRef syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVM::AtomicOrdering ordering, StringRef syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FenceOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FenceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FenceOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FenceOp FenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FenceOp::verifyInvariantsImpl() {
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
if (!tblgen_ordering) return emitOpError("requires attribute 'ordering'");
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_ordering, "ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_syncscope, "syncscope")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FenceOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult FenceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::StringAttr syncscopeAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr orderingAttr;
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (syncscopeAttr) result.getOrAddProperties<FenceOp::Properties>().syncscope = syncscopeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<FenceOp::Properties>().ordering = orderingAttr;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FenceOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if (getSyncscopeAttr()) {
|
|
_odsPrinter << ' ' << "syncscope";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getSyncscopeAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("syncscope");
|
|
elidedAttrs.push_back("ordering");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FenceOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::FenceOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::FreezeOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FreezeOpGenericAdaptorBase::FreezeOpGenericAdaptorBase(FreezeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
FreezeOpAdaptor::FreezeOpAdaptor(FreezeOp op) : FreezeOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FreezeOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FreezeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FreezeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FreezeOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FreezeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FreezeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void FreezeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult FreezeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) {
|
|
odsState.addOperands(val);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value val) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(val)>(val));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value val) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(val)>(val));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val) {
|
|
odsState.addOperands(val);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FreezeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value val) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(val)>(val));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value val) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(val)>(val));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
|
|
odsState.addOperands(val);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FreezeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FreezeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FreezeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FreezeOp FreezeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FreezeOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FreezeOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FreezeOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FreezeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
|
|
(void)valOperandsLoc;
|
|
::mlir::Type valRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
|
|
|
|
valOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valRawType = type;
|
|
}
|
|
result.addTypes(valTypes[0]);
|
|
if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FreezeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getVal();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getVal().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FreezeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FreezeOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::GEPOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GEPOpGenericAdaptorBase::GEPOpGenericAdaptorBase(GEPOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> GEPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> GEPOpGenericAdaptorBase::getRawConstantIndices() {
|
|
auto attr = getRawConstantIndicesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::Type GEPOpGenericAdaptorBase::getElemType() {
|
|
auto attr = getElemTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GEPOpAdaptor::GEPOpAdaptor(GEPOp op) : GEPOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GEPOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::GEPNoWrapFlags tblgen_noWrapFlags = this->getNoWrapFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_noWrapFlags) & ~7) == 0)))
|
|
return emitError(loc, "'llvm.getelementptr' op property 'noWrapFlags' failed to satisfy constraint: ::mlir::LLVM::GEPNoWrapFlags");
|
|
}
|
|
auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type;
|
|
if (!tblgen_elem_type) return emitError(loc, "'llvm.getelementptr' op requires attribute 'elem_type'");
|
|
auto tblgen_rawConstantIndices = getProperties().rawConstantIndices; (void)tblgen_rawConstantIndices;
|
|
if (!tblgen_rawConstantIndices) return emitError(loc, "'llvm.getelementptr' op requires attribute 'rawConstantIndices'");
|
|
|
|
if (tblgen_rawConstantIndices && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_rawConstantIndices))))
|
|
return emitError(loc, "'llvm.getelementptr' op attribute 'rawConstantIndices' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_elem_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_elem_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_elem_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.getelementptr' op attribute 'elem_type' failed to satisfy constraint: any type attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> GEPOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange GEPOp::getDynamicIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult GEPOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.elem_type;
|
|
auto attr = dict.get("elem_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `elem_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.rawConstantIndices;
|
|
auto attr = dict.get("rawConstantIndices");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `rawConstantIndices` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected IntegerAttr storage for ::mlir::LLVM::GEPNoWrapFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::GEPNoWrapFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("noWrapFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.noWrapFlags, attr, [&]() {
|
|
return emitError() << "for `noWrapFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.noWrapFlags = ::mlir::LLVM::GEPNoWrapFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GEPOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.elem_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("elem_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.rawConstantIndices;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("rawConstantIndices",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noWrapFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("noWrapFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GEPOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.elem_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.rawConstantIndices.getAsOpaquePointer()),
|
|
hash_value(prop.noWrapFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GEPOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "elem_type")
|
|
return prop.elem_type;
|
|
|
|
if (name == "rawConstantIndices")
|
|
return prop.rawConstantIndices;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GEPOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "elem_type") {
|
|
prop.elem_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.elem_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "rawConstantIndices") {
|
|
prop.rawConstantIndices = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.rawConstantIndices)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GEPOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.elem_type) attrs.append("elem_type", prop.elem_type);
|
|
|
|
if (prop.rawConstantIndices) attrs.append("rawConstantIndices", prop.rawConstantIndices);
|
|
}
|
|
|
|
::llvm::LogicalResult GEPOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getElemTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "elem_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getRawConstantIndicesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "rawConstantIndices", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GEPOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.elem_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.rawConstantIndices)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.noWrapFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::GEPNoWrapFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GEPOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.elem_type);
|
|
writer.writeAttribute(prop.rawConstantIndices);
|
|
|
|
{
|
|
auto &propStorage = prop.noWrapFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> GEPOp::getRawConstantIndices() {
|
|
auto attr = getRawConstantIndicesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::Type GEPOp::getElemType() {
|
|
auto attr = getElemTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
void GEPOp::setRawConstantIndices(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().rawConstantIndices = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
void GEPOp::setElemType(::mlir::Type attrValue) {
|
|
getProperties().elem_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
GEPOp GEPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, Type elementType, Value basePtr, ValueRange indices, GEPNoWrapFlags noWrapFlags, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(basePtr)>(basePtr), std::forward<decltype(indices)>(indices), std::forward<decltype(noWrapFlags)>(noWrapFlags), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GEPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GEPOp GEPOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, Type elementType, Value basePtr, ValueRange indices, GEPNoWrapFlags noWrapFlags, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(basePtr)>(basePtr), std::forward<decltype(indices)>(indices), std::forward<decltype(noWrapFlags)>(noWrapFlags), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
GEPOp GEPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, Type elementType, Value basePtr, ArrayRef<GEPArg> indices, GEPNoWrapFlags noWrapFlags, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(basePtr)>(basePtr), std::forward<decltype(indices)>(indices), std::forward<decltype(noWrapFlags)>(noWrapFlags), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GEPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GEPOp GEPOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, Type elementType, Value basePtr, ArrayRef<GEPArg> indices, GEPNoWrapFlags noWrapFlags, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(elementType)>(elementType), std::forward<decltype(basePtr)>(basePtr), std::forward<decltype(indices)>(indices), std::forward<decltype(noWrapFlags)>(noWrapFlags), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GEPOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::GEPNoWrapFlags tblgen_noWrapFlags = this->getNoWrapFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps2(*this, tblgen_noWrapFlags, "noWrapFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type;
|
|
if (!tblgen_elem_type) return emitOpError("requires attribute 'elem_type'");
|
|
auto tblgen_rawConstantIndices = getProperties().rawConstantIndices; (void)tblgen_rawConstantIndices;
|
|
if (!tblgen_rawConstantIndices) return emitOpError("requires attribute 'rawConstantIndices'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_rawConstantIndices, "rawConstantIndices")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_elem_type, "elem_type")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps16(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GEPOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GEPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicIndicesOperands;
|
|
::llvm::SMLoc dynamicIndicesOperandsLoc;
|
|
(void)dynamicIndicesOperandsLoc;
|
|
::mlir::DenseI32ArrayAttr rawConstantIndicesAttr;
|
|
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
|
|
::llvm::ArrayRef<::mlir::Type> allResultTypes;
|
|
::mlir::TypeAttr elem_typeAttr;
|
|
|
|
auto noWrapFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
auto value = ::mlir::FieldParser<std::optional<::mlir::LLVM::GEPNoWrapFlags>>::parse(parser);
|
|
if (::mlir::failed(value))
|
|
return ::mlir::failure();
|
|
if (!(value->has_value()))
|
|
return std::nullopt;
|
|
propStorage = std::move(**value);
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<GEPOp::Properties>().noWrapFlags);
|
|
if (noWrapFlagsPropParseResult.has_value() && failed(*noWrapFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (noWrapFlagsPropParseResult.has_value() && succeeded(*noWrapFlagsPropParseResult)) {
|
|
}
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
dynamicIndicesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseGEPIndices(parser, dynamicIndicesOperands, rawConstantIndicesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<GEPOp::Properties>().rawConstantIndices = rawConstantIndicesAttr;
|
|
}
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::FunctionType allOperand__allResult_functionType;
|
|
if (parser.parseType(allOperand__allResult_functionType))
|
|
return ::mlir::failure();
|
|
allOperandTypes = allOperand__allResult_functionType.getInputs();
|
|
allResultTypes = allOperand__allResult_functionType.getResults();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(elem_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (elem_typeAttr) result.getOrAddProperties<GEPOp::Properties>().elem_type = elem_typeAttr;
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(::llvm::concat<const ::mlir::OpAsmParser::UnresolvedOperand>(baseOperands, dynamicIndicesOperands), allOperandTypes, parser.getNameLoc(), result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GEPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if (getNoWrapFlags() != ::mlir::LLVM::GEPNoWrapFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getProperties().noWrapFlags;
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
printGEPIndices(_odsPrinter, *this, getDynamicIndices(), getRawConstantIndicesAttr());
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("rawConstantIndices");
|
|
elidedAttrs.push_back("elem_type");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getElemTypeAttr());
|
|
}
|
|
|
|
void GEPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GEPOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::GEPOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::GlobalCtorsOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalCtorsOpGenericAdaptorBase::GlobalCtorsOpGenericAdaptorBase(GlobalCtorsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getCtors() {
|
|
auto attr = getCtorsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getPriorities() {
|
|
auto attr = getPrioritiesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getData() {
|
|
auto attr = getDataAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalCtorsOpAdaptor::GlobalCtorsOpAdaptor(GlobalCtorsOp op) : GlobalCtorsOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_ctors = getProperties().ctors; (void)tblgen_ctors;
|
|
if (!tblgen_ctors) return emitError(loc, "'llvm.mlir.global_ctors' op requires attribute 'ctors'");
|
|
auto tblgen_data = getProperties().data; (void)tblgen_data;
|
|
if (!tblgen_data) return emitError(loc, "'llvm.mlir.global_ctors' op requires attribute 'data'");
|
|
auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities;
|
|
if (!tblgen_priorities) return emitError(loc, "'llvm.mlir.global_ctors' op requires attribute 'priorities'");
|
|
|
|
if (tblgen_ctors && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_ctors))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_ctors), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.mlir.global_ctors' op attribute 'ctors' failed to satisfy constraint: flat symbol ref array attribute");
|
|
|
|
if (tblgen_priorities && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_priorities))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_priorities), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); }))))
|
|
return emitError(loc, "'llvm.mlir.global_ctors' op attribute 'priorities' failed to satisfy constraint: 32-bit integer array attribute");
|
|
|
|
if (tblgen_data && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_data))))
|
|
return emitError(loc, "'llvm.mlir.global_ctors' op attribute 'data' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ctors;
|
|
auto attr = dict.get("ctors");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ctors` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.data;
|
|
auto attr = dict.get("data");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `data` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.priorities;
|
|
auto attr = dict.get("priorities");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `priorities` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalCtorsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.ctors;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ctors",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.data;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("data",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.priorities;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("priorities",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalCtorsOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.ctors.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.data.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.priorities.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalCtorsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "ctors")
|
|
return prop.ctors;
|
|
|
|
if (name == "data")
|
|
return prop.data;
|
|
|
|
if (name == "priorities")
|
|
return prop.priorities;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalCtorsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "ctors") {
|
|
prop.ctors = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ctors)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "data") {
|
|
prop.data = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.data)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "priorities") {
|
|
prop.priorities = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.priorities)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GlobalCtorsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.ctors) attrs.append("ctors", prop.ctors);
|
|
|
|
if (prop.data) attrs.append("data", prop.data);
|
|
|
|
if (prop.priorities) attrs.append("priorities", prop.priorities);
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCtorsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(attr, "ctors", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDataAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "data", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPrioritiesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(attr, "priorities", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.ctors)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.data)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.priorities)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalCtorsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.ctors);
|
|
writer.writeAttribute(prop.data);
|
|
writer.writeAttribute(prop.priorities);
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOp::getCtors() {
|
|
auto attr = getCtorsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOp::getPriorities() {
|
|
auto attr = getPrioritiesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalCtorsOp::getData() {
|
|
auto attr = getDataAttr();
|
|
return attr;
|
|
}
|
|
|
|
void GlobalCtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
odsState.getOrAddProperties<Properties>().ctors = ctors;
|
|
odsState.getOrAddProperties<Properties>().priorities = priorities;
|
|
odsState.getOrAddProperties<Properties>().data = data;
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(ctors)>(ctors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalCtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(ctors)>(ctors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
}
|
|
|
|
void GlobalCtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
odsState.getOrAddProperties<Properties>().ctors = ctors;
|
|
odsState.getOrAddProperties<Properties>().priorities = priorities;
|
|
odsState.getOrAddProperties<Properties>().data = data;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ctors)>(ctors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalCtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ctors)>(ctors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
}
|
|
|
|
void GlobalCtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GlobalCtorsOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalCtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalCtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalCtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalCtorsOp GlobalCtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOp::verifyInvariantsImpl() {
|
|
auto tblgen_ctors = getProperties().ctors; (void)tblgen_ctors;
|
|
if (!tblgen_ctors) return emitOpError("requires attribute 'ctors'");
|
|
auto tblgen_data = getProperties().data; (void)tblgen_data;
|
|
if (!tblgen_data) return emitOpError("requires attribute 'data'");
|
|
auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities;
|
|
if (!tblgen_priorities) return emitOpError("requires attribute 'priorities'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(*this, tblgen_ctors, "ctors")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(*this, tblgen_priorities, "priorities")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_data, "data")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalCtorsOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GlobalCtorsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::ArrayAttr ctorsAttr;
|
|
::mlir::ArrayAttr prioritiesAttr;
|
|
::mlir::ArrayAttr dataAttr;
|
|
if (parser.parseKeyword("ctors"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(ctorsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (ctorsAttr) result.getOrAddProperties<GlobalCtorsOp::Properties>().ctors = ctorsAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("priorities"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(prioritiesAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (prioritiesAttr) result.getOrAddProperties<GlobalCtorsOp::Properties>().priorities = prioritiesAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("data"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(dataAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (dataAttr) result.getOrAddProperties<GlobalCtorsOp::Properties>().data = dataAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalCtorsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ' << "ctors";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getCtorsAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ' << "priorities";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getPrioritiesAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ' << "data";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getDataAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("ctors");
|
|
elidedAttrs.push_back("priorities");
|
|
elidedAttrs.push_back("data");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalCtorsOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::GlobalCtorsOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::GlobalDtorsOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalDtorsOpGenericAdaptorBase::GlobalDtorsOpGenericAdaptorBase(GlobalDtorsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getDtors() {
|
|
auto attr = getDtorsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getPriorities() {
|
|
auto attr = getPrioritiesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getData() {
|
|
auto attr = getDataAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalDtorsOpAdaptor::GlobalDtorsOpAdaptor(GlobalDtorsOp op) : GlobalDtorsOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_data = getProperties().data; (void)tblgen_data;
|
|
if (!tblgen_data) return emitError(loc, "'llvm.mlir.global_dtors' op requires attribute 'data'");
|
|
auto tblgen_dtors = getProperties().dtors; (void)tblgen_dtors;
|
|
if (!tblgen_dtors) return emitError(loc, "'llvm.mlir.global_dtors' op requires attribute 'dtors'");
|
|
auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities;
|
|
if (!tblgen_priorities) return emitError(loc, "'llvm.mlir.global_dtors' op requires attribute 'priorities'");
|
|
|
|
if (tblgen_dtors && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_dtors))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_dtors), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.mlir.global_dtors' op attribute 'dtors' failed to satisfy constraint: flat symbol ref array attribute");
|
|
|
|
if (tblgen_priorities && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_priorities))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_priorities), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); }))))
|
|
return emitError(loc, "'llvm.mlir.global_dtors' op attribute 'priorities' failed to satisfy constraint: 32-bit integer array attribute");
|
|
|
|
if (tblgen_data && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_data))))
|
|
return emitError(loc, "'llvm.mlir.global_dtors' op attribute 'data' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.data;
|
|
auto attr = dict.get("data");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `data` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dtors;
|
|
auto attr = dict.get("dtors");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dtors` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.priorities;
|
|
auto attr = dict.get("priorities");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `priorities` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalDtorsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.data;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("data",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dtors;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dtors",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.priorities;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("priorities",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalDtorsOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.data.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dtors.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.priorities.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalDtorsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "data")
|
|
return prop.data;
|
|
|
|
if (name == "dtors")
|
|
return prop.dtors;
|
|
|
|
if (name == "priorities")
|
|
return prop.priorities;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalDtorsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "data") {
|
|
prop.data = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.data)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dtors") {
|
|
prop.dtors = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dtors)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "priorities") {
|
|
prop.priorities = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.priorities)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GlobalDtorsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.data) attrs.append("data", prop.data);
|
|
|
|
if (prop.dtors) attrs.append("dtors", prop.dtors);
|
|
|
|
if (prop.priorities) attrs.append("priorities", prop.priorities);
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDataAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "data", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDtorsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(attr, "dtors", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPrioritiesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(attr, "priorities", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.data)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.dtors)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.priorities)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalDtorsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.data);
|
|
writer.writeAttribute(prop.dtors);
|
|
writer.writeAttribute(prop.priorities);
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOp::getDtors() {
|
|
auto attr = getDtorsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOp::getPriorities() {
|
|
auto attr = getPrioritiesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr GlobalDtorsOp::getData() {
|
|
auto attr = getDataAttr();
|
|
return attr;
|
|
}
|
|
|
|
void GlobalDtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
odsState.getOrAddProperties<Properties>().dtors = dtors;
|
|
odsState.getOrAddProperties<Properties>().priorities = priorities;
|
|
odsState.getOrAddProperties<Properties>().data = data;
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(dtors)>(dtors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalDtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(dtors)>(dtors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
}
|
|
|
|
void GlobalDtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
odsState.getOrAddProperties<Properties>().dtors = dtors;
|
|
odsState.getOrAddProperties<Properties>().priorities = priorities;
|
|
odsState.getOrAddProperties<Properties>().data = data;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(dtors)>(dtors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalDtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities, ::mlir::ArrayAttr data) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(dtors)>(dtors), std::forward<decltype(priorities)>(priorities), std::forward<decltype(data)>(data));
|
|
}
|
|
|
|
void GlobalDtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GlobalDtorsOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalDtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalDtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalDtorsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalDtorsOp GlobalDtorsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOp::verifyInvariantsImpl() {
|
|
auto tblgen_data = getProperties().data; (void)tblgen_data;
|
|
if (!tblgen_data) return emitOpError("requires attribute 'data'");
|
|
auto tblgen_dtors = getProperties().dtors; (void)tblgen_dtors;
|
|
if (!tblgen_dtors) return emitOpError("requires attribute 'dtors'");
|
|
auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities;
|
|
if (!tblgen_priorities) return emitOpError("requires attribute 'priorities'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(*this, tblgen_dtors, "dtors")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(*this, tblgen_priorities, "priorities")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_data, "data")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalDtorsOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GlobalDtorsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::ArrayAttr dtorsAttr;
|
|
::mlir::ArrayAttr prioritiesAttr;
|
|
::mlir::ArrayAttr dataAttr;
|
|
if (parser.parseKeyword("dtors"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(dtorsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (dtorsAttr) result.getOrAddProperties<GlobalDtorsOp::Properties>().dtors = dtorsAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("priorities"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(prioritiesAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (prioritiesAttr) result.getOrAddProperties<GlobalDtorsOp::Properties>().priorities = prioritiesAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("data"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(dataAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (dataAttr) result.getOrAddProperties<GlobalDtorsOp::Properties>().data = dataAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalDtorsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ' << "dtors";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getDtorsAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ' << "priorities";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getPrioritiesAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ' << "data";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getDataAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("dtors");
|
|
elidedAttrs.push_back("priorities");
|
|
elidedAttrs.push_back("data");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalDtorsOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::GlobalDtorsOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::GlobalOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(GlobalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::Type GlobalOpGenericAdaptorBase::getGlobalType() {
|
|
auto attr = getGlobalTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getConstantAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GlobalOpGenericAdaptorBase::getConstant() {
|
|
auto attr = getConstantAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::llvm::StringRef GlobalOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::Linkage GlobalOpGenericAdaptorBase::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getDsoLocalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GlobalOpGenericAdaptorBase::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getThreadLocal_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().thread_local_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GlobalOpGenericAdaptorBase::getThreadLocal_() {
|
|
auto attr = getThreadLocal_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getExternallyInitializedAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().externally_initialized);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GlobalOpGenericAdaptorBase::getExternallyInitialized() {
|
|
auto attr = getExternallyInitializedAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional<::mlir::Attribute> GlobalOpGenericAdaptorBase::getValue() {
|
|
auto attr = getValueAttr();
|
|
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> GlobalOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::IntegerAttr GlobalOpGenericAdaptorBase::getAddrSpaceAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().addr_space);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t GlobalOpGenericAdaptorBase::getAddrSpace() {
|
|
auto attr = getAddrSpaceAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> GlobalOpGenericAdaptorBase::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > GlobalOpGenericAdaptorBase::getSection() {
|
|
auto attr = getSectionAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::SymbolRefAttr > GlobalOpGenericAdaptorBase::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > GlobalOpGenericAdaptorBase::getDbgExprs() {
|
|
auto attr = getDbgExprsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::VisibilityAttr GlobalOpGenericAdaptorBase::getVisibility_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::Visibility GlobalOpGenericAdaptorBase::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > GlobalOpGenericAdaptorBase::getTargetSpecificAttrs() {
|
|
auto attr = getTargetSpecificAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalOpAdaptor::GlobalOpAdaptor(GlobalOp op) : GlobalOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_addr_space = getProperties().addr_space; (void)tblgen_addr_space;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
|
|
auto tblgen_dbg_exprs = getProperties().dbg_exprs; (void)tblgen_dbg_exprs;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_externally_initialized = getProperties().externally_initialized; (void)tblgen_externally_initialized;
|
|
auto tblgen_global_type = getProperties().global_type; (void)tblgen_global_type;
|
|
if (!tblgen_global_type) return emitError(loc, "'llvm.mlir.global' op requires attribute 'global_type'");
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitError(loc, "'llvm.mlir.global' op requires attribute 'linkage'");
|
|
auto tblgen_section = getProperties().section; (void)tblgen_section;
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.mlir.global' op requires attribute 'sym_name'");
|
|
auto tblgen_target_specific_attrs = getProperties().target_specific_attrs; (void)tblgen_target_specific_attrs;
|
|
auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_value = getProperties().value; (void)tblgen_value;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (tblgen_global_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_global_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_global_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'global_type' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'constant' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification");
|
|
|
|
if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'dso_local' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_thread_local_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_thread_local_))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'thread_local_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_externally_initialized && !((::llvm::isa<::mlir::UnitAttr>(tblgen_externally_initialized))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'externally_initialized' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_value && !((true)))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'value' failed to satisfy constraint: any attribute");
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_addr_space && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_addr_space))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_addr_space).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_addr_space).getValue().isNegative()))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'addr_space' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative");
|
|
|
|
if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr");
|
|
|
|
if (tblgen_section && !((::llvm::isa<::mlir::StringAttr>(tblgen_section))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'section' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_comdat && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_comdat))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'comdat' failed to satisfy constraint: symbol reference attribute");
|
|
|
|
if (tblgen_dbg_exprs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_dbg_exprs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_dbg_exprs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::DIGlobalVariableExpressionAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'dbg_exprs' failed to satisfy constraint: an array of variable expressions");
|
|
|
|
if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility");
|
|
|
|
if (tblgen_target_specific_attrs && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_target_specific_attrs))))
|
|
return emitError(loc, "'llvm.mlir.global' op attribute 'target_specific_attrs' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.addr_space;
|
|
auto attr = dict.get("addr_space");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `addr_space` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.comdat;
|
|
auto attr = dict.get("comdat");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `comdat` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.constant;
|
|
auto attr = dict.get("constant");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `constant` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dbg_exprs;
|
|
auto attr = dict.get("dbg_exprs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dbg_exprs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dso_local;
|
|
auto attr = dict.get("dso_local");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.externally_initialized;
|
|
auto attr = dict.get("externally_initialized");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `externally_initialized` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_type;
|
|
auto attr = dict.get("global_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.linkage;
|
|
auto attr = dict.get("linkage");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.section;
|
|
auto attr = dict.get("section");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `section` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.target_specific_attrs;
|
|
auto attr = dict.get("target_specific_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_specific_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.thread_local_;
|
|
auto attr = dict.get("thread_local_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `thread_local_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto attr = dict.get("unnamed_addr");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.value;
|
|
auto attr = dict.get("value");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `value` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.visibility_;
|
|
auto attr = dict.get("visibility_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.addr_space;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("addr_space",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.comdat;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("comdat",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.constant;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("constant",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dbg_exprs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dbg_exprs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dso_local;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dso_local",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.externally_initialized;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("externally_initialized",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.global_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.linkage;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("linkage",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.section;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("section",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.target_specific_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("target_specific_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.thread_local_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("thread_local_",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unnamed_addr;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.value;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("value",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.visibility_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("visibility_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.addr_space.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.comdat.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.constant.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dbg_exprs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dso_local.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.externally_initialized.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.global_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.linkage.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.section.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.target_specific_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.thread_local_.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.value.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.visibility_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "addr_space")
|
|
return prop.addr_space;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "comdat")
|
|
return prop.comdat;
|
|
|
|
if (name == "constant")
|
|
return prop.constant;
|
|
|
|
if (name == "dbg_exprs")
|
|
return prop.dbg_exprs;
|
|
|
|
if (name == "dso_local")
|
|
return prop.dso_local;
|
|
|
|
if (name == "externally_initialized")
|
|
return prop.externally_initialized;
|
|
|
|
if (name == "global_type")
|
|
return prop.global_type;
|
|
|
|
if (name == "linkage")
|
|
return prop.linkage;
|
|
|
|
if (name == "section")
|
|
return prop.section;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
|
|
if (name == "target_specific_attrs")
|
|
return prop.target_specific_attrs;
|
|
|
|
if (name == "thread_local_")
|
|
return prop.thread_local_;
|
|
|
|
if (name == "unnamed_addr")
|
|
return prop.unnamed_addr;
|
|
|
|
if (name == "value")
|
|
return prop.value;
|
|
|
|
if (name == "visibility_")
|
|
return prop.visibility_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "addr_space") {
|
|
prop.addr_space = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.addr_space)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "comdat") {
|
|
prop.comdat = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.comdat)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "constant") {
|
|
prop.constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.constant)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dbg_exprs") {
|
|
prop.dbg_exprs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dbg_exprs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dso_local") {
|
|
prop.dso_local = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dso_local)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "externally_initialized") {
|
|
prop.externally_initialized = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.externally_initialized)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "global_type") {
|
|
prop.global_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "linkage") {
|
|
prop.linkage = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.linkage)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "section") {
|
|
prop.section = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.section)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "target_specific_attrs") {
|
|
prop.target_specific_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target_specific_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "thread_local_") {
|
|
prop.thread_local_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.thread_local_)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unnamed_addr") {
|
|
prop.unnamed_addr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unnamed_addr)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "value") {
|
|
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "visibility_") {
|
|
prop.visibility_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.visibility_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.addr_space) attrs.append("addr_space", prop.addr_space);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.comdat) attrs.append("comdat", prop.comdat);
|
|
|
|
if (prop.constant) attrs.append("constant", prop.constant);
|
|
|
|
if (prop.dbg_exprs) attrs.append("dbg_exprs", prop.dbg_exprs);
|
|
|
|
if (prop.dso_local) attrs.append("dso_local", prop.dso_local);
|
|
|
|
if (prop.externally_initialized) attrs.append("externally_initialized", prop.externally_initialized);
|
|
|
|
if (prop.global_type) attrs.append("global_type", prop.global_type);
|
|
|
|
if (prop.linkage) attrs.append("linkage", prop.linkage);
|
|
|
|
if (prop.section) attrs.append("section", prop.section);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
|
|
if (prop.target_specific_attrs) attrs.append("target_specific_attrs", prop.target_specific_attrs);
|
|
|
|
if (prop.thread_local_) attrs.append("thread_local_", prop.thread_local_);
|
|
|
|
if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr);
|
|
|
|
if (prop.value) attrs.append("value", prop.value);
|
|
|
|
if (prop.visibility_) attrs.append("visibility_", prop.visibility_);
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAddrSpaceAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(attr, "addr_space", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getComdatAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps33(attr, "comdat", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getConstantAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "constant", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDbgExprsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps34(attr, "dbg_exprs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "dso_local", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getExternallyInitializedAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "externally_initialized", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "global_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "linkage", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSectionAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "section", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetSpecificAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "target_specific_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getThreadLocal_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "thread_local_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "unnamed_addr", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(attr, "value", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "visibility_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.addr_space)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.comdat)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.constant)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dbg_exprs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.externally_initialized)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.global_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.linkage)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.section)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.target_specific_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.thread_local_)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.value)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.addr_space);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
|
|
writer.writeOptionalAttribute(prop.comdat);
|
|
|
|
writer.writeOptionalAttribute(prop.constant);
|
|
|
|
writer.writeOptionalAttribute(prop.dbg_exprs);
|
|
|
|
writer.writeOptionalAttribute(prop.dso_local);
|
|
|
|
writer.writeOptionalAttribute(prop.externally_initialized);
|
|
writer.writeAttribute(prop.global_type);
|
|
writer.writeAttribute(prop.linkage);
|
|
|
|
writer.writeOptionalAttribute(prop.section);
|
|
writer.writeAttribute(prop.sym_name);
|
|
|
|
writer.writeOptionalAttribute(prop.target_specific_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.thread_local_);
|
|
|
|
writer.writeOptionalAttribute(prop.unnamed_addr);
|
|
|
|
writer.writeOptionalAttribute(prop.value);
|
|
|
|
writer.writeOptionalAttribute(prop.visibility_);
|
|
}
|
|
|
|
::mlir::Type GlobalOp::getGlobalType() {
|
|
auto attr = getGlobalTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
bool GlobalOp::getConstant() {
|
|
auto attr = getConstantAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::llvm::StringRef GlobalOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::Linkage GlobalOp::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
bool GlobalOp::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool GlobalOp::getThreadLocal_() {
|
|
auto attr = getThreadLocal_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool GlobalOp::getExternallyInitialized() {
|
|
auto attr = getExternallyInitializedAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional<::mlir::Attribute> GlobalOp::getValue() {
|
|
auto attr = getValueAttr();
|
|
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> GlobalOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
uint32_t GlobalOp::getAddrSpace() {
|
|
auto attr = getAddrSpaceAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> GlobalOp::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > GlobalOp::getSection() {
|
|
auto attr = getSectionAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::SymbolRefAttr > GlobalOp::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > GlobalOp::getDbgExprs() {
|
|
auto attr = getDbgExprsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::Visibility GlobalOp::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > GlobalOp::getTargetSpecificAttrs() {
|
|
auto attr = getTargetSpecificAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void GlobalOp::setGlobalType(::mlir::Type attrValue) {
|
|
getProperties().global_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void GlobalOp::setConstant(bool attrValue) {
|
|
auto &odsProp = getProperties().constant;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void GlobalOp::setLinkage(::mlir::LLVM::Linkage attrValue) {
|
|
getProperties().linkage = ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void GlobalOp::setDsoLocal(bool attrValue) {
|
|
auto &odsProp = getProperties().dso_local;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setThreadLocal_(bool attrValue) {
|
|
auto &odsProp = getProperties().thread_local_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setExternallyInitialized(bool attrValue) {
|
|
auto &odsProp = getProperties().externally_initialized;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setAddrSpace(uint32_t attrValue) {
|
|
getProperties().addr_space = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void GlobalOp::setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue) {
|
|
auto &odsProp = getProperties().unnamed_addr;
|
|
if (attrValue)
|
|
odsProp = ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setSection(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().section;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalOp::setVisibility_(::mlir::LLVM::Visibility attrValue) {
|
|
getProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, bool isConstant, Linkage linkage, StringRef name, Attribute value, uint64_t alignment, unsigned addrSpace, bool dsoLocal, bool thread_local_, SymbolRefAttr comdat, ArrayRef<NamedAttribute> attrs, ArrayRef<Attribute> dbgExprs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(isConstant)>(isConstant), std::forward<decltype(linkage)>(linkage), std::forward<decltype(name)>(name), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addrSpace)>(addrSpace), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(comdat)>(comdat), std::forward<decltype(attrs)>(attrs), std::forward<decltype(dbgExprs)>(dbgExprs));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, bool isConstant, Linkage linkage, StringRef name, Attribute value, uint64_t alignment, unsigned addrSpace, bool dsoLocal, bool thread_local_, SymbolRefAttr comdat, ArrayRef<NamedAttribute> attrs, ArrayRef<Attribute> dbgExprs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(isConstant)>(isConstant), std::forward<decltype(linkage)>(linkage), std::forward<decltype(name)>(name), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addrSpace)>(addrSpace), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(comdat)>(comdat), std::forward<decltype(attrs)>(attrs), std::forward<decltype(dbgExprs)>(dbgExprs));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().global_type = global_type;
|
|
if (constant) {
|
|
odsState.getOrAddProperties<Properties>().constant = constant;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = thread_local_;
|
|
}
|
|
if (externally_initialized) {
|
|
odsState.getOrAddProperties<Properties>().externally_initialized = externally_initialized;
|
|
}
|
|
if (value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (addr_space) {
|
|
odsState.getOrAddProperties<Properties>().addr_space = addr_space;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (section) {
|
|
odsState.getOrAddProperties<Properties>().section = section;
|
|
}
|
|
if (comdat) {
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
}
|
|
if (dbg_exprs) {
|
|
odsState.getOrAddProperties<Properties>().dbg_exprs = dbg_exprs;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
if (target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().target_specific_attrs = target_specific_attrs;
|
|
}
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().global_type = global_type;
|
|
if (constant) {
|
|
odsState.getOrAddProperties<Properties>().constant = constant;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = thread_local_;
|
|
}
|
|
if (externally_initialized) {
|
|
odsState.getOrAddProperties<Properties>().externally_initialized = externally_initialized;
|
|
}
|
|
if (value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (addr_space) {
|
|
odsState.getOrAddProperties<Properties>().addr_space = addr_space;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (section) {
|
|
odsState.getOrAddProperties<Properties>().section = section;
|
|
}
|
|
if (comdat) {
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
}
|
|
if (dbg_exprs) {
|
|
odsState.getOrAddProperties<Properties>().dbg_exprs = dbg_exprs;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
if (target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().target_specific_attrs = target_specific_attrs;
|
|
}
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::UnitAttr externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::VisibilityAttr visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().global_type = ::mlir::TypeAttr::get(global_type);
|
|
if (constant) {
|
|
odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (externally_initialized) {
|
|
odsState.getOrAddProperties<Properties>().externally_initialized = ((externally_initialized) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), addr_space);
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (section) {
|
|
odsState.getOrAddProperties<Properties>().section = section;
|
|
}
|
|
if (comdat) {
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
}
|
|
if (dbg_exprs) {
|
|
odsState.getOrAddProperties<Properties>().dbg_exprs = dbg_exprs;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
if (target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().target_specific_attrs = target_specific_attrs;
|
|
}
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().global_type = ::mlir::TypeAttr::get(global_type);
|
|
if (constant) {
|
|
odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (thread_local_) {
|
|
odsState.getOrAddProperties<Properties>().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (externally_initialized) {
|
|
odsState.getOrAddProperties<Properties>().externally_initialized = ((externally_initialized) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
}
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), addr_space);
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (section) {
|
|
odsState.getOrAddProperties<Properties>().section = section;
|
|
}
|
|
if (comdat) {
|
|
odsState.getOrAddProperties<Properties>().comdat = comdat;
|
|
}
|
|
if (dbg_exprs) {
|
|
odsState.getOrAddProperties<Properties>().dbg_exprs = dbg_exprs;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
if (target_specific_attrs) {
|
|
odsState.getOrAddProperties<Properties>().target_specific_attrs = target_specific_attrs;
|
|
}
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/bool externally_initialized, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, /*optional*/::mlir::ArrayAttr dbg_exprs, ::mlir::LLVM::Visibility visibility_, /*optional*/::mlir::ArrayAttr target_specific_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global_type)>(global_type), std::forward<decltype(constant)>(constant), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(thread_local_)>(thread_local_), std::forward<decltype(externally_initialized)>(externally_initialized), std::forward<decltype(value)>(value), std::forward<decltype(alignment)>(alignment), std::forward<decltype(addr_space)>(addr_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(section)>(section), std::forward<decltype(comdat)>(comdat), std::forward<decltype(dbg_exprs)>(dbg_exprs), std::forward<decltype(visibility_)>(visibility_), std::forward<decltype(target_specific_attrs)>(target_specific_attrs));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
for (unsigned i = 0; i != 1; ++i)
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GlobalOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
for (unsigned i = 0; i != 1; ++i)
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void GlobalOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.addr_space)
|
|
properties.addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
if (!properties.visibility_)
|
|
properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default);
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::verifyInvariantsImpl() {
|
|
auto tblgen_addr_space = getProperties().addr_space; (void)tblgen_addr_space;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
|
|
auto tblgen_dbg_exprs = getProperties().dbg_exprs; (void)tblgen_dbg_exprs;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_externally_initialized = getProperties().externally_initialized; (void)tblgen_externally_initialized;
|
|
auto tblgen_global_type = getProperties().global_type; (void)tblgen_global_type;
|
|
if (!tblgen_global_type) return emitOpError("requires attribute 'global_type'");
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitOpError("requires attribute 'linkage'");
|
|
auto tblgen_section = getProperties().section; (void)tblgen_section;
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
auto tblgen_target_specific_attrs = getProperties().target_specific_attrs; (void)tblgen_target_specific_attrs;
|
|
auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_value = getProperties().value; (void)tblgen_value;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_global_type, "global_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_constant, "constant")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_linkage, "linkage")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_dso_local, "dso_local")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_thread_local_, "thread_local_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_externally_initialized, "externally_initialized")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(*this, tblgen_value, "value")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(*this, tblgen_addr_space, "addr_space")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_unnamed_addr, "unnamed_addr")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_section, "section")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps33(*this, tblgen_comdat, "comdat")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps34(*this, tblgen_dbg_exprs, "dbg_exprs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_visibility_, "visibility_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_target_specific_attrs, "target_specific_attrs")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps2(*this, region, "initializer", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.global_type;
|
|
auto global_typeAttrName = ::mlir::StringAttr::get(ctx, "global_type");
|
|
auto attr = dict.get(global_typeAttrName);
|
|
usedKeys.insert(global_typeAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for global_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.constant;
|
|
auto constantAttrName = ::mlir::StringAttr::get(ctx, "constant");
|
|
auto attr = dict.get(constantAttrName);
|
|
usedKeys.insert(constantAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for constant in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `constant` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.sym_name;
|
|
auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name");
|
|
auto attr = dict.get(sym_nameAttrName);
|
|
usedKeys.insert(sym_nameAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for sym_name in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.linkage;
|
|
auto linkageAttrName = ::mlir::StringAttr::get(ctx, "linkage");
|
|
auto attr = dict.get(linkageAttrName);
|
|
usedKeys.insert(linkageAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for linkage in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.dso_local;
|
|
auto dso_localAttrName = ::mlir::StringAttr::get(ctx, "dso_local");
|
|
auto attr = dict.get(dso_localAttrName);
|
|
usedKeys.insert(dso_localAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for dso_local in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.thread_local_;
|
|
auto thread_local_AttrName = ::mlir::StringAttr::get(ctx, "thread_local_");
|
|
auto attr = dict.get(thread_local_AttrName);
|
|
usedKeys.insert(thread_local_AttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for thread_local_ in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `thread_local_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.externally_initialized;
|
|
auto externally_initializedAttrName = ::mlir::StringAttr::get(ctx, "externally_initialized");
|
|
auto attr = dict.get(externally_initializedAttrName);
|
|
usedKeys.insert(externally_initializedAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for externally_initialized in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `externally_initialized` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.value;
|
|
auto valueAttrName = ::mlir::StringAttr::get(ctx, "value");
|
|
auto attr = dict.get(valueAttrName);
|
|
usedKeys.insert(valueAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for value in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `value` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.alignment;
|
|
auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment");
|
|
auto attr = dict.get(alignmentAttrName);
|
|
usedKeys.insert(alignmentAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for alignment in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.addr_space;
|
|
auto addr_spaceAttrName = ::mlir::StringAttr::get(ctx, "addr_space");
|
|
auto attr = dict.get(addr_spaceAttrName);
|
|
usedKeys.insert(addr_spaceAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for addr_space in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `addr_space` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto unnamed_addrAttrName = ::mlir::StringAttr::get(ctx, "unnamed_addr");
|
|
auto attr = dict.get(unnamed_addrAttrName);
|
|
usedKeys.insert(unnamed_addrAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for unnamed_addr in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.section;
|
|
auto sectionAttrName = ::mlir::StringAttr::get(ctx, "section");
|
|
auto attr = dict.get(sectionAttrName);
|
|
usedKeys.insert(sectionAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for section in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `section` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.comdat;
|
|
auto comdatAttrName = ::mlir::StringAttr::get(ctx, "comdat");
|
|
auto attr = dict.get(comdatAttrName);
|
|
usedKeys.insert(comdatAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for comdat in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `comdat` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.dbg_exprs;
|
|
auto dbg_exprsAttrName = ::mlir::StringAttr::get(ctx, "dbg_exprs");
|
|
auto attr = dict.get(dbg_exprsAttrName);
|
|
usedKeys.insert(dbg_exprsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for dbg_exprs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dbg_exprs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.visibility_;
|
|
auto visibility_AttrName = ::mlir::StringAttr::get(ctx, "visibility_");
|
|
auto attr = dict.get(visibility_AttrName);
|
|
usedKeys.insert(visibility_AttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for visibility_ in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.target_specific_attrs;
|
|
auto target_specific_attrsAttrName = ::mlir::StringAttr::get(ctx, "target_specific_attrs");
|
|
auto attr = dict.get(target_specific_attrsAttrName);
|
|
usedKeys.insert(target_specific_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for target_specific_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_specific_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::GlobalOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ICmpOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ICmpOpGenericAdaptorBase::ICmpOpGenericAdaptorBase(ICmpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::ICmpPredicate ICmpOpGenericAdaptorBase::getPredicate() {
|
|
auto attr = getPredicateAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ICmpOpAdaptor::ICmpOpAdaptor(ICmpOp op) : ICmpOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ICmpOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
|
|
if (!tblgen_predicate) return emitError(loc, "'llvm.icmp' op requires attribute 'predicate'");
|
|
|
|
if (tblgen_predicate && !((::llvm::isa<::mlir::LLVM::ICmpPredicateAttr>(tblgen_predicate))))
|
|
return emitError(loc, "'llvm.icmp' op attribute 'predicate' failed to satisfy constraint: llvm.icmp comparison predicate");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.predicate;
|
|
auto attr = dict.get("predicate");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `predicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ICmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.predicate;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("predicate",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ICmpOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.predicate.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ICmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "predicate")
|
|
return prop.predicate;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ICmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "predicate") {
|
|
prop.predicate = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.predicate)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ICmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.predicate) attrs.append("predicate", prop.predicate);
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps35(attr, "predicate", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.predicate)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ICmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.predicate);
|
|
}
|
|
|
|
::mlir::LLVM::ICmpPredicate ICmpOp::getPredicate() {
|
|
auto attr = getPredicateAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ICmpOp::setPredicate(::mlir::LLVM::ICmpPredicate attrValue) {
|
|
getProperties().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = predicate;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ICmpOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ICmpOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ICmpOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ICmpOp ICmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::verifyInvariantsImpl() {
|
|
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
|
|
if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps35(*this, tblgen_predicate, "predicate")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps17(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps17(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that result type has i1 element type and same shape as operands");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType());
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ICmpOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.predicate;
|
|
auto predicateAttrName = ::mlir::StringAttr::get(ctx, "predicate");
|
|
auto attr = dict.get(predicateAttrName);
|
|
usedKeys.insert(predicateAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for predicate in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `predicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ICmpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ICmpOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ICmpOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::IFuncOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IFuncOpGenericAdaptorBase::IFuncOpGenericAdaptorBase(IFuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef IFuncOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::Type IFuncOpGenericAdaptorBase::getIFuncType() {
|
|
auto attr = getIFuncTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::llvm::StringRef IFuncOpGenericAdaptorBase::getResolver() {
|
|
auto attr = getResolverAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::Type IFuncOpGenericAdaptorBase::getResolverType() {
|
|
auto attr = getResolverTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::mlir::LLVM::Linkage IFuncOpGenericAdaptorBase::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
::mlir::UnitAttr IFuncOpGenericAdaptorBase::getDsoLocalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool IFuncOpGenericAdaptorBase::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::IntegerAttr IFuncOpGenericAdaptorBase::getAddressSpaceAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().address_space);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t IFuncOpGenericAdaptorBase::getAddressSpace() {
|
|
auto attr = getAddressSpaceAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::LLVM::UnnamedAddrAttr IFuncOpGenericAdaptorBase::getUnnamedAddrAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(getProperties().unnamed_addr);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::UnnamedAddr IFuncOpGenericAdaptorBase::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::VisibilityAttr IFuncOpGenericAdaptorBase::getVisibility_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::Visibility IFuncOpGenericAdaptorBase::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
IFuncOpAdaptor::IFuncOpAdaptor(IFuncOp op) : IFuncOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IFuncOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_address_space = getProperties().address_space; (void)tblgen_address_space;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_i_func_type = getProperties().i_func_type; (void)tblgen_i_func_type;
|
|
if (!tblgen_i_func_type) return emitError(loc, "'llvm.mlir.ifunc' op requires attribute 'i_func_type'");
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitError(loc, "'llvm.mlir.ifunc' op requires attribute 'linkage'");
|
|
auto tblgen_resolver = getProperties().resolver; (void)tblgen_resolver;
|
|
if (!tblgen_resolver) return emitError(loc, "'llvm.mlir.ifunc' op requires attribute 'resolver'");
|
|
auto tblgen_resolver_type = getProperties().resolver_type; (void)tblgen_resolver_type;
|
|
if (!tblgen_resolver_type) return emitError(loc, "'llvm.mlir.ifunc' op requires attribute 'resolver_type'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.mlir.ifunc' op requires attribute 'sym_name'");
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_i_func_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_i_func_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_i_func_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'i_func_type' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_resolver && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_resolver))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'resolver' failed to satisfy constraint: flat symbol reference attribute");
|
|
|
|
if (tblgen_resolver_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_resolver_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_resolver_type).getValue()))) && ((true))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'resolver_type' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification");
|
|
|
|
if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'dso_local' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_address_space && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_address_space))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_address_space).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_address_space).getValue().isNegative()))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'address_space' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative");
|
|
|
|
if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr");
|
|
|
|
if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_))))
|
|
return emitError(loc, "'llvm.mlir.ifunc' op attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.address_space;
|
|
auto attr = dict.get("address_space");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `address_space` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dso_local;
|
|
auto attr = dict.get("dso_local");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.i_func_type;
|
|
auto attr = dict.get("i_func_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `i_func_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.linkage;
|
|
auto attr = dict.get("linkage");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.resolver;
|
|
auto attr = dict.get("resolver");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `resolver` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.resolver_type;
|
|
auto attr = dict.get("resolver_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `resolver_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto attr = dict.get("unnamed_addr");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.visibility_;
|
|
auto attr = dict.get("visibility_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute IFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.address_space;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("address_space",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dso_local;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dso_local",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.i_func_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("i_func_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.linkage;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("linkage",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.resolver;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("resolver",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.resolver_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("resolver_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unnamed_addr;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.visibility_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("visibility_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code IFuncOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.address_space.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dso_local.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.i_func_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.linkage.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.resolver.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.resolver_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.visibility_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "address_space")
|
|
return prop.address_space;
|
|
|
|
if (name == "dso_local")
|
|
return prop.dso_local;
|
|
|
|
if (name == "i_func_type")
|
|
return prop.i_func_type;
|
|
|
|
if (name == "linkage")
|
|
return prop.linkage;
|
|
|
|
if (name == "resolver")
|
|
return prop.resolver;
|
|
|
|
if (name == "resolver_type")
|
|
return prop.resolver_type;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
|
|
if (name == "unnamed_addr")
|
|
return prop.unnamed_addr;
|
|
|
|
if (name == "visibility_")
|
|
return prop.visibility_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "address_space") {
|
|
prop.address_space = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.address_space)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dso_local") {
|
|
prop.dso_local = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dso_local)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "i_func_type") {
|
|
prop.i_func_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i_func_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "linkage") {
|
|
prop.linkage = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.linkage)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "resolver") {
|
|
prop.resolver = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.resolver)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "resolver_type") {
|
|
prop.resolver_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.resolver_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unnamed_addr") {
|
|
prop.unnamed_addr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unnamed_addr)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "visibility_") {
|
|
prop.visibility_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.visibility_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void IFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.address_space) attrs.append("address_space", prop.address_space);
|
|
|
|
if (prop.dso_local) attrs.append("dso_local", prop.dso_local);
|
|
|
|
if (prop.i_func_type) attrs.append("i_func_type", prop.i_func_type);
|
|
|
|
if (prop.linkage) attrs.append("linkage", prop.linkage);
|
|
|
|
if (prop.resolver) attrs.append("resolver", prop.resolver);
|
|
|
|
if (prop.resolver_type) attrs.append("resolver_type", prop.resolver_type);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
|
|
if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr);
|
|
|
|
if (prop.visibility_) attrs.append("visibility_", prop.visibility_);
|
|
}
|
|
|
|
::llvm::LogicalResult IFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAddressSpaceAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(attr, "address_space", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "dso_local", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIFuncTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "i_func_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "linkage", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResolverAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "resolver", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResolverTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "resolver_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "unnamed_addr", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "visibility_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.address_space)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.i_func_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.linkage)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.resolver)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.resolver_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.address_space);
|
|
|
|
writer.writeOptionalAttribute(prop.dso_local);
|
|
writer.writeAttribute(prop.i_func_type);
|
|
writer.writeAttribute(prop.linkage);
|
|
writer.writeAttribute(prop.resolver);
|
|
writer.writeAttribute(prop.resolver_type);
|
|
writer.writeAttribute(prop.sym_name);
|
|
|
|
writer.writeOptionalAttribute(prop.unnamed_addr);
|
|
|
|
writer.writeOptionalAttribute(prop.visibility_);
|
|
}
|
|
|
|
::llvm::StringRef IFuncOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::Type IFuncOp::getIFuncType() {
|
|
auto attr = getIFuncTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::llvm::StringRef IFuncOp::getResolver() {
|
|
auto attr = getResolverAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::Type IFuncOp::getResolverType() {
|
|
auto attr = getResolverTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::mlir::LLVM::Linkage IFuncOp::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
bool IFuncOp::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
uint32_t IFuncOp::getAddressSpace() {
|
|
auto attr = getAddressSpaceAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::LLVM::UnnamedAddr IFuncOp::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::LLVM::Visibility IFuncOp::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void IFuncOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void IFuncOp::setIFuncType(::mlir::Type attrValue) {
|
|
getProperties().i_func_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void IFuncOp::setResolver(::llvm::StringRef attrValue) {
|
|
getProperties().resolver = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void IFuncOp::setResolverType(::mlir::Type attrValue) {
|
|
getProperties().resolver_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void IFuncOp::setLinkage(::mlir::LLVM::Linkage attrValue) {
|
|
getProperties().linkage = ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void IFuncOp::setDsoLocal(bool attrValue) {
|
|
auto &odsProp = getProperties().dso_local;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void IFuncOp::setAddressSpace(uint32_t attrValue) {
|
|
getProperties().address_space = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void IFuncOp::setUnnamedAddr(::mlir::LLVM::UnnamedAddr attrValue) {
|
|
getProperties().unnamed_addr = ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void IFuncOp::setVisibility_(::mlir::LLVM::Visibility attrValue) {
|
|
getProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, Type i_func_type, StringRef resolver, Type resolver_type, Linkage linkage, LLVM::Visibility visibility) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(visibility)>(visibility));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, Type i_func_type, StringRef resolver, Type resolver_type, Linkage linkage, LLVM::Visibility visibility) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(visibility)>(visibility));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().i_func_type = i_func_type;
|
|
odsState.getOrAddProperties<Properties>().resolver = resolver;
|
|
odsState.getOrAddProperties<Properties>().resolver_type = resolver_type;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (address_space) {
|
|
odsState.getOrAddProperties<Properties>().address_space = address_space;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().i_func_type = i_func_type;
|
|
odsState.getOrAddProperties<Properties>().resolver = resolver;
|
|
odsState.getOrAddProperties<Properties>().resolver_type = resolver_type;
|
|
odsState.getOrAddProperties<Properties>().linkage = linkage;
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = dso_local;
|
|
}
|
|
if (address_space) {
|
|
odsState.getOrAddProperties<Properties>().address_space = address_space;
|
|
}
|
|
if (unnamed_addr) {
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = unnamed_addr;
|
|
}
|
|
if (visibility_) {
|
|
odsState.getOrAddProperties<Properties>().visibility_ = visibility_;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr i_func_type, ::mlir::FlatSymbolRefAttr resolver, ::mlir::TypeAttr resolver_type, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, ::mlir::IntegerAttr address_space, ::mlir::LLVM::UnnamedAddrAttr unnamed_addr, ::mlir::LLVM::VisibilityAttr visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().i_func_type = ::mlir::TypeAttr::get(i_func_type);
|
|
odsState.getOrAddProperties<Properties>().resolver = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), resolver);
|
|
odsState.getOrAddProperties<Properties>().resolver_type = ::mlir::TypeAttr::get(resolver_type);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().address_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), address_space);
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = ::mlir::LLVM::UnnamedAddrAttr::get(odsBuilder.getContext(), unnamed_addr);
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().i_func_type = ::mlir::TypeAttr::get(i_func_type);
|
|
odsState.getOrAddProperties<Properties>().resolver = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), resolver);
|
|
odsState.getOrAddProperties<Properties>().resolver_type = ::mlir::TypeAttr::get(resolver_type);
|
|
odsState.getOrAddProperties<Properties>().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage);
|
|
if (dso_local) {
|
|
odsState.getOrAddProperties<Properties>().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().address_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), address_space);
|
|
odsState.getOrAddProperties<Properties>().unnamed_addr = ::mlir::LLVM::UnnamedAddrAttr::get(odsBuilder.getContext(), unnamed_addr);
|
|
odsState.getOrAddProperties<Properties>().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type i_func_type, ::llvm::StringRef resolver, ::mlir::Type resolver_type, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, uint32_t address_space, ::mlir::LLVM::UnnamedAddr unnamed_addr, ::mlir::LLVM::Visibility visibility_) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(i_func_type)>(i_func_type), std::forward<decltype(resolver)>(resolver), std::forward<decltype(resolver_type)>(resolver_type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dso_local)>(dso_local), std::forward<decltype(address_space)>(address_space), std::forward<decltype(unnamed_addr)>(unnamed_addr), std::forward<decltype(visibility_)>(visibility_));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<IFuncOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IFuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IFuncOp IFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void IFuncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.address_space)
|
|
properties.address_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
if (!properties.unnamed_addr)
|
|
properties.unnamed_addr = ::mlir::LLVM::UnnamedAddrAttr::get(odsBuilder.getContext(), mlir::LLVM::UnnamedAddr::None);
|
|
if (!properties.visibility_)
|
|
properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default);
|
|
}
|
|
|
|
::llvm::LogicalResult IFuncOp::verifyInvariantsImpl() {
|
|
auto tblgen_address_space = getProperties().address_space; (void)tblgen_address_space;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_i_func_type = getProperties().i_func_type; (void)tblgen_i_func_type;
|
|
if (!tblgen_i_func_type) return emitOpError("requires attribute 'i_func_type'");
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
if (!tblgen_linkage) return emitOpError("requires attribute 'linkage'");
|
|
auto tblgen_resolver = getProperties().resolver; (void)tblgen_resolver;
|
|
if (!tblgen_resolver) return emitOpError("requires attribute 'resolver'");
|
|
auto tblgen_resolver_type = getProperties().resolver_type; (void)tblgen_resolver_type;
|
|
if (!tblgen_resolver_type) return emitOpError("requires attribute 'resolver_type'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_i_func_type, "i_func_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_resolver, "resolver")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_resolver_type, "resolver_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_linkage, "linkage")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_dso_local, "dso_local")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(*this, tblgen_address_space, "address_space")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_unnamed_addr, "unnamed_addr")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_visibility_, "visibility_")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IFuncOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult IFuncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::LLVM::LinkageAttr linkageAttr;
|
|
::mlir::LLVM::VisibilityAttr visibility_Attr;
|
|
::mlir::LLVM::UnnamedAddrAttr unnamed_addrAttr;
|
|
::mlir::StringAttr sym_nameAttr;
|
|
::mlir::TypeAttr i_func_typeAttr;
|
|
::mlir::TypeAttr resolver_typeAttr;
|
|
::mlir::FlatSymbolRefAttr resolverAttr;
|
|
{
|
|
auto odsResult = parseLLVMLinkage(parser, linkageAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<IFuncOp::Properties>().linkage = linkageAttr;
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"hidden","protected"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"visibility_", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeVisibility(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "visibility_ attribute specification: \"" << attrStr << '"';;
|
|
|
|
visibility_Attr = ::mlir::LLVM::VisibilityAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<IFuncOp::Properties>().visibility_ = visibility_Attr;
|
|
}
|
|
}
|
|
if (visibility_Attr) {
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"local_unnamed_addr","unnamed_addr"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"unnamed_addr", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeUnnamedAddr(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "unnamed_addr attribute specification: \"" << attrStr << '"';;
|
|
|
|
unnamed_addrAttr = ::mlir::LLVM::UnnamedAddrAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<IFuncOp::Properties>().unnamed_addr = unnamed_addrAttr;
|
|
}
|
|
}
|
|
if (unnamed_addrAttr) {
|
|
}
|
|
|
|
if (parser.parseSymbolName(sym_nameAttr))
|
|
return ::mlir::failure();
|
|
if (sym_nameAttr) result.getOrAddProperties<IFuncOp::Properties>().sym_name = sym_nameAttr;
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(i_func_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (i_func_typeAttr) result.getOrAddProperties<IFuncOp::Properties>().i_func_type = i_func_typeAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(resolver_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (resolver_typeAttr) result.getOrAddProperties<IFuncOp::Properties>().resolver_type = resolver_typeAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(resolverAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (resolverAttr) result.getOrAddProperties<IFuncOp::Properties>().resolver = resolverAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IFuncOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printLLVMLinkage(_odsPrinter, *this, getLinkageAttr());
|
|
if (getVisibility_Attr() != ::mlir::LLVM::VisibilityAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), mlir::LLVM::Visibility::Default)) {
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getVisibility_();
|
|
auto caseValueStr = stringifyVisibility(caseValue);
|
|
switch (caseValue) {
|
|
case ::mlir::LLVM::Visibility::Hidden:
|
|
case ::mlir::LLVM::Visibility::Protected:
|
|
_odsPrinter << caseValueStr;
|
|
break;
|
|
default:
|
|
_odsPrinter << '"' << caseValueStr << '"';
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (getUnnamedAddrAttr() != ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), mlir::LLVM::UnnamedAddr::None)) {
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getUnnamedAddr();
|
|
auto caseValueStr = stringifyUnnamedAddr(caseValue);
|
|
switch (caseValue) {
|
|
case ::mlir::LLVM::UnnamedAddr::Local:
|
|
case ::mlir::LLVM::UnnamedAddr::Global:
|
|
_odsPrinter << caseValueStr;
|
|
break;
|
|
default:
|
|
_odsPrinter << '"' << caseValueStr << '"';
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getIFuncTypeAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getResolverTypeAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getResolverAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("linkage");
|
|
elidedAttrs.push_back("visibility_");
|
|
elidedAttrs.push_back("unnamed_addr");
|
|
elidedAttrs.push_back("sym_name");
|
|
elidedAttrs.push_back("i_func_type");
|
|
elidedAttrs.push_back("resolver_type");
|
|
elidedAttrs.push_back("resolver");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getDsoLocalAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("dso_local");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getAddressSpaceAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("address_space");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnnamedAddrAttr();
|
|
if(attr && (attr == ::mlir::LLVM::UnnamedAddrAttr::get(odsBuilder.getContext(), mlir::LLVM::UnnamedAddr::None)))
|
|
elidedAttrs.push_back("unnamed_addr");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getVisibility_Attr();
|
|
if(attr && (attr == ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default)))
|
|
elidedAttrs.push_back("visibility_");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IFuncOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::IFuncOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::IndirectBrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IndirectBrOpGenericAdaptorBase::IndirectBrOpGenericAdaptorBase(IndirectBrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> IndirectBrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> IndirectBrOpGenericAdaptorBase::getIndbrOperandSegments() {
|
|
auto attr = getIndbrOperandSegmentsAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
IndirectBrOpAdaptor::IndirectBrOpAdaptor(IndirectBrOp op) : IndirectBrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IndirectBrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_indbr_operand_segments = getProperties().indbr_operand_segments; (void)tblgen_indbr_operand_segments;
|
|
if (!tblgen_indbr_operand_segments) return emitError(loc, "'llvm.indirectbr' op requires attribute 'indbr_operand_segments'");
|
|
|
|
if (tblgen_indbr_operand_segments && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_indbr_operand_segments))))
|
|
return emitError(loc, "'llvm.indirectbr' op attribute 'indbr_operand_segments' failed to satisfy constraint: i32 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> IndirectBrOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRangeRange IndirectBrOp::getSuccOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getIndbrOperandSegmentsAttrName()));
|
|
}
|
|
|
|
::llvm::LogicalResult IndirectBrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indbr_operand_segments;
|
|
auto attr = dict.get("indbr_operand_segments");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indbr_operand_segments` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute IndirectBrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.indbr_operand_segments;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indbr_operand_segments",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code IndirectBrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.indbr_operand_segments.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IndirectBrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "indbr_operand_segments")
|
|
return prop.indbr_operand_segments;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IndirectBrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "indbr_operand_segments") {
|
|
prop.indbr_operand_segments = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indbr_operand_segments)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void IndirectBrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.indbr_operand_segments) attrs.append("indbr_operand_segments", prop.indbr_operand_segments);
|
|
}
|
|
|
|
::llvm::LogicalResult IndirectBrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndbrOperandSegmentsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "indbr_operand_segments", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IndirectBrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.indbr_operand_segments)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IndirectBrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.indbr_operand_segments);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> IndirectBrOp::getIndbrOperandSegments() {
|
|
auto attr = getIndbrOperandSegmentsAttr();
|
|
return attr;
|
|
}
|
|
|
|
void IndirectBrOp::setIndbrOperandSegments(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().indbr_operand_segments = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
IndirectBrOp IndirectBrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value addr, ArrayRef<ValueRange> succOperands, BlockRange successors) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(addr)>(addr), std::forward<decltype(succOperands)>(succOperands), std::forward<decltype(successors)>(successors));
|
|
auto __res__ = ::llvm::dyn_cast<IndirectBrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IndirectBrOp IndirectBrOp::create(::mlir::ImplicitLocOpBuilder &builder, Value addr, ArrayRef<ValueRange> succOperands, BlockRange successors) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(addr)>(addr), std::forward<decltype(succOperands)>(succOperands), std::forward<decltype(successors)>(successors));
|
|
}
|
|
|
|
::llvm::LogicalResult IndirectBrOp::verifyInvariantsImpl() {
|
|
auto tblgen_indbr_operand_segments = getProperties().indbr_operand_segments; (void)tblgen_indbr_operand_segments;
|
|
if (!tblgen_indbr_operand_segments) return emitOpError("requires attribute 'indbr_operand_segments'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_indbr_operand_segments, "indbr_operand_segments")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "indbr_operand_segments", "succOperands", valueGroup1.size())))
|
|
return ::mlir::failure();
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps18(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IndirectBrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult IndirectBrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand addrRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(&addrRawOperand, 1); ::llvm::SMLoc addrOperandsLoc;
|
|
(void)addrOperandsLoc;
|
|
::mlir::Type addrRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> addrTypes(&addrRawType, 1);
|
|
::llvm::SmallVector<::mlir::Block *, 2> successorsSuccessors;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> succOperandsOperands;
|
|
llvm::SmallVector<int32_t> succOperandsOperandGroupSizes;
|
|
::llvm::SMLoc succOperandsOperandsLoc;
|
|
(void)succOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> succOperandsTypes;
|
|
|
|
addrOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(addrRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::LLVM::LLVMPointerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
addrRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
{
|
|
succOperandsOperandsLoc = parser.getCurrentLocation();
|
|
::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> succOperandsOperandGroups;
|
|
::llvm::SmallVector<llvm::SmallVector<::mlir::Type>> succOperandsTypeGroups;
|
|
auto odsResult = parseIndirectBrOpSucessors(parser, addrRawType, successorsSuccessors, succOperandsOperandGroups, succOperandsTypeGroups);
|
|
if (odsResult) return ::mlir::failure();
|
|
for (const auto &subRange : succOperandsOperandGroups) {
|
|
succOperandsOperands.append(subRange.begin(), subRange.end());
|
|
succOperandsOperandGroupSizes.push_back(subRange.size());
|
|
}
|
|
for (const auto &subRange : succOperandsTypeGroups)
|
|
succOperandsTypes.append(subRange.begin(), subRange.end());
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
result.addSuccessors(successorsSuccessors);
|
|
result.getOrAddProperties<IndirectBrOp::Properties>().indbr_operand_segments = parser.getBuilder().getDenseI32ArrayAttr(succOperandsOperandGroupSizes);
|
|
if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(succOperandsOperands, succOperandsTypes, succOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IndirectBrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getAddr();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getAddr().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::LLVM::LLVMPointerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
printIndirectBrOpSucessors(_odsPrinter, *this, getAddr().getType(), getSuccessors(), getSuccOperands(), getSuccOperands().getTypes());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("indbr_operand_segments");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void IndirectBrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IndirectBrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::IndirectBrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::InlineAsmOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
InlineAsmOpGenericAdaptorBase::InlineAsmOpGenericAdaptorBase(InlineAsmOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> InlineAsmOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::StringRef InlineAsmOpGenericAdaptorBase::getAsmString() {
|
|
auto attr = getAsmStringAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef InlineAsmOpGenericAdaptorBase::getConstraints() {
|
|
auto attr = getConstraintsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::UnitAttr InlineAsmOpGenericAdaptorBase::getHasSideEffectsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().has_side_effects);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool InlineAsmOpGenericAdaptorBase::getHasSideEffects() {
|
|
auto attr = getHasSideEffectsAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr InlineAsmOpGenericAdaptorBase::getIsAlignStackAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_align_stack);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool InlineAsmOpGenericAdaptorBase::getIsAlignStack() {
|
|
auto attr = getIsAlignStackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::TailCallKindAttr InlineAsmOpGenericAdaptorBase::getTailCallKindAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::TailCallKindAttr>(getProperties().tail_call_kind);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::tailcallkind::TailCallKind InlineAsmOpGenericAdaptorBase::getTailCallKind() {
|
|
auto attr = getTailCallKindAttr();
|
|
return attr.getTailCallKind();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::AsmDialect> InlineAsmOpGenericAdaptorBase::getAsmDialect() {
|
|
auto attr = getAsmDialectAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::AsmDialect>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InlineAsmOpGenericAdaptorBase::getOperandAttrs() {
|
|
auto attr = getOperandAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
InlineAsmOpAdaptor::InlineAsmOpAdaptor(InlineAsmOp op) : InlineAsmOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult InlineAsmOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_asm_dialect = getProperties().asm_dialect; (void)tblgen_asm_dialect;
|
|
auto tblgen_asm_string = getProperties().asm_string; (void)tblgen_asm_string;
|
|
if (!tblgen_asm_string) return emitError(loc, "'llvm.inline_asm' op requires attribute 'asm_string'");
|
|
auto tblgen_constraints = getProperties().constraints; (void)tblgen_constraints;
|
|
if (!tblgen_constraints) return emitError(loc, "'llvm.inline_asm' op requires attribute 'constraints'");
|
|
auto tblgen_has_side_effects = getProperties().has_side_effects; (void)tblgen_has_side_effects;
|
|
auto tblgen_is_align_stack = getProperties().is_align_stack; (void)tblgen_is_align_stack;
|
|
auto tblgen_operand_attrs = getProperties().operand_attrs; (void)tblgen_operand_attrs;
|
|
auto tblgen_tail_call_kind = getProperties().tail_call_kind; (void)tblgen_tail_call_kind;
|
|
|
|
if (tblgen_asm_string && !((::llvm::isa<::mlir::StringAttr>(tblgen_asm_string))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'asm_string' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_constraints && !((::llvm::isa<::mlir::StringAttr>(tblgen_constraints))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'constraints' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_has_side_effects && !((::llvm::isa<::mlir::UnitAttr>(tblgen_has_side_effects))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'has_side_effects' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_is_align_stack && !((::llvm::isa<::mlir::UnitAttr>(tblgen_is_align_stack))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'is_align_stack' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_tail_call_kind && !((::llvm::isa<::mlir::LLVM::TailCallKindAttr>(tblgen_tail_call_kind))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'tail_call_kind' failed to satisfy constraint: LLVM Calling Convention specification");
|
|
|
|
if (tblgen_asm_dialect && !((::llvm::isa<::mlir::LLVM::AsmDialectAttr>(tblgen_asm_dialect))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'asm_dialect' failed to satisfy constraint: ATT (0) or Intel (1) asm dialect");
|
|
|
|
if (tblgen_operand_attrs && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_operand_attrs))))
|
|
return emitError(loc, "'llvm.inline_asm' op attribute 'operand_attrs' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> InlineAsmOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange InlineAsmOp::getOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> InlineAsmOp::getODSResultIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::LogicalResult InlineAsmOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.asm_dialect;
|
|
auto attr = dict.get("asm_dialect");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `asm_dialect` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.asm_string;
|
|
auto attr = dict.get("asm_string");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `asm_string` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.constraints;
|
|
auto attr = dict.get("constraints");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `constraints` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.has_side_effects;
|
|
auto attr = dict.get("has_side_effects");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `has_side_effects` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.is_align_stack;
|
|
auto attr = dict.get("is_align_stack");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `is_align_stack` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operand_attrs;
|
|
auto attr = dict.get("operand_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `operand_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tail_call_kind;
|
|
auto attr = dict.get("tail_call_kind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tail_call_kind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute InlineAsmOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.asm_dialect;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("asm_dialect",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.asm_string;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("asm_string",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.constraints;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("constraints",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.has_side_effects;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("has_side_effects",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.is_align_stack;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("is_align_stack",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operand_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("operand_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tail_call_kind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tail_call_kind",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code InlineAsmOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.asm_dialect.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.asm_string.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.constraints.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.has_side_effects.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.is_align_stack.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.operand_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tail_call_kind.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> InlineAsmOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "asm_dialect")
|
|
return prop.asm_dialect;
|
|
|
|
if (name == "asm_string")
|
|
return prop.asm_string;
|
|
|
|
if (name == "constraints")
|
|
return prop.constraints;
|
|
|
|
if (name == "has_side_effects")
|
|
return prop.has_side_effects;
|
|
|
|
if (name == "is_align_stack")
|
|
return prop.is_align_stack;
|
|
|
|
if (name == "operand_attrs")
|
|
return prop.operand_attrs;
|
|
|
|
if (name == "tail_call_kind")
|
|
return prop.tail_call_kind;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void InlineAsmOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "asm_dialect") {
|
|
prop.asm_dialect = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.asm_dialect)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "asm_string") {
|
|
prop.asm_string = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.asm_string)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "constraints") {
|
|
prop.constraints = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.constraints)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "has_side_effects") {
|
|
prop.has_side_effects = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.has_side_effects)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "is_align_stack") {
|
|
prop.is_align_stack = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.is_align_stack)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "operand_attrs") {
|
|
prop.operand_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.operand_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tail_call_kind") {
|
|
prop.tail_call_kind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tail_call_kind)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void InlineAsmOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.asm_dialect) attrs.append("asm_dialect", prop.asm_dialect);
|
|
|
|
if (prop.asm_string) attrs.append("asm_string", prop.asm_string);
|
|
|
|
if (prop.constraints) attrs.append("constraints", prop.constraints);
|
|
|
|
if (prop.has_side_effects) attrs.append("has_side_effects", prop.has_side_effects);
|
|
|
|
if (prop.is_align_stack) attrs.append("is_align_stack", prop.is_align_stack);
|
|
|
|
if (prop.operand_attrs) attrs.append("operand_attrs", prop.operand_attrs);
|
|
|
|
if (prop.tail_call_kind) attrs.append("tail_call_kind", prop.tail_call_kind);
|
|
}
|
|
|
|
::llvm::LogicalResult InlineAsmOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAsmDialectAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps36(attr, "asm_dialect", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAsmStringAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "asm_string", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getConstraintsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "constraints", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getHasSideEffectsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "has_side_effects", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsAlignStackAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "is_align_stack", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOperandAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "operand_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTailCallKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(attr, "tail_call_kind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InlineAsmOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.asm_dialect)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.asm_string)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.constraints)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.has_side_effects)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.is_align_stack)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.operand_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tail_call_kind)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InlineAsmOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.asm_dialect);
|
|
writer.writeAttribute(prop.asm_string);
|
|
writer.writeAttribute(prop.constraints);
|
|
|
|
writer.writeOptionalAttribute(prop.has_side_effects);
|
|
|
|
writer.writeOptionalAttribute(prop.is_align_stack);
|
|
|
|
writer.writeOptionalAttribute(prop.operand_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.tail_call_kind);
|
|
}
|
|
|
|
::llvm::StringRef InlineAsmOp::getAsmString() {
|
|
auto attr = getAsmStringAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef InlineAsmOp::getConstraints() {
|
|
auto attr = getConstraintsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool InlineAsmOp::getHasSideEffects() {
|
|
auto attr = getHasSideEffectsAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool InlineAsmOp::getIsAlignStack() {
|
|
auto attr = getIsAlignStackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::tailcallkind::TailCallKind InlineAsmOp::getTailCallKind() {
|
|
auto attr = getTailCallKindAttr();
|
|
return attr.getTailCallKind();
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::AsmDialect> InlineAsmOp::getAsmDialect() {
|
|
auto attr = getAsmDialectAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::AsmDialect>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InlineAsmOp::getOperandAttrs() {
|
|
auto attr = getOperandAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void InlineAsmOp::setAsmString(::llvm::StringRef attrValue) {
|
|
getProperties().asm_string = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void InlineAsmOp::setConstraints(::llvm::StringRef attrValue) {
|
|
getProperties().constraints = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void InlineAsmOp::setHasSideEffects(bool attrValue) {
|
|
auto &odsProp = getProperties().has_side_effects;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InlineAsmOp::setIsAlignStack(bool attrValue) {
|
|
auto &odsProp = getProperties().is_align_stack;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InlineAsmOp::setTailCallKind(::mlir::LLVM::tailcallkind::TailCallKind attrValue) {
|
|
getProperties().tail_call_kind = ::mlir::LLVM::TailCallKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void InlineAsmOp::setAsmDialect(::std::optional<::mlir::LLVM::AsmDialect> attrValue) {
|
|
auto &odsProp = getProperties().asm_dialect;
|
|
if (attrValue)
|
|
odsProp = ::mlir::LLVM::AsmDialectAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
odsState.addOperands(operands);
|
|
odsState.getOrAddProperties<Properties>().asm_string = asm_string;
|
|
odsState.getOrAddProperties<Properties>().constraints = constraints;
|
|
if (has_side_effects) {
|
|
odsState.getOrAddProperties<Properties>().has_side_effects = has_side_effects;
|
|
}
|
|
if (is_align_stack) {
|
|
odsState.getOrAddProperties<Properties>().is_align_stack = is_align_stack;
|
|
}
|
|
if (tail_call_kind) {
|
|
odsState.getOrAddProperties<Properties>().tail_call_kind = tail_call_kind;
|
|
}
|
|
if (asm_dialect) {
|
|
odsState.getOrAddProperties<Properties>().asm_dialect = asm_dialect;
|
|
}
|
|
if (operand_attrs) {
|
|
odsState.getOrAddProperties<Properties>().operand_attrs = operand_attrs;
|
|
}
|
|
if (res)
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
odsState.addOperands(operands);
|
|
odsState.getOrAddProperties<Properties>().asm_string = asm_string;
|
|
odsState.getOrAddProperties<Properties>().constraints = constraints;
|
|
if (has_side_effects) {
|
|
odsState.getOrAddProperties<Properties>().has_side_effects = has_side_effects;
|
|
}
|
|
if (is_align_stack) {
|
|
odsState.getOrAddProperties<Properties>().is_align_stack = is_align_stack;
|
|
}
|
|
if (tail_call_kind) {
|
|
odsState.getOrAddProperties<Properties>().tail_call_kind = tail_call_kind;
|
|
}
|
|
if (asm_dialect) {
|
|
odsState.getOrAddProperties<Properties>().asm_dialect = asm_dialect;
|
|
}
|
|
if (operand_attrs) {
|
|
odsState.getOrAddProperties<Properties>().operand_attrs = operand_attrs;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, ::mlir::LLVM::TailCallKindAttr tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
odsState.addOperands(operands);
|
|
odsState.getOrAddProperties<Properties>().asm_string = odsBuilder.getStringAttr(asm_string);
|
|
odsState.getOrAddProperties<Properties>().constraints = odsBuilder.getStringAttr(constraints);
|
|
if (has_side_effects) {
|
|
odsState.getOrAddProperties<Properties>().has_side_effects = ((has_side_effects) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (is_align_stack) {
|
|
odsState.getOrAddProperties<Properties>().is_align_stack = ((is_align_stack) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().tail_call_kind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), tail_call_kind);
|
|
if (asm_dialect) {
|
|
odsState.getOrAddProperties<Properties>().asm_dialect = asm_dialect;
|
|
}
|
|
if (operand_attrs) {
|
|
odsState.getOrAddProperties<Properties>().operand_attrs = operand_attrs;
|
|
}
|
|
if (res)
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
odsState.addOperands(operands);
|
|
odsState.getOrAddProperties<Properties>().asm_string = odsBuilder.getStringAttr(asm_string);
|
|
odsState.getOrAddProperties<Properties>().constraints = odsBuilder.getStringAttr(constraints);
|
|
if (has_side_effects) {
|
|
odsState.getOrAddProperties<Properties>().has_side_effects = ((has_side_effects) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (is_align_stack) {
|
|
odsState.getOrAddProperties<Properties>().is_align_stack = ((is_align_stack) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().tail_call_kind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), tail_call_kind);
|
|
if (asm_dialect) {
|
|
odsState.getOrAddProperties<Properties>().asm_dialect = asm_dialect;
|
|
}
|
|
if (operand_attrs) {
|
|
odsState.getOrAddProperties<Properties>().operand_attrs = operand_attrs;
|
|
}
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, ::mlir::LLVM::tailcallkind::TailCallKind tail_call_kind, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(asm_string)>(asm_string), std::forward<decltype(constraints)>(constraints), std::forward<decltype(has_side_effects)>(has_side_effects), std::forward<decltype(is_align_stack)>(is_align_stack), std::forward<decltype(tail_call_kind)>(tail_call_kind), std::forward<decltype(asm_dialect)>(asm_dialect), std::forward<decltype(operand_attrs)>(operand_attrs));
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<InlineAsmOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InlineAsmOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InlineAsmOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InlineAsmOp InlineAsmOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void InlineAsmOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.tail_call_kind)
|
|
properties.tail_call_kind = ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), TailCallKind::None);
|
|
}
|
|
|
|
::llvm::LogicalResult InlineAsmOp::verifyInvariantsImpl() {
|
|
auto tblgen_asm_dialect = getProperties().asm_dialect; (void)tblgen_asm_dialect;
|
|
auto tblgen_asm_string = getProperties().asm_string; (void)tblgen_asm_string;
|
|
if (!tblgen_asm_string) return emitOpError("requires attribute 'asm_string'");
|
|
auto tblgen_constraints = getProperties().constraints; (void)tblgen_constraints;
|
|
if (!tblgen_constraints) return emitOpError("requires attribute 'constraints'");
|
|
auto tblgen_has_side_effects = getProperties().has_side_effects; (void)tblgen_has_side_effects;
|
|
auto tblgen_is_align_stack = getProperties().is_align_stack; (void)tblgen_is_align_stack;
|
|
auto tblgen_operand_attrs = getProperties().operand_attrs; (void)tblgen_operand_attrs;
|
|
auto tblgen_tail_call_kind = getProperties().tail_call_kind; (void)tblgen_tail_call_kind;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_asm_string, "asm_string")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_constraints, "constraints")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_has_side_effects, "has_side_effects")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_is_align_stack, "is_align_stack")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(*this, tblgen_tail_call_kind, "tail_call_kind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps36(*this, tblgen_asm_dialect, "asm_dialect")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_operand_attrs, "operand_attrs")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
if (valueGroup0.size() > 1) {
|
|
return emitOpError("result group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup0.size();
|
|
}
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InlineAsmOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult InlineAsmOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::LLVM::TailCallKindAttr tail_call_kindAttr;
|
|
::mlir::LLVM::AsmDialectAttr asm_dialectAttr;
|
|
::mlir::ArrayAttr operand_attrsAttr;
|
|
::mlir::StringAttr asm_stringAttr;
|
|
::mlir::StringAttr constraintsAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
|
|
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
|
|
::llvm::ArrayRef<::mlir::Type> allResultTypes;
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("has_side_effects"))) {
|
|
result.getOrAddProperties<InlineAsmOp::Properties>().has_side_effects = parser.getBuilder().getUnitAttr(); }
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("is_align_stack"))) {
|
|
result.getOrAddProperties<InlineAsmOp::Properties>().is_align_stack = parser.getBuilder().getUnitAttr(); }
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("tail_call_kind"))) {
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(tail_call_kindAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (tail_call_kindAttr) result.getOrAddProperties<InlineAsmOp::Properties>().tail_call_kind = tail_call_kindAttr;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("asm_dialect"))) {
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"att","intel"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"asm_dialect", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'asm_dialect' [att, intel]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAsmDialect(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "asm_dialect attribute specification: \"" << attrStr << '"';;
|
|
|
|
asm_dialectAttr = ::mlir::LLVM::AsmDialectAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<InlineAsmOp::Properties>().asm_dialect = asm_dialectAttr;
|
|
}
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("operand_attrs"))) {
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(operand_attrsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (operand_attrsAttr) result.getOrAddProperties<InlineAsmOp::Properties>().operand_attrs = operand_attrsAttr;
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
if (parser.parseCustomAttributeWithFallback(asm_stringAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (asm_stringAttr) result.getOrAddProperties<InlineAsmOp::Properties>().asm_string = asm_stringAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(constraintsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (constraintsAttr) result.getOrAddProperties<InlineAsmOp::Properties>().constraints = constraintsAttr;
|
|
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(allOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::FunctionType allOperand__allResult_functionType;
|
|
if (parser.parseType(allOperand__allResult_functionType))
|
|
return ::mlir::failure();
|
|
allOperandTypes = allOperand__allResult_functionType.getInputs();
|
|
allResultTypes = allOperand__allResult_functionType.getResults();
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InlineAsmOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getHasSideEffectsAttr() && getHasSideEffectsAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "has_side_effects";
|
|
}
|
|
if ((getIsAlignStackAttr() && getIsAlignStackAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "is_align_stack";
|
|
}
|
|
if (getTailCallKindAttr() != ::mlir::LLVM::TailCallKindAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TailCallKind::None)) {
|
|
_odsPrinter << ' ' << "tail_call_kind";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getTailCallKindAttr());
|
|
}
|
|
if (getAsmDialectAttr()) {
|
|
_odsPrinter << ' ' << "asm_dialect";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = *getAsmDialect();
|
|
auto caseValueStr = stringifyAsmDialect(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
}
|
|
if (getOperandAttrsAttr()) {
|
|
_odsPrinter << ' ' << "operand_attrs";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getOperandAttrsAttr());
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("has_side_effects");
|
|
elidedAttrs.push_back("is_align_stack");
|
|
elidedAttrs.push_back("tail_call_kind");
|
|
elidedAttrs.push_back("asm_dialect");
|
|
elidedAttrs.push_back("operand_attrs");
|
|
elidedAttrs.push_back("asm_string");
|
|
elidedAttrs.push_back("constraints");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getHasSideEffectsAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("has_side_effects");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsAlignStackAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("is_align_stack");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getTailCallKindAttr();
|
|
if(attr && (attr == ::mlir::LLVM::TailCallKindAttr::get(odsBuilder.getContext(), TailCallKind::None)))
|
|
elidedAttrs.push_back("tail_call_kind");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getAsmStringAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getConstraintsAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getOperands();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InlineAsmOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::InlineAsmOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::InsertElementOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
InsertElementOpGenericAdaptorBase::InsertElementOpGenericAdaptorBase(InsertElementOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
InsertElementOpAdaptor::InsertElementOpAdaptor(InsertElementOp op) : InsertElementOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult InsertElementOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertElementOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute InsertElementOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code InsertElementOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> InsertElementOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void InsertElementOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void InsertElementOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult InsertElementOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(position);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(position);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
odsState.addOperands(vector);
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(position);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(vector)>(vector), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertElementOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertElementOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertElementOp InsertElementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult InsertElementOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps19(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((std::equal_to<>()(::llvm::cast<::mlir::VectorType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSOperands(1).begin()).getType()))))
|
|
return emitOpError("failed to verify that argument type matches vector element type");
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {res, vector} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertElementOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertElementOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult InsertElementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc;
|
|
(void)vectorOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand positionRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> positionOperands(&positionRawOperand, 1); ::llvm::SMLoc positionOperandsLoc;
|
|
(void)positionOperandsLoc;
|
|
::mlir::Type positionRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> positionTypes(&positionRawType, 1);
|
|
::mlir::Type vectorRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1);
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
vectorOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(vectorRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
positionOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(positionRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
positionRawType = type;
|
|
}
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
vectorRawType = type;
|
|
}
|
|
for (::mlir::Type type : vectorTypes) {
|
|
(void)type;
|
|
if (!((::mlir::LLVM::isCompatibleVectorType(type)))) {
|
|
return parser.emitError(parser.getNameLoc()) << "'vector' must be LLVM dialect-compatible vector type, but got " << type;
|
|
}
|
|
}
|
|
result.addTypes(vectorTypes[0]);
|
|
if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(valueOperands, ::llvm::cast<::mlir::VectorType>(vectorTypes[0]).getElementType(), valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(positionOperands, positionTypes, positionOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InsertElementOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getVector();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getPosition();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getPosition().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getVector().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void InsertElementOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertElementOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::InsertValueOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
InsertValueOpGenericAdaptorBase::InsertValueOpGenericAdaptorBase(InsertValueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::ArrayRef<int64_t> InsertValueOpGenericAdaptorBase::getPosition() {
|
|
auto attr = getPositionAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
InsertValueOpAdaptor::InsertValueOpAdaptor(InsertValueOp op) : InsertValueOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult InsertValueOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_position = getProperties().position; (void)tblgen_position;
|
|
if (!tblgen_position) return emitError(loc, "'llvm.insertvalue' op requires attribute 'position'");
|
|
|
|
if (tblgen_position && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_position))))
|
|
return emitError(loc, "'llvm.insertvalue' op attribute 'position' failed to satisfy constraint: i64 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.position;
|
|
auto attr = dict.get("position");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `position` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute InsertValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.position;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("position",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code InsertValueOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.position.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> InsertValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "position")
|
|
return prop.position;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void InsertValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "position") {
|
|
prop.position = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.position)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void InsertValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.position) attrs.append("position", prop.position);
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPositionAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(attr, "position", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.position)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InsertValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.position);
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> InsertValueOp::getPosition() {
|
|
auto attr = getPositionAttr();
|
|
return attr;
|
|
}
|
|
|
|
void InsertValueOp::setPosition(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().position = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = position;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = position;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = position;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = odsBuilder.getDenseI64ArrayAttr(position);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = odsBuilder.getDenseI64ArrayAttr(position);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
odsState.addOperands(container);
|
|
odsState.addOperands(value);
|
|
odsState.getOrAddProperties<Properties>().position = odsBuilder.getDenseI64ArrayAttr(position);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef<int64_t> position) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(container)>(container), std::forward<decltype(value)>(value), std::forward<decltype(position)>(position));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<InsertValueOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<InsertValueOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InsertValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InsertValueOp InsertValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::verifyInvariantsImpl() {
|
|
auto tblgen_position = getProperties().position; (void)tblgen_position;
|
|
if (!tblgen_position) return emitOpError("requires attribute 'position'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(*this, tblgen_position, "position")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps19(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {container, res} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult InsertValueOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult InsertValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand containerRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> containerOperands(&containerRawOperand, 1); ::llvm::SMLoc containerOperandsLoc;
|
|
(void)containerOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr positionAttr;
|
|
::mlir::Type containerRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> containerTypes(&containerRawType, 1);
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
containerOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(containerRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(positionAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (positionAttr) result.getOrAddProperties<InsertValueOp::Properties>().position = positionAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
containerRawType = type;
|
|
}
|
|
{
|
|
auto odsResult = parseInsertExtractValueElementType(parser, valueRawType, containerRawType, positionAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
}
|
|
result.addTypes(containerTypes[0]);
|
|
if (parser.resolveOperands(containerOperands, containerTypes, containerOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InsertValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getContainer();
|
|
_odsPrinter.printStrippedAttrOrType(getPositionAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("position");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getContainer().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ';
|
|
printInsertExtractValueElementType(_odsPrinter, *this, getValue().getType(), getContainer().getType(), getPositionAttr());
|
|
}
|
|
|
|
void InsertValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertValueOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::InsertValueOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::IntToPtrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntToPtrOpGenericAdaptorBase::IntToPtrOpGenericAdaptorBase(IntToPtrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::std::optional<::mlir::LLVM::DereferenceableAttr> IntToPtrOpGenericAdaptorBase::getDereferenceable() {
|
|
auto attr = getDereferenceableAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DereferenceableAttr>(::llvm::cast<::mlir::LLVM::DereferenceableAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
IntToPtrOpAdaptor::IntToPtrOpAdaptor(IntToPtrOp op) : IntToPtrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntToPtrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_dereferenceable = getProperties().dereferenceable; (void)tblgen_dereferenceable;
|
|
|
|
if (tblgen_dereferenceable && !((::llvm::isa<::mlir::LLVM::DereferenceableAttr>(tblgen_dereferenceable))))
|
|
return emitError(loc, "'llvm.inttoptr' op attribute 'dereferenceable' failed to satisfy constraint: LLVM dereferenceable attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntToPtrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dereferenceable;
|
|
auto attr = dict.get("dereferenceable");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dereferenceable` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute IntToPtrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.dereferenceable;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dereferenceable",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code IntToPtrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.dereferenceable.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntToPtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "dereferenceable")
|
|
return prop.dereferenceable;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntToPtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "dereferenceable") {
|
|
prop.dereferenceable = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dereferenceable)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void IntToPtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.dereferenceable) attrs.append("dereferenceable", prop.dereferenceable);
|
|
}
|
|
|
|
::llvm::LogicalResult IntToPtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDereferenceableAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps37(attr, "dereferenceable", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntToPtrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dereferenceable)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntToPtrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.dereferenceable);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::DereferenceableAttr> IntToPtrOp::getDereferenceable() {
|
|
auto attr = getDereferenceableAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DereferenceableAttr>(::llvm::cast<::mlir::LLVM::DereferenceableAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntToPtrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
odsState.addOperands(arg);
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(dereferenceable)>(dereferenceable));
|
|
auto __res__ = ::llvm::dyn_cast<IntToPtrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(dereferenceable)>(dereferenceable));
|
|
}
|
|
|
|
void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
odsState.addOperands(arg);
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(dereferenceable)>(dereferenceable));
|
|
auto __res__ = ::llvm::dyn_cast<IntToPtrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(dereferenceable)>(dereferenceable));
|
|
}
|
|
|
|
void IntToPtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<IntToPtrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntToPtrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntToPtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntToPtrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntToPtrOp IntToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntToPtrOp::verifyInvariantsImpl() {
|
|
auto tblgen_dereferenceable = getProperties().dereferenceable; (void)tblgen_dereferenceable;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps37(*this, tblgen_dereferenceable, "dereferenceable")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntToPtrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult IntToPtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::LLVM::DereferenceableAttr dereferenceableAttr;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("dereferenceable"))) {
|
|
|
|
if (parser.parseCustomAttributeWithFallback(dereferenceableAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (dereferenceableAttr) result.getOrAddProperties<IntToPtrOp::Properties>().dereferenceable = dereferenceableAttr;
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntToPtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
if (getDereferenceableAttr()) {
|
|
_odsPrinter << ' ' << "dereferenceable";
|
|
_odsPrinter.printStrippedAttrOrType(getDereferenceableAttr());
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("dereferenceable");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntToPtrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IntToPtrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::IntToPtrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::InvokeOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
InvokeOpGenericAdaptorBase::InvokeOpGenericAdaptorBase(InvokeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> InvokeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LLVMFunctionType> InvokeOpGenericAdaptorBase::getVarCalleeType() {
|
|
auto attr = getVarCalleeTypeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > InvokeOpGenericAdaptorBase::getCallee() {
|
|
auto attr = getCalleeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOpGenericAdaptorBase::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOpGenericAdaptorBase::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> InvokeOpGenericAdaptorBase::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::CConvAttr InvokeOpGenericAdaptorBase::getCConvAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(getProperties().CConv);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv InvokeOpGenericAdaptorBase::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> InvokeOpGenericAdaptorBase::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOpGenericAdaptorBase::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
InvokeOpAdaptor::InvokeOpAdaptor(InvokeOp op) : InvokeOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult InvokeOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitError(loc, "'llvm.invoke' op requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_var_callee_type = getProperties().var_callee_type; (void)tblgen_var_callee_type;
|
|
|
|
if (tblgen_var_callee_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_var_callee_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_var_callee_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_var_callee_type).getValue())))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'var_callee_type' failed to satisfy constraint: type attribute of LLVM function type");
|
|
|
|
if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'callee' failed to satisfy constraint: flat symbol reference attribute");
|
|
|
|
if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_CConv && !((::llvm::isa<::mlir::LLVM::CConvAttr>(tblgen_CConv))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'CConv' failed to satisfy constraint: LLVM Calling Convention specification");
|
|
|
|
if (tblgen_op_bundle_sizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_op_bundle_sizes))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'op_bundle_sizes' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_op_bundle_tags && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_op_bundle_tags))))
|
|
return emitError(loc, "'llvm.invoke' op attribute 'op_bundle_tags' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> InvokeOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange InvokeOp::getCalleeOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange InvokeOp::getNormalDestOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange InvokeOp::getUnwindDestOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRangeRange InvokeOp::getOpBundleOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getOpBundleSizesAttrName()));
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> InvokeOp::getODSResultIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.CConv;
|
|
auto attr = dict.get("CConv");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto attr = dict.get("arg_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.branch_weights;
|
|
auto attr = dict.get("branch_weights");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.callee;
|
|
auto attr = dict.get("callee");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto attr = dict.get("op_bundle_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto attr = dict.get("op_bundle_tags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.res_attrs;
|
|
auto attr = dict.get("res_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.var_callee_type;
|
|
auto attr = dict.get("var_callee_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `var_callee_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute InvokeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.CConv;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("CConv",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arg_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.branch_weights;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("branch_weights",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.callee;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("callee",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.op_bundle_tags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("op_bundle_tags",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.res_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.var_callee_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("var_callee_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code InvokeOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.CConv.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.branch_weights.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.callee.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_sizes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.op_bundle_tags.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.var_callee_type.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> InvokeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "CConv")
|
|
return prop.CConv;
|
|
|
|
if (name == "arg_attrs")
|
|
return prop.arg_attrs;
|
|
|
|
if (name == "branch_weights")
|
|
return prop.branch_weights;
|
|
|
|
if (name == "callee")
|
|
return prop.callee;
|
|
|
|
if (name == "op_bundle_sizes")
|
|
return prop.op_bundle_sizes;
|
|
|
|
if (name == "op_bundle_tags")
|
|
return prop.op_bundle_tags;
|
|
|
|
if (name == "res_attrs")
|
|
return prop.res_attrs;
|
|
|
|
if (name == "var_callee_type")
|
|
return prop.var_callee_type;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void InvokeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "CConv") {
|
|
prop.CConv = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.CConv)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arg_attrs") {
|
|
prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "branch_weights") {
|
|
prop.branch_weights = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.branch_weights)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "callee") {
|
|
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_sizes") {
|
|
prop.op_bundle_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_sizes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "op_bundle_tags") {
|
|
prop.op_bundle_tags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op_bundle_tags)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "res_attrs") {
|
|
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "var_callee_type") {
|
|
prop.var_callee_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.var_callee_type)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void InvokeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.CConv) attrs.append("CConv", prop.CConv);
|
|
|
|
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
|
|
|
|
if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights);
|
|
|
|
if (prop.callee) attrs.append("callee", prop.callee);
|
|
|
|
if (prop.op_bundle_sizes) attrs.append("op_bundle_sizes", prop.op_bundle_sizes);
|
|
|
|
if (prop.op_bundle_tags) attrs.append("op_bundle_tags", prop.op_bundle_tags);
|
|
|
|
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
|
|
|
|
if (prop.var_callee_type) attrs.append("var_callee_type", prop.var_callee_type);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCConvAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(attr, "CConv", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "arg_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "branch_weights", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "callee", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "op_bundle_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOpBundleTagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "op_bundle_tags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "res_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVarCalleeTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(attr, "var_callee_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.CConv)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.callee)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.op_bundle_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.op_bundle_tags)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.var_callee_type)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void InvokeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.CConv);
|
|
|
|
writer.writeOptionalAttribute(prop.arg_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.branch_weights);
|
|
|
|
writer.writeOptionalAttribute(prop.callee);
|
|
writer.writeAttribute(prop.op_bundle_sizes);
|
|
|
|
writer.writeOptionalAttribute(prop.op_bundle_tags);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
writer.writeOptionalAttribute(prop.res_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.var_callee_type);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::LLVMFunctionType> InvokeOp::getVarCalleeType() {
|
|
auto attr = getVarCalleeTypeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > InvokeOp::getCallee() {
|
|
auto attr = getCalleeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOp::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOp::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> InvokeOp::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv InvokeOp::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> InvokeOp::getOpBundleSizes() {
|
|
auto attr = getOpBundleSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > InvokeOp::getOpBundleTags() {
|
|
auto attr = getOpBundleTagsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void InvokeOp::setVarCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue) {
|
|
auto &odsProp = getProperties().var_callee_type;
|
|
if (attrValue)
|
|
odsProp = ::mlir::TypeAttr::get(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InvokeOp::setCallee(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().callee;
|
|
if (attrValue)
|
|
odsProp = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InvokeOp::setBranchWeights(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().branch_weights;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void InvokeOp::setCConv(::mlir::LLVM::cconv::CConv attrValue) {
|
|
getProperties().CConv = ::mlir::LLVM::CConvAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void InvokeOp::setOpBundleSizes(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().op_bundle_sizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFuncOp func, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(func)>(func), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFuncOp func, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(func)>(func), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange tys, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(tys)>(tys), std::forward<decltype(callee)>(callee), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeRange tys, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(tys)>(tys), std::forward<decltype(callee)>(callee), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(calleeType)>(calleeType), std::forward<decltype(callee)>(callee), std::forward<decltype(ops)>(ops), std::forward<decltype(normal)>(normal), std::forward<decltype(normalOps)>(normalOps), std::forward<decltype(unwind)>(unwind), std::forward<decltype(unwindOps)>(unwindOps));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
odsState.addOperands(callee_operands);
|
|
odsState.addOperands(normalDestOperands);
|
|
odsState.addOperands(unwindDestOperands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), static_cast<int32_t>(normalDestOperands.size()), static_cast<int32_t>(unwindDestOperands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
if (CConv) {
|
|
odsState.getOrAddProperties<Properties>().CConv = CConv;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
odsState.addSuccessors(normalDest);
|
|
odsState.addSuccessors(unwindDest);
|
|
if (result)
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
odsState.addOperands(callee_operands);
|
|
odsState.addOperands(normalDestOperands);
|
|
odsState.addOperands(unwindDestOperands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), static_cast<int32_t>(normalDestOperands.size()), static_cast<int32_t>(unwindDestOperands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
if (CConv) {
|
|
odsState.getOrAddProperties<Properties>().CConv = CConv;
|
|
}
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
odsState.addSuccessors(normalDest);
|
|
odsState.addSuccessors(unwindDest);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::CConvAttr CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
odsState.addOperands(callee_operands);
|
|
odsState.addOperands(normalDestOperands);
|
|
odsState.addOperands(unwindDestOperands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), static_cast<int32_t>(normalDestOperands.size()), static_cast<int32_t>(unwindDestOperands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv);
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
odsState.addSuccessors(normalDest);
|
|
odsState.addSuccessors(unwindDest);
|
|
if (result)
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
odsState.addOperands(callee_operands);
|
|
odsState.addOperands(normalDestOperands);
|
|
odsState.addOperands(unwindDestOperands);
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : op_bundle_operands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().op_bundle_sizes = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(callee_operands.size()), static_cast<int32_t>(normalDestOperands.size()), static_cast<int32_t>(unwindDestOperands.size()), llvm::accumulate(op_bundle_operands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (var_callee_type) {
|
|
odsState.getOrAddProperties<Properties>().var_callee_type = var_callee_type;
|
|
}
|
|
if (callee) {
|
|
odsState.getOrAddProperties<Properties>().callee = callee;
|
|
}
|
|
if (arg_attrs) {
|
|
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
|
|
}
|
|
if (res_attrs) {
|
|
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv);
|
|
if (op_bundle_tags) {
|
|
odsState.getOrAddProperties<Properties>().op_bundle_tags = op_bundle_tags;
|
|
}
|
|
odsState.addSuccessors(normalDest);
|
|
odsState.addSuccessors(unwindDest);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr var_callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::LLVM::cconv::CConv CConv, ::llvm::ArrayRef<::mlir::ValueRange> op_bundle_operands, /*optional*/::mlir::ArrayAttr op_bundle_tags, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var_callee_type)>(var_callee_type), std::forward<decltype(callee)>(callee), std::forward<decltype(callee_operands)>(callee_operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs), std::forward<decltype(normalDestOperands)>(normalDestOperands), std::forward<decltype(unwindDestOperands)>(unwindDestOperands), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(CConv)>(CConv), std::forward<decltype(op_bundle_operands)>(op_bundle_operands), std::forward<decltype(op_bundle_tags)>(op_bundle_tags), std::forward<decltype(normalDest)>(normalDest), std::forward<decltype(unwindDest)>(unwindDest));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<InvokeOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void InvokeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<InvokeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
InvokeOp InvokeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void InvokeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.CConv)
|
|
properties.CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv::C);
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::verifyInvariantsImpl() {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
|
|
auto tblgen_op_bundle_sizes = getProperties().op_bundle_sizes; (void)tblgen_op_bundle_sizes;
|
|
if (!tblgen_op_bundle_sizes) return emitOpError("requires attribute 'op_bundle_sizes'");
|
|
auto tblgen_op_bundle_tags = getProperties().op_bundle_tags; (void)tblgen_op_bundle_tags;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_var_callee_type = getProperties().var_callee_type; (void)tblgen_var_callee_type;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(*this, tblgen_var_callee_type, "var_callee_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_callee, "callee")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_arg_attrs, "arg_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_res_attrs, "res_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_branch_weights, "branch_weights")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(*this, tblgen_CConv, "CConv")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_op_bundle_sizes, "op_bundle_sizes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_op_bundle_tags, "op_bundle_tags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "op_bundle_sizes", "op_bundle_operands", valueGroup3.size())))
|
|
return ::mlir::failure();
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
if (valueGroup0.size() > 1) {
|
|
return emitOpError("result group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup0.size();
|
|
}
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult InvokeOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.var_callee_type;
|
|
auto var_callee_typeAttrName = ::mlir::StringAttr::get(ctx, "var_callee_type");
|
|
auto attr = dict.get(var_callee_typeAttrName);
|
|
usedKeys.insert(var_callee_typeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for var_callee_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `var_callee_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.callee;
|
|
auto calleeAttrName = ::mlir::StringAttr::get(ctx, "callee");
|
|
auto attr = dict.get(calleeAttrName);
|
|
usedKeys.insert(calleeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for callee in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs");
|
|
auto attr = dict.get(arg_attrsAttrName);
|
|
usedKeys.insert(arg_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.res_attrs;
|
|
auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs");
|
|
auto attr = dict.get(res_attrsAttrName);
|
|
usedKeys.insert(res_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.branch_weights;
|
|
auto branch_weightsAttrName = ::mlir::StringAttr::get(ctx, "branch_weights");
|
|
auto attr = dict.get(branch_weightsAttrName);
|
|
usedKeys.insert(branch_weightsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for branch_weights in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.CConv;
|
|
auto CConvAttrName = ::mlir::StringAttr::get(ctx, "CConv");
|
|
auto attr = dict.get(CConvAttrName);
|
|
usedKeys.insert(CConvAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for CConv in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_sizes;
|
|
auto op_bundle_sizesAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_sizes");
|
|
auto attr = dict.get(op_bundle_sizesAttrName);
|
|
usedKeys.insert(op_bundle_sizesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_sizes in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.op_bundle_tags;
|
|
auto op_bundle_tagsAttrName = ::mlir::StringAttr::get(ctx, "op_bundle_tags");
|
|
auto attr = dict.get(op_bundle_tagsAttrName);
|
|
usedKeys.insert(op_bundle_tagsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for op_bundle_tags in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `op_bundle_tags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InvokeOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::InvokeOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::LLVMFuncOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LLVMFuncOpGenericAdaptorBase::LLVMFuncOpGenericAdaptorBase(LLVMFuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef LLVMFuncOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getSymVisibility() {
|
|
auto attr = getSymVisibilityAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::LLVMFunctionType LLVMFuncOpGenericAdaptorBase::getFunctionType() {
|
|
auto attr = getFunctionTypeAttr();
|
|
return ::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue());
|
|
}
|
|
|
|
::mlir::LLVM::LinkageAttr LLVMFuncOpGenericAdaptorBase::getLinkageAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::LinkageAttr>(getProperties().linkage);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::Linkage LLVMFuncOpGenericAdaptorBase::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getDsoLocalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::CConvAttr LLVMFuncOpGenericAdaptorBase::getCConvAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(getProperties().CConv);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv LLVMFuncOpGenericAdaptorBase::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::std::optional< ::mlir::SymbolRefAttr > LLVMFuncOpGenericAdaptorBase::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getConvergentAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().convergent);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getConvergent() {
|
|
auto attr = getConvergentAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getPersonality() {
|
|
auto attr = getPersonalityAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getGarbageCollector() {
|
|
auto attr = getGarbageCollectorAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getPassthrough() {
|
|
auto attr = getPassthroughAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> LLVMFuncOpGenericAdaptorBase::getFunctionEntryCount() {
|
|
auto attr = getFunctionEntryCountAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::MemoryEffectsAttr> LLVMFuncOpGenericAdaptorBase::getMemoryEffects() {
|
|
auto attr = getMemoryEffectsAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::VisibilityAttr LLVMFuncOpGenericAdaptorBase::getVisibility_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::Visibility LLVMFuncOpGenericAdaptorBase::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmStreamingAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_streaming);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmStreaming() {
|
|
auto attr = getArmStreamingAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmLocallyStreamingAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_locally_streaming);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmLocallyStreaming() {
|
|
auto attr = getArmLocallyStreamingAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmStreamingCompatibleAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_streaming_compatible);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmStreamingCompatible() {
|
|
auto attr = getArmStreamingCompatibleAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmNewZaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_new_za);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmNewZa() {
|
|
auto attr = getArmNewZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmInZaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_in_za);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmInZa() {
|
|
auto attr = getArmInZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmOutZaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_out_za);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmOutZa() {
|
|
auto attr = getArmOutZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmInoutZaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_inout_za);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmInoutZa() {
|
|
auto attr = getArmInoutZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmPreservesZaAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_preserves_za);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getArmPreservesZa() {
|
|
auto attr = getArmPreservesZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getSection() {
|
|
auto attr = getSectionAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> LLVMFuncOpGenericAdaptorBase::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> LLVMFuncOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::VScaleRangeAttr> LLVMFuncOpGenericAdaptorBase::getVscaleRange() {
|
|
auto attr = getVscaleRangeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::VScaleRangeAttr>(::llvm::cast<::mlir::LLVM::VScaleRangeAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::FramePointerKindAttr> LLVMFuncOpGenericAdaptorBase::getFramePointer() {
|
|
auto attr = getFramePointerAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::FramePointerKindAttr>(::llvm::cast<::mlir::LLVM::FramePointerKindAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getTargetCpu() {
|
|
auto attr = getTargetCpuAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getTuneCpu() {
|
|
auto attr = getTuneCpuAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getReciprocalEstimates() {
|
|
auto attr = getReciprocalEstimatesAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getPreferVectorWidth() {
|
|
auto attr = getPreferVectorWidthAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::TargetFeaturesAttr> LLVMFuncOpGenericAdaptorBase::getTargetFeatures() {
|
|
auto attr = getTargetFeaturesAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::TargetFeaturesAttr>(::llvm::cast<::mlir::LLVM::TargetFeaturesAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< bool > LLVMFuncOpGenericAdaptorBase::getNoSignedZerosFpMath() {
|
|
auto attr = getNoSignedZerosFpMathAttr();
|
|
return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::DenormalFPEnvAttr> LLVMFuncOpGenericAdaptorBase::getDenormalFpenv() {
|
|
auto attr = getDenormalFpenvAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DenormalFPEnvAttr>(::llvm::cast<::mlir::LLVM::DenormalFPEnvAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getFpContract() {
|
|
auto attr = getFpContractAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getInstrumentFunctionEntry() {
|
|
auto attr = getInstrumentFunctionEntryAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getInstrumentFunctionExit() {
|
|
auto attr = getInstrumentFunctionExitAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNoInlineAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_inline);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNoInline() {
|
|
auto attr = getNoInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getAlwaysInlineAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().always_inline);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getAlwaysInline() {
|
|
auto attr = getAlwaysInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getInlineHintAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inline_hint);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getInlineHint() {
|
|
auto attr = getInlineHintAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNoUnwindAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_unwind);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNoUnwind() {
|
|
auto attr = getNoUnwindAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getWillReturnAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().will_return);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getWillReturn() {
|
|
auto attr = getWillReturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNoreturnAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().noreturn);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNoreturn() {
|
|
auto attr = getNoreturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getOptimizeNoneAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().optimize_none);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getOptimizeNone() {
|
|
auto attr = getOptimizeNoneAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getReturnsTwiceAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().returns_twice);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getReturnsTwice() {
|
|
auto attr = getReturnsTwiceAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getHotAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hot);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getHot() {
|
|
auto attr = getHotAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getColdAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().cold);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getCold() {
|
|
auto attr = getColdAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNoduplicateAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().noduplicate);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNoduplicate() {
|
|
auto attr = getNoduplicateAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNoCallerSavedRegistersAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().no_caller_saved_registers);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNoCallerSavedRegisters() {
|
|
auto attr = getNoCallerSavedRegistersAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getNocallbackAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nocallback);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LLVMFuncOpGenericAdaptorBase::getNocallback() {
|
|
auto attr = getNocallbackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getModularFormat() {
|
|
auto attr = getModularFormatAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getNobuiltins() {
|
|
auto attr = getNobuiltinsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOpGenericAdaptorBase::getAllocsize() {
|
|
auto attr = getAllocsizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOpGenericAdaptorBase::getOptsize() {
|
|
auto attr = getOptsizeAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOpGenericAdaptorBase::getMinsize() {
|
|
auto attr = getMinsizeAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOpGenericAdaptorBase::getSaveRegParams() {
|
|
auto attr = getSaveRegParamsAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getZeroCallUsedRegs() {
|
|
auto attr = getZeroCallUsedRegsAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::DictionaryAttr > LLVMFuncOpGenericAdaptorBase::getDefaultFuncAttrs() {
|
|
auto attr = getDefaultFuncAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::DictionaryAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::VecTypeHintAttr> LLVMFuncOpGenericAdaptorBase::getVecTypeHint() {
|
|
auto attr = getVecTypeHintAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::VecTypeHintAttr>(::llvm::cast<::mlir::LLVM::VecTypeHintAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOpGenericAdaptorBase::getWorkGroupSizeHint() {
|
|
auto attr = getWorkGroupSizeHintAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOpGenericAdaptorBase::getReqdWorkGroupSize() {
|
|
auto attr = getReqdWorkGroupSizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> LLVMFuncOpGenericAdaptorBase::getIntelReqdSubGroupSize() {
|
|
auto attr = getIntelReqdSubGroupSizeAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UWTableKindAttr> LLVMFuncOpGenericAdaptorBase::getUwtableKind() {
|
|
auto attr = getUwtableKindAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UWTableKindAttr>(::llvm::cast<::mlir::LLVM::UWTableKindAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< bool > LLVMFuncOpGenericAdaptorBase::getUseSampleProfile() {
|
|
auto attr = getUseSampleProfileAttr();
|
|
return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
LLVMFuncOpAdaptor::LLVMFuncOpAdaptor(LLVMFuncOp op) : LLVMFuncOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LLVMFuncOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_allocsize = getProperties().allocsize; (void)tblgen_allocsize;
|
|
auto tblgen_always_inline = getProperties().always_inline; (void)tblgen_always_inline;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_arm_in_za = getProperties().arm_in_za; (void)tblgen_arm_in_za;
|
|
auto tblgen_arm_inout_za = getProperties().arm_inout_za; (void)tblgen_arm_inout_za;
|
|
auto tblgen_arm_locally_streaming = getProperties().arm_locally_streaming; (void)tblgen_arm_locally_streaming;
|
|
auto tblgen_arm_new_za = getProperties().arm_new_za; (void)tblgen_arm_new_za;
|
|
auto tblgen_arm_out_za = getProperties().arm_out_za; (void)tblgen_arm_out_za;
|
|
auto tblgen_arm_preserves_za = getProperties().arm_preserves_za; (void)tblgen_arm_preserves_za;
|
|
auto tblgen_arm_streaming = getProperties().arm_streaming; (void)tblgen_arm_streaming;
|
|
auto tblgen_arm_streaming_compatible = getProperties().arm_streaming_compatible; (void)tblgen_arm_streaming_compatible;
|
|
auto tblgen_cold = getProperties().cold; (void)tblgen_cold;
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
auto tblgen_convergent = getProperties().convergent; (void)tblgen_convergent;
|
|
auto tblgen_default_func_attrs = getProperties().default_func_attrs; (void)tblgen_default_func_attrs;
|
|
auto tblgen_denormal_fpenv = getProperties().denormal_fpenv; (void)tblgen_denormal_fpenv;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_fp_contract = getProperties().fp_contract; (void)tblgen_fp_contract;
|
|
auto tblgen_frame_pointer = getProperties().frame_pointer; (void)tblgen_frame_pointer;
|
|
auto tblgen_function_entry_count = getProperties().function_entry_count; (void)tblgen_function_entry_count;
|
|
auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
|
|
if (!tblgen_function_type) return emitError(loc, "'llvm.func' op requires attribute 'function_type'");
|
|
auto tblgen_garbageCollector = getProperties().garbageCollector; (void)tblgen_garbageCollector;
|
|
auto tblgen_hot = getProperties().hot; (void)tblgen_hot;
|
|
auto tblgen_inline_hint = getProperties().inline_hint; (void)tblgen_inline_hint;
|
|
auto tblgen_instrument_function_entry = getProperties().instrument_function_entry; (void)tblgen_instrument_function_entry;
|
|
auto tblgen_instrument_function_exit = getProperties().instrument_function_exit; (void)tblgen_instrument_function_exit;
|
|
auto tblgen_intel_reqd_sub_group_size = getProperties().intel_reqd_sub_group_size; (void)tblgen_intel_reqd_sub_group_size;
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
auto tblgen_memory_effects = getProperties().memory_effects; (void)tblgen_memory_effects;
|
|
auto tblgen_minsize = getProperties().minsize; (void)tblgen_minsize;
|
|
auto tblgen_modular_format = getProperties().modular_format; (void)tblgen_modular_format;
|
|
auto tblgen_no_caller_saved_registers = getProperties().no_caller_saved_registers; (void)tblgen_no_caller_saved_registers;
|
|
auto tblgen_no_inline = getProperties().no_inline; (void)tblgen_no_inline;
|
|
auto tblgen_no_signed_zeros_fp_math = getProperties().no_signed_zeros_fp_math; (void)tblgen_no_signed_zeros_fp_math;
|
|
auto tblgen_no_unwind = getProperties().no_unwind; (void)tblgen_no_unwind;
|
|
auto tblgen_nobuiltins = getProperties().nobuiltins; (void)tblgen_nobuiltins;
|
|
auto tblgen_nocallback = getProperties().nocallback; (void)tblgen_nocallback;
|
|
auto tblgen_noduplicate = getProperties().noduplicate; (void)tblgen_noduplicate;
|
|
auto tblgen_noreturn = getProperties().noreturn; (void)tblgen_noreturn;
|
|
auto tblgen_optimize_none = getProperties().optimize_none; (void)tblgen_optimize_none;
|
|
auto tblgen_optsize = getProperties().optsize; (void)tblgen_optsize;
|
|
auto tblgen_passthrough = getProperties().passthrough; (void)tblgen_passthrough;
|
|
auto tblgen_personality = getProperties().personality; (void)tblgen_personality;
|
|
auto tblgen_prefer_vector_width = getProperties().prefer_vector_width; (void)tblgen_prefer_vector_width;
|
|
auto tblgen_reciprocal_estimates = getProperties().reciprocal_estimates; (void)tblgen_reciprocal_estimates;
|
|
auto tblgen_reqd_work_group_size = getProperties().reqd_work_group_size; (void)tblgen_reqd_work_group_size;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_returns_twice = getProperties().returns_twice; (void)tblgen_returns_twice;
|
|
auto tblgen_save_reg_params = getProperties().save_reg_params; (void)tblgen_save_reg_params;
|
|
auto tblgen_section = getProperties().section; (void)tblgen_section;
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'llvm.func' op requires attribute 'sym_name'");
|
|
auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility;
|
|
auto tblgen_target_cpu = getProperties().target_cpu; (void)tblgen_target_cpu;
|
|
auto tblgen_target_features = getProperties().target_features; (void)tblgen_target_features;
|
|
auto tblgen_tune_cpu = getProperties().tune_cpu; (void)tblgen_tune_cpu;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_use_sample_profile = getProperties().use_sample_profile; (void)tblgen_use_sample_profile;
|
|
auto tblgen_uwtable_kind = getProperties().uwtable_kind; (void)tblgen_uwtable_kind;
|
|
auto tblgen_vec_type_hint = getProperties().vec_type_hint; (void)tblgen_vec_type_hint;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
auto tblgen_vscale_range = getProperties().vscale_range; (void)tblgen_vscale_range;
|
|
auto tblgen_will_return = getProperties().will_return; (void)tblgen_will_return;
|
|
auto tblgen_work_group_size_hint = getProperties().work_group_size_hint; (void)tblgen_work_group_size_hint;
|
|
auto tblgen_zero_call_used_regs = getProperties().zero_call_used_regs; (void)tblgen_zero_call_used_regs;
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'llvm.func' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility))))
|
|
return emitError(loc, "'llvm.func' op attribute 'sym_visibility' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue())))))
|
|
return emitError(loc, "'llvm.func' op attribute 'function_type' failed to satisfy constraint: type attribute of LLVM function type");
|
|
|
|
if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage))))
|
|
return emitError(loc, "'llvm.func' op attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification");
|
|
|
|
if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local))))
|
|
return emitError(loc, "'llvm.func' op attribute 'dso_local' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_CConv && !((::llvm::isa<::mlir::LLVM::CConvAttr>(tblgen_CConv))))
|
|
return emitError(loc, "'llvm.func' op attribute 'CConv' failed to satisfy constraint: LLVM Calling Convention specification");
|
|
|
|
if (tblgen_comdat && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_comdat))))
|
|
return emitError(loc, "'llvm.func' op attribute 'comdat' failed to satisfy constraint: symbol reference attribute");
|
|
|
|
if (tblgen_convergent && !((::llvm::isa<::mlir::UnitAttr>(tblgen_convergent))))
|
|
return emitError(loc, "'llvm.func' op attribute 'convergent' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_personality && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_personality))))
|
|
return emitError(loc, "'llvm.func' op attribute 'personality' failed to satisfy constraint: flat symbol reference attribute");
|
|
|
|
if (tblgen_garbageCollector && !((::llvm::isa<::mlir::StringAttr>(tblgen_garbageCollector))))
|
|
return emitError(loc, "'llvm.func' op attribute 'garbageCollector' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_passthrough && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_passthrough))))
|
|
return emitError(loc, "'llvm.func' op attribute 'passthrough' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.func' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
|
|
|
|
if (tblgen_function_entry_count && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_function_entry_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_function_entry_count).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.func' op attribute 'function_entry_count' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_memory_effects && !((::llvm::isa<::mlir::LLVM::MemoryEffectsAttr>(tblgen_memory_effects))))
|
|
return emitError(loc, "'llvm.func' op attribute 'memory_effects' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_))))
|
|
return emitError(loc, "'llvm.func' op attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility");
|
|
|
|
if (tblgen_arm_streaming && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_streaming))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_streaming' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_locally_streaming && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_locally_streaming))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_locally_streaming' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_streaming_compatible && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_streaming_compatible))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_streaming_compatible' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_new_za && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_new_za))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_new_za' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_in_za && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_in_za))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_in_za' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_out_za && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_out_za))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_out_za' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_inout_za && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_inout_za))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_inout_za' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_arm_preserves_za && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_preserves_za))))
|
|
return emitError(loc, "'llvm.func' op attribute 'arm_preserves_za' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_section && !((::llvm::isa<::mlir::StringAttr>(tblgen_section))))
|
|
return emitError(loc, "'llvm.func' op attribute 'section' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr))))
|
|
return emitError(loc, "'llvm.func' op attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr");
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.func' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_vscale_range && !((::llvm::isa<::mlir::LLVM::VScaleRangeAttr>(tblgen_vscale_range))))
|
|
return emitError(loc, "'llvm.func' op attribute 'vscale_range' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_frame_pointer && !((::llvm::isa<::mlir::LLVM::FramePointerKindAttr>(tblgen_frame_pointer))))
|
|
return emitError(loc, "'llvm.func' op attribute 'frame_pointer' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_target_cpu && !((::llvm::isa<::mlir::StringAttr>(tblgen_target_cpu))))
|
|
return emitError(loc, "'llvm.func' op attribute 'target_cpu' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_tune_cpu && !((::llvm::isa<::mlir::StringAttr>(tblgen_tune_cpu))))
|
|
return emitError(loc, "'llvm.func' op attribute 'tune_cpu' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_reciprocal_estimates && !((::llvm::isa<::mlir::StringAttr>(tblgen_reciprocal_estimates))))
|
|
return emitError(loc, "'llvm.func' op attribute 'reciprocal_estimates' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_prefer_vector_width && !((::llvm::isa<::mlir::StringAttr>(tblgen_prefer_vector_width))))
|
|
return emitError(loc, "'llvm.func' op attribute 'prefer_vector_width' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_target_features && !((::llvm::isa<::mlir::LLVM::TargetFeaturesAttr>(tblgen_target_features))))
|
|
return emitError(loc, "'llvm.func' op attribute 'target_features' failed to satisfy constraint: LLVM target features attribute");
|
|
|
|
if (tblgen_no_signed_zeros_fp_math && !((::llvm::isa<::mlir::BoolAttr>(tblgen_no_signed_zeros_fp_math))))
|
|
return emitError(loc, "'llvm.func' op attribute 'no_signed_zeros_fp_math' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_denormal_fpenv && !((::llvm::isa<::mlir::LLVM::DenormalFPEnvAttr>(tblgen_denormal_fpenv))))
|
|
return emitError(loc, "'llvm.func' op attribute 'denormal_fpenv' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_fp_contract && !((::llvm::isa<::mlir::StringAttr>(tblgen_fp_contract))))
|
|
return emitError(loc, "'llvm.func' op attribute 'fp_contract' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_instrument_function_entry && !((::llvm::isa<::mlir::StringAttr>(tblgen_instrument_function_entry))))
|
|
return emitError(loc, "'llvm.func' op attribute 'instrument_function_entry' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_instrument_function_exit && !((::llvm::isa<::mlir::StringAttr>(tblgen_instrument_function_exit))))
|
|
return emitError(loc, "'llvm.func' op attribute 'instrument_function_exit' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_no_inline && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_inline))))
|
|
return emitError(loc, "'llvm.func' op attribute 'no_inline' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_always_inline && !((::llvm::isa<::mlir::UnitAttr>(tblgen_always_inline))))
|
|
return emitError(loc, "'llvm.func' op attribute 'always_inline' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_inline_hint && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inline_hint))))
|
|
return emitError(loc, "'llvm.func' op attribute 'inline_hint' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_no_unwind && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_unwind))))
|
|
return emitError(loc, "'llvm.func' op attribute 'no_unwind' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_will_return && !((::llvm::isa<::mlir::UnitAttr>(tblgen_will_return))))
|
|
return emitError(loc, "'llvm.func' op attribute 'will_return' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_noreturn && !((::llvm::isa<::mlir::UnitAttr>(tblgen_noreturn))))
|
|
return emitError(loc, "'llvm.func' op attribute 'noreturn' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_optimize_none && !((::llvm::isa<::mlir::UnitAttr>(tblgen_optimize_none))))
|
|
return emitError(loc, "'llvm.func' op attribute 'optimize_none' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_returns_twice && !((::llvm::isa<::mlir::UnitAttr>(tblgen_returns_twice))))
|
|
return emitError(loc, "'llvm.func' op attribute 'returns_twice' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_hot && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hot))))
|
|
return emitError(loc, "'llvm.func' op attribute 'hot' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_cold && !((::llvm::isa<::mlir::UnitAttr>(tblgen_cold))))
|
|
return emitError(loc, "'llvm.func' op attribute 'cold' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_noduplicate && !((::llvm::isa<::mlir::UnitAttr>(tblgen_noduplicate))))
|
|
return emitError(loc, "'llvm.func' op attribute 'noduplicate' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_no_caller_saved_registers && !((::llvm::isa<::mlir::UnitAttr>(tblgen_no_caller_saved_registers))))
|
|
return emitError(loc, "'llvm.func' op attribute 'no_caller_saved_registers' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_nocallback && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nocallback))))
|
|
return emitError(loc, "'llvm.func' op attribute 'nocallback' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_modular_format && !((::llvm::isa<::mlir::StringAttr>(tblgen_modular_format))))
|
|
return emitError(loc, "'llvm.func' op attribute 'modular_format' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_nobuiltins && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_nobuiltins))))
|
|
return emitError(loc, "'llvm.func' op attribute 'nobuiltins' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_allocsize && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_allocsize))))
|
|
return emitError(loc, "'llvm.func' op attribute 'allocsize' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_optsize && !((::llvm::isa<::mlir::UnitAttr>(tblgen_optsize))))
|
|
return emitError(loc, "'llvm.func' op attribute 'optsize' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_minsize && !((::llvm::isa<::mlir::UnitAttr>(tblgen_minsize))))
|
|
return emitError(loc, "'llvm.func' op attribute 'minsize' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_save_reg_params && !((::llvm::isa<::mlir::UnitAttr>(tblgen_save_reg_params))))
|
|
return emitError(loc, "'llvm.func' op attribute 'save_reg_params' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_zero_call_used_regs && !((::llvm::isa<::mlir::StringAttr>(tblgen_zero_call_used_regs))))
|
|
return emitError(loc, "'llvm.func' op attribute 'zero_call_used_regs' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_default_func_attrs && !((::llvm::isa<::mlir::DictionaryAttr>(tblgen_default_func_attrs))))
|
|
return emitError(loc, "'llvm.func' op attribute 'default_func_attrs' failed to satisfy constraint: dictionary of named attribute values");
|
|
|
|
if (tblgen_vec_type_hint && !((::llvm::isa<::mlir::LLVM::VecTypeHintAttr>(tblgen_vec_type_hint))))
|
|
return emitError(loc, "'llvm.func' op attribute 'vec_type_hint' failed to satisfy constraint: Explicit vectorization compiler hint");
|
|
|
|
if (tblgen_work_group_size_hint && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_work_group_size_hint))))
|
|
return emitError(loc, "'llvm.func' op attribute 'work_group_size_hint' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_reqd_work_group_size && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_reqd_work_group_size))))
|
|
return emitError(loc, "'llvm.func' op attribute 'reqd_work_group_size' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_intel_reqd_sub_group_size && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_intel_reqd_sub_group_size))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_intel_reqd_sub_group_size).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'llvm.func' op attribute 'intel_reqd_sub_group_size' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_uwtable_kind && !((::llvm::isa<::mlir::LLVM::UWTableKindAttr>(tblgen_uwtable_kind))))
|
|
return emitError(loc, "'llvm.func' op attribute 'uwtable_kind' failed to satisfy constraint: ");
|
|
|
|
if (tblgen_use_sample_profile && !((::llvm::isa<::mlir::BoolAttr>(tblgen_use_sample_profile))))
|
|
return emitError(loc, "'llvm.func' op attribute 'use_sample_profile' failed to satisfy constraint: bool attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.CConv;
|
|
auto attr = dict.get("CConv");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.allocsize;
|
|
auto attr = dict.get("allocsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `allocsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.always_inline;
|
|
auto attr = dict.get("always_inline");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `always_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto attr = dict.get("arg_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_in_za;
|
|
auto attr = dict.get("arm_in_za");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_in_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_inout_za;
|
|
auto attr = dict.get("arm_inout_za");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_inout_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_locally_streaming;
|
|
auto attr = dict.get("arm_locally_streaming");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_locally_streaming` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_new_za;
|
|
auto attr = dict.get("arm_new_za");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_new_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_out_za;
|
|
auto attr = dict.get("arm_out_za");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_out_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_preserves_za;
|
|
auto attr = dict.get("arm_preserves_za");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_preserves_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_streaming;
|
|
auto attr = dict.get("arm_streaming");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_streaming` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.arm_streaming_compatible;
|
|
auto attr = dict.get("arm_streaming_compatible");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_streaming_compatible` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cold;
|
|
auto attr = dict.get("cold");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cold` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.comdat;
|
|
auto attr = dict.get("comdat");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `comdat` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.convergent;
|
|
auto attr = dict.get("convergent");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `convergent` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.default_func_attrs;
|
|
auto attr = dict.get("default_func_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `default_func_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.denormal_fpenv;
|
|
auto attr = dict.get("denormal_fpenv");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `denormal_fpenv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dso_local;
|
|
auto attr = dict.get("dso_local");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fp_contract;
|
|
auto attr = dict.get("fp_contract");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fp_contract` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.frame_pointer;
|
|
auto attr = dict.get("frame_pointer");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `frame_pointer` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.function_entry_count;
|
|
auto attr = dict.get("function_entry_count");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `function_entry_count` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.function_type;
|
|
auto attr = dict.get("function_type");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `function_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.garbageCollector;
|
|
auto attr = dict.get("garbageCollector");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `garbageCollector` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.hot;
|
|
auto attr = dict.get("hot");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `hot` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.inline_hint;
|
|
auto attr = dict.get("inline_hint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inline_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.instrument_function_entry;
|
|
auto attr = dict.get("instrument_function_entry");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `instrument_function_entry` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.instrument_function_exit;
|
|
auto attr = dict.get("instrument_function_exit");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `instrument_function_exit` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.intel_reqd_sub_group_size;
|
|
auto attr = dict.get("intel_reqd_sub_group_size");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `intel_reqd_sub_group_size` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.linkage;
|
|
auto attr = dict.get("linkage");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.memory_effects;
|
|
auto attr = dict.get("memory_effects");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `memory_effects` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.minsize;
|
|
auto attr = dict.get("minsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `minsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.modular_format;
|
|
auto attr = dict.get("modular_format");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `modular_format` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_caller_saved_registers;
|
|
auto attr = dict.get("no_caller_saved_registers");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_caller_saved_registers` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_inline;
|
|
auto attr = dict.get("no_inline");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_signed_zeros_fp_math;
|
|
auto attr = dict.get("no_signed_zeros_fp_math");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_signed_zeros_fp_math` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.no_unwind;
|
|
auto attr = dict.get("no_unwind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_unwind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nobuiltins;
|
|
auto attr = dict.get("nobuiltins");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltins` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nocallback;
|
|
auto attr = dict.get("nocallback");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nocallback` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noduplicate;
|
|
auto attr = dict.get("noduplicate");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noduplicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noreturn;
|
|
auto attr = dict.get("noreturn");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noreturn` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.optimize_none;
|
|
auto attr = dict.get("optimize_none");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optimize_none` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.optsize;
|
|
auto attr = dict.get("optsize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.passthrough;
|
|
auto attr = dict.get("passthrough");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `passthrough` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.personality;
|
|
auto attr = dict.get("personality");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `personality` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.prefer_vector_width;
|
|
auto attr = dict.get("prefer_vector_width");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `prefer_vector_width` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.reciprocal_estimates;
|
|
auto attr = dict.get("reciprocal_estimates");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reciprocal_estimates` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.reqd_work_group_size;
|
|
auto attr = dict.get("reqd_work_group_size");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reqd_work_group_size` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.res_attrs;
|
|
auto attr = dict.get("res_attrs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.returns_twice;
|
|
auto attr = dict.get("returns_twice");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `returns_twice` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.save_reg_params;
|
|
auto attr = dict.get("save_reg_params");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `save_reg_params` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.section;
|
|
auto attr = dict.get("section");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `section` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_name;
|
|
auto attr = dict.get("sym_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.sym_visibility;
|
|
auto attr = dict.get("sym_visibility");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.target_cpu;
|
|
auto attr = dict.get("target_cpu");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_cpu` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.target_features;
|
|
auto attr = dict.get("target_features");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_features` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tune_cpu;
|
|
auto attr = dict.get("tune_cpu");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tune_cpu` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto attr = dict.get("unnamed_addr");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.use_sample_profile;
|
|
auto attr = dict.get("use_sample_profile");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `use_sample_profile` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.uwtable_kind;
|
|
auto attr = dict.get("uwtable_kind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `uwtable_kind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.vec_type_hint;
|
|
auto attr = dict.get("vec_type_hint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `vec_type_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.visibility_;
|
|
auto attr = dict.get("visibility_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.vscale_range;
|
|
auto attr = dict.get("vscale_range");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `vscale_range` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.will_return;
|
|
auto attr = dict.get("will_return");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `will_return` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.work_group_size_hint;
|
|
auto attr = dict.get("work_group_size_hint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `work_group_size_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.zero_call_used_regs;
|
|
auto attr = dict.get("zero_call_used_regs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `zero_call_used_regs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LLVMFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.CConv;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("CConv",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.allocsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("allocsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.always_inline;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("always_inline",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arg_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_in_za;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_in_za",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_inout_za;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_inout_za",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_locally_streaming;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_locally_streaming",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_new_za;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_new_za",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_out_za;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_out_za",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_preserves_za;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_preserves_za",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_streaming;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_streaming",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.arm_streaming_compatible;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("arm_streaming_compatible",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.cold;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cold",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.comdat;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("comdat",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.convergent;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("convergent",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.default_func_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("default_func_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.denormal_fpenv;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("denormal_fpenv",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dso_local;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dso_local",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fp_contract;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fp_contract",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.frame_pointer;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("frame_pointer",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.function_entry_count;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("function_entry_count",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.function_type;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("function_type",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.garbageCollector;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("garbageCollector",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.hot;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("hot",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.inline_hint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("inline_hint",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.instrument_function_entry;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("instrument_function_entry",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.instrument_function_exit;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("instrument_function_exit",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.intel_reqd_sub_group_size;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("intel_reqd_sub_group_size",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.linkage;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("linkage",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.memory_effects;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("memory_effects",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.minsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("minsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.modular_format;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("modular_format",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_caller_saved_registers;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_caller_saved_registers",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_inline;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_inline",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_signed_zeros_fp_math;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_signed_zeros_fp_math",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.no_unwind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("no_unwind",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nobuiltins;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nobuiltins",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nocallback;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nocallback",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noduplicate;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noduplicate",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noreturn;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noreturn",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.optimize_none;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("optimize_none",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.optsize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("optsize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.passthrough;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("passthrough",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.personality;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("personality",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.prefer_vector_width;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("prefer_vector_width",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.reciprocal_estimates;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("reciprocal_estimates",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.reqd_work_group_size;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("reqd_work_group_size",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.res_attrs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.returns_twice;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("returns_twice",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.save_reg_params;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("save_reg_params",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.section;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("section",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.sym_visibility;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("sym_visibility",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.target_cpu;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("target_cpu",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.target_features;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("target_features",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tune_cpu;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tune_cpu",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unnamed_addr;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.use_sample_profile;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("use_sample_profile",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.uwtable_kind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("uwtable_kind",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.vec_type_hint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("vec_type_hint",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.visibility_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("visibility_",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.vscale_range;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("vscale_range",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.will_return;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("will_return",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.work_group_size_hint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("work_group_size_hint",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.zero_call_used_regs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("zero_call_used_regs",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LLVMFuncOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.CConv.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.allocsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.always_inline.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_in_za.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_inout_za.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_locally_streaming.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_new_za.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_out_za.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_preserves_za.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_streaming.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.arm_streaming_compatible.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.cold.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.comdat.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.convergent.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.default_func_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.denormal_fpenv.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dso_local.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fp_contract.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.frame_pointer.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.function_entry_count.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.function_type.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.garbageCollector.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.hot.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.inline_hint.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.instrument_function_entry.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.instrument_function_exit.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.intel_reqd_sub_group_size.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.linkage.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.memory_effects.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.minsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.modular_format.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_caller_saved_registers.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_inline.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_signed_zeros_fp_math.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.no_unwind.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nobuiltins.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nocallback.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noduplicate.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noreturn.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.optimize_none.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.optsize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.passthrough.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.personality.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.prefer_vector_width.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.reciprocal_estimates.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.reqd_work_group_size.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.returns_twice.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.save_reg_params.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.section.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_visibility.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.target_cpu.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.target_features.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tune_cpu.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.use_sample_profile.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.uwtable_kind.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.vec_type_hint.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.visibility_.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.vscale_range.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.will_return.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.work_group_size_hint.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.zero_call_used_regs.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LLVMFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "CConv")
|
|
return prop.CConv;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "allocsize")
|
|
return prop.allocsize;
|
|
|
|
if (name == "always_inline")
|
|
return prop.always_inline;
|
|
|
|
if (name == "arg_attrs")
|
|
return prop.arg_attrs;
|
|
|
|
if (name == "arm_in_za")
|
|
return prop.arm_in_za;
|
|
|
|
if (name == "arm_inout_za")
|
|
return prop.arm_inout_za;
|
|
|
|
if (name == "arm_locally_streaming")
|
|
return prop.arm_locally_streaming;
|
|
|
|
if (name == "arm_new_za")
|
|
return prop.arm_new_za;
|
|
|
|
if (name == "arm_out_za")
|
|
return prop.arm_out_za;
|
|
|
|
if (name == "arm_preserves_za")
|
|
return prop.arm_preserves_za;
|
|
|
|
if (name == "arm_streaming")
|
|
return prop.arm_streaming;
|
|
|
|
if (name == "arm_streaming_compatible")
|
|
return prop.arm_streaming_compatible;
|
|
|
|
if (name == "cold")
|
|
return prop.cold;
|
|
|
|
if (name == "comdat")
|
|
return prop.comdat;
|
|
|
|
if (name == "convergent")
|
|
return prop.convergent;
|
|
|
|
if (name == "default_func_attrs")
|
|
return prop.default_func_attrs;
|
|
|
|
if (name == "denormal_fpenv")
|
|
return prop.denormal_fpenv;
|
|
|
|
if (name == "dso_local")
|
|
return prop.dso_local;
|
|
|
|
if (name == "fp_contract")
|
|
return prop.fp_contract;
|
|
|
|
if (name == "frame_pointer")
|
|
return prop.frame_pointer;
|
|
|
|
if (name == "function_entry_count")
|
|
return prop.function_entry_count;
|
|
|
|
if (name == "function_type")
|
|
return prop.function_type;
|
|
|
|
if (name == "garbageCollector")
|
|
return prop.garbageCollector;
|
|
|
|
if (name == "hot")
|
|
return prop.hot;
|
|
|
|
if (name == "inline_hint")
|
|
return prop.inline_hint;
|
|
|
|
if (name == "instrument_function_entry")
|
|
return prop.instrument_function_entry;
|
|
|
|
if (name == "instrument_function_exit")
|
|
return prop.instrument_function_exit;
|
|
|
|
if (name == "intel_reqd_sub_group_size")
|
|
return prop.intel_reqd_sub_group_size;
|
|
|
|
if (name == "linkage")
|
|
return prop.linkage;
|
|
|
|
if (name == "memory_effects")
|
|
return prop.memory_effects;
|
|
|
|
if (name == "minsize")
|
|
return prop.minsize;
|
|
|
|
if (name == "modular_format")
|
|
return prop.modular_format;
|
|
|
|
if (name == "no_caller_saved_registers")
|
|
return prop.no_caller_saved_registers;
|
|
|
|
if (name == "no_inline")
|
|
return prop.no_inline;
|
|
|
|
if (name == "no_signed_zeros_fp_math")
|
|
return prop.no_signed_zeros_fp_math;
|
|
|
|
if (name == "no_unwind")
|
|
return prop.no_unwind;
|
|
|
|
if (name == "nobuiltins")
|
|
return prop.nobuiltins;
|
|
|
|
if (name == "nocallback")
|
|
return prop.nocallback;
|
|
|
|
if (name == "noduplicate")
|
|
return prop.noduplicate;
|
|
|
|
if (name == "noreturn")
|
|
return prop.noreturn;
|
|
|
|
if (name == "optimize_none")
|
|
return prop.optimize_none;
|
|
|
|
if (name == "optsize")
|
|
return prop.optsize;
|
|
|
|
if (name == "passthrough")
|
|
return prop.passthrough;
|
|
|
|
if (name == "personality")
|
|
return prop.personality;
|
|
|
|
if (name == "prefer_vector_width")
|
|
return prop.prefer_vector_width;
|
|
|
|
if (name == "reciprocal_estimates")
|
|
return prop.reciprocal_estimates;
|
|
|
|
if (name == "reqd_work_group_size")
|
|
return prop.reqd_work_group_size;
|
|
|
|
if (name == "res_attrs")
|
|
return prop.res_attrs;
|
|
|
|
if (name == "returns_twice")
|
|
return prop.returns_twice;
|
|
|
|
if (name == "save_reg_params")
|
|
return prop.save_reg_params;
|
|
|
|
if (name == "section")
|
|
return prop.section;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
|
|
if (name == "sym_visibility")
|
|
return prop.sym_visibility;
|
|
|
|
if (name == "target_cpu")
|
|
return prop.target_cpu;
|
|
|
|
if (name == "target_features")
|
|
return prop.target_features;
|
|
|
|
if (name == "tune_cpu")
|
|
return prop.tune_cpu;
|
|
|
|
if (name == "unnamed_addr")
|
|
return prop.unnamed_addr;
|
|
|
|
if (name == "use_sample_profile")
|
|
return prop.use_sample_profile;
|
|
|
|
if (name == "uwtable_kind")
|
|
return prop.uwtable_kind;
|
|
|
|
if (name == "vec_type_hint")
|
|
return prop.vec_type_hint;
|
|
|
|
if (name == "visibility_")
|
|
return prop.visibility_;
|
|
|
|
if (name == "vscale_range")
|
|
return prop.vscale_range;
|
|
|
|
if (name == "will_return")
|
|
return prop.will_return;
|
|
|
|
if (name == "work_group_size_hint")
|
|
return prop.work_group_size_hint;
|
|
|
|
if (name == "zero_call_used_regs")
|
|
return prop.zero_call_used_regs;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LLVMFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "CConv") {
|
|
prop.CConv = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.CConv)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "allocsize") {
|
|
prop.allocsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.allocsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "always_inline") {
|
|
prop.always_inline = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.always_inline)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arg_attrs") {
|
|
prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_in_za") {
|
|
prop.arm_in_za = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_in_za)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_inout_za") {
|
|
prop.arm_inout_za = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_inout_za)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_locally_streaming") {
|
|
prop.arm_locally_streaming = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_locally_streaming)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_new_za") {
|
|
prop.arm_new_za = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_new_za)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_out_za") {
|
|
prop.arm_out_za = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_out_za)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_preserves_za") {
|
|
prop.arm_preserves_za = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_preserves_za)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_streaming") {
|
|
prop.arm_streaming = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_streaming)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "arm_streaming_compatible") {
|
|
prop.arm_streaming_compatible = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arm_streaming_compatible)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "cold") {
|
|
prop.cold = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cold)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "comdat") {
|
|
prop.comdat = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.comdat)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "convergent") {
|
|
prop.convergent = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.convergent)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "default_func_attrs") {
|
|
prop.default_func_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.default_func_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "denormal_fpenv") {
|
|
prop.denormal_fpenv = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.denormal_fpenv)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dso_local") {
|
|
prop.dso_local = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dso_local)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fp_contract") {
|
|
prop.fp_contract = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fp_contract)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "frame_pointer") {
|
|
prop.frame_pointer = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.frame_pointer)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "function_entry_count") {
|
|
prop.function_entry_count = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_entry_count)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "function_type") {
|
|
prop.function_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_type)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "garbageCollector") {
|
|
prop.garbageCollector = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.garbageCollector)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "hot") {
|
|
prop.hot = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.hot)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "inline_hint") {
|
|
prop.inline_hint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.inline_hint)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "instrument_function_entry") {
|
|
prop.instrument_function_entry = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.instrument_function_entry)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "instrument_function_exit") {
|
|
prop.instrument_function_exit = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.instrument_function_exit)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "intel_reqd_sub_group_size") {
|
|
prop.intel_reqd_sub_group_size = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.intel_reqd_sub_group_size)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "linkage") {
|
|
prop.linkage = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.linkage)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "memory_effects") {
|
|
prop.memory_effects = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.memory_effects)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "minsize") {
|
|
prop.minsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.minsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "modular_format") {
|
|
prop.modular_format = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.modular_format)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_caller_saved_registers") {
|
|
prop.no_caller_saved_registers = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_caller_saved_registers)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_inline") {
|
|
prop.no_inline = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_inline)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_signed_zeros_fp_math") {
|
|
prop.no_signed_zeros_fp_math = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_signed_zeros_fp_math)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "no_unwind") {
|
|
prop.no_unwind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.no_unwind)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nobuiltins") {
|
|
prop.nobuiltins = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nobuiltins)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nocallback") {
|
|
prop.nocallback = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nocallback)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noduplicate") {
|
|
prop.noduplicate = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noduplicate)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noreturn") {
|
|
prop.noreturn = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noreturn)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "optimize_none") {
|
|
prop.optimize_none = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.optimize_none)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "optsize") {
|
|
prop.optsize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.optsize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "passthrough") {
|
|
prop.passthrough = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.passthrough)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "personality") {
|
|
prop.personality = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.personality)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "prefer_vector_width") {
|
|
prop.prefer_vector_width = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.prefer_vector_width)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "reciprocal_estimates") {
|
|
prop.reciprocal_estimates = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.reciprocal_estimates)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "reqd_work_group_size") {
|
|
prop.reqd_work_group_size = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.reqd_work_group_size)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "res_attrs") {
|
|
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "returns_twice") {
|
|
prop.returns_twice = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.returns_twice)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "save_reg_params") {
|
|
prop.save_reg_params = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.save_reg_params)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "section") {
|
|
prop.section = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.section)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_name") {
|
|
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "sym_visibility") {
|
|
prop.sym_visibility = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_visibility)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "target_cpu") {
|
|
prop.target_cpu = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target_cpu)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "target_features") {
|
|
prop.target_features = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target_features)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tune_cpu") {
|
|
prop.tune_cpu = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tune_cpu)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unnamed_addr") {
|
|
prop.unnamed_addr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unnamed_addr)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "use_sample_profile") {
|
|
prop.use_sample_profile = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.use_sample_profile)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "uwtable_kind") {
|
|
prop.uwtable_kind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.uwtable_kind)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "vec_type_hint") {
|
|
prop.vec_type_hint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.vec_type_hint)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "visibility_") {
|
|
prop.visibility_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.visibility_)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "vscale_range") {
|
|
prop.vscale_range = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.vscale_range)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "will_return") {
|
|
prop.will_return = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.will_return)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "work_group_size_hint") {
|
|
prop.work_group_size_hint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.work_group_size_hint)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "zero_call_used_regs") {
|
|
prop.zero_call_used_regs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.zero_call_used_regs)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void LLVMFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.CConv) attrs.append("CConv", prop.CConv);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.allocsize) attrs.append("allocsize", prop.allocsize);
|
|
|
|
if (prop.always_inline) attrs.append("always_inline", prop.always_inline);
|
|
|
|
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
|
|
|
|
if (prop.arm_in_za) attrs.append("arm_in_za", prop.arm_in_za);
|
|
|
|
if (prop.arm_inout_za) attrs.append("arm_inout_za", prop.arm_inout_za);
|
|
|
|
if (prop.arm_locally_streaming) attrs.append("arm_locally_streaming", prop.arm_locally_streaming);
|
|
|
|
if (prop.arm_new_za) attrs.append("arm_new_za", prop.arm_new_za);
|
|
|
|
if (prop.arm_out_za) attrs.append("arm_out_za", prop.arm_out_za);
|
|
|
|
if (prop.arm_preserves_za) attrs.append("arm_preserves_za", prop.arm_preserves_za);
|
|
|
|
if (prop.arm_streaming) attrs.append("arm_streaming", prop.arm_streaming);
|
|
|
|
if (prop.arm_streaming_compatible) attrs.append("arm_streaming_compatible", prop.arm_streaming_compatible);
|
|
|
|
if (prop.cold) attrs.append("cold", prop.cold);
|
|
|
|
if (prop.comdat) attrs.append("comdat", prop.comdat);
|
|
|
|
if (prop.convergent) attrs.append("convergent", prop.convergent);
|
|
|
|
if (prop.default_func_attrs) attrs.append("default_func_attrs", prop.default_func_attrs);
|
|
|
|
if (prop.denormal_fpenv) attrs.append("denormal_fpenv", prop.denormal_fpenv);
|
|
|
|
if (prop.dso_local) attrs.append("dso_local", prop.dso_local);
|
|
|
|
if (prop.fp_contract) attrs.append("fp_contract", prop.fp_contract);
|
|
|
|
if (prop.frame_pointer) attrs.append("frame_pointer", prop.frame_pointer);
|
|
|
|
if (prop.function_entry_count) attrs.append("function_entry_count", prop.function_entry_count);
|
|
|
|
if (prop.function_type) attrs.append("function_type", prop.function_type);
|
|
|
|
if (prop.garbageCollector) attrs.append("garbageCollector", prop.garbageCollector);
|
|
|
|
if (prop.hot) attrs.append("hot", prop.hot);
|
|
|
|
if (prop.inline_hint) attrs.append("inline_hint", prop.inline_hint);
|
|
|
|
if (prop.instrument_function_entry) attrs.append("instrument_function_entry", prop.instrument_function_entry);
|
|
|
|
if (prop.instrument_function_exit) attrs.append("instrument_function_exit", prop.instrument_function_exit);
|
|
|
|
if (prop.intel_reqd_sub_group_size) attrs.append("intel_reqd_sub_group_size", prop.intel_reqd_sub_group_size);
|
|
|
|
if (prop.linkage) attrs.append("linkage", prop.linkage);
|
|
|
|
if (prop.memory_effects) attrs.append("memory_effects", prop.memory_effects);
|
|
|
|
if (prop.minsize) attrs.append("minsize", prop.minsize);
|
|
|
|
if (prop.modular_format) attrs.append("modular_format", prop.modular_format);
|
|
|
|
if (prop.no_caller_saved_registers) attrs.append("no_caller_saved_registers", prop.no_caller_saved_registers);
|
|
|
|
if (prop.no_inline) attrs.append("no_inline", prop.no_inline);
|
|
|
|
if (prop.no_signed_zeros_fp_math) attrs.append("no_signed_zeros_fp_math", prop.no_signed_zeros_fp_math);
|
|
|
|
if (prop.no_unwind) attrs.append("no_unwind", prop.no_unwind);
|
|
|
|
if (prop.nobuiltins) attrs.append("nobuiltins", prop.nobuiltins);
|
|
|
|
if (prop.nocallback) attrs.append("nocallback", prop.nocallback);
|
|
|
|
if (prop.noduplicate) attrs.append("noduplicate", prop.noduplicate);
|
|
|
|
if (prop.noreturn) attrs.append("noreturn", prop.noreturn);
|
|
|
|
if (prop.optimize_none) attrs.append("optimize_none", prop.optimize_none);
|
|
|
|
if (prop.optsize) attrs.append("optsize", prop.optsize);
|
|
|
|
if (prop.passthrough) attrs.append("passthrough", prop.passthrough);
|
|
|
|
if (prop.personality) attrs.append("personality", prop.personality);
|
|
|
|
if (prop.prefer_vector_width) attrs.append("prefer_vector_width", prop.prefer_vector_width);
|
|
|
|
if (prop.reciprocal_estimates) attrs.append("reciprocal_estimates", prop.reciprocal_estimates);
|
|
|
|
if (prop.reqd_work_group_size) attrs.append("reqd_work_group_size", prop.reqd_work_group_size);
|
|
|
|
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
|
|
|
|
if (prop.returns_twice) attrs.append("returns_twice", prop.returns_twice);
|
|
|
|
if (prop.save_reg_params) attrs.append("save_reg_params", prop.save_reg_params);
|
|
|
|
if (prop.section) attrs.append("section", prop.section);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
|
|
if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility);
|
|
|
|
if (prop.target_cpu) attrs.append("target_cpu", prop.target_cpu);
|
|
|
|
if (prop.target_features) attrs.append("target_features", prop.target_features);
|
|
|
|
if (prop.tune_cpu) attrs.append("tune_cpu", prop.tune_cpu);
|
|
|
|
if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr);
|
|
|
|
if (prop.use_sample_profile) attrs.append("use_sample_profile", prop.use_sample_profile);
|
|
|
|
if (prop.uwtable_kind) attrs.append("uwtable_kind", prop.uwtable_kind);
|
|
|
|
if (prop.vec_type_hint) attrs.append("vec_type_hint", prop.vec_type_hint);
|
|
|
|
if (prop.visibility_) attrs.append("visibility_", prop.visibility_);
|
|
|
|
if (prop.vscale_range) attrs.append("vscale_range", prop.vscale_range);
|
|
|
|
if (prop.will_return) attrs.append("will_return", prop.will_return);
|
|
|
|
if (prop.work_group_size_hint) attrs.append("work_group_size_hint", prop.work_group_size_hint);
|
|
|
|
if (prop.zero_call_used_regs) attrs.append("zero_call_used_regs", prop.zero_call_used_regs);
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCConvAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(attr, "CConv", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAllocsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "allocsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlwaysInlineAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "always_inline", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "arg_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmInZaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_in_za", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmInoutZaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_inout_za", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmLocallyStreamingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_locally_streaming", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmNewZaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_new_za", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmOutZaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_out_za", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmPreservesZaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_preserves_za", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmStreamingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_streaming", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getArmStreamingCompatibleAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "arm_streaming_compatible", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getColdAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "cold", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getComdatAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps33(attr, "comdat", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getConvergentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "convergent", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDefaultFuncAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(attr, "default_func_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDenormalFpenvAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps42(attr, "denormal_fpenv", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "dso_local", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFpContractAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "fp_contract", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFramePointerAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps39(attr, "frame_pointer", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFunctionEntryCountAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "function_entry_count", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(attr, "function_type", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGarbageCollectorAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "garbageCollector", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getHotAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "hot", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInlineHintAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "inline_hint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInstrumentFunctionEntryAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "instrument_function_entry", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInstrumentFunctionExitAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "instrument_function_exit", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIntelReqdSubGroupSizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps44(attr, "intel_reqd_sub_group_size", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "linkage", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMemoryEffectsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(attr, "memory_effects", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMinsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "minsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getModularFormatAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "modular_format", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoCallerSavedRegistersAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_caller_saved_registers", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoInlineAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_inline", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoSignedZerosFpMathAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps41(attr, "no_signed_zeros_fp_math", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoUnwindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "no_unwind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNobuiltinsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "nobuiltins", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNocallbackAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nocallback", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoduplicateAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "noduplicate", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoreturnAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "noreturn", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOptimizeNoneAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "optimize_none", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOptsizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "optsize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPassthroughAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "passthrough", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPersonalityAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "personality", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPreferVectorWidthAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "prefer_vector_width", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReciprocalEstimatesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "reciprocal_estimates", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReqdWorkGroupSizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "reqd_work_group_size", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "res_attrs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReturnsTwiceAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "returns_twice", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSaveRegParamsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "save_reg_params", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSectionAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "section", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "sym_visibility", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetCpuAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "target_cpu", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetFeaturesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps40(attr, "target_features", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTuneCpuAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "tune_cpu", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "unnamed_addr", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUseSampleProfileAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps41(attr, "use_sample_profile", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUwtableKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps45(attr, "uwtable_kind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVecTypeHintAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps43(attr, "vec_type_hint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "visibility_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVscaleRangeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps38(attr, "vscale_range", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWillReturnAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "will_return", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWorkGroupSizeHintAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "work_group_size_hint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getZeroCallUsedRegsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "zero_call_used_regs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.CConv)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.allocsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.always_inline)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_in_za)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_inout_za)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_locally_streaming)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_new_za)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_out_za)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_preserves_za)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_streaming)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.arm_streaming_compatible)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cold)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.comdat)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.convergent)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.default_func_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.denormal_fpenv)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fp_contract)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.frame_pointer)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.function_entry_count)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.function_type)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.garbageCollector)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.hot)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.inline_hint)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.instrument_function_entry)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.instrument_function_exit)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.intel_reqd_sub_group_size)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.linkage)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.memory_effects)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.minsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.modular_format)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_caller_saved_registers)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_inline)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_signed_zeros_fp_math)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.no_unwind)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nobuiltins)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nocallback)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noduplicate)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noreturn)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.optimize_none)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.optsize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.passthrough)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.personality)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.prefer_vector_width)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.reciprocal_estimates)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.reqd_work_group_size)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.returns_twice)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.save_reg_params)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.section)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.target_cpu)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.target_features)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tune_cpu)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.use_sample_profile)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.uwtable_kind)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.vec_type_hint)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.vscale_range)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.will_return)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.work_group_size_hint)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.zero_call_used_regs)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LLVMFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.CConv);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
|
|
writer.writeOptionalAttribute(prop.allocsize);
|
|
|
|
writer.writeOptionalAttribute(prop.always_inline);
|
|
|
|
writer.writeOptionalAttribute(prop.arg_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_in_za);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_inout_za);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_locally_streaming);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_new_za);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_out_za);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_preserves_za);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_streaming);
|
|
|
|
writer.writeOptionalAttribute(prop.arm_streaming_compatible);
|
|
|
|
writer.writeOptionalAttribute(prop.cold);
|
|
|
|
writer.writeOptionalAttribute(prop.comdat);
|
|
|
|
writer.writeOptionalAttribute(prop.convergent);
|
|
|
|
writer.writeOptionalAttribute(prop.default_func_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.denormal_fpenv);
|
|
|
|
writer.writeOptionalAttribute(prop.dso_local);
|
|
|
|
writer.writeOptionalAttribute(prop.fp_contract);
|
|
|
|
writer.writeOptionalAttribute(prop.frame_pointer);
|
|
|
|
writer.writeOptionalAttribute(prop.function_entry_count);
|
|
writer.writeAttribute(prop.function_type);
|
|
|
|
writer.writeOptionalAttribute(prop.garbageCollector);
|
|
|
|
writer.writeOptionalAttribute(prop.hot);
|
|
|
|
writer.writeOptionalAttribute(prop.inline_hint);
|
|
|
|
writer.writeOptionalAttribute(prop.instrument_function_entry);
|
|
|
|
writer.writeOptionalAttribute(prop.instrument_function_exit);
|
|
|
|
writer.writeOptionalAttribute(prop.intel_reqd_sub_group_size);
|
|
|
|
writer.writeOptionalAttribute(prop.linkage);
|
|
|
|
writer.writeOptionalAttribute(prop.memory_effects);
|
|
|
|
writer.writeOptionalAttribute(prop.minsize);
|
|
|
|
writer.writeOptionalAttribute(prop.modular_format);
|
|
|
|
writer.writeOptionalAttribute(prop.no_caller_saved_registers);
|
|
|
|
writer.writeOptionalAttribute(prop.no_inline);
|
|
|
|
writer.writeOptionalAttribute(prop.no_signed_zeros_fp_math);
|
|
|
|
writer.writeOptionalAttribute(prop.no_unwind);
|
|
|
|
writer.writeOptionalAttribute(prop.nobuiltins);
|
|
|
|
writer.writeOptionalAttribute(prop.nocallback);
|
|
|
|
writer.writeOptionalAttribute(prop.noduplicate);
|
|
|
|
writer.writeOptionalAttribute(prop.noreturn);
|
|
|
|
writer.writeOptionalAttribute(prop.optimize_none);
|
|
|
|
writer.writeOptionalAttribute(prop.optsize);
|
|
|
|
writer.writeOptionalAttribute(prop.passthrough);
|
|
|
|
writer.writeOptionalAttribute(prop.personality);
|
|
|
|
writer.writeOptionalAttribute(prop.prefer_vector_width);
|
|
|
|
writer.writeOptionalAttribute(prop.reciprocal_estimates);
|
|
|
|
writer.writeOptionalAttribute(prop.reqd_work_group_size);
|
|
|
|
writer.writeOptionalAttribute(prop.res_attrs);
|
|
|
|
writer.writeOptionalAttribute(prop.returns_twice);
|
|
|
|
writer.writeOptionalAttribute(prop.save_reg_params);
|
|
|
|
writer.writeOptionalAttribute(prop.section);
|
|
writer.writeAttribute(prop.sym_name);
|
|
|
|
writer.writeOptionalAttribute(prop.sym_visibility);
|
|
|
|
writer.writeOptionalAttribute(prop.target_cpu);
|
|
|
|
writer.writeOptionalAttribute(prop.target_features);
|
|
|
|
writer.writeOptionalAttribute(prop.tune_cpu);
|
|
|
|
writer.writeOptionalAttribute(prop.unnamed_addr);
|
|
|
|
writer.writeOptionalAttribute(prop.use_sample_profile);
|
|
|
|
writer.writeOptionalAttribute(prop.uwtable_kind);
|
|
|
|
writer.writeOptionalAttribute(prop.vec_type_hint);
|
|
|
|
writer.writeOptionalAttribute(prop.visibility_);
|
|
|
|
writer.writeOptionalAttribute(prop.vscale_range);
|
|
|
|
writer.writeOptionalAttribute(prop.will_return);
|
|
|
|
writer.writeOptionalAttribute(prop.work_group_size_hint);
|
|
|
|
writer.writeOptionalAttribute(prop.zero_call_used_regs);
|
|
}
|
|
|
|
::llvm::StringRef LLVMFuncOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getSymVisibility() {
|
|
auto attr = getSymVisibilityAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::LLVMFunctionType LLVMFuncOp::getFunctionType() {
|
|
auto attr = getFunctionTypeAttr();
|
|
return ::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue());
|
|
}
|
|
|
|
::mlir::LLVM::Linkage LLVMFuncOp::getLinkage() {
|
|
auto attr = getLinkageAttr();
|
|
return attr.getLinkage();
|
|
}
|
|
|
|
bool LLVMFuncOp::getDsoLocal() {
|
|
auto attr = getDsoLocalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::cconv::CConv LLVMFuncOp::getCConv() {
|
|
auto attr = getCConvAttr();
|
|
return attr.getCallingConv();
|
|
}
|
|
|
|
::std::optional< ::mlir::SymbolRefAttr > LLVMFuncOp::getComdat() {
|
|
auto attr = getComdatAttr();
|
|
return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
bool LLVMFuncOp::getConvergent() {
|
|
auto attr = getConvergentAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getPersonality() {
|
|
auto attr = getPersonalityAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getGarbageCollector() {
|
|
auto attr = getGarbageCollectorAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getPassthrough() {
|
|
auto attr = getPassthroughAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getArgAttrs() {
|
|
auto attr = getArgAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getResAttrs() {
|
|
auto attr = getResAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> LLVMFuncOp::getFunctionEntryCount() {
|
|
auto attr = getFunctionEntryCountAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::MemoryEffectsAttr> LLVMFuncOp::getMemoryEffects() {
|
|
auto attr = getMemoryEffectsAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::LLVM::Visibility LLVMFuncOp::getVisibility_() {
|
|
auto attr = getVisibility_Attr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmStreaming() {
|
|
auto attr = getArmStreamingAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmLocallyStreaming() {
|
|
auto attr = getArmLocallyStreamingAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmStreamingCompatible() {
|
|
auto attr = getArmStreamingCompatibleAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmNewZa() {
|
|
auto attr = getArmNewZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmInZa() {
|
|
auto attr = getArmInZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmOutZa() {
|
|
auto attr = getArmOutZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmInoutZa() {
|
|
auto attr = getArmInoutZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getArmPreservesZa() {
|
|
auto attr = getArmPreservesZaAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getSection() {
|
|
auto attr = getSectionAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UnnamedAddr> LLVMFuncOp::getUnnamedAddr() {
|
|
auto attr = getUnnamedAddrAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint64_t> LLVMFuncOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::VScaleRangeAttr> LLVMFuncOp::getVscaleRange() {
|
|
auto attr = getVscaleRangeAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::VScaleRangeAttr>(::llvm::cast<::mlir::LLVM::VScaleRangeAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::FramePointerKindAttr> LLVMFuncOp::getFramePointer() {
|
|
auto attr = getFramePointerAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::FramePointerKindAttr>(::llvm::cast<::mlir::LLVM::FramePointerKindAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getTargetCpu() {
|
|
auto attr = getTargetCpuAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getTuneCpu() {
|
|
auto attr = getTuneCpuAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getReciprocalEstimates() {
|
|
auto attr = getReciprocalEstimatesAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getPreferVectorWidth() {
|
|
auto attr = getPreferVectorWidthAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::TargetFeaturesAttr> LLVMFuncOp::getTargetFeatures() {
|
|
auto attr = getTargetFeaturesAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::TargetFeaturesAttr>(::llvm::cast<::mlir::LLVM::TargetFeaturesAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< bool > LLVMFuncOp::getNoSignedZerosFpMath() {
|
|
auto attr = getNoSignedZerosFpMathAttr();
|
|
return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::DenormalFPEnvAttr> LLVMFuncOp::getDenormalFpenv() {
|
|
auto attr = getDenormalFpenvAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DenormalFPEnvAttr>(::llvm::cast<::mlir::LLVM::DenormalFPEnvAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getFpContract() {
|
|
auto attr = getFpContractAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getInstrumentFunctionEntry() {
|
|
auto attr = getInstrumentFunctionEntryAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getInstrumentFunctionExit() {
|
|
auto attr = getInstrumentFunctionExitAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
bool LLVMFuncOp::getNoInline() {
|
|
auto attr = getNoInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getAlwaysInline() {
|
|
auto attr = getAlwaysInlineAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getInlineHint() {
|
|
auto attr = getInlineHintAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getNoUnwind() {
|
|
auto attr = getNoUnwindAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getWillReturn() {
|
|
auto attr = getWillReturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getNoreturn() {
|
|
auto attr = getNoreturnAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getOptimizeNone() {
|
|
auto attr = getOptimizeNoneAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getReturnsTwice() {
|
|
auto attr = getReturnsTwiceAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getHot() {
|
|
auto attr = getHotAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getCold() {
|
|
auto attr = getColdAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getNoduplicate() {
|
|
auto attr = getNoduplicateAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getNoCallerSavedRegisters() {
|
|
auto attr = getNoCallerSavedRegistersAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LLVMFuncOp::getNocallback() {
|
|
auto attr = getNocallbackAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getModularFormat() {
|
|
auto attr = getModularFormatAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getNobuiltins() {
|
|
auto attr = getNobuiltinsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOp::getAllocsize() {
|
|
auto attr = getAllocsizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOp::getOptsize() {
|
|
auto attr = getOptsizeAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOp::getMinsize() {
|
|
auto attr = getMinsizeAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<bool> LLVMFuncOp::getSaveRegParams() {
|
|
auto attr = getSaveRegParamsAttr();
|
|
return attr ? ::std::optional<bool>(attr != nullptr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LLVMFuncOp::getZeroCallUsedRegs() {
|
|
auto attr = getZeroCallUsedRegsAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::DictionaryAttr > LLVMFuncOp::getDefaultFuncAttrs() {
|
|
auto attr = getDefaultFuncAttrsAttr();
|
|
return attr ? ::std::optional< ::mlir::DictionaryAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::VecTypeHintAttr> LLVMFuncOp::getVecTypeHint() {
|
|
auto attr = getVecTypeHintAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::VecTypeHintAttr>(::llvm::cast<::mlir::LLVM::VecTypeHintAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOp::getWorkGroupSizeHint() {
|
|
auto attr = getWorkGroupSizeHintAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> LLVMFuncOp::getReqdWorkGroupSize() {
|
|
auto attr = getReqdWorkGroupSizeAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> LLVMFuncOp::getIntelReqdSubGroupSize() {
|
|
auto attr = getIntelReqdSubGroupSizeAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::UWTableKindAttr> LLVMFuncOp::getUwtableKind() {
|
|
auto attr = getUwtableKindAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::UWTableKindAttr>(::llvm::cast<::mlir::LLVM::UWTableKindAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< bool > LLVMFuncOp::getUseSampleProfile() {
|
|
auto attr = getUseSampleProfileAttr();
|
|
return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void LLVMFuncOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void LLVMFuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().sym_visibility;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setFunctionType(::mlir::LLVM::LLVMFunctionType attrValue) {
|
|
getProperties().function_type = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void LLVMFuncOp::setLinkage(::mlir::LLVM::Linkage attrValue) {
|
|
getProperties().linkage = ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void LLVMFuncOp::setDsoLocal(bool attrValue) {
|
|
auto &odsProp = getProperties().dso_local;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setCConv(::mlir::LLVM::cconv::CConv attrValue) {
|
|
getProperties().CConv = ::mlir::LLVM::CConvAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void LLVMFuncOp::setConvergent(bool attrValue) {
|
|
auto &odsProp = getProperties().convergent;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setPersonality(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().personality;
|
|
if (attrValue)
|
|
odsProp = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setGarbageCollector(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().garbageCollector;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setFunctionEntryCount(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().function_entry_count;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setVisibility_(::mlir::LLVM::Visibility attrValue) {
|
|
getProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void LLVMFuncOp::setArmStreaming(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_streaming;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmLocallyStreaming(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_locally_streaming;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmStreamingCompatible(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_streaming_compatible;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmNewZa(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_new_za;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmInZa(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_in_za;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmOutZa(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_out_za;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmInoutZa(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_inout_za;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setArmPreservesZa(bool attrValue) {
|
|
auto &odsProp = getProperties().arm_preserves_za;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setSection(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().section;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue) {
|
|
auto &odsProp = getProperties().unnamed_addr;
|
|
if (attrValue)
|
|
odsProp = ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setTargetCpu(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().target_cpu;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setTuneCpu(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().tune_cpu;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setReciprocalEstimates(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().reciprocal_estimates;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setPreferVectorWidth(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().prefer_vector_width;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoSignedZerosFpMath(::std::optional<bool> attrValue) {
|
|
auto &odsProp = getProperties().no_signed_zeros_fp_math;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getBoolAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setFpContract(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().fp_contract;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setInstrumentFunctionEntry(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().instrument_function_entry;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setInstrumentFunctionExit(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().instrument_function_exit;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoInline(bool attrValue) {
|
|
auto &odsProp = getProperties().no_inline;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setAlwaysInline(bool attrValue) {
|
|
auto &odsProp = getProperties().always_inline;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setInlineHint(bool attrValue) {
|
|
auto &odsProp = getProperties().inline_hint;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoUnwind(bool attrValue) {
|
|
auto &odsProp = getProperties().no_unwind;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setWillReturn(bool attrValue) {
|
|
auto &odsProp = getProperties().will_return;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoreturn(bool attrValue) {
|
|
auto &odsProp = getProperties().noreturn;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setOptimizeNone(bool attrValue) {
|
|
auto &odsProp = getProperties().optimize_none;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setReturnsTwice(bool attrValue) {
|
|
auto &odsProp = getProperties().returns_twice;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setHot(bool attrValue) {
|
|
auto &odsProp = getProperties().hot;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setCold(bool attrValue) {
|
|
auto &odsProp = getProperties().cold;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoduplicate(bool attrValue) {
|
|
auto &odsProp = getProperties().noduplicate;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNoCallerSavedRegisters(bool attrValue) {
|
|
auto &odsProp = getProperties().no_caller_saved_registers;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setNocallback(bool attrValue) {
|
|
auto &odsProp = getProperties().nocallback;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setModularFormat(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().modular_format;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setAllocsize(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().allocsize;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setOptsize(bool attrValue) {
|
|
auto &odsProp = getProperties().optsize;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setMinsize(bool attrValue) {
|
|
auto &odsProp = getProperties().minsize;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setSaveRegParams(bool attrValue) {
|
|
auto &odsProp = getProperties().save_reg_params;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setZeroCallUsedRegs(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().zero_call_used_regs;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setWorkGroupSizeHint(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().work_group_size_hint;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setReqdWorkGroupSize(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().reqd_work_group_size;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setIntelReqdSubGroupSize(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().intel_reqd_sub_group_size;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LLVMFuncOp::setUseSampleProfile(::std::optional<bool> attrValue) {
|
|
auto &odsProp = getProperties().use_sample_profile;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getBoolAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
LLVMFuncOp LLVMFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, Type type, Linkage linkage, bool dsoLocal, CConv cconv, SymbolRefAttr comdat, ArrayRef<NamedAttribute> attrs, ArrayRef<DictionaryAttr> argAttrs, std::optional<uint64_t> functionEntryCount) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(type)>(type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(cconv)>(cconv), std::forward<decltype(comdat)>(comdat), std::forward<decltype(attrs)>(attrs), std::forward<decltype(argAttrs)>(argAttrs), std::forward<decltype(functionEntryCount)>(functionEntryCount));
|
|
auto __res__ = ::llvm::dyn_cast<LLVMFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LLVMFuncOp LLVMFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, Type type, Linkage linkage, bool dsoLocal, CConv cconv, SymbolRefAttr comdat, ArrayRef<NamedAttribute> attrs, ArrayRef<DictionaryAttr> argAttrs, std::optional<uint64_t> functionEntryCount) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(type)>(type), std::forward<decltype(linkage)>(linkage), std::forward<decltype(dsoLocal)>(dsoLocal), std::forward<decltype(cconv)>(cconv), std::forward<decltype(comdat)>(comdat), std::forward<decltype(attrs)>(attrs), std::forward<decltype(argAttrs)>(argAttrs), std::forward<decltype(functionEntryCount)>(functionEntryCount));
|
|
}
|
|
|
|
void LLVMFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, const Properties &properties, ArrayRef<NamedAttribute> discardableAttributes) {
|
|
odsState.addRegion();
|
|
odsState.getOrAddProperties<Properties>() = properties;
|
|
odsState.addAttributes(discardableAttributes);
|
|
}
|
|
|
|
LLVMFuncOp LLVMFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, const Properties &properties, ArrayRef<NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LLVMFuncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LLVMFuncOp LLVMFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, const Properties &properties, ArrayRef<NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void LLVMFuncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.linkage)
|
|
properties.linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), Linkage::External);
|
|
if (!properties.CConv)
|
|
properties.CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv::C);
|
|
if (!properties.visibility_)
|
|
properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default);
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::verifyInvariantsImpl() {
|
|
auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_allocsize = getProperties().allocsize; (void)tblgen_allocsize;
|
|
auto tblgen_always_inline = getProperties().always_inline; (void)tblgen_always_inline;
|
|
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
|
|
auto tblgen_arm_in_za = getProperties().arm_in_za; (void)tblgen_arm_in_za;
|
|
auto tblgen_arm_inout_za = getProperties().arm_inout_za; (void)tblgen_arm_inout_za;
|
|
auto tblgen_arm_locally_streaming = getProperties().arm_locally_streaming; (void)tblgen_arm_locally_streaming;
|
|
auto tblgen_arm_new_za = getProperties().arm_new_za; (void)tblgen_arm_new_za;
|
|
auto tblgen_arm_out_za = getProperties().arm_out_za; (void)tblgen_arm_out_za;
|
|
auto tblgen_arm_preserves_za = getProperties().arm_preserves_za; (void)tblgen_arm_preserves_za;
|
|
auto tblgen_arm_streaming = getProperties().arm_streaming; (void)tblgen_arm_streaming;
|
|
auto tblgen_arm_streaming_compatible = getProperties().arm_streaming_compatible; (void)tblgen_arm_streaming_compatible;
|
|
auto tblgen_cold = getProperties().cold; (void)tblgen_cold;
|
|
auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat;
|
|
auto tblgen_convergent = getProperties().convergent; (void)tblgen_convergent;
|
|
auto tblgen_default_func_attrs = getProperties().default_func_attrs; (void)tblgen_default_func_attrs;
|
|
auto tblgen_denormal_fpenv = getProperties().denormal_fpenv; (void)tblgen_denormal_fpenv;
|
|
auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local;
|
|
auto tblgen_fp_contract = getProperties().fp_contract; (void)tblgen_fp_contract;
|
|
auto tblgen_frame_pointer = getProperties().frame_pointer; (void)tblgen_frame_pointer;
|
|
auto tblgen_function_entry_count = getProperties().function_entry_count; (void)tblgen_function_entry_count;
|
|
auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
|
|
if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'");
|
|
auto tblgen_garbageCollector = getProperties().garbageCollector; (void)tblgen_garbageCollector;
|
|
auto tblgen_hot = getProperties().hot; (void)tblgen_hot;
|
|
auto tblgen_inline_hint = getProperties().inline_hint; (void)tblgen_inline_hint;
|
|
auto tblgen_instrument_function_entry = getProperties().instrument_function_entry; (void)tblgen_instrument_function_entry;
|
|
auto tblgen_instrument_function_exit = getProperties().instrument_function_exit; (void)tblgen_instrument_function_exit;
|
|
auto tblgen_intel_reqd_sub_group_size = getProperties().intel_reqd_sub_group_size; (void)tblgen_intel_reqd_sub_group_size;
|
|
auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage;
|
|
auto tblgen_memory_effects = getProperties().memory_effects; (void)tblgen_memory_effects;
|
|
auto tblgen_minsize = getProperties().minsize; (void)tblgen_minsize;
|
|
auto tblgen_modular_format = getProperties().modular_format; (void)tblgen_modular_format;
|
|
auto tblgen_no_caller_saved_registers = getProperties().no_caller_saved_registers; (void)tblgen_no_caller_saved_registers;
|
|
auto tblgen_no_inline = getProperties().no_inline; (void)tblgen_no_inline;
|
|
auto tblgen_no_signed_zeros_fp_math = getProperties().no_signed_zeros_fp_math; (void)tblgen_no_signed_zeros_fp_math;
|
|
auto tblgen_no_unwind = getProperties().no_unwind; (void)tblgen_no_unwind;
|
|
auto tblgen_nobuiltins = getProperties().nobuiltins; (void)tblgen_nobuiltins;
|
|
auto tblgen_nocallback = getProperties().nocallback; (void)tblgen_nocallback;
|
|
auto tblgen_noduplicate = getProperties().noduplicate; (void)tblgen_noduplicate;
|
|
auto tblgen_noreturn = getProperties().noreturn; (void)tblgen_noreturn;
|
|
auto tblgen_optimize_none = getProperties().optimize_none; (void)tblgen_optimize_none;
|
|
auto tblgen_optsize = getProperties().optsize; (void)tblgen_optsize;
|
|
auto tblgen_passthrough = getProperties().passthrough; (void)tblgen_passthrough;
|
|
auto tblgen_personality = getProperties().personality; (void)tblgen_personality;
|
|
auto tblgen_prefer_vector_width = getProperties().prefer_vector_width; (void)tblgen_prefer_vector_width;
|
|
auto tblgen_reciprocal_estimates = getProperties().reciprocal_estimates; (void)tblgen_reciprocal_estimates;
|
|
auto tblgen_reqd_work_group_size = getProperties().reqd_work_group_size; (void)tblgen_reqd_work_group_size;
|
|
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
|
|
auto tblgen_returns_twice = getProperties().returns_twice; (void)tblgen_returns_twice;
|
|
auto tblgen_save_reg_params = getProperties().save_reg_params; (void)tblgen_save_reg_params;
|
|
auto tblgen_section = getProperties().section; (void)tblgen_section;
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
|
|
auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility;
|
|
auto tblgen_target_cpu = getProperties().target_cpu; (void)tblgen_target_cpu;
|
|
auto tblgen_target_features = getProperties().target_features; (void)tblgen_target_features;
|
|
auto tblgen_tune_cpu = getProperties().tune_cpu; (void)tblgen_tune_cpu;
|
|
auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr;
|
|
auto tblgen_use_sample_profile = getProperties().use_sample_profile; (void)tblgen_use_sample_profile;
|
|
auto tblgen_uwtable_kind = getProperties().uwtable_kind; (void)tblgen_uwtable_kind;
|
|
auto tblgen_vec_type_hint = getProperties().vec_type_hint; (void)tblgen_vec_type_hint;
|
|
auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_;
|
|
auto tblgen_vscale_range = getProperties().vscale_range; (void)tblgen_vscale_range;
|
|
auto tblgen_will_return = getProperties().will_return; (void)tblgen_will_return;
|
|
auto tblgen_work_group_size_hint = getProperties().work_group_size_hint; (void)tblgen_work_group_size_hint;
|
|
auto tblgen_zero_call_used_regs = getProperties().zero_call_used_regs; (void)tblgen_zero_call_used_regs;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_sym_visibility, "sym_visibility")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(*this, tblgen_function_type, "function_type")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_linkage, "linkage")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_dso_local, "dso_local")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(*this, tblgen_CConv, "CConv")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps33(*this, tblgen_comdat, "comdat")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_convergent, "convergent")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_personality, "personality")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_garbageCollector, "garbageCollector")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_passthrough, "passthrough")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_arg_attrs, "arg_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_res_attrs, "res_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_function_entry_count, "function_entry_count")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(*this, tblgen_memory_effects, "memory_effects")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_visibility_, "visibility_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_streaming, "arm_streaming")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_locally_streaming, "arm_locally_streaming")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_streaming_compatible, "arm_streaming_compatible")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_new_za, "arm_new_za")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_in_za, "arm_in_za")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_out_za, "arm_out_za")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_inout_za, "arm_inout_za")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_arm_preserves_za, "arm_preserves_za")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_section, "section")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_unnamed_addr, "unnamed_addr")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps38(*this, tblgen_vscale_range, "vscale_range")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps39(*this, tblgen_frame_pointer, "frame_pointer")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_target_cpu, "target_cpu")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_tune_cpu, "tune_cpu")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_reciprocal_estimates, "reciprocal_estimates")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_prefer_vector_width, "prefer_vector_width")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps40(*this, tblgen_target_features, "target_features")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps41(*this, tblgen_no_signed_zeros_fp_math, "no_signed_zeros_fp_math")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps42(*this, tblgen_denormal_fpenv, "denormal_fpenv")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_fp_contract, "fp_contract")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_instrument_function_entry, "instrument_function_entry")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_instrument_function_exit, "instrument_function_exit")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_inline, "no_inline")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_always_inline, "always_inline")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_inline_hint, "inline_hint")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_unwind, "no_unwind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_will_return, "will_return")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_noreturn, "noreturn")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_optimize_none, "optimize_none")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_returns_twice, "returns_twice")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_hot, "hot")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_cold, "cold")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_noduplicate, "noduplicate")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_no_caller_saved_registers, "no_caller_saved_registers")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nocallback, "nocallback")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_modular_format, "modular_format")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_nobuiltins, "nobuiltins")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_allocsize, "allocsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_optsize, "optsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_minsize, "minsize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_save_reg_params, "save_reg_params")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_zero_call_used_regs, "zero_call_used_regs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(*this, tblgen_default_func_attrs, "default_func_attrs")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps43(*this, tblgen_vec_type_hint, "vec_type_hint")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_work_group_size_hint, "work_group_size_hint")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_reqd_work_group_size, "reqd_work_group_size")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps44(*this, tblgen_intel_reqd_sub_group_size, "intel_reqd_sub_group_size")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps45(*this, tblgen_uwtable_kind, "uwtable_kind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps41(*this, tblgen_use_sample_profile, "use_sample_profile")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps2(*this, region, "body", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult LLVMFuncOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.sym_name;
|
|
auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name");
|
|
auto attr = dict.get(sym_nameAttrName);
|
|
usedKeys.insert(sym_nameAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for sym_name in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.sym_visibility;
|
|
auto sym_visibilityAttrName = ::mlir::StringAttr::get(ctx, "sym_visibility");
|
|
auto attr = dict.get(sym_visibilityAttrName);
|
|
usedKeys.insert(sym_visibilityAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for sym_visibility in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.function_type;
|
|
auto function_typeAttrName = ::mlir::StringAttr::get(ctx, "function_type");
|
|
auto attr = dict.get(function_typeAttrName);
|
|
usedKeys.insert(function_typeAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for function_type in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `function_type` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.linkage;
|
|
auto linkageAttrName = ::mlir::StringAttr::get(ctx, "linkage");
|
|
auto attr = dict.get(linkageAttrName);
|
|
usedKeys.insert(linkageAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for linkage in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `linkage` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.dso_local;
|
|
auto dso_localAttrName = ::mlir::StringAttr::get(ctx, "dso_local");
|
|
auto attr = dict.get(dso_localAttrName);
|
|
usedKeys.insert(dso_localAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for dso_local in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dso_local` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.CConv;
|
|
auto CConvAttrName = ::mlir::StringAttr::get(ctx, "CConv");
|
|
auto attr = dict.get(CConvAttrName);
|
|
usedKeys.insert(CConvAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for CConv in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `CConv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.comdat;
|
|
auto comdatAttrName = ::mlir::StringAttr::get(ctx, "comdat");
|
|
auto attr = dict.get(comdatAttrName);
|
|
usedKeys.insert(comdatAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for comdat in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `comdat` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.convergent;
|
|
auto convergentAttrName = ::mlir::StringAttr::get(ctx, "convergent");
|
|
auto attr = dict.get(convergentAttrName);
|
|
usedKeys.insert(convergentAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for convergent in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `convergent` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.personality;
|
|
auto personalityAttrName = ::mlir::StringAttr::get(ctx, "personality");
|
|
auto attr = dict.get(personalityAttrName);
|
|
usedKeys.insert(personalityAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for personality in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `personality` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.garbageCollector;
|
|
auto garbageCollectorAttrName = ::mlir::StringAttr::get(ctx, "garbageCollector");
|
|
auto attr = dict.get(garbageCollectorAttrName);
|
|
usedKeys.insert(garbageCollectorAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for garbageCollector in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `garbageCollector` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.passthrough;
|
|
auto passthroughAttrName = ::mlir::StringAttr::get(ctx, "passthrough");
|
|
auto attr = dict.get(passthroughAttrName);
|
|
usedKeys.insert(passthroughAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for passthrough in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `passthrough` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arg_attrs;
|
|
auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs");
|
|
auto attr = dict.get(arg_attrsAttrName);
|
|
usedKeys.insert(arg_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.res_attrs;
|
|
auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs");
|
|
auto attr = dict.get(res_attrsAttrName);
|
|
usedKeys.insert(res_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.function_entry_count;
|
|
auto function_entry_countAttrName = ::mlir::StringAttr::get(ctx, "function_entry_count");
|
|
auto attr = dict.get(function_entry_countAttrName);
|
|
usedKeys.insert(function_entry_countAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for function_entry_count in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `function_entry_count` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.memory_effects;
|
|
auto memory_effectsAttrName = ::mlir::StringAttr::get(ctx, "memory_effects");
|
|
auto attr = dict.get(memory_effectsAttrName);
|
|
usedKeys.insert(memory_effectsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for memory_effects in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `memory_effects` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.visibility_;
|
|
auto visibility_AttrName = ::mlir::StringAttr::get(ctx, "visibility_");
|
|
auto attr = dict.get(visibility_AttrName);
|
|
usedKeys.insert(visibility_AttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for visibility_ in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `visibility_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_streaming;
|
|
auto arm_streamingAttrName = ::mlir::StringAttr::get(ctx, "arm_streaming");
|
|
auto attr = dict.get(arm_streamingAttrName);
|
|
usedKeys.insert(arm_streamingAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_streaming in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_streaming` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_locally_streaming;
|
|
auto arm_locally_streamingAttrName = ::mlir::StringAttr::get(ctx, "arm_locally_streaming");
|
|
auto attr = dict.get(arm_locally_streamingAttrName);
|
|
usedKeys.insert(arm_locally_streamingAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_locally_streaming in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_locally_streaming` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_streaming_compatible;
|
|
auto arm_streaming_compatibleAttrName = ::mlir::StringAttr::get(ctx, "arm_streaming_compatible");
|
|
auto attr = dict.get(arm_streaming_compatibleAttrName);
|
|
usedKeys.insert(arm_streaming_compatibleAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_streaming_compatible in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_streaming_compatible` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_new_za;
|
|
auto arm_new_zaAttrName = ::mlir::StringAttr::get(ctx, "arm_new_za");
|
|
auto attr = dict.get(arm_new_zaAttrName);
|
|
usedKeys.insert(arm_new_zaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_new_za in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_new_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_in_za;
|
|
auto arm_in_zaAttrName = ::mlir::StringAttr::get(ctx, "arm_in_za");
|
|
auto attr = dict.get(arm_in_zaAttrName);
|
|
usedKeys.insert(arm_in_zaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_in_za in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_in_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_out_za;
|
|
auto arm_out_zaAttrName = ::mlir::StringAttr::get(ctx, "arm_out_za");
|
|
auto attr = dict.get(arm_out_zaAttrName);
|
|
usedKeys.insert(arm_out_zaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_out_za in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_out_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_inout_za;
|
|
auto arm_inout_zaAttrName = ::mlir::StringAttr::get(ctx, "arm_inout_za");
|
|
auto attr = dict.get(arm_inout_zaAttrName);
|
|
usedKeys.insert(arm_inout_zaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_inout_za in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_inout_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.arm_preserves_za;
|
|
auto arm_preserves_zaAttrName = ::mlir::StringAttr::get(ctx, "arm_preserves_za");
|
|
auto attr = dict.get(arm_preserves_zaAttrName);
|
|
usedKeys.insert(arm_preserves_zaAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for arm_preserves_za in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `arm_preserves_za` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.section;
|
|
auto sectionAttrName = ::mlir::StringAttr::get(ctx, "section");
|
|
auto attr = dict.get(sectionAttrName);
|
|
usedKeys.insert(sectionAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for section in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `section` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.unnamed_addr;
|
|
auto unnamed_addrAttrName = ::mlir::StringAttr::get(ctx, "unnamed_addr");
|
|
auto attr = dict.get(unnamed_addrAttrName);
|
|
usedKeys.insert(unnamed_addrAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for unnamed_addr in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.alignment;
|
|
auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment");
|
|
auto attr = dict.get(alignmentAttrName);
|
|
usedKeys.insert(alignmentAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for alignment in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.vscale_range;
|
|
auto vscale_rangeAttrName = ::mlir::StringAttr::get(ctx, "vscale_range");
|
|
auto attr = dict.get(vscale_rangeAttrName);
|
|
usedKeys.insert(vscale_rangeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for vscale_range in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `vscale_range` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.frame_pointer;
|
|
auto frame_pointerAttrName = ::mlir::StringAttr::get(ctx, "frame_pointer");
|
|
auto attr = dict.get(frame_pointerAttrName);
|
|
usedKeys.insert(frame_pointerAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for frame_pointer in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `frame_pointer` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.target_cpu;
|
|
auto target_cpuAttrName = ::mlir::StringAttr::get(ctx, "target_cpu");
|
|
auto attr = dict.get(target_cpuAttrName);
|
|
usedKeys.insert(target_cpuAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for target_cpu in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_cpu` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.tune_cpu;
|
|
auto tune_cpuAttrName = ::mlir::StringAttr::get(ctx, "tune_cpu");
|
|
auto attr = dict.get(tune_cpuAttrName);
|
|
usedKeys.insert(tune_cpuAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for tune_cpu in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tune_cpu` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.reciprocal_estimates;
|
|
auto reciprocal_estimatesAttrName = ::mlir::StringAttr::get(ctx, "reciprocal_estimates");
|
|
auto attr = dict.get(reciprocal_estimatesAttrName);
|
|
usedKeys.insert(reciprocal_estimatesAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for reciprocal_estimates in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reciprocal_estimates` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.prefer_vector_width;
|
|
auto prefer_vector_widthAttrName = ::mlir::StringAttr::get(ctx, "prefer_vector_width");
|
|
auto attr = dict.get(prefer_vector_widthAttrName);
|
|
usedKeys.insert(prefer_vector_widthAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for prefer_vector_width in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `prefer_vector_width` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.target_features;
|
|
auto target_featuresAttrName = ::mlir::StringAttr::get(ctx, "target_features");
|
|
auto attr = dict.get(target_featuresAttrName);
|
|
usedKeys.insert(target_featuresAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for target_features in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target_features` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_signed_zeros_fp_math;
|
|
auto no_signed_zeros_fp_mathAttrName = ::mlir::StringAttr::get(ctx, "no_signed_zeros_fp_math");
|
|
auto attr = dict.get(no_signed_zeros_fp_mathAttrName);
|
|
usedKeys.insert(no_signed_zeros_fp_mathAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_signed_zeros_fp_math in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_signed_zeros_fp_math` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.denormal_fpenv;
|
|
auto denormal_fpenvAttrName = ::mlir::StringAttr::get(ctx, "denormal_fpenv");
|
|
auto attr = dict.get(denormal_fpenvAttrName);
|
|
usedKeys.insert(denormal_fpenvAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for denormal_fpenv in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `denormal_fpenv` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fp_contract;
|
|
auto fp_contractAttrName = ::mlir::StringAttr::get(ctx, "fp_contract");
|
|
auto attr = dict.get(fp_contractAttrName);
|
|
usedKeys.insert(fp_contractAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fp_contract in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fp_contract` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.instrument_function_entry;
|
|
auto instrument_function_entryAttrName = ::mlir::StringAttr::get(ctx, "instrument_function_entry");
|
|
auto attr = dict.get(instrument_function_entryAttrName);
|
|
usedKeys.insert(instrument_function_entryAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for instrument_function_entry in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `instrument_function_entry` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.instrument_function_exit;
|
|
auto instrument_function_exitAttrName = ::mlir::StringAttr::get(ctx, "instrument_function_exit");
|
|
auto attr = dict.get(instrument_function_exitAttrName);
|
|
usedKeys.insert(instrument_function_exitAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for instrument_function_exit in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `instrument_function_exit` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_inline;
|
|
auto no_inlineAttrName = ::mlir::StringAttr::get(ctx, "no_inline");
|
|
auto attr = dict.get(no_inlineAttrName);
|
|
usedKeys.insert(no_inlineAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_inline in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.always_inline;
|
|
auto always_inlineAttrName = ::mlir::StringAttr::get(ctx, "always_inline");
|
|
auto attr = dict.get(always_inlineAttrName);
|
|
usedKeys.insert(always_inlineAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for always_inline in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `always_inline` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.inline_hint;
|
|
auto inline_hintAttrName = ::mlir::StringAttr::get(ctx, "inline_hint");
|
|
auto attr = dict.get(inline_hintAttrName);
|
|
usedKeys.insert(inline_hintAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for inline_hint in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `inline_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_unwind;
|
|
auto no_unwindAttrName = ::mlir::StringAttr::get(ctx, "no_unwind");
|
|
auto attr = dict.get(no_unwindAttrName);
|
|
usedKeys.insert(no_unwindAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_unwind in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_unwind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.will_return;
|
|
auto will_returnAttrName = ::mlir::StringAttr::get(ctx, "will_return");
|
|
auto attr = dict.get(will_returnAttrName);
|
|
usedKeys.insert(will_returnAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for will_return in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `will_return` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.noreturn;
|
|
auto noreturnAttrName = ::mlir::StringAttr::get(ctx, "noreturn");
|
|
auto attr = dict.get(noreturnAttrName);
|
|
usedKeys.insert(noreturnAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for noreturn in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noreturn` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.optimize_none;
|
|
auto optimize_noneAttrName = ::mlir::StringAttr::get(ctx, "optimize_none");
|
|
auto attr = dict.get(optimize_noneAttrName);
|
|
usedKeys.insert(optimize_noneAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for optimize_none in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optimize_none` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.returns_twice;
|
|
auto returns_twiceAttrName = ::mlir::StringAttr::get(ctx, "returns_twice");
|
|
auto attr = dict.get(returns_twiceAttrName);
|
|
usedKeys.insert(returns_twiceAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for returns_twice in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `returns_twice` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.hot;
|
|
auto hotAttrName = ::mlir::StringAttr::get(ctx, "hot");
|
|
auto attr = dict.get(hotAttrName);
|
|
usedKeys.insert(hotAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for hot in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `hot` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.cold;
|
|
auto coldAttrName = ::mlir::StringAttr::get(ctx, "cold");
|
|
auto attr = dict.get(coldAttrName);
|
|
usedKeys.insert(coldAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for cold in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cold` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.noduplicate;
|
|
auto noduplicateAttrName = ::mlir::StringAttr::get(ctx, "noduplicate");
|
|
auto attr = dict.get(noduplicateAttrName);
|
|
usedKeys.insert(noduplicateAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for noduplicate in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noduplicate` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.no_caller_saved_registers;
|
|
auto no_caller_saved_registersAttrName = ::mlir::StringAttr::get(ctx, "no_caller_saved_registers");
|
|
auto attr = dict.get(no_caller_saved_registersAttrName);
|
|
usedKeys.insert(no_caller_saved_registersAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for no_caller_saved_registers in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `no_caller_saved_registers` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.nocallback;
|
|
auto nocallbackAttrName = ::mlir::StringAttr::get(ctx, "nocallback");
|
|
auto attr = dict.get(nocallbackAttrName);
|
|
usedKeys.insert(nocallbackAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for nocallback in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nocallback` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.modular_format;
|
|
auto modular_formatAttrName = ::mlir::StringAttr::get(ctx, "modular_format");
|
|
auto attr = dict.get(modular_formatAttrName);
|
|
usedKeys.insert(modular_formatAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for modular_format in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `modular_format` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.nobuiltins;
|
|
auto nobuiltinsAttrName = ::mlir::StringAttr::get(ctx, "nobuiltins");
|
|
auto attr = dict.get(nobuiltinsAttrName);
|
|
usedKeys.insert(nobuiltinsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for nobuiltins in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nobuiltins` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.allocsize;
|
|
auto allocsizeAttrName = ::mlir::StringAttr::get(ctx, "allocsize");
|
|
auto attr = dict.get(allocsizeAttrName);
|
|
usedKeys.insert(allocsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for allocsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `allocsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.optsize;
|
|
auto optsizeAttrName = ::mlir::StringAttr::get(ctx, "optsize");
|
|
auto attr = dict.get(optsizeAttrName);
|
|
usedKeys.insert(optsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for optsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `optsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.minsize;
|
|
auto minsizeAttrName = ::mlir::StringAttr::get(ctx, "minsize");
|
|
auto attr = dict.get(minsizeAttrName);
|
|
usedKeys.insert(minsizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for minsize in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `minsize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.save_reg_params;
|
|
auto save_reg_paramsAttrName = ::mlir::StringAttr::get(ctx, "save_reg_params");
|
|
auto attr = dict.get(save_reg_paramsAttrName);
|
|
usedKeys.insert(save_reg_paramsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for save_reg_params in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `save_reg_params` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.zero_call_used_regs;
|
|
auto zero_call_used_regsAttrName = ::mlir::StringAttr::get(ctx, "zero_call_used_regs");
|
|
auto attr = dict.get(zero_call_used_regsAttrName);
|
|
usedKeys.insert(zero_call_used_regsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for zero_call_used_regs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `zero_call_used_regs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.default_func_attrs;
|
|
auto default_func_attrsAttrName = ::mlir::StringAttr::get(ctx, "default_func_attrs");
|
|
auto attr = dict.get(default_func_attrsAttrName);
|
|
usedKeys.insert(default_func_attrsAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for default_func_attrs in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `default_func_attrs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.vec_type_hint;
|
|
auto vec_type_hintAttrName = ::mlir::StringAttr::get(ctx, "vec_type_hint");
|
|
auto attr = dict.get(vec_type_hintAttrName);
|
|
usedKeys.insert(vec_type_hintAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for vec_type_hint in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `vec_type_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.work_group_size_hint;
|
|
auto work_group_size_hintAttrName = ::mlir::StringAttr::get(ctx, "work_group_size_hint");
|
|
auto attr = dict.get(work_group_size_hintAttrName);
|
|
usedKeys.insert(work_group_size_hintAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for work_group_size_hint in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `work_group_size_hint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.reqd_work_group_size;
|
|
auto reqd_work_group_sizeAttrName = ::mlir::StringAttr::get(ctx, "reqd_work_group_size");
|
|
auto attr = dict.get(reqd_work_group_sizeAttrName);
|
|
usedKeys.insert(reqd_work_group_sizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for reqd_work_group_size in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reqd_work_group_size` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.intel_reqd_sub_group_size;
|
|
auto intel_reqd_sub_group_sizeAttrName = ::mlir::StringAttr::get(ctx, "intel_reqd_sub_group_size");
|
|
auto attr = dict.get(intel_reqd_sub_group_sizeAttrName);
|
|
usedKeys.insert(intel_reqd_sub_group_sizeAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for intel_reqd_sub_group_size in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `intel_reqd_sub_group_size` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.uwtable_kind;
|
|
auto uwtable_kindAttrName = ::mlir::StringAttr::get(ctx, "uwtable_kind");
|
|
auto attr = dict.get(uwtable_kindAttrName);
|
|
usedKeys.insert(uwtable_kindAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for uwtable_kind in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `uwtable_kind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.use_sample_profile;
|
|
auto use_sample_profileAttrName = ::mlir::StringAttr::get(ctx, "use_sample_profile");
|
|
auto attr = dict.get(use_sample_profileAttrName);
|
|
usedKeys.insert(use_sample_profileAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for use_sample_profile in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `use_sample_profile` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFuncOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::LLVMFuncOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::LShrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LShrOpGenericAdaptorBase::LShrOpGenericAdaptorBase(LShrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr LShrOpGenericAdaptorBase::getIsExactAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isExact);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LShrOpGenericAdaptorBase::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
LShrOpAdaptor::LShrOpAdaptor(LShrOp op) : LShrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LShrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (tblgen_isExact && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isExact))))
|
|
return emitError(loc, "'llvm.lshr' op attribute 'isExact' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.isExact;
|
|
auto attr = dict.get("isExact");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `isExact` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LShrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.isExact;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("isExact",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LShrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.isExact.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LShrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "isExact")
|
|
return prop.isExact;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LShrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "isExact") {
|
|
prop.isExact = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.isExact)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void LShrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.isExact) attrs.append("isExact", prop.isExact);
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsExactAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "isExact", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.isExact)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LShrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.isExact);
|
|
}
|
|
|
|
bool LShrOp::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void LShrOp::setIsExact(bool attrValue) {
|
|
auto &odsProp = getProperties().isExact;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<LShrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<LShrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LShrOp LShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::verifyInvariantsImpl() {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_isExact, "isExact")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult LShrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult LShrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("exact"))) {
|
|
result.getOrAddProperties<LShrOp::Properties>().isExact = parser.getBuilder().getUnitAttr(); }
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LShrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getIsExactAttr() && getIsExactAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "exact";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("isExact");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsExactAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("isExact");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void LShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LShrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::LShrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::LandingpadOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LandingpadOpGenericAdaptorBase::LandingpadOpGenericAdaptorBase(LandingpadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> LandingpadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::UnitAttr LandingpadOpGenericAdaptorBase::getCleanupAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().cleanup);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LandingpadOpGenericAdaptorBase::getCleanup() {
|
|
auto attr = getCleanupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
LandingpadOpAdaptor::LandingpadOpAdaptor(LandingpadOp op) : LandingpadOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LandingpadOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_cleanup = getProperties().cleanup; (void)tblgen_cleanup;
|
|
|
|
if (tblgen_cleanup && !((::llvm::isa<::mlir::UnitAttr>(tblgen_cleanup))))
|
|
return emitError(loc, "'llvm.landingpad' op attribute 'cleanup' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> LandingpadOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cleanup;
|
|
auto attr = dict.get("cleanup");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cleanup` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LandingpadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.cleanup;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cleanup",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LandingpadOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.cleanup.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LandingpadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "cleanup")
|
|
return prop.cleanup;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LandingpadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "cleanup") {
|
|
prop.cleanup = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cleanup)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void LandingpadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.cleanup) attrs.append("cleanup", prop.cleanup);
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCleanupAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "cleanup", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cleanup)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LandingpadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.cleanup);
|
|
}
|
|
|
|
bool LandingpadOp::getCleanup() {
|
|
auto attr = getCleanupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void LandingpadOp::setCleanup(bool attrValue) {
|
|
auto &odsProp = getProperties().cleanup;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
odsState.addOperands(odsArg_0);
|
|
if (cleanup) {
|
|
odsState.getOrAddProperties<Properties>().cleanup = cleanup;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
odsState.addOperands(odsArg_0);
|
|
if (cleanup) {
|
|
odsState.getOrAddProperties<Properties>().cleanup = cleanup;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
odsState.addOperands(odsArg_0);
|
|
if (cleanup) {
|
|
odsState.getOrAddProperties<Properties>().cleanup = ((cleanup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
odsState.addOperands(odsArg_0);
|
|
if (cleanup) {
|
|
odsState.getOrAddProperties<Properties>().cleanup = ((cleanup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(cleanup)>(cleanup), std::forward<decltype(odsArg_0)>(odsArg_0));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<LandingpadOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LandingpadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LandingpadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LandingpadOp LandingpadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::verifyInvariantsImpl() {
|
|
auto tblgen_cleanup = getProperties().cleanup; (void)tblgen_cleanup;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_cleanup, "cleanup")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult LandingpadOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
// keep track of used keys in the input dictionary to be able to error out
|
|
// if there are some unknown ones.
|
|
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
|
|
::mlir::MLIRContext *ctx = dict.getContext();
|
|
(void)ctx;
|
|
{
|
|
|
|
auto &propStorage = prop.cleanup;
|
|
auto cleanupAttrName = ::mlir::StringAttr::get(ctx, "cleanup");
|
|
auto attr = dict.get(cleanupAttrName);
|
|
usedKeys.insert(cleanupAttrName);
|
|
if (attr || /*isRequired=*/false) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for cleanup in DictionaryAttr to set "
|
|
"Properties.";
|
|
return ::mlir::failure();
|
|
}
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cleanup` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
for (::mlir::NamedAttribute attr : dict) {
|
|
if (!usedKeys.contains(attr.getName()))
|
|
return emitError() << "unknown key '" << attr.getName() <<
|
|
"' when parsing properties dictionary";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LandingpadOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::LandingpadOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::LinkerOptionsOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LinkerOptionsOpGenericAdaptorBase::LinkerOptionsOpGenericAdaptorBase(LinkerOptionsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::ArrayAttr LinkerOptionsOpGenericAdaptorBase::getOptions() {
|
|
auto attr = getOptionsAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
LinkerOptionsOpAdaptor::LinkerOptionsOpAdaptor(LinkerOptionsOp op) : LinkerOptionsOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_options = getProperties().options; (void)tblgen_options;
|
|
if (!tblgen_options) return emitError(loc, "'llvm.linker_options' op requires attribute 'options'");
|
|
|
|
if (tblgen_options && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_options))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_options), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.linker_options' op attribute 'options' failed to satisfy constraint: string array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.options;
|
|
auto attr = dict.get("options");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `options` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LinkerOptionsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.options;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("options",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LinkerOptionsOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.options.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LinkerOptionsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "options")
|
|
return prop.options;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LinkerOptionsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "options") {
|
|
prop.options = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.options)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void LinkerOptionsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.options) attrs.append("options", prop.options);
|
|
}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOptionsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps46(attr, "options", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.options)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LinkerOptionsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.options);
|
|
}
|
|
|
|
::mlir::ArrayAttr LinkerOptionsOp::getOptions() {
|
|
auto attr = getOptionsAttr();
|
|
return attr;
|
|
}
|
|
|
|
void LinkerOptionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr options) {
|
|
odsState.getOrAddProperties<Properties>().options = options;
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ArrayAttr options) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(options)>(options));
|
|
auto __res__ = ::llvm::dyn_cast<LinkerOptionsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ArrayAttr options) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(options)>(options));
|
|
}
|
|
|
|
void LinkerOptionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr options) {
|
|
odsState.getOrAddProperties<Properties>().options = options;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr options) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(options)>(options));
|
|
auto __res__ = ::llvm::dyn_cast<LinkerOptionsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr options) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(options)>(options));
|
|
}
|
|
|
|
void LinkerOptionsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<LinkerOptionsOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LinkerOptionsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LinkerOptionsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LinkerOptionsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LinkerOptionsOp LinkerOptionsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOp::verifyInvariantsImpl() {
|
|
auto tblgen_options = getProperties().options; (void)tblgen_options;
|
|
if (!tblgen_options) return emitOpError("requires attribute 'options'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps46(*this, tblgen_options, "options")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LinkerOptionsOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult LinkerOptionsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::ArrayAttr optionsAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(optionsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (optionsAttr) result.getOrAddProperties<LinkerOptionsOp::Properties>().options = optionsAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LinkerOptionsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getOptionsAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("options");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkerOptionsOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::LinkerOptionsOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::LoadOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(LoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::std::optional<uint64_t> LoadOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr LoadOpGenericAdaptorBase::getVolatile_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LoadOpGenericAdaptorBase::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LoadOpGenericAdaptorBase::getNontemporalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LoadOpGenericAdaptorBase::getNontemporal() {
|
|
auto attr = getNontemporalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LoadOpGenericAdaptorBase::getInvariantAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().invariant);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LoadOpGenericAdaptorBase::getInvariant() {
|
|
auto attr = getInvariantAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr LoadOpGenericAdaptorBase::getInvariantGroupAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().invariantGroup);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool LoadOpGenericAdaptorBase::getInvariantGroup() {
|
|
auto attr = getInvariantGroupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrderingAttr LoadOpGenericAdaptorBase::getOrderingAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering LoadOpGenericAdaptorBase::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LoadOpGenericAdaptorBase::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::DereferenceableAttr> LoadOpGenericAdaptorBase::getDereferenceable() {
|
|
auto attr = getDereferenceableAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DereferenceableAttr>(::llvm::cast<::mlir::LLVM::DereferenceableAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
LoadOpAdaptor::LoadOpAdaptor(LoadOp op) : LoadOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LoadOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_dereferenceable = getProperties().dereferenceable; (void)tblgen_dereferenceable;
|
|
auto tblgen_invariant = getProperties().invariant; (void)tblgen_invariant;
|
|
auto tblgen_invariantGroup = getProperties().invariantGroup; (void)tblgen_invariantGroup;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_))))
|
|
return emitError(loc, "'llvm.load' op attribute 'volatile_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_nontemporal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nontemporal))))
|
|
return emitError(loc, "'llvm.load' op attribute 'nontemporal' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_invariant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_invariant))))
|
|
return emitError(loc, "'llvm.load' op attribute 'invariant' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_invariantGroup && !((::llvm::isa<::mlir::UnitAttr>(tblgen_invariantGroup))))
|
|
return emitError(loc, "'llvm.load' op attribute 'invariantGroup' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering))))
|
|
return emitError(loc, "'llvm.load' op attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope))))
|
|
return emitError(loc, "'llvm.load' op attribute 'syncscope' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_dereferenceable && !((::llvm::isa<::mlir::LLVM::DereferenceableAttr>(tblgen_dereferenceable))))
|
|
return emitError(loc, "'llvm.load' op attribute 'dereferenceable' failed to satisfy constraint: LLVM dereferenceable attribute");
|
|
|
|
if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.load' op attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array");
|
|
|
|
if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.load' op attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.load' op attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.load' op attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.access_groups;
|
|
auto attr = dict.get("access_groups");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto attr = dict.get("alias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.dereferenceable;
|
|
auto attr = dict.get("dereferenceable");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `dereferenceable` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.invariant;
|
|
auto attr = dict.get("invariant");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `invariant` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.invariantGroup;
|
|
auto attr = dict.get("invariantGroup");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `invariantGroup` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto attr = dict.get("noalias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nontemporal;
|
|
auto attr = dict.get("nontemporal");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ordering;
|
|
auto attr = dict.get("ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.syncscope;
|
|
auto attr = dict.get("syncscope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `syncscope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tbaa;
|
|
auto attr = dict.get("tbaa");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.volatile_;
|
|
auto attr = dict.get("volatile_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `volatile_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.access_groups;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("access_groups",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.dereferenceable;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("dereferenceable",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.invariant;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("invariant",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.invariantGroup;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("invariantGroup",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noalias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nontemporal;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nontemporal",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.syncscope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("syncscope",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tbaa;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tbaa",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.volatile_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("volatile_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LoadOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.access_groups.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.dereferenceable.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.invariant.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.invariantGroup.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nontemporal.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.syncscope.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tbaa.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.volatile_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "access_groups")
|
|
return prop.access_groups;
|
|
|
|
if (name == "alias_scopes")
|
|
return prop.alias_scopes;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "dereferenceable")
|
|
return prop.dereferenceable;
|
|
|
|
if (name == "invariant")
|
|
return prop.invariant;
|
|
|
|
if (name == "invariantGroup")
|
|
return prop.invariantGroup;
|
|
|
|
if (name == "noalias_scopes")
|
|
return prop.noalias_scopes;
|
|
|
|
if (name == "nontemporal")
|
|
return prop.nontemporal;
|
|
|
|
if (name == "ordering")
|
|
return prop.ordering;
|
|
|
|
if (name == "syncscope")
|
|
return prop.syncscope;
|
|
|
|
if (name == "tbaa")
|
|
return prop.tbaa;
|
|
|
|
if (name == "volatile_")
|
|
return prop.volatile_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "access_groups") {
|
|
prop.access_groups = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.access_groups)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alias_scopes") {
|
|
prop.alias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "dereferenceable") {
|
|
prop.dereferenceable = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dereferenceable)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "invariant") {
|
|
prop.invariant = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.invariant)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "invariantGroup") {
|
|
prop.invariantGroup = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.invariantGroup)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noalias_scopes") {
|
|
prop.noalias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noalias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nontemporal") {
|
|
prop.nontemporal = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nontemporal)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "ordering") {
|
|
prop.ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "syncscope") {
|
|
prop.syncscope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.syncscope)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tbaa") {
|
|
prop.tbaa = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tbaa)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "volatile_") {
|
|
prop.volatile_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.volatile_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void LoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.access_groups) attrs.append("access_groups", prop.access_groups);
|
|
|
|
if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.dereferenceable) attrs.append("dereferenceable", prop.dereferenceable);
|
|
|
|
if (prop.invariant) attrs.append("invariant", prop.invariant);
|
|
|
|
if (prop.invariantGroup) attrs.append("invariantGroup", prop.invariantGroup);
|
|
|
|
if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes);
|
|
|
|
if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal);
|
|
|
|
if (prop.ordering) attrs.append("ordering", prop.ordering);
|
|
|
|
if (prop.syncscope) attrs.append("syncscope", prop.syncscope);
|
|
|
|
if (prop.tbaa) attrs.append("tbaa", prop.tbaa);
|
|
|
|
if (prop.volatile_) attrs.append("volatile_", prop.volatile_);
|
|
}
|
|
|
|
::llvm::LogicalResult LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "access_groups", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "alias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDereferenceableAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps37(attr, "dereferenceable", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInvariantAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "invariant", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInvariantGroupAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "invariantGroup", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "noalias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nontemporal", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "syncscope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "tbaa", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "volatile_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.dereferenceable)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.invariant)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.invariantGroup)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.access_groups);
|
|
|
|
writer.writeOptionalAttribute(prop.alias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
|
|
writer.writeOptionalAttribute(prop.dereferenceable);
|
|
|
|
writer.writeOptionalAttribute(prop.invariant);
|
|
|
|
writer.writeOptionalAttribute(prop.invariantGroup);
|
|
|
|
writer.writeOptionalAttribute(prop.noalias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.nontemporal);
|
|
|
|
writer.writeOptionalAttribute(prop.ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.syncscope);
|
|
|
|
writer.writeOptionalAttribute(prop.tbaa);
|
|
|
|
writer.writeOptionalAttribute(prop.volatile_);
|
|
}
|
|
|
|
::std::optional<uint64_t> LoadOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
bool LoadOp::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LoadOp::getNontemporal() {
|
|
auto attr = getNontemporalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LoadOp::getInvariant() {
|
|
auto attr = getInvariantAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool LoadOp::getInvariantGroup() {
|
|
auto attr = getInvariantGroupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering LoadOp::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > LoadOp::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<::mlir::LLVM::DereferenceableAttr> LoadOp::getDereferenceable() {
|
|
auto attr = getDereferenceableAttr();
|
|
return attr ? ::std::optional<::mlir::LLVM::DereferenceableAttr>(::llvm::cast<::mlir::LLVM::DereferenceableAttr>(attr)) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOp::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOp::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOp::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > LoadOp::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void LoadOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LoadOp::setVolatile_(bool attrValue) {
|
|
auto &odsProp = getProperties().volatile_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LoadOp::setNontemporal(bool attrValue) {
|
|
auto &odsProp = getProperties().nontemporal;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LoadOp::setInvariant(bool attrValue) {
|
|
auto &odsProp = getProperties().invariant;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LoadOp::setInvariantGroup(bool attrValue) {
|
|
auto &odsProp = getProperties().invariantGroup;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void LoadOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void LoadOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().syncscope;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, Value addr, unsigned alignment, bool isVolatile, bool isNonTemporal, bool isInvariant, bool isInvariantGroup, AtomicOrdering ordering, StringRef syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(type)>(type), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile), std::forward<decltype(isNonTemporal)>(isNonTemporal), std::forward<decltype(isInvariant)>(isInvariant), std::forward<decltype(isInvariantGroup)>(isInvariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, Value addr, unsigned alignment, bool isVolatile, bool isNonTemporal, bool isInvariant, bool isInvariantGroup, AtomicOrdering ordering, StringRef syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(type)>(type), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile), std::forward<decltype(isNonTemporal)>(isNonTemporal), std::forward<decltype(isInvariant)>(isInvariant), std::forward<decltype(isInvariantGroup)>(isInvariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = nontemporal;
|
|
}
|
|
if (invariant) {
|
|
odsState.getOrAddProperties<Properties>().invariant = invariant;
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = invariantGroup;
|
|
}
|
|
if (ordering) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
}
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = nontemporal;
|
|
}
|
|
if (invariant) {
|
|
odsState.getOrAddProperties<Properties>().invariant = invariant;
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = invariantGroup;
|
|
}
|
|
if (ordering) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
}
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariant, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariant) {
|
|
odsState.getOrAddProperties<Properties>().invariant = ((invariant) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = ((invariantGroup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariant) {
|
|
odsState.getOrAddProperties<Properties>().invariant = ((invariant) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = ((invariantGroup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (dereferenceable) {
|
|
odsState.getOrAddProperties<Properties>().dereferenceable = dereferenceable;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariant, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::LLVM::DereferenceableAttr dereferenceable, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariant)>(invariant), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(dereferenceable)>(dereferenceable), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<LoadOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void LoadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.ordering)
|
|
properties.ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic);
|
|
}
|
|
|
|
::llvm::LogicalResult LoadOp::verifyInvariantsImpl() {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_dereferenceable = getProperties().dereferenceable; (void)tblgen_dereferenceable;
|
|
auto tblgen_invariant = getProperties().invariant; (void)tblgen_invariant;
|
|
auto tblgen_invariantGroup = getProperties().invariantGroup; (void)tblgen_invariantGroup;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_volatile_, "volatile_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nontemporal, "nontemporal")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_invariant, "invariant")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_invariantGroup, "invariantGroup")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_ordering, "ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_syncscope, "syncscope")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps37(*this, tblgen_dereferenceable, "dereferenceable")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_access_groups, "access_groups")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_alias_scopes, "alias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_noalias_scopes, "noalias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_tbaa, "tbaa")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps20(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LoadOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult LoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand addrRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(&addrRawOperand, 1); ::llvm::SMLoc addrOperandsLoc;
|
|
(void)addrOperandsLoc;
|
|
::mlir::StringAttr syncscopeAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr orderingAttr;
|
|
::mlir::LLVM::DereferenceableAttr dereferenceableAttr;
|
|
::mlir::Type addrRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> addrTypes(&addrRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) {
|
|
result.getOrAddProperties<LoadOp::Properties>().volatile_ = parser.getBuilder().getUnitAttr(); }
|
|
|
|
addrOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(addrRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("atomic"))) {
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (syncscopeAttr) result.getOrAddProperties<LoadOp::Properties>().syncscope = syncscopeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<LoadOp::Properties>().ordering = orderingAttr;
|
|
}
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("invariant"))) {
|
|
result.getOrAddProperties<LoadOp::Properties>().invariant = parser.getBuilder().getUnitAttr(); }
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("invariant_group"))) {
|
|
result.getOrAddProperties<LoadOp::Properties>().invariantGroup = parser.getBuilder().getUnitAttr(); }
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("dereferenceable"))) {
|
|
|
|
if (parser.parseCustomAttributeWithFallback(dereferenceableAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (dereferenceableAttr) result.getOrAddProperties<LoadOp::Properties>().dereferenceable = dereferenceableAttr;
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(addrRawType))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getVolatile_Attr() && getVolatile_Attr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "volatile";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getAddr();
|
|
if (getOrderingAttr() != ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), AtomicOrdering::not_atomic)) {
|
|
_odsPrinter << ' ' << "atomic";
|
|
if (getSyncscopeAttr()) {
|
|
_odsPrinter << ' ' << "syncscope";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getSyncscopeAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
}
|
|
if ((getInvariantAttr() && getInvariantAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "invariant";
|
|
}
|
|
if ((getInvariantGroupAttr() && getInvariantGroupAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "invariant_group";
|
|
}
|
|
if (getDereferenceableAttr()) {
|
|
_odsPrinter << ' ' << "dereferenceable";
|
|
_odsPrinter.printStrippedAttrOrType(getDereferenceableAttr());
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("volatile_");
|
|
elidedAttrs.push_back("syncscope");
|
|
elidedAttrs.push_back("ordering");
|
|
elidedAttrs.push_back("invariant");
|
|
elidedAttrs.push_back("invariantGroup");
|
|
elidedAttrs.push_back("dereferenceable");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getVolatile_Attr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("volatile_");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNontemporalAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("nontemporal");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getInvariantAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("invariant");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getInvariantGroupAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("invariantGroup");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getOrderingAttr();
|
|
if(attr && (attr == ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic)))
|
|
elidedAttrs.push_back("ordering");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getAddr().getType();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoadOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::LoadOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::MetadataAsValueOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MetadataAsValueOpGenericAdaptorBase::MetadataAsValueOpGenericAdaptorBase(MetadataAsValueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::Attribute MetadataAsValueOpGenericAdaptorBase::getMetadata() {
|
|
auto attr = getMetadataAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MetadataAsValueOpAdaptor::MetadataAsValueOpAdaptor(MetadataAsValueOp op) : MetadataAsValueOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_metadata = getProperties().metadata; (void)tblgen_metadata;
|
|
if (!tblgen_metadata) return emitError(loc, "'llvm.mlir.metadata_as_value' op requires attribute 'metadata'");
|
|
|
|
if (tblgen_metadata && !(((::llvm::isa<::mlir::LLVM::MDStringAttr>(tblgen_metadata))) || ((::llvm::isa<::mlir::LLVM::MDConstantAttr>(tblgen_metadata))) || ((::llvm::isa<::mlir::LLVM::MDFuncAttr>(tblgen_metadata))) || ((::llvm::isa<::mlir::LLVM::MDNodeAttr>(tblgen_metadata)))))
|
|
return emitError(loc, "'llvm.mlir.metadata_as_value' op attribute 'metadata' failed to satisfy constraint: LLVM metadata attribute (md_string, md_const, md_func, or md_node)");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.metadata;
|
|
auto attr = dict.get("metadata");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `metadata` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MetadataAsValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.metadata;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("metadata",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MetadataAsValueOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.metadata.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MetadataAsValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "metadata")
|
|
return prop.metadata;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MetadataAsValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "metadata") {
|
|
prop.metadata = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.metadata)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MetadataAsValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.metadata) attrs.append("metadata", prop.metadata);
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMetadataAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps47(attr, "metadata", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.metadata)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MetadataAsValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.metadata);
|
|
}
|
|
|
|
::mlir::Attribute MetadataAsValueOp::getMetadata() {
|
|
auto attr = getMetadataAttr();
|
|
return attr;
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute metadata) {
|
|
build(odsBuilder, odsState,
|
|
::mlir::LLVM::LLVMMetadataType::get(odsBuilder.getContext()),
|
|
metadata);
|
|
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Attribute metadata) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(metadata)>(metadata));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Attribute metadata) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(metadata)>(metadata));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Attribute metadata) {
|
|
odsState.getOrAddProperties<Properties>().metadata = metadata;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Attribute metadata) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(metadata)>(metadata));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Attribute metadata) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(metadata)>(metadata));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute metadata) {
|
|
odsState.getOrAddProperties<Properties>().metadata = metadata;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute metadata) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata)>(metadata));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute metadata) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata)>(metadata));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MetadataAsValueOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MetadataAsValueOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MetadataAsValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MetadataAsValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MetadataAsValueOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MetadataAsValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MetadataAsValueOp MetadataAsValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::verifyInvariantsImpl() {
|
|
auto tblgen_metadata = getProperties().metadata; (void)tblgen_metadata;
|
|
if (!tblgen_metadata) return emitOpError("requires attribute 'metadata'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps47(*this, tblgen_metadata, "metadata")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps21(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult MetadataAsValueOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = ::mlir::LLVM::LLVMMetadataType::get(odsBuilder.getContext());
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult MetadataAsValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Attribute metadataAttr;
|
|
|
|
if (parser.parseAttribute(metadataAttr, ::mlir::Type{}))
|
|
return ::mlir::failure();
|
|
if (metadataAttr) result.getOrAddProperties<MetadataAsValueOp::Properties>().metadata = metadataAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
::mlir::Type odsBuildableType0 = ::mlir::LLVM::LLVMMetadataType::get(parser.getBuilder().getContext());
|
|
result.addTypes(odsBuildableType0);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MetadataAsValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttribute(getMetadataAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("metadata");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void MetadataAsValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MetadataAsValueOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::MetadataAsValueOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ModuleFlagsOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ModuleFlagsOpGenericAdaptorBase::ModuleFlagsOpGenericAdaptorBase(ModuleFlagsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::ArrayAttr ModuleFlagsOpGenericAdaptorBase::getFlags() {
|
|
auto attr = getFlagsAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ModuleFlagsOpAdaptor::ModuleFlagsOpAdaptor(ModuleFlagsOp op) : ModuleFlagsOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_flags = getProperties().flags; (void)tblgen_flags;
|
|
if (!tblgen_flags) return emitError(loc, "'llvm.module_flags' op requires attribute 'flags'");
|
|
|
|
if (tblgen_flags && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_flags))))
|
|
return emitError(loc, "'llvm.module_flags' op attribute 'flags' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.flags;
|
|
auto attr = dict.get("flags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `flags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ModuleFlagsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.flags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("flags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ModuleFlagsOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.flags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ModuleFlagsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "flags")
|
|
return prop.flags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ModuleFlagsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "flags") {
|
|
prop.flags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.flags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ModuleFlagsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.flags) attrs.append("flags", prop.flags);
|
|
}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "flags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.flags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ModuleFlagsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.flags);
|
|
}
|
|
|
|
::mlir::ArrayAttr ModuleFlagsOp::getFlags() {
|
|
auto attr = getFlagsAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ModuleFlagsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr flags) {
|
|
odsState.getOrAddProperties<Properties>().flags = flags;
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ArrayAttr flags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(flags)>(flags));
|
|
auto __res__ = ::llvm::dyn_cast<ModuleFlagsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ArrayAttr flags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(flags)>(flags));
|
|
}
|
|
|
|
void ModuleFlagsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr flags) {
|
|
odsState.getOrAddProperties<Properties>().flags = flags;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr flags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(flags)>(flags));
|
|
auto __res__ = ::llvm::dyn_cast<ModuleFlagsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr flags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(flags)>(flags));
|
|
}
|
|
|
|
void ModuleFlagsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ModuleFlagsOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ModuleFlagsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ModuleFlagsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ModuleFlagsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ModuleFlagsOp ModuleFlagsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOp::verifyInvariantsImpl() {
|
|
auto tblgen_flags = getProperties().flags; (void)tblgen_flags;
|
|
if (!tblgen_flags) return emitOpError("requires attribute 'flags'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_flags, "flags")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ModuleFlagsOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ModuleFlagsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::ArrayAttr flagsAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(flagsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (flagsAttr) result.getOrAddProperties<ModuleFlagsOp::Properties>().flags = flagsAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ModuleFlagsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getFlagsAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("flags");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ModuleFlagsOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ModuleFlagsOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::MulOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_overflowFlags) & ~3) == 0)))
|
|
return emitError(loc, "'llvm.mul' op property 'overflowFlags' failed to satisfy constraint: LLVM integer overflow flags");
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto customAttr = ::mlir::dyn_cast_if_present<::mlir::LLVM::IntegerOverflowFlagsAttr>(propAttr);
|
|
if (customAttr) {
|
|
propStorage = customAttr.getValue();
|
|
return ::mlir::success();
|
|
}
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected ::mlir::LLVM::IntegerOverflowFlagsAttr or IntegerAttr storage for ::mlir::LLVM::IntegerOverflowFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("overflowFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.overflowFlags, attr, [&]() {
|
|
return emitError() << "for `overflowFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.overflowFlags = ::mlir::LLVM::IntegerOverflowFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.overflowFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("overflowFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MulOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_value(prop.overflowFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void MulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MulOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MulOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps1(*this, tblgen_overflowFlags, "overflowFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult MulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult MulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
auto overflowFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
if (parser.parseOptionalKeyword("overflow")) {
|
|
return std::nullopt;
|
|
}
|
|
if (parser.parseLess()) {
|
|
return ::mlir::failure();
|
|
}
|
|
auto parseRes = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(parser);
|
|
if (::mlir::failed(parseRes) ||
|
|
::mlir::failed(parser.parseGreater())) {
|
|
return ::mlir::failure();
|
|
}
|
|
propStorage = *parseRes;
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<MulOp::Properties>().overflowFlags);
|
|
if (overflowFlagsPropParseResult.has_value() && failed(*overflowFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (overflowFlagsPropParseResult.has_value() && succeeded(*overflowFlagsPropParseResult)) {
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MulOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
if (getOverflowFlags() != ::mlir::LLVM::IntegerOverflowFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "overflow<" << getProperties().overflowFlags << ">";;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void MulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MulOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::MulOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::NamedMetadataOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
NamedMetadataOpGenericAdaptorBase::NamedMetadataOpGenericAdaptorBase(NamedMetadataOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef NamedMetadataOpGenericAdaptorBase::getMetadataName() {
|
|
auto attr = getMetadataNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::ArrayAttr NamedMetadataOpGenericAdaptorBase::getNodes() {
|
|
auto attr = getNodesAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
NamedMetadataOpAdaptor::NamedMetadataOpAdaptor(NamedMetadataOp op) : NamedMetadataOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult NamedMetadataOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_metadata_name = getProperties().metadata_name; (void)tblgen_metadata_name;
|
|
if (!tblgen_metadata_name) return emitError(loc, "'llvm.named_metadata' op requires attribute 'metadata_name'");
|
|
auto tblgen_nodes = getProperties().nodes; (void)tblgen_nodes;
|
|
if (!tblgen_nodes) return emitError(loc, "'llvm.named_metadata' op requires attribute 'nodes'");
|
|
|
|
if (tblgen_metadata_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_metadata_name))))
|
|
return emitError(loc, "'llvm.named_metadata' op attribute 'metadata_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_nodes && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_nodes))))
|
|
return emitError(loc, "'llvm.named_metadata' op attribute 'nodes' failed to satisfy constraint: array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult NamedMetadataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.metadata_name;
|
|
auto attr = dict.get("metadata_name");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `metadata_name` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nodes;
|
|
auto attr = dict.get("nodes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nodes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute NamedMetadataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.metadata_name;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("metadata_name",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nodes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nodes",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code NamedMetadataOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.metadata_name.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nodes.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> NamedMetadataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "metadata_name")
|
|
return prop.metadata_name;
|
|
|
|
if (name == "nodes")
|
|
return prop.nodes;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void NamedMetadataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "metadata_name") {
|
|
prop.metadata_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.metadata_name)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nodes") {
|
|
prop.nodes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nodes)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void NamedMetadataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.metadata_name) attrs.append("metadata_name", prop.metadata_name);
|
|
|
|
if (prop.nodes) attrs.append("nodes", prop.nodes);
|
|
}
|
|
|
|
::llvm::LogicalResult NamedMetadataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMetadataNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "metadata_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNodesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "nodes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult NamedMetadataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.metadata_name)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.nodes)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void NamedMetadataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.metadata_name);
|
|
writer.writeAttribute(prop.nodes);
|
|
}
|
|
|
|
::llvm::StringRef NamedMetadataOp::getMetadataName() {
|
|
auto attr = getMetadataNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::ArrayAttr NamedMetadataOp::getNodes() {
|
|
auto attr = getNodesAttr();
|
|
return attr;
|
|
}
|
|
|
|
void NamedMetadataOp::setMetadataName(::llvm::StringRef attrValue) {
|
|
getProperties().metadata_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
odsState.getOrAddProperties<Properties>().metadata_name = metadata_name;
|
|
odsState.getOrAddProperties<Properties>().nodes = nodes;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
odsState.getOrAddProperties<Properties>().metadata_name = metadata_name;
|
|
odsState.getOrAddProperties<Properties>().nodes = nodes;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr metadata_name, ::mlir::ArrayAttr nodes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
odsState.getOrAddProperties<Properties>().metadata_name = odsBuilder.getStringAttr(metadata_name);
|
|
odsState.getOrAddProperties<Properties>().nodes = nodes;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
odsState.getOrAddProperties<Properties>().metadata_name = odsBuilder.getStringAttr(metadata_name);
|
|
odsState.getOrAddProperties<Properties>().nodes = nodes;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef metadata_name, ::mlir::ArrayAttr nodes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(metadata_name)>(metadata_name), std::forward<decltype(nodes)>(nodes));
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<NamedMetadataOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void NamedMetadataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<NamedMetadataOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NamedMetadataOp NamedMetadataOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult NamedMetadataOp::verifyInvariantsImpl() {
|
|
auto tblgen_metadata_name = getProperties().metadata_name; (void)tblgen_metadata_name;
|
|
if (!tblgen_metadata_name) return emitOpError("requires attribute 'metadata_name'");
|
|
auto tblgen_nodes = getProperties().nodes; (void)tblgen_nodes;
|
|
if (!tblgen_nodes) return emitOpError("requires attribute 'nodes'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_metadata_name, "metadata_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_nodes, "nodes")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult NamedMetadataOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult NamedMetadataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::StringAttr metadata_nameAttr;
|
|
::mlir::ArrayAttr nodesAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(metadata_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (metadata_nameAttr) result.getOrAddProperties<NamedMetadataOp::Properties>().metadata_name = metadata_nameAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(nodesAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (nodesAttr) result.getOrAddProperties<NamedMetadataOp::Properties>().nodes = nodesAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void NamedMetadataOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getMetadataNameAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getNodesAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("metadata_name");
|
|
elidedAttrs.push_back("nodes");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::NamedMetadataOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::NamedMetadataOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::NoneTokenOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
NoneTokenOpGenericAdaptorBase::NoneTokenOpGenericAdaptorBase(NoneTokenOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
NoneTokenOpAdaptor::NoneTokenOpAdaptor(NoneTokenOp op) : NoneTokenOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult NoneTokenOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult NoneTokenOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute NoneTokenOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code NoneTokenOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> NoneTokenOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void NoneTokenOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void NoneTokenOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult NoneTokenOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(NoneTokenOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__);
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder) {
|
|
return create(builder, builder.getLoc());
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(NoneTokenOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(NoneTokenOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<NoneTokenOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
NoneTokenOp NoneTokenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult NoneTokenOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps22(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult NoneTokenOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult NoneTokenOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::TokenType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult NoneTokenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::TokenType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void NoneTokenOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::TokenType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void NoneTokenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::NoneTokenOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::OrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
OrOpGenericAdaptorBase::OrOpGenericAdaptorBase(OrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr OrOpGenericAdaptorBase::getIsDisjointAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isDisjoint);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool OrOpGenericAdaptorBase::getIsDisjoint() {
|
|
auto attr = getIsDisjointAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
OrOpAdaptor::OrOpAdaptor(OrOp op) : OrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult OrOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_isDisjoint = getProperties().isDisjoint; (void)tblgen_isDisjoint;
|
|
|
|
if (tblgen_isDisjoint && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isDisjoint))))
|
|
return emitError(loc, "'llvm.or' op attribute 'isDisjoint' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.isDisjoint;
|
|
auto attr = dict.get("isDisjoint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `isDisjoint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute OrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.isDisjoint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("isDisjoint",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code OrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.isDisjoint.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> OrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "isDisjoint")
|
|
return prop.isDisjoint;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void OrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "isDisjoint") {
|
|
prop.isDisjoint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.isDisjoint)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void OrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.isDisjoint) attrs.append("isDisjoint", prop.isDisjoint);
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsDisjointAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "isDisjoint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.isDisjoint)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void OrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.isDisjoint);
|
|
}
|
|
|
|
bool OrOp::getIsDisjoint() {
|
|
auto attr = getIsDisjointAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void OrOp::setIsDisjoint(bool attrValue) {
|
|
auto &odsProp = getProperties().isDisjoint;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = isDisjoint;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = isDisjoint;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = isDisjoint;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = ((isDisjoint) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = ((isDisjoint) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isDisjoint) {
|
|
odsState.getOrAddProperties<Properties>().isDisjoint = ((isDisjoint) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isDisjoint) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isDisjoint)>(isDisjoint));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<OrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<OrOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<OrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
OrOp OrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::verifyInvariantsImpl() {
|
|
auto tblgen_isDisjoint = getProperties().isDisjoint; (void)tblgen_isDisjoint;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_isDisjoint, "isDisjoint")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult OrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult OrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("disjoint"))) {
|
|
result.getOrAddProperties<OrOp::Properties>().isDisjoint = parser.getBuilder().getUnitAttr(); }
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void OrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getIsDisjointAttr() && getIsDisjointAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "disjoint";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("isDisjoint");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsDisjointAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("isDisjoint");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void OrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::OrOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::OrOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::PoisonOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PoisonOpGenericAdaptorBase::PoisonOpGenericAdaptorBase(PoisonOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
PoisonOpAdaptor::PoisonOpAdaptor(PoisonOp op) : PoisonOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PoisonOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PoisonOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PoisonOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PoisonOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PoisonOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PoisonOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void PoisonOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult PoisonOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PoisonOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res));
|
|
auto __res__ = ::llvm::dyn_cast<PoisonOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res));
|
|
}
|
|
|
|
void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<PoisonOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void PoisonOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PoisonOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PoisonOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PoisonOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PoisonOp PoisonOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PoisonOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PoisonOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult PoisonOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PoisonOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PoisonOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PoisonOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::PtrToAddrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PtrToAddrOpGenericAdaptorBase::PtrToAddrOpGenericAdaptorBase(PtrToAddrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
PtrToAddrOpAdaptor::PtrToAddrOpAdaptor(PtrToAddrOp op) : PtrToAddrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PtrToAddrOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToAddrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PtrToAddrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PtrToAddrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PtrToAddrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PtrToAddrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void PtrToAddrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToAddrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PtrToAddrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToAddrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PtrToAddrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToAddrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void PtrToAddrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToAddrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void PtrToAddrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToAddrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PtrToAddrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToAddrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToAddrOp PtrToAddrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToAddrOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToAddrOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult PtrToAddrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PtrToAddrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PtrToAddrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrToAddrOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::PtrToIntOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PtrToIntOpGenericAdaptorBase::PtrToIntOpGenericAdaptorBase(PtrToIntOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
PtrToIntOpAdaptor::PtrToIntOpAdaptor(PtrToIntOp op) : PtrToIntOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PtrToIntOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToIntOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PtrToIntOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PtrToIntOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PtrToIntOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PtrToIntOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void PtrToIntOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToIntOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToIntOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToIntOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToIntOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void PtrToIntOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToIntOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PtrToIntOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PtrToIntOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PtrToIntOp PtrToIntOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToIntOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PtrToIntOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult PtrToIntOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PtrToIntOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PtrToIntOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrToIntOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ResumeOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ResumeOpGenericAdaptorBase::ResumeOpGenericAdaptorBase(ResumeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
ResumeOpAdaptor::ResumeOpAdaptor(ResumeOp op) : ResumeOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ResumeOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ResumeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ResumeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ResumeOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ResumeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ResumeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ResumeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ResumeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value) {
|
|
odsState.addOperands(value);
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ResumeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) {
|
|
odsState.addOperands(value);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
|
|
auto __res__ = ::llvm::dyn_cast<ResumeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ResumeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ResumeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ResumeOp ResumeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ResumeOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ResumeOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ResumeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ResumeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ResumeOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ReturnOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ReturnOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange ReturnOp::getArgMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ReturnOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ReturnOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ReturnOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ReturnOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ReturnOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ReturnOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ReturnOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange args) {
|
|
build(odsBuilder, odsState, TypeRange(), args);
|
|
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange args) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(args)>(args));
|
|
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange args) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(args)>(args));
|
|
}
|
|
|
|
void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value arg) {
|
|
if (arg)
|
|
odsState.addOperands(arg);
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value arg) {
|
|
if (arg)
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ReturnOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
if (valueGroup0.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup0.size();
|
|
}
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ReturnOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argOperands;
|
|
::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> argTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
argOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (!argOperands.empty()) {
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
argTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
}
|
|
if (!argOperands.empty()) {
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
if (getArg()) {
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getArg())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getArg() ? ::llvm::ArrayRef<::mlir::Type>(getArg().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
}
|
|
}
|
|
|
|
void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ReturnOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SDivOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SDivOpGenericAdaptorBase::SDivOpGenericAdaptorBase(SDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr SDivOpGenericAdaptorBase::getIsExactAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isExact);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SDivOpGenericAdaptorBase::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SDivOpAdaptor::SDivOpAdaptor(SDivOp op) : SDivOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SDivOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (tblgen_isExact && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isExact))))
|
|
return emitError(loc, "'llvm.sdiv' op attribute 'isExact' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.isExact;
|
|
auto attr = dict.get("isExact");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `isExact` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SDivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.isExact;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("isExact",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SDivOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.isExact.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "isExact")
|
|
return prop.isExact;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "isExact") {
|
|
prop.isExact = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.isExact)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.isExact) attrs.append("isExact", prop.isExact);
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsExactAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "isExact", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.isExact)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SDivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.isExact);
|
|
}
|
|
|
|
bool SDivOp::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void SDivOp::setIsExact(bool attrValue) {
|
|
auto &odsProp = getProperties().isExact;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::verifyInvariantsImpl() {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_isExact, "isExact")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult SDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("exact"))) {
|
|
result.getOrAddProperties<SDivOp::Properties>().isExact = parser.getBuilder().getUnitAttr(); }
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getIsExactAttr() && getIsExactAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "exact";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("isExact");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsExactAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("isExact");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SDivOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::SDivOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SExtOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SExtOpGenericAdaptorBase::SExtOpGenericAdaptorBase(SExtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
SExtOpAdaptor::SExtOpAdaptor(SExtOp op) : SExtOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SExtOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SExtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SExtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SExtOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SExtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SExtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void SExtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult SExtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<SExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<SExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void SExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SExtOp SExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SExtOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SExtOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult SExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SExtOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SIToFPOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SIToFPOpGenericAdaptorBase::SIToFPOpGenericAdaptorBase(SIToFPOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
SIToFPOpAdaptor::SIToFPOpAdaptor(SIToFPOp op) : SIToFPOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SIToFPOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SIToFPOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SIToFPOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SIToFPOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SIToFPOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SIToFPOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void SIToFPOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult SIToFPOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<SIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<SIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void SIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SIToFPOp SIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SIToFPOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SIToFPOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult SIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SIToFPOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SRemOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SRemOpGenericAdaptorBase::SRemOpGenericAdaptorBase(SRemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
SRemOpAdaptor::SRemOpAdaptor(SRemOp op) : SRemOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SRemOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SRemOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SRemOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SRemOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SRemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SRemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void SRemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult SRemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SRemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SRemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SRemOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SRemOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult SRemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SRemOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SelectOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(SelectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::LLVM::FastmathFlagsAttr SelectOpGenericAdaptorBase::getFastmathFlagsAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags SelectOpGenericAdaptorBase::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SelectOpAdaptor::SelectOpAdaptor(SelectOp op) : SelectOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SelectOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags))))
|
|
return emitError(loc, "'llvm.select' op attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fastmathFlags;
|
|
auto attr = dict.get("fastmathFlags");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SelectOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fastmathFlags;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SelectOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SelectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fastmathFlags")
|
|
return prop.fastmathFlags;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SelectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fastmathFlags") {
|
|
prop.fastmathFlags = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fastmathFlags)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SelectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags);
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "fastmathFlags", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SelectOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.fastmathFlags);
|
|
}
|
|
|
|
::mlir::LLVM::FastmathFlags SelectOp::getFastmathFlags() {
|
|
auto attr = getFastmathFlagsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void SelectOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) {
|
|
getProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
if (fastmathFlags) {
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = fastmathFlags;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
odsState.addOperands(condition);
|
|
odsState.addOperands(trueValue);
|
|
odsState.addOperands(falseValue);
|
|
odsState.getOrAddProperties<Properties>().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(trueValue)>(trueValue), std::forward<decltype(falseValue)>(falseValue), std::forward<decltype(fastmathFlags)>(fastmathFlags));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SelectOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SelectOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SelectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SelectOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fastmathFlags)
|
|
properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {});
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::verifyInvariantsImpl() {
|
|
auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_fastmathFlags, "fastmathFlags")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {trueValue, falseValue, res} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult SelectOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SelectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
|
|
::mlir::Type conditionRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> conditionTypes(&conditionRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(allOperands))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
conditionRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(allOperands, ::llvm::concat<const ::mlir::Type>(::llvm::ArrayRef<::mlir::Type>(conditionTypes), ::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resTypes[0])), allOperandLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SelectOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getOperands();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFastmathFlagsAttr();
|
|
if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {})))
|
|
elidedAttrs.push_back("fastmathFlags");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getCondition().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SelectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SelectOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::SelectOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ShlOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ShlOpGenericAdaptorBase::ShlOpGenericAdaptorBase(ShlOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
ShlOpAdaptor::ShlOpAdaptor(ShlOp op) : ShlOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ShlOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_overflowFlags) & ~3) == 0)))
|
|
return emitError(loc, "'llvm.shl' op property 'overflowFlags' failed to satisfy constraint: LLVM integer overflow flags");
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto customAttr = ::mlir::dyn_cast_if_present<::mlir::LLVM::IntegerOverflowFlagsAttr>(propAttr);
|
|
if (customAttr) {
|
|
propStorage = customAttr.getValue();
|
|
return ::mlir::success();
|
|
}
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected ::mlir::LLVM::IntegerOverflowFlagsAttr or IntegerAttr storage for ::mlir::LLVM::IntegerOverflowFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("overflowFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.overflowFlags, attr, [&]() {
|
|
return emitError() << "for `overflowFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.overflowFlags = ::mlir::LLVM::IntegerOverflowFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ShlOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.overflowFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("overflowFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ShlOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_value(prop.overflowFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ShlOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ShlOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ShlOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ShlOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ShlOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ShlOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShlOp ShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps1(*this, tblgen_overflowFlags, "overflowFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ShlOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult ShlOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
auto overflowFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
if (parser.parseOptionalKeyword("overflow")) {
|
|
return std::nullopt;
|
|
}
|
|
if (parser.parseLess()) {
|
|
return ::mlir::failure();
|
|
}
|
|
auto parseRes = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(parser);
|
|
if (::mlir::failed(parseRes) ||
|
|
::mlir::failed(parser.parseGreater())) {
|
|
return ::mlir::failure();
|
|
}
|
|
propStorage = *parseRes;
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<ShlOp::Properties>().overflowFlags);
|
|
if (overflowFlagsPropParseResult.has_value() && failed(*overflowFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (overflowFlagsPropParseResult.has_value() && succeeded(*overflowFlagsPropParseResult)) {
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ShlOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
if (getOverflowFlags() != ::mlir::LLVM::IntegerOverflowFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "overflow<" << getProperties().overflowFlags << ">";;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ShlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShlOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ShlOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ShuffleVectorOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ShuffleVectorOpGenericAdaptorBase::ShuffleVectorOpGenericAdaptorBase(ShuffleVectorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::ArrayRef<int32_t> ShuffleVectorOpGenericAdaptorBase::getMask() {
|
|
auto attr = getMaskAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ShuffleVectorOpAdaptor::ShuffleVectorOpAdaptor(ShuffleVectorOp op) : ShuffleVectorOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_mask = getProperties().mask; (void)tblgen_mask;
|
|
if (!tblgen_mask) return emitError(loc, "'llvm.shufflevector' op requires attribute 'mask'");
|
|
|
|
if (tblgen_mask && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mask))))
|
|
return emitError(loc, "'llvm.shufflevector' op attribute 'mask' failed to satisfy constraint: i32 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.mask;
|
|
auto attr = dict.get("mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ShuffleVectorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("mask",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ShuffleVectorOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.mask.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ShuffleVectorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "mask")
|
|
return prop.mask;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ShuffleVectorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "mask") {
|
|
prop.mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mask)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ShuffleVectorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.mask) attrs.append("mask", prop.mask);
|
|
}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.mask)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ShuffleVectorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.mask);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> ShuffleVectorOp::getMask() {
|
|
auto attr = getMaskAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ShuffleVectorOp::setMask(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().mask = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value v1, Value v2, DenseI32ArrayAttr mask, ArrayRef<NamedAttribute> attrs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask), std::forward<decltype(attrs)>(attrs));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, Value v1, Value v2, DenseI32ArrayAttr mask, ArrayRef<NamedAttribute> attrs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask), std::forward<decltype(attrs)>(attrs));
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value v1, Value v2, ArrayRef<int32_t> mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, Value v1, Value v2, ArrayRef<int32_t> mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
odsState.addOperands(v1);
|
|
odsState.addOperands(v2);
|
|
odsState.getOrAddProperties<Properties>().mask = mask;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
odsState.addOperands(v1);
|
|
odsState.addOperands(v2);
|
|
odsState.getOrAddProperties<Properties>().mask = mask;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
odsState.addOperands(v1);
|
|
odsState.addOperands(v2);
|
|
odsState.getOrAddProperties<Properties>().mask = odsBuilder.getDenseI32ArrayAttr(mask);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
odsState.addOperands(v1);
|
|
odsState.addOperands(v2);
|
|
odsState.getOrAddProperties<Properties>().mask = odsBuilder.getDenseI32ArrayAttr(mask);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef<int32_t> mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(v1)>(v1), std::forward<decltype(v2)>(v2), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ShuffleVectorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ShuffleVectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ShuffleVectorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ShuffleVectorOp ShuffleVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOp::verifyInvariantsImpl() {
|
|
auto tblgen_mask = getProperties().mask; (void)tblgen_mask;
|
|
if (!tblgen_mask) return emitOpError("requires attribute 'mask'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_mask, "mask")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {v1, v2} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ShuffleVectorOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ShuffleVectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand v1RawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> v1Operands(&v1RawOperand, 1); ::llvm::SMLoc v1OperandsLoc;
|
|
(void)v1OperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand v2RawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> v2Operands(&v2RawOperand, 1); ::llvm::SMLoc v2OperandsLoc;
|
|
(void)v2OperandsLoc;
|
|
::mlir::DenseI32ArrayAttr maskAttr;
|
|
::mlir::Type v1RawType{};
|
|
::llvm::ArrayRef<::mlir::Type> v1Types(&v1RawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
v1OperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(v1RawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
v2OperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(v2RawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(maskAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (maskAttr) result.getOrAddProperties<ShuffleVectorOp::Properties>().mask = maskAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
v1RawType = type;
|
|
}
|
|
{
|
|
auto odsResult = parseShuffleType(parser, v1RawType, resRawType, maskAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(v1Operands, v1Types, v1OperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(v2Operands, v1Types[0], v2OperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ShuffleVectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getV1();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getV2();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getMaskAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("mask");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getV1().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ';
|
|
printShuffleType(_odsPrinter, *this, getV1().getType(), getRes().getType(), getMaskAttr());
|
|
}
|
|
|
|
void ShuffleVectorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShuffleVectorOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ShuffleVectorOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::StoreOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(StoreOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::std::optional<uint64_t> StoreOpGenericAdaptorBase::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::UnitAttr StoreOpGenericAdaptorBase::getVolatile_Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool StoreOpGenericAdaptorBase::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr StoreOpGenericAdaptorBase::getNontemporalAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool StoreOpGenericAdaptorBase::getNontemporal() {
|
|
auto attr = getNontemporalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr StoreOpGenericAdaptorBase::getInvariantGroupAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().invariantGroup);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool StoreOpGenericAdaptorBase::getInvariantGroup() {
|
|
auto attr = getInvariantGroupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrderingAttr StoreOpGenericAdaptorBase::getOrderingAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering StoreOpGenericAdaptorBase::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > StoreOpGenericAdaptorBase::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
StoreOpAdaptor::StoreOpAdaptor(StoreOp op) : StoreOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult StoreOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_invariantGroup = getProperties().invariantGroup; (void)tblgen_invariantGroup;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))))
|
|
return emitError(loc, "'llvm.store' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute");
|
|
|
|
if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_))))
|
|
return emitError(loc, "'llvm.store' op attribute 'volatile_' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_nontemporal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nontemporal))))
|
|
return emitError(loc, "'llvm.store' op attribute 'nontemporal' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_invariantGroup && !((::llvm::isa<::mlir::UnitAttr>(tblgen_invariantGroup))))
|
|
return emitError(loc, "'llvm.store' op attribute 'invariantGroup' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering))))
|
|
return emitError(loc, "'llvm.store' op attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model");
|
|
|
|
if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope))))
|
|
return emitError(loc, "'llvm.store' op attribute 'syncscope' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.store' op attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array");
|
|
|
|
if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.store' op attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.store' op attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array");
|
|
|
|
if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); }))))
|
|
return emitError(loc, "'llvm.store' op attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult StoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.access_groups;
|
|
auto attr = dict.get("access_groups");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `access_groups` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alias_scopes;
|
|
auto attr = dict.get("alias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.alignment;
|
|
auto attr = dict.get("alignment");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `alignment` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.invariantGroup;
|
|
auto attr = dict.get("invariantGroup");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `invariantGroup` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.noalias_scopes;
|
|
auto attr = dict.get("noalias_scopes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nontemporal;
|
|
auto attr = dict.get("nontemporal");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ordering;
|
|
auto attr = dict.get("ordering");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ordering` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.syncscope;
|
|
auto attr = dict.get("syncscope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `syncscope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tbaa;
|
|
auto attr = dict.get("tbaa");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tbaa` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.volatile_;
|
|
auto attr = dict.get("volatile_");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `volatile_` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute StoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.access_groups;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("access_groups",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.alignment;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("alignment",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.invariantGroup;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("invariantGroup",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.noalias_scopes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.nontemporal;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nontemporal",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.ordering;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ordering",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.syncscope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("syncscope",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tbaa;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tbaa",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.volatile_;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("volatile_",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code StoreOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.access_groups.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.alignment.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.invariantGroup.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.nontemporal.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.ordering.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.syncscope.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tbaa.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.volatile_.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> StoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "access_groups")
|
|
return prop.access_groups;
|
|
|
|
if (name == "alias_scopes")
|
|
return prop.alias_scopes;
|
|
|
|
if (name == "alignment")
|
|
return prop.alignment;
|
|
|
|
if (name == "invariantGroup")
|
|
return prop.invariantGroup;
|
|
|
|
if (name == "noalias_scopes")
|
|
return prop.noalias_scopes;
|
|
|
|
if (name == "nontemporal")
|
|
return prop.nontemporal;
|
|
|
|
if (name == "ordering")
|
|
return prop.ordering;
|
|
|
|
if (name == "syncscope")
|
|
return prop.syncscope;
|
|
|
|
if (name == "tbaa")
|
|
return prop.tbaa;
|
|
|
|
if (name == "volatile_")
|
|
return prop.volatile_;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void StoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "access_groups") {
|
|
prop.access_groups = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.access_groups)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alias_scopes") {
|
|
prop.alias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "alignment") {
|
|
prop.alignment = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.alignment)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "invariantGroup") {
|
|
prop.invariantGroup = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.invariantGroup)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "noalias_scopes") {
|
|
prop.noalias_scopes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.noalias_scopes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "nontemporal") {
|
|
prop.nontemporal = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nontemporal)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "ordering") {
|
|
prop.ordering = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ordering)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "syncscope") {
|
|
prop.syncscope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.syncscope)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tbaa") {
|
|
prop.tbaa = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tbaa)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "volatile_") {
|
|
prop.volatile_ = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.volatile_)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void StoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.access_groups) attrs.append("access_groups", prop.access_groups);
|
|
|
|
if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes);
|
|
|
|
if (prop.alignment) attrs.append("alignment", prop.alignment);
|
|
|
|
if (prop.invariantGroup) attrs.append("invariantGroup", prop.invariantGroup);
|
|
|
|
if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes);
|
|
|
|
if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal);
|
|
|
|
if (prop.ordering) attrs.append("ordering", prop.ordering);
|
|
|
|
if (prop.syncscope) attrs.append("syncscope", prop.syncscope);
|
|
|
|
if (prop.tbaa) attrs.append("tbaa", prop.tbaa);
|
|
|
|
if (prop.volatile_) attrs.append("volatile_", prop.volatile_);
|
|
}
|
|
|
|
::llvm::LogicalResult StoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "access_groups", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "alias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "alignment", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getInvariantGroupAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "invariantGroup", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "noalias_scopes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nontemporal", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "ordering", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "syncscope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "tbaa", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "volatile_", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult StoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.alignment)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.invariantGroup)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.ordering)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void StoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.access_groups);
|
|
|
|
writer.writeOptionalAttribute(prop.alias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.alignment);
|
|
|
|
writer.writeOptionalAttribute(prop.invariantGroup);
|
|
|
|
writer.writeOptionalAttribute(prop.noalias_scopes);
|
|
|
|
writer.writeOptionalAttribute(prop.nontemporal);
|
|
|
|
writer.writeOptionalAttribute(prop.ordering);
|
|
|
|
writer.writeOptionalAttribute(prop.syncscope);
|
|
|
|
writer.writeOptionalAttribute(prop.tbaa);
|
|
|
|
writer.writeOptionalAttribute(prop.volatile_);
|
|
}
|
|
|
|
::std::optional<uint64_t> StoreOp::getAlignment() {
|
|
auto attr = getAlignmentAttr();
|
|
return attr ? ::std::optional<uint64_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
bool StoreOp::getVolatile_() {
|
|
auto attr = getVolatile_Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool StoreOp::getNontemporal() {
|
|
auto attr = getNontemporalAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool StoreOp::getInvariantGroup() {
|
|
auto attr = getInvariantGroupAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::LLVM::AtomicOrdering StoreOp::getOrdering() {
|
|
auto attr = getOrderingAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional< ::llvm::StringRef > StoreOp::getSyncscope() {
|
|
auto attr = getSyncscopeAttr();
|
|
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOp::getAccessGroups() {
|
|
auto attr = getAccessGroupsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOp::getAliasScopes() {
|
|
auto attr = getAliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOp::getNoaliasScopes() {
|
|
auto attr = getNoaliasScopesAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > StoreOp::getTbaa() {
|
|
auto attr = getTbaaAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void StoreOp::setAlignment(::std::optional<uint64_t> attrValue) {
|
|
auto &odsProp = getProperties().alignment;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void StoreOp::setVolatile_(bool attrValue) {
|
|
auto &odsProp = getProperties().volatile_;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void StoreOp::setNontemporal(bool attrValue) {
|
|
auto &odsProp = getProperties().nontemporal;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void StoreOp::setInvariantGroup(bool attrValue) {
|
|
auto &odsProp = getProperties().invariantGroup;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void StoreOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) {
|
|
getProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void StoreOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) {
|
|
auto &odsProp = getProperties().syncscope;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value value, Value addr, unsigned alignment, bool isVolatile, bool isNonTemporal, bool isInvariantGroup, AtomicOrdering ordering, StringRef syncscope) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile), std::forward<decltype(isNonTemporal)>(isNonTemporal), std::forward<decltype(isInvariantGroup)>(isInvariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, Value value, Value addr, unsigned alignment, bool isVolatile, bool isNonTemporal, bool isInvariantGroup, AtomicOrdering ordering, StringRef syncscope) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(isVolatile)>(isVolatile), std::forward<decltype(isNonTemporal)>(isNonTemporal), std::forward<decltype(isInvariantGroup)>(isInvariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = nontemporal;
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = invariantGroup;
|
|
}
|
|
if (ordering) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
}
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = volatile_;
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = nontemporal;
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = invariantGroup;
|
|
}
|
|
if (ordering) {
|
|
odsState.getOrAddProperties<Properties>().ordering = ordering;
|
|
}
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, /*optional*/::mlir::UnitAttr invariantGroup, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = ((invariantGroup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(addr);
|
|
if (alignment) {
|
|
odsState.getOrAddProperties<Properties>().alignment = alignment;
|
|
}
|
|
if (volatile_) {
|
|
odsState.getOrAddProperties<Properties>().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (nontemporal) {
|
|
odsState.getOrAddProperties<Properties>().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (invariantGroup) {
|
|
odsState.getOrAddProperties<Properties>().invariantGroup = ((invariantGroup) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.getOrAddProperties<Properties>().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering);
|
|
if (syncscope) {
|
|
odsState.getOrAddProperties<Properties>().syncscope = syncscope;
|
|
}
|
|
if (access_groups) {
|
|
odsState.getOrAddProperties<Properties>().access_groups = access_groups;
|
|
}
|
|
if (alias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().alias_scopes = alias_scopes;
|
|
}
|
|
if (noalias_scopes) {
|
|
odsState.getOrAddProperties<Properties>().noalias_scopes = noalias_scopes;
|
|
}
|
|
if (tbaa) {
|
|
odsState.getOrAddProperties<Properties>().tbaa = tbaa;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, /*optional*/bool invariantGroup, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(addr)>(addr), std::forward<decltype(alignment)>(alignment), std::forward<decltype(volatile_)>(volatile_), std::forward<decltype(nontemporal)>(nontemporal), std::forward<decltype(invariantGroup)>(invariantGroup), std::forward<decltype(ordering)>(ordering), std::forward<decltype(syncscope)>(syncscope), std::forward<decltype(access_groups)>(access_groups), std::forward<decltype(alias_scopes)>(alias_scopes), std::forward<decltype(noalias_scopes)>(noalias_scopes), std::forward<decltype(tbaa)>(tbaa));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<StoreOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void StoreOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.ordering)
|
|
properties.ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic);
|
|
}
|
|
|
|
::llvm::LogicalResult StoreOp::verifyInvariantsImpl() {
|
|
auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups;
|
|
auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes;
|
|
auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment;
|
|
auto tblgen_invariantGroup = getProperties().invariantGroup; (void)tblgen_invariantGroup;
|
|
auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes;
|
|
auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal;
|
|
auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering;
|
|
auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope;
|
|
auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa;
|
|
auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_alignment, "alignment")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_volatile_, "volatile_")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nontemporal, "nontemporal")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_invariantGroup, "invariantGroup")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_ordering, "ordering")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_syncscope, "syncscope")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_access_groups, "access_groups")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_alias_scopes, "alias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_noalias_scopes, "noalias_scopes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_tbaa, "tbaa")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps20(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult StoreOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult StoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand addrRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(&addrRawOperand, 1); ::llvm::SMLoc addrOperandsLoc;
|
|
(void)addrOperandsLoc;
|
|
::mlir::StringAttr syncscopeAttr;
|
|
::mlir::LLVM::AtomicOrderingAttr orderingAttr;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type addrRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> addrTypes(&addrRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) {
|
|
result.getOrAddProperties<StoreOp::Properties>().volatile_ = parser.getBuilder().getUnitAttr(); }
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
addrOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(addrRawOperand))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("atomic"))) {
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (syncscopeAttr) result.getOrAddProperties<StoreOp::Properties>().syncscope = syncscopeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"ordering", attrStorage);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
attrStr = attrVal.getValue();
|
|
} else {
|
|
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "ordering attribute specification: \"" << attrStr << '"';;
|
|
|
|
orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<StoreOp::Properties>().ordering = orderingAttr;
|
|
}
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("invariant_group"))) {
|
|
result.getOrAddProperties<StoreOp::Properties>().invariantGroup = parser.getBuilder().getUnitAttr(); }
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(addrRawType))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void StoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getVolatile_Attr() && getVolatile_Attr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "volatile";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getAddr();
|
|
if (getOrderingAttr() != ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), AtomicOrdering::not_atomic)) {
|
|
_odsPrinter << ' ' << "atomic";
|
|
if (getSyncscopeAttr()) {
|
|
_odsPrinter << ' ' << "syncscope";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getSyncscopeAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getOrdering();
|
|
auto caseValueStr = stringifyAtomicOrdering(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
}
|
|
if ((getInvariantGroupAttr() && getInvariantGroupAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "invariant_group";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("volatile_");
|
|
elidedAttrs.push_back("syncscope");
|
|
elidedAttrs.push_back("ordering");
|
|
elidedAttrs.push_back("invariantGroup");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getVolatile_Attr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("volatile_");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNontemporalAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("nontemporal");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getInvariantGroupAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("invariantGroup");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getOrderingAttr();
|
|
if(attr && (attr == ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic)))
|
|
elidedAttrs.push_back("ordering");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getAddr().getType();
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::StoreOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::StoreOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SubOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_overflowFlags) & ~3) == 0)))
|
|
return emitError(loc, "'llvm.sub' op property 'overflowFlags' failed to satisfy constraint: LLVM integer overflow flags");
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto customAttr = ::mlir::dyn_cast_if_present<::mlir::LLVM::IntegerOverflowFlagsAttr>(propAttr);
|
|
if (customAttr) {
|
|
propStorage = customAttr.getValue();
|
|
return ::mlir::success();
|
|
}
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected ::mlir::LLVM::IntegerOverflowFlagsAttr or IntegerAttr storage for ::mlir::LLVM::IntegerOverflowFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("overflowFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.overflowFlags, attr, [&]() {
|
|
return emitError() << "for `overflowFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.overflowFlags = ::mlir::LLVM::IntegerOverflowFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.overflowFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("overflowFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SubOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_value(prop.overflowFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void SubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SubOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SubOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps1(*this, tblgen_overflowFlags, "overflowFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult SubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
auto overflowFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
if (parser.parseOptionalKeyword("overflow")) {
|
|
return std::nullopt;
|
|
}
|
|
if (parser.parseLess()) {
|
|
return ::mlir::failure();
|
|
}
|
|
auto parseRes = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(parser);
|
|
if (::mlir::failed(parseRes) ||
|
|
::mlir::failed(parser.parseGreater())) {
|
|
return ::mlir::failure();
|
|
}
|
|
propStorage = *parseRes;
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<SubOp::Properties>().overflowFlags);
|
|
if (overflowFlagsPropParseResult.has_value() && failed(*overflowFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (overflowFlagsPropParseResult.has_value() && succeeded(*overflowFlagsPropParseResult)) {
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SubOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
if (getOverflowFlags() != ::mlir::LLVM::IntegerOverflowFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "overflow<" << getProperties().overflowFlags << ">";;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SubOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::SubOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::SwitchOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(SwitchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> SwitchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::std::optional< ::mlir::DenseIntElementsAttr > SwitchOpGenericAdaptorBase::getCaseValues() {
|
|
auto attr = getCaseValuesAttr();
|
|
return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> SwitchOpGenericAdaptorBase::getCaseOperandSegments() {
|
|
auto attr = getCaseOperandSegmentsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> SwitchOpGenericAdaptorBase::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SwitchOpAdaptor::SwitchOpAdaptor(SwitchOp op) : SwitchOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SwitchOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments;
|
|
if (!tblgen_case_operand_segments) return emitError(loc, "'llvm.switch' op requires attribute 'case_operand_segments'");
|
|
auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values;
|
|
|
|
if (tblgen_case_values && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_case_values))) && ((true))))
|
|
return emitError(loc, "'llvm.switch' op attribute 'case_values' failed to satisfy constraint: integer elements attribute");
|
|
|
|
if (tblgen_case_operand_segments && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_case_operand_segments))))
|
|
return emitError(loc, "'llvm.switch' op attribute 'case_operand_segments' failed to satisfy constraint: i32 dense array attribute");
|
|
|
|
if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights))))
|
|
return emitError(loc, "'llvm.switch' op attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> SwitchOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange SwitchOp::getDefaultOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRangeRange SwitchOp::getCaseOperandsMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getCaseOperandSegmentsAttrName()));
|
|
}
|
|
|
|
::llvm::LogicalResult SwitchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.branch_weights;
|
|
auto attr = dict.get("branch_weights");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.case_operand_segments;
|
|
auto attr = dict.get("case_operand_segments");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `case_operand_segments` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.case_values;
|
|
auto attr = dict.get("case_values");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `case_values` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SwitchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.branch_weights;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("branch_weights",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.case_operand_segments;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("case_operand_segments",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.case_values;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("case_values",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SwitchOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.branch_weights.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.case_operand_segments.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.case_values.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SwitchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "branch_weights")
|
|
return prop.branch_weights;
|
|
|
|
if (name == "case_operand_segments")
|
|
return prop.case_operand_segments;
|
|
|
|
if (name == "case_values")
|
|
return prop.case_values;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SwitchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "branch_weights") {
|
|
prop.branch_weights = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.branch_weights)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "case_operand_segments") {
|
|
prop.case_operand_segments = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.case_operand_segments)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "case_values") {
|
|
prop.case_values = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.case_values)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SwitchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights);
|
|
|
|
if (prop.case_operand_segments) attrs.append("case_operand_segments", prop.case_operand_segments);
|
|
|
|
if (prop.case_values) attrs.append("case_values", prop.case_values);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult SwitchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "branch_weights", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCaseOperandSegmentsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "case_operand_segments", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps48(attr, "case_values", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SwitchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.case_operand_segments)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.case_values)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SwitchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.branch_weights);
|
|
writer.writeAttribute(prop.case_operand_segments);
|
|
|
|
writer.writeOptionalAttribute(prop.case_values);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::std::optional< ::mlir::DenseIntElementsAttr > SwitchOp::getCaseValues() {
|
|
auto attr = getCaseValuesAttr();
|
|
return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::llvm::ArrayRef<int32_t> SwitchOp::getCaseOperandSegments() {
|
|
auto attr = getCaseOperandSegmentsAttr();
|
|
return attr;
|
|
}
|
|
|
|
::std::optional<::llvm::ArrayRef<int32_t>> SwitchOp::getBranchWeights() {
|
|
auto attr = getBranchWeightsAttr();
|
|
return attr ? ::std::optional<::llvm::ArrayRef<int32_t>>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void SwitchOp::setCaseOperandSegments(::llvm::ArrayRef<int32_t> attrValue) {
|
|
getProperties().case_operand_segments = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
|
|
}
|
|
|
|
void SwitchOp::setBranchWeights(::std::optional<::llvm::ArrayRef<int32_t>> attrValue) {
|
|
auto &odsProp = getProperties().branch_weights;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef<APInt> caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef<APInt> caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef<int32_t> caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef<int32_t> caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value value, Block *defaultDestination, ValueRange defaultOperands, DenseIntElementsAttr caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value value, Block *defaultDestination, ValueRange defaultOperands, DenseIntElementsAttr caseValues, BlockRange caseDestinations, ArrayRef<ValueRange> caseOperands, ArrayRef<int32_t> branchWeights) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseValues)>(caseValues), std::forward<decltype(caseDestinations)>(caseDestinations), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(branchWeights)>(branchWeights));
|
|
}
|
|
|
|
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addSuccessors(destinations);
|
|
odsState.addAttributes(attributes);
|
|
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange operands, SuccessorRange destinations, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(destinations)>(destinations), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(defaultOperands);
|
|
for (::mlir::ValueRange range : caseOperands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : caseOperands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().case_operand_segments = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(defaultOperands.size()), llvm::accumulate(caseOperands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (case_values) {
|
|
odsState.getOrAddProperties<Properties>().case_values = case_values;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
odsState.addSuccessors(defaultDestination);
|
|
odsState.addSuccessors(caseDestinations);
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(case_values)>(case_values), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(caseDestinations)>(caseDestinations));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(case_values)>(case_values), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(caseDestinations)>(caseDestinations));
|
|
}
|
|
|
|
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(defaultOperands);
|
|
for (::mlir::ValueRange range : caseOperands)
|
|
odsState.addOperands(range);
|
|
{
|
|
::llvm::SmallVector<int32_t> rangeSegments;
|
|
for (::mlir::ValueRange range : caseOperands)
|
|
rangeSegments.push_back(range.size());
|
|
auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments);
|
|
odsState.getOrAddProperties<Properties>().case_operand_segments = rangeAttr; }
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(defaultOperands.size()), llvm::accumulate(caseOperands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast<int32_t>(range.size()); })}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (case_values) {
|
|
odsState.getOrAddProperties<Properties>().case_values = case_values;
|
|
}
|
|
if (branch_weights) {
|
|
odsState.getOrAddProperties<Properties>().branch_weights = branch_weights;
|
|
}
|
|
odsState.addSuccessors(defaultDestination);
|
|
odsState.addSuccessors(caseDestinations);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(case_values)>(case_values), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(caseDestinations)>(caseDestinations));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(defaultOperands)>(defaultOperands), std::forward<decltype(caseOperands)>(caseOperands), std::forward<decltype(case_values)>(case_values), std::forward<decltype(branch_weights)>(branch_weights), std::forward<decltype(defaultDestination)>(defaultDestination), std::forward<decltype(caseDestinations)>(caseDestinations));
|
|
}
|
|
|
|
void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SwitchOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SwitchOp::verifyInvariantsImpl() {
|
|
auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights;
|
|
auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments;
|
|
if (!tblgen_case_operand_segments) return emitOpError("requires attribute 'case_operand_segments'");
|
|
auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps48(*this, tblgen_case_values, "case_values")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_case_operand_segments, "case_operand_segments")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_branch_weights, "branch_weights")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps18(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "case_operand_segments", "caseOperands", valueGroup2.size())))
|
|
return ::mlir::failure();
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps18(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SwitchOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult SwitchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Block *defaultDestinationSuccessor = nullptr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> defaultOperandsOperands;
|
|
::llvm::SMLoc defaultOperandsOperandsLoc;
|
|
(void)defaultOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> defaultOperandsTypes;
|
|
::mlir::DenseIntElementsAttr case_valuesAttr;
|
|
::llvm::SmallVector<::mlir::Block *, 2> caseDestinationsSuccessors;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> caseOperandsOperands;
|
|
llvm::SmallVector<int32_t> caseOperandsOperandGroupSizes;
|
|
::llvm::SMLoc caseOperandsOperandsLoc;
|
|
(void)caseOperandsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> caseOperandsTypes;
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseSuccessor(defaultDestinationSuccessor))
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalLParen())) {
|
|
|
|
defaultOperandsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(defaultOperandsOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(defaultOperandsTypes))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
caseOperandsOperandsLoc = parser.getCurrentLocation();
|
|
::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> caseOperandsOperandGroups;
|
|
::llvm::SmallVector<llvm::SmallVector<::mlir::Type>> caseOperandsTypeGroups;
|
|
auto odsResult = parseSwitchOpCases(parser, valueRawType, case_valuesAttr, caseDestinationsSuccessors, caseOperandsOperandGroups, caseOperandsTypeGroups);
|
|
if (odsResult) return ::mlir::failure();
|
|
if (case_valuesAttr)
|
|
result.getOrAddProperties<SwitchOp::Properties>().case_values = case_valuesAttr;
|
|
for (const auto &subRange : caseOperandsOperandGroups) {
|
|
caseOperandsOperands.append(subRange.begin(), subRange.end());
|
|
caseOperandsOperandGroupSizes.push_back(subRange.size());
|
|
}
|
|
for (const auto &subRange : caseOperandsTypeGroups)
|
|
caseOperandsTypes.append(subRange.begin(), subRange.end());
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
result.addSuccessors(defaultDestinationSuccessor);
|
|
result.addSuccessors(caseDestinationsSuccessors);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(defaultOperandsOperands.size()), static_cast<int32_t>(caseOperandsOperands.size())}), result.getOrAddProperties<SwitchOp::Properties>().operandSegmentSizes.begin());
|
|
result.getOrAddProperties<SwitchOp::Properties>().case_operand_segments = parser.getBuilder().getDenseI32ArrayAttr(caseOperandsOperandGroupSizes);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(defaultOperandsOperands, defaultOperandsTypes, defaultOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(caseOperandsOperands, caseOperandsTypes, caseOperandsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SwitchOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDefaultDestination();
|
|
if (!getDefaultOperands().empty()) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getDefaultOperands();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDefaultOperands().getTypes();
|
|
_odsPrinter << ")";
|
|
}
|
|
_odsPrinter << ' ';
|
|
printSwitchOpCases(_odsPrinter, *this, getValue().getType(), getCaseValuesAttr(), getCaseDestinations(), getCaseOperands(), getCaseOperands().getTypes());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("case_operand_segments");
|
|
elidedAttrs.push_back("case_values");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void SwitchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SwitchOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::SwitchOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::TruncOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
TruncOpGenericAdaptorBase::TruncOpGenericAdaptorBase(TruncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
TruncOpAdaptor::TruncOpAdaptor(TruncOp op) : TruncOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult TruncOpAdaptor::verify(::mlir::Location loc) {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (!(((static_cast<uint32_t>(tblgen_overflowFlags) & ~3) == 0)))
|
|
return emitError(loc, "'llvm.trunc' op property 'overflowFlags' failed to satisfy constraint: LLVM integer overflow flags");
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TruncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
auto customAttr = ::mlir::dyn_cast_if_present<::mlir::LLVM::IntegerOverflowFlagsAttr>(propAttr);
|
|
if (customAttr) {
|
|
propStorage = customAttr.getValue();
|
|
return ::mlir::success();
|
|
}
|
|
auto intAttr = ::mlir::dyn_cast_if_present<::mlir::IntegerAttr>(propAttr);
|
|
if (!intAttr) {
|
|
return emitError() << "expected ::mlir::LLVM::IntegerOverflowFlagsAttr or IntegerAttr storage for ::mlir::LLVM::IntegerOverflowFlags";
|
|
}
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(intAttr.getValue().getZExtValue());
|
|
return ::mlir::success();
|
|
};
|
|
auto attr = dict.get("overflowFlags");;
|
|
;
|
|
if (attr) {
|
|
if (::mlir::failed(setFromAttr(prop.overflowFlags, attr, [&]() {
|
|
return emitError() << "for `overflowFlags`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
} else {
|
|
prop.overflowFlags = ::mlir::LLVM::IntegerOverflowFlags::none;
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute TruncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.overflowFlags;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::IntegerAttr::get(::mlir::IntegerType::get(ctx, 32), static_cast<uint32_t>(propStorage));
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("overflowFlags", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code TruncOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_value(prop.overflowFlags));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> TruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void TruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void TruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult TruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TruncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
auto readProp = [&]() {
|
|
uint64_t rawValue;
|
|
if (::mlir::failed(reader.readVarInt(rawValue)))
|
|
return ::mlir::failure();
|
|
if (rawValue > std::numeric_limits<uint32_t>::max())
|
|
return ::mlir::failure();
|
|
propStorage = static_cast<::mlir::LLVM::IntegerOverflowFlags>(rawValue);;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TruncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
{
|
|
auto &propStorage = prop.overflowFlags;
|
|
writer.writeVarInt(static_cast<uint64_t>(propStorage));;
|
|
}
|
|
}
|
|
|
|
void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<TruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<TruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
odsState.addOperands(arg);
|
|
odsState.getOrAddProperties<Properties>().setOverflowFlags(overflowFlags);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
auto __res__ = ::llvm::dyn_cast<TruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::LLVM::IntegerOverflowFlags overflowFlags) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(overflowFlags)>(overflowFlags));
|
|
}
|
|
|
|
void TruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<TruncOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<TruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void TruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<TruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TruncOp TruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult TruncOp::verifyInvariantsImpl() {
|
|
{
|
|
|
|
[[maybe_unused]] ::mlir::LLVM::IntegerOverflowFlags tblgen_overflowFlags = this->getOverflowFlags();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_prop_constraint_LLVMOps1(*this, tblgen_overflowFlags, "overflowFlags")))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TruncOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult TruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
auto overflowFlagsPropParseResult = [&](auto& propStorage) -> ::mlir::OptionalParseResult {
|
|
if (parser.parseOptionalKeyword("overflow")) {
|
|
return std::nullopt;
|
|
}
|
|
if (parser.parseLess()) {
|
|
return ::mlir::failure();
|
|
}
|
|
auto parseRes = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(parser);
|
|
if (::mlir::failed(parseRes) ||
|
|
::mlir::failed(parser.parseGreater())) {
|
|
return ::mlir::failure();
|
|
}
|
|
propStorage = *parseRes;
|
|
return ::mlir::success();
|
|
}(result.getOrAddProperties<TruncOp::Properties>().overflowFlags);
|
|
if (overflowFlagsPropParseResult.has_value() && failed(*overflowFlagsPropParseResult)) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (overflowFlagsPropParseResult.has_value() && succeeded(*overflowFlagsPropParseResult)) {
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
if (getOverflowFlags() != ::mlir::LLVM::IntegerOverflowFlags::none) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "overflow<" << getProperties().overflowFlags << ">";;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void TruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TruncOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::TruncOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::UDivOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
UDivOpGenericAdaptorBase::UDivOpGenericAdaptorBase(UDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr UDivOpGenericAdaptorBase::getIsExactAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isExact);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool UDivOpGenericAdaptorBase::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
UDivOpAdaptor::UDivOpAdaptor(UDivOp op) : UDivOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult UDivOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (tblgen_isExact && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isExact))))
|
|
return emitError(loc, "'llvm.udiv' op attribute 'isExact' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.isExact;
|
|
auto attr = dict.get("isExact");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `isExact` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute UDivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.isExact;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("isExact",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code UDivOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.isExact.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> UDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "isExact")
|
|
return prop.isExact;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void UDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "isExact") {
|
|
prop.isExact = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.isExact)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void UDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.isExact) attrs.append("isExact", prop.isExact);
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIsExactAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "isExact", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.isExact)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UDivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.isExact);
|
|
}
|
|
|
|
bool UDivOp::getIsExact() {
|
|
auto attr = getIsExactAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void UDivOp::setIsExact(bool attrValue) {
|
|
auto &odsProp = getProperties().isExact;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = isExact;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::UnitAttr isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
if (isExact) {
|
|
odsState.getOrAddProperties<Properties>().isExact = ((isExact) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/bool isExact) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs), std::forward<decltype(isExact)>(isExact));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<UDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<UDivOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<UDivOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::verifyInvariantsImpl() {
|
|
auto tblgen_isExact = getProperties().isExact; (void)tblgen_isExact;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_isExact, "isExact")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult UDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult UDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("exact"))) {
|
|
result.getOrAddProperties<UDivOp::Properties>().isExact = parser.getBuilder().getUnitAttr(); }
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getIsExactAttr() && getIsExactAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "exact";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("isExact");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getIsExactAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("isExact");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void UDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UDivOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::UDivOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::UIToFPOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
UIToFPOpGenericAdaptorBase::UIToFPOpGenericAdaptorBase(UIToFPOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr UIToFPOpGenericAdaptorBase::getNonNegAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nonNeg);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool UIToFPOpGenericAdaptorBase::getNonNeg() {
|
|
auto attr = getNonNegAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
UIToFPOpAdaptor::UIToFPOpAdaptor(UIToFPOp op) : UIToFPOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult UIToFPOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_nonNeg = getProperties().nonNeg; (void)tblgen_nonNeg;
|
|
|
|
if (tblgen_nonNeg && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nonNeg))))
|
|
return emitError(loc, "'llvm.uitofp' op attribute 'nonNeg' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UIToFPOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nonNeg;
|
|
auto attr = dict.get("nonNeg");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nonNeg` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute UIToFPOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.nonNeg;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nonNeg",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code UIToFPOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.nonNeg.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> UIToFPOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "nonNeg")
|
|
return prop.nonNeg;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void UIToFPOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "nonNeg") {
|
|
prop.nonNeg = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nonNeg)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void UIToFPOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.nonNeg) attrs.append("nonNeg", prop.nonNeg);
|
|
}
|
|
|
|
::llvm::LogicalResult UIToFPOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNonNegAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nonNeg", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UIToFPOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nonNeg)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UIToFPOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.nonNeg);
|
|
}
|
|
|
|
bool UIToFPOp::getNonNeg() {
|
|
auto attr = getNonNegAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void UIToFPOp::setNonNeg(bool attrValue) {
|
|
auto &odsProp = getProperties().nonNeg;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = nonNeg;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = nonNeg;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = ((nonNeg) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = ((nonNeg) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<UIToFPOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<UIToFPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UIToFPOp UIToFPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult UIToFPOp::verifyInvariantsImpl() {
|
|
auto tblgen_nonNeg = getProperties().nonNeg; (void)tblgen_nonNeg;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nonNeg, "nonNeg")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UIToFPOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult UIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("nneg"))) {
|
|
result.getOrAddProperties<UIToFPOp::Properties>().nonNeg = parser.getBuilder().getUnitAttr(); }
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getNonNegAttr() && getNonNegAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "nneg";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("nonNeg");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNonNegAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("nonNeg");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void UIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UIToFPOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::UIToFPOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::URemOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
URemOpGenericAdaptorBase::URemOpGenericAdaptorBase(URemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
URemOpAdaptor::URemOpAdaptor(URemOp op) : URemOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult URemOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult URemOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute URemOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code URemOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> URemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void URemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void URemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult URemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(URemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(URemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(URemOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<URemOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
URemOp URemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult URemOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult URemOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult URemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult URemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void URemOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void URemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::URemOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::UndefOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(UndefOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
UndefOpAdaptor::UndefOpAdaptor(UndefOp op) : UndefOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult UndefOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UndefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute UndefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code UndefOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> UndefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void UndefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void UndefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult UndefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UndefOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res));
|
|
auto __res__ = ::llvm::dyn_cast<UndefOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res));
|
|
}
|
|
|
|
void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<UndefOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void UndefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UndefOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UndefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<UndefOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult UndefOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UndefOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult UndefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UndefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void UndefOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UndefOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::UnreachableOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
UnreachableOpGenericAdaptorBase::UnreachableOpGenericAdaptorBase(UnreachableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
UnreachableOpAdaptor::UnreachableOpAdaptor(UnreachableOp op) : UnreachableOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult UnreachableOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UnreachableOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute UnreachableOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code UnreachableOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> UnreachableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void UnreachableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void UnreachableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult UnreachableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__);
|
|
auto __res__ = ::llvm::dyn_cast<UnreachableOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder) {
|
|
return create(builder, builder.getLoc());
|
|
}
|
|
|
|
void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<UnreachableOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void UnreachableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<UnreachableOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void UnreachableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<UnreachableOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult UnreachableOp::verifyInvariantsImpl() {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UnreachableOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult UnreachableOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UnreachableOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UnreachableOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::VaArgOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
VaArgOpGenericAdaptorBase::VaArgOpGenericAdaptorBase(VaArgOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
VaArgOpAdaptor::VaArgOpAdaptor(VaArgOp op) : VaArgOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult VaArgOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult VaArgOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute VaArgOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code VaArgOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> VaArgOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void VaArgOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void VaArgOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult VaArgOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void VaArgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<VaArgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void VaArgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<VaArgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void VaArgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
odsState.addOperands(arg);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
auto __res__ = ::llvm::dyn_cast<VaArgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg));
|
|
}
|
|
|
|
void VaArgOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<VaArgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void VaArgOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<VaArgOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
VaArgOp VaArgOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult VaArgOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult VaArgOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult VaArgOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::llvm::ArrayRef<::mlir::Type> argTypes;
|
|
::llvm::ArrayRef<::mlir::Type> resTypes;
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::FunctionType arg__res_functionType;
|
|
if (parser.parseType(arg__res_functionType))
|
|
return ::mlir::failure();
|
|
argTypes = arg__res_functionType.getInputs();
|
|
resTypes = arg__res_functionType.getResults();
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void VaArgOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getArg().getType()), ::llvm::ArrayRef<::mlir::Type>(getRes().getType()));
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaArgOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::XOrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
XOrOpGenericAdaptorBase::XOrOpGenericAdaptorBase(XOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
XOrOpAdaptor::XOrOpAdaptor(XOrOp op) : XOrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult XOrOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult XOrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute XOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code XOrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> XOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void XOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void XOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult XOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<XOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
XOrOp XOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult XOrOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult XOrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult XOrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult XOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void XOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void XOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::XOrOp)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ZExtOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ZExtOpGenericAdaptorBase::ZExtOpGenericAdaptorBase(ZExtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr ZExtOpGenericAdaptorBase::getNonNegAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nonNeg);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool ZExtOpGenericAdaptorBase::getNonNeg() {
|
|
auto attr = getNonNegAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ZExtOpAdaptor::ZExtOpAdaptor(ZExtOp op) : ZExtOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ZExtOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_nonNeg = getProperties().nonNeg; (void)tblgen_nonNeg;
|
|
|
|
if (tblgen_nonNeg && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nonNeg))))
|
|
return emitError(loc, "'llvm.zext' op attribute 'nonNeg' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ZExtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.nonNeg;
|
|
auto attr = dict.get("nonNeg");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `nonNeg` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ZExtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.nonNeg;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("nonNeg",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ZExtOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.nonNeg.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ZExtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "nonNeg")
|
|
return prop.nonNeg;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ZExtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "nonNeg") {
|
|
prop.nonNeg = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.nonNeg)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ZExtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.nonNeg) attrs.append("nonNeg", prop.nonNeg);
|
|
}
|
|
|
|
::llvm::LogicalResult ZExtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNonNegAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "nonNeg", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ZExtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.nonNeg)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ZExtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.nonNeg);
|
|
}
|
|
|
|
bool ZExtOp::getNonNeg() {
|
|
auto attr = getNonNegAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void ZExtOp::setNonNeg(bool attrValue) {
|
|
auto &odsProp = getProperties().nonNeg;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = nonNeg;
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = nonNeg;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/::mlir::UnitAttr nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = ((nonNeg) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
odsState.addOperands(arg);
|
|
if (nonNeg) {
|
|
odsState.getOrAddProperties<Properties>().nonNeg = ((nonNeg) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, /*optional*/bool nonNeg) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(nonNeg)>(nonNeg));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ZExtOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ZExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZExtOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZExtOp ZExtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ZExtOp::verifyInvariantsImpl() {
|
|
auto tblgen_nonNeg = getProperties().nonNeg; (void)tblgen_nonNeg;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_nonNeg, "nonNeg")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ZExtOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ZExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
|
|
(void)argOperandsLoc;
|
|
::mlir::Type argRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("nneg"))) {
|
|
result.getOrAddProperties<ZExtOp::Properties>().nonNeg = parser.getBuilder().getUnitAttr(); }
|
|
|
|
argOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(argRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
argRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ZExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getNonNegAttr() && getNonNegAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "nneg";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getArg();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("nonNeg");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNonNegAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("nonNeg");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getArg().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ZExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZExtOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::detail::ZExtOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::LLVM {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::LLVM::ZeroOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ZeroOpGenericAdaptorBase::ZeroOpGenericAdaptorBase(ZeroOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
ZeroOpAdaptor::ZeroOpAdaptor(ZeroOp op) : ZeroOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ZeroOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ZeroOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ZeroOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ZeroOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ZeroOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ZeroOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ZeroOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ZeroOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
if (resultType) odsState.addTypes(resultType);
|
|
odsState.addOperands(operands);
|
|
for (auto namedAttr : attributes)
|
|
odsState.addAttribute(namedAttr.getName(), namedAttr.getValue());
|
|
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZeroOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::ImplicitLocOpBuilder &builder, Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultType)>(resultType), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res));
|
|
auto __res__ = ::llvm::dyn_cast<ZeroOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res));
|
|
}
|
|
|
|
void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ZeroOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void ZeroOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZeroOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ZeroOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ZeroOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ZeroOp ZeroOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ZeroOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ZeroOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ZeroOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ZeroOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ZeroOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::LLVM
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZeroOp)
|
|
|
|
|
|
#endif // GET_OP_CLASSES
|
|
|