public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Rename get_address_mode to mem_address_mode
@ 2022-03-16 12:15 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2022-03-16 12:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:158bad1044e0ac80ac60e8857a88ed4e534810c6

commit 158bad1044e0ac80ac60e8857a88ed4e534810c6
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Mar 16 12:15:47 2022 +0000

    Rename get_address_mode to mem_address_mode
    
    I wanted to add a helper function that returned the mode of
    an address rtx (only necessary because of modeless CONST_INTs).
    The obvious name was get_address_mode, but that name was
    already taken by a function that returns the mode of a
    MEM's address.
    
    This patch renames the existing function to mem_address_mode,
    which hopefully makes the operation a little clearer.  The new
    get_address_mode will take two arguments, so new uses of the old
    get_address_mode would be caught/rejected at build time.

Diff:
---
 gcc/combine.c        |  2 +-
 gcc/cselib.c         |  2 +-
 gcc/dse.c            |  6 +++---
 gcc/dwarf2cfi.c      |  2 +-
 gcc/dwarf2out.c      | 16 ++++++++--------
 gcc/emit-rtl.c       |  4 ++--
 gcc/expr.c           | 12 ++++++------
 gcc/ifcvt.c          |  2 +-
 gcc/optabs.c         |  2 +-
 gcc/reload.c         |  2 +-
 gcc/rtl.h            |  2 +-
 gcc/rtlanal.c        |  2 +-
 gcc/sched-deps.c     |  4 ++--
 gcc/sel-sched-dump.c |  2 +-
 gcc/var-tracking.c   | 10 +++++-----
 15 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 4fee114b3cc..22eccea90be 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4971,7 +4971,7 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
       if (HAVE_lo_sum && (GET_CODE (XEXP (x, 0)) == CONST
 			  || GET_CODE (XEXP (x, 0)) == SYMBOL_REF))
 	{
-	  machine_mode address_mode = get_address_mode (x);
+	  machine_mode address_mode = mem_address_mode (x);
 
 	  SUBST (XEXP (x, 0),
 		 gen_rtx_LO_SUM (address_mode,
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 41530692907..d81a4ceeb5e 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -2918,7 +2918,7 @@ cselib_record_sets (rtx_insn *insn)
 	  sets[i].src_elt = cselib_lookup (src, GET_MODE (dest), 1, VOIDmode);
 	  if (MEM_P (dest))
 	    {
-	      machine_mode address_mode = get_address_mode (dest);
+	      machine_mode address_mode = mem_address_mode (dest);
 
 	      sets[i].dest_addr_elt = cselib_lookup (XEXP (dest, 0),
 						     address_mode, 1,
diff --git a/gcc/dse.c b/gcc/dse.c
index d65266b5476..7331ab1c4bd 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1119,7 +1119,7 @@ canon_address (rtx mem,
 	       poly_int64 *offset,
 	       cselib_val **base)
 {
-  machine_mode address_mode = get_address_mode (mem);
+  machine_mode address_mode = mem_address_mode (mem);
   rtx mem_address = XEXP (mem, 0);
   rtx expanded_address, address;
   int expanded;
@@ -1526,7 +1526,7 @@ record_store (rtx body, bb_info_t bb_info)
       mem_addr = group->canon_base_addr;
     }
   if (maybe_ne (offset, 0))
-    mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
+    mem_addr = plus_constant (mem_address_mode (mem), mem_addr, offset);
 
   while (ptr)
     {
@@ -2217,7 +2217,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
       mem_addr = group->canon_base_addr;
     }
   if (maybe_ne (offset, 0))
-    mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
+    mem_addr = plus_constant (mem_address_mode (mem), mem_addr, offset);
 
   if (group_id >= 0)
     {
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 5d78d60e27a..41de22c8926 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -1314,7 +1314,7 @@ dwarf2out_frame_debug_cfa_expression (rtx set)
   cfi->dw_cfi_opc = DW_CFA_expression;
   cfi->dw_cfi_oprnd1.dw_cfi_reg_num = regno;
   cfi->dw_cfi_oprnd2.dw_cfi_loc
-    = mem_loc_descriptor (XEXP (dest, 0), get_address_mode (dest),
+    = mem_loc_descriptor (XEXP (dest, 0), mem_address_mode (dest),
 			  GET_MODE (dest), VAR_INIT_STATUS_INITIALIZED);
 
   /* ??? We'd like to use queue_reg_save, were the interface different,
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 652a63c6a1e..3129efb3e13 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15731,7 +15731,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
 	  }
       }
       mem_loc_result = mem_loc_descriptor (XEXP (rtl, 0),
-					   get_address_mode (rtl), mode,
+					   mem_address_mode (rtl), mode,
 					   VAR_INIT_STATUS_INITIALIZED);
       if (mem_loc_result == NULL)
 	mem_loc_result = tls_mem_loc_descriptor (rtl);
@@ -16727,7 +16727,7 @@ loc_descriptor (rtx rtl, machine_mode mode,
       break;
 
     case MEM:
-      loc_result = mem_loc_descriptor (XEXP (rtl, 0), get_address_mode (rtl),
+      loc_result = mem_loc_descriptor (XEXP (rtl, 0), mem_address_mode (rtl),
 				       GET_MODE (rtl), initialized);
       if (loc_result == NULL)
 	loc_result = tls_mem_loc_descriptor (rtl);
@@ -17048,7 +17048,7 @@ dw_loc_list_1 (tree loc, rtx varloc, int want_address,
 	  if (MEM_P (varloc))
 	    {
 	      rtx addr = XEXP (varloc, 0);
-	      descr = mem_loc_descriptor (addr, get_address_mode (varloc),
+	      descr = mem_loc_descriptor (addr, mem_address_mode (varloc),
 					  mode, initialized);
 	      if (descr)
 		have_address = 1;
@@ -17577,7 +17577,7 @@ cst_pool_loc_descr (tree loc)
 			"CST value in contant pool but not marked.");
       return 0;
     }
-  return mem_loc_descriptor (XEXP (rtl, 0), get_address_mode (rtl),
+  return mem_loc_descriptor (XEXP (rtl, 0), mem_address_mode (rtl),
 			     GET_MODE (rtl), VAR_INIT_STATUS_INITIALIZED);
 }
 
@@ -18559,7 +18559,7 @@ loc_list_from_tree_1 (tree loc, int want_address,
 		if (MEM_P (rtl))
 		  {
 		    mem_mode = mode;
-		    mode = get_address_mode (rtl);
+		    mode = mem_address_mode (rtl);
 		    rtl = XEXP (rtl, 0);
 		    have_address = 1;
 		  }
@@ -20156,7 +20156,7 @@ rtl_for_decl_location (tree decl)
 	       && known_lt (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl))),
 			    UNITS_PER_WORD))
 	{
-	  machine_mode addr_mode = get_address_mode (rtl);
+	  machine_mode addr_mode = mem_address_mode (rtl);
 	  poly_int64 offset = (UNITS_PER_WORD
 			       - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl))));
 
@@ -20169,7 +20169,7 @@ rtl_for_decl_location (tree decl)
 	   && MEM_P (rtl)
 	   && GET_MODE (rtl) != TYPE_MODE (TREE_TYPE (decl)))
     {
-      machine_mode addr_mode = get_address_mode (rtl);
+      machine_mode addr_mode = mem_address_mode (rtl);
       poly_int64 offset = byte_lowpart_offset (TYPE_MODE (TREE_TYPE (decl)),
 					       GET_MODE (rtl));
 
@@ -23514,7 +23514,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 		    {
 		      rtx mem = XEXP (XEXP (arg, 0), 0);
 		      reg = mem_loc_descriptor (XEXP (mem, 0),
-						get_address_mode (mem),
+						mem_address_mode (mem),
 						GET_MODE (mem),
 						VAR_INIT_STATUS_INITIALIZED);
 		    }
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 5bbe0db28f8..b10243b5b8c 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2448,7 +2448,7 @@ adjust_address_1 (rtx memref, machine_mode mode, poly_int64 offset,
 
   /* Convert a possibly large offset to a signed value within the
      range of the target address space.  */
-  address_mode = get_address_mode (memref);
+  address_mode = mem_address_mode (memref);
   offset = trunc_int_for_mode (offset, offset_mode (address_mode));
 
   if (adjust_address)
@@ -2567,7 +2567,7 @@ offset_address (rtx memref, rtx offset, unsigned HOST_WIDE_INT pow2)
   class mem_attrs *defattrs;
 
   mem_attrs attrs (*get_mem_attrs (memref));
-  address_mode = get_address_mode (memref);
+  address_mode = mem_address_mode (memref);
   new_rtx = gen_pointer_plus (address_mode, addr, offset);
 
   /* At this point we don't know _why_ the address is invalid.  It
diff --git a/gcc/expr.c b/gcc/expr.c
index 7102fa96cef..6611879d70e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -985,7 +985,7 @@ pieces_addr::decide_autoinc (machine_mode ARG_UNUSED (mode), bool reverse,
   bool use_postinc = (m_is_load
 		      ? USE_LOAD_POST_INCREMENT (mode)
 		      : USE_STORE_POST_INCREMENT (mode));
-  machine_mode addr_mode = get_address_mode (m_obj);
+  machine_mode addr_mode = mem_address_mode (m_obj);
 
   if (use_predec && reverse)
     {
@@ -1926,8 +1926,8 @@ emit_block_move_via_loop (rtx x, rtx y, rtx size,
 {
   rtx_code_label *cmp_label, *top_label;
   rtx iter, x_addr, y_addr, tmp;
-  scalar_addr_mode x_addr_mode = get_address_mode (x);
-  scalar_addr_mode y_addr_mode = get_address_mode (y);
+  scalar_addr_mode x_addr_mode = mem_address_mode (x);
+  scalar_addr_mode y_addr_mode = mem_address_mode (y);
   machine_mode iter_mode;
 
   iter_mode = GET_MODE (size);
@@ -5347,7 +5347,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
 	    }
 
 	  offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, EXPAND_SUM);
-	  om = offset_mode (get_address_mode (to_rtx));
+	  om = offset_mode (mem_address_mode (to_rtx));
 	  if (GET_MODE (offset_rtx) != om)
 	    {
 		/* We cannot be sure that the RTL in offset_rtx is valid outside
@@ -6043,7 +6043,7 @@ store_expr (tree exp, rtx target, int call_param_p,
 	    {
 	      machine_mode pointer_mode
 		= targetm.addr_space.pointer_mode (MEM_ADDR_SPACE (target));
-	      const scalar_addr_mode address_mode = get_address_mode (target);
+	      const scalar_addr_mode address_mode = mem_address_mode (target);
 	      const auto om = offset_mode (address_mode);
 
 	      /* Compute the size of the data to copy from the string.  */
@@ -11205,7 +11205,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
 
 	    gcc_assert (MEM_P (op0));
 
-	    off_mode = offset_mode (get_address_mode (op0));
+	    off_mode = offset_mode (mem_address_mode (op0));
 	    if (GET_MODE (offset_rtx) != off_mode)
 	      {
 		/* We cannot be sure that the RTL in offset_rtx is valid outside
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 70ecf81b1b2..0fb75023c71 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2057,7 +2057,7 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
       && MEM_P (a) && MEM_P (b)
       && MEM_ADDR_SPACE (a) == MEM_ADDR_SPACE (b))
     {
-      machine_mode address_mode = get_address_mode (a);
+      machine_mode address_mode = mem_address_mode (a);
 
       a = XEXP (a, 0);
       b = XEXP (b, 0);
diff --git a/gcc/optabs.c b/gcc/optabs.c
index b77d2c44e84..b85f77c853d 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7224,7 +7224,7 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno,
 	  machine_mode mode;
 
 	  last = get_last_insn ();
-	  mode = get_address_mode (mem);
+	  mode = mem_address_mode (mem);
 	  mem = replace_equiv_address (mem, copy_to_mode_reg (mode, addr));
 	  if (insn_operand_matches (icode, opno, mem))
 	    {
diff --git a/gcc/reload.c b/gcc/reload.c
index 9b820a1f720..8fcb3ac2784 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -3983,7 +3983,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
 	    addr_space_t as = MEM_ADDR_SPACE (recog_data.operand[i]);
 	    machine_mode address_mode;
 
-	    address_mode = get_address_mode (recog_data.operand[i]);
+	    address_mode = mem_address_mode (recog_data.operand[i]);
 	    operand_reloadnum[i]
 	      = push_reload (XEXP (recog_data.operand[i], 0), NULL_RTX,
 			     &XEXP (recog_data.operand[i], 0), (rtx*) 0,
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2626635881b..cd33abbc55b 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3559,7 +3559,7 @@ inline bool any_plus_p (const_rtx x)
   return GET_CODE (x) == PLUS || GET_CODE (x) == POINTER_PLUS;
 }
 
-extern scalar_addr_mode get_address_mode (rtx mem);
+extern scalar_addr_mode mem_address_mode (rtx mem);
 extern int rtx_addr_can_trap_p (const_rtx);
 extern bool nonzero_address_p (const_rtx);
 extern int rtx_unstable_p (const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 61248d925a7..d000a603b3c 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5965,7 +5965,7 @@ low_bitmask_len (machine_mode mode, unsigned HOST_WIDE_INT m)
 /* Return the mode of MEM's address.  */
 
 scalar_addr_mode
-get_address_mode (rtx mem)
+mem_address_mode (rtx mem)
 {
   machine_mode mode;
 
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 1bc75074e5d..8d76a6fed4d 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2466,7 +2466,7 @@ sched_analyze_1 (class deps_desc *deps, rtx x, rtx_insn *insn)
 
       if (sched_deps_info->use_cselib)
 	{
-	  machine_mode address_mode = get_address_mode (dest);
+	  machine_mode address_mode = mem_address_mode (dest);
 
 	  t = shallow_copy_rtx (dest);
 	  cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
@@ -2628,7 +2628,7 @@ sched_analyze_2 (class deps_desc *deps, rtx x, rtx_insn *insn)
 
 	if (sched_deps_info->use_cselib)
 	  {
-	    machine_mode address_mode = get_address_mode (t);
+	    machine_mode address_mode = mem_address_mode (t);
 
 	    t = shallow_copy_rtx (t);
 	    cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
diff --git a/gcc/sel-sched-dump.c b/gcc/sel-sched-dump.c
index d41674572a2..395d922f146 100644
--- a/gcc/sel-sched-dump.c
+++ b/gcc/sel-sched-dump.c
@@ -1014,7 +1014,7 @@ debug_mem_addr_value (rtx x)
   machine_mode address_mode;
 
   gcc_assert (MEM_P (x));
-  address_mode = get_address_mode (x);
+  address_mode = mem_address_mode (x);
 
   t = shallow_copy_rtx (x);
   if (cselib_lookup (XEXP (t, 0), address_mode, 0, GET_MODE (t)))
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index c411b6f16da..03098b1486e 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5485,7 +5485,7 @@ replace_expr_with_values (rtx loc)
   else if (MEM_P (loc))
     {
       cselib_val *addr = cselib_lookup (XEXP (loc, 0),
-					get_address_mode (loc), 0,
+					mem_address_mode (loc), 0,
 					GET_MODE (loc));
       if (addr)
 	return replace_equiv_address_nv (loc, addr->val_rtx);
@@ -5548,7 +5548,7 @@ use_type (rtx loc, struct count_use_info *cui, machine_mode *modep)
 	      if (REG_P (loc)
 		  || (find_use_val (loc, GET_MODE (loc), cui)
 		      && cselib_lookup (XEXP (loc, 0),
-					get_address_mode (loc), 0,
+					mem_address_mode (loc), 0,
 					GET_MODE (loc))))
 		return MO_VAL_SET;
 	    }
@@ -5711,7 +5711,7 @@ add_uses (rtx loc, struct count_use_info *cui)
 	      && !MEM_P (XEXP (vloc, 0)))
 	    {
 	      rtx mloc = vloc;
-	      machine_mode address_mode = get_address_mode (mloc);
+	      machine_mode address_mode = mem_address_mode (mloc);
 	      cselib_val *val
 		= cselib_lookup (XEXP (mloc, 0), address_mode, 0,
 				 GET_MODE (mloc));
@@ -5776,7 +5776,7 @@ add_uses (rtx loc, struct count_use_info *cui)
 	      && !MEM_P (XEXP (oloc, 0)))
 	    {
 	      rtx mloc = oloc;
-	      machine_mode address_mode = get_address_mode (mloc);
+	      machine_mode address_mode = mem_address_mode (mloc);
 	      cselib_val *val
 		= cselib_lookup (XEXP (mloc, 0), address_mode, 0,
 				 GET_MODE (mloc));
@@ -6053,7 +6053,7 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
 	  && !MEM_P (XEXP (loc, 0)))
 	{
 	  rtx mloc = loc;
-	  machine_mode address_mode = get_address_mode (mloc);
+	  machine_mode address_mode = mem_address_mode (mloc);
 	  cselib_val *val = cselib_lookup (XEXP (mloc, 0),
 					   address_mode, 0,
 					   GET_MODE (mloc));


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

only message in thread, other threads:[~2022-03-16 12:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 12:15 [gcc(refs/vendors/ARM/heads/morello)] Rename get_address_mode to mem_address_mode 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).