make LABEL_REF_LABEL a rtx_insn *

While changing LABEL_REF_LABEL it might as well become an inline
function, so that its clearer what types are involved.  Unfortunately
because it is still possible to use XEXP and related macros on a
LABEL_REF rtx you can still set the field to be a non insn rtx.  The
other unfortunate thing is that the generators actually create LABEL_REF
rtx that refer to MATCH_x rtx, so there we actually need to use XEXP to
bypass the checking this patch adds.

gcc/ChangeLog:

2016-10-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* rtl.h (label_ref_label): New function.
	(set_label_ref_label): New function.
	(LABEL_REF_LABEL): Delete.
	* alias.c (rtx_equal_for_memref_p): Adjust.
	* cfgbuild.c (make_edges): Likewise.
	(purge_dead_tablejump_edges): Likewise.
	* cfgexpand.c (convert_debug_memory_address): Likewise.
	* cfgrtl.c (patch_jump_insn): Likewise.
	* combine.c (distribute_notes): Likewise.
	* cse.c (hash_rtx_cb): Likewise.
	(exp_equiv_p): Likewise.
	(fold_rtx): Likewise.
	(check_for_label_ref): Likewise.
	* cselib.c (rtx_equal_for_cselib_1): Likewise.
	(cselib_hash_rtx): Likewise.
	* emit-rtl.c (mark_label_nuses): Likewise.
	* explow.c (convert_memory_address_addr_space_1): Likewise.
	* final.c (output_asm_label): Likewise.
	(output_addr_const): Likewise.
	* gcse.c (add_label_notes): Likewise.
	* genconfig.c (walk_insn_part): Likewise.
	* genrecog.c (validate_pattern): Likewise.
	* ifcvt.c (cond_exec_get_condition): Likewise.
	(noce_emit_store_flag): Likewise.
	(noce_get_alt_condition): Likewise.
	(noce_get_condition): Likewise.
	* jump.c (maybe_propagate_label_ref): Likewise.
	(mark_jump_label_1): Likewise.
	(redirect_exp_1): Likewise.
	(rtx_renumbered_equal_p): Likewise.
	* lra-constraints.c (operands_match_p): Likewise.
	* print-rtl.c (print_value): Likewise.
	* reload.c (find_reloads): Likewise.
	* reload1.c (set_label_offsets): Likewise.
	* reorg.c (get_branch_condition): Likewise.
	* rtl-tests.c (test_uncond_jump): Likewise.
	* rtl.c (rtx_equal_p_cb): Likewise.
	(rtx_equal_p): Likewise.
	* rtlanal.c (reg_mentioned_p): Likewise.
	(rtx_referenced_p): Likewise.
	(get_condition): Likewise.
	* varasm.c (const_hash_1): Likewise.
	(compare_constant): Likewise.
	(const_rtx_hash_1): Likewise.
	(output_constant_pool_1): Likewise.

From-SVN: r241401
This commit is contained in:
Trevor Saunders 2016-10-21 12:32:56 +00:00 committed by Trevor Saunders
parent 1d64ceb057
commit 04a121a757
26 changed files with 134 additions and 75 deletions

View File

