diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-04-10 10:28:05 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-04-10 10:28:05 +0000 |
commit | 02149a789076495212f47452550971bc3c5a0b9a (patch) | |
tree | 020fe027bf566bd895a9f12a6310dd1f9061fc9d /gcc/final.c | |
parent | 5c35bc3e16f0e238488423e37aed5dcbb9bfde46 (diff) | |
download | gcc-02149a789076495212f47452550971bc3c5a0b9a.tar.gz |
Set insn_last_address in final_1
final_1 already sets insn_current_address for each instruction, making
it possible to use some of the address functions in final.c during
assembly generation. This patch also sets insn_last_address, since
as the comment says, we can treat final as a shorten_branches pass that
does nothing. It's then possible to use insn_current_reference_address
during final as well.
This is needed for the aarch64.md definitions of far_branch to work:
(set (attr "far_branch")
(if_then_else (and (ge (minus (match_dup 2) (pc)) (const_int -1048576))
(lt (minus (match_dup 2) (pc)) (const_int 1048572)))
(const_int 0)
(const_int 1)))]
This value (tested only during final) uses the difference between
the INSN_ADDRESSES of operand 2 and insn_current_reference_address
to calculate a conservatively-correct estimate of the branch distance.
It takes into account the worst-case gap due to alignment, whereas
a direct comparison of INSN_ADDRESSES would give an unreliable,
optimistic result.
2018-04-10 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* final.c (final_1): Set insn_last_address as well as
insn_current_address.
From-SVN: r259267
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/final.c b/gcc/final.c index 87a3067f3b1..19817e240da 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -2081,6 +2081,9 @@ final_1 (rtx_insn *first, FILE *file, int seen, int optimize_p) } else insn_current_address = INSN_ADDRESSES (INSN_UID (insn)); + /* final can be seen as an iteration of shorten_branches that + does nothing (since a fixed point has already been reached). */ + insn_last_address = insn_current_address; } dump_basic_block_info (file, insn, start_to_bb, end_to_bb, |