* [PATCH 1/2] use rtx_insn * more
@ 2014-09-11 22:49 tsaunders
2014-09-11 22:50 ` [PATCH 2/2] add static typed insn_deleted_p tsaunders
2014-09-12 21:20 ` [PATCH 1/2] use rtx_insn * more Jeff Law
0 siblings, 2 replies; 8+ messages in thread
From: tsaunders @ 2014-09-11 22:49 UTC (permalink / raw)
To: gcc-patches; +Cc: Trevor Saunders
From: Trevor Saunders <tsaunders@mozilla.com>
Hi,
pretty trivial, but not quiet just changing the types of variables.
bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
config-list.mk with a couple other patches. ok?
Trev
gcc/ChangeLog:
2014-09-11 Trevor Saunders <tsaunders@mozilla.com>
* config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Assign the
result of emit_jump_insn_before to a new variable.
* jump.c (mark_jump_label): Change the type of insn to rtx_insn *.
(mark_jump_label_1): Likewise.
(mark_jump_label_asm): Likewise.
* reload1.c (gen_reload): Change type of tem to rtx_insn *.
* rtl.h (mark_jump_label): Adjust.
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 07cae5c..6296292 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -3200,11 +3200,11 @@ mn10300_insert_setlb_lcc (rtx label, rtx branch)
else
lcc = gen_Lcc (comparison, label);
- lcc = emit_jump_insn_before (lcc, branch);
- mark_jump_label (XVECEXP (PATTERN (lcc), 0, 0), lcc, 0);
- JUMP_LABEL (lcc) = label;
+ rtx_insn *jump = emit_jump_insn_before (lcc, branch);
+ mark_jump_label (XVECEXP (PATTERN (lcc), 0, 0), jump, 0);
+ JUMP_LABEL (jump) = label;
DUMP ("Replacing branch insn...", branch);
- DUMP ("... with Lcc insn:", lcc);
+ DUMP ("... with Lcc insn:", jump);
delete_insn (branch);
}
diff --git a/gcc/jump.c b/gcc/jump.c
index ef2f9e5..fc3f683 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -65,8 +65,8 @@ along with GCC; see the file COPYING3. If not see
static void init_label_info (rtx_insn *);
static void mark_all_labels (rtx_insn *);
-static void mark_jump_label_1 (rtx, rtx, bool, bool);
-static void mark_jump_label_asm (rtx, rtx);
+static void mark_jump_label_1 (rtx, rtx_insn *, bool, bool);
+static void mark_jump_label_asm (rtx, rtx_insn *);
static void redirect_exp_1 (rtx *, rtx, rtx, rtx);
static int invert_exp_1 (rtx, rtx);
\f
@@ -1066,7 +1066,7 @@ sets_cc0_p (const_rtx x)
that loop-optimization is done with. */
void
-mark_jump_label (rtx x, rtx insn, int in_mem)
+mark_jump_label (rtx x, rtx_insn *insn, int in_mem)
{
rtx asmop = extract_asm_operands (x);
if (asmop)
@@ -1083,7 +1083,7 @@ mark_jump_label (rtx x, rtx insn, int in_mem)
note. */
static void
-mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
+mark_jump_label_1 (rtx x, rtx_insn *insn, bool in_mem, bool is_target)
{
RTX_CODE code = GET_CODE (x);
int i;
@@ -1192,7 +1192,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
int eltnum = code == ADDR_DIFF_VEC ? 1 : 0;
for (i = 0; i < XVECLEN (x, eltnum); i++)
- mark_jump_label_1 (XVECEXP (x, eltnum, i), NULL_RTX, in_mem,
+ mark_jump_label_1 (XVECEXP (x, eltnum, i), NULL, in_mem,
is_target);
}
return;
@@ -1227,7 +1227,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
need to be considered targets. */
static void
-mark_jump_label_asm (rtx asmop, rtx insn)
+mark_jump_label_asm (rtx asmop, rtx_insn *insn)
{
int i;
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c18ee67..02a30f7 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8594,7 +8594,7 @@ static rtx_insn *
gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
{
rtx_insn *last = get_last_insn ();
- rtx tem;
+ rtx_insn *tem;
#ifdef SECONDARY_MEMORY_NEEDED
rtx tem1, tem2;
#endif
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ddf89b0..0173fe4 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2656,7 +2656,7 @@ extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
extern enum rtx_code swap_condition (enum rtx_code);
extern enum rtx_code unsigned_condition (enum rtx_code);
extern enum rtx_code signed_condition (enum rtx_code);
-extern void mark_jump_label (rtx, rtx, int);
+extern void mark_jump_label (rtx, rtx_insn *, int);
/* In jump.c */
extern rtx_insn *delete_related_insns (rtx);
--
2.1.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] add static typed insn_deleted_p
2014-09-11 22:49 [PATCH 1/2] use rtx_insn * more tsaunders
@ 2014-09-11 22:50 ` tsaunders
2014-09-12 0:09 ` David Malcolm
2014-09-12 21:22 ` Jeff Law
2014-09-12 21:20 ` [PATCH 1/2] use rtx_insn * more Jeff Law
1 sibling, 2 replies; 8+ messages in thread
From: tsaunders @ 2014-09-11 22:50 UTC (permalink / raw)
To: gcc-patches; +Cc: Trevor Saunders
From: Trevor Saunders <tsaunders@mozilla.com>
Hi,
This changes all callers of INSN_DELETED_P to use one of insn->deleted () insn->set_deleted () or insn->set_undeleted () depending on what they're doing (set_deleted / set_undeleted seem somewhat clearer to me than = 0 / 1).
bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
config-list.mk with a couple other patches. ok?
Trev
gcc/
* cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
macro with staticly checked member functions.
* rtl.h (rtx_insn::deleted): New method.
(rtx_insn::set_deleted): Likewise.
(rtx_insn::set_undeleted): Likewise.
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index bc6c965..49779fc 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -165,11 +165,11 @@ delete_insn (rtx uncast_insn)
if (really_delete)
{
/* If this insn has already been deleted, something is very wrong. */
- gcc_assert (!INSN_DELETED_P (insn));
+ gcc_assert (!insn->deleted ());
if (INSN_P (insn))
df_insn_delete (insn);
remove_insn (insn);
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted ();
}
/* If deleting a jump, decrement the use count of the label. Deleting
@@ -254,7 +254,7 @@ delete_insn_chain (rtx start, rtx finish, bool clear_bb)
else
delete_insn (current);
- if (clear_bb && !INSN_DELETED_P (current))
+ if (clear_bb && !current->deleted ())
set_block_for_insn (current, NULL);
if (current == start)
@@ -3278,7 +3278,7 @@ fixup_abnormal_edges (void)
if (GET_CODE (PATTERN (insn)) != USE)
{
/* We're not deleting it, we're moving it. */
- INSN_DELETED_P (insn) = 0;
+ insn->set_undeleted ();
SET_PREV_INSN (insn) = NULL_RTX;
SET_NEXT_INSN (insn) = NULL_RTX;
diff --git a/gcc/combine.c b/gcc/combine.c
index 60524b5..67fd5b1 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1238,7 +1238,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
continue;
while (last_combined_insn
- && INSN_DELETED_P (last_combined_insn))
+ && last_combined_insn->deleted ())
last_combined_insn = PREV_INSN (last_combined_insn);
if (last_combined_insn == NULL_RTX
|| BARRIER_P (last_combined_insn)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 1d7f3b8..a9f90eb 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -2819,10 +2819,10 @@ arc_print_operand (FILE *file, rtx x, int code)
if (final_sequence && XVECLEN (final_sequence, 0) != 1)
{
rtx jump = XVECEXP (final_sequence, 0, 0);
- rtx delay = XVECEXP (final_sequence, 0, 1);
+ rtx_insn *delay = final_sequence->insn (1);
/* For TARGET_PAD_RETURN we might have grabbed the delay insn. */
- if (INSN_DELETED_P (delay))
+ if (delay->deleted ())
return;
if (JUMP_P (jump) && INSN_ANNULLED_BRANCH_P (jump))
fputs (INSN_FROM_TARGET_P (delay) ? ".d"
@@ -3747,7 +3747,7 @@ arc_ccfsm_record_condition (rtx cond, bool reverse, rtx_insn *jump,
{
rtx insn = XVECEXP (PATTERN (seq_insn), 0, 1);
- if (!INSN_DELETED_P (insn)
+ if (!as_a<rtx_insn *> (insn)->deleted ()
&& INSN_ANNULLED_BRANCH_P (jump)
&& (TARGET_AT_DBR_CONDEXEC || INSN_FROM_TARGET_P (insn)))
{
@@ -8624,7 +8624,7 @@ arc_unalign_branch_p (rtx branch)
return 0;
/* Do not do this if we have a filled delay slot. */
if (get_attr_delay_slot_filled (branch) == DELAY_SLOT_FILLED_YES
- && !INSN_DELETED_P (NEXT_INSN (branch)))
+ && !NEXT_INSN (branch)->deleted ())
return 0;
note = find_reg_note (branch, REG_BR_PROB, 0);
return (!note
@@ -8705,7 +8705,7 @@ arc_pad_return (void)
rtx save_pred = current_insn_predicate;
final_scan_insn (prev, asm_out_file, optimize, 1, NULL);
cfun->machine->force_short_suffix = -1;
- INSN_DELETED_P (prev) = 1;
+ prev->set_deleted ();
current_output_insn = insn;
current_insn_predicate = save_pred;
}
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index cb10203..babb37b 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -2411,7 +2411,7 @@
final_sequence = 0;
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;
+ seq->insn (1)->set_deleted ();
return "";
}
}
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index aad0f1a..e2208b7 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -2536,7 +2536,7 @@ conditionalize_block (rtx_insn *first)
{
rtx_insn *newinsn;
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
/* Try to form a conditional variant of the instruction and emit it. */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index f9713c1..a7468ff 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -12498,7 +12498,7 @@ mips_output_conditional_branch (rtx_insn *insn, rtx *operands,
{
final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (final_sequence->insn (1)) = 1;
+ final_sequence->insn (1)->set_deleted ();
}
else
output_asm_insn ("nop", 0);
@@ -12523,7 +12523,7 @@ mips_output_conditional_branch (rtx_insn *insn, rtx *operands,
{
final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (final_sequence->insn (1)) = 1;
+ final_sequence->insn (1)->set_deleted ();
}
else
output_asm_insn ("nop", 0);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index fd91986..2861c2b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -34215,7 +34215,7 @@ replace_swap_with_copy (swap_web_entry *insn_entry, unsigned i)
df_insn_delete (insn);
remove_insn (insn);
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted ();
}
/* Dump the swap table to DUMP_FILE. */
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 3b4acb9..8d16e7a 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -2645,7 +2645,7 @@ print_slot (rtx_sequence *seq)
{
final_scan_insn (seq->insn (1), asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (seq->insn (1)) = 1;
+ seq->insn (1)->set_deleted ();
}
const char *
@@ -5572,7 +5572,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int need_block)
rtx dest;
/* First, check if we already have an instruction that satisfies our need. */
- if (prev && NONJUMP_INSN_P (prev) && ! INSN_DELETED_P (prev))
+ if (prev && NONJUMP_INSN_P (prev) && ! prev->deleted ())
{
if (INSN_CODE (prev) == CODE_FOR_indirect_jump_scratch)
return prev;
@@ -5615,7 +5615,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int need_block)
{
enum rtx_code code;
- if (INSN_DELETED_P (scan))
+ if (scan->deleted ())
continue;
code = GET_CODE (scan);
if (code == CODE_LABEL || code == JUMP_INSN)
@@ -5634,7 +5634,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int need_block)
{
enum rtx_code code;
- if (INSN_DELETED_P (scan))
+ if (scan->deleted ())
continue;
code = GET_CODE (scan);
if (INSN_P (scan))
@@ -6494,7 +6494,7 @@ split_branches (rtx_insn *first)
for (insn = first; insn; insn = NEXT_INSN (insn))
if (! INSN_P (insn))
continue;
- else if (INSN_DELETED_P (insn))
+ else if (insn->deleted ())
{
/* Shorten_branches would split this instruction again,
so transform it into a note. */
@@ -10702,7 +10702,7 @@ mark_constant_pool_use (rtx x)
}
for (rtx insn = LABEL_REFS (lab); insn; insn = LABEL_REFS (insn))
- INSN_DELETED_P (insn) = 1;
+ as_a<rtx_insn *> (insn)->set_deleted ();
/* Mark constants in a window. */
for (insn = NEXT_INSN (as_a <rtx_insn *> (x)); insn; insn = NEXT_INSN (insn))
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 0b2e3c5..71e4f17 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -792,10 +792,13 @@ v850_output_addr_const_extra (FILE * file, rtx x)
nothing, since the table will not be used.
(cf gcc.c-torture/compile/990801-1.c). */
if (GET_CODE (x) == MINUS
- && GET_CODE (XEXP (x, 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == CODE_LABEL
- && INSN_DELETED_P (XEXP (XEXP (x, 0), 0)))
- return true;
+ && GET_CODE (XEXP (x, 0)) == LABEL_REF)
+ {
+ rtx_code_label *label
+ = dyn_cast<rtx_code_label *> (XEXP (XEXP (x, 0), 0));
+ if (label && label->deleted ())
+ return true;
+ }
output_addr_const (file, x);
return true;
diff --git a/gcc/cprop.c b/gcc/cprop.c
index fa77faa..3711508 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1071,7 +1071,7 @@ retry:
print_rtl (dump_file, src);
fprintf (dump_file, "\n");
}
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return 1;
}
}
@@ -1257,7 +1257,7 @@ local_cprop_pass (void)
break;
}
}
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
break;
}
while (i < reg_use_count);
@@ -1854,7 +1854,7 @@ one_cprop_pass (void)
/* ??? Need to be careful w.r.t. mods done to INSN.
Don't call mark_oprs_set if we turned the
insn into a NOTE, or deleted the insn. */
- if (! NOTE_P (insn) && ! INSN_DELETED_P (insn))
+ if (! NOTE_P (insn) && ! insn->deleted ())
mark_oprs_set (insn);
}
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 23a80d8..571c816 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19051,7 +19051,7 @@ gen_label_die (tree decl, dw_die_ref context_die)
represent source-level labels which were explicitly declared by
the user. This really shouldn't be happening though, so catch
it if it ever does happen. */
- gcc_assert (!INSN_DELETED_P (insn));
+ gcc_assert (!as_a<rtx_insn *> (insn)->deleted ());
ASM_GENERATE_INTERNAL_LABEL (label, "L", CODE_LABEL_NUMBER (insn));
add_AT_lbl_id (lbl_die, DW_AT_low_pc, label);
@@ -21328,7 +21328,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
next_note = NEXT_INSN (loc_note);
if (! next_note
- || INSN_DELETED_P (next_note)
+ || next_note->deleted ()
|| ! NOTE_P (next_note)
|| (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
&& NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index e3df826..9a20e0e 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3796,7 +3796,7 @@ try_split (rtx pat, rtx uncast_trial, int last)
We can't use next_active_insn here since AFTER may be a note.
Ignore deleted insns, which can be occur if not optimizing. */
for (tem = NEXT_INSN (before); tem != after; tem = NEXT_INSN (tem))
- if (! INSN_DELETED_P (tem) && INSN_P (tem))
+ if (! tem->deleted () && INSN_P (tem))
tem = try_split (PATTERN (tem), tem, 1);
/* Return either the first or the last insn, depending on which was
@@ -3973,7 +3973,7 @@ add_insn_after_nobb (rtx_insn *insn, rtx_insn *after)
{
rtx_insn *next = NEXT_INSN (after);
- gcc_assert (!optimize || !INSN_DELETED_P (after));
+ gcc_assert (!optimize || !after->deleted ());
link_insn_into_chain (insn, after, next);
@@ -4002,7 +4002,7 @@ add_insn_before_nobb (rtx_insn *insn, rtx_insn *before)
{
rtx_insn *prev = PREV_INSN (before);
- gcc_assert (!optimize || !INSN_DELETED_P (before));
+ gcc_assert (!optimize || !before->deleted ());
link_insn_into_chain (insn, prev, before);
diff --git a/gcc/final.c b/gcc/final.c
index d9a887f..4e1fcec 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1133,7 +1133,7 @@ shorten_branches (rtx_insn *first)
if (NOTE_P (insn) || BARRIER_P (insn)
|| LABEL_P (insn) || DEBUG_INSN_P (insn))
continue;
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
body = PATTERN (insn);
@@ -2183,7 +2183,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
/* Ignore deleted insns. These can occur when we split insns (due to a
template of "#") while not optimizing. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return NEXT_INSN (insn);
switch (GET_CODE (insn))
diff --git a/gcc/function.c b/gcc/function.c
index c8daf95..26d25b9 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1933,7 +1933,7 @@ instantiate_virtual_regs (void)
else
instantiate_virtual_regs_in_insn (insn);
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
instantiate_virtual_regs_in_rtx (®_NOTES (insn));
diff --git a/gcc/gcse.c b/gcc/gcse.c
index ad92e25..8358072 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2486,7 +2486,7 @@ pre_insert_copies (void)
continue;
/* Don't handle this one if it's a redundant one. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
/* Or if the expression doesn't reach the deleted one. */
diff --git a/gcc/jump.c b/gcc/jump.c
index fc3f683..e601ca0 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -291,7 +291,7 @@ mark_all_labels (rtx_insn *f)
handled by other optimizers using better algorithms. */
FOR_BB_INSNS (bb, insn)
{
- gcc_assert (! INSN_DELETED_P (insn));
+ gcc_assert (! insn->deleted ());
if (NONDEBUG_INSN_P (insn))
mark_jump_label (PATTERN (insn), insn, 0);
}
@@ -312,7 +312,7 @@ mark_all_labels (rtx_insn *f)
rtx_insn *prev_nonjump_insn = NULL;
for (insn = f; insn; insn = NEXT_INSN (insn))
{
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
;
else if (LABEL_P (insn))
prev_nonjump_insn = NULL;
@@ -1156,7 +1156,7 @@ mark_jump_label_1 (rtx x, rtx_insn *insn, bool in_mem, bool is_target)
break;
XEXP (x, 0) = label;
- if (! insn || ! INSN_DELETED_P (insn))
+ if (! insn || ! insn->deleted ())
++LABEL_NUSES (label);
if (insn)
@@ -1187,7 +1187,7 @@ mark_jump_label_1 (rtx x, rtx_insn *insn, bool in_mem, bool is_target)
ADDR_DIFF_VEC. Don't set the JUMP_LABEL of a vector. */
case ADDR_VEC:
case ADDR_DIFF_VEC:
- if (! INSN_DELETED_P (insn))
+ if (! insn->deleted ())
{
int eltnum = code == ADDR_DIFF_VEC ? 1 : 0;
@@ -1254,11 +1254,11 @@ delete_related_insns (rtx uncast_insn)
rtx note;
rtx_insn *next = NEXT_INSN (insn), *prev = PREV_INSN (insn);
- while (next && INSN_DELETED_P (next))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
/* This insn is already deleted => return first following nondeleted. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return next;
delete_insn (insn);
@@ -1279,7 +1279,7 @@ delete_related_insns (rtx uncast_insn)
{
rtx_insn *p;
- for (p = next && INSN_DELETED_P (next) ? NEXT_INSN (next) : next;
+ for (p = next && next->deleted () ? NEXT_INSN (next) : next;
p && NOTE_P (p);
p = NEXT_INSN (p))
if (NOTE_KIND (p) == NOTE_INSN_CALL_ARG_LOCATION)
@@ -1323,7 +1323,7 @@ delete_related_insns (rtx uncast_insn)
for (i = 0; i < len; i++)
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))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
return next;
}
@@ -1339,7 +1339,7 @@ delete_related_insns (rtx uncast_insn)
if (LABEL_NUSES (XEXP (note, 0)) == 0)
delete_related_insns (XEXP (note, 0));
- while (prev && (INSN_DELETED_P (prev) || NOTE_P (prev)))
+ while (prev && (prev->deleted () || NOTE_P (prev)))
prev = PREV_INSN (prev);
/* If INSN was a label and a dispatch table follows it,
@@ -1362,7 +1362,7 @@ delete_related_insns (rtx uncast_insn)
if (code == NOTE)
next = NEXT_INSN (next);
/* Keep going past other deleted labels to delete what follows. */
- else if (code == CODE_LABEL && INSN_DELETED_P (next))
+ else if (code == CODE_LABEL && next->deleted ())
next = NEXT_INSN (next);
/* Keep the (use (insn))s created by dbr_schedule, which needs
them in order to track liveness relative to a previous
@@ -1386,7 +1386,7 @@ delete_related_insns (rtx uncast_insn)
but I see no clean and sure alternative way
to find the first insn after INSN that is not now deleted.
I hope this works. */
- while (next && INSN_DELETED_P (next))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
return next;
}
@@ -1408,7 +1408,7 @@ delete_for_peephole (rtx_insn *from, rtx_insn *to)
if (!NOTE_P (insn))
{
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted();
/* Patch this insn out of the chain. */
/* We don't do this all at once, because we
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index af8e3cd..8c0a5c8 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2341,7 +2341,7 @@ subst_stack_regs (rtx_insn *insn, stack_ptr regstack)
/* subst_stack_regs_pat may have deleted a no-op insn. If so, any
REG_UNUSED will already have been dealt with, so just return. */
- if (NOTE_P (insn) || INSN_DELETED_P (insn))
+ if (NOTE_P (insn) || insn->deleted ())
return control_flow_insn_deleted;
/* If this a noreturn call, we can't insert pop insns after it.
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 02a30f7..bd0118d 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8847,7 +8847,7 @@ delete_output_reload (rtx_insn *insn, int j, int last_reload_reg,
/* It is possible that this reload has been only used to set another reload
we eliminated earlier and thus deleted this instruction too. */
- if (INSN_DELETED_P (output_reload_insn))
+ if (output_reload_insn->deleted ())
return;
/* Get the raw pseudo-register referred to. */
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 400a20f..6243c51 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -536,7 +536,7 @@ emit_delay_sequence (rtx_insn *insn, rtx_insn_list *list, int length)
rtx note, next;
/* Show that this copy of the insn isn't deleted. */
- INSN_DELETED_P (tem) = 0;
+ tem->set_undeleted ();
/* Unlink insn from its original place, and re-emit it into
the sequence. */
@@ -1426,7 +1426,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
update_block (dtrial, thread);
new_rtx = delete_from_delay_slot (dtrial);
- if (INSN_DELETED_P (thread))
+ if (thread->deleted ())
thread = new_rtx;
INSN_FROM_TARGET_P (next_to_match) = 0;
}
@@ -1464,7 +1464,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
update_block (merged_insns->insn (), thread);
new_rtx = delete_from_delay_slot (merged_insns->insn ());
- if (INSN_DELETED_P (thread))
+ if (thread->deleted ())
thread = new_rtx;
}
else
@@ -1947,7 +1947,7 @@ fill_simple_delay_slots (int non_jumps_p)
insn = unfilled_slots_base[i];
if (insn == 0
- || INSN_DELETED_P (insn)
+ || insn->deleted ()
|| (NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
|| (JUMP_P (insn) && non_jumps_p)
@@ -2861,7 +2861,7 @@ fill_eager_delay_slots (void)
insn = unfilled_slots_base[i];
if (insn == 0
- || INSN_DELETED_P (insn)
+ || insn->deleted ()
|| !JUMP_P (insn)
|| ! (condjump_p (insn) || condjump_in_parallel_p (insn)))
continue;
@@ -3837,7 +3837,7 @@ dbr_schedule (rtx_insn *first)
memset (total_annul_slots, 0, sizeof total_annul_slots);
for (insn = first; insn; insn = NEXT_INSN (insn))
{
- if (! INSN_DELETED_P (insn)
+ if (! insn->deleted ()
&& NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE
&& GET_CODE (PATTERN (insn)) != CLOBBER)
diff --git a/gcc/resource.c b/gcc/resource.c
index ff9b878..3ebc709 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -931,8 +931,7 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource
information, we can get it from there unless the insn at the
start of the basic block has been deleted. */
if (tinfo && tinfo->block != -1
- && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK_FOR_FN (cfun,
- tinfo->block))))
+ && ! BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, tinfo->block))->deleted ())
b = tinfo->block;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0173fe4..93badb6 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -490,6 +490,7 @@ is_a_helper <const rtx_sequence *>::test (const_rtx rt)
class GTY(()) rtx_insn : public rtx_def
{
+public:
/* No extra fields, but adds the invariant:
(INSN_P (X)
@@ -505,6 +506,18 @@ class GTY(()) rtx_insn : public rtx_def
i.e. we have an rtx that has an INSN_UID field and can be part of
a linked list of insns.
*/
+
+ /* Returns true if this insn has been deleted. */
+
+ bool deleted () const { return volatil; }
+
+ /* Mark this insn as deleted. */
+
+ void set_deleted () { volatil = true; }
+
+ /* Mark this insn as not deleted. */
+
+ void set_undeleted () { volatil = false; }
};
/* Subclasses of rtx_insn. */
@@ -1405,10 +1418,6 @@ inline rtvec rtx_jump_table_data::get_labels () const
(RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
-/* 1 if RTX is an insn that has been deleted. */
-#define INSN_DELETED_P(RTX) \
- (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
-
/* 1 if JUMP RTX is a crossing jump. */
#define CROSSING_JUMP_P(RTX) \
(RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 053fe14..9d0004a 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1069,7 +1069,7 @@ return_nop_to_pool (insn_t nop, bool full_tidying)
sel_remove_insn (nop, false, full_tidying);
/* We'll recycle this nop. */
- INSN_DELETED_P (nop) = 0;
+ nop->set_undeleted ();
if (nop_pool.n == nop_pool.s)
nop_pool.v = XRESIZEVEC (rtx_insn *, nop_pool.v,
@@ -1404,7 +1404,7 @@ sel_gen_insn_from_expr_after (expr_t expr, vinsn_t vinsn, int seqno,
/* The insn may come from the transformation cache, which may hold already
deleted insns, so mark it as not deleted. */
- INSN_DELETED_P (insn) = 0;
+ insn->set_undeleted ();
add_insn_after (insn, after, BLOCK_FOR_INSN (insn));
diff --git a/gcc/varasm.c b/gcc/varasm.c
index de4479c..0ef866a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3822,7 +3822,7 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
CODE_LABEL into a NOTE. */
/* ??? This seems completely and utterly wrong. Certainly it's
not true for NOTE_INSN_DELETED_LABEL, but I disbelieve proper
- functioning even with INSN_DELETED_P and friends. */
+ functioning even with rtx_insn::deleted and friends. */
tmp = x;
switch (GET_CODE (tmp))
@@ -3836,7 +3836,7 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
case LABEL_REF:
tmp = XEXP (tmp, 0);
- gcc_assert (!INSN_DELETED_P (tmp));
+ gcc_assert (!as_a<rtx_insn *> (tmp)->deleted ());
gcc_assert (!NOTE_P (tmp)
|| NOTE_KIND (tmp) != NOTE_INSN_DELETED);
break;
--
2.1.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add static typed insn_deleted_p
2014-09-11 22:50 ` [PATCH 2/2] add static typed insn_deleted_p tsaunders
@ 2014-09-12 0:09 ` David Malcolm
2014-09-12 1:18 ` Trevor Saunders
2014-09-12 21:22 ` Jeff Law
1 sibling, 1 reply; 8+ messages in thread
From: David Malcolm @ 2014-09-12 0:09 UTC (permalink / raw)
To: tsaunders; +Cc: gcc-patches
On Thu, 2014-09-11 at 18:49 -0400, tsaunders@mozilla.com wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> This changes all callers of INSN_DELETED_P to use one of insn->deleted () insn->set_deleted () or insn->set_undeleted () depending on what they're doing (set_deleted / set_undeleted seem somewhat clearer to me than = 0 / 1).
>
> bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
> config-list.mk with a couple other patches. ok?
>
> Trev
>
> gcc/
>
> * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
> config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
> emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
> reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
> macro with staticly checked member functions.
> * rtl.h (rtx_insn::deleted): New method.
> (rtx_insn::set_deleted): Likewise.
> (rtx_insn::set_undeleted): Likewise.
I'm not an approver, but a couple of nitpicks:
(A) "staticly" -> "statically"
(B) the above candidate ChangeLog for rtl.h omits the deletion of the
INSN_DELETED_P macro (obviously trivial to fix).
[...]
FWIW, in case it's helpful, I have a script here that I use to help make
ChangeLog entries:
https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/generate-changelog.py
(needs to be able to import the sibling "refactor" module)
You feed it a git diff, and it generates a fragment of ChangeLog,
grouped according to subdirectory appropriately (based on which have
ChangeLog files), with each hunk indented so you can see what changed,
and write stuff accordingly (the assumption being that any automated
approach is going to get things wrong, and that human review is
necessary).
Dave
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add static typed insn_deleted_p
2014-09-12 0:09 ` David Malcolm
@ 2014-09-12 1:18 ` Trevor Saunders
2014-09-12 21:17 ` Jeff Law
2014-09-15 10:12 ` Yury Gribov
0 siblings, 2 replies; 8+ messages in thread
From: Trevor Saunders @ 2014-09-12 1:18 UTC (permalink / raw)
To: David Malcolm; +Cc: gcc-patches
On Thu, Sep 11, 2014 at 08:06:02PM -0400, David Malcolm wrote:
> On Thu, 2014-09-11 at 18:49 -0400, tsaunders@mozilla.com wrote:
> > From: Trevor Saunders <tsaunders@mozilla.com>
> >
> > Hi,
> >
> > This changes all callers of INSN_DELETED_P to use one of insn->deleted () insn->set_deleted () or insn->set_undeleted () depending on what they're doing (set_deleted / set_undeleted seem somewhat clearer to me than = 0 / 1).
> >
> > bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
> > config-list.mk with a couple other patches. ok?
> >
> > Trev
> >
> > gcc/
> >
> > * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
> > config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
> > emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
> > reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
> > macro with staticly checked member functions.
> > * rtl.h (rtx_insn::deleted): New method.
> > (rtx_insn::set_deleted): Likewise.
> > (rtx_insn::set_undeleted): Likewise.
>
> I'm not an approver, but a couple of nitpicks:
> (A) "staticly" -> "statically"
> (B) the above candidate ChangeLog for rtl.h omits the deletion of the
> INSN_DELETED_P macro (obviously trivial to fix).
oops, I see there's at least one person who actually reads changelogs.
> [...]
>
> FWIW, in case it's helpful, I have a script here that I use to help make
> ChangeLog entries:
> https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/generate-changelog.py
> (needs to be able to import the sibling "refactor" module)
>
> You feed it a git diff, and it generates a fragment of ChangeLog,
> grouped according to subdirectory appropriately (based on which have
> ChangeLog files), with each hunk indented so you can see what changed,
> and write stuff accordingly (the assumption being that any automated
> approach is going to get things wrong, and that human review is
> necessary).
yeah, I tend to use contrib/mklog except in cases like this where I'm
going to give the same comment for a bunch of files. In that case I use
something like git diff --stat | sed and then handle the few single
items manually, but it turns out the problem with humans is they make
mistakes.
btw it would be great to merge your thing with mklog somehow ideally
resulting in less perl ;-)
Trev
>
> Dave
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add static typed insn_deleted_p
2014-09-12 1:18 ` Trevor Saunders
@ 2014-09-12 21:17 ` Jeff Law
2014-09-15 10:12 ` Yury Gribov
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2014-09-12 21:17 UTC (permalink / raw)
To: Trevor Saunders, David Malcolm; +Cc: gcc-patches
On 09/11/14 19:17, Trevor Saunders wrote:
> On Thu, Sep 11, 2014 at 08:06:02PM -0400, David Malcolm wrote:
>> On Thu, 2014-09-11 at 18:49 -0400, tsaunders@mozilla.com wrote:
>>> From: Trevor Saunders <tsaunders@mozilla.com>
>>>
>>> Hi,
>>>
>>> This changes all callers of INSN_DELETED_P to use one of insn->deleted () insn->set_deleted () or insn->set_undeleted () depending on what they're doing (set_deleted / set_undeleted seem somewhat clearer to me than = 0 / 1).
>>>
>>> bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
>>> config-list.mk with a couple other patches. ok?
>>>
>>> Trev
>>>
>>> gcc/
>>>
>>> * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
>>> config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
>>> emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
>>> reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
>>> macro with staticly checked member functions.
>>> * rtl.h (rtx_insn::deleted): New method.
>>> (rtx_insn::set_deleted): Likewise.
>>> (rtx_insn::set_undeleted): Likewise.
>>
>> I'm not an approver, but a couple of nitpicks:
>> (A) "staticly" -> "statically"
>> (B) the above candidate ChangeLog for rtl.h omits the deletion of the
>> INSN_DELETED_P macro (obviously trivial to fix).
>
> oops, I see there's at least one person who actually reads changelogs.
I read them as well, though not for every change. :-)
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] use rtx_insn * more
2014-09-11 22:49 [PATCH 1/2] use rtx_insn * more tsaunders
2014-09-11 22:50 ` [PATCH 2/2] add static typed insn_deleted_p tsaunders
@ 2014-09-12 21:20 ` Jeff Law
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2014-09-12 21:20 UTC (permalink / raw)
To: tsaunders, gcc-patches
On 09/11/14 16:48, tsaunders@mozilla.com wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> pretty trivial, but not quiet just changing the types of variables.
> bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
> config-list.mk with a couple other patches. ok?
>
> Trev
>
> gcc/ChangeLog:
>
> 2014-09-11 Trevor Saunders <tsaunders@mozilla.com>
>
> * config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Assign the
> result of emit_jump_insn_before to a new variable.
> * jump.c (mark_jump_label): Change the type of insn to rtx_insn *.
> (mark_jump_label_1): Likewise.
> (mark_jump_label_asm): Likewise.
> * reload1.c (gen_reload): Change type of tem to rtx_insn *.
> * rtl.h (mark_jump_label): Adjust.
OK.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add static typed insn_deleted_p
2014-09-11 22:50 ` [PATCH 2/2] add static typed insn_deleted_p tsaunders
2014-09-12 0:09 ` David Malcolm
@ 2014-09-12 21:22 ` Jeff Law
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2014-09-12 21:22 UTC (permalink / raw)
To: tsaunders, gcc-patches
On 09/11/14 16:49, tsaunders@mozilla.com wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> This changes all callers of INSN_DELETED_P to use one of insn->deleted () insn->set_deleted () or insn->set_undeleted () depending on what they're doing (set_deleted / set_undeleted seem somewhat clearer to me than = 0 / 1).
>
> bootstrapped + regtested on x86_64-unknown-linux-gnu, and run through
> config-list.mk with a couple other patches. ok?
>
> Trev
>
> gcc/
>
> * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
> config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
> emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
> reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
> macro with staticly checked member functions.
> * rtl.h (rtx_insn::deleted): New method.
> (rtx_insn::set_deleted): Likewise.
> (rtx_insn::set_undeleted): Likewise.
OK with the ChangeLog fixups pointed out by David.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add static typed insn_deleted_p
2014-09-12 1:18 ` Trevor Saunders
2014-09-12 21:17 ` Jeff Law
@ 2014-09-15 10:12 ` Yury Gribov
1 sibling, 0 replies; 8+ messages in thread
From: Yury Gribov @ 2014-09-15 10:12 UTC (permalink / raw)
To: Trevor Saunders, David Malcolm; +Cc: gcc-patches
On 09/12/2014 05:17 AM, Trevor Saunders wrote:
> On Thu, Sep 11, 2014 at 08:06:02PM -0400, David Malcolm wrote:
>> FWIW, in case it's helpful, I have a script here that I use to help make
>> ChangeLog entries:
>> https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/generate-changelog.py
>> (needs to be able to import the sibling "refactor" module)
>>
>> You feed it a git diff, and it generates a fragment of ChangeLog,
>> grouped according to subdirectory appropriately (based on which have
>> ChangeLog files), with each hunk indented so you can see what changed,
>> and write stuff accordingly (the assumption being that any automated
>> approach is going to get things wrong, and that human review is
>> necessary).
>
> yeah, I tend to use contrib/mklog except in cases like this where I'm
> going to give the same comment for a bunch of files. In that case I use
> something like git diff --stat | sed and then handle the few single
> items manually, but it turns out the problem with humans is they make
> mistakes.
>
> btw it would be great to merge your thing with mklog somehow ideally
> resulting in less perl ;-)
Rewriting mklog in Python has been discussed a dozen of times (it's not
that I like Python). Note that this would probably require significant
testing (I can share my mklog testsuite). E.g. current
generate-changelog.py does not seem to handle context diffs.
-Y
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-15 10:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 22:49 [PATCH 1/2] use rtx_insn * more tsaunders
2014-09-11 22:50 ` [PATCH 2/2] add static typed insn_deleted_p tsaunders
2014-09-12 0:09 ` David Malcolm
2014-09-12 1:18 ` Trevor Saunders
2014-09-12 21:17 ` Jeff Law
2014-09-15 10:12 ` Yury Gribov
2014-09-12 21:22 ` Jeff Law
2014-09-12 21:20 ` [PATCH 1/2] use rtx_insn * more Jeff Law
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).