@ -1,3 +1,51 @@
2016-10-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* rtl.h (label_ref_label): New function.
(set_label_ref_label): New function.
(LABEL_REF_LABEL): Delete.
* alias.c (rtx_equal_for_memref_p): Adjust.
* cfgbuild.c (make_edges): Likewise.
(purge_dead_tablejump_edges): Likewise.
* cfgexpand.c (convert_debug_memory_address): Likewise.
* cfgrtl.c (patch_jump_insn): Likewise.
* combine.c (distribute_notes): Likewise.
* cse.c (hash_rtx_cb): Likewise.
(exp_equiv_p): Likewise.
(fold_rtx): Likewise.
(check_for_label_ref): Likewise.
* cselib.c (rtx_equal_for_cselib_1): Likewise.
(cselib_hash_rtx): Likewise.
* emit-rtl.c (mark_label_nuses): Likewise.
* explow.c (convert_memory_address_addr_space_1): Likewise.
* final.c (output_asm_label): Likewise.
(output_addr_const): Likewise.
* gcse.c (add_label_notes): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genrecog.c (validate_pattern): Likewise.
* ifcvt.c (cond_exec_get_condition): Likewise.
(noce_emit_store_flag): Likewise.
(noce_get_alt_condition): Likewise.
(noce_get_condition): Likewise.
* jump.c (maybe_propagate_label_ref): Likewise.
(mark_jump_label_1): Likewise.
(redirect_exp_1): Likewise.
(rtx_renumbered_equal_p): Likewise.
* lra-constraints.c (operands_match_p): Likewise.
* print-rtl.c (print_value): Likewise.
* reload.c (find_reloads): Likewise.
* reload1.c (set_label_offsets): Likewise.
* reorg.c (get_branch_condition): Likewise.
* rtl-tests.c (test_uncond_jump): Likewise.
* rtl.c (rtx_equal_p_cb): Likewise.
(rtx_equal_p): Likewise.
* rtlanal.c (reg_mentioned_p): Likewise.
(rtx_referenced_p): Likewise.
(get_condition): Likewise.
* varasm.c (const_hash_1): Likewise.
(compare_constant): Likewise.
(const_rtx_hash_1): Likewise.
(output_constant_pool_1): Likewise.
2016-10-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
PR target/71627

View File

@ -1767,7 +1767,7 @@ rtx_equal_for_memref_p (const_rtx x, const_rtx y)
return REGNO (x) == REGNO (y);
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return compare_base_symbol_refs (x, y) == 1;

View File

