AArch64 - new pass to add conditional-branch speculation tracking 69/198469/3
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 Jul 2018 17:36:18 +0000 (17:36 +0000)
committerDongkyun Son <dongkyun.s@samsung.com>
Wed, 6 Feb 2019 15:54:31 +0000 (15:54 +0000)
commit8d651ade76b02287292996ed2dff85bccaad4e2a
tree8f96e30677dccedfc754a97b5176dff3187e6d64
parent233eedd720a30dc4552a3310792871e8156e8076
AArch64 - new pass to add conditional-branch speculation tracking

This patch is the main part of the speculation tracking code.  It adds
a new target-specific pass that is run just before the final branch
reorg pass (so that it can clean up any new edge insertions we make).
The pass is only run with -mtrack-speculation is passed on the command
line.

One thing that did come to light as part of this was that the stack pointer
register was not being permitted in comparision instructions.  We rely on
that for moving the tracking state between SP and the scratch register at
function call boundaries.

* config/aarch64/aarch64-speculation.cc: New file.
* config/aarch64/aarch64-passes.def (pass_track_speculation): Add before
pass_reorder_blocks.
* config/aarch64/aarch64-protos.h (make_pass_track_speculation): Add
prototype.
* config/aarch64/aarch64.c (aarch64_conditional_register_usage): Fix
X14 and X15 when tracking speculation.
* config/aarch64/aarch64.md (register name constants): Add
SPECULATION_TRACKER_REGNUM and SPECULATION_SCRATCH_REGNUM.
(unspec): Add UNSPEC_SPECULATION_TRACKER.
(speculation_barrier): New insn attribute.
(cmp<mode>): Allow SP in comparisons.
(speculation_tracker): New insn.
(speculation_barrier): Add speculation_barrier attribute.
* config/aarch64/t-aarch64: Add make rule for aarch64-speculation.o.
* config.gcc (aarch64*-*-*): Add aarch64-speculation.o to extra_objs.
* doc/invoke.texi (AArch64 Options): Document -mtrack-speculation.

(backported b19562a81626f3e6adc5a5d4a185b36548539a4f)

Change-Id: Icece830281b0131f2a151bb43aa1aa3f94463836
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263173 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config.gcc
gcc/config/aarch64/aarch64-passes.def
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64-speculation.cc [new file with mode: 0644]
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.md
gcc/config/aarch64/t-aarch64
gcc/doc/invoke.texi