This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Merge definitions of get_some_local_dynamic_name


On 09/02/14 12:36, Richard Sandiford wrote:
Several targets define a function like i386's get_some_local_dynamic_name.
The function looks through the current output function and returns the first
(arbitrary) local-dynamic symbol that it finds.  The result can be used in
a call to __tls_get_addr, since all local-dynamic symbols have the same base.

This patch replaces the various target functions with a single generic one.
The only difference between the implementations was that s390 checked
for constant pool references while the others didn't need to (because
they don't allow TLS symbols to be forced into the pool).  Checking for
constant pool references is unnecessary but harmless for the other ports.
Also, the walk is needed only once per TLS-referencing output function,
so it's hardly critical in terms of compile time.

All uses of this function are in final.  In general it wouldn't be
safe to call the function earlier than that, since the symbol reference
could in principle be deleted by any rtl pass.  I've therefore cached
it in a variable local to final rather than in cfun (which is where
the ports used to cache it).

Also, i386 was robust against uses of %& in inline asm.  The patch
makes sure the other ports are too.  Using %& in inline asm would
often be a mistake, but it should at least trigger a proper error
rather than an ICE.

Tested on x86_64-linux-gnu.  Also tested by building cross compilers
before and after the change on:

   alpha-linux-gnu powerpc64-linux-gnu s390x-linux-gnu sparc64-linux-gnu

OK to install?

Thanks,
Richard


gcc/
	* output.h (get_some_local_dynamic_name): Declare.
	* final.c (some_local_dynamic_name): New variable.
	(get_some_local_dynamic_name): New function.
	(final_end_function): Clear some_local_dynamic_name.
	* config/alpha/alpha.c (machine_function): Remove some_ld_name.
	(get_some_local_dynamic_name, get_some_local_dynamic_name_1): Delete.
	(print_operand): Report an error if '%&' is used inappropriately.
	* config/i386/i386.c (get_some_local_dynamic_name): Delete.
	(get_some_local_dynamic_name_1): Delete.
	* config/rs6000/rs6000.c (machine_function): Remove some_ld_name.
	(rs6000_get_some_local_dynamic_name): Delete.
	(rs6000_get_some_local_dynamic_name_1): Delete.
	(print_operand): Report an error if '%&' is used inappropriately.
	* config/s390/s390.c (machine_function): Remove some_ld_name.
	(get_some_local_dynamic_name, get_some_local_dynamic_name_1): Delete.
	(print_operand): Assert that get_some_local_dynamic_name is nonnull.
	* config/sparc/sparc.c: Include rtl-iter.h.
	(machine_function): Remove some_ld_name.
	(sparc_print_operand): Report an error if '%&' is used inappropriately.
	(get_some_local_dynamic_name, get_some_local_dynamic_name_1): Delete.
OK.
Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]