@ -275,7 +275,7 @@ make_edges (basic_block min, basic_block max, int update_p)
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
make_label_edge (edge_cache, bb,
LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)), 0);
label_ref_label (XEXP (SET_SRC (tmp), 2)), 0);
}
/* If this is a computed jump, then mark it as reaching
@ -415,7 +415,7 @@ purge_dead_tablejump_edges (basic_block bb, rtx_jump_table_data *table)
&& SET_DEST (tmp) == pc_rtx
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
mark_tablejump_edge (LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)));
mark_tablejump_edge (label_ref_label (XEXP (SET_SRC (tmp), 2)));
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{

View File

@ -3999,7 +3999,7 @@ convert_debug_memory_address (machine_mode mode, rtx x,
return SUBREG_REG (x);
break;
case LABEL_REF:
temp = gen_rtx_LABEL_REF (mode, LABEL_REF_LABEL (x));
temp = gen_rtx_LABEL_REF (mode, label_ref_label (x));
LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x);
return temp;
case SYMBOL_REF:

View File

@ -1201,7 +1201,7 @@ patch_jump_insn (rtx_insn *insn, rtx_insn *old_label, basic_block new_bb)
&& SET_DEST (tmp) == pc_rtx
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)) == old_label)
&& label_ref_label (XEXP (SET_SRC (tmp), 2)) == old_label)
{
XEXP (SET_SRC (tmp), 2) = gen_rtx_LABEL_REF (Pmode,
new_label);

View File

@ -13874,14 +13874,14 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3))
|| ((tem_note = find_reg_note (i3, REG_EQUAL, NULL_RTX))
&& GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (tem_note, 0)) == XEXP (note, 0)))
&& label_ref_label (XEXP (tem_note, 0)) == XEXP (note, 0)))
place = i3;
if (i2
&& (reg_mentioned_p (XEXP (note, 0), PATTERN (i2))
|| ((tem_note = find_reg_note (i2, REG_EQUAL, NULL_RTX))
&& GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (tem_note, 0)) == XEXP (note, 0))))
&& label_ref_label (XEXP (tem_note, 0)) == XEXP (note, 0))))
{
if (place)
place2 = i2;

View File

@ -2365,7 +2365,7 @@ hash_rtx_cb (const_rtx x, machine_mode mode,
/* We don't hash on the address of the CODE_LABEL to avoid bootstrap
differences and differences between each stage's debugging dumps. */
hash += (((unsigned int) LABEL_REF << 7)
+ CODE_LABEL_NUMBER (LABEL_REF_LABEL (x)));
+ CODE_LABEL_NUMBER (label_ref_label (x)));
return hash;
case SYMBOL_REF:
@ -2618,7 +2618,7 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse)
return x == y;
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
@ -3507,7 +3507,7 @@ fold_rtx (rtx x, rtx_insn *insn)
: lookup_as_function (folded_arg0, MINUS);
if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (y, 1)) == LABEL_REF_LABEL (const_arg1))
&& label_ref_label (XEXP (y, 1)) == label_ref_label (const_arg1))
return XEXP (y, 0);
/* Now try for a CONST of a MINUS like the above. */
@ -3515,7 +3515,7 @@ fold_rtx (rtx x, rtx_insn *insn)
: lookup_as_function (folded_arg0, CONST))) != 0
&& GET_CODE (XEXP (y, 0)) == MINUS
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (XEXP (y, 0), 1)) == LABEL_REF_LABEL (const_arg1))
&& label_ref_label (XEXP (XEXP (y, 0), 1)) == label_ref_label (const_arg1))
return XEXP (XEXP (y, 0), 0);
}
@ -3527,7 +3527,7 @@ fold_rtx (rtx x, rtx_insn *insn)
: lookup_as_function (folded_arg1, MINUS);
if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (y, 1)) == LABEL_REF_LABEL (const_arg0))
&& label_ref_label (XEXP (y, 1)) == label_ref_label (const_arg0))
return XEXP (y, 0);
/* Now try for a CONST of a MINUS like the above. */
@ -3535,7 +3535,7 @@ fold_rtx (rtx x, rtx_insn *insn)
: lookup_as_function (folded_arg1, CONST))) != 0
&& GET_CODE (XEXP (y, 0)) == MINUS
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (XEXP (y, 0), 1)) == LABEL_REF_LABEL (const_arg0))
&& label_ref_label (XEXP (XEXP (y, 0), 1)) == label_ref_label (const_arg0))
return XEXP (XEXP (y, 0), 0);
}
@ -6497,10 +6497,10 @@ check_for_label_ref (rtx_insn *insn)
if (GET_CODE (x) == LABEL_REF
&& !LABEL_REF_NONLOCAL_P (x)
&& (!JUMP_P (insn)
|| !label_is_jump_target_p (LABEL_REF_LABEL (x), insn))
&& LABEL_P (LABEL_REF_LABEL (x))
&& INSN_UID (LABEL_REF_LABEL (x)) != 0
&& !find_reg_note (insn, REG_LABEL_OPERAND, LABEL_REF_LABEL (x)))
|| !label_is_jump_target_p (label_ref_label (x), insn))
&& LABEL_P (label_ref_label (x))
&& INSN_UID (label_ref_label (x)) != 0
&& !find_reg_note (insn, REG_LABEL_OPERAND, label_ref_label (x)))
return true;
}
return false;

View File

@ -945,7 +945,7 @@ rtx_equal_for_cselib_1 (rtx x, rtx y, machine_mode memmode)
return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case REG:
return REGNO (x) == REGNO (y);
@ -1154,7 +1154,7 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode)
/* We don't hash on the address of the CODE_LABEL to avoid bootstrap
differences and differences between each stage's debugging dumps. */
hash += (((unsigned int) LABEL_REF << 7)
+ CODE_LABEL_NUMBER (LABEL_REF_LABEL (x)));
+ CODE_LABEL_NUMBER (label_ref_label (x)));
return hash ? hash : (unsigned int) LABEL_REF;
case SYMBOL_REF:

