15#include "mlir/Dialect/UB/IR/UBOpsDialect.cpp.inc"
23struct UBInlinerInterface :
public DialectInlinerInterface {
24 using DialectInlinerInterface::DialectInlinerInterface;
27 bool isLegalToInline(Operation *, Region *,
bool, IRMapping &)
const final {
33 void handleTerminator(Operation *op,
Block *newDest)
const final {
34 assert(isa<UnreachableOp>(op) &&
"unexpected UB terminator");
41 bool allowSingleBlockOptimization(
Block *)
const final {
return false; }
49void UBDialect::initialize() {
50 addInterfaces<UBInlinerInterface>();
51 declarePromisedInterface<ConvertToLLVMPatternInterface, UBDialect>();
56 if (
auto attr = dyn_cast<PoisonAttr>(value))
57 return PoisonOp::create(builder, loc, type, attr);
62OpFoldResult PoisonOp::fold(FoldAdaptor ) {
return getValue(); }
64#include "mlir/Dialect/UB/IR/UBOpsInterfaces.cpp.inc"
66#define GET_ATTRDEF_CLASSES
67#include "mlir/Dialect/UB/IR/UBOpsAttributes.cpp.inc"
70#include "mlir/Dialect/UB/IR/UBOps.cpp.inc"
static bool isLegalToInline(InlinerInterface &interface, Region *src, Region *insertRegion, bool shouldCloneInlinedRegion, IRMapping &valueMapping)
Utility to check that all of the operations within 'src' can be inlined.
Attributes are known-constant values of operations.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
This class represents a single result from folding an operation.
Operation is the basic unit of execution within MLIR.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Include the generated interface declarations.