12#ifndef CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H
13#define CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H
15#include "mlir/Dialect/DLTI/DLTI.h"
16#include "mlir/IR/BuiltinOps.h"
26 bool bigEndian =
false;
28 unsigned programAddrSpace = 0;
37 void reset(mlir::DataLayoutSpecInterface spec);
44 llvm::Align
getAlignment(mlir::Type ty,
bool useABIAlign)
const;
59 return {llvm::divideCeil(baseSize.getKnownMinValue(), 8),
60 baseSize.isScalable()};
72 uint64_t alignedSizeInBits =
73 llvm::alignToPowerOf2(baseSize.getKnownMinValue(), 8);
74 return {alignedSizeInBits, baseSize.isScalable()};
105 assert(mlir::isa<cir::PointerType>(ty) &&
106 "This should only be called with a pointer type");
107 return layout.getTypeSizeInBits(ty);
111 assert(mlir::isa<cir::PointerType>(ty) &&
"Expected pointer type");
void reset(mlir::DataLayoutSpecInterface spec)
Parse a data layout string (with fallback to default values).
CIRDataLayout(mlir::ModuleOp modOp)
Constructs a DataLayout the module's data layout attribute.
llvm::TypeSize getPointerTypeSizeInBits(mlir::Type ty) const
llvm::TypeSize getTypeAllocSize(mlir::Type ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
llvm::TypeSize getTypeStoreSizeInBits(mlir::Type ty) const
Returns the maximum number of bits that may be overwritten by storing the specified type; always a mu...
unsigned getProgramAddressSpace() const
llvm::Align getABITypeAlign(mlir::Type ty) const
mlir::Type getIntPtrType(mlir::Type ty) const
llvm::Align getAlignment(mlir::Type ty, bool useABIAlign) const
Internal helper method that returns requested alignment for type.
llvm::TypeSize getTypeAllocSizeInBits(mlir::Type ty) const
Returns the offset in bits between successive objects of the specified type, including alignment padd...
bool typeSizeEqualsStoreSize(mlir::Type ty) const
Returns true if no extra padding bits are needed when storing the specified type.
llvm::TypeSize getTypeSizeInBits(mlir::Type ty) const
llvm::TypeSize getTypeStoreSize(mlir::Type ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type.