View File

@ -3601,8 +3601,8 @@ mark_label_nuses (rtx x)
const char *fmt;
code = GET_CODE (x);
if (code == LABEL_REF && LABEL_P (LABEL_REF_LABEL (x)))
LABEL_NUSES (LABEL_REF_LABEL (x))++;
if (code == LABEL_REF && LABEL_P (label_ref_label (x)))
LABEL_NUSES (label_ref_label (x))++;
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)

View File

@ -321,7 +321,7 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
break;
case LABEL_REF:
temp = gen_rtx_LABEL_REF (to_mode, LABEL_REF_LABEL (x));
temp = gen_rtx_LABEL_REF (to_mode, label_ref_label (x));
LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x);
return temp;

View File

@ -3826,7 +3826,7 @@ output_asm_label (rtx x)
char buf[256];
if (GET_CODE (x) == LABEL_REF)
x = LABEL_REF_LABEL (x);
x = label_ref_label (x);
if (LABEL_P (x)
|| (NOTE_P (x)
&& NOTE_KIND (x) == NOTE_INSN_DELETED_LABEL))
@ -3917,7 +3917,7 @@ output_addr_const (FILE *file, rtx x)
break;
case LABEL_REF:
x = LABEL_REF_LABEL (x);
x = label_ref_label (x);
/* Fall through. */
case CODE_LABEL:
ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));

View File

@ -2643,10 +2643,10 @@ add_label_notes (rtx x, rtx_insn *insn)
such a LABEL_REF, so we don't have to handle REG_LABEL_TARGET
notes. */
gcc_assert (!JUMP_P (insn));
add_reg_note (insn, REG_LABEL_OPERAND, LABEL_REF_LABEL (x));
add_reg_note (insn, REG_LABEL_OPERAND, label_ref_label (x));
if (LABEL_P (LABEL_REF_LABEL (x)))
LABEL_NUSES (LABEL_REF_LABEL (x))++;
if (LABEL_P (label_ref_label (x)))
LABEL_NUSES (label_ref_label (x))++;
return;
}

View File

@ -94,8 +94,8 @@ walk_insn_part (rtx part, int recog_p, int non_pc_set_src)
break;
case LABEL_REF:
if (GET_CODE (LABEL_REF_LABEL (part)) == MATCH_OPERAND
|| GET_CODE (LABEL_REF_LABEL (part)) == MATCH_DUP)
if (GET_CODE (XEXP (part, 0)) == MATCH_OPERAND
|| GET_CODE (XEXP (part, 0)) == MATCH_DUP)
break;
return;

View File

@ -732,9 +732,9 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
return;
case LABEL_REF:
if (GET_MODE (LABEL_REF_LABEL (pattern)) != VOIDmode)
if (GET_MODE (XEXP (pattern, 0)) != VOIDmode)
error_at (info->loc, "operand to label_ref %smode not VOIDmode",
GET_MODE_NAME (GET_MODE (LABEL_REF_LABEL (pattern))));
GET_MODE_NAME (GET_MODE (XEXP (pattern, 0))));
break;
default:

View File

