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;
35 void reset(mlir::DataLayoutSpecInterface spec);
40 llvm::Align
getAlignment(mlir::Type ty,
bool useABIAlign)
const;
55 return {llvm::divideCeil(baseSize.getKnownMinValue(), 8),
56 baseSize.isScalable()};
87 assert(mlir::isa<cir::PointerType>(ty) &&
88 "This should only be called with a pointer type");
89 return layout.getTypeSizeInBits(ty);
93 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::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...
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.