MLIR
20.0.0git
lib
Target
LLVMIR
Dialect
ArmSME
ArmSMEToLLVMIRTranslation.cpp
Go to the documentation of this file.
1
//======- ArmSMEToLLVMIRTranslation.cpp - Translate ArmSME to LLVM IR -=======//
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
// This file implements a translation between the ArmSME dialect and LLVM IR.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "
mlir/Target/LLVMIR/Dialect/ArmSME/ArmSMEToLLVMIRTranslation.h
"
14
#include "
mlir/Dialect/ArmSME/IR/ArmSME.h
"
15
#include "
mlir/IR/Operation.h
"
16
#include "
mlir/Target/LLVMIR/ModuleTranslation.h
"
17
18
#include "llvm/IR/IRBuilder.h"
19
#include "llvm/IR/IntrinsicsAArch64.h"
20
21
using namespace
mlir
;
22
using namespace
mlir::LLVM
;
23
24
namespace
{
25
/// Implementation of the dialect interface that converts operations belonging
26
/// to the ArmSME dialect to LLVM IR.
27
class
ArmSMEDialectLLVMIRTranslationInterface
28
:
public
LLVMTranslationDialectInterface
{
29
public
:
30
using
LLVMTranslationDialectInterface::LLVMTranslationDialectInterface
;
31
32
/// Translates the given operation to LLVM IR using the provided IR builder
33
/// and saving the state in `moduleTranslation`.
34
LogicalResult
35
convertOperation(
Operation
*op, llvm::IRBuilderBase &builder,
36
LLVM::ModuleTranslation
&moduleTranslation)
const
final
{
37
Operation
&opInst = *op;
38
#include "mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc"
39
#include "mlir/Dialect/ArmSME/IR/ArmSMEOpsConversions.inc"
40
41
return
failure();
42
}
43
};
44
}
// namespace
45
46
void
mlir::registerArmSMEDialectTranslation
(
DialectRegistry
®istry) {
47
registry.
insert
<arm_sme::ArmSMEDialect>();
48
registry.
addExtension
(+[](
MLIRContext
*ctx, arm_sme::ArmSMEDialect *dialect) {
49
dialect->addInterfaces<ArmSMEDialectLLVMIRTranslationInterface>();
50
});
51
}
52
53
void
mlir::registerArmSMEDialectTranslation
(
MLIRContext
&context) {
54
DialectRegistry
registry;
55
registerArmSMEDialectTranslation
(registry);
56
context.
appendDialectRegistry
(registry);
57
}
ArmSMEToLLVMIRTranslation.h
ArmSME.h
Operation.h
ModuleTranslation.h
mlir::DialectRegistry
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Definition:
DialectRegistry.h:139
mlir::DialectRegistry::addExtension
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
Definition:
DialectRegistry.h:211
mlir::DialectRegistry::insert
void insert()
Definition:
DialectRegistry.h:148
mlir::LLVMTranslationDialectInterface
Base class for dialect interfaces providing translation to LLVM IR.
Definition:
LLVMTranslationInterface.h:38
mlir::LLVMTranslationDialectInterface::LLVMTranslationDialectInterface
LLVMTranslationDialectInterface(Dialect *dialect)
Definition:
LLVMTranslationInterface.h:40
mlir::LLVM::ModuleTranslation
Implementation class for module translation.
Definition:
ModuleTranslation.h:58
mlir::MLIRContext
MLIRContext is the top-level object for a collection of MLIR operations.
Definition:
MLIRContext.h:60
mlir::MLIRContext::appendDialectRegistry
void appendDialectRegistry(const DialectRegistry ®istry)
Append the contents of the given dialect registry to the registry associated with this context.
Definition:
MLIRContext.cpp:419
mlir::Operation
Operation is the basic unit of execution within MLIR.
Definition:
Operation.h:88
mlir::LLVM
Definition:
ConvertFuncToLLVM.h:21
mlir
Include the generated interface declarations.
Definition:
LocalAliasAnalysis.h:20
mlir::registerArmSMEDialectTranslation
void registerArmSMEDialectTranslation(DialectRegistry ®istry)
Register the ArmSME dialect and the translation from it to the LLVM IR in the given registry;.
Definition:
ArmSMEToLLVMIRTranslation.cpp:46
Generated on Tue Nov 19 2024 04:32:31 for MLIR by
1.9.1