Autoincrement addressing modes

Richard Henderson rth@cygnus.com
Thu Feb 12 06:42:00 GMT 1998


On Thu, Feb 12, 1998 at 11:06:26AM +1300, Michael P. Hayes wrote:
> 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")

I think this is a swell idea.  I can see it as being particularly
useful to use this kind of description to help auto-generate
GO_IF_LEGITIMATE_ADDRESS and LEGITIMIZE_ADDRESS.  As it is not a
few ports lie to gcc about how addresses really work with -fpic,
perhaps if it were easier to describe, ports would quite lying.

Though I would get rid of the mem and add a name,

(define_address "base_disp"
  [(plus:DI (match_operand:DI 0 "register_operand" "r")
	    (match_operand:DI 1 "const16_operand" "I"))]
  ""
  "%1(%0)")

(define_address "unaligned_base_disp"
  [(and:DI (plus:DI (match_operand:DI 0 "register_operand" "r")
	            (match_operand:DI 1 "const16_operand" "I"))
	   (const_int -8))]
  ""
  "%1(%0)")

(define_address "symbolic"
  [(match_operand:SI 0 "symbolic_operand" "s")]
  "! flag_pic"
  "%0")

(define_address "symbolic"
  [(plus:SI (reg:SI "ebx")
     (match_operand:SI 0 "symbolic_operand" "s"))]
  "flag_pic"
  "%0(%%ebx)")

and create a mechanism whereby related address modes could be
collected and named ("input_address"). 

You might also allow addressing modes to be given attributes,
like "cost" or "length".  The former might be useful in creating
ADDRESS_COST, the later in adjusting the length of the insn that
contains the address.

It would be interesting to see what would happen if the mov insns
were restructured to name the precise address modes that could be
used (via a match_address).  This would increase the number of
insn patterns, possibly greatly, but it would also allow all the
HAVE_PRE_DEC_INPUT or whatever uglyness to be detected by genconfig.


Just rambling at this point...


r~



More information about the Gcc mailing list