From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Wilson To: Andreas Schwab Cc: amylaar@cygnus.com, egcs@cygnus.com Subject: Re: Missing documentation in regmove.c Date: Mon, 11 May 1998 18:12:00 -0000 Message-id: <199805120112.SAA26199@rtl.cygnus.com> References: X-SW-Source: 1998-05/msg00391.html I added some comments which should help. Index: regmove.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/regmove.c,v retrieving revision 1.16 diff -p -r1.16 regmove.c *** regmove.c 1998/04/18 15:42:46 1.16 --- regmove.c 1998/05/12 01:09:17 *************** reg_is_remote_constant_p (reg, insn, fir *** 568,575 **** --- 568,591 ---- return 0; } + /* INSN is adding a CONST_INT to a REG. We search backwards looking for + another add immediate instruction with the same source and dest registers, + and if we find one, we change INSN to an increment, and return 1. If + no changes are made, we return 0. + + This changes + (set (reg100) (plus reg1 offset1)) + ... + (set (reg100) (plus reg1 offset2)) + to + (set (reg100) (plus reg1 offset1)) + ... + (set (reg100) (plus reg100 offset2-offset1)) */ + + /* ??? What does this comment mean? */ /* cse disrupts preincrement / postdecrement squences when it finds a hard register as ultimate source, like the frame pointer. */ + int fixup_match_2 (insn, dst, src, offset, regmove_dump_file) rtx insn, dst, src, offset; *************** regmove_optimize (f, nregs, regmove_dump *** 1141,1147 **** --- 1157,1168 ---- #endif /* REGISTER_CONSTRAINTS */ } + /* Returns the INSN_CODE for INSN if its pattern has matching constraints for + any operand. Returns -1 if INSN can't be recognized, or if the alternative + can't be determined. + Initialize the info in MATCHP based on the constraints. */ + static int find_matches (insn, matchp) rtx insn; *************** stable_but_for_p (x, src, dst) *** 1708,1715 **** return ! rtx_unstable_p (x); } } - /* Test if regmove seems profitable for this target. */ int regmove_profitable_p () { --- 1729,1739 ---- return ! rtx_unstable_p (x); } } + + /* Test if regmove seems profitable for this target. Regmove is useful only + if some common patterns are two address, i.e. require matching constraints, + so we check that condition here. */ int regmove_profitable_p () {