diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-11 20:47:39 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-11 20:47:39 +0000 |
commit | b49f2e4bb0ee85b8cf91d62ab3c47e9b2723bb79 (patch) | |
tree | 99f089d03c5999d04f7bdff5d44e2a6ef6a2568b | |
parent | fa7d9d71c83133587a26128bf52435f3b1ba4779 (diff) | |
download | gcc-b49f2e4bb0ee85b8cf91d62ab3c47e9b2723bb79.tar.gz |
Introduce LABEL_REF_LABEL
gcc/ChangeLog:
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215190 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 48 | ||||
-rw-r--r-- | gcc/alias.c | 2 | ||||
-rw-r--r-- | gcc/cfgbuild.c | 4 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 2 | ||||
-rw-r--r-- | gcc/cfgrtl.c | 2 | ||||
-rw-r--r-- | gcc/combine.c | 4 | ||||
-rw-r--r-- | gcc/cse.c | 20 | ||||
-rw-r--r-- | gcc/cselib.c | 4 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 4 | ||||
-rw-r--r-- | gcc/explow.c | 2 | ||||
-rw-r--r-- | gcc/final.c | 4 | ||||
-rw-r--r-- | gcc/gcse.c | 6 | ||||
-rw-r--r-- | gcc/genconfig.c | 4 | ||||
-rw-r--r-- | gcc/genrecog.c | 4 | ||||
-rw-r--r-- | gcc/ifcvt.c | 8 | ||||
-rw-r--r-- | gcc/jump.c | 16 | ||||
-rw-r--r-- | gcc/lra-constraints.c | 2 | ||||
-rw-r--r-- | gcc/reload.c | 13 | ||||
-rw-r--r-- | gcc/reload1.c | 6 | ||||
-rw-r--r-- | gcc/reorg.c | 6 | ||||
-rw-r--r-- | gcc/rtl.c | 4 | ||||
-rw-r--r-- | gcc/rtl.h | 4 | ||||
-rw-r--r-- | gcc/rtlanal.c | 8 | ||||
-rw-r--r-- | gcc/sched-vis.c | 2 | ||||
-rw-r--r-- | gcc/varasm.c | 11 |
25 files changed, 123 insertions, 67 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ffd95158f5..c0498fac287 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,51 @@ +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, diff --git a/gcc/alias.c b/gcc/alias.c index 602e9e03a70..a098cb7fb70 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1521,7 +1521,7 @@ rtx_equal_for_memref_p (const_rtx x, const_rtx y) 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); diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index e5ac8d636e7..00dab3e72db 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -277,7 +277,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, - 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 @@ -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 (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)); ) { diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 891630536c8..f95981be6b6 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -3624,7 +3624,7 @@ convert_debug_memory_address (enum machine_mode mode, rtx x, 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: diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index bc6c9651ee2..04c7d63e117 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1202,7 +1202,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 - && 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); diff --git a/gcc/combine.c b/gcc/combine.c index 0ec7f852c47..151e948ab7a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -13403,14 +13403,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 - && 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; diff --git a/gcc/cse.c b/gcc/cse.c index 90b08b62fd1..be2f31bc205 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2349,7 +2349,7 @@ hash_rtx_cb (const_rtx x, enum 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 (XEXP (x, 0))); + + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x))); return hash; case SYMBOL_REF: @@ -2602,7 +2602,7 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse) 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); @@ -3486,7 +3486,7 @@ fold_rtx (rtx x, rtx_insn *insn) : 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. */ @@ -3494,7 +3494,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 - && 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); } @@ -3506,7 +3506,7 @@ fold_rtx (rtx x, rtx_insn *insn) : 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. */ @@ -3514,7 +3514,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 - && 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); } @@ -6374,10 +6374,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 (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; diff --git a/gcc/cselib.c b/gcc/cselib.c index 68d428446c6..d06a1d56d2a 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -961,7 +961,7 @@ rtx_equal_for_cselib_1 (rtx x, rtx y, enum machine_mode memmode) 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 @@ -1167,7 +1167,7 @@ cselib_hash_rtx (rtx x, int create, enum 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 (XEXP (x, 0))); + + CODE_LABEL_NUMBER (LABEL_REF_LABEL (x))); return hash ? hash : (unsigned int) LABEL_REF; case SYMBOL_REF: diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 34bf2717be2..99cd2094ed3 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3584,8 +3584,8 @@ mark_label_nuses (rtx x) 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--) diff --git a/gcc/explow.c b/gcc/explow.c index 91de63996ef..8470691d779 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -357,7 +357,7 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED, 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; diff --git a/gcc/final.c b/gcc/final.c index 9275a487bd8..1b50e74bbf0 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3802,7 +3802,7 @@ output_asm_label (rtx x) 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)) @@ -3892,7 +3892,7 @@ output_addr_const (FILE *file, rtx x) 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)); diff --git a/gcc/gcse.c b/gcc/gcse.c index b7c4788a4f7..15d026b2a56 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -2816,10 +2816,10 @@ add_label_notes (rtx x, rtx 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, 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; } diff --git a/gcc/genconfig.c b/gcc/genconfig.c index d1996c3af5d..ae08d1e21ff 100644 --- a/gcc/genconfig.c +++ b/gcc/genconfig.c @@ -98,8 +98,8 @@ walk_insn_part (rtx part, int recog_p, int non_pc_set_src) 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; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 1f09dd661e8..dbdefb07d19 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -617,10 +617,10 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code) 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: diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 6c801d3b3b7..6bcc23afc10 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -443,7 +443,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 - && 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) @@ -847,7 +847,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 - && 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; @@ -1777,7 +1777,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 - && 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; @@ -2351,7 +2351,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 - && 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 diff --git a/gcc/jump.c b/gcc/jump.c index ef2f9e51551..34466b693e7 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -264,7 +264,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) == 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); @@ -1141,7 +1141,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target) case LABEL_REF: { - rtx label = XEXP (x, 0); + rtx label = LABEL_REF_LABEL (x); /* Ignore remaining references to unreachable labels that have been deleted. */ @@ -1155,7 +1155,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target) 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); @@ -1454,7 +1454,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn) 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); @@ -1467,7 +1467,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 - && XEXP (SET_SRC (x), 0) == olabel) + && LABEL_REF_LABEL (SET_SRC (x)) == olabel) { validate_change (insn, loc, nlabel, 1); return; @@ -1791,12 +1791,12 @@ 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 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); diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index d8489541fa6..5f6839968d6 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -735,7 +735,7 @@ operands_match_p (rtx x, rtx y, int y_hard_regno) 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); diff --git a/gcc/reload.c b/gcc/reload.c index 529cd1401b9..3e563d0041c 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -2321,7 +2321,7 @@ operands_match_p (rtx x, rtx y) 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); @@ -4221,16 +4221,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, - 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)); } } diff --git a/gcc/reload1.c b/gcc/reload1.c index f09f8b731c6..3f3541a8903 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -2358,7 +2358,7 @@ set_label_offsets (rtx x, rtx_insn *insn, int initial_p) if (LABEL_REF_NONLOCAL_P (x)) return; - x = XEXP (x, 0); + x = LABEL_REF_LABEL (x); /* ... fall through ... */ @@ -2460,13 +2460,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 (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; diff --git a/gcc/reorg.c b/gcc/reorg.c index c37ae1e96ca..28401dda849 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -923,20 +923,20 @@ get_branch_condition (const rtx_insn *insn, rtx target) 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; diff --git a/gcc/rtl.c b/gcc/rtl.c index 3363eebdbb6..c61c365ee03 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -422,7 +422,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 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); @@ -559,7 +559,7 @@ rtx_equal_p (const_rtx x, const_rtx y) 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); diff --git a/gcc/rtl.h b/gcc/rtl.h index 56a06e1ade0..aaca3dcff5c 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1673,6 +1673,10 @@ inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn) 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) + /* For a REG rtx, REGNO extracts the register number. REGNO can only be used on RHS. Use SET_REGNO to change the value. */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index d3a3e0277b4..299b8162f5c 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -785,7 +785,7 @@ reg_mentioned_p (const_rtx reg, const_rtx in) return 1; if (GET_CODE (in) == LABEL_REF) - return reg == XEXP (in, 0); + return reg == LABEL_REF_LABEL (in); code = GET_CODE (in); @@ -2847,7 +2847,9 @@ rtx_referenced_p (const_rtx x, const_rtx body) 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)) @@ -5320,7 +5322,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 - && 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); diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c index 1dca799d41f..dabe88025a8 100644 --- a/gcc/sched-vis.c +++ b/gcc/sched-vis.c @@ -468,7 +468,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 (XEXP (x, 0))); + pp_printf (pp, "L%d", INSN_UID (LABEL_REF_LABEL (x))); break; case CONST: case HIGH: diff --git a/gcc/varasm.c b/gcc/varasm.c index de4479ccac9..cd4a2306925 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2922,7 +2922,8 @@ const_hash_1 (const tree exp) 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: @@ -3112,8 +3113,8 @@ compare_constant (const tree t1, const tree t2) 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: @@ -3547,7 +3548,7 @@ const_rtx_hash_1 (const_rtx x) 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: @@ -3835,7 +3836,7 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc, /* 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); |