]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move get_call_rtx_from to final.c
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 1 Jun 2025 01:29:48 +0000 (09:29 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 1 Jun 2025 23:56:25 +0000 (07:56 +0800)
Move get_call_rtx_from to final.c and call call_from_call_insn.

PR other/120493
* final.cc (call_from_call_insn): Change the argument type to
const rtx_call_insn *.
(get_call_rtx_from): New.
* rtl.h (is_a_helper <const rtx_call_insn *>::test): New.
(get_call_rtx_from): Moved to the final.cc section.
* rtlanal.cc (get_call_rtx_from): Removed.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gcc/final.cc
gcc/rtl.h
gcc/rtlanal.cc

index 12c6eb0ac09c34107c80fbee2aa8c713eab0a35a..a4dbab72914b1b023b72071cb90552d3632abd7f 100644 (file)
@@ -2072,7 +2072,7 @@ output_alternate_entry_point (FILE *file, rtx_insn *insn)
 
 /* Given a CALL_INSN, find and return the nested CALL. */
 static rtx
-call_from_call_insn (rtx_call_insn *insn)
+call_from_call_insn (const rtx_call_insn *insn)
 {
   rtx x;
   gcc_assert (CALL_P (insn));
@@ -2098,6 +2098,15 @@ call_from_call_insn (rtx_call_insn *insn)
   return x;
 }
 
+/* Return the CALL in X if there is one.  */
+
+rtx
+get_call_rtx_from (const rtx_insn *insn)
+{
+  const rtx_call_insn *call_insn = as_a<const rtx_call_insn *> (insn);
+  return call_from_call_insn (call_insn);
+}
+
 /* Print a comment into the asm showing FILENAME, LINENUM, and the
    corresponding source line, if available.  */
 
index 7049ed775e8f2b3c4672fe7e8b8b0442b066bba8..8a740219c2a0878296e787b314ffa9d0fe90771b 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -957,6 +957,14 @@ is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
   return CALL_P (insn);
 }
 
+template <>
+template <>
+inline bool
+is_a_helper <const rtx_call_insn *>::test (const rtx_insn *insn)
+{
+  return CALL_P (insn);
+}
+
 template <>
 template <>
 inline bool
@@ -3682,7 +3690,6 @@ extern bool nonzero_address_p (const_rtx);
 extern bool rtx_unstable_p (const_rtx);
 extern bool rtx_varies_p (const_rtx, bool);
 extern bool rtx_addr_varies_p (const_rtx, bool);
-extern rtx get_call_rtx_from (const rtx_insn *);
 extern tree get_call_fndecl (const rtx_insn *);
 extern HOST_WIDE_INT get_integer_term (const_rtx);
 extern rtx get_related_value (const_rtx);
@@ -4572,6 +4579,7 @@ extern void simplify_using_condition (rtx, rtx *, bitmap);
 extern void compute_alignments (void);
 extern void update_alignments (vec<rtx> &);
 extern int asm_str_count (const char *templ);
+extern rtx get_call_rtx_from (const rtx_insn *);
 \f
 struct rtl_hooks
 {
index 900f53e252a9879cf7ac42e41c9f588269df7e05..239d6691c4ca0031982086eb7fd92ba66c4a251f 100644 (file)
@@ -813,21 +813,6 @@ rtx_addr_varies_p (const_rtx x, bool for_alias)
   return false;
 }
 \f
-/* Return the CALL in X if there is one.  */
-
-rtx
-get_call_rtx_from (const rtx_insn *insn)
-{
-  rtx x = PATTERN (insn);
-  if (GET_CODE (x) == PARALLEL)
-    x = XVECEXP (x, 0, 0);
-  if (GET_CODE (x) == SET)
-    x = SET_SRC (x);
-  if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
-    return x;
-  return NULL_RTX;
-}
-
 /* Get the declaration of the function called by INSN.  */
 
 tree