MLIR
22.0.0git
include
mlir
Target
LLVMIR
TypeToLLVM.h
Go to the documentation of this file.
1
//===- TypeToLLVM.h - Translate types from MLIR to LLVM --*- C++ -*-===//
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 declares the type translation function going from MLIR LLVM dialect
10
// to LLVM IR and back.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef MLIR_TARGET_LLVMIR_TYPETOLLVM_H
15
#define MLIR_TARGET_LLVMIR_TYPETOLLVM_H
16
17
#include <memory>
18
19
namespace
llvm
{
20
class
DataLayout;
21
class
LLVMContext;
22
class
Type;
23
}
// namespace llvm
24
25
namespace
mlir
{
26
27
class
Type
;
28
class
MLIRContext
;
29
30
namespace
LLVM
{
31
32
namespace
detail
{
33
class
TypeToLLVMIRTranslatorImpl
;
34
}
// namespace detail
35
36
/// Utility class to translate MLIR LLVM dialect types to LLVM IR. Stores the
37
/// translation state, in particular any identified structure types that can be
38
/// reused in further translation.
39
class
TypeToLLVMIRTranslator
{
40
public
:
41
TypeToLLVMIRTranslator
(llvm::LLVMContext &context);
42
~TypeToLLVMIRTranslator
();
43
44
/// Returns the preferred alignment for the type given the data layout. Note
45
/// that this will perform type conversion and store its results for future
46
/// uses.
47
// TODO: this should be removed when MLIR has proper data layout.
48
unsigned
getPreferredAlignment
(
Type
type,
const
llvm::DataLayout &layout);
49
50
/// Translates the given MLIR LLVM dialect type to LLVM IR.
51
llvm::Type *
translateType
(
Type
type);
52
53
private
:
54
/// Private implementation.
55
std::unique_ptr<detail::TypeToLLVMIRTranslatorImpl>
impl
;
56
};
57
58
}
// namespace LLVM
59
}
// namespace mlir
60
61
#endif
// MLIR_TARGET_LLVMIR_TYPETOLLVM_H
mlir::LLVM::TypeToLLVMIRTranslator::getPreferredAlignment
unsigned getPreferredAlignment(Type type, const llvm::DataLayout &layout)
Returns the preferred alignment for the type given the data layout.
Definition
TypeToLLVM.cpp:190
mlir::LLVM::TypeToLLVMIRTranslator::translateType
llvm::Type * translateType(Type type)
Translates the given MLIR LLVM dialect type to LLVM IR.
Definition
TypeToLLVM.cpp:186
mlir::LLVM::TypeToLLVMIRTranslator::TypeToLLVMIRTranslator
TypeToLLVMIRTranslator(llvm::LLVMContext &context)
Definition
TypeToLLVM.cpp:181
mlir::LLVM::TypeToLLVMIRTranslator::~TypeToLLVMIRTranslator
~TypeToLLVMIRTranslator()
mlir::LLVM::detail::TypeToLLVMIRTranslatorImpl
Support for translating MLIR LLVM dialect types to LLVM IR.
Definition
TypeToLLVM.cpp:25
mlir::MLIRContext
MLIRContext is the top-level object for a collection of MLIR operations.
Definition
MLIRContext.h:63
mlir::Type
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition
Types.h:74
impl
Definition
RunnerUtils.h:80
llvm
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition
CallGraph.h:229
mlir::LLVM::detail
Definition
Pattern.h:21
mlir::LLVM
Definition
ConvertFuncToLLVM.h:21
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
Generated on
for MLIR by
1.14.0