31 foldResults.append(operands.begin(), operands.end());
41 if (resultTypes.empty())
43 <<
"expected at least one result for cast operation";
46 if (!cast<CastOpInterface>(op).areCastCompatible(operandTypes, resultTypes)) {
48 if (operandTypes.empty())
50 else if (llvm::size(operandTypes) == 1)
51 diag <<
" " << *operandTypes.begin();
53 diag <<
"s " << operandTypes;
54 return diag <<
" and result type" << (resultTypes.size() == 1 ?
" " :
"s ")
55 << resultTypes <<
" are cast incompatible";
69 struct UnrealizedConversionCastOpInterface
70 : CastOpInterface::ExternalModel<UnrealizedConversionCastOpInterface,
71 UnrealizedConversionCastOp> {
83 UnrealizedConversionCastOp::attachInterface<
84 UnrealizedConversionCastOpInterface>(*ctx);
92 #include "mlir/Interfaces/CastInterfaces.cpp.inc"
static std::string diag(const llvm::Value &value)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
This class represents a diagnostic that is inflight and set to be reported.
MLIRContext is the top-level object for a collection of MLIR operations.
This class implements the operand iterators for the Operation class.
type_range getTypes() const
Operation is the basic unit of execution within MLIR.
operand_type_range getOperandTypes()
result_type_range getResultTypes()
operand_range getOperands()
Returns an iterator on the underlying Value's.
result_range getResults()
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
This class implements the result iterators for the Operation class.
type_range getTypes() const
This class provides an abstraction over the various different ranges of value types.
void registerCastOpInterfaceExternalModels(DialectRegistry ®istry)
LogicalResult foldCastInterfaceOp(Operation *op, ArrayRef< Attribute > attrOperands, SmallVectorImpl< OpFoldResult > &foldResults)
Attempt to fold the given cast operation.
LogicalResult verifyCastInterfaceOp(Operation *op)
Attempt to verify the given cast operation.
Include the generated interface declarations.