Problem in gen_reload(), seeking an explanation

Jeffrey A Law
Mon Jun 21 22:04:00 GMT 1999

  In message < >you write:
  > The code is not shuffling operands cause it is only special-casing 
  > pseudo-registers, but we enter here with 2 real registers. Something like 
  > below works too:
Not exactly what I had in mind.  But better.

If you look even earlier, you will find code that looks like this:

      if (op0 != XEXP (in, 0) || op1 != XEXP (in, 1))
        in = gen_rtx_PLUS (GET_MODE (in), op0, op1);

      insn = emit_insn (gen_rtx_SET (VOIDmode, out, in));
      code = recog_memoized (insn);

      if (code >= 0)
          extract_insn (insn);
          /* We want constrain operands to treat this insn strictly in
             its validity determination, i.e., the way it would after reload
             has completed.  */
          if (constrain_operands (1))
            return insn;

      delete_insns_since (last);

We can do the same thing in the later hunk of code.  ie, try it one way, if
that does not work, swap the operands and try again.  Something like this

      gen_reload (out, op0, opnum, type);

      /* If OP0 and OP1 are the same, we can use OUT for OP1.
         This fixes a problem on the 32K where the stack pointer cannot
         be used as an operand of an add insn.  */

      if (rtx_equal_p (op0, op1))
        op1 = out;

      insn = emit_insn (gen_rtx_SET ...)

      /* If that failed, copy the address register to the reload register.
         Then add the constant to the reload register.  */

      code = recog_memoized (insn);
      [ ... check that the operands match the constraints... ]
      if constraints fail, call delete_all_insns_since (last), swap
      op0 and op1 and try again.  If it still fails delete the insns and
      go on to the next method of generating the reload.

  > What I'm not quite sure about is if and how we can enter here with float 
  > operands.
I do not think in any way that matters -- most of the complexity in this code
is dealing with addresses and frame pointer elimination on 2 address machines.


More information about the Gcc mailing list