* [PATCH 01/10] Use rtx_jump_table_data in jump.c:delete_related_insns
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:23 ` Jeff Law
2014-09-05 1:47 ` [PATCH 05/10] Convert set_block_for_insn from a macro to an inline function David Malcolm
` (8 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* jump.c (delete_related_insns): Introduce a new local "table" by
replacing JUMP_TABLE_DATA_P with a dyn_cast, then use the
get_labels method of "table" to simplify access to the labels in
the jump table.
---
gcc/jump.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/jump.c b/gcc/jump.c
index 12edd92..84040da 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1314,15 +1314,15 @@ delete_related_insns (rtx uncast_insn)
/* Likewise if we're deleting a dispatch table. */
- if (JUMP_TABLE_DATA_P (insn))
+ if (rtx_jump_table_data *table = dyn_cast <rtx_jump_table_data *> (insn))
{
- rtx pat = PATTERN (insn);
- int i, diff_vec_p = GET_CODE (pat) == ADDR_DIFF_VEC;
- int len = XVECLEN (pat, diff_vec_p);
+ rtvec labels = table->get_labels ();
+ int i;
+ int len = GET_NUM_ELEM (labels);
for (i = 0; i < len; i++)
- if (LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0)) == 0)
- delete_related_insns (XEXP (XVECEXP (pat, diff_vec_p, i), 0));
+ if (LABEL_NUSES (XEXP (RTVEC_ELT (labels, i), 0)) == 0)
+ delete_related_insns (XEXP (RTVEC_ELT (labels, i), 0));
while (next && INSN_DELETED_P (next))
next = NEXT_INSN (next);
return next;
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 05/10] Convert set_block_for_insn from a macro to an inline function
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
2014-09-05 1:47 ` [PATCH 01/10] Use rtx_jump_table_data in jump.c:delete_related_insns David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:29 ` Jeff Law
2014-09-05 1:47 ` [PATCH 06/10] Use rtx_insn more within peep2 David Malcolm
` (7 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* basic-block.h (set_block_for_insn): Eliminate this macro in
favor of...
* rtl.h (set_block_for_insn): New inline function, imposing the
requirement that the "insn" param is an rtx_insn *.
---
gcc/basic-block.h | 2 --
gcc/rtl.h | 5 +++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index dd727c2..fb1c498 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -385,8 +385,6 @@ struct GTY(()) control_flow_graph {
/* The two blocks that are always in the cfg. */
#define NUM_FIXED_BLOCKS (2)
-#define set_block_for_insn(INSN, BB) (BLOCK_FOR_INSN (INSN) = BB)
-
extern void compute_bb_for_insn (void);
extern unsigned int free_bb_for_insn (void);
extern void update_bb_for_insn (basic_block);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index deb206b..7c5bd51 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1353,6 +1353,11 @@ inline basic_block& BLOCK_FOR_INSN (rtx insn)
return XBBDEF (insn, 2);
}
+inline void set_block_for_insn (rtx_insn *insn, basic_block bb)
+{
+ BLOCK_FOR_INSN (insn) = bb;
+}
+
/* The body of an insn. */
inline rtx PATTERN (const_rtx insn)
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 06/10] Use rtx_insn more within peep2
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
2014-09-05 1:47 ` [PATCH 01/10] Use rtx_jump_table_data in jump.c:delete_related_insns David Malcolm
2014-09-05 1:47 ` [PATCH 05/10] Convert set_block_for_insn from a macro to an inline function David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:29 ` Jeff Law
2014-09-05 1:47 ` [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage David Malcolm
` (6 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* recog.c (peep2_attempt): Strengthen return type from rtx to
rtx_insn *.
(peep2_update_life): Likewise for params "last", "prev", removing
a checked cast made redundant by this.
(peephole2_optimize): Likewise for local "last".
---
gcc/recog.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gcc/recog.c b/gcc/recog.c
index 469dfe6..d07a57a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3160,7 +3160,7 @@ peep2_reinit_state (regset live)
replacing them with ATTEMPT. Returns the last insn emitted, or NULL
if the replacement is rejected. */
-static rtx
+static rtx_insn *
peep2_attempt (basic_block bb, rtx uncast_insn, int match_len, rtx_insn *attempt)
{
rtx_insn *insn = safe_as_a <rtx_insn *> (uncast_insn);
@@ -3396,7 +3396,8 @@ peep2_attempt (basic_block bb, rtx uncast_insn, int match_len, rtx_insn *attempt
matched, and which now need to be replaced in the buffer. */
static void
-peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
+peep2_update_life (basic_block bb, int match_len, rtx_insn *last,
+ rtx_insn *prev)
{
int i = peep2_buf_position (peep2_current + match_len + 1);
rtx_insn *x;
@@ -3408,7 +3409,7 @@ peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
gcc_assert (peep2_current_count >= match_len + 1);
peep2_current_count -= match_len + 1;
- x = as_a <rtx_insn *> (last);
+ x = last;
do
{
if (INSN_P (x))
@@ -3538,7 +3539,7 @@ peephole2_optimize (void)
peephole2_insns (PATTERN (head), head, &match_len));
if (attempt != NULL)
{
- rtx last = peep2_attempt (bb, head, match_len, attempt);
+ rtx_insn *last = peep2_attempt (bb, head, match_len, attempt);
if (last)
{
peep2_update_life (bb, match_len, last, PREV_INSN (attempt));
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (2 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 06/10] Use rtx_insn more within peep2 David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:28 ` Jeff Law
2014-09-05 1:47 ` [PATCH 08/10] Use rtx_insn_list within haifa-sched.c David Malcolm
` (5 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* caller-save.c (setup_save_areas): Strengthen local "insn" from
rtx to rtx_insn *.
* final.c (get_call_reg_set_usage): Likewise for first param,
eliminating a checked cast.
* regs.h (get_call_reg_set_usage): Likewise for first param.
* resource.c (mark_set_resources): Introduce local rtx_call_insn *
"call_insn" for the case of a MARK_SRC_DEST_CALL via a checked
cast, replacing references to "x" with "call_insn" where
appropriate.
(mark_target_live_regs): Strengthen local "real_insn" from rtx to
rtx_insn *, adding a checked cast.
---
gcc/caller-save.c | 2 +-
gcc/final.c | 3 +--
gcc/regs.h | 2 +-
gcc/resource.c | 11 ++++++-----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index d94343e..a0c402e 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -418,7 +418,7 @@ setup_save_areas (void)
int i, j, k, freq;
HARD_REG_SET hard_regs_used;
struct saved_hard_reg *saved_reg;
- rtx insn;
+ rtx_insn *insn;
struct insn_chain *chain, *next;
unsigned int regno;
HARD_REG_SET hard_regs_to_save, used_regs, this_insn_sets;
diff --git a/gcc/final.c b/gcc/final.c
index 81c750d..d9a887f 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -4879,10 +4879,9 @@ get_call_cgraph_rtl_info (rtx_insn *insn)
in REG_SET. Return DEFAULT_SET in REG_SET if not found. */
bool
-get_call_reg_set_usage (rtx uncast_insn, HARD_REG_SET *reg_set,
+get_call_reg_set_usage (rtx_insn *insn, HARD_REG_SET *reg_set,
HARD_REG_SET default_set)
{
- rtx_insn *insn = safe_as_a <rtx_insn *> (uncast_insn);
if (flag_use_caller_save)
{
struct cgraph_rtl_info *node = get_call_cgraph_rtl_info (insn);
diff --git a/gcc/regs.h b/gcc/regs.h
index 36e803d..17a7e58 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -412,7 +412,7 @@ range_in_hard_reg_set_p (const HARD_REG_SET set, unsigned regno, int nregs)
}
/* Get registers used by given function call instruction. */
-extern bool get_call_reg_set_usage (rtx insn, HARD_REG_SET *reg_set,
+extern bool get_call_reg_set_usage (rtx_insn *insn, HARD_REG_SET *reg_set,
HARD_REG_SET default_set);
#endif /* GCC_REGS_H */
diff --git a/gcc/resource.c b/gcc/resource.c
index 5528831..ff9b878 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -659,15 +659,16 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
if (mark_type == MARK_SRC_DEST_CALL)
{
+ rtx_call_insn *call_insn = as_a <rtx_call_insn *> (x);
rtx link;
HARD_REG_SET regs;
res->cc = res->memory = 1;
- get_call_reg_set_usage (x, ®s, regs_invalidated_by_call);
+ get_call_reg_set_usage (call_insn, ®s, regs_invalidated_by_call);
IOR_HARD_REG_SET (res->regs, regs);
- for (link = CALL_INSN_FUNCTION_USAGE (x);
+ for (link = CALL_INSN_FUNCTION_USAGE (call_insn);
link; link = XEXP (link, 1))
if (GET_CODE (XEXP (link, 0)) == CLOBBER)
mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1,
@@ -675,7 +676,7 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
/* Check for a REG_SETJMP. If it exists, then we must
assume that this call can clobber any register. */
- if (find_reg_note (x, REG_SETJMP, NULL))
+ if (find_reg_note (call_insn, REG_SETJMP, NULL))
SET_HARD_REG_SET (res->regs);
}
@@ -995,7 +996,7 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource
insn = next_insn_no_annul (insn))
{
rtx link;
- rtx real_insn = insn;
+ rtx_insn *real_insn = insn;
enum rtx_code code = GET_CODE (insn);
if (DEBUG_INSN_P (insn))
@@ -1013,7 +1014,7 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource
if (code == INSN
&& GET_CODE (PATTERN (insn)) == USE
&& INSN_P (XEXP (PATTERN (insn), 0)))
- real_insn = XEXP (PATTERN (insn), 0);
+ real_insn = as_a <rtx_insn *> (XEXP (PATTERN (insn), 0));
if (CALL_P (real_insn))
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage
2014-09-05 1:47 ` [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage David Malcolm
@ 2014-09-05 2:28 ` Jeff Law
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:28 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:52, David Malcolm wrote:
> gcc/
> * caller-save.c (setup_save_areas): Strengthen local "insn" from
> rtx to rtx_insn *.
> * final.c (get_call_reg_set_usage): Likewise for first param,
> eliminating a checked cast.
> * regs.h (get_call_reg_set_usage): Likewise for first param.
> * resource.c (mark_set_resources): Introduce local rtx_call_insn *
> "call_insn" for the case of a MARK_SRC_DEST_CALL via a checked
> cast, replacing references to "x" with "call_insn" where
> appropriate.
> (mark_target_live_regs): Strengthen local "real_insn" from rtx to
> rtx_insn *, adding a checked cast.
OK.
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 08/10] Use rtx_insn_list within haifa-sched.c
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (3 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:31 ` Jeff Law
2014-09-05 1:47 ` [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn David Malcolm
` (4 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* haifa-sched.c (check_clobbered_conditions): Strengthen local
"link" from rtx to rtx_insn_list *, and use its methods for
clarity and type-safety.
(toggle_cancelled_flags): Likewise.
(restore_last_backtrack_point): Likewise.
(queue_to_ready): Use insn method of "link" in one place.
(schedule_block): Strengthen local "link" from rtx to
rtx_insn_list *, and use its methods for clarity and type-safety.
---
gcc/haifa-sched.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 83ea5bd..fb92bb2 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -3148,13 +3148,13 @@ check_clobbered_conditions (rtx insn)
}
for (i = 0; i <= max_insn_queue_index; i++)
{
- rtx link;
+ rtx_insn_list *link;
int q = NEXT_Q_AFTER (q_ptr, i);
restart_queue:
- for (link = insn_queue[q]; link; link = XEXP (link, 1))
+ for (link = insn_queue[q]; link; link = link->next ())
{
- rtx_insn *x = as_a <rtx_insn *> (XEXP (link, 0));
+ rtx_insn *x = link->insn ();
if (TODO_SPEC (x) == DEP_CONTROL && cond_clobbered_p (x, t))
{
queue_remove (x);
@@ -4239,10 +4239,10 @@ toggle_cancelled_flags (bool set)
for (i = 0; i <= max_insn_queue_index; i++)
{
int q = NEXT_Q_AFTER (q_ptr, i);
- rtx link;
- for (link = insn_queue[q]; link; link = XEXP (link, 1))
+ rtx_insn_list *link;
+ for (link = insn_queue[q]; link; link = link->next ())
{
- rtx insn = XEXP (link, 0);
+ rtx_insn *insn = link->insn ();
FOR_EACH_DEP (insn, SD_LIST_BACK, sd_it, dep)
if (!DEBUG_INSN_P (DEP_PRO (dep)))
{
@@ -4349,7 +4349,6 @@ unschedule_insns_until (rtx insn)
static void
restore_last_backtrack_point (struct sched_block_state *psched_block)
{
- rtx link;
int i;
struct haifa_saved_data *save = backtrack_queue;
@@ -4384,9 +4383,9 @@ restore_last_backtrack_point (struct sched_block_state *psched_block)
{
int q = NEXT_Q_AFTER (q_ptr, i);
- for (link = insn_queue[q]; link; link = XEXP (link, 1))
+ for (rtx_insn_list *link = insn_queue[q]; link; link = link->next ())
{
- rtx_insn *x = as_a <rtx_insn *> (XEXP (link, 0));
+ rtx_insn *x = link->insn ();
QUEUE_INDEX (x) = QUEUE_NOWHERE;
INSN_TICK (x) = INVALID_TICK;
}
@@ -4416,9 +4415,9 @@ restore_last_backtrack_point (struct sched_block_state *psched_block)
insn_queue[q] = save->insn_queue[q];
- for (link = insn_queue[q]; link; link = XEXP (link, 1))
+ for (rtx_insn_list *link = insn_queue[q]; link; link = link->next ())
{
- rtx_insn *x = as_a <rtx_insn *> (XEXP (link, 0));
+ rtx_insn *x = link->insn ();
QUEUE_INDEX (x) = i;
TODO_SPEC (x) = recompute_todo_spec (x, true);
INSN_TICK (x) = save->clock_var + i;
@@ -4991,7 +4990,7 @@ queue_to_ready (struct ready_list *ready)
{
for (; link; link = link->next ())
{
- insn = as_a <rtx_insn *> (XEXP (link, 0));
+ insn = link->insn ();
q_size -= 1;
if (sched_verbose >= 2)
@@ -6545,12 +6544,12 @@ schedule_block (basic_block *target_bb, state_t init_state)
if (q_size)
for (i = 0; i <= max_insn_queue_index; i++)
{
- rtx link;
- for (link = insn_queue[i]; link; link = XEXP (link, 1))
+ rtx_insn_list *link;
+ for (link = insn_queue[i]; link; link = link->next ())
{
rtx_insn *x;
- x = as_a <rtx_insn *> (XEXP (link, 0));
+ x = link->insn ();
QUEUE_INDEX (x) = QUEUE_NOWHERE;
TODO_SPEC (x) = HARD_DEP;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 08/10] Use rtx_insn_list within haifa-sched.c
2014-09-05 1:47 ` [PATCH 08/10] Use rtx_insn_list within haifa-sched.c David Malcolm
@ 2014-09-05 2:31 ` Jeff Law
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:31 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:52, David Malcolm wrote:
> gcc/
> * haifa-sched.c (check_clobbered_conditions): Strengthen local
> "link" from rtx to rtx_insn_list *, and use its methods for
> clarity and type-safety.
> (toggle_cancelled_flags): Likewise.
> (restore_last_backtrack_point): Likewise.
> (queue_to_ready): Use insn method of "link" in one place.
> (schedule_block): Strengthen local "link" from rtx to
> rtx_insn_list *, and use its methods for clarity and type-safety.
OK.
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (4 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 08/10] Use rtx_insn_list within haifa-sched.c David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:25 ` Jeff Law
2014-09-05 1:47 ` [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN David Malcolm
` (3 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* output.h (final_scan_insn): Strengthen first param from rtx to
rtx_insn *.
* final.c (final_scan_insn): Likewise, renaming it back from
"uncast_insn" to "insn", eliminating the checked cast.
* config/h8300/h8300.md (define_insn "jump"): Replace local rtx
"vec" with an rtx_sequence * "seq", taking a copy of
"final_sequence", and using methods of "seq" for clarity, and for
type-safety in the calls to final_scan_insn.
* config/mips/mips.c (mips_output_conditional_branch): Use methods
of "final_sequence" for clarity, and for type-safety in the call to
final_scan_insn.
* config/sh/sh.c (print_slot): Strengthen param from rtx to
rtx_sequence * and rename from "insn" to "seq".
---
gcc/config/h8300/h8300.md | 10 +++++-----
gcc/config/mips/mips.c | 8 ++++----
gcc/config/sh/sh.c | 8 ++++----
gcc/final.c | 4 +---
gcc/output.h | 2 +-
5 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index bc592dc..cb10203 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -2404,14 +2404,14 @@
bytes further than previously thought. The length-based
test for bra vs. jump is very conservative though, so the
branch will still be within range. */
- rtvec vec;
+ rtx_sequence *seq;
int seen;
- vec = XVEC (final_sequence, 0);
+ seq = final_sequence;
final_sequence = 0;
- final_scan_insn (RTVEC_ELT (vec, 1), asm_out_file, optimize, 1, & seen);
- final_scan_insn (RTVEC_ELT (vec, 0), asm_out_file, optimize, 1, & seen);
- INSN_DELETED_P (RTVEC_ELT (vec, 1)) = 1;
+ final_scan_insn (seq->insn (1), asm_out_file, optimize, 1, & seen);
+ final_scan_insn (seq->insn (0), asm_out_file, optimize, 1, & seen);
+ INSN_DELETED_P (seq->insn (1)) = 1;
return "";
}
}
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 3e77491..f9713c1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -12496,9 +12496,9 @@ mips_output_conditional_branch (rtx_insn *insn, rtx *operands,
delay slot if is not annulled. */
if (!INSN_ANNULLED_BRANCH_P (insn))
{
- final_scan_insn (XVECEXP (final_sequence, 0, 1),
+ final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (XVECEXP (final_sequence, 0, 1)) = 1;
+ INSN_DELETED_P (final_sequence->insn (1)) = 1;
}
else
output_asm_insn ("nop", 0);
@@ -12521,9 +12521,9 @@ mips_output_conditional_branch (rtx_insn *insn, rtx *operands,
Use INSN's delay slot if is annulled. */
if (INSN_ANNULLED_BRANCH_P (insn))
{
- final_scan_insn (XVECEXP (final_sequence, 0, 1),
+ final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (XVECEXP (final_sequence, 0, 1)) = 1;
+ INSN_DELETED_P (final_sequence->insn (1)) = 1;
}
else
output_asm_insn ("nop", 0);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 849867a..3b4acb9 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -184,7 +184,7 @@ static bool shmedia_space_reserved_for_target_registers;
static void split_branches (rtx_insn *);
static int branch_dest (rtx);
-static void print_slot (rtx);
+static void print_slot (rtx_sequence *);
static rtx_code_label *add_constant (rtx, enum machine_mode, rtx);
static void dump_table (rtx_insn *, rtx_insn *);
static bool broken_move (rtx_insn *);
@@ -2641,11 +2641,11 @@ output_movedouble (rtx insn ATTRIBUTE_UNUSED, rtx operands[],
another instruction, but couldn't because the other instruction expanded
into a sequence where putting the slot insn at the end wouldn't work. */
static void
-print_slot (rtx insn)
+print_slot (rtx_sequence *seq)
{
- final_scan_insn (XVECEXP (insn, 0, 1), asm_out_file, optimize, 1, NULL);
+ final_scan_insn (seq->insn (1), asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (XVECEXP (insn, 0, 1)) = 1;
+ INSN_DELETED_P (seq->insn (1)) = 1;
}
const char *
diff --git a/gcc/final.c b/gcc/final.c
index 6469f40..81c750d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2171,7 +2171,7 @@ call_from_call_insn (rtx_call_insn *insn)
both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG. */
rtx_insn *
-final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
+final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
int nopeepholes ATTRIBUTE_UNUSED, int *seen)
{
#ifdef HAVE_cc0
@@ -2179,8 +2179,6 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
#endif
rtx_insn *next;
- rtx_insn *insn = as_a <rtx_insn *> (uncast_insn);
-
insn_counter++;
/* Ignore deleted insns. These can occur when we split insns (due to a
diff --git a/gcc/output.h b/gcc/output.h
index a2ac1ec..fd36f8b 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -72,7 +72,7 @@ extern void final (rtx_insn *, FILE *, int);
/* The final scan for one insn, INSN. Args are same as in `final', except
that INSN is the insn being scanned. Value returned is the next insn to
be scanned. */
-extern rtx_insn *final_scan_insn (rtx, FILE *, int, int, int *);
+extern rtx_insn *final_scan_insn (rtx_insn *, FILE *, int, int, int *);
/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
subreg of. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn
2014-09-05 1:47 ` [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn David Malcolm
@ 2014-09-05 2:25 ` Jeff Law
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:25 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:51, David Malcolm wrote:
> gcc/
>
> * output.h (final_scan_insn): Strengthen first param from rtx to
> rtx_insn *.
>
> * final.c (final_scan_insn): Likewise, renaming it back from
> "uncast_insn" to "insn", eliminating the checked cast.
>
> * config/h8300/h8300.md (define_insn "jump"): Replace local rtx
> "vec" with an rtx_sequence * "seq", taking a copy of
> "final_sequence", and using methods of "seq" for clarity, and for
> type-safety in the calls to final_scan_insn.
> * config/mips/mips.c (mips_output_conditional_branch): Use methods
> of "final_sequence" for clarity, and for type-safety in the call to
> final_scan_insn.
> * config/sh/sh.c (print_slot): Strengthen param from rtx to
> rtx_sequence * and rename from "insn" to "seq".
OK.
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (5 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:31 ` Jeff Law
2014-09-05 1:47 ` [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label David Malcolm
` (2 subsequent siblings)
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* sched-deps.c (sched_get_condition_with_rev_uncached): Strengthen
param "insn" from const_rtx to const rtx_insn *.
(sched_get_reverse_condition_uncached): Likewise.
(sched_get_condition_with_rev): Likewise.
(sched_has_condition_p): Likewise.
(sched_insns_conditions_mutex_p): Likewise for both params.
(sched_insn_is_legitimate_for_speculation_p): Likewise for param
"insn"; conver use of CONST_CAST_RTX to CONST_CAST_RTX_INSN.
(setup_insn_reg_uses): Move local "list" to be more tightly
scoped, strengthening it from an rtx to an rtx_insn_list *. Use
its methods for clarity and type-safety.
(sched_analyze_1): Strengthen local "pending" from rtx to
rtx_insn_list *, and local "pending_mem" from rtx to
rtx_expr_list *. Use methods of each for clarity and type-safety.
(sched_analyze_2): Likewise.
(sched_analyze_insn): Likewise.
* sched-int.h (sched_get_reverse_condition_uncached): Strengthen
param from const_rtx to const rtx_insn *.
(sched_insns_conditions_mutex_p): Likewise for both params.
(sched_insn_is_legitimate_for_speculation_p): Likewise for first
param.
* system.h (CONST_CAST_RTX_INSN): New macro.
---
gcc/sched-deps.c | 94 +++++++++++++++++++++++++++++---------------------------
gcc/sched-int.h | 7 +++--
gcc/system.h | 1 +
3 files changed, 53 insertions(+), 49 deletions(-)
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 455ed19..cceff6d 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -496,7 +496,7 @@ static void sched_analyze_1 (struct deps_desc *, rtx, rtx_insn *);
static void sched_analyze_2 (struct deps_desc *, rtx, rtx_insn *);
static void sched_analyze_insn (struct deps_desc *, rtx, rtx_insn *);
-static bool sched_has_condition_p (const_rtx);
+static bool sched_has_condition_p (const rtx_insn *);
static int conditions_mutex_p (const_rtx, const_rtx, bool, bool);
static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 (dep_t, bool,
@@ -528,7 +528,7 @@ deps_may_trap_p (const_rtx mem)
it is set to TRUE when the returned comparison should be reversed
to get the actual condition. */
static rtx
-sched_get_condition_with_rev_uncached (const_rtx insn, bool *rev)
+sched_get_condition_with_rev_uncached (const rtx_insn *insn, bool *rev)
{
rtx pat = PATTERN (insn);
rtx src;
@@ -567,7 +567,7 @@ sched_get_condition_with_rev_uncached (const_rtx insn, bool *rev)
find such a condition. The caller should make a copy of the condition
before using it. */
rtx
-sched_get_reverse_condition_uncached (const_rtx insn)
+sched_get_reverse_condition_uncached (const rtx_insn *insn)
{
bool rev;
rtx cond = sched_get_condition_with_rev_uncached (insn, &rev);
@@ -587,7 +587,7 @@ sched_get_reverse_condition_uncached (const_rtx insn)
We only do actual work the first time we come here for an insn; the
results are cached in INSN_CACHED_COND and INSN_REVERSE_COND. */
static rtx
-sched_get_condition_with_rev (const_rtx insn, bool *rev)
+sched_get_condition_with_rev (const rtx_insn *insn, bool *rev)
{
bool tmp;
@@ -620,7 +620,7 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev)
/* True when we can find a condition under which INSN is executed. */
static bool
-sched_has_condition_p (const_rtx insn)
+sched_has_condition_p (const rtx_insn *insn)
{
return !! sched_get_condition_with_rev (insn, NULL);
}
@@ -646,7 +646,7 @@ conditions_mutex_p (const_rtx cond1, const_rtx cond2, bool rev1, bool rev2)
/* Return true if insn1 and insn2 can never depend on one another because
the conditions under which they are executed are mutually exclusive. */
bool
-sched_insns_conditions_mutex_p (const_rtx insn1, const_rtx insn2)
+sched_insns_conditions_mutex_p (const rtx_insn *insn1, const rtx_insn *insn2)
{
rtx cond1, cond2;
bool rev1 = false, rev2 = false;
@@ -673,7 +673,7 @@ sched_insns_conditions_mutex_p (const_rtx insn1, const_rtx insn2)
/* Return true if INSN can potentially be speculated with type DS. */
bool
-sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
+sched_insn_is_legitimate_for_speculation_p (const rtx_insn *insn, ds_t ds)
{
if (HAS_INTERNAL_DEP (insn))
return false;
@@ -684,7 +684,7 @@ sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
if (SCHED_GROUP_P (insn))
return false;
- if (IS_SPECULATION_CHECK_P (CONST_CAST_RTX (insn)))
+ if (IS_SPECULATION_CHECK_P (CONST_CAST_RTX_INSN (insn)))
return false;
if (side_effects_p (PATTERN (insn)))
@@ -1970,7 +1970,6 @@ setup_insn_reg_uses (struct deps_desc *deps, rtx_insn *insn)
{
unsigned i;
reg_set_iterator rsi;
- rtx list;
struct reg_use_data *use, *use2, *next;
struct deps_reg *reg_last;
@@ -1991,9 +1990,9 @@ setup_insn_reg_uses (struct deps_desc *deps, rtx_insn *insn)
reg_last = &deps->reg_last[i];
/* Create the cycle list of uses. */
- for (list = reg_last->uses; list; list = XEXP (list, 1))
+ for (rtx_insn_list *list = reg_last->uses; list; list = list->next ())
{
- use2 = create_insn_reg_use (i, as_a <rtx_insn *> (XEXP (list, 0)));
+ use2 = create_insn_reg_use (i, list->insn ());
next = use->next_regno_use;
use->next_regno_use = use2;
use2->next_regno_use = next;
@@ -2506,33 +2505,34 @@ sched_analyze_1 (struct deps_desc *deps, rtx x, rtx_insn *insn)
}
else
{
- rtx pending, pending_mem;
+ rtx_insn_list *pending;
+ rtx_expr_list *pending_mem;
pending = deps->pending_read_insns;
pending_mem = deps->pending_read_mems;
while (pending)
{
- if (anti_dependence (XEXP (pending_mem, 0), t)
- && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
- note_mem_dep (t, XEXP (pending_mem, 0), as_a <rtx_insn *> (XEXP (pending, 0)),
+ if (anti_dependence (pending_mem->element (), t)
+ && ! sched_insns_conditions_mutex_p (insn, pending->insn ()))
+ note_mem_dep (t, pending_mem->element (), pending->insn (),
DEP_ANTI);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem->next ();
}
pending = deps->pending_write_insns;
pending_mem = deps->pending_write_mems;
while (pending)
{
- if (output_dependence (XEXP (pending_mem, 0), t)
- && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
- note_mem_dep (t, XEXP (pending_mem, 0),
- as_a <rtx_insn *> (XEXP (pending, 0)),
+ if (output_dependence (pending_mem->element (), t)
+ && ! sched_insns_conditions_mutex_p (insn, pending->insn ()))
+ note_mem_dep (t, pending_mem->element (),
+ pending->insn (),
DEP_OUTPUT);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem-> next ();
}
add_dependence_list (insn, deps->last_pending_memory_flush, 1,
@@ -2635,7 +2635,8 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
{
/* Reading memory. */
rtx u;
- rtx pending, pending_mem;
+ rtx_insn_list *pending;
+ rtx_expr_list *pending_mem;
rtx t = x;
if (sched_deps_info->use_cselib)
@@ -2657,31 +2658,31 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
pending_mem = deps->pending_read_mems;
while (pending)
{
- if (read_dependence (XEXP (pending_mem, 0), t)
+ if (read_dependence (pending_mem->element (), t)
&& ! sched_insns_conditions_mutex_p (insn,
- XEXP (pending, 0)))
- note_mem_dep (t, XEXP (pending_mem, 0),
- as_a <rtx_insn *> (XEXP (pending, 0)),
+ pending->insn ()))
+ note_mem_dep (t, pending_mem->element (),
+ pending->insn (),
DEP_ANTI);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem->next ();
}
pending = deps->pending_write_insns;
pending_mem = deps->pending_write_mems;
while (pending)
{
- if (true_dependence (XEXP (pending_mem, 0), VOIDmode, t)
+ if (true_dependence (pending_mem->element (), VOIDmode, t)
&& ! sched_insns_conditions_mutex_p (insn,
- XEXP (pending, 0)))
- note_mem_dep (t, XEXP (pending_mem, 0),
- as_a <rtx_insn *> (XEXP (pending, 0)),
+ pending->insn ()))
+ note_mem_dep (t, pending_mem->element (),
+ pending->insn (),
sched_deps_info->generate_spec_deps
? BEGIN_DATA | DEP_TRUE : DEP_TRUE);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem->next ();
}
for (u = deps->last_pending_memory_flush; u; u = XEXP (u, 1))
@@ -2998,7 +2999,8 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn)
reg_pending_barrier = MOVE_BARRIER;
else
{
- rtx pending, pending_mem;
+ rtx_insn_list *pending;
+ rtx_expr_list *pending_mem;
if (sched_deps_info->compute_jump_reg_dependencies)
{
@@ -3026,23 +3028,23 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn)
pending_mem = deps->pending_write_mems;
while (pending)
{
- if (! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
- add_dependence (insn, as_a <rtx_insn *> (XEXP (pending, 0)),
+ if (! sched_insns_conditions_mutex_p (insn, pending->insn ()))
+ add_dependence (insn, pending->insn (),
REG_DEP_OUTPUT);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem->next ();
}
pending = deps->pending_read_insns;
pending_mem = deps->pending_read_mems;
while (pending)
{
- if (MEM_VOLATILE_P (XEXP (pending_mem, 0))
- && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
- add_dependence (insn, as_a <rtx_insn *> (XEXP (pending, 0)),
+ if (MEM_VOLATILE_P (pending_mem->element ())
+ && ! sched_insns_conditions_mutex_p (insn, pending->insn ()))
+ add_dependence (insn, pending->insn (),
REG_DEP_OUTPUT);
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
+ pending = pending->next ();
+ pending_mem = pending_mem->next ();
}
add_dependence_list (insn, deps->last_pending_memory_flush, 1,
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 76d4e96..dda394e 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -1291,9 +1291,10 @@ extern struct sched_deps_info_def *sched_deps_info;
/* Functions in sched-deps.c. */
-extern rtx sched_get_reverse_condition_uncached (const_rtx);
-extern bool sched_insns_conditions_mutex_p (const_rtx, const_rtx);
-extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
+extern rtx sched_get_reverse_condition_uncached (const rtx_insn *);
+extern bool sched_insns_conditions_mutex_p (const rtx_insn *,
+ const rtx_insn *);
+extern bool sched_insn_is_legitimate_for_speculation_p (const rtx_insn *, ds_t);
extern void add_dependence (rtx_insn *, rtx_insn *, enum reg_note);
extern void sched_analyze (struct deps_desc *, rtx_insn *, rtx_insn *);
extern void init_deps (struct deps_desc *, bool);
diff --git a/gcc/system.h b/gcc/system.h
index 3f2cfa1..a2c8f77 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1034,6 +1034,7 @@ helper_const_non_const_cast (const char *p)
#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
#define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X))
#define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X))
+#define CONST_CAST_RTX_INSN(X) CONST_CAST (struct rtx_insn *, (X))
#define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X))
#define CONST_CAST_GIMPLE(X) CONST_CAST (struct gimple_statement_base *, (X))
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN
2014-09-05 1:47 ` [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN David Malcolm
@ 2014-09-05 2:31 ` Jeff Law
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:31 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:52, David Malcolm wrote:
> gcc/
> * sched-deps.c (sched_get_condition_with_rev_uncached): Strengthen
> param "insn" from const_rtx to const rtx_insn *.
> (sched_get_reverse_condition_uncached): Likewise.
> (sched_get_condition_with_rev): Likewise.
> (sched_has_condition_p): Likewise.
> (sched_insns_conditions_mutex_p): Likewise for both params.
> (sched_insn_is_legitimate_for_speculation_p): Likewise for param
> "insn"; conver use of CONST_CAST_RTX to CONST_CAST_RTX_INSN.
> (setup_insn_reg_uses): Move local "list" to be more tightly
> scoped, strengthening it from an rtx to an rtx_insn_list *. Use
> its methods for clarity and type-safety.
> (sched_analyze_1): Strengthen local "pending" from rtx to
> rtx_insn_list *, and local "pending_mem" from rtx to
> rtx_expr_list *. Use methods of each for clarity and type-safety.
> (sched_analyze_2): Likewise.
> (sched_analyze_insn): Likewise.
>
> * sched-int.h (sched_get_reverse_condition_uncached): Strengthen
> param from const_rtx to const rtx_insn *.
> (sched_insns_conditions_mutex_p): Likewise for both params.
> (sched_insn_is_legitimate_for_speculation_p): Likewise for first
> param.
>
> * system.h (CONST_CAST_RTX_INSN): New macro.
OK.
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (6 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:27 ` Jeff Law
2014-09-05 1:47 ` [PATCH 09/10] Simplification within reorg.c David Malcolm
2014-09-05 1:47 ` [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates David Malcolm
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* except.c (for_each_eh_label): Within param "callback",
strengthen param from rtx to rtx_code_label *. Strengthen local
"lab" from rtx to rtx_code_label *. Remove redundant check on
LABEL_P (lab), since this is known from the type rtx_code_label *.
* except.h (for_each_eh_label): Within param "callback",
strengthen param from rtx to rtx_code_label *.
* reload1.c (set_initial_eh_label_offset): Strengthen param
"label" from rtx to rtx_code_label *.
---
gcc/except.c | 6 +++---
gcc/except.h | 2 +-
gcc/reload1.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/except.c b/gcc/except.c
index fecc060..55941a0 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1629,7 +1629,7 @@ remove_unreachable_eh_regions (sbitmap r_reachable)
Only used by reload hackery; should not be used by new code. */
void
-for_each_eh_label (void (*callback) (rtx))
+for_each_eh_label (void (*callback) (rtx_code_label *))
{
eh_landing_pad lp;
int i;
@@ -1638,8 +1638,8 @@ for_each_eh_label (void (*callback) (rtx))
{
if (lp)
{
- rtx lab = lp->landing_pad;
- if (lab && LABEL_P (lab))
+ rtx_code_label *lab = lp->landing_pad;
+ if (lab)
(*callback) (lab);
}
}
diff --git a/gcc/except.h b/gcc/except.h
index 3259151..f47f996 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -223,7 +223,7 @@ struct GTY(()) eh_status
/* Invokes CALLBACK for every exception handler label. Only used by old
loop hackery; should not be used by new code. */
-extern void for_each_eh_label (void (*) (rtx));
+extern void for_each_eh_label (void (*) (rtx_code_label *));
extern void init_eh_for_function (void);
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c18ee67..fff6d1f 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3894,7 +3894,7 @@ set_initial_elim_offsets (void)
/* Subroutine of set_initial_label_offsets called via for_each_eh_label. */
static void
-set_initial_eh_label_offset (rtx label)
+set_initial_eh_label_offset (rtx_code_label *label)
{
set_label_offsets (label, NULL, 1);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label
2014-09-05 1:47 ` [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label David Malcolm
@ 2014-09-05 2:27 ` Jeff Law
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:27 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:52, David Malcolm wrote:
> gcc/
> * except.c (for_each_eh_label): Within param "callback",
> strengthen param from rtx to rtx_code_label *. Strengthen local
> "lab" from rtx to rtx_code_label *. Remove redundant check on
> LABEL_P (lab), since this is known from the type rtx_code_label *.
> * except.h (for_each_eh_label): Within param "callback",
> strengthen param from rtx to rtx_code_label *.
> * reload1.c (set_initial_eh_label_offset): Strengthen param
> "label" from rtx to rtx_code_label *.
OK.
> {
> - rtx lab = lp->landing_pad;
> - if (lab && LABEL_P (lab))
> + rtx_code_label *lab = lp->landing_pad;
> + if (lab)
Though I do wonder what in the world LAB could be here other than a
label... Maybe someone was just being paranoid. If anything were to
show up here other than a label, I'd call that a bug. Though presumably
that can't happen now without someone playing games with a cast :-)
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 09/10] Simplification within reorg.c
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (7 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:32 ` Jeff Law
2014-09-05 1:47 ` [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates David Malcolm
9 siblings, 1 reply; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* reorg.c (relax_delay_slots): Move declaration of "trial_seq"
above the conditional, and convert the check on GET_CODE to a
dyn_cast, so that "trial_seq" is available as an rtx_sequence * in
the conditional. Simplify the conditional by using methods of
"trial_seq".
---
gcc/reorg.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 89d500d..7bacc6d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3385,13 +3385,14 @@ relax_delay_slots (rtx_insn *first)
/* Similarly, if it is an unconditional jump with one insn in its
delay list and that insn is redundant, thread the jump. */
- if (trial && GET_CODE (PATTERN (trial)) == SEQUENCE
- && XVECLEN (PATTERN (trial), 0) == 2
- && JUMP_P (XVECEXP (PATTERN (trial), 0, 0))
- && simplejump_or_return_p (XVECEXP (PATTERN (trial), 0, 0))
- && redundant_insn (XVECEXP (PATTERN (trial), 0, 1), insn, 0))
+ rtx_sequence *trial_seq =
+ trial ? dyn_cast <rtx_sequence *> (PATTERN (trial)) : NULL;
+ if (trial_seq
+ && trial_seq->len () == 2
+ && JUMP_P (trial_seq->insn (0))
+ && simplejump_or_return_p (trial_seq->insn (0))
+ && redundant_insn (trial_seq->insn (1), insn, 0))
{
- rtx_sequence *trial_seq = as_a <rtx_sequence *> (PATTERN (trial));
target_label = JUMP_LABEL (trial_seq->insn (0));
if (ANY_RETURN_P (target_label))
target_label = find_end_label (target_label);
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates
2014-09-05 1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
` (8 preceding siblings ...)
2014-09-05 1:47 ` [PATCH 09/10] Simplification within reorg.c David Malcolm
@ 2014-09-05 1:47 ` David Malcolm
2014-09-05 2:34 ` Jeff Law
2014-09-05 13:03 ` Richard Sandiford
9 siblings, 2 replies; 23+ messages in thread
From: David Malcolm @ 2014-09-05 1:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/
* config/arc/arc.c (arc_print_operand): Use insn method of
final_sequence for type-safety.
* config/bfin/bfin.c (bfin_hardware_loop): Strengthen param
"insn" from rtx to rtx_insn *.
* config/frv/frv.c (frv_print_operand_jump_hint): Likewise.
* config/mn10300/mn10300.c (mn10300_scan_for_setlb_lcc):
Likewise for locals "branch", "label".
* config/h8300/h8300.c (same_cmp_preceding_p): Likewise for
locals "i1", "i2". Use NULL rather than NULL_RTX in comparisons.
(same_cmp_following_p): Likewise for locals "i2", "i3".
* config/sh/sh.c (gen_far_branch): Likewise for local "insn".
* config/sh/sh_optimize_sett_clrt.cc
(sh_optimize_sett_clrt::sh_cbranch_ccreg_value): Likewise for
param "cbranch_insn".
* function.c (convert_jumps_to_returns): Likewis for local "jump".
* ifcvt.c (cond_exec_get_condition): Likewise for param "jump".
* jump.c (simplejump_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(condjump_p): Likewise.
(condjump_in_parallel_p): Likewise.
(pc_set): Likewise.
(any_uncondjump_p): Likewise.
(any_condjump_p): Likewise.
(condjump_label): Likewise.
(returnjump_p): Strengthen param "insn" from rtx to
const rtx_insn *.
(onlyjump_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(jump_to_label_p): Likewise.
(invert_jump_1): Strengthen param "jump" from rtx to rtx_insn *.
(invert_jump): Likewise.
* reorg.c (simplejump_or_return_p): Add checked cast when calling
simplejump_p.
(get_jump_flags): Strengthen param "insn" from rtx to
const rtx_insn *.
(get_branch_condition): Likewise.
(condition_dominates_p): Likewise.
(make_return_insns): Move declaration of local "pat" earlier, to
after we've handled NONJUMP_INSN_P and non-sequences, using its
methods to simplify the code and for type-safety.
* rtl.h (find_constant_src): Strengthen param from const_rtx to
const rtx_insn *.
(jump_to_label_p): Strengthen param from rtx to const rtx_insn *.
(condjump_p): Strengthen param from const_rtx to
const rtx_insn *.
(any_condjump_p): Likewise.
(any_uncondjump_p): Likewise.
(pc_set): Likewise.
(condjump_label): Likewise.
(simplejump_p): Likewise.
(returnjump_p): Likewise.
(onlyjump_p): Likewise.
(invert_jump_1): Strengthen param 1 from rtx to rtx_insn *.
(invert_jump): Likewise.
(condjump_in_parallel_p): Strengthen param from const_rtx to
const rtx_insn *.
* rtlanal.c (find_constant_src): Strengthen param from const_rtx
to const rtx_insn *.
* sel-sched-ir.c (fallthru_bb_of_jump): Strengthen param from rtx
to const rtx_insn *.
* sel-sched-ir.h (fallthru_bb_of_jump): Likewise.
---
gcc/config/arc/arc.c | 4 ++--
gcc/config/bfin/bfin.c | 2 +-
gcc/config/frv/frv.c | 4 ++--
gcc/config/h8300/h8300.c | 12 ++++++------
gcc/config/mn10300/mn10300.c | 4 ++--
gcc/config/sh/sh_optimize_sett_clrt.cc | 4 ++--
gcc/function.c | 2 +-
gcc/ifcvt.c | 4 ++--
gcc/jump.c | 24 ++++++++++++------------
gcc/reorg.c | 33 +++++++++++++++++++--------------
gcc/rtl.h | 26 +++++++++++++-------------
gcc/rtlanal.c | 2 +-
gcc/sel-sched-ir.c | 2 +-
gcc/sel-sched-ir.h | 2 +-
14 files changed, 65 insertions(+), 60 deletions(-)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 7cddab7..57eb83b 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -2849,8 +2849,8 @@ arc_print_operand (FILE *file, rtx x, int code)
/* Is this insn in a delay slot sequence? */
if (!final_sequence || XVECLEN (final_sequence, 0) < 2
|| current_insn_predicate
- || CALL_P (XVECEXP (final_sequence, 0, 0))
- || simplejump_p (XVECEXP (final_sequence, 0, 0)))
+ || CALL_P (final_sequence->insn (0))
+ || simplejump_p (final_sequence-> insn (0)))
{
/* This insn isn't in a delay slot sequence, or conditionalized
independently of its position in a delay slot. */
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index f92b6d1..03470da 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3411,7 +3411,7 @@ bfin_hardware_loop (void)
/* Estimate the length of INSN conservatively. */
static int
-length_for_loop (rtx insn)
+length_for_loop (rtx_insn *insn)
{
int length = 0;
if (JUMP_P (insn) && any_condjump_p (insn) && !optimize_size)
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index a9e574c..2f83962 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -271,7 +271,7 @@ static bool frv_print_operand_punct_valid_p (unsigned char code);
static void frv_print_operand_memory_reference_reg
(FILE *, rtx);
static void frv_print_operand_memory_reference (FILE *, rtx, int);
-static int frv_print_operand_jump_hint (rtx);
+static int frv_print_operand_jump_hint (rtx_insn *);
static const char *comparison_string (enum rtx_code, rtx);
static rtx frv_function_value (const_tree, const_tree,
bool);
@@ -2623,7 +2623,7 @@ frv_print_operand_memory_reference (FILE * stream, rtx x, int addr_offset)
#define FRV_JUMP_NOT_LIKELY 0
static int
-frv_print_operand_jump_hint (rtx insn)
+frv_print_operand_jump_hint (rtx_insn *insn)
{
rtx note;
rtx labelref;
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 45e469c..e521f3b 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -5718,14 +5718,14 @@ byte_accesses_mergeable_p (rtx addr1, rtx addr2)
int
same_cmp_preceding_p (rtx i3)
{
- rtx i1, i2;
+ rtx_insn *i1, *i2;
/* Make sure we have a sequence of three insns. */
i2 = prev_nonnote_insn (i3);
- if (i2 == NULL_RTX)
+ if (i2 == NULL)
return 0;
i1 = prev_nonnote_insn (i2);
- if (i1 == NULL_RTX)
+ if (i1 == NULL)
return 0;
return (INSN_P (i1) && rtx_equal_p (PATTERN (i1), PATTERN (i3))
@@ -5738,14 +5738,14 @@ same_cmp_preceding_p (rtx i3)
int
same_cmp_following_p (rtx i1)
{
- rtx i2, i3;
+ rtx_insn *i2, *i3;
/* Make sure we have a sequence of three insns. */
i2 = next_nonnote_insn (i1);
- if (i2 == NULL_RTX)
+ if (i2 == NULL)
return 0;
i3 = next_nonnote_insn (i2);
- if (i3 == NULL_RTX)
+ if (i3 == NULL)
return 0;
return (INSN_P (i3) && rtx_equal_p (PATTERN (i1), PATTERN (i3))
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index c4d74c1..07cae5c 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -3274,7 +3274,7 @@ mn10300_scan_for_setlb_lcc (void)
reason = "it contains CALL insns";
else
{
- rtx branch = BB_END (loop->latch);
+ rtx_insn *branch = BB_END (loop->latch);
gcc_assert (JUMP_P (branch));
if (single_set (branch) == NULL_RTX || ! any_condjump_p (branch))
@@ -3283,7 +3283,7 @@ mn10300_scan_for_setlb_lcc (void)
reason = "it is not a simple loop";
else
{
- rtx label;
+ rtx_insn *label;
if (dump_file)
flow_loop_dump (loop, dump_file, NULL, 0);
diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
index f173cac..c39df3f 100644
--- a/gcc/config/sh/sh_optimize_sett_clrt.cc
+++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
@@ -118,7 +118,7 @@ private:
// Given a cbranch insn, its basic block and another basic block, determine
// the value to which the ccreg will be set after jumping/falling through to
// the specified target basic block.
- bool sh_cbranch_ccreg_value (rtx cbranch_insn,
+ bool sh_cbranch_ccreg_value (rtx_insn *cbranch_insn,
basic_block cbranch_insn_bb,
basic_block branch_target_bb) const;
@@ -276,7 +276,7 @@ sh_optimize_sett_clrt::const_setcc_value (rtx pat) const
bool
sh_optimize_sett_clrt
-::sh_cbranch_ccreg_value (rtx cbranch_insn, basic_block cbranch_insn_bb,
+::sh_cbranch_ccreg_value (rtx_insn *cbranch_insn, basic_block cbranch_insn_bb,
basic_block branch_target_bb) const
{
rtx pc_set_rtx = pc_set (cbranch_insn);
diff --git a/gcc/function.c b/gcc/function.c
index 8b125ae..c8daf95 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5460,7 +5460,7 @@ convert_jumps_to_returns (basic_block last_bb, bool simple_p,
FOR_EACH_VEC_ELT (src_bbs, i, bb)
{
- rtx jump = BB_END (bb);
+ rtx_insn *jump = BB_END (bb);
if (!JUMP_P (jump) || JUMP_LABEL (jump) != label)
continue;
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 3742759..eee04cc 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -92,7 +92,7 @@ static rtx_insn *find_active_insn_after (basic_block, rtx_insn *);
static basic_block block_fallthru (basic_block);
static int cond_exec_process_insns (ce_if_block *, rtx_insn *, rtx, rtx, int,
int);
-static rtx cond_exec_get_condition (rtx);
+static rtx cond_exec_get_condition (rtx_insn *);
static rtx noce_get_condition (rtx_insn *, rtx_insn **, bool);
static int noce_operand_ok (const_rtx);
static void merge_if_block (ce_if_block *);
@@ -429,7 +429,7 @@ cond_exec_process_insns (ce_if_block *ce_info ATTRIBUTE_UNUSED,
/* Return the condition for a jump. Do not do any special processing. */
static rtx
-cond_exec_get_condition (rtx jump)
+cond_exec_get_condition (rtx_insn *jump)
{
rtx test_if, cond;
diff --git a/gcc/jump.c b/gcc/jump.c
index 84040da..ef2f9e5 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -766,7 +766,7 @@ comparison_dominates_p (enum rtx_code code1, enum rtx_code code2)
/* Return 1 if INSN is an unconditional jump and nothing else. */
int
-simplejump_p (const_rtx insn)
+simplejump_p (const rtx_insn *insn)
{
return (JUMP_P (insn)
&& GET_CODE (PATTERN (insn)) == SET
@@ -781,7 +781,7 @@ simplejump_p (const_rtx insn)
branch and compare insns. Use any_condjump_p instead whenever possible. */
int
-condjump_p (const_rtx insn)
+condjump_p (const rtx_insn *insn)
{
const_rtx x = PATTERN (insn);
@@ -809,7 +809,7 @@ condjump_p (const_rtx insn)
branch and compare insns. Use any_condjump_p instead whenever possible. */
int
-condjump_in_parallel_p (const_rtx insn)
+condjump_in_parallel_p (const rtx_insn *insn)
{
const_rtx x = PATTERN (insn);
@@ -840,7 +840,7 @@ condjump_in_parallel_p (const_rtx insn)
/* Return set of PC, otherwise NULL. */
rtx
-pc_set (const_rtx insn)
+pc_set (const rtx_insn *insn)
{
rtx pat;
if (!JUMP_P (insn))
@@ -861,7 +861,7 @@ pc_set (const_rtx insn)
possibly bundled inside a PARALLEL. */
int
-any_uncondjump_p (const_rtx insn)
+any_uncondjump_p (const rtx_insn *insn)
{
const_rtx x = pc_set (insn);
if (!x)
@@ -881,7 +881,7 @@ any_uncondjump_p (const_rtx insn)
Note that unlike condjump_p it returns false for unconditional jumps. */
int
-any_condjump_p (const_rtx insn)
+any_condjump_p (const rtx_insn *insn)
{
const_rtx x = pc_set (insn);
enum rtx_code a, b;
@@ -902,7 +902,7 @@ any_condjump_p (const_rtx insn)
/* Return the label of a conditional jump. */
rtx
-condjump_label (const_rtx insn)
+condjump_label (const rtx_insn *insn)
{
rtx x = pc_set (insn);
@@ -923,7 +923,7 @@ condjump_label (const_rtx insn)
/* Return TRUE if INSN is a return jump. */
int
-returnjump_p (rtx insn)
+returnjump_p (const rtx_insn *insn)
{
if (JUMP_P (insn))
{
@@ -970,7 +970,7 @@ eh_returnjump_p (rtx_insn *insn)
nothing more. */
int
-onlyjump_p (const_rtx insn)
+onlyjump_p (const rtx_insn *insn)
{
rtx set;
@@ -991,7 +991,7 @@ onlyjump_p (const_rtx insn)
/* Return true iff INSN is a jump and its JUMP_LABEL is a label, not
NULL or a return. */
bool
-jump_to_label_p (rtx insn)
+jump_to_label_p (const rtx_insn *insn)
{
return (JUMP_P (insn)
&& JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
@@ -1656,7 +1656,7 @@ invert_exp_1 (rtx x, rtx insn)
inversion and redirection. */
int
-invert_jump_1 (rtx jump, rtx nlabel)
+invert_jump_1 (rtx_insn *jump, rtx nlabel)
{
rtx x = pc_set (jump);
int ochanges;
@@ -1680,7 +1680,7 @@ invert_jump_1 (rtx jump, rtx nlabel)
NLABEL instead of where it jumps now. Return true if successful. */
int
-invert_jump (rtx jump, rtx nlabel, int delete_unused)
+invert_jump (rtx_insn *jump, rtx nlabel, int delete_unused)
{
rtx olabel = JUMP_LABEL (jump);
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 7bacc6d..400a20f 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -217,10 +217,10 @@ static void note_delay_statistics (int, int);
#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
static rtx_insn_list *optimize_skip (rtx_insn *);
#endif
-static int get_jump_flags (rtx, rtx);
+static int get_jump_flags (const rtx_insn *, rtx);
static int mostly_true_jump (rtx);
-static rtx get_branch_condition (rtx, rtx);
-static int condition_dominates_p (rtx, rtx);
+static rtx get_branch_condition (const rtx_insn *, rtx);
+static int condition_dominates_p (rtx, const rtx_insn *);
static int redirect_with_delay_slots_safe_p (rtx_insn *, rtx, rtx);
static int redirect_with_delay_list_safe_p (rtx_insn *, rtx, rtx_insn_list *);
static int check_annul_list_true_false (int, rtx);
@@ -272,7 +272,8 @@ static bool
simplejump_or_return_p (rtx insn)
{
return (JUMP_P (insn)
- && (simplejump_p (insn) || ANY_RETURN_P (PATTERN (insn))));
+ && (simplejump_p (as_a <rtx_insn *> (insn))
+ || ANY_RETURN_P (PATTERN (insn))));
}
\f
/* Return TRUE if this insn should stop the search for insn to fill delay
@@ -845,7 +846,7 @@ optimize_skip (rtx_insn *insn)
are predicted as very likely taken. */
static int
-get_jump_flags (rtx insn, rtx label)
+get_jump_flags (const rtx_insn *insn, rtx label)
{
int flags;
@@ -907,7 +908,7 @@ mostly_true_jump (rtx jump_insn)
type of jump, or it doesn't go to TARGET, return 0. */
static rtx
-get_branch_condition (rtx insn, rtx target)
+get_branch_condition (const rtx_insn *insn, rtx target)
{
rtx pat = PATTERN (insn);
rtx src;
@@ -953,7 +954,7 @@ get_branch_condition (rtx insn, rtx target)
INSN, i.e., if INSN will always branch if CONDITION is true. */
static int
-condition_dominates_p (rtx condition, rtx insn)
+condition_dominates_p (rtx condition, const rtx_insn *insn)
{
rtx other_condition = get_branch_condition (insn, JUMP_LABEL (insn));
enum rtx_code code = GET_CODE (condition);
@@ -3579,18 +3580,23 @@ make_return_insns (rtx_insn *first)
/* Only look at filled JUMP_INSNs that go to the end of function
label. */
- if (!NONJUMP_INSN_P (insn)
- || GET_CODE (PATTERN (insn)) != SEQUENCE
- || !jump_to_label_p (XVECEXP (PATTERN (insn), 0, 0)))
+ if (!NONJUMP_INSN_P (insn))
continue;
- if (JUMP_LABEL (XVECEXP (PATTERN (insn), 0, 0)) == function_return_label)
+ if (GET_CODE (PATTERN (insn)) != SEQUENCE)
+ continue;
+
+ rtx_sequence *pat = as_a <rtx_sequence *> (PATTERN (insn));
+
+ if (!jump_to_label_p (pat->insn (0)))
+ continue;
+
+ if (JUMP_LABEL (pat->insn (0)) == function_return_label)
{
kind = ret_rtx;
real_label = real_return_label;
}
- else if (JUMP_LABEL (XVECEXP (PATTERN (insn), 0, 0))
- == function_simple_return_label)
+ else if (JUMP_LABEL (pat->insn (0)) == function_simple_return_label)
{
kind = simple_return_rtx;
real_label = real_simple_return_label;
@@ -3598,7 +3604,6 @@ make_return_insns (rtx_insn *first)
else
continue;
- rtx_sequence *pat = as_a <rtx_sequence *> (PATTERN (insn));
jump_insn = pat->insn (0);
/* If we can't make the jump into a RETURN, try to redirect it to the best
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 7c5bd51..0a289ea 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2772,7 +2772,7 @@ extern int dead_or_set_regno_p (const_rtx, unsigned int);
extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
extern rtx find_reg_equal_equiv_note (const_rtx);
-extern rtx find_constant_src (const_rtx);
+extern rtx find_constant_src (const rtx_insn *);
extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
@@ -3232,20 +3232,20 @@ extern bool check_for_inc_dec (rtx_insn *insn);
/* In jump.c */
extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
-extern bool jump_to_label_p (rtx);
-extern int condjump_p (const_rtx);
-extern int any_condjump_p (const_rtx);
-extern int any_uncondjump_p (const_rtx);
-extern rtx pc_set (const_rtx);
-extern rtx condjump_label (const_rtx);
-extern int simplejump_p (const_rtx);
-extern int returnjump_p (rtx);
+extern bool jump_to_label_p (const rtx_insn *);
+extern int condjump_p (const rtx_insn *);
+extern int any_condjump_p (const rtx_insn *);
+extern int any_uncondjump_p (const rtx_insn *);
+extern rtx pc_set (const rtx_insn *);
+extern rtx condjump_label (const rtx_insn *);
+extern int simplejump_p (const rtx_insn *);
+extern int returnjump_p (const rtx_insn *);
extern int eh_returnjump_p (rtx_insn *);
-extern int onlyjump_p (const_rtx);
+extern int onlyjump_p (const rtx_insn *);
extern int only_sets_cc0_p (const_rtx);
extern int sets_cc0_p (const_rtx);
-extern int invert_jump_1 (rtx, rtx);
-extern int invert_jump (rtx, rtx, int);
+extern int invert_jump_1 (rtx_insn *, rtx);
+extern int invert_jump (rtx_insn *, rtx, int);
extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
extern int true_regnum (const_rtx);
extern unsigned int reg_or_subregno (const_rtx);
@@ -3259,7 +3259,7 @@ extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
const_rtx, const_rtx);
extern void delete_for_peephole (rtx_insn *, rtx_insn *);
-extern int condjump_in_parallel_p (const_rtx);
+extern int condjump_in_parallel_p (const rtx_insn *);
/* In emit-rtl.c. */
extern int max_reg_num (void);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 7dc1eeb..3fe2cd4 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1918,7 +1918,7 @@ find_reg_equal_equiv_note (const_rtx insn)
return null. */
rtx
-find_constant_src (const_rtx insn)
+find_constant_src (const rtx_insn *insn)
{
rtx note, set, x;
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 02dc8f2..053fe14 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4605,7 +4605,7 @@ in_current_region_p (basic_block bb)
/* Return the block which is a fallthru bb of a conditional jump JUMP. */
basic_block
-fallthru_bb_of_jump (rtx jump)
+fallthru_bb_of_jump (const rtx_insn *jump)
{
if (!JUMP_P (jump))
return NULL;
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 9ac9e5b..90e7283 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1619,7 +1619,7 @@ extern bool sel_bb_end_p (insn_t);
extern bool sel_bb_empty_p (basic_block);
extern bool in_current_region_p (basic_block);
-extern basic_block fallthru_bb_of_jump (rtx);
+extern basic_block fallthru_bb_of_jump (const rtx_insn *);
extern void sel_init_bbs (bb_vec_t);
extern void sel_finish_bbs (void);
--
1.8.5.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates
2014-09-05 1:47 ` [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates David Malcolm
@ 2014-09-05 2:34 ` Jeff Law
2014-09-05 13:03 ` Richard Sandiford
1 sibling, 0 replies; 23+ messages in thread
From: Jeff Law @ 2014-09-05 2:34 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 09/04/14 19:52, David Malcolm wrote:
> gcc/
> * config/arc/arc.c (arc_print_operand): Use insn method of
> final_sequence for type-safety.
> * config/bfin/bfin.c (bfin_hardware_loop): Strengthen param
> "insn" from rtx to rtx_insn *.
> * config/frv/frv.c (frv_print_operand_jump_hint): Likewise.
> * config/mn10300/mn10300.c (mn10300_scan_for_setlb_lcc):
> Likewise for locals "branch", "label".
> * config/h8300/h8300.c (same_cmp_preceding_p): Likewise for
> locals "i1", "i2". Use NULL rather than NULL_RTX in comparisons.
> (same_cmp_following_p): Likewise for locals "i2", "i3".
> * config/sh/sh.c (gen_far_branch): Likewise for local "insn".
> * config/sh/sh_optimize_sett_clrt.cc
> (sh_optimize_sett_clrt::sh_cbranch_ccreg_value): Likewise for
> param "cbranch_insn".
> * function.c (convert_jumps_to_returns): Likewis for local "jump".
> * ifcvt.c (cond_exec_get_condition): Likewise for param "jump".
> * jump.c (simplejump_p): Strengthen param "insn" from const_rtx to
> const rtx_insn *.
> (condjump_p): Likewise.
> (condjump_in_parallel_p): Likewise.
> (pc_set): Likewise.
> (any_uncondjump_p): Likewise.
> (any_condjump_p): Likewise.
> (condjump_label): Likewise.
> (returnjump_p): Strengthen param "insn" from rtx to
> const rtx_insn *.
> (onlyjump_p): Strengthen param "insn" from const_rtx to
> const rtx_insn *.
> (jump_to_label_p): Likewise.
> (invert_jump_1): Strengthen param "jump" from rtx to rtx_insn *.
> (invert_jump): Likewise.
> * reorg.c (simplejump_or_return_p): Add checked cast when calling
> simplejump_p.
> (get_jump_flags): Strengthen param "insn" from rtx to
> const rtx_insn *.
> (get_branch_condition): Likewise.
> (condition_dominates_p): Likewise.
> (make_return_insns): Move declaration of local "pat" earlier, to
> after we've handled NONJUMP_INSN_P and non-sequences, using its
> methods to simplify the code and for type-safety.
> * rtl.h (find_constant_src): Strengthen param from const_rtx to
> const rtx_insn *.
> (jump_to_label_p): Strengthen param from rtx to const rtx_insn *.
> (condjump_p): Strengthen param from const_rtx to
> const rtx_insn *.
> (any_condjump_p): Likewise.
> (any_uncondjump_p): Likewise.
> (pc_set): Likewise.
> (condjump_label): Likewise.
> (simplejump_p): Likewise.
> (returnjump_p): Likewise.
> (onlyjump_p): Likewise.
> (invert_jump_1): Strengthen param 1 from rtx to rtx_insn *.
> (invert_jump): Likewise.
> (condjump_in_parallel_p): Strengthen param from const_rtx to
> const rtx_insn *.
> * rtlanal.c (find_constant_src): Strengthen param from const_rtx
> to const rtx_insn *.
> * sel-sched-ir.c (fallthru_bb_of_jump): Strengthen param from rtx
> to const rtx_insn *.
> * sel-sched-ir.h (fallthru_bb_of_jump): Likewise.
OK.
Jeff
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates
2014-09-05 1:47 ` [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates David Malcolm
2014-09-05 2:34 ` Jeff Law
@ 2014-09-05 13:03 ` Richard Sandiford
2014-09-05 15:16 ` David Malcolm
1 sibling, 1 reply; 23+ messages in thread
From: Richard Sandiford @ 2014-09-05 13:03 UTC (permalink / raw)
To: David Malcolm; +Cc: gcc-patches
David Malcolm <dmalcolm@redhat.com> writes:
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 7cddab7..57eb83b 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -2849,8 +2849,8 @@ arc_print_operand (FILE *file, rtx x, int code)
> /* Is this insn in a delay slot sequence? */
> if (!final_sequence || XVECLEN (final_sequence, 0) < 2
> || current_insn_predicate
> - || CALL_P (XVECEXP (final_sequence, 0, 0))
> - || simplejump_p (XVECEXP (final_sequence, 0, 0)))
> + || CALL_P (final_sequence->insn (0))
> + || simplejump_p (final_sequence-> insn (0)))
> {
> /* This insn isn't in a delay slot sequence, or conditionalized
> independently of its position in a delay slot. */
Sorry for the nit, but: stray space after "->".
Thanks,
Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates
2014-09-05 13:03 ` Richard Sandiford
@ 2014-09-05 15:16 ` David Malcolm
0 siblings, 0 replies; 23+ messages in thread
From: David Malcolm @ 2014-09-05 15:16 UTC (permalink / raw)
To: Richard Sandiford; +Cc: gcc-patches
On Fri, 2014-09-05 at 14:03 +0100, Richard Sandiford wrote:
> David Malcolm <dmalcolm@redhat.com> writes:
> > diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> > index 7cddab7..57eb83b 100644
> > --- a/gcc/config/arc/arc.c
> > +++ b/gcc/config/arc/arc.c
> > @@ -2849,8 +2849,8 @@ arc_print_operand (FILE *file, rtx x, int code)
> > /* Is this insn in a delay slot sequence? */
> > if (!final_sequence || XVECLEN (final_sequence, 0) < 2
> > || current_insn_predicate
> > - || CALL_P (XVECEXP (final_sequence, 0, 0))
> > - || simplejump_p (XVECEXP (final_sequence, 0, 0)))
> > + || CALL_P (final_sequence->insn (0))
> > + || simplejump_p (final_sequence-> insn (0)))
> > {
> > /* This insn isn't in a delay slot sequence, or conditionalized
> > independently of its position in a delay slot. */
>
> Sorry for the nit, but: stray space after "->".
Thanks; I fixed this before committing (r214970).
^ permalink raw reply [flat|nested] 23+ messages in thread