20 assert(ABIType &&
"convertType requires a non-null ABI type");
22 auto It = TypeCache.find(ABIType);
23 if (It != TypeCache.end())
28 switch (ABIType->getKind()) {
65 TypeCache[ABIType] = Result;
88llvm::Type *IRTypeMapper::convertComplexType(
const abi::ComplexType *CT) {
95IRTypeMapper::convertMemberPointerType(
const abi::MemberPointerType *MPT) {
96 llvm::Type *IntPtrTy = DL.getIntPtrType(Context);
98 llvm::Type *Fields[] = {IntPtrTy, IntPtrTy};
104llvm::Type *IRTypeMapper::createPaddingType(uint64_t PaddingBits) {
105 if (PaddingBits == 0)
107 assert(PaddingBits % 8 == 0 &&
108 "sub-byte padding cannot be expressed as an llvm::Type");
115 TypeSize
Size, Align Alignment,
117 SmallVector<llvm::Type *, 16> FieldTypes;
120 llvm::Type *LargestFieldType =
nullptr;
121 uint64_t LargestFieldSize = 0;
122 for (
const auto &
Field : Fields) {
124 uint64_t FieldSize =
Field.FieldType->getSizeInBits().getFixedValue();
125 if (FieldSize > LargestFieldSize) {
126 LargestFieldSize = FieldSize;
127 LargestFieldType = FieldType;
130 if (LargestFieldType) {
132 uint64_t UnionSizeBits =
Size.getFixedValue();
133 if (LargestFieldSize < UnionSizeBits) {
134 if (llvm::Type *PaddingType =
135 createPaddingType(UnionSizeBits - LargestFieldSize))
140 uint64_t CurrentOffset = 0;
141 for (
const auto &
Field : Fields) {
142 if (
Field.OffsetInBits > CurrentOffset) {
143 if (llvm::Type *PaddingType =
144 createPaddingType(
Field.OffsetInBits - CurrentOffset))
146 CurrentOffset =
Field.OffsetInBits;
148 assert(!
Field.IsBitField &&
"bitfields should not reach IR type mapping");
151 CurrentOffset +=
Field.FieldType->getSizeInBits().getFixedValue();
153 uint64_t TotalSizeBits =
Size.getFixedValue();
154 if (CurrentOffset < TotalSizeBits) {
155 if (llvm::Type *PaddingType =
156 createPaddingType(TotalSizeBits - CurrentOffset))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
Maps LLVM ABI type representations back to corresponding LLVM IR types.
OptimizedStructLayoutField Field
This file defines the SmallVector class.
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
static constexpr ElementCount getFixed(ScalarTy MinVal)
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
static LLVM_ABI PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
void push_back(const T &Elt)
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI Type * getFloatingPointTy(LLVMContext &C, const fltSemantics &S)
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
const Type * getElementType() const
bool isMatrixType() const
uint64_t getNumElements() const
const Type * getElementType() const
llvm::Type * convertType(const abi::Type *ABIType)
bool isFunctionPointer() const
ArrayRef< FieldInfo > getFields() const
Represents the ABI-specific view of a type in LLVM.
TypeSize getSizeInBits() const
Align getAlignment() const
ElementCount getNumElements() const
const Type * getElementType() const
This file defines the type system for the LLVMABI library, which mirrors ABI-relevant aspects of fron...
ElementType
The element type of an SRV or UAV resource.
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.