diff options
author | Michael Hayes <m.hayes@elec.canterbury.ac.nz> | 1999-03-15 01:52:49 +0000 |
---|---|---|
committer | Michael Hayes <m.hayes@gcc.gnu.org> | 1999-03-15 01:52:49 +0000 |
commit | 2dfa9a87f6860348995b47f2432f851e3ce4d6f2 (patch) | |
tree | 7fe0df0111a98b6f7af1daa0cbded32b22f3ac51 /gcc/reload1.c | |
parent | 7ae575286e5c6b27aa69f2d6d80b0497dbfabd10 (diff) | |
download | gcc-2dfa9a87f6860348995b47f2432f851e3ce4d6f2.zip gcc-2dfa9a87f6860348995b47f2432f851e3ce4d6f2.tar.gz gcc-2dfa9a87f6860348995b47f2432f851e3ce4d6f2.tar.bz2 |
rtlanal.c (auto_inc_p): New function.
* rtlanal.c (auto_inc_p): New function.
* rtl.h (auto_inc_p): Prototype it.
* reload1.c (add_auto_inc_notes): New function.
(reload): Strip REG_INC notes and call add_auto_inc_notes
for each insn to restore them correctly.
From-SVN: r25774
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index 4402831..1e83d5f 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -443,6 +443,9 @@ static void reload_combine_note_use PROTO((rtx *, rtx)); static void reload_combine_note_store PROTO((rtx, rtx)); static void reload_cse_move2add PROTO((rtx)); static void move2add_note_store PROTO((rtx, rtx)); +#ifdef AUTO_INC_DEC +static void add_auto_inc_notes PROTO((rtx, rtx)); +#endif /* Initialize the reload pass once per compilation. */ @@ -1124,11 +1127,13 @@ reload (first, global, dumpfile) which are only valid during and after reload. */ reload_completed = 1; - /* Make a pass over all the insns and delete all USEs which we inserted - only to tag a REG_EQUAL note on them. Remove all REG_DEAD and REG_UNUSED - notes. Delete all CLOBBER insns and simplify (subreg (reg)) operands. - Also remove all REG_RETVAL and REG_LIBCALL notes since they are no longer - useful or accurate. */ + /* Make a pass over all the insns and delete all USEs which we + inserted only to tag a REG_EQUAL note on them. Remove all + REG_DEAD and REG_UNUSED notes. Delete all CLOBBER insns and + simplify (subreg (reg)) operands. Also remove all REG_RETVAL and + REG_LIBCALL notes since they are no longer useful or accurate. + Strip and regenerate REG_INC notes that may have been moved + around. */ for (insn = first; insn; insn = NEXT_INSN (insn)) if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') @@ -1150,6 +1155,7 @@ reload (first, global, dumpfile) { if (REG_NOTE_KIND (*pnote) == REG_DEAD || REG_NOTE_KIND (*pnote) == REG_UNUSED + || REG_NOTE_KIND (*pnote) == REG_INC || REG_NOTE_KIND (*pnote) == REG_RETVAL || REG_NOTE_KIND (*pnote) == REG_LIBCALL) *pnote = XEXP (*pnote, 1); @@ -1157,6 +1163,10 @@ reload (first, global, dumpfile) pnote = &XEXP (*pnote, 1); } +#ifdef AUTO_INC_DEC + add_auto_inc_notes (insn, PATTERN (insn)); +#endif + /* And simplify (subreg (reg)) if it appears as an operand. */ cleanup_subreg_operands (insn); } @@ -10131,3 +10141,33 @@ move2add_note_store (dst, set) } } } + +#ifdef AUTO_INC_DEC +static void +add_auto_inc_notes (insn, x) + rtx insn; + rtx x; +{ + enum rtx_code code = GET_CODE (x); + char *fmt; + int i, j; + + if (code == MEM && auto_inc_p (XEXP (x, 0))) + { + REG_NOTES (insn) + = gen_rtx_EXPR_LIST (REG_INC, XEXP (XEXP (x, 0), 0), REG_NOTES (insn)); + return; + } + + /* Scan all the operand sub-expressions. */ + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + add_auto_inc_notes (insn, XEXP (x, i)); + else if (fmt[i] == 'E') + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + add_auto_inc_notes (insn, XVECEXP (x, i, j)); + } +} +#endif |