reload segfault

Bill Currie bill@taniwha.tssc.co.nz
Fri Jan 29 00:51:00 GMT 1999


Jeffrey A Law wrote:
> 
>   In message < 36B1137E.3D3D7CDB@tssc.co.nz >you write:
>   > 'Elp!! refs is most definitly nonzero (5).  Due to my solution to the
>   > first time I had this problem, I still suspect PREFERRED_RELOAD_CLASS,
>   > but reload seams to be extreamly fagile with inexperienced gcc hackers
>   > (I'm a fair coder, but reload scares me, it's *HUGE*, does any one have
>   > some notes on the operation of reload they're willing to share with me?)
> OK.  Look at reg_renumber[169] and reg_equiv_mem[169]
> 
> reg_renumber should be >= 0 else reg_equiv_mem should be an rtx for a stack
> slot.
> 
> jeff

Sorry, I grabbed the wrong insn dump in my previous message.

(insn 4723 4720 2962 (set (reg:DF 54 f22)
        (reg:DF 839)) 74 {movstrsi+2} (nil)
    (nil))

(gdb) p *reg_n_info.data.reg[839]
$3 = {first_uid = 4049, last_uid = 2962, last_note_uid = 2962, sets = 1, 
  refs = 5, deaths = 0, live_length = 236, calls_crossed = 6, 
  basic_block = -2, changes_size = 0 '\000'}
(gdb) p reg_renumber[839]
$4 = -1
(gdb) p reg_equiv_mem[839]
$5 = (rtx_def *) 0x0
(gdb) 

I now know it is definitly PREFERRED_RELOAD_CLASS, defined as:

#define PREFERRED_RELOAD_CLASS(X,CLASS) preferred_reload_class (X,
CLASS)

With

enum reg_class
preferred_reload_class(x, class)
     rtx x;
     enum reg_class class;
{
  if (GET_CODE (x) == HIGH
      || GET_CODE (x) == LO_SUM)
    return GENERAL_REGS;
  if (!CONSTANT_P (x))
    return class;
  if (class == FP_REGS)
    {
      if (CONST_DOUBLE_OK_FOR_LETTER_P (x, 'G'))
        return class;
      /* a constant int that can be loaded into a general register in
one
	 instruction takes the same number of instructions to put into an
	 fp reg as loading from memory, but saves the 4 bytes of memory
	 needed to store the constant */
      if (GET_CODE (x) == CONST_INT
	  && ((INTVAL (x) & 0x0000ffff) == 0
	      || (INTVAL (x) & 0xffff0000) == 0))
	return GENERAL_REGS;
      return NO_REGS;
    }
  /* int->reg is proabably always best as general regs */
  if ((class == SCRATCH_REGS
       || class == GENERAL_REGS
       || class == ALL_REGS)
      && GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
    return GENERAL_REGS;
  if (GET_CODE (x) == CONST_DOUBLE)
      return NO_REGS;
  return class;
/*  return GENERAL_REGS;*/
}

If I change the #define to just return CLASS (rather than the function
call), this particular problem dissapears, but in other code I get:

(insn 2193 1790 2194 (set (reg:PSI 31 r31)
        (high:PSI (lo_sum:PSI (reg:PSI 27 r27)
                (symbol_ref:SI ("system_include_depth"))))) -1 (nil)
    (nil))

which is definitly bogus.

I'm going to continue tweaking my preferred_reload_class function and
see if I can get it to work.  As it seems to only be DFmode regs that
give me problems, I should get something soon (I hope).

Bill
-- 
Leave others their otherness.



More information about the Gcc mailing list