Requesting scratch register
Richard Earnshaw
rearnsha@arm.com
Tue Jul 15 11:48:00 GMT 2003
> Hi all,
>
> As written in MD Documentation, the pattern (clobber
> (match_scratch)) would request for a scratch register for use in
> particular insn. Is there any way to know if the scratch register
> is available for use. I would clarify on my point. I'm generating
> an insn
>
> (parallel [(.............) (clobber (match_scratch:SI))])
>
> That would give me a little improvement. But I don't want to
> increase the register pressure. I would like to generate the above
> insn in the situation where I could find a free scratch
> register.
>
Add a peephole2 that uses the scratch and generates the more efficient
sequence. Use a pattern without the scratch prior to register allocation.
Alternatively, you might be able to do this with register constraints; if
an alternative doesn't need a scratch register, just use X in the
constraint for that alternative. Something like
(set (match_operand:SI 0 "register_operand" "r,r")
(OP:SI (match_operand:SI 1 "register_operand" "r,r")
(match_operand:SI 2 "some_constraint" "r,I"))) ; I is some magic
constant
; Scratch only needed if op 2 is a constant
(clobber (match_operand:SI 3 "match_scratch" "X,r"))
R.
More information about the Gcc
mailing list