Help with "unable to generate reloads for..." error?

Robert Baruch autophile@gmail.com
Thu Dec 23 00:11:00 GMT 2004


Hi all,

I have a processor for which I generated a minimal description. I've
assigned 19 8-bit registers as hard registers. The .md file has, among
other things, this:

(define_insn "movqi"
	[(set (match_operand:QI 0 "nonimmediate_operand" "")
		  (match_operand:QI 1 "general_operand" ""))]
  ""
  "MOVF %1,%0"
  [(set_attr "cc" "z")]
  )
  
(define_insn "addqi3"
	[(set (match_operand:QI 0 "register_operand" "")
		  (plus:QI (match_operand:QI 1 "register_operand" "0")
                   (match_operand:QI 2 "nonmemory_operand" "")))]
  ""
  "ADDF %1,%0"
  [(set_attr "cc" "all")]
  )


The problem is, when building gcc and compiling libgcc2.c (_muldi3), I
get this abort:

../../Desktop/gcc-3.4.3/gcc/libgcc2.c: In function `__muldi3':
../../Desktop/gcc-3.4.3/gcc/libgcc2.c:468: error: unable to generate
reloads for:
(insn 88 86 89 0 ../../Desktop/gcc-3.4.3/gcc/libgcc2.c:462 (set (reg:QI 0 FSR)
        (plus:QI (reg/f:QI 19 virtual-incoming-args)
            (const_int 32 [0x20]))) 1 {addqi3} (nil)
    (nil))
../../Desktop/gcc-3.4.3/gcc/libgcc2.c:468: internal compiler error: in
find_reloads, at reload.c:3687

A gdb session has this stack trace:

#0  fancy_abort (file=0x36ba1c "../../Desktop/gcc-3.4.3/gcc/reload.c",
line=3687, function=0x36bae8 "find_reloads") at
../../Desktop/gcc-3.4.3/gcc/diagnostic.c:584
#1  0x002e65f4 in _fatal_insn (msgid=0x36bb24 "unable to generate
reloads for:", insn=0x40e1ce38, file=0x36ba1c
"../../Desktop/gcc-3.4.3/gcc/reload.c", line=3687, function=0x36bae8
"find_reloads") at ../../Desktop/gcc-3.4.3/gcc/rtl-error.c:116
#2  0x002f5fd8 in find_reloads (insn=0x40e1ce38, replace=0,
ind_levels=0, live_known=1, reload_reg_p=0x4038d580) at
../../Desktop/gcc-3.4.3/gcc/reload.c:3687
#3  0x002be5c4 in calculate_needs_all_insns (global=1) at
../../Desktop/gcc-3.4.3/gcc/reload1.c:1459
#4  0x002bd0ac in reload (first=0x40e19140, global=1) at
../../Desktop/gcc-3.4.3/gcc/reload1.c:968
#5  0x00239020 in global_alloc (file=0xa00098c8) at
../../Desktop/gcc-3.4.3/gcc/global.c:606
#6  0x000dfeb8 in rest_of_handle_old_regalloc (decl=0x39206c,
insns=0x40e19140) at ../../Desktop/gcc-3.4.3/gcc/toplev.c:2277


First, I noted that register 19 is a psuedo-register. At this point in
the reload() function (reload1.c:968), should all pseudo's be
allocated to hard registers?

I looked at find_reloads() (reload.c:3687), where the abort is
generated, and found this comment and code fragment:

  /* The operands don't meet the constraints.
     goal_alternative describes the alternative
     that we could reach by reloading the fewest operands.
     Reload so as to fit it.  */

  if (best == MAX_RECOG_OPERANDS * 2 + 600)
    {
      /* No alternative works with reloads??  */
      if (insn_code_number >= 0)
	fatal_insn ("unable to generate reloads for:", insn);


I'm not sure what is going on here. What is find_reloads trying to
accomplish, and why is it failing? Does it have anything to do with
the fact that my define_insns have nothing in the constraints?

Any insight into what's going on would be appreciated.... Thanks!

--Rob



More information about the Gcc mailing list