From: Trevor Saunders <[email protected]>

gcc/ChangeLog:

        * config/arc/arc.cc (arc_output_pic_addr_const): Use
        label_ref_label instead of XEXP.
        * config/arm/arm.cc (arm_final_prescan_insn): Likewise.
        * config/avr/avr.cc (avr_output_addr_vec): Likewise.
        * config/cris/cris.cc (cris_asm_output_case_end): Likewise.
        * config/m68k/m68k.cc (print_operand_address): Likewise.
        * config/mcore/mcore.cc (conditionalize_block): Likewise.
        * config/pa/pa.cc (pa_output_addr_vec, pa_output_addr_diff_vec):
        Likewise.
        * config/pdp11/pdp11.cc (output_addr_const_pdp11): Likewise.
        * config/rs6000/rs6000.cc (output_toc): Likewise.
        * config/sparc/sparc.cc (sparc_output_addr_vec,
        sparc_output_addr_diff_vec): Likewise.
        * final.cc (final_scan_insn_1): Likewise.

Signed-off-by: Trevor Saunders <[email protected]>
---
 gcc/config/arc/arc.cc       |  3 ++-
 gcc/config/arm/arm.cc       | 11 ++++++-----
 gcc/config/avr/avr.cc       |  2 +-
 gcc/config/cris/cris.cc     |  4 ++--
 gcc/config/m68k/m68k.cc     |  2 +-
 gcc/config/mcore/mcore.cc   |  6 ++++--
 gcc/config/pa/pa.cc         |  7 ++++---
 gcc/config/pdp11/pdp11.cc   |  3 ++-
 gcc/config/rs6000/rs6000.cc |  2 +-
 gcc/config/sparc/sparc.cc   |  7 ++++---
 gcc/final.cc                |  8 +++++---
 11 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index 3b4cc342b1c..0f7684fe189 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -6308,7 +6308,8 @@ arc_output_pic_addr_const (FILE * file, rtx x, int code)
       break;
 
     case LABEL_REF:
-      ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
+      ASM_GENERATE_INTERNAL_LABEL (buf, "L",
+                                  CODE_LABEL_NUMBER (label_ref_label (x)));
       assemble_name (file, buf);
       break;
 
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 2a8254c366e..c96eef96dea 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -24544,19 +24544,19 @@ arm_final_prescan_insn (rtx_insn *insn)
       /* Flag which part of the IF_THEN_ELSE is the LABEL_REF.  */
       int then_not_else = TRUE;
       rtx_insn *this_insn = start_insn;
-      rtx label = 0;
+      rtx_insn *label = 0;
 
       /* Register the insn jumped to.  */
       if (reverse)
         {
          if (!seeking_return)
-           label = XEXP (SET_SRC (body), 0);
+           label = label_ref_label (SET_SRC (body));
         }
       else if (GET_CODE (XEXP (SET_SRC (body), 1)) == LABEL_REF)
-       label = XEXP (XEXP (SET_SRC (body), 1), 0);
+       label = label_ref_label (XEXP (SET_SRC (body), 1));
       else if (GET_CODE (XEXP (SET_SRC (body), 2)) == LABEL_REF)
        {
-         label = XEXP (XEXP (SET_SRC (body), 2), 0);
+         label = label_ref_label (XEXP (SET_SRC (body), 2));
          then_not_else = FALSE;
        }
       else if (ANY_RETURN_P (XEXP (SET_SRC (body), 1)))
