[llvm] [DataLayout] Introduce DataLayout::getPointerAddressSize(AS) (PR #137412)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 14:11:05 PDT 2025
================
@@ -401,6 +401,31 @@ TEST(DataLayout, ParsePointerSpec) {
EXPECT_THAT_EXPECTED(
DataLayout::parse(Str),
FailedWithMessage("index size cannot be larger than the pointer size"));
+
+ EXPECT_THAT_EXPECTED(
+ DataLayout::parse("p:64:64:64:48:32"),
+ FailedWithMessage("index size cannot be larger than the address size"));
+
+ // address size
+ for (StringRef Str : {"p:64:32:32:64:", "p0:64:32:32:64:"})
+ EXPECT_THAT_EXPECTED(
+ DataLayout::parse(Str),
+ FailedWithMessage("address size component cannot be empty"));
+
+ // Note: in the future we might allow 0 for address size to indicate pointers
+ // that do not have a meaning full address (e.g. relocatable GC pointers).
----------------
arichardson wrote:
```suggestion
// that do not have a meaningful address (e.g. relocatable GC pointers).
```
https://github.com/llvm/llvm-project/pull/137412
More information about the llvm-commits
mailing list