aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/tm.texi
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2003-04-20 18:20:39 +0000
committerZack Weinberg <zack@gcc.gnu.org>2003-04-20 18:20:39 +0000
commitc6a2438aaf2ceeb137d21d67b00edf27a92104c0 (patch)
tree6af2bc9bef24c55c4233dbdc955842df62042749 /gcc/doc/tm.texi
parent8c7d377fa2a94ea39f7eb38df8aeb776452f49f0 (diff)
downloadgcc-c6a2438aaf2ceeb137d21d67b00edf27a92104c0.zip
gcc-c6a2438aaf2ceeb137d21d67b00edf27a92104c0.tar.gz
gcc-c6a2438aaf2ceeb137d21d67b00edf27a92104c0.tar.bz2
target.h (encode_section_info): Add new argument carrying the RTL to be modified by the hook.
* target.h (encode_section_info): Add new argument carrying the RTL to be modified by the hook. * varasm.c (make_decl_rtl, output_constant_def): Update calls to encode_section_info. (default_encode_section_info): Take and use RTL argument, don't use TREE_CST_RTL or DECL_RTL. * output.h: Update prototype of default_encode_section_info. * config/darwin.h (ASM_DECLARE_OBJECT_NAME) (ASM_DECLARE_FUNCTION_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL): Update calls to encode_section_info. * config/darwin.c, config/arm/arm.c, config/arm/pe.c * config/h8300/h8300.c, config/i386/winnt.c, config/m32r/m32r.c * config/m68hc11/m68hc11.c, config/m88k/m88k.c, config/mcore/mcore.c * config/mips/mips.c, config/mmix/mmix.c, config/pa/pa.c * config/romp/romp.c, config/rs6000/rs6000.c, config/s390/s390.c * config/v850/v850.c (TARGET_ENCODE_SECTION_INFO definitions): Take and use RTL argument, don't use TREE_CST_RTL or DECL_RTL, except for PE dllimport/dllexport. Update calls to default_encode_section_info. * config/darwin-protos.h, config/arm/arm-protos.h, config/i386-protos.h: Update prototypes. * doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update. From-SVN: r65859
Diffstat (limited to 'gcc/doc/tm.texi')
-rw-r--r--gcc/doc/tm.texi39
1 files changed, 26 insertions, 13 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b824b1e..092e400 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -6047,30 +6047,43 @@ constants in @code{flag_pic} mode in @code{data_section} and everything
else in @code{readonly_data_section}.
@end deftypefn
-@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, int @var{new_decl_p})
+@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, rtx @var{rtl}, int @var{new_decl_p})
Define this hook if references to a symbol or a constant must be
treated differently depending on something about the variable or
function named by the symbol (such as what section it is in).
-The hook is executed under two circumstances. One is immediately after
-the rtl for @var{decl} that represents a variable or a function has been
-created and stored in @code{DECL_RTL(@var{decl})}. The value of the rtl
-will be a @code{mem} whose address is a @code{symbol_ref}. The other is
-immediately after the rtl for @var{decl} that represents a constant has
-been created and stored in @code{TREE_CST_RTL (@var{decl})}. The macro
-is called once for each distinct constant in a source file.
+The hook is executed immediately after rtl has been created for
+@var{decl}, which may be a variable or function declaration or
+an entry in the constant pool. In either case, @var{rtl} is the
+rtl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})}
+or @code{TREE_CST_RTL (@var{decl})} in this hook; that field may
+not have been initialized yet.
+
+In the case of a constant, it is safe to assume that the rtl is
+a @code{mem} whose address is a @code{symbol_ref}. Most decls
+will also have this form, but that is not guaranteed. Global
+register variables, for instance, will have a @code{reg} for their
+rtl. (Normally the right thing to do with such unusual rtl is
+leave it alone.)
The @var{new_decl_p} argument will be true if this is the first time
-that @code{ENCODE_SECTION_INFO} has been invoked on this decl. It will
+that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It will
be false for subsequent invocations, which will happen for duplicate
declarations. Whether or not anything must be done for the duplicate
declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.
+@var{new_decl_p} is always true when the hook is called for a constant.
@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}
-The usual thing for this hook to do is to record a flag in the
-@code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
-modified name string in the @code{symbol_ref} (if one bit is not
-enough information).
+The usual thing for this hook to do is to record flags in the
+@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.
+Historically, the name string was modified if it was necessary to
+encode more than one bit of information, but this practice is now
+discouraged; use @code{SYMBOL_REF_FLAGS}.
+
+The default definition of this hook, @code{default_encode_section_info}
+in @file{varasm.c}, sets a number of commonly-useful bits in
+@code{SYMBOL_REF_FLAGS}. Check whether the default does what you need
+before overriding it.
@end deftypefn
@deftypefn {Target Hook} const char *TARGET_STRIP_NAME_ENCODING (const char *name)