@@ -24654,7 +24654,8 @@ arm_final_prescan_insn (rtx_insn *insn)
                  && GET_CODE (SET_DEST (scanbody)) == PC)
                {
                  if (GET_CODE (SET_SRC (scanbody)) == LABEL_REF
-                     && XEXP (SET_SRC (scanbody), 0) == label && !reverse)
+                     && label_ref_label (SET_SRC (scanbody)) == label
+                     && !reverse)
                    {
                      arm_ccfsm_state = 2;
                      succeed = TRUE;
diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index 184c370d2ca..ff5dc76ff1c 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -14910,7 +14910,7 @@ avr_output_addr_vec (rtx_insn *labl, rtx table)
 
   for (int idx = 0; idx < vlen; idx++)
     {
-      int value = CODE_LABEL_NUMBER (XEXP (XVECEXP (table, 0, idx), 0));
+      int value = CODE_LABEL_NUMBER (label_ref_label (XVECEXP (table, 0, 
idx)));
 
       if (AVR_HAVE_JMP_CALL)
        fprintf (stream, "\t.word gs(.L%d)\n", value);
diff --git a/gcc/config/cris/cris.cc b/gcc/config/cris/cris.cc
index de425f68cad..c3cb47b3010 100644
--- a/gcc/config/cris/cris.cc
+++ b/gcc/config/cris/cris.cc
@@ -2311,10 +2311,10 @@ cris_asm_output_case_end (FILE *stream, int num, 
rtx_insn *table)
 
   asm_fprintf (stream,
               "\t.word %LL%d-%LL%d%s\n",
-              CODE_LABEL_NUMBER (XEXP
+              CODE_LABEL_NUMBER (label_ref_label
                                  (XEXP
                                   (XEXP (XVECEXP (whole_jump_pat, 0, 0), 1),
-                                   2), 0)),
+                                   2))),
               num,
               (TARGET_PDEBUG ? "; default" : ""));
 }
