public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 05/50] calls.c:internal_arg_pointer_based_exp
Date: Sun, 03 Aug 2014 13:48:00 -0000	[thread overview]
Message-ID: <87d2chd6po.fsf@googlemail.com> (raw)
In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of	"Sun, 03 Aug 2014 14:38:01 +0100")

gcc/
	* calls.c: Include rtl-iter.h.
	(internal_arg_pointer_based_exp_1): Delete.
	(internal_arg_pointer_based_exp): Take a const_rtx.
	Use FOR_EACH_SUBRTX to iterate over subrtxes.

Index: gcc/calls.c
===================================================================
--- gcc/calls.c	2014-08-03 11:25:10.496959956 +0100
+++ gcc/calls.c	2014-08-03 11:25:21.433068077 +0100
@@ -49,6 +49,7 @@ Software Foundation; either version 3, o
 #include "cgraph.h"
 #include "except.h"
 #include "dbgcnt.h"
+#include "rtl-iter.h"
 
 /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits.  */
 #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
@@ -1693,7 +1694,7 @@ rtx_for_function_call (tree fndecl, tree
   vec<rtx> cache;
 } internal_arg_pointer_exp_state;
 
-static rtx internal_arg_pointer_based_exp (rtx, bool);
+static rtx internal_arg_pointer_based_exp (const_rtx, bool);
 
 /* Helper function for internal_arg_pointer_based_exp.  Scan insns in
    the tail call sequence, starting with first insn that hasn't been
@@ -1741,28 +1742,13 @@ internal_arg_pointer_based_exp_scan (voi
   internal_arg_pointer_exp_state.scan_start = scan_start;
 }
 
-/* Helper function for internal_arg_pointer_based_exp, called through
-   for_each_rtx.  Return 1 if *LOC is a register based on
-   crtl->args.internal_arg_pointer.  Return -1 if *LOC is not based on it
-   and the subexpressions need not be examined.  Otherwise return 0.  */
-
-static int
-internal_arg_pointer_based_exp_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
-{
-  if (REG_P (*loc) && internal_arg_pointer_based_exp (*loc, false) != NULL_RTX)
-    return 1;
-  if (MEM_P (*loc))
-    return -1;
-  return 0;
-}
-
 /* Compute whether RTL is based on crtl->args.internal_arg_pointer.  Return
    NULL_RTX if RTL isn't based on it, a CONST_INT offset if RTL is based on
    it with fixed offset, or PC if this is with variable or unknown offset.
    TOPLEVEL is true if the function is invoked at the topmost level.  */
 
 static rtx
