diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-21 07:00:46 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-21 07:00:46 +0000 |
commit | 68184180f25f3c89ebcb9202ff3235f936bcdc78 (patch) | |
tree | 80c76ceffc762df432c6b9871357d8642769e61e /gcc/expr.c | |
parent | a15b25dcdcf597e01f5079b2bc44c1430b5e7719 (diff) | |
download | gcc-68184180f25f3c89ebcb9202ff3235f936bcdc78.zip gcc-68184180f25f3c89ebcb9202ff3235f936bcdc78.tar.gz gcc-68184180f25f3c89ebcb9202ff3235f936bcdc78.tar.bz2 |
poly_int: REG_ARGS_SIZE
This patch adds new utility functions for manipulating REG_ARGS_SIZE
notes and allows the notes to carry polynomial as well as constant sizes.
The code was inconsistent about whether INT_MIN or HOST_WIDE_INT_MIN
should be used to represent an unknown size. The patch uses
HOST_WIDE_INT_MIN throughout.
2017-12-21 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* rtl.h (get_args_size, add_args_size_note): New functions.
(find_args_size_adjust): Return a poly_int64 rather than a
HOST_WIDE_INT.
(fixup_args_size_notes): Likewise. Make the same change to the
end_args_size parameter.
* rtlanal.c (get_args_size, add_args_size_note): New functions.
* builtins.c (expand_builtin_trap): Use add_args_size_note.
* calls.c (emit_call_1): Likewise.
* explow.c (adjust_stack_1): Likewise.
* cfgcleanup.c (old_insns_match_p): Update use of
find_args_size_adjust.
* combine.c (distribute_notes): Track polynomial arg sizes.
* dwarf2cfi.c (dw_trace_info): Change beg_true_args_size,
end_true_args_size, beg_delay_args_size and end_delay_args_size
from HOST_WIDE_INT to poly_int64.
(add_cfi_args_size): Take the args_size as a poly_int64 rather
than a HOST_WIDE_INT.
(notice_args_size, notice_eh_throw, maybe_record_trace_start)
(maybe_record_trace_start_abnormal, scan_trace, connect_traces): Track
polynomial arg sizes.
* emit-rtl.c (try_split): Use get_args_size.
* recog.c (peep2_attempt): Likewise.
* reload1.c (reload_as_needed): Likewise.
* expr.c (find_args_size_adjust): Return the adjustment as a
poly_int64 rather than a HOST_WIDE_INT.
(fixup_args_size_notes): Change end_args_size from a HOST_WIDE_INT
to a poly_int64 and change the return type in the same way.
(emit_single_push_insn): Track polynomial arg sizes.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255919
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -3941,9 +3941,9 @@ mem_autoinc_base (rtx mem) The return value is the amount of adjustment that can be trivially verified, via immediate operand or auto-inc. If the adjustment - cannot be trivially extracted, the return value is INT_MIN. */ + cannot be trivially extracted, the return value is HOST_WIDE_INT_MIN. */ -HOST_WIDE_INT +poly_int64 find_args_size_adjust (rtx_insn *insn) { rtx dest, set, pat; @@ -4066,22 +4066,21 @@ find_args_size_adjust (rtx_insn *insn) } } -int -fixup_args_size_notes (rtx_insn *prev, rtx_insn *last, int end_args_size) +poly_int64 +fixup_args_size_notes (rtx_insn *prev, rtx_insn *last, + poly_int64 end_args_size) { - int args_size = end_args_size; + poly_int64 args_size = end_args_size; bool saw_unknown = false; rtx_insn *insn; for (insn = last; insn != prev; insn = PREV_INSN (insn)) { - HOST_WIDE_INT this_delta; - if (!NONDEBUG_INSN_P (insn)) continue; - this_delta = find_args_size_adjust (insn); - if (this_delta == 0) + poly_int64 this_delta = find_args_size_adjust (insn); + if (known_eq (this_delta, 0)) { if (!CALL_P (insn) || ACCUMULATE_OUTGOING_ARGS @@ -4090,15 +4089,15 @@ fixup_args_size_notes (rtx_insn *prev, rtx_insn *last, int end_args_size) } gcc_assert (!saw_unknown); - if (this_delta == HOST_WIDE_INT_MIN) + if (known_eq (this_delta, HOST_WIDE_INT_MIN)) saw_unknown = true; - add_reg_note (insn, REG_ARGS_SIZE, GEN_INT (args_size)); + add_args_size_note (insn, args_size); if (STACK_GROWS_DOWNWARD) - this_delta = -(unsigned HOST_WIDE_INT) this_delta; + this_delta = -poly_uint64 (this_delta); if (saw_unknown) - args_size = INT_MIN; + args_size = HOST_WIDE_INT_MIN; else args_size -= this_delta; } @@ -4198,7 +4197,7 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type) static void emit_single_push_insn (machine_mode mode, rtx x, tree type) { - int delta, old_delta = stack_pointer_delta; + poly_int64 delta, old_delta = stack_pointer_delta; rtx_insn *prev = get_last_insn (); rtx_insn *last; @@ -4209,12 +4208,13 @@ emit_single_push_insn (machine_mode mode, rtx x, tree type) /* Notice the common case where we emitted exactly one insn. */ if (PREV_INSN (last) == prev) { - add_reg_note (last, REG_ARGS_SIZE, GEN_INT (stack_pointer_delta)); + add_args_size_note (last, stack_pointer_delta); return; } delta = fixup_args_size_notes (prev, last, stack_pointer_delta); - gcc_assert (delta == INT_MIN || delta == old_delta); + gcc_assert (known_eq (delta, HOST_WIDE_INT_MIN) + || known_eq (delta, old_delta)); } #endif |