@ -436,7 +436,7 @@ cond_exec_get_condition (rtx_insn *jump)
/* If this branches to JUMP_LABEL when the condition is false,
reverse the condition. */
if (GET_CODE (XEXP (test_if, 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (test_if, 2)) == JUMP_LABEL (jump))
&& label_ref_label (XEXP (test_if, 2)) == JUMP_LABEL (jump))
{
enum rtx_code rev = reversed_comparison_code (cond, jump);
if (rev == UNKNOWN)
@ -881,7 +881,7 @@ noce_emit_store_flag (struct noce_if_info *if_info, rtx x, int reversep,
rtx set = pc_set (if_info->jump);
cond = XEXP (SET_SRC (set), 0);
if (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump))
&& label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump))
reversep = !reversep;
if (if_info->then_else_reversed)
reversep = !reversep;
@ -2348,7 +2348,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
cond = XEXP (SET_SRC (set), 0);
reverse
= GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump);
&& label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump);
if (if_info->then_else_reversed)
reverse = !reverse;
@ -2955,7 +2955,7 @@ noce_get_condition (rtx_insn *jump, rtx_insn **earliest, bool then_else_reversed
/* If this branches to JUMP_LABEL when the condition is false,
reverse the condition. */
reverse = (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump));
&& label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump));
/* We may have to reverse because the caller's if block is not canonical,
i.e. the THEN block isn't the fallthrough block for the TEST block

View File

@ -284,7 +284,7 @@ maybe_propagate_label_ref (rtx_insn *jump_insn, rtx_insn *prev_nonjump_insn)
CODE_LABEL in the LABEL_REF of the "set". We can
conveniently use it for the marker function, which
requires a LABEL_REF wrapping. */
gcc_assert (XEXP (label_note, 0) == LABEL_REF_LABEL (SET_SRC (label_set)));
gcc_assert (XEXP (label_note, 0) == label_ref_label (SET_SRC (label_set)));
mark_jump_label_1 (label_set, jump_insn, false, true);
@ -1151,7 +1151,7 @@ mark_jump_label_1 (rtx x, rtx_insn *insn, bool in_mem, bool is_target)
case LABEL_REF:
{
rtx label = LABEL_REF_LABEL (x);
rtx_insn *label = label_ref_label (x);
/* Ignore remaining references to unreachable labels that
have been deleted. */
@ -1165,7 +1165,7 @@ mark_jump_label_1 (rtx x, rtx_insn *insn, bool in_mem, bool is_target)
if (LABEL_REF_NONLOCAL_P (x))
break;
LABEL_REF_LABEL (x) = label;
set_label_ref_label (x, label);
if (! insn || ! insn->deleted ())
++LABEL_NUSES (label);
@ -1464,7 +1464,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
int i;
const char *fmt;
if ((code == LABEL_REF && LABEL_REF_LABEL (x) == olabel)
if ((code == LABEL_REF && label_ref_label (x) == olabel)
|| x == olabel)
{
x = redirect_target (nlabel);
@ -1477,7 +1477,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
if (code == SET && SET_DEST (x) == pc_rtx
&& ANY_RETURN_P (nlabel)
&& GET_CODE (SET_SRC (x)) == LABEL_REF
&& LABEL_REF_LABEL (SET_SRC (x)) == olabel)
&& label_ref_label (SET_SRC (x)) == olabel)
{
validate_change (insn, loc, nlabel, 1);
return;
@ -1801,16 +1801,14 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y)
case LABEL_REF:
/* We can't assume nonlocal labels have their following insns yet. */
if (LABEL_REF_NONLOCAL_P (x) || LABEL_REF_NONLOCAL_P (y))
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
/* Two label-refs are equivalent if they point at labels
in the same position in the instruction stream. */
else
{
rtx_insn *xi = next_nonnote_nondebug_insn
(as_a<rtx_insn *> (LABEL_REF_LABEL (x)));
rtx_insn *yi = next_nonnote_nondebug_insn
(as_a<rtx_insn *> (LABEL_REF_LABEL (y)));
rtx_insn *xi = next_nonnote_nondebug_insn (label_ref_label (x));
rtx_insn *yi = next_nonnote_nondebug_insn (label_ref_label (y));
while (xi && LABEL_P (xi))
xi = next_nonnote_nondebug_insn (xi);
while (yi && LABEL_P (yi))

View File

@ -739,7 +739,7 @@ operands_match_p (rtx x, rtx y, int y_hard_regno)
return false;
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);

View File

@ -1432,7 +1432,7 @@ print_value (pretty_printer *pp, const_rtx x, int verbose)
pp_printf (pp, "`%s'", XSTR (x, 0));
break;
case LABEL_REF:
pp_printf (pp, "L%d", INSN_UID (LABEL_REF_LABEL (x)));
pp_printf (pp, "L%d", INSN_UID (label_ref_label (x)));
break;
case CONST:
case HIGH:

View File

@ -2318,7 +2318,7 @@ operands_match_p (rtx x, rtx y)
return 0;
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
@ -4218,17 +4218,17 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
this instruction. */
if (GET_CODE (substitution) == LABEL_REF
&& !find_reg_note (insn, REG_LABEL_OPERAND,
LABEL_REF_LABEL (substitution))
label_ref_label (substitution))
/* For a JUMP_P, if it was a branch target it must have
already been recorded as such. */
&& (!JUMP_P (insn)
|| !label_is_jump_target_p (LABEL_REF_LABEL (substitution),
|| !label_is_jump_target_p (label_ref_label (substitution),
insn)))
{
add_reg_note (insn, REG_LABEL_OPERAND,
LABEL_REF_LABEL (substitution));
if (LABEL_P (LABEL_REF_LABEL (substitution)))
++LABEL_NUSES (LABEL_REF_LABEL (substitution));
label_ref_label (substitution));
if (LABEL_P (label_ref_label (substitution)))
++LABEL_NUSES (label_ref_label (substitution));
}
}

