aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-09-03 18:36:10 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-09-03 18:36:10 +0000
commit4fbca4ba44198fa692ca6f53e70e36fe6009e7a6 (patch)
treec9154659b0fa458cc8b2e9802ac3e0935f722369 /gcc/final.c
parentdd991abb1bb40648f53a1b8014b485ed0ea3ac4c (diff)
downloadgcc-4fbca4ba44198fa692ca6f53e70e36fe6009e7a6.zip
gcc-4fbca4ba44198fa692ca6f53e70e36fe6009e7a6.tar.gz
gcc-4fbca4ba44198fa692ca6f53e70e36fe6009e7a6.tar.bz2
output.h (get_some_local_dynamic_name): Declare.
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. From-SVN: r214889
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/final.c b/gcc/final.c
index d022226..6469f40 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1719,6 +1719,38 @@ reemit_insn_block_notes (void)
reorder_blocks ();
}
+static const char *some_local_dynamic_name;
+
+/* Locate some local-dynamic symbol still in use by this function
+ so that we can print its name in local-dynamic base patterns.
+ Return null if there are no local-dynamic references. */
+
+const char *
+get_some_local_dynamic_name ()
+{
+ subrtx_iterator::array_type array;
+ rtx_insn *insn;
+
+ if (some_local_dynamic_name)
+ return some_local_dynamic_name;
+
+ for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
+ if (NONDEBUG_INSN_P (insn))
+ FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
+ {
+ const_rtx x = *iter;
+ if (GET_CODE (x) == SYMBOL_REF)
+ {
+ if (SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC)
+ return some_local_dynamic_name = XSTR (x, 0);
+ if (CONSTANT_POOL_ADDRESS_P (x))
+ iter.substitute (get_pool_constant (x));
+ }
+ }
+
+ return 0;
+}
+
/* Output assembler code for the start of a function,
and initialize some of the variables in this file
for the new function. The label for the function and associated
@@ -1904,6 +1936,8 @@ final_end_function (void)
if (!dwarf2_debug_info_emitted_p (current_function_decl)
&& dwarf2out_do_frame ())
dwarf2out_end_epilogue (last_linenum, last_filename);
+
+ some_local_dynamic_name = 0;
}