diff options
Diffstat (limited to 'gcc/rtlanal.cc')
-rw-r--r-- | gcc/rtlanal.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc index 239d669..87332ff 100644 --- a/gcc/rtlanal.cc +++ b/gcc/rtlanal.cc @@ -4245,11 +4245,16 @@ subreg_offset_representable_p (unsigned int xregno, machine_mode xmode, can be simplified. Return -1 if the subreg can't be simplified. - XREGNO is a hard register number. */ + XREGNO is a hard register number. ALLOW_STACK_REGS is true if + we should allow subregs of stack_pointer_rtx, frame_pointer_rtx. + and arg_pointer_rtx (which are normally expected to be the unique + way of referring to their respective registers). */ + int simplify_subreg_regno (unsigned int xregno, machine_mode xmode, - poly_uint64 offset, machine_mode ymode) + poly_uint64 offset, machine_mode ymode, + bool allow_stack_regs) { struct subreg_info info; unsigned int yregno; @@ -4260,20 +4265,23 @@ simplify_subreg_regno (unsigned int xregno, machine_mode xmode, && !REG_CAN_CHANGE_MODE_P (xregno, xmode, ymode)) return -1; - /* We shouldn't simplify stack-related registers. */ - if ((!reload_completed || frame_pointer_needed) - && xregno == FRAME_POINTER_REGNUM) - return -1; + if (!allow_stack_regs) + { + /* We shouldn't simplify stack-related registers. */ + if ((!reload_completed || frame_pointer_needed) + && xregno == FRAME_POINTER_REGNUM) + return -1; - if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - && xregno == ARG_POINTER_REGNUM) - return -1; + if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM + && xregno == ARG_POINTER_REGNUM) + return -1; - if (xregno == STACK_POINTER_REGNUM - /* We should convert hard stack register in LRA if it is - possible. */ - && ! lra_in_progress) - return -1; + if (xregno == STACK_POINTER_REGNUM + /* We should convert hard stack register in LRA if it is + possible. */ + && ! lra_in_progress) + return -1; + } /* Try to get the register offset. */ subreg_get_info (xregno, xmode, offset, ymode, &info); |