gcc: AArch64 Function Attributes
1
1 6.31.2 AArch64 Function Attributes
1 ----------------------------------
1
1 The following target-specific function attributes are available for the
1 AArch64 target. For the most part, these options mirror the behavior of
1 similar command-line options (⇒AArch64 Options), but on a
1 per-function basis.
1
1 'general-regs-only'
1 Indicates that no floating-point or Advanced SIMD registers should
1 be used when generating code for this function. If the function
1 explicitly uses floating-point code, then the compiler gives an
1 error. This is the same behavior as that of the command-line
1 option '-mgeneral-regs-only'.
1
1 'fix-cortex-a53-835769'
1 Indicates that the workaround for the Cortex-A53 erratum 835769
1 should be applied to this function. To explicitly disable the
1 workaround for this function specify the negated form:
1 'no-fix-cortex-a53-835769'. This corresponds to the behavior of
1 the command line options '-mfix-cortex-a53-835769' and
1 '-mno-fix-cortex-a53-835769'.
1
1 'cmodel='
1 Indicates that code should be generated for a particular code model
1 for this function. The behavior and permissible arguments are the
1 same as for the command line option '-mcmodel='.
1
1 'strict-align'
1 Indicates that the compiler should not assume that unaligned memory
1 references are handled by the system. The behavior is the same as
1 for the command-line option '-mstrict-align'.
1
1 'omit-leaf-frame-pointer'
1 Indicates that the frame pointer should be omitted for a leaf
1 function call. To keep the frame pointer, the inverse attribute
1 'no-omit-leaf-frame-pointer' can be specified. These attributes
1 have the same behavior as the command-line options
1 '-momit-leaf-frame-pointer' and '-mno-omit-leaf-frame-pointer'.
1
1 'tls-dialect='
1 Specifies the TLS dialect to use for this function. The behavior
1 and permissible arguments are the same as for the command-line
1 option '-mtls-dialect='.
1
1 'arch='
1 Specifies the architecture version and architectural extensions to
1 use for this function. The behavior and permissible arguments are
1 the same as for the '-march=' command-line option.
1
1 'tune='
1 Specifies the core for which to tune the performance of this
1 function. The behavior and permissible arguments are the same as
1 for the '-mtune=' command-line option.
1
1 'cpu='
1 Specifies the core for which to tune the performance of this
1 function and also whose architectural features to use. The
1 behavior and valid arguments are the same as for the '-mcpu='
1 command-line option.
1
1 'sign-return-address'
1 Select the function scope on which return address signing will be
1 applied. The behavior and permissible arguments are the same as
1 for the command-line option '-msign-return-address='. The default
1 value is 'none'.
1
1 'outline-atomics'
1 Enable or disable calls to out-of-line helpers to implement atomic
1 operations. This corresponds to the behavior of the command line
1 options '-moutline-atomics' and '-mno-outline-atomics'.
1
1 The above target attributes can be specified as follows:
1
1 __attribute__((target("ATTR-STRING")))
1 int
1 f (int a)
1 {
1 return a + 5;
1 }
1
1 where 'ATTR-STRING' is one of the attribute strings specified above.
1
1 Additionally, the architectural extension string may be specified on
1 its own. This can be used to turn on and off particular architectural
1 extensions without having to specify a particular architecture version
1 or core. Example:
1
1 __attribute__((target("+crc+nocrypto")))
1 int
1 foo (int a)
1 {
1 return a + 5;
1 }
1
1 In this example 'target("+crc+nocrypto")' enables the 'crc' extension
1 and disables the 'crypto' extension for the function 'foo' without
1 modifying an existing '-march=' or '-mcpu' option.
1
1 Multiple target function attributes can be specified by separating them
1 with a comma. For example:
1 __attribute__((target("arch=armv8-a+crc+crypto,tune=cortex-a53")))
1 int
1 foo (int a)
1 {
1 return a + 5;
1 }
1
1 is valid and compiles function 'foo' for ARMv8-A with 'crc' and
1 'crypto' extensions and tunes it for 'cortex-a53'.
1
1 6.31.2.1 Inlining rules
1 .......................
1
1 Specifying target attributes on individual functions or performing
1 link-time optimization across translation units compiled with different
1 target options can affect function inlining rules:
1
1 In particular, a caller function can inline a callee function only if
1 the architectural features available to the callee are a subset of the
1 features available to the caller. For example: A function 'foo'
1 compiled with '-march=armv8-a+crc', or tagged with the equivalent
1 'arch=armv8-a+crc' attribute, can inline a function 'bar' compiled with
1 '-march=armv8-a+nocrc' because the all the architectural features that
1 function 'bar' requires are available to function 'foo'. Conversely,
1 function 'bar' cannot inline function 'foo'.
1
1 Additionally inlining a function compiled with '-mstrict-align' into a
1 function compiled without '-mstrict-align' is not allowed. However,
1 inlining a function compiled without '-mstrict-align' into a function
1 compiled with '-mstrict-align' is allowed.
1
1 Note that CPU tuning options and attributes such as the '-mcpu=',
1 '-mtune=' do not inhibit inlining unless the CPU specified by the
1 '-mcpu=' option or the 'cpu=' attribute conflicts with the architectural
1 feature rules specified above.
1