View File

@ -2319,7 +2319,7 @@ set_label_offsets (rtx x, rtx_insn *insn, int initial_p)
if (LABEL_REF_NONLOCAL_P (x))
return;
x = LABEL_REF_LABEL (x);
x = label_ref_label (x);
/* fall through */
@ -2421,13 +2421,13 @@ set_label_offsets (rtx x, rtx_insn *insn, int initial_p)
case IF_THEN_ELSE:
tem = XEXP (SET_SRC (x), 1);
if (GET_CODE (tem) == LABEL_REF)
set_label_offsets (LABEL_REF_LABEL (tem), insn, initial_p);
set_label_offsets (label_ref_label (tem), insn, initial_p);
else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
break;
tem = XEXP (SET_SRC (x), 2);
if (GET_CODE (tem) == LABEL_REF)
set_label_offsets (LABEL_REF_LABEL (tem), insn, initial_p);
set_label_offsets (label_ref_label (tem), insn, initial_p);
else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
break;
return;

View File

@ -878,20 +878,20 @@ get_branch_condition (const rtx_insn *insn, rtx target)
return 0;
src = SET_SRC (pat);
if (GET_CODE (src) == LABEL_REF && LABEL_REF_LABEL (src) == target)
if (GET_CODE (src) == LABEL_REF && label_ref_label (src) == target)
return const_true_rtx;
else if (GET_CODE (src) == IF_THEN_ELSE
&& XEXP (src, 2) == pc_rtx
&& ((GET_CODE (XEXP (src, 1)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (src, 1)) == target)
&& label_ref_label (XEXP (src, 1)) == target)
|| (ANY_RETURN_P (XEXP (src, 1)) && XEXP (src, 1) == target)))
return XEXP (src, 0);
else if (GET_CODE (src) == IF_THEN_ELSE
&& XEXP (src, 1) == pc_rtx
&& ((GET_CODE (XEXP (src, 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (src, 2)) == target)
&& label_ref_label (XEXP (src, 2)) == target)
|| (ANY_RETURN_P (XEXP (src, 2)) && XEXP (src, 2) == target)))
{
enum rtx_code rev;

View File

@ -87,7 +87,7 @@ test_uncond_jump ()
label));
ASSERT_EQ (SET, jump_pat->code);
ASSERT_EQ (LABEL_REF, SET_SRC (jump_pat)->code);
ASSERT_EQ (label, LABEL_REF_LABEL (SET_SRC (jump_pat)));
ASSERT_EQ (label, label_ref_label (SET_SRC (jump_pat)));
ASSERT_EQ (PC, SET_DEST (jump_pat)->code);
verify_print_pattern ("pc=L0", jump_pat);

