From: Richard Sandiford Date: Tue, 10 Apr 2018 10:28:05 +0000 (+0000) Subject: Set insn_last_address in final_1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02149a789076495212f47452550971bc3c5a0b9a;p=gcc.git 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 gcc/ * final.c (final_1): Set insn_last_address as well as insn_current_address. From-SVN: r259267 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 805b4b4acb9..50484facbb9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-10 Richard Sandiford + + * final.c (final_1): Set insn_last_address as well as + insn_current_address. + 2018-04-10 Kyrylo Tkachov PR target/85173 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,