aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c186
1 files changed, 94 insertions, 92 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index bf1766a..296c5b7 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -75,11 +75,7 @@ const char * built_in_names[(int) END_BUILTINS] =
/* Setup an array of _DECL trees, make sure each element is
initialized to NULL_TREE. */
-tree built_in_decls[(int) END_BUILTINS];
-/* Declarations used when constructing the builtin implicitly in the compiler.
- It may be NULL_TREE when this is invalid (for instance runtime is not
- required to implement the function call in all cases). */
-tree implicit_built_in_decls[(int) END_BUILTINS];
+builtin_info_type builtin_info;
static const char *c_getstr (tree);
static rtx c_readstr (const char *, enum machine_mode);
@@ -1791,17 +1787,15 @@ expand_builtin_classify_type (tree exp)
fcode = BUILT_IN_MATHFN##_R; fcodef = BUILT_IN_MATHFN##F_R ; \
fcodel = BUILT_IN_MATHFN##L_R ; break;
-/* Return mathematic function equivalent to FN but operating directly
- on TYPE, if available. If IMPLICIT is true find the function in
- implicit_built_in_decls[], otherwise use built_in_decls[]. If we
- can't do the conversion, return zero. */
+/* Return mathematic function equivalent to FN but operating directly on TYPE,
+ if available. If IMPLICIT is true use the implicit builtin declaration,
+ otherwise use the explicit declaration. If we can't do the conversion,
+ return zero. */
static tree
-mathfn_built_in_1 (tree type, enum built_in_function fn, bool implicit)
+mathfn_built_in_1 (tree type, enum built_in_function fn, bool implicit_p)
{
- tree const *const fn_arr
- = implicit ? implicit_built_in_decls : built_in_decls;
- enum built_in_function fcode, fcodef, fcodel;
+ enum built_in_function fcode, fcodef, fcodel, fcode2;
switch (fn)
{
@@ -1898,13 +1892,18 @@ mathfn_built_in_1 (tree type, enum built_in_function fn, bool implicit)
}
if (TYPE_MAIN_VARIANT (type) == double_type_node)
- return fn_arr[fcode];
+ fcode2 = fcode;
else if (TYPE_MAIN_VARIANT (type) == float_type_node)
- return fn_arr[fcodef];
+ fcode2 = fcodef;
else if (TYPE_MAIN_VARIANT (type) == long_double_type_node)
- return fn_arr[fcodel];
+ fcode2 = fcodel;
else
return NULL_TREE;
+
+ if (implicit_p && !builtin_decl_implicit_p (fcode2))
+ return NULL_TREE;
+
+ return builtin_decl_explicit (fcode2);
}
/* Like mathfn_built_in_1(), but always use the implicit array. */
@@ -2554,11 +2553,11 @@ expand_builtin_cexpi (tree exp, rtx target)
rtx op1a, op2a;
if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPIF)
- fn = built_in_decls[BUILT_IN_SINCOSF];
+ fn = builtin_decl_explicit (BUILT_IN_SINCOSF);
else if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPI)
- fn = built_in_decls[BUILT_IN_SINCOS];
+ fn = builtin_decl_explicit (BUILT_IN_SINCOS);
else if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPIL)
- fn = built_in_decls[BUILT_IN_SINCOSL];
+ fn = builtin_decl_explicit (BUILT_IN_SINCOSL);
else
gcc_unreachable ();
@@ -2580,11 +2579,11 @@ expand_builtin_cexpi (tree exp, rtx target)
tree ctype = build_complex_type (type);
if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPIF)
- fn = built_in_decls[BUILT_IN_CEXPF];
+ fn = builtin_decl_explicit (BUILT_IN_CEXPF);
else if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPI)
- fn = built_in_decls[BUILT_IN_CEXP];
+ fn = builtin_decl_explicit (BUILT_IN_CEXP);
else if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CEXPIL)
- fn = built_in_decls[BUILT_IN_CEXPL];
+ fn = builtin_decl_explicit (BUILT_IN_CEXPL);
else
gcc_unreachable ();
@@ -3129,9 +3128,9 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len,
rtx target, enum machine_mode mode, int endp)
{
/* If return value is ignored, transform mempcpy into memcpy. */
- if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_MEMCPY])
+ if (target == const0_rtx && builtin_decl_implicit_p (BUILT_IN_MEMCPY))
{
- tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
tree result = build_call_nofold_loc (UNKNOWN_LOCATION, fn, 3,
dest, src, len);
return expand_expr (result, target, mode, EXPAND_NORMAL);
@@ -3292,9 +3291,9 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode)
src = CALL_EXPR_ARG (exp, 1);
/* If return value is ignored, transform stpcpy into strcpy. */
- if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_STRCPY])
+ if (target == const0_rtx && builtin_decl_implicit (BUILT_IN_STRCPY))
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCPY);
tree result = build_call_nofold_loc (loc, fn, 2, dst, src);
return expand_expr (result, target, mode, EXPAND_NORMAL);
}
@@ -4353,7 +4352,7 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
expression to exit or longjmp. */
gimplify_and_add (valist, pre_p);
t = build_call_expr_loc (loc,
- implicit_built_in_decls[BUILT_IN_TRAP], 0);
+ builtin_decl_implicit (BUILT_IN_TRAP), 0);
gimplify_and_add (t, pre_p);
/* This is dead code, but go ahead and finish so that the
@@ -5126,7 +5125,7 @@ expand_builtin_sync_operation (enum machine_mode mode, tree exp,
if (warned_f_a_n)
break;
- fndecl = implicit_built_in_decls[BUILT_IN_SYNC_FETCH_AND_NAND_N];
+ fndecl = builtin_decl_implicit (BUILT_IN_SYNC_FETCH_AND_NAND_N);
inform (loc, "%qD changed semantics in GCC 4.4", fndecl);
warned_f_a_n = true;
break;
@@ -5140,7 +5139,7 @@ expand_builtin_sync_operation (enum machine_mode mode, tree exp,
if (warned_n_a_f)
break;
- fndecl = implicit_built_in_decls[BUILT_IN_SYNC_NAND_AND_FETCH_N];
+ fndecl = builtin_decl_implicit (BUILT_IN_SYNC_NAND_AND_FETCH_N);
inform (loc, "%qD changed semantics in GCC 4.4", fndecl);
warned_n_a_f = true;
break;
@@ -6247,7 +6246,7 @@ build_builtin_expect_predicate (location_t loc, tree pred, tree expected)
{
tree fn, arg_types, pred_type, expected_type, call_expr, ret_type;
- fn = built_in_decls[BUILT_IN_EXPECT];
+ fn = builtin_decl_explicit (BUILT_IN_EXPECT);
arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
ret_type = TREE_TYPE (TREE_TYPE (fn));
pred_type = TREE_VALUE (arg_types);
@@ -8039,7 +8038,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
&& (MIN (src_align, dest_align) / BITS_PER_UNIT
>= (unsigned HOST_WIDE_INT) tree_low_cst (len, 1))))
{
- tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
return build_call_expr_loc (loc, fn, 3, dest, src, len);
@@ -8098,7 +8097,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
else
return NULL_TREE;
- fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
return build_call_expr_loc (loc, fn, 3, dest, src, len);
@@ -8117,7 +8116,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
if (!refs_may_alias_p_1 (&destr, &srcr, false))
{
tree fn;
- fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
return build_call_expr_loc (loc, fn, 3, dest, src, len);
@@ -8292,7 +8291,7 @@ fold_builtin_strcpy (location_t loc, tree fndecl, tree dest, tree src, tree len)
if (optimize_function_for_size_p (cfun))
return NULL_TREE;
- fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
@@ -8331,7 +8330,7 @@ fold_builtin_stpcpy (location_t loc, tree fndecl, tree dest, tree src)
&& !integer_zerop (len))
return NULL_TREE;
- fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
@@ -8390,7 +8389,7 @@ fold_builtin_strncpy (location_t loc, tree fndecl, tree dest,
return NULL_TREE;
/* OK transform into builtin memcpy. */
- fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
return NULL_TREE;
@@ -9213,7 +9212,7 @@ fold_builtin_interclass_mathfn (location_t loc, tree fndecl, tree arg)
CASE_FLT_FN (BUILT_IN_ISINF):
{
/* isinf(x) -> isgreater(fabs(x),DBL_MAX). */
- tree const isgr_fn = built_in_decls[BUILT_IN_ISGREATER];
+ tree const isgr_fn = builtin_decl_explicit (BUILT_IN_ISGREATER);
tree const type = TREE_TYPE (arg);
REAL_VALUE_TYPE r;
char buf[128];
@@ -9229,7 +9228,7 @@ fold_builtin_interclass_mathfn (location_t loc, tree fndecl, tree arg)
case BUILT_IN_ISFINITE:
{
/* isfinite(x) -> islessequal(fabs(x),DBL_MAX). */
- tree const isle_fn = built_in_decls[BUILT_IN_ISLESSEQUAL];
+ tree const isle_fn = builtin_decl_explicit (BUILT_IN_ISLESSEQUAL);
tree const type = TREE_TYPE (arg);
REAL_VALUE_TYPE r;
char buf[128];
@@ -9252,8 +9251,8 @@ fold_builtin_interclass_mathfn (location_t loc, tree fndecl, tree arg)
{
/* isnormal(x) -> isgreaterequal(fabs(x),DBL_MIN) &
islessequal(fabs(x),DBL_MAX). */
- tree const isle_fn = built_in_decls[BUILT_IN_ISLESSEQUAL];
- tree const isge_fn = built_in_decls[BUILT_IN_ISGREATEREQUAL];
+ tree const isle_fn = builtin_decl_explicit (BUILT_IN_ISLESSEQUAL);
+ tree const isge_fn = builtin_decl_explicit (BUILT_IN_ISGREATEREQUAL);
tree const type = TREE_TYPE (arg);
REAL_VALUE_TYPE rmax, rmin;
char buf[128];
@@ -9314,7 +9313,7 @@ fold_builtin_classify (location_t loc, tree fndecl, tree arg, int builtin_index)
1. So e.g. "if (isinf_sign(x))" would be folded to just
"if (isinf(x) ? 1 : 0)" which becomes "if (isinf(x))". */
tree signbit_fn = mathfn_built_in_1 (TREE_TYPE (arg), BUILT_IN_SIGNBIT, 0);
- tree isinf_fn = built_in_decls[BUILT_IN_ISINF];
+ tree isinf_fn = builtin_decl_explicit (BUILT_IN_ISINF);
tree tmp = NULL_TREE;
arg = builtin_save_expr (arg);
@@ -10037,7 +10036,7 @@ fold_builtin_2 (location_t loc, tree fndecl, tree arg0, tree arg1, bool ignore)
case BUILT_IN_STPCPY:
if (ignore)
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCPY);
if (!fn)
break;
@@ -10837,7 +10836,7 @@ fold_builtin_strstr (location_t loc, tree s1, tree s2, tree type)
if (p2[1] != '\0')
return NULL_TREE;
- fn = implicit_built_in_decls[BUILT_IN_STRCHR];
+ fn = builtin_decl_implicit (BUILT_IN_STRCHR);
if (!fn)
return NULL_TREE;
@@ -10957,7 +10956,7 @@ fold_builtin_strrchr (location_t loc, tree s1, tree s2, tree type)
if (! integer_zerop (s2))
return NULL_TREE;
- fn = implicit_built_in_decls[BUILT_IN_STRCHR];
+ fn = builtin_decl_implicit (BUILT_IN_STRCHR);
if (!fn)
return NULL_TREE;
@@ -11021,7 +11020,7 @@ fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type)
if (p2[1] != '\0')
return NULL_TREE; /* Really call strpbrk. */
- fn = implicit_built_in_decls[BUILT_IN_STRCHR];
+ fn = builtin_decl_implicit (BUILT_IN_STRCHR);
if (!fn)
return NULL_TREE;
@@ -11068,8 +11067,8 @@ fold_builtin_strcat (location_t loc ATTRIBUTE_UNUSED, tree dst, tree src)
{
/* See if we can store by pieces into (dst + strlen(dst)). */
tree newdst, call;
- tree strlen_fn = implicit_built_in_decls[BUILT_IN_STRLEN];
- tree strcpy_fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree strlen_fn = builtin_decl_implicit (BUILT_IN_STRLEN);
+ tree strcpy_fn = builtin_decl_implicit (BUILT_IN_STRCPY);
if (!strlen_fn || !strcpy_fn)
return NULL_TREE;
@@ -11142,7 +11141,7 @@ fold_builtin_strncat (location_t loc, tree dst, tree src, tree len)
if (TREE_CODE (len) == INTEGER_CST && p
&& compare_tree_int (len, strlen (p)) >= 0)
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCAT];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCAT);
/* If the replacement _DECL isn't initialized, don't do the
transformation. */
@@ -11247,7 +11246,7 @@ fold_builtin_strcspn (location_t loc, tree s1, tree s2)
/* If the second argument is "", return __builtin_strlen(s1). */
if (p2 && *p2 == '\0')
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRLEN];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRLEN);
/* If the replacement _DECL isn't initialized, don't do the
transformation. */
@@ -11273,10 +11272,12 @@ fold_builtin_fputs (location_t loc, tree arg0, tree arg1,
{
/* If we're using an unlocked function, assume the other unlocked
functions exist explicitly. */
- tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_FPUTC];
- tree const fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_FWRITE];
+ tree const fn_fputc = (unlocked
+ ? builtin_decl_explicit (BUILT_IN_FPUTC_UNLOCKED)
+ : builtin_decl_implicit (BUILT_IN_FPUTC));
+ tree const fn_fwrite = (unlocked
+ ? builtin_decl_explicit (BUILT_IN_FWRITE_UNLOCKED)
+ : builtin_decl_implicit (BUILT_IN_FWRITE));
/* If the return value is used, don't do the transformation. */
if (!ignore)
@@ -11470,7 +11471,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt,
/* If the format doesn't contain % args or %%, use strcpy. */
if (strchr (fmt_str, target_percent) == NULL)
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCPY);
if (!fn)
return NULL_TREE;
@@ -11490,7 +11491,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt,
else if (fmt_str && strcmp (fmt_str, target_percent_s) == 0)
{
tree fn;
- fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ fn = builtin_decl_implicit (BUILT_IN_STRCPY);
if (!fn)
return NULL_TREE;
@@ -11512,7 +11513,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt,
if (call && retval)
{
retval = fold_convert_loc
- (loc, TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SPRINTF])),
+ (loc, TREE_TYPE (TREE_TYPE (builtin_decl_implicit (BUILT_IN_SPRINTF))),
retval);
return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
}
@@ -11565,7 +11566,7 @@ fold_builtin_snprintf (location_t loc, tree dest, tree destsize, tree fmt,
/* If the format doesn't contain % args or %%, use strcpy. */
if (strchr (fmt_str, target_percent) == NULL)
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCPY);
size_t len = strlen (fmt_str);
/* Don't optimize snprintf (buf, 4, "abc", ptr++). */
@@ -11597,7 +11598,7 @@ fold_builtin_snprintf (location_t loc, tree dest, tree destsize, tree fmt,
/* If the format is "%s", use strcpy if the result isn't used. */
else if (fmt_str && strcmp (fmt_str, target_percent_s) == 0)
{
- tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ tree fn = builtin_decl_implicit (BUILT_IN_STRCPY);
unsigned HOST_WIDE_INT origlen;
/* Don't crash on snprintf (str1, cst, "%s"). */
@@ -11632,7 +11633,7 @@ fold_builtin_snprintf (location_t loc, tree dest, tree destsize, tree fmt,
if (call && retval)
{
- tree fn = built_in_decls[BUILT_IN_SNPRINTF];
+ tree fn = builtin_decl_explicit (BUILT_IN_SNPRINTF);
retval = fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fn)), retval);
return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
}
@@ -11720,16 +11721,16 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
switch (fcode)
{
case BUILT_IN_MEMCPY_CHK:
- fn = built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_explicit (BUILT_IN_MEMCPY);
break;
case BUILT_IN_MEMPCPY_CHK:
- fn = built_in_decls[BUILT_IN_MEMPCPY];
+ fn = builtin_decl_explicit (BUILT_IN_MEMPCPY);
break;
case BUILT_IN_MEMMOVE_CHK:
- fn = built_in_decls[BUILT_IN_MEMMOVE];
+ fn = builtin_decl_explicit (BUILT_IN_MEMMOVE);
break;
case BUILT_IN_MEMSET_CHK:
- fn = built_in_decls[BUILT_IN_MEMSET];
+ fn = builtin_decl_explicit (BUILT_IN_MEMSET);
break;
default:
break;
@@ -11781,7 +11782,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
normal __memcpy_chk. */
if (readonly_data_expr (src))
{
- tree fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
+ tree fn = builtin_decl_explicit (BUILT_IN_MEMCPY_CHK);
if (!fn)
return NULL_RTX;
fn = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 4,
@@ -12045,7 +12046,7 @@ fold_builtin_memory_chk (location_t loc, tree fndecl,
{
/* (void) __mempcpy_chk () can be optimized into
(void) __memcpy_chk (). */
- fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
+ fn = builtin_decl_explicit (BUILT_IN_MEMCPY_CHK);
if (!fn)
return NULL_TREE;
@@ -12067,16 +12068,16 @@ fold_builtin_memory_chk (location_t loc, tree fndecl,
switch (fcode)
{
case BUILT_IN_MEMCPY_CHK:
- fn = built_in_decls[BUILT_IN_MEMCPY];
+ fn = builtin_decl_explicit (BUILT_IN_MEMCPY);
break;
case BUILT_IN_MEMPCPY_CHK:
- fn = built_in_decls[BUILT_IN_MEMPCPY];
+ fn = builtin_decl_explicit (BUILT_IN_MEMPCPY);
break;
case BUILT_IN_MEMMOVE_CHK:
- fn = built_in_decls[BUILT_IN_MEMMOVE];
+ fn = builtin_decl_explicit (BUILT_IN_MEMMOVE);
break;
case BUILT_IN_MEMSET_CHK:
- fn = built_in_decls[BUILT_IN_MEMSET];
+ fn = builtin_decl_explicit (BUILT_IN_MEMSET);
break;
default:
break;
@@ -12131,7 +12132,7 @@ fold_builtin_stxcpy_chk (location_t loc, tree fndecl, tree dest,
/* If return value of __stpcpy_chk is ignored,
optimize into __strcpy_chk. */
- fn = built_in_decls[BUILT_IN_STRCPY_CHK];
+ fn = builtin_decl_explicit (BUILT_IN_STRCPY_CHK);
if (!fn)
return NULL_TREE;
@@ -12143,7 +12144,7 @@ fold_builtin_stxcpy_chk (location_t loc, tree fndecl, tree dest,
/* If c_strlen returned something, but not a constant,
transform __strcpy_chk into __memcpy_chk. */
- fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
+ fn = builtin_decl_explicit (BUILT_IN_MEMCPY_CHK);
if (!fn)
return NULL_TREE;
@@ -12163,8 +12164,8 @@ fold_builtin_stxcpy_chk (location_t loc, tree fndecl, tree dest,
}
/* If __builtin_st{r,p}cpy_chk is used, assume st{r,p}cpy is available. */
- fn = built_in_decls[fcode == BUILT_IN_STPCPY_CHK
- ? BUILT_IN_STPCPY : BUILT_IN_STRCPY];
+ fn = builtin_decl_explicit (fcode == BUILT_IN_STPCPY_CHK
+ ? BUILT_IN_STPCPY : BUILT_IN_STRCPY);
if (!fn)
return NULL_TREE;
@@ -12208,7 +12209,7 @@ fold_builtin_strncpy_chk (location_t loc, tree dest, tree src,
}
/* If __builtin_strncpy_chk is used, assume strncpy is available. */
- fn = built_in_decls[BUILT_IN_STRNCPY];
+ fn = builtin_decl_explicit (BUILT_IN_STRNCPY);
if (!fn)
return NULL_TREE;
@@ -12239,7 +12240,7 @@ fold_builtin_strcat_chk (location_t loc, tree fndecl, tree dest,
return NULL_TREE;
/* If __builtin_strcat_chk is used, assume strcat is available. */
- fn = built_in_decls[BUILT_IN_STRCAT];
+ fn = builtin_decl_explicit (BUILT_IN_STRCAT);
if (!fn)
return NULL_TREE;
@@ -12281,7 +12282,7 @@ fold_builtin_strncat_chk (location_t loc, tree fndecl,
&& ! tree_int_cst_lt (len, src_len))
{
/* If LEN >= strlen (SRC), optimize into __strcat_chk. */
- fn = built_in_decls[BUILT_IN_STRCAT_CHK];
+ fn = builtin_decl_explicit (BUILT_IN_STRCAT_CHK);
if (!fn)
return NULL_TREE;
@@ -12291,7 +12292,7 @@ fold_builtin_strncat_chk (location_t loc, tree fndecl,
}
/* If __builtin_strncat_chk is used, assume strncat is available. */
- fn = built_in_decls[BUILT_IN_STRNCAT];
+ fn = builtin_decl_explicit (BUILT_IN_STRNCAT);
if (!fn)
return NULL_TREE;
@@ -12382,8 +12383,8 @@ fold_builtin_sprintf_chk_1 (location_t loc, int nargs, tree *args,
}
/* If __builtin_{,v}sprintf_chk is used, assume {,v}sprintf is available. */
- fn = built_in_decls[fcode == BUILT_IN_VSPRINTF_CHK
- ? BUILT_IN_VSPRINTF : BUILT_IN_SPRINTF];
+ fn = builtin_decl_explicit (fcode == BUILT_IN_VSPRINTF_CHK
+ ? BUILT_IN_VSPRINTF : BUILT_IN_SPRINTF);
if (!fn)
return NULL_TREE;
@@ -12471,8 +12472,8 @@ fold_builtin_snprintf_chk_1 (location_t loc, int nargs, tree *args,
/* If __builtin_{,v}snprintf_chk is used, assume {,v}snprintf is
available. */
- fn = built_in_decls[fcode == BUILT_IN_VSNPRINTF_CHK
- ? BUILT_IN_VSNPRINTF : BUILT_IN_SNPRINTF];
+ fn = builtin_decl_explicit (fcode == BUILT_IN_VSNPRINTF_CHK
+ ? BUILT_IN_VSNPRINTF : BUILT_IN_SNPRINTF);
if (!fn)
return NULL_TREE;
@@ -12526,13 +12527,13 @@ fold_builtin_printf (location_t loc, tree fndecl, tree fmt,
{
/* If we're using an unlocked function, assume the other
unlocked functions exist explicitly. */
- fn_putchar = built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED];
- fn_puts = built_in_decls[BUILT_IN_PUTS_UNLOCKED];
+ fn_putchar = builtin_decl_explicit (BUILT_IN_PUTCHAR_UNLOCKED);
+ fn_puts = builtin_decl_explicit (BUILT_IN_PUTS_UNLOCKED);
}
else
{
- fn_putchar = implicit_built_in_decls[BUILT_IN_PUTCHAR];
- fn_puts = implicit_built_in_decls[BUILT_IN_PUTS];
+ fn_putchar = builtin_decl_implicit (BUILT_IN_PUTCHAR);
+ fn_puts = builtin_decl_implicit (BUILT_IN_PUTS);
}
if (!init_target_chars ())
@@ -12677,13 +12678,13 @@ fold_builtin_fprintf (location_t loc, tree fndecl, tree fp,
{
/* If we're using an unlocked function, assume the other
unlocked functions exist explicitly. */
- fn_fputc = built_in_decls[BUILT_IN_FPUTC_UNLOCKED];
- fn_fputs = built_in_decls[BUILT_IN_FPUTS_UNLOCKED];
+ fn_fputc = builtin_decl_explicit (BUILT_IN_FPUTC_UNLOCKED);
+ fn_fputs = builtin_decl_explicit (BUILT_IN_FPUTS_UNLOCKED);
}
else
{
- fn_fputc = implicit_built_in_decls[BUILT_IN_FPUTC];
- fn_fputs = implicit_built_in_decls[BUILT_IN_FPUTS];
+ fn_fputc = builtin_decl_implicit (BUILT_IN_FPUTC);
+ fn_fputs = builtin_decl_implicit (BUILT_IN_FPUTS);
}
if (!init_target_chars ())
@@ -13485,7 +13486,7 @@ fold_call_stmt (gimple stmt, bool ignore)
return NULL_TREE;
}
-/* Look up the function in built_in_decls that corresponds to DECL
+/* Look up the function in builtin_decl that corresponds to DECL
and set ASMSPEC as its user assembler name. DECL must be a
function decl that declares a builtin. */
@@ -13497,8 +13498,9 @@ set_builtin_user_assembler_name (tree decl, const char *asmspec)
&& DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& asmspec != 0);
- builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
- set_user_assembler_name (builtin, asmspec);
+ builtin = builtin_decl_explicit (DECL_FUNCTION_CODE (decl));
+ set_user_assembler_name (
+builtin, asmspec);
switch (DECL_FUNCTION_CODE (decl))
{
case BUILT_IN_MEMCPY: