public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6178] recog: Split out a register_asm_p function
@ 2020-12-17  0:16 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2020-12-17  0:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b665081f577d875903570ad64f40278faf0f79a0

commit r11-6178-gb665081f577d875903570ad64f40278faf0f79a0
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Dec 17 00:15:04 2020 +0000

    recog: Split out a register_asm_p function
    
    verify_changes has a test for whether a particular hard register
    is a user-defined register asm.  A later patch needs to test the
    same thing, so this patch splits it out into a helper.
    
    gcc/
            * rtl.h (register_asm_p): Declare.
            * recog.c (verify_changes): Split out the test for whether
            a hard register is a register asm to...
            * rtlanal.c (register_asm_p): ...this new function.

Diff:
---
 gcc/recog.c   |  5 +----
 gcc/rtl.h     |  1 +
 gcc/rtlanal.c | 12 ++++++++++++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/gcc/recog.c b/gcc/recog.c
index 6d8b7d560ee..2d934169a81 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -408,10 +408,7 @@ verify_changes (int num)
 	       changes[i].old
 	       && REG_P (changes[i].old)
 	       && asm_noperands (PATTERN (object)) > 0
-	       && REG_EXPR (changes[i].old) != NULL_TREE
-	       && HAS_DECL_ASSEMBLER_NAME_P (REG_EXPR (changes[i].old))
-	       && DECL_ASSEMBLER_NAME_SET_P (REG_EXPR (changes[i].old))
-	       && DECL_REGISTER (REG_EXPR (changes[i].old)))
+	       && register_asm_p (changes[i].old))
 	{
 	  /* Don't allow changes of hard register operands to inline
 	     assemblies if they have been defined as register asm ("x").  */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index fcec9dc6387..5a1670f295c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3525,6 +3525,7 @@ extern rtx tablejump_casesi_pattern (const rtx_insn *insn);
 extern int computed_jump_p (const rtx_insn *);
 extern bool tls_referenced_p (const_rtx);
 extern bool contains_mem_rtx_p (rtx x);
+extern bool register_asm_p (const_rtx);
 
 /* Overload for refers_to_regno_p for checking a single register.  */
 inline bool
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 6f521503c39..30d5b0c6b76 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -6617,3 +6617,15 @@ add_auto_inc_notes (rtx_insn *insn, rtx x)
 	  add_auto_inc_notes (insn, XVECEXP (x, i, j));
     }
 }
+
+/* Return true if X is register asm.  */
+
+bool
+register_asm_p (const_rtx x)
+{
+  return (REG_P (x)
+	  && REG_EXPR (x) != NULL_TREE
+	  && HAS_DECL_ASSEMBLER_NAME_P (REG_EXPR (x))
+	  && DECL_ASSEMBLER_NAME_SET_P (REG_EXPR (x))
+	  && DECL_REGISTER (REG_EXPR (x)));
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-17  0:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17  0:16 [gcc r11-6178] recog: Split out a register_asm_p function Richard Sandiford

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).