Skip to content

Commit 2da641d

Browse files
committed
Move get_call_rtx_from to final.c
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 <[email protected]>
1 parent 5ff48aa commit 2da641d

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

gcc/final.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ output_alternate_entry_point (FILE *file, rtx_insn *insn)
20722072

20732073
/* Given a CALL_INSN, find and return the nested CALL. */
20742074
static rtx
2075-
call_from_call_insn (rtx_call_insn *insn)
2075+
call_from_call_insn (const rtx_call_insn *insn)
20762076
{
20772077
rtx x;
20782078
gcc_assert (CALL_P (insn));
@@ -2098,6 +2098,15 @@ call_from_call_insn (rtx_call_insn *insn)
20982098
return x;
20992099
}
21002100

2101+
/* Return the CALL in X if there is one. */
2102+
2103+
rtx
2104+
get_call_rtx_from (const rtx_insn *insn)
2105+
{
2106+
const rtx_call_insn *call_insn = as_a<const rtx_call_insn *> (insn);
2107+
return call_from_call_insn (call_insn);
2108+
}
2109+
21012110
/* Print a comment into the asm showing FILENAME, LINENUM, and the
21022111
corresponding source line, if available. */
21032112

gcc/rtl.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,14 @@ is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
957957
return CALL_P (insn);
958958
}
959959

960+
template <>
961+
template <>
962+
inline bool
963+
is_a_helper <const rtx_call_insn *>::test (const rtx_insn *insn)
964+
{
965+
return CALL_P (insn);
966+
}
967+
960968
template <>
961969
template <>
962970
inline bool
@@ -3682,7 +3690,6 @@ extern bool nonzero_address_p (const_rtx);
36823690
extern bool rtx_unstable_p (const_rtx);
36833691
extern bool rtx_varies_p (const_rtx, bool);
36843692
extern bool rtx_addr_varies_p (const_rtx, bool);
3685-
extern rtx get_call_rtx_from (const rtx_insn *);
36863693
extern tree get_call_fndecl (const rtx_insn *);
36873694
extern HOST_WIDE_INT get_integer_term (const_rtx);
36883695
extern rtx get_related_value (const_rtx);
@@ -4572,6 +4579,7 @@ extern void simplify_using_condition (rtx, rtx *, bitmap);
45724579
extern void compute_alignments (void);
45734580
extern void update_alignments (vec<rtx> &);
45744581
extern int asm_str_count (const char *templ);
4582+
extern rtx get_call_rtx_from (const rtx_insn *);
45754583

45764584
struct rtl_hooks
45774585
{

gcc/rtlanal.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -813,21 +813,6 @@ rtx_addr_varies_p (const_rtx x, bool for_alias)
813813
return false;
814814
}
815815

816-
/* Return the CALL in X if there is one. */
817-
818-
rtx
819-
get_call_rtx_from (const rtx_insn *insn)
820-
{
821-
rtx x = PATTERN (insn);
822-
if (GET_CODE (x) == PARALLEL)
823-
x = XVECEXP (x, 0, 0);
824-
if (GET_CODE (x) == SET)
825-
x = SET_SRC (x);
826-
if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
827-
return x;
828-
return NULL_RTX;
829-
}
830-
831816
/* Get the declaration of the function called by INSN. */
832817

833818
tree

0 commit comments

Comments
 (0)