PATCH for alias sets/stack slots, again

Jeffrey A Law law@hurl.cygnus.com
Wed Mar 17 23:03:00 GMT 1999


  > Regarding the problem of reusing stack slots in register spilling, I
  > noticed  also in gcc the following weirdness:
  > When a register, holding a value aliased to a global symbol, needs to be 
  > spilled, gcc could use its address instead of creating (or even reusing
  > another) a stack slot.
Only when the pseudo and the mem are equivalent -- and I think we already
handle that case.

We should have had an insn which initializes the pseudo from the memory
location.  Which would have set reg_equiv_memory_loc[pseudo] in this code:


      if (set != 0 && GET_CODE (SET_DEST (set)) == REG)
        {
          rtx note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
          if (note
#ifdef LEGITIMATE_PIC_OPERAND_P
              && (! function_invariant_p (XEXP (note, 0))
                  || ! flag_pic
                  || LEGITIMATE_PIC_OPERAND_P (XEXP (note, 0)))
#endif
              )
            {
              rtx x = XEXP (note, 0);

              i = REGNO (SET_DEST (set));
              if (i > LAST_VIRTUAL_REGISTER)
                {
                  if (GET_CODE (x) == MEM)
                    {
                      /* If the operand is a PLUS, the MEM may be shared,
                         so make sure we have an unshared copy here.  */
                      if (GET_CODE (XEXP (x, 0)) == PLUS)
                        x = copy_rtx (x);

                      reg_equiv_memory_loc[i] = x;
                    }

jeff


More information about the Gcc-patches mailing list