LLVM
23.0.0git
include
llvm
ABI
IRTypeMapper.h
Go to the documentation of this file.
1
//===---- IRTypeMapper.h - Maps LLVM ABI Types to LLVM IR Types ---------===//
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
/// \file
10
/// Maps LLVM ABI type representations back to corresponding LLVM IR types.
11
/// Used by frontends after the ABI library has computed argument/return
12
/// classification: coerce-to types in the ABI representation must be
13
/// translated to llvm::Type before being handed back to the IR builder.
14
///
15
//===----------------------------------------------------------------------===//
16
17
#ifndef LLVM_ABI_IRTYPEMAPPER_H
18
#define LLVM_ABI_IRTYPEMAPPER_H
19
20
#include "
llvm/ABI/Types.h
"
21
#include "
llvm/ADT/DenseMap.h
"
22
23
namespace
llvm
{
24
class
LLVMContext
;
25
class
Type
;
26
class
StructType
;
27
class
DataLayout
;
28
29
namespace
abi
{
30
31
class
IRTypeMapper
{
32
public
:
33
IRTypeMapper
(
LLVMContext
&Ctx,
const
DataLayout
&DL) : Context(Ctx), DL(DL) {}
34
35
llvm::Type
*
convertType
(
const
abi::Type
*ABIType);
36
37
void
clearCache
() { TypeCache.clear(); }
38
39
private
:
40
LLVMContext
&Context;
41
const
DataLayout
&
DL
;
42
43
llvm::DenseMap<const abi::Type *, llvm::Type *>
TypeCache;
44
45
llvm::Type
*convertArrayType(
const
abi::ArrayType
*AT);
46
llvm::Type
*convertVectorType(
const
abi::VectorType
*VT);
47
llvm::Type
*convertRecordType(
const
abi::RecordType
*RT);
48
llvm::Type
*convertComplexType(
const
abi::ComplexType
*CT);
49
llvm::Type
*convertMemberPointerType(
const
abi::MemberPointerType
*MPT);
50
51
llvm::StructType
*createStructFromFields(
ArrayRef<abi::FieldInfo>
Fields,
52
TypeSize
Size
,
Align
Alignment,
53
bool
IsUnion
);
54
llvm::Type
*createPaddingType(
uint64_t
PaddingBits);
55
};
56
57
}
// namespace abi
58
}
// namespace llvm
59
60
#endif
// LLVM_ABI_ABITYPEMAPPER_H
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition
ARMSLSHardening.cpp:73
DenseMap.h
This file defines the DenseMap class.
InlinePriorityMode::Size
@ Size
Definition
InlineOrder.cpp:25
llvm::ArrayRef
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition
ArrayRef.h:39
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition
DataLayout.h:64
llvm::DenseMap
Definition
DenseMap.h:743
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition
LLVMContext.h:68
llvm::StructType
Class to represent struct types.
Definition
DerivedTypes.h:262
llvm::TypeSize
Definition
TypeSize.h:332
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition
Type.h:46
llvm::abi::ArrayType
Definition
Types.h:190
llvm::abi::ComplexType
Definition
Types.h:93
llvm::abi::IRTypeMapper::clearCache
void clearCache()
Definition
IRTypeMapper.h:37
llvm::abi::IRTypeMapper::IRTypeMapper
IRTypeMapper(LLVMContext &Ctx, const DataLayout &DL)
Definition
IRTypeMapper.h:33
llvm::abi::IRTypeMapper::convertType
llvm::Type * convertType(const abi::Type *ABIType)
Definition
IRTypeMapper.cpp:19
llvm::abi::MemberPointerType
Definition
Types.h:173
llvm::abi::RecordType
Definition
Types.h:263
llvm::abi::Type
Represents the ABI-specific view of a type in LLVM.
Definition
Types.h:43
llvm::abi::VectorType
Definition
Types.h:211
uint64_t
Types.h
This file defines the type system for the LLVMABI library, which mirrors ABI-relevant aspects of fron...
llvm::abi
Definition
FunctionInfo.h:26
llvm::abi::IsUnion
@ IsUnion
Definition
Types.h:255
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
FunctionInfo.h:25
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition
Alignment.h:39
Generated on
for LLVM by
1.14.0