Details
- Reviewers
ftynse - Commits
- rG31686d13dc58: Add default DataLayout support for complex numbers
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks! Please update DataLayout.md to describe this default.
mlir/lib/Interfaces/DataLayoutInterfaces.cpp | ||
---|---|---|
57–59 | How do we handle size in bytes for, e.g. complex<i4> (if that is even allowed)? The size in bits is 8, but the byte size may be 2 if each i4 should be aligned at byte boundary. |
Change complex DataLayout size computation to include alignment padding between elements.
Please let me know what you think of my interpretation of the default sizes for complex types.
mlir/lib/Interfaces/DataLayoutInterfaces.cpp | ||
---|---|---|
57–59 | Good point. I changed this to also include any padding needed to keep both elements in the structure aligned. I'm proposing that bitsize be 12 in the case of complex<i4> (the 2 elements and the padding to align the second element). This is the most accurate representation if treating complex like a C struct. This would not guarantee that collections of the struct are aligned when only considering bitsize of the object and would require the users to remember to compute the aligned size, but I think that's best rather than giving a false representation. |
How do we handle size in bytes for, e.g. complex<i4> (if that is even allowed)? The size in bits is 8, but the byte size may be 2 if each i4 should be aligned at byte boundary.