@@ -877,7 +877,9 @@ an optional ``unnamed_addr`` attribute, a return type, an optional
877877name, a (possibly empty) argument list (each with optional :ref:`parameter
878878attributes <paramattrs>`), optional :ref:`function attributes <fnattrs>`,
879879an optional address space, an optional section, an optional partition,
880- an optional alignment, an optional :ref:`comdat <langref_comdats>`,
880+ an optional minimum alignment,
881+ an optional preferred alignment,
882+ an optional :ref:`comdat <langref_comdats>`,
881883an optional :ref:`garbage collector name <gc>`, an optional :ref:`prefix <prefixdata>`,
882884an optional :ref:`prologue <prologuedata>`,
883885an optional :ref:`personality <personalityfn>`,
@@ -891,8 +893,8 @@ Syntax::
891893 <ResultType> @<FunctionName> ([argument list])
892894 [(unnamed_addr|local_unnamed_addr)] [AddrSpace] [fn Attrs]
893895 [section "name"] [partition "name"] [comdat [($name)]] [align N]
894- [gc ] [prefix Constant ] [prologue Constant] [personality Constant]
895- (!name !N)* { ... }
896+ [prefalign N ] [gc ] [prefix Constant] [prologue Constant]
897+ [personality Constant] (!name !N)* { ... }
896898
897899The argument list is a comma-separated sequence of arguments where each
898900argument is of the following form:
@@ -942,11 +944,24 @@ LLVM allows an explicit section to be specified for functions. If the
942944target supports it, it will emit functions to the section specified.
943945Additionally, the function can be placed in a COMDAT.
944946
945- An explicit alignment may be specified for a function. If not present,
946- or if the alignment is set to zero, the alignment of the function is set
947- by the target to whatever it feels convenient. If an explicit alignment
948- is specified, the function is forced to have at least that much
949- alignment. All alignments must be a power of 2.
947+ An explicit minimum alignment (``align``) may be specified for a
948+ function. If not present, or if the alignment is set to zero, the
949+ alignment of the function is set according to the preferred alignment
950+ rules described below. If an explicit minimum alignment is specified, the
951+ function is forced to have at least that much alignment. All alignments
952+ must be a power of 2.
953+
954+ An explicit preferred alignment (``prefalign``) may also be specified
955+ for a function (definitions only, and must be a power of 2). If a
956+ function does not have a preferred alignment attribute, the preferred
957+ alignment is determined in a target-specific way. The final alignment
958+ of the function is determined in the following way: if the function
959+ size is less than the minimum alignment, the function's alignment will
960+ be at least the minimum alignment. Otherwise, if the function size is
961+ between the minimum alignment and the preferred alignment, the function's
962+ alignment will be at least the power of 2 greater than or equal to the
963+ function size. Otherwise, the function's alignment will be at least the
964+ preferred alignment.
950965
951966If the ``unnamed_addr`` attribute is given, the address is known to not
952967be significant and two identical functions can be merged.
0 commit comments