32   assert(converter && 
"expected non-null type converter");
 
   33   assert(!block->
isEntryBlock() && 
"entry blocks have no predecessors");
 
   40   std::optional<TypeConverter::SignatureConversion> conversion =
 
   44                                        "could not compute block signature");
 
   45   if (expectedTypes != conversion->getConvertedTypes())
 
   48         "mismatch between adaptor operand types and computed block signature");
 
   56     llvm::append_range(result, vals);
 
   66   matchAndRewrite(cf::BranchOp op, OneToNOpAdaptor adaptor,
 
   69     FailureOr<Block *> convertedBlock =
 
   70         getConvertedBlock(rewriter, getTypeConverter(), op, op.getSuccessor(),
 
   72     if (
failed(convertedBlock))
 
   86   matchAndRewrite(cf::CondBranchOp op, OneToNOpAdaptor adaptor,
 
   92     if (!llvm::hasSingleElement(adaptor.getCondition()))
 
   94                                          "expected single element condition");
 
   95     FailureOr<Block *> convertedTrueBlock =
 
   96         getConvertedBlock(rewriter, getTypeConverter(), op, op.getTrueDest(),
 
   98     if (
failed(convertedTrueBlock))
 
  100     FailureOr<Block *> convertedFalseBlock =
 
  101         getConvertedBlock(rewriter, getTypeConverter(), op, op.getFalseDest(),
 
  103     if (
failed(convertedFalseBlock))
 
  106         op, llvm::getSingleElement(adaptor.getCondition()),
 
  107         flattenedAdaptorTrue, flattenedAdaptorFalse, op.getBranchWeightsAttr(),
 
  108         *convertedTrueBlock, *convertedFalseBlock);
 
  119   matchAndRewrite(cf::SwitchOp op, OpAdaptor adaptor,
 
  122     FailureOr<Block *> convertedDefaultBlock = getConvertedBlock(
 
  123         rewriter, getTypeConverter(), op, op.getDefaultDestination(),
 
  124         TypeRange(adaptor.getDefaultOperands()));
 
  125     if (
failed(convertedDefaultBlock))
 
  132       Block *b = it.value();
 
  133       FailureOr<Block *> convertedBlock =
 
  134           getConvertedBlock(rewriter, getTypeConverter(), op, b,
 
  136       if (
failed(convertedBlock))
 
  138       caseDestinations.push_back(*convertedBlock);
 
  142         op, adaptor.getFlag(), *convertedDefaultBlock,
 
  143         adaptor.getDefaultOperands(), adaptor.getCaseValuesAttr(),
 
  144         caseDestinations, caseOperands);
 
  154   patterns.add<BranchOpConversion, CondBranchOpConversion, SwitchOpConversion>(
 
  155       typeConverter, 
patterns.getContext(), benefit);
 
Block represents an ordered list of Operations.
ValueTypeRange< BlockArgListType > getArgumentTypes()
Return a range containing the types of the arguments for this block.
bool isEntryBlock()
Return if this block is the entry block in the parent region.
This class implements a pattern rewriter for use with ConversionPatterns.
Block * applySignatureConversion(Block *block, TypeConverter::SignatureConversion &conversion, const TypeConverter *converter=nullptr)
Apply a signature conversion to given block.
This class describes a specific conversion target.
void addDynamicallyLegalOp(OperationName op, const DynamicLegalityCallbackFn &callback)
Register the given operation as dynamically legal and set the dynamic legalization callback to the on...
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
Operation is the basic unit of execution within MLIR.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the listener that the IR failed to be rewritten because of a match failure,...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
bool isLegal(Type type) const
Return true if the given type is legal for this type converter, i.e.
std::optional< SignatureConversion > convertBlockSignature(Block *block) const
This function converts the type signature of the given block, by invoking 'convertSignatureArg' for e...
This class provides an abstraction over the various different ranges of value types.
This class provides an abstraction over the different types of ranges over Values.
void populateCFStructuralTypeConversionTarget(const TypeConverter &typeConverter, ConversionTarget &target)
Updates the ConversionTarget with dynamic legality of CF operations based on the provided type conver...
void populateCFStructuralTypeConversions(const TypeConverter &typeConverter, RewritePatternSet &patterns, PatternBenefit benefit=1)
Similar to populateCFStructuralTypeConversionsAndLegality but does not populate the conversion target...
void populateCFStructuralTypeConversionsAndLegality(const TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target, PatternBenefit benefit=1)
Populates patterns for CF structural type conversions and sets up the provided ConversionTarget with ...
constexpr void enumerate(std::tuple< Tys... > &tuple, CallbackT &&callback)
SmallVector< Value > flattenValues(ArrayRef< ValueRange > values)
Flatten a set of ValueRange into a single SmallVector<Value>
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns