public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Why it crash? (How to use emit_move_insn?)
@ 2000-03-09  6:13 Peng-Sheng Chen
  2000-04-01  0:00 ` Peng-Sheng Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Peng-Sheng Chen @ 2000-03-09  6:13 UTC (permalink / raw)
  To: gcc, gcc-help


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Why it crash? (How to use emit_move_insn?)
  2000-03-09  6:13 Why it crash? (How to use emit_move_insn?) Peng-Sheng Chen
@ 2000-04-01  0:00 ` Peng-Sheng Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peng-Sheng Chen @ 2000-04-01  0:00 UTC (permalink / raw)
  To: gcc, gcc-help


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-09  6:13 Why it crash? (How to use emit_move_insn?) Peng-Sheng Chen
2000-04-01  0:00 ` Peng-Sheng Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).