Cross gcc Mailing List Archive

[Prev][Next][Index][Thread]

Re: GCC: insn generated in RTL with too complex addressing mode



| I wonder if you can help me out with following question.
| 
| Is GCC designed to find workarounds for non-existing mov patterns by
| itself? Or do I have to code the workaround myself in the MD file using
| a define_expand?
| Case in point, a MEM to MEM movhi is generated in the RTL, but the
| 1750a doesn't support that. I made the movhi pattern with just a plain
| define_insn (without an alternative for the MEM to MEM case.)
| GCC aborts as follows 
| 
| GNU C version 2.7.2.1 (MIL-STD-1750A) compiled by GNU C version 2.7.2.
| zz.c: In function `time':
| zz.c:16: Unable to find a register to spill.
| (insn:HI 9 7 11 (set (mem:HI (reg/v:QI 2 2))
|         (mem/s:HI (plus:QI (reg:QI 14 14)
|                 (const_int 1)))) 28 {movhi} (insn_list 3 (nil))
|     (expr_list:REG_DEAD (reg/v:QI 2 2)
|         (nil)))
| xgcc: Internal compiler error: program cc1 got fatal signal 6

I don't know the 1750a, but the traditional way of solving this is to
use a define_expand and a define_insn with a condition to prevent
combine from regenerating a memory to memory move:

	(define_expand "movhi"
	  [(set (match_operand:HI 0 "general_operand" "")
		(match_operand:HI 1 "general_operand" ""))]
	  ""
	  "
	{
	  if (GET_CODE (operands[0]) != REG)
	    operands[1] = force_reg (HImode, operands[1]);
	}")

	(define_insn "*movhi_internal
	  [(set (match_operand:HI 0 "general_operand" "...")
		(match_operand:HI 1 "general_operand" "..."))]
	  "register_operand (operands[0], HImode)
	   || register_operand (operands[1], HImode)"
	  "...")

Now, for large types on small machines, you do often times want to
generate a memory to memory move including one or more move_scratch's
to relive the register pressure.

-- 
Michael Meissner, Cygnus Support (East Coast)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com,	617-354-5416 (office),	617-354-7161 (fax)


Home | Subject Index | Thread Index