This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Autoincrement ideas
- To: egcs at cygnus dot com
- Subject: Autoincrement ideas
- From: "Michael P. Hayes" <michaelh at ongaonga dot chch dot cri dot nz>
- Date: Mon, 19 Jan 1998 16:01:27 +1300
I've been hacking flow.c to improve generation of autoincrement
addressing modes, in particular for targets that can increment
an address by the contents of another register (eg, RS6000, ARC,
C3x/C4x). Currrently these targets have move_update patterns
but they don't get exercised very often since the combine pass
only looks for insns where a source operand is set by a preceeding
insn.
I thus modified flow.c to combine the following two insns
insn 1: (set (reg A) (mem (reg B)))
insn 2: (set (reg B) (plus (reg B) (reg C)))
into
(parallel [(set (reg A) (mem (plus (reg B) (reg C))))
(set (reg B) (plus (reg B) (reg C)))])
which works fine but is still very limited.
A better approach would be handle this sort of side effect like we
handle POST_INC so that other instructions can utilise these
addressing modes without having to define myriads of other patterns.
I envisage either of two approaches:
1) (set (reg A) (mem (post_inc2 (reg B) (reg C))))
2) (set (reg A) (mem (post_inc (plus (reg B) (reg C)))))
I implemented the first approach in about half an hour (not including
the patches required to reload to fix things up if we get into a
knot), and it appeared to work well. The advantage of this approach
is that it doesn't need any modifications to the other back ends.
Any comments or suggestions of possible problems?
Michael.