These function attributes are supported by the x86 back end:
cdecl
cdecl
attribute causes the compiler to assume that the calling function pops off the stack space used to pass arguments. This is useful to override the effects of the -mrtd
switch. fastcall
fastcall
attribute causes the compiler to pass the first argument (if of integral type) in the register ECX and the second argument (if of integral type) in the register EDX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. thiscall
thiscall
attribute causes the compiler to pass the first argument (if of integral type) in the register ECX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. The thiscall
attribute is intended for C++ non-static member functions. As a GCC extension, this calling convention can be used for C functions and for static member methods. ms_abi
sysv_abi
ms_abi
attribute tells the compiler to use the Microsoft ABI, while the sysv_abi
attribute tells the compiler to use the ABI used on GNU/Linux and other systems. The default is to use the Microsoft ABI when targeting Windows. On all other systems, the default is the x86/AMD ABI. Note, the ms_abi
attribute for Microsoft Windows 64-bit targets currently requires the -maccumulate-outgoing-args
option.
callee_pop_aggregate_return (
number)
The default x86-32 ABI assumes that the callee pops the stack for hidden pointer. However, on x86-32 Microsoft Windows targets, the compiler assumes that the caller pops the stack for hidden pointer.
ms_hook_prologue
regparm (
number)
regparm
attribute causes the compiler to pass arguments number one to number if they are of integral type in registers EAX, EDX, and ECX instead of on the stack. Functions that take a variable number of arguments continue to be passed all of their arguments on the stack. Beware that on some ELF systems this attribute is unsuitable for global functions in shared libraries with lazy binding (which is the default). Lazy binding sends the first call via resolving code in the loader, which might assume EAX, EDX and ECX can be clobbered, as per the standard calling conventions. Solaris 8 is affected by this. Systems with the GNU C Library version 2.1 or higher and FreeBSD are believed to be safe since the loaders there save EAX, EDX and ECX. (Lazy binding can be disabled with the linker or the loader if desired, to avoid the problem.)
sseregparm
sseregparm
attribute causes the compiler to pass up to 3 floating-point arguments in SSE registers instead of on the stack. Functions that take a variable number of arguments continue to pass all of their floating-point arguments on the stack. force_align_arg_pointer
force_align_arg_pointer
attribute may be applied to individual function definitions, generating an alternate prologue and epilogue that realigns the run-time stack if necessary. This supports mixing legacy codes that run with a 4-byte aligned stack with modern codes that keep a 16-byte stack for SSE compatibility. stdcall
stdcall
attribute causes the compiler to assume that the called function pops off the stack space used to pass arguments, unless it takes a variable number of arguments. target (
options)
On the x86, the following options are allowed:
abm
’no-abm
’aes
’no-aes
’default
’mmx
’no-mmx
’pclmul
’no-pclmul
’popcnt
’no-popcnt
’sse
’no-sse
’sse2
’no-sse2
’sse3
’no-sse3
’sse4
’no-sse4
’sse4.1
’no-sse4.1
’sse4.2
’no-sse4.2
’sse4a
’no-sse4a
’fma4
’no-fma4
’xop
’no-xop
’lwp
’no-lwp
’ssse3
’no-ssse3
’cld
’no-cld
’fancy-math-387
’no-fancy-math-387
’sin
, cos
, and sqrt
instructions on the 387 floating-point unit. fused-madd
’no-fused-madd
’ieee-fp
’no-ieee-fp
’inline-all-stringops
’no-inline-all-stringops
’inline-stringops-dynamically
’no-inline-stringops-dynamically
’align-stringops
’no-align-stringops
’recip
’no-recip
’target("fpmath=sse,387")
option as target("fpmath=sse+387")
because the comma would separate different options. On the x86, the inliner does not inline a function that has different target options than the caller, unless the callee has a subset of the target options of the caller. For example a function declared with target("sse3")
can inline a function with target("sse2")
, since -msse3
implies -msse2
.
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/x86-Function-Attributes.html