MLIR
22.0.0git
lib
Dialect
Math
IR
MathDialect.cpp
Go to the documentation of this file.
1
//===- MathDialect.cpp - MLIR dialect for Math implementation -------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h
"
10
#include "
mlir/Dialect/Math/IR/Math.h
"
11
#include "
mlir/Transforms/InliningUtils.h
"
12
13
using namespace
mlir
;
14
using namespace
mlir::math
;
15
16
#include "mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc"
17
18
namespace
{
19
/// This class defines the interface for handling inlining with math
20
/// operations.
21
struct
MathInlinerInterface :
public
DialectInlinerInterface
{
22
using
DialectInlinerInterface::DialectInlinerInterface
;
23
24
/// All operations within math ops can be inlined.
25
bool
isLegalToInline
(Operation *, Region *,
bool
, IRMapping &)
const
final
{
26
return
true
;
27
}
28
};
29
}
// namespace
30
31
void
mlir::math::MathDialect::initialize() {
32
addOperations<
33
#define GET_OP_LIST
34
#include "mlir/Dialect/Math/IR/MathOps.cpp.inc"
35
>();
36
addInterfaces<MathInlinerInterface>();
37
declarePromisedInterface<ConvertToLLVMPatternInterface, MathDialect>();
38
}
isLegalToInline
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.
Definition
InliningUtils.cpp:182
InliningUtils.h
ToLLVMInterface.h
mlir::DialectInlinerInterface
This is the interface that must be implemented by the dialects of operations to be inlined.
Definition
InliningUtils.h:44
mlir::DialectInlinerInterface::DialectInlinerInterface
DialectInlinerInterface(Dialect *dialect)
Definition
InliningUtils.h:46
Math.h
mlir::math
Definition
Approximation.h:16
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
Generated on
for MLIR by
1.14.0