https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120493

            Bug ID: 120493
           Summary: 2 different functions to get call RTX from CALL_INSN
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

There are

/* 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;
}

and

/* Given a CALL_INSN, find and return the nested CALL. */
static rtx
call_from_call_insn (rtx_call_insn *insn)
{
  rtx x;
  gcc_assert (CALL_P (insn));
  x = PATTERN (insn);

  while (GET_CODE (x) != CALL)
    {
      switch (GET_CODE (x))
        {
        default:
          gcc_unreachable ();
        case COND_EXEC:
          x = COND_EXEC_CODE (x);
          break;
        case PARALLEL:
          x = XVECEXP (x, 0, 0);
          break;
        case SET:
          x = XEXP (x, 1);
          break;
        }
    }
  return x;
}

Can we have only one?

Reply via email to