[Mlir-commits] [mlir] [MLIR][LLVM][DLTI] Handle data layout token 'n32:64' (PR #141299)

Bruno Cardoso Lopes llvmlistbot at llvm.org
Tue May 27 12:33:02 PDT 2025


================
@@ -251,6 +251,30 @@ LogicalResult DataLayoutImporter::tryToEmplaceFunctionPointerAlignmentEntry(
   return success();
 }
 
+LogicalResult
+DataLayoutImporter::tryToEmplaceLegalIntWidthsEntry(StringRef token) {
+  auto key =
+      StringAttr::get(context, DLTIDialect::kDataLayoutLegalIntWidthsKey);
+  if (keyEntries.count(key))
+    return success();
+
+  FailureOr<SmallVector<uint64_t>> intWidths = tryToParseIntList(token);
+  if (failed(intWidths) || intWidths->empty())
+    return failure();
+
+  OpBuilder builder(context);
+  SmallVector<Attribute> intWidthAttrs;
+  intWidthAttrs.reserve(intWidths->size());
+  llvm::for_each(*intWidths, [&](uint64_t width) {
+    intWidthAttrs.push_back(builder.getI32IntegerAttr(width));
+  });
+
+  keyEntries.try_emplace(
+      key, DataLayoutEntryAttr::get(
+               key, ArrayAttr::get(key.getContext(), intWidthAttrs)));
----------------
bcardosolopes wrote:

Good idea, thanks! Applied.

https://github.com/llvm/llvm-project/pull/141299


More information about the Mlir-commits mailing list