Skip to content

Commit f583014

Browse files
committed
[LangRef] Document the difference between <abi> and <pref>
Document how LLVM expects to use `<abi>` and `<pref>`, as well as the `pref >= abi` requirement.
1 parent 2e38bee commit f583014

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

llvm/docs/LangRef.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,12 +3240,15 @@ as follows:
32403240
as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0``
32413241
address space cannot be specified as non-integral.
32423242

3243+
``<abi>`` provides a minimum allowed alignment for a type, and
3244+
``<pref>`` allows providing a more optimal alignment that should be used
3245+
when possible. ``<pref>`` is an optional value that must be greater than
3246+
or equal to ``<abi>``. If omitted, the preceding ``:`` should also be
3247+
omitted and ``<pref>`` will be equal to ``<abi>``.
3248+
32433249
Unless explicitly stated otherwise, on every specification that specifies
32443250
an alignment, the value of the alignment must be in the range [1,2^16)
32453251
and must be a power of two times the width of a byte.
3246-
On every specification that takes a ``<abi>:<pref>``, specifying the
3247-
``<pref>`` alignment is optional. If omitted, the preceding ``:``
3248-
should be omitted too and ``<pref>`` will be equal to ``<abi>``.
32493252

32503253
When constructing the data layout for a given target, LLVM starts with a
32513254
default set of specifications which are then (possibly) overridden by
@@ -3261,8 +3264,8 @@ specifications are given in this list:
32613264
- ``i8:8:8`` - i8 is 8-bit (byte) aligned as mandated
32623265
- ``i16:16:16`` - i16 is 16-bit aligned
32633266
- ``i32:32:32`` - i32 is 32-bit aligned
3264-
- ``i64:32:64`` - i64 has ABI alignment of 32-bits but preferred
3265-
alignment of 64-bits
3267+
- ``i64:32:64`` - i64 has a required alignment of 32-bits but should be
3268+
aligned to 64-bits if possible.
32663269
- ``f16:16:16`` - half is 16-bit aligned
32673270
- ``f32:32:32`` - float is 32-bit aligned
32683271
- ``f64:64:64`` - double is 64-bit aligned

0 commit comments

Comments
 (0)