* expr.h: Remove prototypes of functions defined in builtins.c.
* tree.h: (build_call_expr_*, build_string_literal): Add prototypes.
Remove prototypes of functions defined in builtins.c.
* builtins.h: Update prototype list to include all exported functions.
* builtins.c: (default_libc_has_function, gnu_libc_has_function,
no_c99_libc_has_function): Move to targhooks.c
(build_string_literal, build_call_expr_loc_array,
build_call_expr_loc_vec, build_call_expr_loc, build_call_expr): Move
to tree.c.
(expand_builtin_object_size, fold_builtin_object_size): Make static.
* targhooks.c (default_libc_has_function, gnu_libc_has_function,
no_c99_libc_has_function): Relocate from builtins.c.
* tree.c: Include builtins.h.
(build_call_expr_loc_array, build_call_expr_loc_vec,
build_call_expr_loc, build_call_expr, build_string_literal): Relocate
from builtins.c.
* fold-const.h (fold_fma): Move prototype to builtins.h.
* realmpfr.h (do_mpc_arg2): Move prototype to builtins.h.
* fortran/trans.c (trans_runtime_error_vararg): Call
fold_build_call_array_loc instead of fold_builtin_call_array.
===================================================================
*************** extern unsigned HOST_WIDE_INT choose_mul
int, unsigned HOST_WIDE_INT *,
int *, int *);
- /* Functions from builtins.c: */
- extern rtx expand_builtin (tree, rtx, rtx, enum machine_mode, int);
- extern tree std_build_builtin_va_list (void);
- extern tree std_fn_abi_va_list (tree);
- extern tree std_canonical_va_list_type (tree);
-
- extern void std_expand_builtin_va_start (tree, rtx);
- extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
- extern void expand_builtin_setjmp_setup (rtx, rtx);
- extern void expand_builtin_setjmp_receiver (rtx);
- extern rtx expand_builtin_saveregs (void);
- extern void expand_builtin_trap (void);
- extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
-
/* Functions from expr.c: */
/* This is run during target initialization to set up which modes can be
===================================================================
*************** extern tree build_call_valist (tree, tre
build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3)
extern tree build_call_array_loc (location_t, tree, tree, int, const tree *);
extern tree build_call_vec (tree, tree, vec<tree, va_gc> *);
+ extern tree build_call_expr_loc_array (location_t, tree, int, tree *);
+ extern tree build_call_expr_loc_vec (location_t, tree, vec<tree, va_gc> *);
+ extern tree build_call_expr_loc (location_t, tree, int, ...);
+ extern tree build_call_expr (tree, int, ...);
+ extern tree build_string_literal (int, const char *);
/* Construct various nodes representing data types. */
*************** extern tree get_inner_reference (tree, H
EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */
extern tree array_ref_low_bound (tree);
- /* In builtins.c. */
-
- /* Non-zero if __builtin_constant_p should be folded right away. */
- extern bool force_folding_builtin_constant_p;
-
- extern bool avoid_folding_inline_builtin (tree);
- extern tree fold_call_expr (location_t, tree, bool);
- extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree);
- extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree);
- extern tree fold_builtin_strncpy (location_t, tree, tree, tree, tree, tree);
- extern tree fold_builtin_strcat (location_t, tree, tree, tree);
- extern tree fold_builtin_memory_chk (location_t, tree, tree, tree, tree, tree, tree, bool,
- enum built_in_function);
- extern tree fold_builtin_stxcpy_chk (location_t, tree, tree, tree, tree, tree, bool,
- enum built_in_function);
- extern tree fold_builtin_stxncpy_chk (location_t, tree, tree, tree, tree, tree, bool,
- enum built_in_function);
- extern tree fold_builtin_expect (location_t, tree, tree, tree);
- extern bool fold_builtin_next_arg (tree, bool);
- extern enum built_in_function builtin_mathfn_code (const_tree);
- extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
- extern tree build_call_expr_loc_array (location_t, tree, int, tree *);
- extern tree build_call_expr_loc_vec (location_t, tree, vec<tree, va_gc> *);
- extern tree build_call_expr_loc (location_t, tree, int, ...);
- extern tree build_call_expr (tree, int, ...);
- extern tree mathfn_built_in (tree, enum built_in_function fn);
- extern tree c_strlen (tree, int);
- extern tree build_string_literal (int, const char *);
- extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
- extern bool is_builtin_fn (tree);
- extern bool get_object_alignment_1 (tree, unsigned int *,
- unsigned HOST_WIDE_INT *);
- extern unsigned int get_object_alignment (tree);
- extern bool get_pointer_alignment_1 (tree, unsigned int *,
- unsigned HOST_WIDE_INT *);
- extern unsigned int get_pointer_alignment (tree);
- extern tree fold_call_stmt (gimple, bool);
- extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function);
- extern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
- extern bool is_simple_builtin (tree);
- extern bool is_inexpensive_builtin (tree);
-
#endif /* GCC_TREE_H */
===================================================================
*************** along with GCC; see the file COPYING3.
#ifndef GCC_BUILTINS_H
#define GCC_BUILTINS_H
+ #include <mpc.h>
+
/* Target-dependent globals. */
struct target_builtins {
/* For each register that may be used for calling a function, this
*************** extern struct target_builtins *this_targ
#define this_target_builtins (&default_target_builtins)
#endif
+ /* Non-zero if __builtin_constant_p should be folded right away. */
+ extern bool force_folding_builtin_constant_p;
+
+ extern bool is_builtin_fn (tree);
+ extern bool get_object_alignment_1 (tree, unsigned int *,
+ unsigned HOST_WIDE_INT *);
+ extern unsigned int get_object_alignment (tree);
+ extern bool get_pointer_alignment_1 (tree, unsigned int *,
+ unsigned HOST_WIDE_INT *);
+ extern unsigned int get_pointer_alignment (tree);
+ extern tree c_strlen (tree, int);
+ extern void expand_builtin_setjmp_setup (rtx, rtx);
+ extern void expand_builtin_setjmp_receiver (rtx);
+ extern tree mathfn_built_in (tree, enum built_in_function fn);
+ extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+ extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+ extern rtx expand_builtin_saveregs (void);
+ extern tree std_build_builtin_va_list (void);
+ extern tree std_fn_abi_va_list (tree);
+ extern tree std_canonical_va_list_type (tree);
+ extern void std_expand_builtin_va_start (tree, rtx);
+ extern void expand_builtin_trap (void);
+ extern rtx expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+ extern enum built_in_function builtin_mathfn_code (const_tree);
+ extern tree fold_builtin_expect (location_t, tree, tree, tree);
+ extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree);
+ extern tree fold_builtin_strncpy (location_t, tree, tree, tree, tree, tree);
+ extern tree fold_fma (location_t, tree, tree, tree, tree);
+ extern bool avoid_folding_inline_builtin (tree);
+ extern tree fold_call_expr (location_t, tree, bool);
+ extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
extern bool validate_gimple_arglist (const_gimple, ...);
+ extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+ extern tree fold_builtin_strcat (location_t, tree, tree, tree);
+ extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree);
+ extern bool fold_builtin_next_arg (tree, bool);
+ extern tree fold_builtin_memory_chk (location_t, tree, tree, tree, tree, tree,
+ tree, bool, enum built_in_function);
+ extern tree fold_builtin_stxcpy_chk (location_t, tree, tree, tree, tree, tree,
+ bool, enum built_in_function);
+ extern tree fold_builtin_stxncpy_chk (location_t, tree, tree, tree, tree, tree,
+ bool, enum built_in_function);
+ extern tree gimple_fold_builtin_snprintf_chk (gimple, tree,
+ enum built_in_function);
+ extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
+ extern tree fold_call_stmt (gimple, bool);
+ extern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
+ extern bool is_simple_builtin (tree);
+ extern bool is_inexpensive_builtin (tree);
#endif
===================================================================
*************** is_builtin_fn (tree decl)
return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl);
}
- /* By default we assume that c99 functions are present at the runtime,
- but sincos is not. */
- bool
- default_libc_has_function (enum function_class fn_class)
- {
- if (fn_class == function_c94
- || fn_class == function_c99_misc
- || fn_class == function_c99_math_complex)
- return true;
-
- return false;
- }
-
- bool
- gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
- {
- return true;
- }
-
- bool
- no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
- {
- return false;
- }
-
/* Return true if NODE should be considered for inline expansion regardless
of the optimization level. This means whenever a function is invoked with
its "internal" name, which normally contains the prefix "__builtin". */
*************** expand_builtin_copysign (tree exp, rtx t
return expand_copysign (op0, op1, target);
}
- /* Create a new constant string literal and return a char* pointer to it.
- The STRING_CST value is the LEN characters at STR. */
- tree
- build_string_literal (int len, const char *str)
- {
- tree t, elem, index, type;
-
- t = build_string (len, str);
- elem = build_type_variant (char_type_node, 1, 0);
- index = build_index_type (size_int (len - 1));
- type = build_array_type (elem, index);
- TREE_TYPE (t) = type;
- TREE_CONSTANT (t) = 1;
- TREE_READONLY (t) = 1;
- TREE_STATIC (t) = 1;
-
- type = build_pointer_type (elem);
- t = build1 (ADDR_EXPR, type,
- build4 (ARRAY_REF, elem,
- t, integer_zero_node, NULL_TREE, NULL_TREE));
- return t;
- }
-
/* Expand a call to __builtin___clear_cache. */
static rtx
*************** fold_call_expr (location_t loc, tree exp
return NULL_TREE;
}
- /* Conveniently construct a function call expression. FNDECL names the
- function to be called and N arguments are passed in the array
- ARGARRAY. */
-
- tree
- build_call_expr_loc_array (location_t loc, tree fndecl, int n, tree *argarray)
- {
- tree fntype = TREE_TYPE (fndecl);
- tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
-
- return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
- }
-
- /* Conveniently construct a function call expression. FNDECL names the
- function to be called and the arguments are passed in the vector
- VEC. */
-
- tree
- build_call_expr_loc_vec (location_t loc, tree fndecl, vec<tree, va_gc> *vec)
- {
- return build_call_expr_loc_array (loc, fndecl, vec_safe_length (vec),
- vec_safe_address (vec));
- }
-
-
- /* Conveniently construct a function call expression. FNDECL names the
- function to be called, N is the number of arguments, and the "..."
- parameters are the argument expressions. */
-
- tree
- build_call_expr_loc (location_t loc, tree fndecl, int n, ...)
- {
- va_list ap;
- tree *argarray = XALLOCAVEC (tree, n);
- int i;
-
- va_start (ap, n);
- for (i = 0; i < n; i++)
- argarray[i] = va_arg (ap, tree);
- va_end (ap);
- return build_call_expr_loc_array (loc, fndecl, n, argarray);
- }
-
- /* Like build_call_expr_loc (UNKNOWN_LOCATION, ...). Duplicated because
- varargs macros aren't supported by all bootstrap compilers. */
-
- tree
- build_call_expr (tree fndecl, int n, ...)
- {
- va_list ap;
- tree *argarray = XALLOCAVEC (tree, n);
- int i;
-
- va_start (ap, n);
- for (i = 0; i < n; i++)
- argarray[i] = va_arg (ap, tree);
- va_end (ap);
- return build_call_expr_loc_array (UNKNOWN_LOCATION, fndecl, n, argarray);
- }
-
/* Construct a CALL_EXPR with type TYPE with FN as the function expression.
N arguments are passed in the array ARGARRAY. */
*************** fold_builtin_snprintf (location_t loc, t
/* Expand a call EXP to __builtin_object_size. */
! rtx
expand_builtin_object_size (tree exp)
{
tree ost;
/* Expand a call EXP to __builtin_object_size. */
! static rtx
expand_builtin_object_size (tree exp)
{
tree ost;
*************** maybe_emit_free_warning (tree exp)
/* Fold a call to __builtin_object_size with arguments PTR and OST,
if possible. */
! tree
fold_builtin_object_size (tree ptr, tree ost)
{
unsigned HOST_WIDE_INT bytes;
/* Fold a call to __builtin_object_size with arguments PTR and OST,
if possible. */
! static tree
fold_builtin_object_size (tree ptr, tree ost)
{
unsigned HOST_WIDE_INT bytes;
===================================================================
*************** default_have_conditional_execution (void
#endif
}
+ /* By default we assume that c99 functions are present at the runtime,
+ but sincos is not. */
+ bool
+ default_libc_has_function (enum function_class fn_class)
+ {
+ if (fn_class == function_c94
+ || fn_class == function_c99_misc
+ || fn_class == function_c99_math_complex)
+ return true;
+
+ return false;
+ }
+
+ bool
+ gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
+ {
+ return true;
+ }
+
+ bool
+ no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
+ {
+ return false;
+ }
+
tree
default_builtin_tm_load_store (tree ARG_UNUSED (type))
{
===================================================================
*************** along with GCC; see the file COPYING3.
#include "debug.h"
#include "intl.h"
#include "wide-int.h"
+ #include "builtins.h"
/* Tree code classes. */
*************** build_call_vec (tree return_type, tree f
return ret;
}
+ /* Conveniently construct a function call expression. FNDECL names the
+ function to be called and N arguments are passed in the array
+ ARGARRAY. */
+
+ tree
+ build_call_expr_loc_array (location_t loc, tree fndecl, int n, tree *argarray)
+ {
+ tree fntype = TREE_TYPE (fndecl);
+ tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+
+ return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
+ }
+
+ /* Conveniently construct a function call expression. FNDECL names the
+ function to be called and the arguments are passed in the vector
+ VEC. */
+
+ tree
+ build_call_expr_loc_vec (location_t loc, tree fndecl, vec<tree, va_gc> *vec)
+ {
+ return build_call_expr_loc_array (loc, fndecl, vec_safe_length (vec),
+ vec_safe_address (vec));
+ }
+
+
+ /* Conveniently construct a function call expression. FNDECL names the
+ function to be called, N is the number of arguments, and the "..."
+ parameters are the argument expressions. */
+
+ tree
+ build_call_expr_loc (location_t loc, tree fndecl, int n, ...)
+ {
+ va_list ap;
+ tree *argarray = XALLOCAVEC (tree, n);
+ int i;
+
+ va_start (ap, n);
+ for (i = 0; i < n; i++)
+ argarray[i] = va_arg (ap, tree);
+ va_end (ap);
+ return build_call_expr_loc_array (loc, fndecl, n, argarray);
+ }
+
+ /* Like build_call_expr_loc (UNKNOWN_LOCATION, ...). Duplicated because
+ varargs macros aren't supported by all bootstrap compilers. */
+
+ tree
+ build_call_expr (tree fndecl, int n, ...)
+ {
+ va_list ap;
+ tree *argarray = XALLOCAVEC (tree, n);
+ int i;
+
+ va_start (ap, n);
+ for (i = 0; i < n; i++)
+ argarray[i] = va_arg (ap, tree);
+ va_end (ap);
+ return build_call_expr_loc_array (UNKNOWN_LOCATION, fndecl, n, argarray);
+ }
+
+ /* Create a new constant string literal and return a char* pointer to it.
+ The STRING_CST value is the LEN characters at STR. */
+ tree
+ build_string_literal (int len, const char *str)
+ {
+ tree t, elem, index, type;
+
+ t = build_string (len, str);
+ elem = build_type_variant (char_type_node, 1, 0);
+ index = build_index_type (size_int (len - 1));
+ type = build_array_type (elem, index);
+ TREE_TYPE (t) = type;
+ TREE_CONSTANT (t) = 1;
+ TREE_READONLY (t) = 1;
+ TREE_STATIC (t) = 1;
+
+ type = build_pointer_type (elem);
+ t = build1 (ADDR_EXPR, type,
+ build4 (ARRAY_REF, elem,
+ t, integer_zero_node, NULL_TREE, NULL_TREE));
+ return t;
+ }
+
+
+
/* Return true if T (assumed to be a DECL) must be assigned a memory
location. */
===================================================================
*************** extern void fold_defer_overflow_warnings
extern void fold_undefer_overflow_warnings (bool, const_gimple, int);
extern void fold_undefer_and_ignore_overflow_warnings (void);
extern bool fold_deferring_overflow_warnings_p (void);
- extern tree fold_fma (location_t, tree, tree, tree, tree);
extern int operand_equal_p (const_tree, const_tree, unsigned int);
extern int multiple_of_p (tree, const_tree, const_tree);
#define omit_one_operand(T1,T2,T3)\
===================================================================
***************
#include <mpc.h>
#include "real.h"
- /* In builtins.c. */
- extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
-
/* Convert between MPFR and REAL_VALUE_TYPE. The caller is
responsible for initializing and clearing the MPFR parameter. */
===================================================================
*************** trans_runtime_error_vararg (bool error,
fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at);
loc = where ? where->lb->location : input_location;
! tmp = fold_builtin_call_array (loc, TREE_TYPE (fntype),
! fold_build1_loc (loc, ADDR_EXPR,
build_pointer_type (fntype),
error
? gfor_fndecl_runtime_error_at
: gfor_fndecl_runtime_warning_at),
! nargs + 2, argarray);
gfc_add_expr_to_block (&block, tmp);
return gfc_finish_block (&block);
fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at);
loc = where ? where->lb->location : input_location;
! tmp = fold_build_call_array_loc (loc, TREE_TYPE (fntype),
! fold_build1_loc (loc, ADDR_EXPR,
build_pointer_type (fntype),
error
? gfor_fndecl_runtime_error_at
: gfor_fndecl_runtime_warning_at),
! nargs + 2, argarray);
gfc_add_expr_to_block (&block, tmp);
return gfc_finish_block (&block);