move patterns, emit_move_insn

Florent DEFAY spira.inhabitant@gmail.com
Tue Mar 3 13:35:00 GMT 2009


Thank you very much for your attention.

Meena, could you please give me advice about how to set up eliminating
FP against SP ? In my target.h, these macros are NOT defined :
ELIMINABLE_REGS
CAN_ELIMINATE
INITIAL_ELIMINATION_OFFSET

I changed target.md :
________________________________________
;; movhi
(define_expand "movhi"
  [(set (match_operand:HI 0 "nonimmediate_operand" "")
        (match_operand:HI 1 "general_operand" "")
  )]
  ""
  {
    /* First try */
    /*
    if (GET_CODE (operands[0]) == MEM
     && GET_CODE (operands[1]) != REG)
    {
      operands[1] = force_reg (HImode, operands[1]);
    }
    */
    /* Second try */
    if (!register_operand(operand0, HImode)
    && !register_operand(operand1, HImode))
    {
      operands[1] = copy_to_mode_reg(HImode, operand1);
    }
  }
)

;; move.w   r -> (r)
(define_insn "movhi1"
  [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m,r,r")
        (match_operand:HI 1 "general_operand" "r,r,m,i")
  )]
  ""
  "@
  move.w\t%1,%0
  move.w\t%1,%0
  move.w\t%1,%0
  move.w\t%1,%0"
)
______________________________

First and second try (as commented in the code) are successful to
force copying immediate into register and then register into memory.
But then, with both of them, this error appears:

e.c:7: error: unrecognizable insn:
(insn 8 7 9 3 e.c:4 (set (mem/c/i:HI (reg/f:HI 14) [0 i+0 S2 A16])
        (reg:HI 15)) -1 (nil))

I don't know why. Since the pattern movhi1 allows register to memory transfer.

I still wonder how I can deal with access modes ?
For example, to obtain such an ASM instruction
______________
movew r1,8(r2)  ;; move R1 to [R2 + 8]
______________
How to do that ? How to check the access mode ? Where to catch the 8
(in the example) ?

Regards.

Florent



More information about the Gcc-help mailing list