* [ARC] RFA: Use new rtl iterators in arc600_corereg_hazard
@ 2014-10-25 9:58 Richard Sandiford
2014-11-02 18:41 ` Joern Rennecke
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-10-25 9:58 UTC (permalink / raw)
To: gcc-patches; +Cc: joern.rennecke
This is part of a series to remove uses of for_each_rtx from the ports.
Tested by making sure there were no code changes for gcc.dg, gcc.c-torture
and g++.dg for arc-elf. OK to install?
Thanks,
Richard
gcc/
* config/arc/arc.c (arc600_corereg_hazard_1): Delete.
(arc600_corereg_hazard): Use FOR_EACH_SUBRTX.
Index: gcc/config/arc/arc.c
===================================================================
--- gcc/config/arc/arc.c 2014-10-25 09:51:25.901887608 +0100
+++ gcc/config/arc/arc.c 2014-10-25 09:51:26.279890977 +0100
@@ -7698,38 +7698,6 @@ disi_highpart (rtx in)
return simplify_gen_subreg (SImode, in, DImode, TARGET_BIG_ENDIAN ? 0 : 4);
}
-/* Called by arc600_corereg_hazard via for_each_rtx.
- If a hazard is found, return a conservative estimate of the required
- length adjustment to accomodate a nop. */
-
-static int
-arc600_corereg_hazard_1 (rtx *xp, void *data)
-{
- rtx x = *xp;
- rtx dest;
- rtx pat = (rtx) data;
-
- switch (GET_CODE (x))
- {
- case SET: case POST_INC: case POST_DEC: case PRE_INC: case PRE_DEC:
- break;
- default:
- /* This is also fine for PRE/POST_MODIFY, because they contain a SET. */
- return 0;
- }
- dest = XEXP (x, 0);
- /* Check if this sets a an extension register. N.B. we use 61 for the
- condition codes, which is definitely not an extension register. */
- if (REG_P (dest) && REGNO (dest) >= 32 && REGNO (dest) < 61
- /* Check if the same register is used by the PAT. */
- && (refers_to_regno_p
- (REGNO (dest),
- REGNO (dest) + (GET_MODE_SIZE (GET_MODE (dest)) + 3) / 4U, pat, 0)))
- return 4;
-
- return 0;
-}
-
/* Return length adjustment for INSN.
For ARC600:
A write to a core reg greater or equal to 32 must not be immediately
@@ -7761,8 +7729,31 @@ arc600_corereg_hazard (rtx_insn *pred, r
|| recog_memoized (pred) == CODE_FOR_umul64_600
|| recog_memoized (pred) == CODE_FOR_umac64_600)
return 0;
- return for_each_rtx (&PATTERN (pred), arc600_corereg_hazard_1,
- PATTERN (succ));
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, PATTERN (pred), NONCONST)
+ {
+ const_rtx x = *iter;
+ switch (GET_CODE (x))
+ {
+ case SET: case POST_INC: case POST_DEC: case PRE_INC: case PRE_DEC:
+ break;
+ default:
+ /* This is also fine for PRE/POST_MODIFY, because they
+ contain a SET. */
+ continue;
+ }
+ rtx dest = XEXP (x, 0);
+ /* Check if this sets a an extension register. N.B. we use 61 for the
+ condition codes, which is definitely not an extension register. */
+ if (REG_P (dest) && REGNO (dest) >= 32 && REGNO (dest) < 61
+ /* Check if the same register is used by the PAT. */
+ && (refers_to_regno_p
+ (REGNO (dest),
+ REGNO (dest) + (GET_MODE_SIZE (GET_MODE (dest)) + 3) / 4U,
+ PATTERN (succ), 0)))
+ return 4;
+ }
+ return 0;
}
/* For ARC600:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ARC] RFA: Use new rtl iterators in arc600_corereg_hazard
2014-10-25 9:58 [ARC] RFA: Use new rtl iterators in arc600_corereg_hazard Richard Sandiford
@ 2014-11-02 18:41 ` Joern Rennecke
0 siblings, 0 replies; 2+ messages in thread
From: Joern Rennecke @ 2014-11-02 18:41 UTC (permalink / raw)
To: GCC Patches, Joern Rennecke, rdsandiford
On 25 October 2014 10:56, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> This is part of a series to remove uses of for_each_rtx from the ports.
>
> Tested by making sure there were no code changes for gcc.dg, gcc.c-torture
> and g++.dg for arc-elf. OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> * config/arc/arc.c (arc600_corereg_hazard_1): Delete.
> (arc600_corereg_hazard): Use FOR_EACH_SUBRTX.
OK.
> + FOR_EACH_SUBRTX (iter, array, PATTERN (pred), NONCONST)
I was wondering for a while what kind of (NON)CONST this was about...
but as I glean
from the source, as long as nobody packs an address with a side effect
into a (CONST (MEM (...)) -
which should never happen in the first place, no matter if the MEM
itself is really const - we
should be fine.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-02 18:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25 9:58 [ARC] RFA: Use new rtl iterators in arc600_corereg_hazard Richard Sandiford
2014-11-02 18:41 ` Joern Rennecke
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).