]> git.ipfire.org Git - thirdparty/gcc.git/commit
x86-64: Find a scratch register for large model profiling
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 1 Feb 2024 16:02:27 +0000 (08:02 -0800)
committerH.J. Lu <(no_default)>
Mon, 5 Feb 2024 19:08:06 +0000 (11:08 -0800)
commit51f8ac3341078303e81e72d9013698a31c5ddd29
tree28829f5cd1502a8aec2fa6045e17b216b2230c28
parent62babed519afba58b7efeb0e968d97a666b68fd3
x86-64: Find a scratch register for large model profiling

2 scratch registers, %r10 and %r11, are available at function entry for
large model profiling.  But %r10 may be used by stack realignment and we
can't use %r10 in this case.  Add x86_64_select_profile_regnum to find
a caller-saved register which isn't live or a callee-saved register
which has been saved on stack in the prologue at entry for large model
profiling and sorry if we can't find one.

gcc/

PR target/113689
* config/i386/i386.cc (x86_64_select_profile_regnum): New.
(x86_function_profiler): Call x86_64_select_profile_regnum to
get a scratch register for large model profiling.

gcc/testsuite/

PR target/113689
* gcc.target/i386/pr113689-1.c: New file.
* gcc.target/i386/pr113689-2.c: Likewise.
* gcc.target/i386/pr113689-3.c: Likewise.
gcc/config/i386/i386.cc
gcc/testsuite/gcc.target/i386/pr113689-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr113689-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr113689-3.c [new file with mode: 0644]