aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2012-02-19 16:47:19 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2012-02-19 16:47:19 +0000
commit78c2726669d835c1f6e496da8187a450f11fd092 (patch)
tree23cf9f104000d31d848248e5b9f03b0e4daefc3a /gcc
parent5adeb246868dba536895e60100ef20162b6d1911 (diff)
downloadgcc-78c2726669d835c1f6e496da8187a450f11fd092.zip
gcc-78c2726669d835c1f6e496da8187a450f11fd092.tar.gz
gcc-78c2726669d835c1f6e496da8187a450f11fd092.tar.bz2
mips.c (mips_need_mips16_rdhwr_p): New variable.
gcc/ * config/mips/mips.c (mips_need_mips16_rdhwr_p): New variable. (mips_get_tp): Set it. Record that __mips16_rdhwr binds locally. (mips_start_unique_function, mips_output_mips16_rdhwr) (mips_code_end): New functions. (TARGET_ASM_CODE_END): Define. libgcc/ * config.host (mips64*-*-linux*, mipsisa64*-*-linux*) (mips*-*-linux*): Remove t-slibgcc-libgcc. * config/mips/t-mips16 (LIB1ASMFUNCS): Remove __mips16_rdhwr. * config/mips/mips16.S (__mips16_rdhwr): Delete. From-SVN: r184380
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/mips/mips.c63
2 files changed, 71 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e052b4e..07635df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2012-02-19 Richard Sandiford <rdsandiford@googlemail.com>
+ * config/mips/mips.c (mips_need_mips16_rdhwr_p): New variable.
+ (mips_get_tp): Set it. Record that __mips16_rdhwr binds locally.
+ (mips_start_unique_function, mips_output_mips16_rdhwr)
+ (mips_code_end): New functions.
+ (TARGET_ASM_CODE_END): Define.
+
+2012-02-19 Richard Sandiford <rdsandiford@googlemail.com>
+
* config/mips/mips.c (mips16_build_call_stub): Add CFI information
to stubs with non-sibling calls.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 2dfbb4b..1a26267 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -592,6 +592,9 @@ struct target_globals *mips16_globals;
and returned from mips_sched_reorder2. */
static int cached_can_issue_more;
+/* True if the output uses __mips16_rdhwr. */
+static bool mips_need_mips16_rdhwr_p;
+
/* Index R is the smallest register class that contains register R. */
const enum reg_class mips_regno_to_class[FIRST_PSEUDO_REGISTER] = {
LEA_REGS, LEA_REGS, M16_REGS, V1_REG,
@@ -2842,7 +2845,9 @@ mips_get_tp (void)
tp = gen_reg_rtx (Pmode);
if (TARGET_MIPS16)
{
+ mips_need_mips16_rdhwr_p = true;
fn = mips16_stub_function ("__mips16_rdhwr");
+ SYMBOL_REF_FLAGS (fn) |= SYMBOL_FLAG_LOCAL;
if (!call_insn_operand (fn, VOIDmode))
fn = force_reg (Pmode, fn);
emit_insn (PMODE_INSN (gen_tls_get_tp_mips16, (tp, fn)));
@@ -5827,6 +5832,33 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
return addr;
}
+/* Declare a unique, locally-binding function called NAME, then start
+ its definition. */
+
+static void
+mips_start_unique_function (const char *name)
+{
+ tree decl;
+
+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (name),
+ build_function_type_list (void_type_node, NULL_TREE));
+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+ NULL_TREE, void_type_node);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+
+ DECL_COMDAT_GROUP (decl) = DECL_ASSEMBLER_NAME (decl);
+
+ targetm.asm_out.unique_section (decl, 0);
+ switch_to_section (get_named_section (decl, NULL, 0));
+
+ targetm.asm_out.globalize_label (asm_out_file, name);
+ fputs ("\t.hidden\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ putc ('\n', asm_out_file);
+}
+
/* Start a definition of function NAME. MIPS16_P indicates whether the
function contains MIPS16 code. */
@@ -5865,6 +5897,26 @@ mips_end_function_definition (const char *name)
}
}
+/* Output a definition of the __mips16_rdhwr function. */
+
+static void
+mips_output_mips16_rdhwr (void)
+{
+ const char *name;
+
+ name = "__mips16_rdhwr";
+ mips_start_unique_function (name);
+ mips_start_function_definition (name, false);
+ fprintf (asm_out_file,
+ "\t.set\tpush\n"
+ "\t.set\tmips32r2\n"
+ "\t.set\tnoreorder\n"
+ "\trdhwr\t$3,$29\n"
+ "\t.set\tpop\n"
+ "\tj\t$31\n");
+ mips_end_function_definition (name);
+}
+
/* Return true if calls to X can use R_MIPS_CALL* relocations. */
static bool
@@ -8467,6 +8519,15 @@ mips_file_start (void)
ASM_COMMENT_START,
mips_small_data_threshold, mips_arch_info->name, mips_isa);
}
+
+/* Implement TARGET_ASM_CODE_END. */
+
+static void
+mips_code_end (void)
+{
+ if (mips_need_mips16_rdhwr_p)
+ mips_output_mips16_rdhwr ();
+}
/* Make the last instruction frame-related and note that it performs
the operation described by FRAME_PATTERN. */
@@ -17357,6 +17418,8 @@ mips_expand_vec_minmax (rtx target, rtx op0, rtx op1,
#define TARGET_ASM_FILE_START mips_file_start
#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+#undef TARGET_ASM_CODE_END
+#define TARGET_ASM_CODE_END mips_code_end
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS mips_init_libfuncs