* langhooks.h (builtin_function): New langhook.
* langhooks-def.h (LANG_HOOKS_BUILTIN_FUNCTION): New.
(LANG_HOOKS_INITIALIZER): Update.
* tree.h (builtin_function): Remove.
* doc/tm.texi: Update.
* c-tree.h (builtin_function): Declare.
* c-common.c, config/alpha/alpha.c, config/arm/arm.c,
config/c4x/c4x.c, config/frv/frv.c, config/i386/i386.c,
config/ia64/ia64.c, config/iq2000/iq2000.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/stormy16/stormy16.c: All callers of builtin_function
changed.
ada:
* gigi.h (builtin_function): Declare.
cp:
* cp-tree.h (builtin_function): Declare.
fortran:
* trans.h (builtin_function): Declare.
java:
* java-tree.h (builtin_function): Declare.
From-SVN: r84878
+2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * langhooks.h (builtin_function): New langhook.
+ * langhooks-def.h (LANG_HOOKS_BUILTIN_FUNCTION): New.
+ (LANG_HOOKS_INITIALIZER): Update.
+ * tree.h (builtin_function): Remove.
+ * doc/tm.texi: Update.
+ * c-tree.h (builtin_function): Declare.
+ * c-common.c, config/alpha/alpha.c, config/arm/arm.c,
+ config/c4x/c4x.c, config/frv/frv.c, config/i386/i386.c,
+ config/ia64/ia64.c, config/iq2000/iq2000.c,
+ config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
+ config/stormy16/stormy16.c: All callers of builtin_function
+ changed.
+
2004-07-17 Andrew Pinski <pinskia@physics.uc.edu>
PR target/16556
+2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * gigi.h (builtin_function): Declare.
+
2004-07-15 Robert Dewar <dewar@gnat.com>
* makegpr.adb, s-secsta.ads, sem_ch3.adb, sem_case.adb: Minor
should not be allocated in a register. Return true if successful. */
extern bool gnat_mark_addressable (tree);
+/* Implementation of the builtin_function langhook. */
+extern tree builtin_function (const char *, tree, int, enum built_in_class,
+ const char *, tree);
+
/* This function is called by the front end to enumerate all the supported
modes for the machine. We pass a function which is called back with
the following integer parameters:
abort (); \
\
if (!BOTH_P) \
- decl = builtin_function (NAME, builtin_types[TYPE], ENUM, \
+ decl = lang_hooks.builtin_function (NAME, builtin_types[TYPE], \
+ ENUM, \
CLASS, \
(FALLBACK_P \
? (NAME + strlen ("__builtin_")) \
tree decl = NULL_TREE;
if (builtin_name != 0)
- bdecl = builtin_function (builtin_name, builtin_type, function_code,
- class, library_name_p ? name : NULL, attrs);
+ bdecl = lang_hooks.builtin_function (builtin_name, builtin_type,
+ function_code, class,
+ library_name_p ? name : NULL, attrs);
if (name != 0 && !flag_no_builtin && !builtin_function_disabled_p (name)
&& !(nonansi_p && flag_no_nonansi_builtin))
- decl = builtin_function (name, type, function_code, class, NULL, attrs);
+ decl = lang_hooks.builtin_function (name, type, function_code, class,
+ NULL, attrs);
return (bdecl != 0 ? bdecl : decl);
}
extern void push_parm_decl (tree);
extern tree pushdecl_top_level (tree);
extern tree set_array_declarator_type (tree, tree, int);
+extern tree builtin_function (const char *, tree, int, enum built_in_class,
+ const char *, tree);
extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int);
extern tree start_enum (tree);
p = zero_arg_builtins;
for (i = 0; i < ARRAY_SIZE (zero_arg_builtins); ++i, ++p)
if ((target_flags & p->target_mask) == p->target_mask)
- builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+ NULL, NULL_TREE);
ftype = build_function_type_list (long_integer_type_node,
long_integer_type_node, NULL_TREE);
p = one_arg_builtins;
for (i = 0; i < ARRAY_SIZE (one_arg_builtins); ++i, ++p)
if ((target_flags & p->target_mask) == p->target_mask)
- builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+ NULL, NULL_TREE);
ftype = build_function_type_list (long_integer_type_node,
long_integer_type_node,
p = two_arg_builtins;
for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p)
if ((target_flags & p->target_mask) == p->target_mask)
- builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+ NULL, NULL_TREE);
ftype = build_function_type (ptr_type_node, void_list_node);
- builtin_function ("__builtin_thread_pointer", ftype,
- ALPHA_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function ("__builtin_thread_pointer", ftype,
+ ALPHA_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+ NULL, NULL_TREE);
ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
- builtin_function ("__builtin_set_thread_pointer", ftype,
- ALPHA_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function ("__builtin_set_thread_pointer", ftype,
+ ALPHA_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
+ NULL, NULL_TREE);
}
/* Expand an expression EXP that calls a built-in function,
#include "target.h"
#include "target-def.h"
#include "debug.h"
+#include "langhooks.h"
/* Forward definitions of types. */
typedef struct minipool_node Mnode;
do \
{ \
if ((MASK) & insn_flags) \
- builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, NULL, NULL_TREE); \
+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), \
+ BUILT_IN_MD, NULL, NULL_TREE); \
} \
while (0)
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
+#include "langhooks.h"
rtx smulhi3_libfunc;
rtx umulhi3_libfunc;
{
tree endlink = void_list_node;
- builtin_function ("fast_ftoi",
- build_function_type
- (integer_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink)),
- C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
- builtin_function ("ansi_ftoi",
- build_function_type
- (integer_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink)),
- C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL, NULL_TREE);
+ lang_hooks.builtin_function ("fast_ftoi",
+ build_function_type
+ (integer_type_node,
+ tree_cons (NULL_TREE, double_type_node,
+ endlink)),
+ C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
+ lang_hooks.builtin_function ("ansi_ftoi",
+ build_function_type
+ (integer_type_node,
+ tree_cons (NULL_TREE, double_type_node,
+ endlink)),
+ C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL,
+ NULL_TREE);
if (TARGET_C3X)
- builtin_function ("fast_imult",
- build_function_type
- (integer_type_node,
- tree_cons (NULL_TREE, integer_type_node,
- tree_cons (NULL_TREE,
- integer_type_node, endlink))),
- C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL, NULL_TREE);
+ lang_hooks.builtin_function ("fast_imult",
+ build_function_type
+ (integer_type_node,
+ tree_cons (NULL_TREE, integer_type_node,
+ tree_cons (NULL_TREE,
+ integer_type_node,
+ endlink))),
+ C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL,
+ NULL_TREE);
else
{
- builtin_function ("toieee",
- build_function_type
- (double_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink)),
- C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL, NULL_TREE);
- builtin_function ("frieee",
- build_function_type
- (double_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink)),
- C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL, NULL_TREE);
- builtin_function ("fast_invf",
- build_function_type
- (double_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink)),
- C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL, NULL_TREE);
+ lang_hooks.builtin_function ("toieee",
+ build_function_type
+ (double_type_node,
+ tree_cons (NULL_TREE, double_type_node,
+ endlink)),
+ C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL,
+ NULL_TREE);
+ lang_hooks.builtin_function ("frieee",
+ build_function_type
+ (double_type_node,
+ tree_cons (NULL_TREE, double_type_node,
+ endlink)),
+ C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL,
+ NULL_TREE);
+ lang_hooks.builtin_function ("fast_invf",
+ build_function_type
+ (double_type_node,
+ tree_cons (NULL_TREE, double_type_node,
+ endlink)),
+ C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL,
+ NULL_TREE);
}
}
#include "target-def.h"
#include "targhooks.h"
#include "integrate.h"
+#include "langhooks.h"
#ifndef FRV_INLINE
#define FRV_INLINE inline
\f
#define def_builtin(name, type, code) \
- builtin_function ((name), (type), (code), BUILT_IN_MD, NULL, NULL)
+ lang_hooks.builtin_function ((name), (type), (code), BUILT_IN_MD, NULL, NULL)
struct builtin_description
{
#endif
}
\f
-#define def_builtin(MASK, NAME, TYPE, CODE) \
-do { \
- if ((MASK) & target_flags \
- && (!((MASK) & MASK_64BIT) || TARGET_64BIT)) \
- builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
- NULL, NULL_TREE); \
+#define def_builtin(MASK, NAME, TYPE, CODE) \
+do { \
+ if ((MASK) & target_flags \
+ && (!((MASK) & MASK_64BIT) || TARGET_64BIT)) \
+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
+ NULL, NULL_TREE); \
} while (0)
struct builtin_description
(*lang_hooks.types.register_builtin_type) (long_double_type_node,
"__float128");
-#define def_builtin(name, type, code) \
- builtin_function ((name), (type), (code), BUILT_IN_MD, NULL, NULL_TREE)
+#define def_builtin(name, type, code) \
+ lang_hooks.builtin_function ((name), (type), (code), BUILT_IN_MD, \
+ NULL, NULL_TREE)
def_builtin ("__sync_val_compare_and_swap_si", si_ftype_psi_si_si,
IA64_BUILTIN_VAL_COMPARE_AND_SWAP_SI);
#include "debug.h"
#include "target.h"
#include "target-def.h"
+#include "langhooks.h"
/* Enumeration for all of the relational tests, so that we can build
arrays indexed by the test type, and not worry about the order
return 0;
}
-#define def_builtin(NAME, TYPE, CODE) \
- builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, NULL, NULL_TREE)
+#define def_builtin(NAME, TYPE, CODE) \
+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
+ NULL, NULL_TREE)
static void
iq2000_init_builtins (void)
/* Builtins. */
-#define def_builtin(MASK, NAME, TYPE, CODE) \
-do { \
- if ((MASK) & target_flags) \
- builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
- NULL, NULL_TREE); \
+#define def_builtin(MASK, NAME, TYPE, CODE) \
+do { \
+ if ((MASK) & target_flags) \
+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
+ NULL, NULL_TREE); \
} while (0)
/* Simple ternary operations: VECd = foo (VECa, VECb, VECc). */
tree ftype;
ftype = build_function_type (ptr_type_node, void_list_node);
- builtin_function ("__builtin_thread_pointer", ftype,
- S390_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function ("__builtin_thread_pointer", ftype,
+ S390_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+ NULL, NULL_TREE);
ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
- builtin_function ("__builtin_set_thread_pointer", ftype,
- S390_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function ("__builtin_set_thread_pointer", ftype,
+ S390_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
+ NULL, NULL_TREE);
}
/* Expand an expression EXP that calls a built-in function,
if (signature < SH_BLTIN_NUM_SHARED_SIGNATURES)
shared[signature] = type;
}
- builtin_function (d->name, type, d - bdesc, BUILT_IN_MD,
- NULL, NULL_TREE);
+ lang_hooks.builtin_function (d->name, type, d - bdesc, BUILT_IN_MD,
+ NULL, NULL_TREE);
}
}
else
args = tree_cons (NULL_TREE, arg, args);
}
- builtin_function (s16builtins[i].name,
- build_function_type (ret_type, args),
- i, BUILT_IN_MD, NULL, NULL);
+ lang_hooks.builtin_function (s16builtins[i].name,
+ build_function_type (ret_type, args),
+ i, BUILT_IN_MD, NULL, NULL);
}
}
+2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * cp-tree.h (builtin_function): Declare.
+
2004-07-16 Mark Mitchell <mark@codesourcery.com>
* class.c (finish_struct_methods): Remove unncessary code.
extern void register_dtor_fn (tree);
extern tmpl_spec_kind current_tmpl_spec_kind (int);
extern tree cp_fname_init (const char *, tree *);
+extern tree builtin_function (const char *, tree, int, enum built_in_class,
+ const char *, tree);
extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern void warn_extern_redeclared_static (tree, tree);
extern bool cp_missing_noreturn_ok_p (tree);
they have no equivalent in the source language (for example, SIMD vector
instructions or prefetch instructions).
-To create a built-in function, call the function @code{builtin_function}
+To create a built-in function, call the function
+@code{lang_hooks.builtin_function}
which is defined by the language front end. You can use any type nodes set
up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
only language front ends that use those two functions will call
+2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * trans.h (builtin_function): Declare.
+
2004-07-16 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/16404
tree poplevel (int, int, int);
tree getdecls (void);
tree gfc_truthvalue_conversion (tree);
+tree builtin_function (const char *, tree, int, enum built_in_class,
+ const char *, tree);
/* Runtime library function decls. */
extern GTY(()) tree gfor_fndecl_internal_malloc;
+2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * java-tree.h (builtin_function): Declare.
+
2004-07-16 Steven Bosscher <stevenb@suse.de>
* parse.y (java_complete_expand_methods, java_expand_classes): Don't
extern int split_qualified_name (tree *left, tree *right, tree source);
extern int in_same_package (tree, tree);
+extern tree builtin_function (const char *, tree, int, enum built_in_class,
+ const char *, tree);
#define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
#define LANG_HOOKS_TREE_SIZE lhd_tree_size
#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p
+#define LANG_HOOKS_BUILTIN_FUNCTION builtin_function
#define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f
LANG_HOOKS_FOR_TYPES_INITIALIZER, \
LANG_HOOKS_GIMPLIFY_EXPR, \
LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
+ LANG_HOOKS_BUILTIN_FUNCTION, \
}
#endif /* GCC_LANG_HOOKS_DEF_H */
KNOWN_TYPE carries the true type of the OBJ_TYPE_REF_OBJECT. */
tree (*fold_obj_type_ref) (tree, tree);
+ /* Return a definition for a builtin function named NAME and whose data type
+ is TYPE. TYPE should be a function type with argument types.
+ FUNCTION_CODE tells later passes how to compile calls to this function.
+ See tree.h for its possible values.
+
+ If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
+ the name to be called if we can't opencode the function. If
+ ATTRS is nonzero, use that for the function's attribute list. */
+ tree (*builtin_function) (const char *name, tree type, int function_code,
+ enum built_in_class class,
+ const char *library_name, tree attrs);
+
/* Whenever you add entries here, make sure you adjust langhooks-def.h
and langhooks.c accordingly. */
};
chain of FILE_DECLs; currently only C uses it. */
extern GTY(()) tree current_file_decl;
-
-/* Declare a predefined function. Return the declaration. This function is
- provided by each language frontend. */
-extern tree builtin_function (const char *, tree, int, enum built_in_class,
- const char *, tree);
\f
/* In tree.c */
extern unsigned crc32_string (unsigned, const char *);