From: Richard Sandiford <rdsandiford@googlemail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 32/50] lower-subreg.c:find_decomposable_subregs
Date: Sun, 03 Aug 2014 14:17:00 -0000 [thread overview]
Message-ID: <874mxt8xod.fsf@googlemail.com> (raw)
In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100")
Mostly just reindentation.
gcc/
* lower-subreg.c (find_decomposable_subregs): Turn from being
a for_each_rtx callback to being a function that examines each
subrtx itself. Remove handling of null rtxes.
(decompose_multiword_subregs): Update accordingly.
Index: gcc/lower-subreg.c
===================================================================
--- gcc/lower-subreg.c 2014-08-03 11:25:28.779140704 +0100
+++ gcc/lower-subreg.c 2014-08-03 11:25:29.052143403 +0100
@@ -443,7 +443,7 @@ propagate_pseudo_copies (void)
}
/* A pointer to one of these values is passed to
- find_decomposable_subregs via for_each_rtx. */
+ find_decomposable_subregs. */
enum classify_move_insn
{
@@ -455,120 +455,121 @@ enum classify_move_insn
SIMPLE_MOVE
};
-/* This is called via for_each_rtx. If we find a SUBREG which we
- could use to decompose a pseudo-register, set a bit in
- DECOMPOSABLE_CONTEXT. If we find an unadorned register which is
- not a simple pseudo-register copy, DATA will point at the type of
- move, and we set a bit in DECOMPOSABLE_CONTEXT or
- NON_DECOMPOSABLE_CONTEXT as appropriate. */
+/* If we find a SUBREG in *LOC which we could use to decompose a
+ pseudo-register, set a bit in DECOMPOSABLE_CONTEXT. If we find an
+ unadorned register which is not a simple pseudo-register copy,
+ DATA will point at the type of move, and we set a bit in
+ DECOMPOSABLE_CONTEXT or NON_DECOMPOSABLE_CONTEXT as appropriate. */
-static int
-find_decomposable_subregs (rtx *px, void *data)
+static void
+find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi)
{
- enum classify_move_insn *pcmi = (enum classify_move_insn *) data;
- rtx x = *px;
-
- if (x == NULL_RTX)
- return 0;
-
- if (GET_CODE (x) == SUBREG)
+ subrtx_var_iterator::array_type array;
+ FOR_EACH_SUBRTX_VAR (iter, array, *loc, NONCONST)
{
- rtx inner = SUBREG_REG (x);
- unsigned int regno, outer_size, inner_size, outer_words, inner_words;
+ rtx x = *iter;
+ if (GET_CODE (x) == SUBREG)
+ {
+ rtx inner = SUBREG_REG (x);
+ unsigned int regno, outer_size, inner_size, outer_words, inner_words;
- if (!REG_P (inner))
- return 0;
+ if (!REG_P (inner))
+ continue;
- regno = REGNO (inner);
- if (HARD_REGISTER_NUM_P (regno))
- return -1;
+ regno = REGNO (inner);
+ if (HARD_REGISTER_NUM_P (regno))
+ {
+ iter.skip_subrtxes ();
+ continue;
+ }
- outer_size = GET_MODE_SIZE (GET_MODE (x));
- inner_size = GET_MODE_SIZE (GET_MODE (inner));
- outer_words = (outer_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- inner_words = (inner_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- /* We only try to decompose single word subregs of multi-word
- registers. When we find one, we return -1 to avoid iterating
- over the inner register.
-
- ??? This doesn't allow, e.g., DImode subregs of TImode values
- on 32-bit targets. We would need to record the way the
- pseudo-register was used, and only decompose if all the uses
- were the same number and size of pieces. Hopefully this
- doesn't happen much. */
+ outer_size = GET_MODE_SIZE (GET_MODE (x));
+ inner_size = GET_MODE_SIZE (GET_MODE (inner));
+ outer_words = (outer_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+ inner_words = (inner_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+
+ /* We only try to decompose single word subregs of multi-word
+ registers. When we find one, we return -1 to avoid iterating
+ over the inner register.
+
+ ??? This doesn't allow, e.g., DImode subregs of TImode values
+ on 32-bit targets. We would need to record the way the
+ pseudo-register was used, and only decompose if all the uses
+ were the same number and size of pieces. Hopefully this
+ doesn't happen much. */
- if (outer_words == 1 && inner_words > 1)
- {
- bitmap_set_bit (decomposable_context, regno);
- return -1;
- }
+ if (outer_words == 1 && inner_words > 1)
+ {
+ bitmap_set_bit (decomposable_context, regno);
+ iter.skip_subrtxes ();
+ continue;
+ }
- /* If this is a cast from one mode to another, where the modes
- have the same size, and they are not tieable, then mark this
- register as non-decomposable. If we decompose it we are
- likely to mess up whatever the backend is trying to do. */
- if (outer_words > 1
- && outer_size == inner_size
- && !MODES_TIEABLE_P (GET_MODE (x), GET_MODE (inner)))
- {
- bitmap_set_bit (non_decomposable_context, regno);
- bitmap_set_bit (subreg_context, regno);
- return -1;
+ /* If this is a cast from one mode to another, where the modes
+ have the same size, and they are not tieable, then mark this
+ register as non-decomposable. If we decompose it we are
+ likely to mess up whatever the backend is trying to do. */
+ if (outer_words > 1
+ && outer_size == inner_size
+ && !MODES_TIEABLE_P (GET_MODE (x), GET_MODE (inner)))
+ {
+ bitmap_set_bit (non_decomposable_context, regno);
+ bitmap_set_bit (subreg_context, regno);
+ iter.skip_subrtxes ();
+ continue;
+ }
}
- }
- else if (REG_P (x))
- {
- unsigned int regno;
-
- /* We will see an outer SUBREG before we see the inner REG, so
- when we see a plain REG here it means a direct reference to
- the register.
-
- If this is not a simple copy from one location to another,
- then we can not decompose this register. If this is a simple
- copy we want to decompose, and the mode is right,
- then we mark the register as decomposable.
- Otherwise we don't say anything about this register --
- it could be decomposed, but whether that would be
- profitable depends upon how it is used elsewhere.
-
- We only set bits in the bitmap for multi-word
- pseudo-registers, since those are the only ones we care about
- and it keeps the size of the bitmaps down. */
-
- regno = REGNO (x);
- if (!HARD_REGISTER_NUM_P (regno)
- && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
+ else if (REG_P (x))
{
- switch (*pcmi)
+ unsigned int regno;
+
+ /* We will see an outer SUBREG before we see the inner REG, so
+ when we see a plain REG here it means a direct reference to
+ the register.
+
+ If this is not a simple copy from one location to another,
+ then we can not decompose this register. If this is a simple
+ copy we want to decompose, and the mode is right,
+ then we mark the register as decomposable.
+ Otherwise we don't say anything about this register --
+ it could be decomposed, but whether that would be
+ profitable depends upon how it is used elsewhere.
+
+ We only set bits in the bitmap for multi-word
+ pseudo-registers, since those are the only ones we care about
+ and it keeps the size of the bitmaps down. */
+
+ regno = REGNO (x);
+ if (!HARD_REGISTER_NUM_P (regno)
+ && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
{
- case NOT_SIMPLE_MOVE:
- bitmap_set_bit (non_decomposable_context, regno);
- break;
- case DECOMPOSABLE_SIMPLE_MOVE:
- if (MODES_TIEABLE_P (GET_MODE (x), word_mode))
- bitmap_set_bit (decomposable_context, regno);
- break;
- case SIMPLE_MOVE:
- break;
- default:
- gcc_unreachable ();
+ switch (*pcmi)
+ {
+ case NOT_SIMPLE_MOVE:
+ bitmap_set_bit (non_decomposable_context, regno);
+ break;
+ case DECOMPOSABLE_SIMPLE_MOVE:
+ if (MODES_TIEABLE_P (GET_MODE (x), word_mode))
+ bitmap_set_bit (decomposable_context, regno);
+ break;
+ case SIMPLE_MOVE:
+ break;
+ default:
+ gcc_unreachable ();
+ }
}
}
- }
- else if (MEM_P (x))
- {
- enum classify_move_insn cmi_mem = NOT_SIMPLE_MOVE;
+ else if (MEM_P (x))
+ {
+ enum classify_move_insn cmi_mem = NOT_SIMPLE_MOVE;
- /* Any registers used in a MEM do not participate in a
- SIMPLE_MOVE or DECOMPOSABLE_SIMPLE_MOVE. Do our own recursion
- here, and return -1 to block the parent's recursion. */
- for_each_rtx (&XEXP (x, 0), find_decomposable_subregs, &cmi_mem);
- return -1;
+ /* Any registers used in a MEM do not participate in a
+ SIMPLE_MOVE or DECOMPOSABLE_SIMPLE_MOVE. Do our own recursion
+ here, and return -1 to block the parent's recursion. */
+ find_decomposable_subregs (&XEXP (x, 0), &cmi_mem);
+ iter.skip_subrtxes ();
+ }
}
-
- return 0;
}
/* Decompose REGNO into word-sized components. We smash the REG node
@@ -1493,9 +1494,7 @@ decompose_multiword_subregs (bool decomp
n = recog_data.n_operands;
for (i = 0; i < n; ++i)
{
- for_each_rtx (&recog_data.operand[i],
- find_decomposable_subregs,
- &cmi);
+ find_decomposable_subregs (&recog_data.operand[i], &cmi);
/* We handle ASM_OPERANDS as a special case to support
things like x86 rdtsc which returns a DImode value.
next prev parent reply other threads:[~2014-08-03 14:17 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 05/50] calls.c:internal_arg_pointer_based_exp Richard Sandiford
2014-08-05 20:56 ` 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: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 15/50] ddg.c:mark_mem_use Richard Sandiford
2014-08-05 21:04 ` 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: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 25/50] ira.c:set_paradoxical_subreg Richard Sandiford
2014-08-05 21:11 ` 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: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 31/50] lower-subreg.c:resolve_debug Richard Sandiford
2014-08-05 21:13 ` 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:17 ` Richard Sandiford [this message]
2014-08-06 18:11 ` [PATCH 32/50] lower-subreg.c:find_decomposable_subregs 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 36/50] reload1.c:note_reg_elim_costly Richard Sandiford
2014-08-05 22:09 ` 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: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 42/50] sel-sched.c:count_occurrences_equiv Richard Sandiford
2014-08-05 22:12 ` 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: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=874mxt8xod.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).