MLIR 22.0.0git
ArmNeonToLLVMIRTranslation.cpp
Go to the documentation of this file.
1//===- ArmNeonToLLVMIRTranslation.cpp - Translate ArmNeon 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 MLIR ArmNeon dialect and
10// LLVM IR.
11//
12//===----------------------------------------------------------------------===//
13
16#include "mlir/IR/Operation.h"
18
19#include "llvm/IR/IRBuilder.h"
20#include "llvm/IR/IntrinsicsAArch64.h"
21
22using namespace mlir;
23using namespace mlir::LLVM;
24
25namespace {
26/// Implementation of the dialect interface that converts operations belonging
27/// to the ArmNeon dialect to LLVM IR.
28class ArmNeonDialectLLVMIRTranslationInterface
30public:
32
33 /// Translates the given operation to LLVM IR using the provided IR builder
34 /// and saving the state in `moduleTranslation`.
35 LogicalResult
36 convertOperation(Operation *op, llvm::IRBuilderBase &builder,
37 LLVM::ModuleTranslation &moduleTranslation) const final {
38 Operation &opInst = *op;
39#include "mlir/Dialect/ArmNeon/ArmNeonConversions.inc"
40
41 return failure();
42 }
43};
44} // namespace
45
47 registry.insert<arm_neon::ArmNeonDialect>();
48 registry.addExtension(
49 +[](MLIRContext *ctx, arm_neon::ArmNeonDialect *dialect) {
50 dialect->addInterfaces<ArmNeonDialectLLVMIRTranslationInterface>();
51 });
52}
53
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
Base class for dialect interfaces providing translation to LLVM IR.
MLIRContext is the top-level object for a collection of MLIR operations.
Definition MLIRContext.h:63
void appendDialectRegistry(const DialectRegistry &registry)
Append the contents of the given dialect registry to the registry associated with this context.
Include the generated interface declarations.
void registerArmNeonDialectTranslation(DialectRegistry &registry)
Register the ArmNeon dialect and the translation from it to the LLVM IR in the given registry;.