+2014-09-11 David Malcolm <dmalcolm@redhat.com>
+
+ * rtl.h (LABEL_REF_LABEL): New macro.
+
+ * alias.c (rtx_equal_for_memref_p): Use LABEL_REF_LABEL in place
+ of XEXP (, 0), where we know that we have a LABEL_REF.
+ * 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): 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.
+ * reload.c (operands_match_p): Likewise.
+ (find_reloads): Likewise.
+ * reload1.c (set_label_offsets): Likewise.
+ * reorg.c (get_branch_condition): 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.
+ * sched-vis.c (print_value): Likewise.
+ * varasm.c (const_hash_1): Likewise.
+ (compare_constant): Likewise.
+ (const_rtx_hash_1): Likewise.
+ (output_constant_pool_1): Likewise.
+
2014-09-11 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/htm.md (tabort, tabortdc, tabortdci, tabortwc,
return REGNO (x) == REGNO (y);
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
make_label_edge (edge_cache, bb,
- XEXP (XEXP (SET_SRC (tmp), 2), 0), 0);
+ LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)), 0);
}
/* If this is a computed jump, then mark it as reaching
&& 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 (XEXP (XEXP (SET_SRC (tmp), 2), 0));
+ mark_tablejump_edge (LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)));
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
return SUBREG_REG (x);
break;
case LABEL_REF:
- temp = gen_rtx_LABEL_REF (mode, XEXP (x, 0));
+ 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:
&& SET_DEST (tmp) == pc_rtx
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (tmp), 2), 0) == old_label)
+ && LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)) == old_label)
{
XEXP (SET_SRC (tmp), 2) = gen_rtx_LABEL_REF (Pmode,
new_label);
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
- && XEXP (XEXP (tem_note, 0), 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
- && XEXP (XEXP (tem_note, 0), 0) == XEXP (note, 0))))
+ && LABEL_REF_LABEL (XEXP (tem_note, 0)) == XEXP (note, 0))))
{
if (place)
place2 = i2;
/* 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 (XEXP (x, 0)));
+ + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x)));
return hash;
case SYMBOL_REF:
return x == y;
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
: lookup_as_function (folded_arg0, MINUS);
if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
- && XEXP (XEXP (y, 1), 0) == XEXP (const_arg1, 0))
+ && 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. */
: lookup_as_function (folded_arg0, CONST))) != 0
&& GET_CODE (XEXP (y, 0)) == MINUS
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
- && XEXP (XEXP (XEXP (y, 0), 1), 0) == XEXP (const_arg1, 0))
+ && LABEL_REF_LABEL (XEXP (XEXP (y, 0), 1)) == LABEL_REF_LABEL (const_arg1))
return XEXP (XEXP (y, 0), 0);
}
: lookup_as_function (folded_arg1, MINUS);
if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
- && XEXP (XEXP (y, 1), 0) == XEXP (const_arg0, 0))
+ && 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. */
: lookup_as_function (folded_arg1, CONST))) != 0
&& GET_CODE (XEXP (y, 0)) == MINUS
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
- && XEXP (XEXP (XEXP (y, 0), 1), 0) == XEXP (const_arg0, 0))
+ && LABEL_REF_LABEL (XEXP (XEXP (y, 0), 1)) == LABEL_REF_LABEL (const_arg0))
return XEXP (XEXP (y, 0), 0);
}
if (GET_CODE (x) == LABEL_REF
&& !LABEL_REF_NONLOCAL_P (x)
&& (!JUMP_P (insn)
- || !label_is_jump_target_p (XEXP (x, 0), insn))
- && LABEL_P (XEXP (x, 0))
- && INSN_UID (XEXP (x, 0)) != 0
- && !find_reg_note (insn, REG_LABEL_OPERAND, XEXP (x, 0)))
+ || !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;
return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case MEM:
/* We have to compare any autoinc operations in the addresses
/* 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 (XEXP (x, 0)));
+ + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x)));
return hash ? hash : (unsigned int) LABEL_REF;
case SYMBOL_REF:
const char *fmt;
code = GET_CODE (x);
- if (code == LABEL_REF && LABEL_P (XEXP (x, 0)))
- LABEL_NUSES (XEXP (x, 0))++;
+ 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--)
break;
case LABEL_REF:
- temp = gen_rtx_LABEL_REF (to_mode, XEXP (x, 0));
+ temp = gen_rtx_LABEL_REF (to_mode, LABEL_REF_LABEL (x));
LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x);
return temp;
break;
char buf[256];
if (GET_CODE (x) == LABEL_REF)
- x = XEXP (x, 0);
+ x = LABEL_REF_LABEL (x);
if (LABEL_P (x)
|| (NOTE_P (x)
&& NOTE_KIND (x) == NOTE_INSN_DELETED_LABEL))
break;
case LABEL_REF:
- x = XEXP (x, 0);
+ x = LABEL_REF_LABEL (x);
/* Fall through. */
case CODE_LABEL:
ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
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, XEXP (x, 0));
+ add_reg_note (insn, REG_LABEL_OPERAND, LABEL_REF_LABEL (x));
- if (LABEL_P (XEXP (x, 0)))
- LABEL_NUSES (XEXP (x, 0))++;
+ if (LABEL_P (LABEL_REF_LABEL (x)))
+ LABEL_NUSES (LABEL_REF_LABEL (x))++;
return;
}
break;
case LABEL_REF:
- if (GET_CODE (XEXP (part, 0)) == MATCH_OPERAND
- || GET_CODE (XEXP (part, 0)) == MATCH_DUP)
+ if (GET_CODE (LABEL_REF_LABEL (part)) == MATCH_OPERAND
+ || GET_CODE (LABEL_REF_LABEL (part)) == MATCH_DUP)
break;
return;
return;
case LABEL_REF:
- if (GET_MODE (XEXP (pattern, 0)) != VOIDmode)
+ if (GET_MODE (LABEL_REF_LABEL (pattern)) != VOIDmode)
error_with_line (pattern_lineno,
"operand to label_ref %smode not VOIDmode",
- GET_MODE_NAME (GET_MODE (XEXP (pattern, 0))));
+ GET_MODE_NAME (GET_MODE (LABEL_REF_LABEL (pattern))));
break;
default:
/* If this branches to JUMP_LABEL when the condition is false,
reverse the condition. */
if (GET_CODE (XEXP (test_if, 2)) == LABEL_REF
- && XEXP (XEXP (test_if, 2), 0) == 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)
rtx set = pc_set (if_info->jump);
cond = XEXP (SET_SRC (set), 0);
if (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (set), 2), 0) == 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;
cond = XEXP (SET_SRC (set), 0);
reverse
= GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (set), 2), 0) == 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;
/* If this branches to JUMP_LABEL when the condition is false,
reverse the condition. */
reverse = (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (set), 2), 0) == 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
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) == XEXP (SET_SRC (label_set), 0));
+ gcc_assert (XEXP (label_note, 0) == LABEL_REF_LABEL (SET_SRC (label_set)));
mark_jump_label_1 (label_set, jump_insn, false, true);
case LABEL_REF:
{
- rtx label = XEXP (x, 0);
+ rtx label = LABEL_REF_LABEL (x);
/* Ignore remaining references to unreachable labels that
have been deleted. */
if (LABEL_REF_NONLOCAL_P (x))
break;
- XEXP (x, 0) = label;
+ LABEL_REF_LABEL (x) = label;
if (! insn || ! INSN_DELETED_P (insn))
++LABEL_NUSES (label);
int i;
const char *fmt;
- if ((code == LABEL_REF && XEXP (x, 0) == olabel)
+ if ((code == LABEL_REF && LABEL_REF_LABEL (x) == olabel)
|| x == olabel)
{
x = redirect_target (nlabel);
if (code == SET && SET_DEST (x) == pc_rtx
&& ANY_RETURN_P (nlabel)
&& GET_CODE (SET_SRC (x)) == LABEL_REF
- && XEXP (SET_SRC (x), 0) == olabel)
+ && LABEL_REF_LABEL (SET_SRC (x)) == olabel)
{
validate_change (insn, loc, nlabel, 1);
return;
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 XEXP (x, 0) == XEXP (y, 0);
+ 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. */
- return (next_real_insn (XEXP (x, 0))
- == next_real_insn (XEXP (y, 0)));
+ return (next_real_insn (LABEL_REF_LABEL (x))
+ == next_real_insn (LABEL_REF_LABEL (y)));
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
return false;
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
return 0;
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
this instruction. */
if (GET_CODE (substitution) == LABEL_REF
&& !find_reg_note (insn, REG_LABEL_OPERAND,
- XEXP (substitution, 0))
+ 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 (XEXP (substitution, 0),
+ || !label_is_jump_target_p (LABEL_REF_LABEL (substitution),
insn)))
{
- add_reg_note (insn, REG_LABEL_OPERAND, XEXP (substitution, 0));
- if (LABEL_P (XEXP (substitution, 0)))
- ++LABEL_NUSES (XEXP (substitution, 0));
+ add_reg_note (insn, REG_LABEL_OPERAND,
+ LABEL_REF_LABEL (substitution));
+ if (LABEL_P (LABEL_REF_LABEL (substitution)))
+ ++LABEL_NUSES (LABEL_REF_LABEL (substitution));
}
}
if (LABEL_REF_NONLOCAL_P (x))
return;
- x = XEXP (x, 0);
+ x = LABEL_REF_LABEL (x);
/* ... fall through ... */
case IF_THEN_ELSE:
tem = XEXP (SET_SRC (x), 1);
if (GET_CODE (tem) == LABEL_REF)
- set_label_offsets (XEXP (tem, 0), 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 (XEXP (tem, 0), 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;
return 0;
src = SET_SRC (pat);
- if (GET_CODE (src) == LABEL_REF && XEXP (src, 0) == 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
- && XEXP (XEXP (src, 1), 0) == 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
- && XEXP (XEXP (src, 2), 0) == target)
+ && LABEL_REF_LABEL (XEXP (src, 2)) == target)
|| (ANY_RETURN_P (XEXP (src, 2)) && XEXP (src, 2) == target)))
{
enum rtx_code rev;
return (REGNO (x) == REGNO (y));
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
return (REGNO (x) == REGNO (y));
case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
+ return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
goes through all the LABEL_REFs that jump to that label. The chain
eventually winds up at the CODE_LABEL: it is circular. */
#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)
+
\f
/* For a REG rtx, REGNO extracts the register number. REGNO can only
be used on RHS. Use SET_REGNO to change the value. */
return 1;
if (GET_CODE (in) == LABEL_REF)
- return reg == XEXP (in, 0);
+ return reg == LABEL_REF_LABEL (in);
code = GET_CODE (in);
if (const_rtx y = *iter)
{
/* Check if a label_ref Y refers to label X. */
- if (GET_CODE (y) == LABEL_REF && LABEL_P (x) && XEXP (y, 0) == x)
+ if (GET_CODE (y) == LABEL_REF
+ && LABEL_P (x)
+ && LABEL_REF_LABEL (y) == x)
return true;
if (rtx_equal_p (x, y))
the condition. */
reverse
= GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (set), 2), 0) == 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);
pp_printf (pp, "`%s'", XSTR (x, 0));
break;
case LABEL_REF:
- pp_printf (pp, "L%d", INSN_UID (XEXP (x, 0)));
+ pp_printf (pp, "L%d", INSN_UID (LABEL_REF_LABEL (x)));
break;
case CONST:
case HIGH:
break;
case LABEL_REF:
- hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13;
+ hi = (value.offset
+ + CODE_LABEL_NUMBER (LABEL_REF_LABEL (value.base)) * 13);
break;
default:
break;
case LABEL_REF:
- ret = (CODE_LABEL_NUMBER (XEXP (value1.base, 0))
- == CODE_LABEL_NUMBER (XEXP (value2.base, 0)));
+ ret = (CODE_LABEL_NUMBER (LABEL_REF_LABEL (value1.base))
+ == CODE_LABEL_NUMBER (LABEL_REF_LABEL (value2.base)));
break;
default:
break;
case LABEL_REF:
- h = h * 251 + CODE_LABEL_NUMBER (XEXP (x, 0));
+ h = h * 251 + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x));
break;
case UNSPEC:
/* FALLTHRU */
case LABEL_REF:
- tmp = XEXP (tmp, 0);
+ tmp = LABEL_REF_LABEL (tmp);
gcc_assert (!INSN_DELETED_P (tmp));
gcc_assert (!NOTE_P (tmp)
|| NOTE_KIND (tmp) != NOTE_INSN_DELETED);