(root)/
gcc-13.2.0/
gcc/
config/
rx/
rx-protos.h
       1  /* Exported function prototypes from the Renesas RX backend.
       2     Copyright (C) 2008-2023 Free Software Foundation, Inc.
       3     Contributed by Red Hat.
       4  
       5     This file is part of GCC.
       6  
       7     GCC is free software; you can redistribute it and/or modify
       8     it under the terms of the GNU General Public License as published by
       9     the Free Software Foundation; either version 3, or (at your option)
      10     any later version.
      11  
      12     GCC is distributed in the hope that it will be useful,
      13     but WITHOUT ANY WARRANTY; without even the implied warranty of
      14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15     GNU General Public License for more details.
      16  
      17     You should have received a copy of the GNU General Public License
      18     along with GCC; see the file COPYING3.  If not see
      19     <http://www.gnu.org/licenses/>.  */
      20  
      21  #ifndef GCC_RX_PROTOS_H
      22  #define GCC_RX_PROTOS_H
      23  
      24  extern bool             rx_can_use_simple_return (void);
      25  extern void		rx_expand_epilogue (bool);
      26  extern void		rx_expand_prologue (void);
      27  extern int		rx_initial_elimination_offset (int, int);
      28  
      29  bool is_interrupt_func (const_tree decl);
      30  bool is_fast_interrupt_func (const_tree decl);
      31  
      32  /* rx_atomic_sequence is used to emit the header and footer
      33     of an atomic sequence.  It's supposed to be used in a scope.
      34     When constructed, it will emit the atomic sequence header insns.
      35     When destructred (goes out of scope), it will emit the
      36     corresponding atomic sequence footer insns.  */
      37  class rx_atomic_sequence
      38  {
      39  public:
      40    rx_atomic_sequence (const_tree fun_decl);
      41    ~rx_atomic_sequence (void);
      42  
      43  private:
      44    rx_atomic_sequence (void);
      45    rx_atomic_sequence (const rx_atomic_sequence&);
      46    rx_atomic_sequence& operator = (const rx_atomic_sequence&);
      47  
      48    rtx m_prev_psw_reg;
      49  };
      50  
      51  #ifdef RTX_CODE
      52  extern int		rx_adjust_insn_length (rtx_insn *, int);
      53  extern align_flags	rx_align_for_label (rtx_insn *, int);
      54  extern void             rx_emit_stack_popm (rtx *, bool);
      55  extern void             rx_emit_stack_pushm (rtx *);
      56  extern char *		rx_gen_move_template (rtx *, bool);
      57  extern bool		rx_is_legitimate_constant (machine_mode, rtx);
      58  extern bool		rx_is_restricted_memory_address (rtx,
      59  							 machine_mode);
      60  extern bool		rx_match_ccmode (rtx, machine_mode);
      61  extern rtx		rx_maybe_pidify_operand (rtx, int);
      62  extern void		rx_notice_update_cc (rtx, rtx);
      63  extern void		rx_split_cbranch (machine_mode, enum rtx_code,
      64  					  rtx, rtx, rtx);
      65  extern machine_mode	rx_select_cc_mode (enum rtx_code, rtx, rtx);
      66  
      67  extern bool rx_reg_dead_or_unused_after_insn (const rtx_insn* i, int regno);
      68  extern void rx_copy_reg_dead_or_unused_notes (rtx reg, const rtx_insn* src,
      69  					      rtx_insn* dst);
      70  
      71  extern bool rx_fuse_in_memory_bitop (rtx* operands, rtx_insn* curr_insn,
      72  				     rtx (*gen_insn)(rtx, rtx));
      73  
      74  /* Result value of rx_find_set_of_reg.  */
      75  struct set_of_reg
      76  {
      77    /* The insn where sh_find_set_of_reg stopped looking.
      78       Can be NULL_RTX if the end of the insn list was reached.  */
      79    rtx_insn* insn;
      80  
      81    /* The set rtx of the specified reg if found, NULL_RTX otherwise.  */
      82    const_rtx set_rtx;
      83  
      84    /* The set source rtx of the specified reg if found, NULL_RTX otherwise.
      85       Usually, this is the most interesting return value.  */
      86    rtx set_src;
      87  };
      88  
      89  /* FIXME: Copy-pasta from SH.  Move to rtl.h.
      90     Given a reg rtx and a start insn, try to find the insn that sets
      91     the specified reg by using the specified insn stepping function,
      92     such as 'prev_nonnote_nondebug_insn_bb'.  When the insn is found,
      93     try to extract the rtx of the reg set.  */
      94  template <typename F> inline set_of_reg
      95  rx_find_set_of_reg (rtx reg, rtx_insn* insn, F stepfunc,
      96  		    bool ignore_reg_reg_copies = false)
      97  {
      98    set_of_reg result;
      99    result.insn = insn;
     100    result.set_rtx = NULL_RTX;
     101    result.set_src = NULL_RTX;
     102  
     103    if (!REG_P (reg) || insn == NULL_RTX)
     104      return result;
     105  
     106    for (rtx_insn* i = stepfunc (insn); i != NULL_RTX; i = stepfunc (i))
     107      {
     108        if (BARRIER_P (i))
     109  	break;
     110        if (!INSN_P (i) || DEBUG_INSN_P (i))
     111  	  continue;
     112        if (reg_set_p (reg, i))
     113  	{
     114  	  if (CALL_P (i))
     115  	    break;
     116  
     117  	  result.insn = i;
     118  	  result.set_rtx = set_of (reg, i);
     119  
     120  	  if (result.set_rtx == NULL_RTX || GET_CODE (result.set_rtx) != SET)
     121  	    break;
     122  
     123  	  result.set_src = XEXP (result.set_rtx, 1);
     124  
     125  	  if (ignore_reg_reg_copies && REG_P (result.set_src))
     126  	    {
     127  	      reg = result.set_src;
     128  	      continue;
     129  	    }
     130  	  if (ignore_reg_reg_copies && SUBREG_P (result.set_src)
     131  	      && REG_P (SUBREG_REG (result.set_src)))
     132  	    {
     133  	      reg = SUBREG_REG (result.set_src);
     134  	      continue;
     135  	    }
     136  
     137  	  break;
     138  	}
     139      }
     140  
     141    /* If the searched reg is found inside a (mem (post_inc:SI (reg))), set_of
     142       will return NULL and set_rtx will be NULL.
     143       In this case report a 'not found'.  result.insn will always be non-null
     144       at this point, so no need to check it.  */
     145    if (result.set_src != NULL && result.set_rtx == NULL)
     146      result.set_src = NULL;
     147  
     148    return result;
     149  }
     150  
     151  /* FIXME: Move to rtlh.h.  */
     152  template <typename F> inline rtx_insn*
     153  rx_find_use_of_reg (rtx reg, rtx_insn* insn, F stepfunc)
     154  {
     155    if (!REG_P (reg) || insn == NULL_RTX)
     156      return NULL;
     157  
     158    for (rtx_insn* i = stepfunc (insn); i != NULL_RTX; i = stepfunc (i))
     159      {
     160        if (BARRIER_P (i))
     161  	break;
     162        if (!INSN_P (i) || DEBUG_INSN_P (i))
     163  	continue;
     164        if (reg_overlap_mentioned_p (reg, PATTERN (i))
     165  	  || (CALL_P (i) && find_reg_fusage (i, USE, reg)))
     166  	return i;
     167      }
     168  
     169    return NULL;
     170  }
     171  
     172  #endif
     173  
     174  #endif /* GCC_RX_PROTOS_H */