-internal_arg_pointer_based_exp (rtx rtl, bool toplevel)
+internal_arg_pointer_based_exp (const_rtx rtl, bool toplevel)
 {
   if (CONSTANT_P (rtl))
     return NULL_RTX;
@@ -1796,8 +1782,15 @@ internal_arg_pointer_based_exp (rtx rtl,
       return NULL_RTX;
     }
 
-  if (for_each_rtx (&rtl, internal_arg_pointer_based_exp_1, NULL))
-    return pc_rtx;
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, rtl, NONCONST)
+    {
+      const_rtx x = *iter;
+      if (REG_P (x) && internal_arg_pointer_based_exp (x, false) != NULL_RTX)
+	return pc_rtx;
+      if (MEM_P (x))
+	iter.skip_subrtxes ();
+    }
 
   return NULL_RTX;
 }

  parent reply	other threads:[~2014-08-03 13:48 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-03 13:38 [PATCH 0/50] Faster for_each_rtx-like iterators Richard Sandiford
2014-08-03 13:39 ` [PATCH 01/50] Add rtl-iter.h Richard Sandiford
2014-08-05 20:48   ` Jeff Law
2014-08-05 22:19   ` Richard Henderson
2014-08-09 10:16     ` Richard Sandiford
2014-08-03 13:40 ` [PATCH 02/50] alias.c:refs_newer_value_p Richard Sandiford
2014-08-05 20:52   ` Jeff Law
2014-08-03 13:44 ` [PATCH 03/50] bt-load.c:find_btr_use Richard Sandiford
2014-08-06 18:39   ` Jeff Law
2014-08-03 13:48 ` [PATCH 04/50] caller-save.c:add_used_regs Richard Sandiford
2014-08-05 20:54   ` Jeff Law
2014-08-03 13:48 ` Richard Sandiford [this message]
2014-08-05 20:56   ` [PATCH 05/50] calls.c:internal_arg_pointer_based_exp Jeff Law
2014-08-03 13:50 ` [PATCH 06/50] combine.c:unmentioned_reg_p Richard Sandiford
2014-08-05 20:56   ` Jeff Law
2014-08-03 13:51 ` [PATCH 07/50] combine.c:record_truncated_values Richard Sandiford
2014-08-05 20:57   ` Jeff Law
2014-08-03 13:52 ` [PATCH 08/50] Faster for_each_rtx-like iterators Richard Sandiford
2014-08-06 18:17   ` Jeff Law
2014-08-03 13:53 ` [PATCH 09/50] cfgcleanup.c:mentions_nonequal_regs Richard Sandiford
2014-08-05 21:00   ` Jeff Law
2014-08-03 13:54 ` [PATCH 10/50] cse.c:approx_reg_cost Richard Sandiford
2014-08-05 21:01   ` Jeff Law
2014-08-03 13:55 ` [PATCH 11/50] Faster for_each_rtx-like iterators Richard Sandiford
2014-08-06 18:20   ` Jeff Law
2014-08-03 13:56 ` [PATCH 12/50] cse.c:check_for_label_ref Richard Sandiford
2014-08-06 18:15   ` Jeff Law
2014-08-03 13:57 ` [PATCH 13/50] cse.c:is_dead_debug_insn Richard Sandiford
2014-08-05 21:03   ` Jeff Law
2014-08-03 13:58 ` [PATCH 14/50] cse.c:cse_change_cc_mode Richard Sandiford
2014-08-05 21:04   ` Jeff Law
2014-08-03 13:58 ` [PATCH 15/50] ddg.c:mark_mem_use Richard Sandiford
2014-08-05 21:04   ` Jeff Law
2014-08-03 13:59 ` [PATCH 16/50] ddg.c:insns_may_alias_p Richard Sandiford
2014-08-05 21:05   ` Jeff Law
2014-08-03 14:02 ` [PATCH 17/50] df-problems.c:find_memory Richard Sandiford
2014-08-05 21:29   ` Jeff Law
2014-08-06  8:35     ` Richard Earnshaw
2014-08-03 14:02 ` [PATCH 18/50] dse.c:check_mem_read_use Richard Sandiford
2014-08-05 21:06   ` Jeff Law
2014-08-03 14:03 ` [PATCH 19/50] dwarf2out.c:const_ok_for_output Richard Sandiford
2014-08-05 21:30   ` Jeff Law
2014-08-03 14:04 ` [PATCH 20/50] dwarf2out.c:resolve_one_addr Richard Sandiford
2014-08-05 21:31   ` Jeff Law
2014-08-03 14:07 ` [PATCH 21/50] Faster for_each_rtx-like iterators Richard Sandiford
2014-08-05 21:09   ` Jeff Law
2014-08-03 14:08 ` [PATCH 22/50] final.c:mark_symbol_refs_as_used Richard Sandiford
2014-08-05 21:10   ` Jeff Law
2014-08-03 14:09 ` [PATCH 23/50] function.c:instantiate_virtual_regs_in_rtx Richard Sandiford
2014-08-06 18:14   ` Jeff Law
2014-08-03 14:10 ` [PATCH 24/50] fwprop.c:varying_mem_p Richard Sandiford
2014-08-05 21:10   ` Jeff Law
2014-08-03 14:10 ` [PATCH 25/50] ira.c:set_paradoxical_subreg Richard Sandiford
2014-08-05 21:11   ` Jeff Law
2014-08-03 14:11 ` [PATCH 26/50] jump.c:returnjump_p Richard Sandiford
2014-08-05 21:11   ` Jeff Law
2014-08-03 14:12 ` [PATCH 27/50] jump.c:eh_returnjump_p Richard Sandiford
2014-08-05 21:11   ` Jeff Law
2014-08-03 14:13 ` [PATCH 28/50] loop-iv.c:replace_single_def_regs Richard Sandiford
2014-08-05 22:08   ` Jeff Law
2014-08-03 14:14 ` [PATCH 29/50] loop-iv.c:altered_reg_used Richard Sandiford
2014-08-05 21:12   ` Jeff Law
2014-08-03 14:15 ` [PATCH 30/50] lower-subreg.c:resolve_subreg_use Richard Sandiford
2014-08-06 18:12   ` Jeff Law
2014-08-03 14:15 ` [PATCH 31/50] lower-subreg.c:resolve_debug Richard Sandiford
2014-08-05 21:13   ` Jeff Law
2014-08-03 14:17 ` [PATCH 32/50] lower-subreg.c:find_decomposable_subregs Richard Sandiford
2014-08-06 18:11   ` Jeff Law
2014-08-03 14:18 ` [PATCH 33/50] reg-stack.c:subst_all_stack_regs_in_debug_insn Richard Sandiford
2014-08-05 21:13   ` Jeff Law
2014-08-03 14:19 ` [PATCH 34/50] regcprop.c:kill_autoinc_value Richard Sandiford
2014-08-05 21:16   ` Jeff Law
2014-08-03 14:20 ` [PATCH 35/50] regcprop.c:cprop_find_used_regs Richard Sandiford
2014-08-05 21:17   ` Jeff Law
2014-08-03 14:20 ` [PATCH 36/50] reload1.c:note_reg_elim_costly Richard Sandiford
2014-08-05 22:09   ` Jeff Law
2014-08-03 14:22 ` [PATCH 37/50] rtlanal.c:rtx_referenced_p Richard Sandiford
2014-08-05 22:10   ` Jeff Law
2014-08-03 14:25 ` [PATCH 38/50] rtlanal.c:replace_label Richard Sandiford
2014-08-05 22:11   ` Jeff Law
2014-08-03 14:27 ` [PATCH 39/50] rtlanal.c:record_hard_reg_uses Richard Sandiford
2014-08-05 21:19   ` Jeff Law
2014-08-03 14:32 ` [PATCH 40/50] rtlanal.c:for_each_inc_dec Richard Sandiford
2014-08-06 18:33   ` Jeff Law
2014-08-09 10:13     ` Richard Sandiford
2014-08-12 20:11       ` Jeff Law
2014-08-26 19:28         ` Richard Sandiford
2014-08-27 20:36           ` Jeff Law
2014-08-03 14:33 ` [PATCH 41/50] rtlanal.c:tls_referenced_p Richard Sandiford
2014-08-05 21:19   ` Jeff Law
2014-08-03 14:34 ` [PATCH 43/50] store-motion.c:extract_mentioned_regs Richard Sandiford
2014-08-05 21:20   ` Jeff Law
2014-08-03 14:34 ` [PATCH 42/50] sel-sched.c:count_occurrences_equiv Richard Sandiford
2014-08-05 22:12   ` Jeff Law
2014-08-03 14:35 ` [PATCH 44/50] var-tracking.c:rtx_debug_expr_p Richard Sandiford
2014-08-05 21:20   ` Jeff Law
2014-08-03 14:36 ` [PATCH 45/50] var-tracking.c:non_suitable_const Richard Sandiford
2014-08-05 21:21   ` Jeff Law
2014-08-03 14:38 ` [PATCH 46/50] var-tracking.c:use_narrower_mode_test Richard Sandiford
2014-08-05 22:19   ` Jeff Law
2014-08-03 14:38 ` [PATCH 47/50] var-tracking.c:add_uses Richard Sandiford
2014-08-05 21:22   ` Jeff Law
2014-08-03 14:42 ` [PATCH 48/50] varasm.c:const_rtx_hash Richard Sandiford
2014-08-05 22:18   ` Jeff Law
2014-08-03 14:43 ` [PATCH 49/50] varasm.c:mark_constants Richard Sandiford
2014-08-05 22:16   ` Jeff Law
2014-08-03 14:45 ` [PATCH 50/50] varasm.c:compute_reloc_for_rtx Richard Sandiford
2014-08-05 22:15   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2chd6po.fsf@googlemail.com \
    --to=rdsandiford@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).