diff --git a/gcc/config/m68k/m68k.cc b/gcc/config/m68k/m68k.cc
index 8291a58073f..135da62395d 100644
--- a/gcc/config/m68k/m68k.cc
+++ b/gcc/config/m68k/m68k.cc
@@ -5312,7 +5312,7 @@ print_operand_address (FILE *file, rtx addr)
       labelno = (address.offset
                 && !address.base
                 && GET_CODE (address.offset) == LABEL_REF
-                ? CODE_LABEL_NUMBER (XEXP (address.offset, 0))
+                ? CODE_LABEL_NUMBER (label_ref_label (address.offset))
                 : -1);
       if (MOTOROLA)
        {
diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc
index b90ca730a1a..d9e18974168 100644
--- a/gcc/config/mcore/mcore.cc
+++ b/gcc/config/mcore/mcore.cc
@@ -2494,14 +2494,16 @@ conditionalize_block (rtx_insn *first)
   if (GET_CODE (XEXP (XEXP (br_pat, 1), 1)) == LABEL_REF)
     {
       /* A normal branch, so extract label out of first arm.  */
-      br_lab_num = CODE_LABEL_NUMBER (XEXP (XEXP (XEXP (br_pat, 1), 1), 0));
+      br_lab_num = CODE_LABEL_NUMBER
+       (label_ref_label (XEXP (XEXP (br_pat, 1), 1)));
     }
   else
     {
       /* An inverse branch, so extract the label out of the 2nd arm
         and complement the condition.  */
       cond = (cond == 0);
-      br_lab_num = CODE_LABEL_NUMBER (XEXP (XEXP (XEXP (br_pat, 1), 2), 0));
+      br_lab_num = CODE_LABEL_NUMBER
+       (label_ref_label (XEXP (XEXP (br_pat, 1), 2)));
     }
 
   /* Scan forward for the start of block 2: it must start with a
diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index 9a0e0c8910c..dba51d6baa6 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -11413,7 +11413,8 @@ pa_output_addr_vec (rtx lab, rtx body)
   for (idx = 0; idx < vlen; idx++)
     {
       ASM_OUTPUT_ADDR_VEC_ELT
-       (asm_out_file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
+       (asm_out_file,
+        CODE_LABEL_NUMBER (label_ref_label (XVECEXP (body, 0, idx))));
     }
   if (TARGET_GAS)
     fputs ("\t.end_brtab\n", asm_out_file);
@@ -11424,7 +11425,7 @@ pa_output_addr_vec (rtx lab, rtx body)
 void
 pa_output_addr_diff_vec (rtx lab, rtx body)
 {
-  rtx base = XEXP (XEXP (body, 0), 0);
+  rtx_insn *base = label_ref_label (XEXP (body, 0));
   int idx, vlen = XVECLEN (body, 1);
 
   targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (lab));
@@ -11435,7 +11436,7 @@ pa_output_addr_diff_vec (rtx lab, rtx body)
       ASM_OUTPUT_ADDR_DIFF_ELT
        (asm_out_file,
         body,
-        CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
+        CODE_LABEL_NUMBER (label_ref_label (XVECEXP (body, 1, idx))),
         CODE_LABEL_NUMBER (base));
     }
   if (TARGET_GAS)
diff --git a/gcc/config/pdp11/pdp11.cc b/gcc/config/pdp11/pdp11.cc
index e34064ffa41..1ca26c47110 100644
--- a/gcc/config/pdp11/pdp11.cc
+++ b/gcc/config/pdp11/pdp11.cc
@@ -1805,7 +1805,8 @@ output_addr_const_pdp11 (FILE *file, rtx x)
       break;
 
     case LABEL_REF:
-      ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
+      ASM_GENERATE_INTERNAL_LABEL (buf, "L",
+                                  CODE_LABEL_NUMBER (label_ref_label (x)));
       assemble_name (file, buf);
       break;
 
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 9581d122a9d..023e5e42aab 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -17940,7 +17940,7 @@ output_toc (FILE *file, rtx x, int labelno, 
machine_mode mode)
 
     case LABEL_REF:
       ASM_GENERATE_INTERNAL_LABEL (buf, "L",
-                                  CODE_LABEL_NUMBER (XEXP (base, 0)));
+                                  CODE_LABEL_NUMBER (label_ref_label (base)));
       break;
 
     case CODE_LABEL:
diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc
index ae98509bddf..6fef98195c1 100644
--- a/gcc/config/sparc/sparc.cc
+++ b/gcc/config/sparc/sparc.cc
@@ -10478,7 +10478,8 @@ sparc_output_addr_vec (rtx vec)
   for (idx = 0; idx < vlen; idx++)
     {
       ASM_OUTPUT_ADDR_VEC_ELT
-       (asm_out_file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
+       (asm_out_file,
+        CODE_LABEL_NUMBER (label_ref_label (XVECEXP (body, 0, idx))));
     }
 
 #ifdef ASM_OUTPUT_ADDR_VEC_END
@@ -10490,7 +10491,7 @@ static void
 sparc_output_addr_diff_vec (rtx vec)
 {
   rtx lab = XEXP (vec, 0), body = XEXP (vec, 1);
-  rtx base = XEXP (XEXP (body, 0), 0);
+  rtx_insn *base = label_ref_label (XEXP (body, 0));
   int idx, vlen = XVECLEN (body, 1);
 
 #ifdef ASM_OUTPUT_ADDR_VEC_START
@@ -10509,7 +10510,7 @@ sparc_output_addr_diff_vec (rtx vec)
       ASM_OUTPUT_ADDR_DIFF_ELT
         (asm_out_file,
          body,
-         CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
+        CODE_LABEL_NUMBER (label_ref_label (XVECEXP (body, 1, idx))),
          CODE_LABEL_NUMBER (base));
     }
 
diff --git a/gcc/final.cc b/gcc/final.cc
index 1ca754146e4..aeb76fb3bce 100644
--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -2543,7 +2543,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
                  {
 #ifdef ASM_OUTPUT_ADDR_VEC_ELT
                    ASM_OUTPUT_ADDR_VEC_ELT
-                     (file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 
0)));
+                     (file, CODE_LABEL_NUMBER
+                      (label_ref_label (XVECEXP (body, 0, idx))));
 #else
                    gcc_unreachable ();
 #endif
@@ -2554,8 +2555,9 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
                    ASM_OUTPUT_ADDR_DIFF_ELT
                      (file,
                       body,
-                      CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
-                      CODE_LABEL_NUMBER (XEXP (XEXP (body, 0), 0)));
+                      CODE_LABEL_NUMBER
+                      (label_ref_label (XVECEXP (body, 1, idx))),
+                      CODE_LABEL_NUMBER (label_ref_label (XEXP (body, 0))));
 #else
                    gcc_unreachable ();
 #endif
-- 
2.53.0

Reply via email to