aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-07-19 23:11:19 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-07-19 23:11:19 +0000
commit0dc36574afc7846defc8751c3e19e4c994e0de4a (patch)
tree4677dbe754062a2b5c3b9130edc8bd83740a6f96 /gcc
parent59267987dbc7bc330557f4fdfdb574fc797f6c84 (diff)
downloadgcc-0dc36574afc7846defc8751c3e19e4c994e0de4a.zip
gcc-0dc36574afc7846defc8751c3e19e4c994e0de4a.tar.gz
gcc-0dc36574afc7846defc8751c3e19e4c994e0de4a.tar.bz2
rtl.def (CODE_LABEL): Remove slot 8.
* rtl.def (CODE_LABEL): Remove slot 8. * rtl.h (struct rtx_def): Document new uses of jump and call fields. (LABEL_ALTERNATE_NAME): Delete. (LABEL_KIND, SET_LABEL_KIND, LABEL_ALT_ENTRY_P): New. * defaults.h: Remove default for ASM_OUTPUT_ALTERNATE_LABEL_NAME. * final.c (output_alternate_entry_point): New. (final_scan_insn): Use it instead of ASM_OUTPUT_ALTERNATE_LABEL_NAME. Do not consider possibility of a case label being an alternate entry point. * cfgbuild.c (make_edges, find_bb_boundaries): Use LABEL_ALT_ENTRY_P. * emit-rtl.c (gen_label_rtx): Adjust call to gen_rtx_CODE_LABEL. Do not clear LABEL_NUSES (unnecessary) or LABEL_ALTERNATE_NAME (field deleted). * print-rtl.c, ra-debug.c: Update code to output CODE_LABELs. * doc/rtl.texi: Document LABEL_KIND, SET_LABEL_KIND, and LABEL_ALT_ENTRY_P; not LABEL_ALTERNATE_NAME. * doc/tm.texi: Delete documentation of ASM_OUTPUT_ALTERNATE_LABEL_NAME. From-SVN: r55597
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog24
-rw-r--r--gcc/cfgbuild.c4
-rw-r--r--gcc/defaults.h6
-rw-r--r--gcc/doc/rtl.texi29
-rw-r--r--gcc/doc/tm.texi11
-rw-r--r--gcc/emit-rtl.c10
-rw-r--r--gcc/final.c41
-rw-r--r--gcc/print-rtl.c11
-rw-r--r--gcc/ra-debug.c10
-rw-r--r--gcc/rtl.def7
-rw-r--r--gcc/rtl.h56
11 files changed, 158 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e8b734..69403e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,27 @@
+2002-07-19 Zack Weinberg <zack@codesourcery.com>
+
+ * rtl.def (CODE_LABEL): Remove slot 8.
+ * rtl.h (struct rtx_def): Document new uses of jump and call fields.
+ (LABEL_ALTERNATE_NAME): Delete.
+ (LABEL_KIND, SET_LABEL_KIND, LABEL_ALT_ENTRY_P): New.
+ * defaults.h: Remove default for ASM_OUTPUT_ALTERNATE_LABEL_NAME.
+
+ * final.c (output_alternate_entry_point): New.
+ (final_scan_insn): Use it instead of
+ ASM_OUTPUT_ALTERNATE_LABEL_NAME. Do not consider possibility
+ of a case label being an alternate entry point.
+
+ * cfgbuild.c (make_edges, find_bb_boundaries): Use LABEL_ALT_ENTRY_P.
+ * emit-rtl.c (gen_label_rtx): Adjust call to gen_rtx_CODE_LABEL.
+ Do not clear LABEL_NUSES (unnecessary) or LABEL_ALTERNATE_NAME
+ (field deleted).
+ * print-rtl.c, ra-debug.c: Update code to output CODE_LABELs.
+
+ * doc/rtl.texi: Document LABEL_KIND, SET_LABEL_KIND, and
+ LABEL_ALT_ENTRY_P; not LABEL_ALTERNATE_NAME.
+ * doc/tm.texi: Delete documentation of
+ ASM_OUTPUT_ALTERNATE_LABEL_NAME.
+
2002-07-19 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/mips/iris5gas.h (DWARF2_DEBUGGING_INFO): Define.
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 8b7b705..12dd200 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -321,7 +321,7 @@ make_edges (label_value_list, min, max, update_p)
enum rtx_code code;
int force_fallthru = 0;
- if (GET_CODE (bb->head) == CODE_LABEL && LABEL_ALTERNATE_NAME (bb->head))
+ if (GET_CODE (bb->head) == CODE_LABEL && LABEL_ALT_ENTRY_P (bb->head))
cached_make_edge (NULL, ENTRY_BLOCK_PTR, bb, 0);
/* Examine the last instruction of the block, and discover the
@@ -699,7 +699,7 @@ find_bb_boundaries (bb)
bb = fallthru->dest;
remove_edge (fallthru);
flow_transfer_insn = NULL_RTX;
- if (LABEL_ALTERNATE_NAME (insn))
+ if (LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR, bb, 0);
}
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 3bbf231..5b88ac2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -80,12 +80,6 @@ do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
} while (0)
#endif
-/* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME. */
-#ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
-#define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
-do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
-#endif
-
/* choose a reasonable default for ASM_OUTPUT_ASCII. */
#ifndef ASM_OUTPUT_ASCII
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 5894910..4276374 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -2830,13 +2830,32 @@ Besides as a @code{code_label}, a label can also be represented as a
@findex LABEL_NUSES
The field @code{LABEL_NUSES} is only defined once the jump optimization
-phase is completed and contains the number of times this label is
+phase is completed. It contains the number of times this label is
referenced in the current function.
-@findex LABEL_ALTERNATE_NAME
-The field @code{LABEL_ALTERNATE_NAME} is used to associate a name with
-a @code{code_label}. If this field is defined, the alternate name will
-be emitted instead of an internally generated label name.
+@findex LABEL_KIND
+@findex SET_LABEL_KIND
+@findex LABEL_ALT_ENTRY_P
+@cindex alternate entry points
+The field @code{LABEL_KIND} differentiates four different types of
+labels: @code{LABEL_NORMAL}, @code{LABEL_STATIC_ENTRY},
+@code{LABEL_GLOBAL_ENTRY}, and @code{LABEL_WEAK_ENTRY}. The only labels
+that do not have type @code{LABEL_NORMAL} are @dfn{alternate entry
+points} to the current function. These may be static (visible only in
+the containing translation unit), global (exposed to all translation
+units), or weak (global, but can be overriden by another symbol with the
+same name).
+
+Much of the compiler treats all four kinds of label identically. Some
+of it needs to know whether or not a label is an alternate entry point;
+for this purpose, the macro @code{LABEL_ALT_ENTRY_P} is provided. It is
+equivalent to testing whether @samp{LABEL_KIND (label) == LABEL_NORMAL}.
+The only place that cares about the distinction between static, global,
+and weak alternate entry points, besides the front-end code that creates
+them, is the function @code{output_alternate_entry_point}, in
+@file{final.c}.
+
+To set the kind of a label, use the @code{SET_LABEL_KIND} macro.
@findex barrier
@item barrier
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 17d0d13..0892a05 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -6597,17 +6597,6 @@ bundles.
If this macro is not defined, then @code{ASM_OUTPUT_INTERNAL_LABEL} will be
used.
-@findex ASM_OUTPUT_ALTERNATE_LABEL_NAME
-@item ASM_OUTPUT_ALTERNATE_LABEL_NAME (@var{stream}, @var{string})
-A C statement to output to the stdio stream @var{stream} the string
-@var{string}.
-
-The default definition of this macro is as follows:
-
-@example
-fprintf (@var{stream}, "%s:\n", LABEL_ALTERNATE_NAME (INSN))
-@end example
-
@findex ASM_GENERATE_INTERNAL_LABEL
@item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
A C statement to store into the string @var{string} a label whose name
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index eedea4a..af537d2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2185,14 +2185,8 @@ widen_memory_access (memref, mode, offset)
rtx
gen_label_rtx ()
{
- rtx label;
-
- label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
- NULL, label_num++, NULL, NULL);
-
- LABEL_NUSES (label) = 0;
- LABEL_ALTERNATE_NAME (label) = NULL;
- return label;
+ return gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
+ NULL, label_num++, NULL);
}
/* For procedure integration. */
diff --git a/gcc/final.c b/gcc/final.c
index 3b3dfcd..e0b3860 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -222,6 +222,7 @@ static void profile_after_prologue PARAMS ((FILE *));
static void notice_source_line PARAMS ((rtx));
static rtx walk_alter_subreg PARAMS ((rtx *));
static void output_asm_name PARAMS ((void));
+static void output_alternate_entry_point PARAMS ((FILE *, rtx));
static tree get_mem_expr_from_op PARAMS ((rtx, int *));
static void output_asm_operand_names PARAMS ((rtx *, int *, int));
static void output_operand PARAMS ((rtx, int));
@@ -1952,6 +1953,37 @@ get_insn_template (code, insn)
}
}
+/* Emit the appropriate declaration for an alternate-entry-point
+ symbol represented by INSN, to FILE. INSN is a CODE_LABEL with
+ LABEL_KIND != LABEL_NORMAL.
+
+ The case fall-through in this function is intentional. */
+static void
+output_alternate_entry_point (file, insn)
+ FILE *file;
+ rtx insn;
+{
+ const char *name = LABEL_NAME (insn);
+
+ switch (LABEL_KIND (insn))
+ {
+ case LABEL_WEAK_ENTRY:
+#ifdef ASM_WEAKEN_LABEL
+ ASM_WEAKEN_LABEL (file, name);
+#endif
+ case LABEL_GLOBAL_ENTRY:
+ ASM_GLOBALIZE_LABEL (file, name);
+ case LABEL_STATIC_ENTRY:
+ /* FIXME output a .type directive here if appropriate. */
+ ASM_OUTPUT_LABEL (file, name);
+ break;
+
+ case LABEL_NORMAL:
+ default:
+ abort ();
+ }
+}
+
/* The final scan for one insn, INSN.
Args are same as in `final', except that INSN
is the insn being scanned.
@@ -2242,17 +2274,14 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
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));
+ 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);
+ if (LABEL_ALT_ENTRY_P (insn))
+ output_alternate_entry_point (file, insn);
else
ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
break;
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index a6fedf6..15538052 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -526,9 +526,14 @@ print_rtx (in_rtx)
case CODE_LABEL:
fprintf (outfile, " [%d uses]", LABEL_NUSES (in_rtx));
- if (LABEL_ALTERNATE_NAME (in_rtx))
- fprintf (outfile, " [alternate name: %s]",
- LABEL_ALTERNATE_NAME (in_rtx));
+ switch (LABEL_KIND (in_rtx))
+ {
+ case LABEL_NORMAL: break;
+ case LABEL_STATIC_ENTRY: fputs (" [entry]", outfile); break;
+ case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", outfile); break;
+ case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
+ default: abort();
+ }
break;
case CALL_PLACEHOLDER:
diff --git a/gcc/ra-debug.c b/gcc/ra-debug.c
index 239778a..fd8c8d4 100644
--- a/gcc/ra-debug.c
+++ b/gcc/ra-debug.c
@@ -381,8 +381,14 @@ ra_print_rtx (file, x, with_pn)
fprintf (file, "L%d:\t; ", CODE_LABEL_NUMBER (x));
if (LABEL_NAME (x))
fprintf (file, "(%s) ", LABEL_NAME (x));
- if (LABEL_ALTERNATE_NAME (x))
- fprintf (file, "(alternate: %s) ", LABEL_ALTERNATE_NAME (x));
+ switch (LABEL_KIND (x))
+ {
+ case LABEL_NORMAL: break;
+ case LABEL_STATIC_ENTRY: fputs (" (entry)", file); break;
+ case LABEL_GLOBAL_ENTRY: fputs (" (global entry)", file); break;
+ case LABEL_WEAK_ENTRY: fputs (" (weak entry)", file); break;
+ default: abort();
+ }
fprintf (file, " [%d uses] uid=(", LABEL_NUSES (x));
}
fprintf (file, "%d", INSN_UID (x));
diff --git a/gcc/rtl.def b/gcc/rtl.def
index 1acbf98..2934188 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -573,10 +573,9 @@ DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
4: is used in jump.c for the use-count of the label.
5: is used in flow.c to point to the chain of label_ref's to this label.
6: is a number that is unique in the entire compilation.
- 7: is the user-given name of the label, if any.
- 8: is the alternate label name. */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00iss", 'x')
-
+ 7: is the user-given name of the label, if any. */
+DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", 'x')
+
/* Say where in the code a source line starts, for symbol table's sake.
Operand:
4: filename, if line number > 0, note-specific data otherwise.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 31032b6..9490dd7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -130,9 +130,10 @@ struct rtx_def
/* 1 in a MEM if we should keep the alias set for this mem unchanged
when we access a component.
1 in a CALL_INSN if it is a sibling call.
- 1 in a SET that is for a return. */
+ 1 in a SET that is for a return.
+ In a CODE_LABEL, part of the two-bit alternate entry field. */
unsigned int jump : 1;
- /* This flag is currently unused. */
+ /* In a CODE_LABEL, part of the two-bit alternate entry field. */
unsigned int call : 1;
/* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
1 in a SUBREG if it references an unsigned object whose mode has been
@@ -876,8 +877,55 @@ extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
of LABEL_REFs that point at it, so unused labels can be deleted. */
#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
-/* Associate a name with a CODE_LABEL. */
-#define LABEL_ALTERNATE_NAME(RTX) XCSTR (RTX, 8, CODE_LABEL)
+/* Labels carry a two-bit field composed of the ->jump and ->call
+ bits. This field indicates whether the label is an alternate
+ entry point, and if so, what kind. */
+enum label_kind
+{
+ LABEL_NORMAL = 0, /* ordinary label */
+ LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
+ LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
+ LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
+};
+
+#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
+
+/* Retrieve the kind of LABEL. */
+#define LABEL_KIND(LABEL) __extension__ \
+({ rtx const _label = (LABEL); \
+ if (GET_CODE (_label) != CODE_LABEL) \
+ rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ (enum label_kind) ((_label->jump << 1) | _label->call); })
+
+/* Set the kind of LABEL. */
+#define SET_LABEL_KIND(LABEL, KIND) do { \
+ rtx _label = (LABEL); \
+ unsigned int _kind = (KIND); \
+ if (GET_CODE (_label) != CODE_LABEL) \
+ rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ _label->jump = ((_kind >> 1) & 1); \
+ _label->call = (_kind & 1); \
+} while (0)
+
+#else
+
+/* Retrieve the kind of LABEL. */
+#define LABEL_KIND(LABEL) \
+ ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
+
+/* Set the kind of LABEL. */
+#define SET_LABEL_KIND(LABEL, KIND) do { \
+ rtx _label = (LABEL); \
+ unsigned int _kind = (KIND); \
+ _label->jump = ((_kind >> 1) & 1); \
+ _label->call = (_kind & 1); \
+} while (0)
+
+#endif /* rtl flag checking */
+
+#define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
/* The original regno this ADDRESSOF was built for. */
#define ADDRESSOF_REGNO(RTX) XCUINT (RTX, 1, ADDRESSOF)