This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Use set_unique_reg_note to set REG_EQUAL notes
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Ian Lance Taylor <iant at google dot com>, zadeck at naturalbridge dot com
- Date: Sat, 30 Dec 2006 22:02:55 +0100
- Subject: [PATCH] Use set_unique_reg_note to set REG_EQUAL notes
Hi,
This totally mechanical patch makes us use set_unique_reg_note whenever
we add a REG_EQUAL note in one of the files in config/*. If this is
accepted, I'll post a similar patch for the files in gcc/.
I have checked that all files in config/* use set_unique_reg_note to
add REG_EQUIV notes.
The reason for this change is that it simplifies the book-keeping of
changes to REG_NOTES. I think this is helpful for the dataflow branch
to avoid re-scanning notes whenever something changes. I also think
that we can do without REG_EQUAL and REG_EQUIV notes after reload (we
don't have post-reload passes that use them AFAICT), and by going
through a function, we can avoid creating them if reload_completed.
I have no real way to test this, but it's sufficiently mechanical that
I'm confident to ask for a review as-is ;-)
Gr.
Steven
* config/alpha/alpha.md, arm/arm.c, darwin.c, frv/frv.md,
m32r/m32r.c, m32r/m32r.c, mn10300/mn10300.md, pa/pa.c,
rs6000/rs6000.c, s390/s390.md, sh/sh.md, sparc/sparc.c:
Always use set_unique_reg_note to add REG_EQUAL notes.
Index: config/alpha/alpha.md
===================================================================
--- config/alpha/alpha.md (revision 120287)
+++ config/alpha/alpha.md (working copy)
@@ -5336,8 +5336,8 @@ (define_split
emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
- REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn3));
+ set_unique_reg_note (insn3, REG_EQUAL, operands[1]);
+
if (GET_CODE (operands[1]) == LABEL_REF)
{
rtx label;
Index: config/frv/frv.md
===================================================================
--- config/frv/frv.md (revision 120287)
+++ config/frv/frv.md (working copy)
@@ -7904,8 +7904,7 @@ (define_expand "symGOT2reg"
MEM_READONLY_P (SET_SRC (PATTERN (insn))) = 1;
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
@@ -7985,8 +7984,7 @@ (define_expand "symGOTOFF2reg"
{
rtx insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1], operands[2], operands[3]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
@@ -8022,8 +8020,7 @@ (define_expand "symGPREL2reg"
insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1],
operands[4], operands[3]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
@@ -8053,8 +8050,7 @@ (define_expand "symGPREL2reg_hilo"
insn = emit_insn (gen_symGOTOFF2reg_hilo (operands[0], operands[1],
operands[4], operands[3]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
Index: config/s390/s390.md
===================================================================
--- config/s390/s390.md (revision 120287)
+++ config/s390/s390.md (working copy)
@@ -4545,12 +4545,10 @@ (define_expand "divmoddi4"
emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, div_equal);
insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, mod_equal);
DONE;
})
@@ -4616,17 +4614,15 @@ (define_expand "udivmoddi4"
emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
+
insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, div_equal);
insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, mod_equal);
DONE;
})
@@ -4676,17 +4672,15 @@ (define_expand "divmodsi4"
operands[4] = gen_reg_rtx(DImode);
emit_insn (gen_extendsidi2 (operands[4], operands[1]));
+
insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, div_equal);
insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, mod_equal);
DONE;
})
@@ -4738,17 +4732,15 @@ (define_expand "udivmodsi4"
emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
+
insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, div_equal);
insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, mod_equal);
DONE;
})
@@ -4813,14 +4805,11 @@ (define_expand "udivsi3"
emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0],
gen_lowpart (SImode, operands[3]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL,
- udiv_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
}
}
else
@@ -4844,14 +4833,12 @@ (define_expand "udivsi3"
emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0],
gen_lowpart (SImode, operands[3]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL,
- udiv_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
+
emit_jump (label3);
emit_label (label1);
emit_move_insn (operands[0], operands[1]);
@@ -4905,14 +4892,11 @@ (define_expand "umodsi3"
emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0],
gen_highpart (SImode, operands[3]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL,
- umod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, umod_equal);
}
}
else
@@ -4936,14 +4920,12 @@ (define_expand "umodsi3"
emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
operands[2]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equal);
insn = emit_move_insn (operands[0],
gen_highpart (SImode, operands[3]));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL,
- umod_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, umod_equal);
+
emit_jump (label3);
emit_label (label1);
emit_move_insn (operands[0], const0_rtx);
@@ -6275,8 +6257,7 @@ (define_expand "clzdi2"
emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
- REG_NOTES (insn) =
- gen_rtx_EXPR_LIST (REG_EQUAL, clz_equal, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, clz_equal);
DONE;
})
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c (revision 120287)
+++ config/sparc/sparc.c (working copy)
@@ -3257,8 +3257,7 @@ legitimize_pic_address (rtx orig, enum m
insn = emit_move_insn (reg, pic_ref);
/* Put a REG_EQUAL note on this insn, so that it can be optimized
by loop. */
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig,
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, orig);
return reg;
}
else if (GET_CODE (orig) == CONST)
Index: config/m32r/m32r.c
===================================================================
--- config/m32r/m32r.c (revision 120287)
+++ config/m32r/m32r.c (working copy)
@@ -1681,8 +1681,7 @@ m32r_legitimize_pic_address (rtx orig, r
#if 0
/* Put a REG_EQUAL note on this insn, so that it can be optimized
by loop. */
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig,
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, orig);
#endif
return reg;
}
Index: config/sh/sh.md
===================================================================
--- config/sh/sh.md (revision 120287)
+++ config/sh/sh.md (working copy)
@@ -2749,9 +2749,9 @@ (define_expand "mulhisi3"
See also smulsi3_highpart.
??? Alternatively, we could put this at the calling site of expand_binop,
i.e. expand_expr. */
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_EQUAL, copy_rtx (SET_SRC (single_set (first))),
- REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL,
+ copy_rtx (SET_SRC (single_set (first))));
+
DONE;
}")
@@ -2779,9 +2779,9 @@ (define_expand "umulhisi3"
See also smulsi3_highpart.
??? Alternatively, we could put this at the calling site of expand_binop,
i.e. expand_expr. */
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_EQUAL, copy_rtx (SET_SRC (single_set (first))),
- REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL,
+ copy_rtx (SET_SRC (single_set (first))));
+
DONE;
}")
@@ -3058,9 +3058,9 @@ (define_expand "smulsi3_highpart"
See also {,u}mulhisi.
??? Alternatively, we could put this at the calling site of expand_binop,
i.e. expand_mult_highpart. */
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_EQUAL, copy_rtx (SET_SRC (single_set (first))),
- REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL,
+ copy_rtx (SET_SRC (single_set (first))));
+
DONE;
}")
@@ -5113,8 +5113,7 @@ (define_split
{
rtx insn = emit_insn (gen_movsi_const (operands[0], operands[1]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, copy_rtx (operands[1]),
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, copy_rtx (operands[1]));
DONE;
}")
@@ -5497,8 +5496,7 @@ (define_split
else
insn = emit_insn (gen_movdi_const_32bit (operands[0], operands[1]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, copy_rtx (operands[1]),
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, copy_rtx (operands[1]));
DONE;
}")
@@ -8323,8 +8321,7 @@ (define_expand "GOTaddr2picreg"
insn = emit_move_insn (operands[0], tr);
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, equiv,
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, equiv);
DONE;
}
@@ -8433,9 +8430,8 @@ (define_expand "symGOT_load"
/* ??? Should we have a special alias set for the GOT? */
insn = emit_move_insn (operands[0], mem);
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, XVECEXP (XEXP (operands[1],
- 0), 0, 0),
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL,
+ XVECEXP (XEXP (operands[1], 0), 0, 0));
DONE;
}")
@@ -8494,8 +8490,7 @@ (define_expand "symGOTOFF2reg"
gen_rtx_PLUS (Pmode, t,
gen_rtx_REG (Pmode, PIC_REG)));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
@@ -13203,9 +13198,8 @@ (define_expand "ffsdi2"
emit_insn (gen_adddi3 (scratch, scratch, GEN_INT (-64)));
emit_insn (gen_movdicc_false (scratch, operands[1], const0_rtx, scratch));
last = emit_insn (gen_subdi3 (operands[0], const0_rtx, scratch));
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_EQUAL,
- gen_rtx_FFS (DImode, operands[0]), REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL, gen_rtx_FFS (DImode, operands[0]));
+
DONE;
}")
@@ -13228,9 +13222,8 @@ (define_expand "ffssi2"
emit_insn (gen_nsbsi (scratch, discratch));
last = emit_insn (gen_subsi3 (operands[0],
force_reg (SImode, GEN_INT (63)), scratch));
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_EQUAL,
- gen_rtx_FFS (SImode, operands[0]), REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL, gen_rtx_FFS (SImode, operands[0]));
+
DONE;
}")
Index: config/mn10300/mn10300.md
===================================================================
--- config/mn10300/mn10300.md (revision 120287)
+++ config/mn10300/mn10300.md (working copy)
@@ -2631,8 +2631,7 @@ (define_expand "symGOT2reg"
MEM_READONLY_P (SET_SRC (PATTERN (insn))) = 1;
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
@@ -2652,8 +2651,7 @@ (define_expand "symGOTOFF2reg"
{
rtx insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1]));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, operands[1]);
DONE;
}")
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c (revision 120287)
+++ config/rs6000/rs6000.c (working copy)
@@ -3363,8 +3363,7 @@ rs6000_legitimize_tls_address (rtx addr,
emit_move_insn (tmp2, mem);
emit_insn (gen_addsi3 (tmp3, tmp1, tmp2));
last = emit_move_insn (got, tmp3);
- REG_NOTES (last) = gen_rtx_EXPR_LIST (REG_EQUAL, gsym,
- REG_NOTES (last));
+ set_unique_reg_note (last, REG_EQUAL, gsym);
REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
REG_NOTES (first));
REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first,
Index: config/darwin.c
===================================================================
--- config/darwin.c (revision 120287)
+++ config/darwin.c (working copy)
@@ -742,8 +742,7 @@ machopic_legitimize_pic_address (rtx ori
gen_rtx_LO_SUM (Pmode,
hi_sum_reg, offset));
insn = emit_insn (gen_rtx_SET (VOIDmode, reg, mem));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, pic_ref,
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, pic_ref);
pic_ref = reg;
#else
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c (revision 120287)
+++ config/arm/arm.c (working copy)
@@ -3295,8 +3295,8 @@ legitimize_pic_address (rtx orig, enum m
#endif
/* Put a REG_EQUAL note on this insn, so that it can be optimized
by loop. */
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig,
- REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, orig);
+
return reg;
}
else if (GET_CODE (orig) == CONST)
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c (revision 120287)
+++ config/pa/pa.c (working copy)
@@ -662,7 +662,7 @@ legitimize_pic_address (rtx orig, enum m
insn = emit_move_insn (reg, pic_ref);
/* Put a REG_EQUAL note on this insn, so that it can be optimized. */
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, orig);
return reg;
}
@@ -1978,8 +1978,7 @@ emit_move_sequence (rtx *operands, enum
}
}
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_EQUAL, op1, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, op1);
return 1;
}