This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/70047] Warn on inefficient function parameter passing


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70047

--- Comment #2 from Jaak Ristioja <jaak at ristioja dot ee> ---
Perhaps the simplest example for x86_64 would be something like:

  void f(long a1, long a2, long a3, long a4, long a5, long a6, long a7);

According to the ABI all seven arguments are classified as INTEGER-s. Arguments
a1 through a6 get passed in %rdi, %rsi, %rdx, %rcx, %r8 and %r9 respectively,
but a7 will be passed on the stack because no other registers are available.
Therefore, in machine code passing/accessing a7 via the stack might be slightly
slower than accessing the rest of the variables via registers. The situation
gets more complicated with floating-point and aggregate values.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]