This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Associate a name with a CODE_LABEL
- To: rth at cygnus dot com
- Subject: [patch] Associate a name with a CODE_LABEL
- From: Catherine Moore <clm at cygnus dot com>
- Date: Wed, 03 Nov 1999 09:40:13 -0800
- cc: gcc-patches at gcc dot gnu dot org
This patch adds an alternate name field to a CODE_LABEL.
If a CODE_LABEL has a name associated with it, use the
name instead of an internal label.
Okay to commit?
ChangeLog:
* rtl.h (LABEL_ALTERNATE_NAME): Define.
* emit-rtl.c (gen_label_rtx): Initialize LABEL_ALTERNATE_NAME.
* final.c (final_scan_insn): Emit LABEL_ALTERNATE_NAME.
* jump.c (delete_unreferenced_labels): Don't delete a CODE_LABEL
if it's got a name.
* print-rtl.c (print-rtx): DUMP LABEL_ALTERNATE_NAME.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/emit-rtl.c,v
retrieving revision 1.143
diff -p -r1.143 emit-rtl.c
*** emit-rtl.c 1999/10/11 11:55:38 1.143
--- emit-rtl.c 1999/11/03 16:56:08
*************** gen_label_rtx ()
*** 1531,1536 ****
--- 1531,1537 ----
NULL_RTX, label_num++, NULL_PTR);
LABEL_NUSES (label) = 0;
+ LABEL_ALTERNATE_NAME (label) = NULL_RTX;
return label;
}
Index: final.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/final.c,v
retrieving revision 1.184
diff -p -r1.184 final.c
*** final.c 1999/10/05 08:05:13 1.184
--- final.c 1999/11/03 16:56:23
*************** final_scan_insn (insn, file, optimize, p
*** 2477,2490 ****
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
NEXT_INSN (insn));
#else
! ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
#endif
#endif
break;
}
}
!
! ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
break;
default:
--- 2477,2495 ----
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
NEXT_INSN (insn));
#else
! if (LABEL_ALTERNATE_NAME (insn))
! ASM_OUTPUT_ALTERNATE_LABEL_NAME (file, insn);
! else
! ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
#endif
#endif
break;
}
}
! if (LABEL_ALTERNATE_NAME (insn))
! ASM_OUTPUT_ALTERNATE_LABEL_NAME (file, insn);
! else
! ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
break;
default:
Index: jump.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/jump.c,v
retrieving revision 1.162
diff -p -r1.162 jump.c
*** jump.c 1999/10/26 06:53:09 1.162
--- jump.c 1999/11/03 16:56:47
*************** delete_unreferenced_labels (f)
*** 2546,2552 ****
for (insn = f; insn; )
{
! if (GET_CODE (insn) == CODE_LABEL && LABEL_NUSES (insn) == 0)
insn = delete_insn (insn);
else
{
--- 2546,2554 ----
for (insn = f; insn; )
{
! if (GET_CODE (insn) == CODE_LABEL
! && LABEL_NUSES (insn) == 0
! && LABEL_ALTERNATE_NAME (insn) == NULL_RTX)
insn = delete_insn (insn);
else
{
Index: print-rtl.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/print-rtl.c,v
retrieving revision 1.46
diff -p -r1.46 print-rtl.c
*** print-rtl.c 1999/10/15 21:27:32 1.46
--- print-rtl.c 1999/11/03 16:56:49
*************** print_rtx (in_rtx)
*** 354,360 ****
#endif
if (GET_CODE (in_rtx) == CODE_LABEL)
! fprintf (outfile, " [num uses: %d]", LABEL_NUSES (in_rtx));
if (dump_for_graph
&& (is_insn || GET_CODE (in_rtx) == NOTE
--- 354,363 ----
#endif
if (GET_CODE (in_rtx) == CODE_LABEL)
! {
! fprintf (outfile, " [num uses: %d]", LABEL_NUSES (in_rtx));
! fprintf (outfile, " [alternate name: %s]", LABEL_ALTERNATE_NAME (in_rtx));
! }
if (dump_for_graph
&& (is_insn || GET_CODE (in_rtx) == NOTE
Index: rtl.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/rtl.h,v
retrieving revision 1.143
diff -p -r1.143 rtl.h
*** rtl.h 1999/11/03 08:10:29 1.143
--- rtl.h 1999/11/03 16:56:59
*************** extern const char * const note_insn_name
*** 611,616 ****
--- 611,619 ----
of LABEL_REFs that point at it, so unused labels can be deleted. */
#define LABEL_NUSES(RTX) XCINT(RTX, 5, CODE_LABEL)
+ /* Associate a name with a CODE_LABEL. */
+ #define LABEL_ALTERNATE_NAME(RTX) XCSTR(RTX, 7, CODE_LABEL)
+
/* The original regno this ADDRESSOF was built for. */
#define ADDRESSOF_REGNO(RTX) XCINT(RTX, 1, ADDRESSOF)