NFC: Cleanup the naming scheme for registering legalization actions to be consistent, and move a file functions to the source file.
PiperOrigin-RevId: 252639629
This commit is contained in:
committed by
Mehdi Amini
parent
8ad35b90ec
commit
eb28b30940
@@ -724,6 +724,37 @@ FunctionType TypeConverter::convertFunctionSignatureType(
|
||||
return FunctionType::get(arguments, results, type.getContext());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConversionTarget
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Register a legality action for the given operation.
|
||||
void ConversionTarget::setOpAction(OperationName op,
|
||||
LegalizationAction action) {
|
||||
legalOperations[op] = action;
|
||||
}
|
||||
|
||||
/// Register a legality action for the given dialects.
|
||||
void ConversionTarget::setDialectAction(ArrayRef<StringRef> dialectNames,
|
||||
LegalizationAction action) {
|
||||
for (StringRef dialect : dialectNames)
|
||||
legalDialects[dialect] = action;
|
||||
}
|
||||
|
||||
/// Get the legality action for the given operation.
|
||||
auto ConversionTarget::getOpAction(OperationName op) const
|
||||
-> llvm::Optional<LegalizationAction> {
|
||||
// Check for an action for this specific operation.
|
||||
auto it = legalOperations.find(op);
|
||||
if (it != legalOperations.end())
|
||||
return it->second;
|
||||
// Otherwise, default to checking for an action on the parent dialect.
|
||||
auto dialectIt = legalDialects.find(op.getDialect());
|
||||
if (dialectIt != legalDialects.end())
|
||||
return dialectIt->second;
|
||||
return llvm::None;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// applyConversionPatterns
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user