Why it crash? (How to use emit_move_insn?)
Peng-Sheng Chen
pschen@puma.cs.nthu.edu.tw
Thu Mar 9 06:13:00 GMT 2000
Hello :
I have a question about using function emit_move_insn.
original source is (in m68k.c)
------------------------------------------------------------------------------------------
rtx
legitimize_pic_address (orig, mode, reg)
rtx orig, reg;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
rtx pic_ref = orig;
/* First handle a simple SYMBOL_REF or LABEL_REF */
if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
{
if (reg == 0)
abort ();
pic_ref = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, pic_offset_table_rtx, orig));
current_function_uses_pic_offset_table = 1;
RTX_UNCHANGING_P (pic_ref) = 1;
emit_move_insn (reg, pic_ref);
return reg;
}
else if (GET_CODE (orig) == CONST)
......
}
----------------------------------------------------------------------------------------
I want to move SYMBOL_REF to register first, and then add register and bas-register.
I modify it as following :
----------------------------------------------------------------------------------------
if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
{
if (reg == 0)
abort ();
if (XXX) {
rtx tmp = gen_reg_rtx (Pmode); <== Added
emit_move_insn (tmp, orig); <== Added
pic_ref = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tmp));
} else {
pic_ref = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, pic_offset_table_rtx, orig));
}
current_function_uses_pic_offset_table = 1;
RTX_UNCHANGING_P (pic_ref) = 1;
emit_move_insn (reg, pic_ref);
return reg;
}
-------------------------------------------------------------------------------------------
It crash! Why??? I don't know.
Who can tell me why and how to use emit_move_insn not to crash GCC?
Thanks very much.
Ps. Chen
More information about the Gcc
mailing list