public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Peng-Sheng Chen" <pschen@puma.cs.nthu.edu.tw>
To: <gcc@gcc.gnu.org>, <gcc-help@gcc.gnu.org>
Subject: Why it crash? (How to use emit_move_insn?)
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <NDBBLKOACKKKFPINNIPEOEFHCBAA.pschen@puma.cs.nthu.edu.tw> (raw)
Message-ID: <20000401000000.xKbvp4XB7v6bYKVfSl7gBNJCr4XXIkOGWuhWNKXhCWc@z> (raw)


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

             reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-09  6:13 Peng-Sheng Chen [this message]
2000-04-01  0:00 ` Peng-Sheng Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NDBBLKOACKKKFPINNIPEOEFHCBAA.pschen@puma.cs.nthu.edu.tw \
    --to=pschen@puma.cs.nthu.edu.tw \
    --cc=gcc-help@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).