Florent DEFAY schrieb:
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
Don't use "first try". There are other rtx that want to be moved like
SUBREG.
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.
Obviously, it does *not*. Reason could be memory_operand and the
addresses that you allow/don't allow in struct rtl. So check the
addressing stuff, e.g. LEGITIMIZE_ADDRESS, GO_IF_LEGITIMATE_ADDRESS et al.
Georg-Johann