[llvm] [LangRef/DataLayout] Spell out requirements for alignment values (PR #104705)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 02:25:58 PDT 2024
================
@@ -3123,6 +3120,9 @@ as follows:
as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0``
address space cannot be specified as non-integral.
+Unless explicitly stated otherwise, on every specification that specifies
+an alignment, the value of the alignment must be in the range [1,2^16)
+and must be a power of two times the width of a byte.
----------------
s-barannikov wrote:
I'm only considering supporting 16-bit bytes as the most popular, and 32-bit as that is the width of a byte on my architecture.
For these cases either of the following will do:
1. "must be a power of two and a multiple of the byte width"
2. "must be a power of two and at least the width of a byte"
The suggested "must be a power of two times the width of a byte" is more relaxed as it allows any byte width, e.g., 24, so that 24-, 48- and 96-bit alignments are valid (1, 2 and 4 bytes, respectively) even though the values are not powers of two. I'm not pursuing this generalization; the idea was that if it's equally easy to read, why not allow it. (I don't find it easy to read at all, but I can only judge this by my limited English.)
https://github.com/llvm/llvm-project/pull/104705
More information about the llvm-commits
mailing list