From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Peng-Sheng Chen" To: , Subject: Why it crash? (How to use emit_move_insn?) Date: Sat, 01 Apr 2000 00:00:00 -0000 Message-ID: X-SW-Source: 2000-q1/msg00352.html Message-ID: <20000401000000.xKbvp4XB7v6bYKVfSl7gBNJCr4XXIkOGWuhWNKXhCWc@z> 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