how to write a define_peephole2 that uses custom registers in nios2

James E Wilson wilson@specifix.com
Thu Jul 28 19:08:00 GMT 2005


Liu Haibin wrote:
> to "c". However, it seems very difficult here. The old insn patterns
> are all general registers, but the new insn patterns are defined as
> custom registers.

The peephole pass does not do register allocation.  So you can't use it 
to magically change "r" registers to "c" registers.  What you are trying 
to do here won't work.

> Can I use something like
> operands[0] = gen_rtx_REG (DImode, REGNO(operands[0]));
> here to force all the operands to be a different kind? Or how can I
> define the peephole?

If you are willing and able to do your own register allocation, then you 
might be able to get this to work, but this is very unlikely to be a 
good solution.

You probably shouldn't be using peepholes here.  You probably should be 
generating the insns you want during initial RTL generation.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com



More information about the Gcc mailing list