i386: Insert ENDBR before the profiling counter call
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 24 Sep 2018 17:20:58 +0000 (17:20 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Mon, 24 Sep 2018 17:20:58 +0000 (10:20 -0700)
commit708c728d4fe7a5e169833729b8c57d08258ce15d
treecc14a50725b71deb8e2c9e1582ed5578b1338180
parentc109362313623d83fe0a5194bceaf994cf0c6ce0
i386: Insert ENDBR before the profiling counter call

ENDBR must be the first instruction of a function.  This patch queues
ENDBR if we need to put the profiling counter call before the prologue
and generate ENDBR before the profiling counter call.

gcc/

PR target/82699
* config/i386/i386.c (rest_of_insert_endbranch): Set
endbr_queued_at_entrance to true and don't insert ENDBR if
x86_function_profiler will be called.
(x86_function_profiler): Insert ENDBR if endbr_queued_at_entrance
is true.
* config/i386/i386.h (machine_function): Add
endbr_queued_at_entrance.

gcc/testsuite/

PR target/82699
* gcc.target/i386/pr82699-1.c: New file.
* gcc.target/i386/pr82699-2.c: Likewise.
* gcc.target/i386/pr82699-3.c: Likewise.
* gcc.target/i386/pr82699-4.c: Likewise.
* gcc.target/i386/pr82699-5.c: Likewise.
* gcc.target/i386/pr82699-6.c: Likewise.

From-SVN: r264540
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr82699-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82699-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82699-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82699-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82699-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82699-6.c [new file with mode: 0644]