12 reset(modOp.getDataLayoutSpec());
18 mlir::StringAttr key = mlir::StringAttr::get(
19 spec.getContext(), mlir::DLTIDialect::kDataLayoutEndiannessKey);
20 if (mlir::DataLayoutEntryInterface entry = spec.getSpecForIdentifier(key))
21 if (
auto str = llvm::dyn_cast<mlir::StringAttr>(entry.getValue()))
22 bigEndian = str == mlir::DLTIDialect::kDataLayoutEndiannessBig;
32 unsigned align = useABIAlign ?
layout.getTypeABIAlignment(ty)
33 :
layout.getTypePreferredAlignment(ty);
34 return llvm::Align(align);
40 assert(
cir::isSized(ty) &&
"Cannot getTypeInfo() on a type that is unsized!");
42 if (
auto recordTy = llvm::dyn_cast<cir::RecordType>(ty)) {
45 return recordTy.getTypeSizeInBits(
layout, {});
53 return llvm::TypeSize::getFixed(
layout.getTypeSizeInBits(ty));
llvm::Align getAlignment(mlir::Type ty, bool abiOrPref) const
Internal helper method that returns requested alignment for 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 getTypeSizeInBits(mlir::Type ty) const
bool isSized(mlir::Type ty)
Returns true if the type is a CIR sized type.
static bool addressSpace()