alpha himode reload problem

Richard Henderson rth@cygnus.com
Sun Oct 19 22:24:00 GMT 1997


The following program generates bogus rtl in reload on an Alpha:

   struct asdf {
     int space;
     short x;
   };
   
   struct asdf * blah();
   void foo(a,b,c,d,e,f,g)
      int a,b,c,d,e,f,g;
   {
     struct asdf *x = blah();
     while (a < b)
       bar(a++,b,c,d,e,f,g);
     asm volatile("# %0" : : "r"(x->x));
   }

The output from reload is

   (insn 85 69 86 (set (reg:DI 2 $2)
           (mem:DI (plus:DI (reg:DI 30 $30)
                   (const_int 80)))) 252 {movdi-1} (nil)
       (nil))
   
   (insn 86 85 87 (set (reg:SI 2 $2)
           (mem/s:SI (plus:DI (mem:DI (plus:DI (reg:DI 30 $30)
                           (const_int 80)))
                   (const_int 4)))) 244 {movdf+1} (nil)
       (nil))
   
   (insn 87 86 71 (set (subreg:DI (reg:HI 2 $2) 0)
           (zero_extract:DI (subreg:DI (reg:SI 2 $2) 0)
               (const_int 16)
               (const_int 0))) 78 {unaligned_extendhidi+1} (nil)
       (nil))

with the bogosity of course being in insn 86.

The problem seems to me with the fact that reload records replacement
addresses within the rtl, rather than substituting on a pattern; ref
reload.c 3713 (find_reloads):

  /* If this insn pattern contains any MATCH_DUP's, make sure that
     they will be substituted if the operands they match are substituted.
     Also do now any substitutions we already did on the operands.

and alpha.md 4179 (movhi):

      if (aligned_memory_operand (operands[1], HImode))
        {
          rtx aligned_mem, bitnum;
          rtx scratch = (reload_in_progress
                         ? gen_rtx (REG, SImode, REGNO (operands[0]))
                         : gen_reg_rtx (SImode));

          get_aligned_mem (operands[1], &aligned_mem, &bitnum);

          emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
                                         scratch));
        }

The movhi pattern itself contains no match_dup, so no additional 
replacements are generated.

Any ideas on how to handle this?


r~



More information about the Gcc mailing list