24 struct LegacyStructLayout {
28 std::pair<uint32_t, uint32_t> getElementLegacyOffset(
unsigned Idx)
const {
29 assert(Idx < Offsets.size() &&
"Invalid element idx!");
32 return std::make_pair((
Offset - Ch) / RowAlign, Ch);
43 LegacyStructLayout &getStructLayout(
StructType *ST);
54 return getTypeAllocSize(Ty);
60 if (AlignedOffset ==
Offset)
72TypeSize LegacyCBufferLayout::getTypeAllocSize(
Type *Ty) {
74 LegacyStructLayout &Layout = getStructLayout(ST);
77 unsigned NumElts = AT->getNumElements();
81 TypeSize EltSize = getTypeAllocSize(AT->getElementType());
82 TypeSize AlignedEltSize = alignTo4Dwords(EltSize);
88 return DL.getTypeStoreSize(Ty);
92LegacyCBufferLayout::LegacyStructLayout &
93LegacyCBufferLayout::getStructLayout(StructType *ST) {
94 auto it = StructLayouts.find(ST);
95 if (it != StructLayouts.end())
99 LegacyStructLayout Layout;
101 for (
Type *EltTy :
ST->elements()) {
102 TypeSize EltSize = getTypeAllocSize(EltTy);
106 Layout.Offsets.emplace_back(
Offset);
110 StructLayouts[
ST] = Layout;
111 return StructLayouts[
ST];
115 : DL(DL), IsLegacyLayout(IsLegacy),
123 return LegacyDL->getTypeAllocSizeInBytes(Ty);
125 return DL.getTypeAllocSize(Ty);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
A parsed version of the target data layout string in and methods for querying it.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Class to represent struct types.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
CBufferDataLayout(const DataLayout &DL, const bool IsLegacy)
llvm::TypeSize getTypeAllocSizeInBytes(Type *Ty)
LegacyCBufferLayout(const DataLayout &DL)
TypeSize getTypeAllocSizeInBytes(Type *Ty)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Implement std::hash so that hash_code can be used in STL containers.