View File

@ -424,7 +424,7 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
return (REGNO (x) == REGNO (y));
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
@ -561,7 +561,7 @@ rtx_equal_p (const_rtx x, const_rtx y)
return (REGNO (x) == REGNO (y));
case LABEL_REF:
return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
return label_ref_label (x) == label_ref_label (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);

View File

@ -1767,8 +1767,19 @@ inline void rtx_jump_insn::set_jump_target (rtx_code_label *target)
#define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
/* Get the label that a LABEL_REF references. */
#define LABEL_REF_LABEL(LABREF) XCEXP (LABREF, 0, LABEL_REF)
static inline rtx_insn *
label_ref_label (const_rtx ref)
{
return as_a<rtx_insn *> (XCEXP (ref, 0, LABEL_REF));
}
/* Set the label that LABEL_REF ref refers to. */
static inline void
set_label_ref_label (rtx ref, rtx_insn *label)
{
XCEXP (ref, 0, LABEL_REF) = label;
}
/* For a REG rtx, REGNO extracts the register number. REGNO can only
be used on RHS. Use SET_REGNO to change the value. */

View File

@ -1001,7 +1001,7 @@ reg_mentioned_p (const_rtx reg, const_rtx in)
return 1;
if (GET_CODE (in) == LABEL_REF)
return reg == LABEL_REF_LABEL (in);
return reg == label_ref_label (in);
code = GET_CODE (in);
@ -3085,7 +3085,7 @@ rtx_referenced_p (const_rtx x, const_rtx body)
/* Check if a label_ref Y refers to label X. */
if (GET_CODE (y) == LABEL_REF
&& LABEL_P (x)
&& LABEL_REF_LABEL (y) == x)
&& label_ref_label (y) == x)
return true;
if (rtx_equal_p (x, y))
@ -5547,7 +5547,7 @@ get_condition (rtx_insn *jump, rtx_insn **earliest, int allow_cc_mode,
the condition. */
reverse
= GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
&& LABEL_REF_LABEL (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump);
&& label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump);
return canonicalize_condition (jump, cond, reverse, earliest, NULL_RTX,
allow_cc_mode, valid_at_insn_p);

View File

@ -2983,7 +2983,7 @@ const_hash_1 (const tree exp)
case LABEL_REF:
hi = (value.offset
+ CODE_LABEL_NUMBER (LABEL_REF_LABEL (value.base)) * 13);
+ CODE_LABEL_NUMBER (label_ref_label (value.base)) * 13);
break;
default:
@ -3172,8 +3172,8 @@ compare_constant (const tree t1, const tree t2)
break;
case LABEL_REF:
ret = (CODE_LABEL_NUMBER (LABEL_REF_LABEL (value1.base))
== CODE_LABEL_NUMBER (LABEL_REF_LABEL (value2.base)));
ret = (CODE_LABEL_NUMBER (label_ref_label (value1.base))
== CODE_LABEL_NUMBER (label_ref_label (value2.base)));
break;
default:
@ -3611,7 +3611,7 @@ const_rtx_hash_1 (const_rtx x)
break;
case LABEL_REF:
h = h * 251 + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x));
h = h * 251 + CODE_LABEL_NUMBER (label_ref_label (x));
break;
case UNSPEC:
@ -3893,11 +3893,13 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
/* FALLTHRU */
case LABEL_REF:
tmp = LABEL_REF_LABEL (tmp);
gcc_assert (!as_a<rtx_insn *> (tmp)->deleted ());
gcc_assert (!NOTE_P (tmp)
|| NOTE_KIND (tmp) != NOTE_INSN_DELETED);
break;
{
rtx_insn *insn = label_ref_label (tmp);
gcc_assert (!insn->deleted ());
gcc_assert (!NOTE_P (insn)
|| NOTE_KIND (insn) != NOTE_INSN_DELETED);
break;
}
default:
break;