| #include "clang/CIR/Dialect/IR/CIRDataLayout.h" |
| |
| using namespace cir; |
| |
| //===----------------------------------------------------------------------===// |
| // DataLayout Class Implementation |
| //===----------------------------------------------------------------------===// |
| |
| CIRDataLayout::CIRDataLayout(mlir::ModuleOp modOp) : layout(modOp) { |
| reset(modOp.getDataLayoutSpec()); |
| } |
| |
| void CIRDataLayout::reset(mlir::DataLayoutSpecInterface spec) { |
| bigEndian = false; |
| if (spec) { |
| mlir::StringAttr key = mlir::StringAttr::get( |
| spec.getContext(), mlir::DLTIDialect::kDataLayoutEndiannessKey); |
| if (mlir::DataLayoutEntryInterface entry = spec.getSpecForIdentifier(key)) |
| if (auto str = llvm::dyn_cast<mlir::StringAttr>(entry.getValue())) |
| bigEndian = str == mlir::DLTIDialect::kDataLayoutEndiannessBig; |
| } |
| } |