Autoincrement addressing modes

Michael P. Hayes michaelh@ongaonga.chch.cri.nz
Wed Feb 11 18:20:00 GMT 1998


I have been working on generalised support for autoincrement
addressing modes, where the increment may be a constant (not just the
width of the data type), an index register, or even potentially a
scaled index register, circularly modified base register, or
bit-reversed base register.

The format I've used is:

(post_modify (reg base) (expr))
(pre_modify (reg base) (expr))

where in the first case (reg base) is used as the address and then
this gets set to (expr) and in the second case (reg base) gets set
to (expr) and then used as the address.

Currently, I've patched flow.c and reload.c to handle the common
forms:

({post,pre}_modify (reg base) (plus (reg base) (reg index)))  
({post,pre}_modify (reg base) (plus (reg base) (const_int)))
({post,pre}_modify (reg base) (minus (reg base) (reg index)))

supporting addressing modes such as:

*(base += index)
*(base += const)
*(base -= index)

At this stage I'm interested in what other common forms should be
supported.

I'm also wondering if it is worthwhile to describe the addressing
modes of a machine, using something like:

(define_address
 [(mem:SF (match_operand:SI 0 "base_register" "a"))]
 ""
 "*%0")

or

(define_address
 [(mem:SI (plus:SI (match_operand:SI 0 "base_register" "a")
                   (match_operand:SI 1 "index_register" "x")))]
 ""
 "*%0(%1)")

or

(define_address
 [(mem:SI (post_modify:SI (match_operand:SI 0 "base_register" "a")
                          (plus:SI (match_dup 0)
                                  (match_operand:SI 1 "index_register" "x"))))]
 ""
 "*%0++(%1)")





More information about the Gcc mailing list