public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Ju Wu <jasonwucj@gmail.com>
To: gcc patches <gcc-patches@gcc.gnu.org>
Cc: Shiva Chen <shiva0217@gmail.com>
Subject: [PATCH 04/18, nds32] In nds32_valid_stack_push_pop_p(), we look into OP rtx to see if we indeed save $fp/$gp/$lp registers.
Date: Thu, 04 Sep 2014 05:31:00 -0000	[thread overview]
Message-ID: <CADj25HOxxpA37qZHQCfc5asWzkj6Lo7ky2rwkXQUppVps3FG_g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

Hi, all,

Committed as Rev. 214853: https://gcc.gnu.org/r214853


gcc/ChangeLog

2014-09-03  Chung-Ju Wu  <jasonwucj@gmail.com>

        * config/nds32/nds32-predicates.c
        (nds32_valid_stack_push_pop): Rename to ...
        (nds32_valid_stack_push_pop_p): ... this.
        * config/nds32/nds32-protos.h: Likewise.
        * config/nds32/predicates.md: Likewise.


Best regards,
jasonwucj

[-- Attachment #2: 0004-PATCH-04-In-nds32_valid_stack_push_pop_p-we-look-int.patch --]
[-- Type: application/octet-stream, Size: 4394 bytes --]

From aa3dcd12710a3a951023bcb330e2537d49e2936f Mon Sep 17 00:00:00 2001
From: Chung-Ju Wu <jasonwucj@andestech.com>
Date: Tue, 22 Jul 2014 11:55:22 +0800
Subject: [PATCH 04/18] (PATCH 04) In nds32_valid_stack_push_pop_p(), we look
 into OP rtx to see if we indeed save $fp/$gp/$lp registers.

---
 gcc/config/nds32/nds32-predicates.c | 19 ++++++++++++-------
 gcc/config/nds32/nds32-protos.h     |  2 +-
 gcc/config/nds32/predicates.md      |  8 ++++----
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/gcc/config/nds32/nds32-predicates.c b/gcc/config/nds32/nds32-predicates.c
index 72cd739..374a1a8 100644
--- a/gcc/config/nds32/nds32-predicates.c
+++ b/gcc/config/nds32/nds32-predicates.c
@@ -173,12 +173,13 @@ nds32_valid_multiple_load_store (rtx op, bool load_p)
      3. The last element must be stack adjustment rtx.
    See the prologue/epilogue implementation for details.  */
 bool
-nds32_valid_stack_push_pop (rtx op, bool push_p)
+nds32_valid_stack_push_pop_p (rtx op, bool push_p)
 {
   int index;
   int total_count;
   int rest_count;
   int first_regno;
+  int save_fp, save_gp, save_lp;
   rtx elt;
   rtx elt_reg;
   rtx elt_mem;
@@ -234,14 +235,18 @@ nds32_valid_stack_push_pop (rtx op, bool push_p)
         The $sp adjustment rtx, $fp push rtx, $gp push rtx,
         and $lp push rtx are excluded.  */
 
+  /* Detect whether we have $fp, $gp, or $lp in the parallel rtx.  */
+  save_fp = reg_mentioned_p (gen_rtx_REG (SImode, FP_REGNUM), op);
+  save_gp = reg_mentioned_p (gen_rtx_REG (SImode, GP_REGNUM), op);
+  save_lp = reg_mentioned_p (gen_rtx_REG (SImode, LP_REGNUM), op);
   /* Exclude last $sp adjustment rtx.  */
   rest_count = total_count - 1;
   /* Exclude $fp, $gp, and $lp if they are in the parallel rtx.  */
-  if (cfun->machine->fp_size)
+  if (save_fp)
     rest_count--;
-  if (cfun->machine->gp_size)
+  if (save_gp)
     rest_count--;
-  if (cfun->machine->lp_size)
+  if (save_lp)
     rest_count--;
 
   if (rest_count > 0)
@@ -275,7 +280,7 @@ nds32_valid_stack_push_pop (rtx op, bool push_p)
 
   /* Check $fp/$gp/$lp one by one.
      We use 'push_p' to pick up reg rtx and mem rtx.  */
-  if (cfun->machine->fp_size)
+  if (save_fp)
     {
       elt = XVECEXP (op, 0, index);
       elt_mem = push_p ? SET_DEST (elt) : SET_SRC (elt);
@@ -287,7 +292,7 @@ nds32_valid_stack_push_pop (rtx op, bool push_p)
           || REGNO (elt_reg) != FP_REGNUM)
         return false;
     }
-  if (cfun->machine->gp_size)
+  if (save_gp)
     {
       elt = XVECEXP (op, 0, index);
       elt_mem = push_p ? SET_DEST (elt) : SET_SRC (elt);
@@ -299,7 +304,7 @@ nds32_valid_stack_push_pop (rtx op, bool push_p)
           || REGNO (elt_reg) != GP_REGNUM)
         return false;
     }
-  if (cfun->machine->lp_size)
+  if (save_lp)
     {
       elt = XVECEXP (op, 0, index);
       elt_mem = push_p ? SET_DEST (elt) : SET_SRC (elt);
diff --git a/gcc/config/nds32/nds32-protos.h b/gcc/config/nds32/nds32-protos.h
index 5788425..e281016 100644
--- a/gcc/config/nds32/nds32-protos.h
+++ b/gcc/config/nds32/nds32-protos.h
@@ -80,7 +80,7 @@ extern bool nds32_valid_multiple_load_store (rtx, bool);
 
 /* Auxiliary functions for stack operation predicate checking.  */
 
-extern bool nds32_valid_stack_push_pop (rtx, bool);
+extern bool nds32_valid_stack_push_pop_p (rtx, bool);
 
 /* Auxiliary functions for bit operation detection.  */
 
diff --git a/gcc/config/nds32/predicates.md b/gcc/config/nds32/predicates.md
index 0a40d68..6877187 100644
--- a/gcc/config/nds32/predicates.md
+++ b/gcc/config/nds32/predicates.md
@@ -77,16 +77,16 @@
   (match_code "parallel")
 {
   /* To verify 'push' operation, pass 'true' for the second argument.
-     See the implementation in nds32.c for details.  */
-  return nds32_valid_stack_push_pop (op, true);
+     See the implementation in nds32-predicates.c for details.  */
+  return nds32_valid_stack_push_pop_p (op, true);
 })
 
 (define_special_predicate "nds32_stack_pop_operation"
   (match_code "parallel")
 {
   /* To verify 'pop' operation, pass 'false' for the second argument.
-     See the implementation in nds32.c for details.  */
-  return nds32_valid_stack_push_pop (op, false);
+     See the implementation in nds32-predicates.c for details.  */
+  return nds32_valid_stack_push_pop_p (op, false);
 })
 
 ;; ------------------------------------------------------------------------
-- 
1.9.0


                 reply	other threads:[~2014-09-04  5:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CADj25HOxxpA37qZHQCfc5asWzkj6Lo7ky2rwkXQUppVps3FG_g@mail.gmail.com \
    --to=jasonwucj@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=shiva0217@gmail.com \
    /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).