Skip to content

Commit d2d1234

Browse files
committed
Be more specific about what abi does
1 parent f583014 commit d2d1234

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

llvm/docs/LangRef.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,15 +3240,23 @@ 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
3243+
``<abi>`` is a lower bound on what is required for a type to be
3244+
considered aligned. This is used in various places, such as:
3245+
3246+
- The alignment for loads and stores if none is explicitly given.
3247+
- The alignment used to compute struct layout.
3248+
- The alignment used to compute allocation sizes and thus
3249+
``getelementptr`` offsets.
3250+
- The alignment below which accesses are considered underaligned.
3251+
32443252
``<pref>`` allows providing a more optimal alignment that should be used
32453253
when possible. ``<pref>`` is an optional value that must be greater than
32463254
or equal to ``<abi>``. If omitted, the preceding ``:`` should also be
32473255
omitted and ``<pref>`` will be equal to ``<abi>``.
32483256

3249-
Unless explicitly stated otherwise, on every specification that specifies
3250-
an alignment, the value of the alignment must be in the range [1,2^16)
3251-
and must be a power of two times the width of a byte.
3257+
Unless explicitly stated otherwise, every alignment specification is
3258+
provided in bits and must be in the range [1,2^16). The value must be a
3259+
power of times the width of a byte (i.e. ``align = 8 * 2^N``).
32523260

32533261
When constructing the data layout for a given target, LLVM starts with a
32543262
default set of specifications which are then (possibly) overridden by
@@ -3264,8 +3272,8 @@ specifications are given in this list:
32643272
- ``i8:8:8`` - i8 is 8-bit (byte) aligned as mandated
32653273
- ``i16:16:16`` - i16 is 16-bit aligned
32663274
- ``i32:32:32`` - i32 is 32-bit aligned
3267-
- ``i64:32:64`` - i64 has a required alignment of 32-bits but should be
3268-
aligned to 64-bits if possible.
3275+
- ``i64:32:64`` - i64 is aligned at 32-bits but should be aligned to
3276+
64-bits if possible.
32693277
- ``f16:16:16`` - half is 16-bit aligned
32703278
- ``f32:32:32`` - float is 32-bit aligned
32713279
- ``f64:64:64`` - double is 64-bit aligned

0 commit comments

Comments
 (0)