This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Implement TARGET_BUILTIN_DECL for MIPS
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 26 Sep 2010 08:23:54 +0100
- Subject: [committed] Implement TARGET_BUILTIN_DECL for MIPS
Recent changes have brought to the fore the lack of TARGET_BUILTIN_DECL
for MIPS. Tested on mips64octeon-linux-gnu and applied.
Richard
gcc/
* config/mips/mips.c (mips_builtin_decls): Declare.
(mips_init_builtins): Store function declarations in
mips_builtin_decls.
(mips_builtin_decl): New function.
(TARGET_BUILTIN_DECL): Define.
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2010-09-26 08:05:58.000000000 +0100
+++ gcc/config/mips/mips.c 2010-09-26 08:15:01.000000000 +0100
@@ -13025,6 +13025,10 @@ static const struct mips_builtin_descrip
DIRECT_NO_TARGET_BUILTIN (cache, MIPS_VOID_FTYPE_SI_CVPOINTER, cache)
};
+/* Index I is the function declaration for mips_builtins[I], or null if the
+ function isn't defined on this target. */
+static GTY(()) tree mips_builtin_decls[ARRAY_SIZE (mips_builtins)];
+
/* MODE is a vector mode whose elements have type TYPE. Return the type
of the vector itself. */
@@ -13141,12 +13145,23 @@ mips_init_builtins (void)
{
d = &mips_builtins[i];
if (d->avail ())
- add_builtin_function (d->name,
- mips_build_function_type (d->function_type),
- i, BUILT_IN_MD, NULL, NULL);
+ mips_builtin_decls[i]
+ = add_builtin_function (d->name,
+ mips_build_function_type (d->function_type),
+ i, BUILT_IN_MD, NULL, NULL);
}
}
+/* Implement TARGET_BUILTIN_DECL. */
+
+static tree
+mips_builtin_decl (unsigned int code, bool initialize_p ATTRIBUTE_UNUSED)
+{
+ if (code >= ARRAY_SIZE (mips_builtins))
+ return error_mark_node;
+ return mips_builtin_decls[code];
+}
+
/* Take argument ARGNO from EXP's argument list and convert it into a
form suitable for input operand OPNO of instruction ICODE. Return the
value. */
@@ -16519,6 +16534,8 @@ #define TARGET_VECTORIZE_UNITS_PER_SIMD_
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS mips_init_builtins
+#undef TARGET_BUILTIN_DECL
+#define TARGET_BUILTIN_DECL mips_builtin_decl
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN mips_expand_builtin