inner = max_align;
while (handled_component_p (exp))
{
- /* Fields in a structure can be packed, honour DECL_ALIGN
+ /* Fields in a structure can be packed, honor DECL_ALIGN
of the FIELD_DECL. For all other references the conservative
alignment is the element type alignment. */
if (TREE_CODE (exp) == COMPONENT_REF)
/* Pick up FP, label, and SP from the block and jump. This code is
from expand_goto in stmt.c; see there for detailed comments. */
-#if HAVE_nonlocal_goto
+#ifdef HAVE_nonlocal_goto
if (HAVE_nonlocal_goto)
/* We have to pass a value to the nonlocal_goto pattern that will
get copied into the static_chain pointer, but it does not matter
current_function_has_nonlocal_goto = 1;
-#if HAVE_nonlocal_goto
+#ifdef HAVE_nonlocal_goto
/* ??? We no longer need to pass the static chain value, afaik. */
if (HAVE_nonlocal_goto)
emit_insn (gen_nonlocal_goto (const0_rtx, r_label, r_sp, r_fp));
gcc_assert (fallback_fndecl != NULL_TREE);
exp = build_function_call_expr (fallback_fndecl, arglist);
- tmp = expand_builtin_mathfn (exp, NULL_RTX, NULL_RTX);
+ tmp = expand_normal (exp);
/* Truncate the result of floating point optab to integer
via expand_fix (). */
tree dest = TREE_VALUE (arglist);
tree val = TREE_VALUE (TREE_CHAIN (arglist));
tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+ tree fndecl, fn;
+ enum built_in_function fcode;
char c;
-
- unsigned int dest_align
- = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
+ unsigned int dest_align;
rtx dest_mem, dest_addr, len_rtx;
+ dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
+
/* If DEST is not a pointer type, don't do this
operation in-line. */
if (dest_align == 0)
return expand_expr (dest, target, mode, EXPAND_NORMAL);
}
+ /* Stabilize the arguments in case we fail. */
+ dest = builtin_save_expr (dest);
+ val = builtin_save_expr (val);
+ len = builtin_save_expr (len);
+
len_rtx = expand_normal (len);
dest_mem = get_memory_rtx (dest, len);
if (TREE_CODE (val) != INTEGER_CST)
{
+ tree cval;
rtx val_rtx;
- val = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
- val_rtx = expand_normal (val);
+ cval = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
+ val_rtx = expand_normal (cval);
/* Assume that we can memset by pieces if we can store the
* the coefficients by pieces (in the required modes).
store_by_pieces (dest_mem, tree_low_cst (len, 1),
builtin_memset_gen_str, val_rtx, dest_align, 0);
}
- else if (!set_storage_via_setmem(dest_mem, len_rtx, val_rtx,
- dest_align))
- return 0;
+ else if (!set_storage_via_setmem (dest_mem, len_rtx, val_rtx,
+ dest_align))
+ goto do_libcall;
dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
dest_mem = convert_memory_address (ptr_mode, dest_mem);
}
if (target_char_cast (val, &c))
- return 0;
+ goto do_libcall;
if (c)
{
builtin_memset_read_str, &c, dest_align, 0);
else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c),
dest_align))
- return 0;
+ goto do_libcall;
dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
dest_mem = convert_memory_address (ptr_mode, dest_mem);
}
return dest_addr;
+
+ do_libcall:
+ fndecl = get_callee_fndecl (orig_exp);
+ fcode = DECL_FUNCTION_CODE (fndecl);
+ gcc_assert (fcode == BUILT_IN_MEMSET || fcode == BUILT_IN_BZERO);
+ arglist = build_tree_list (NULL_TREE, len);
+ if (fcode == BUILT_IN_MEMSET)
+ arglist = tree_cons (NULL_TREE, val, arglist);
+ arglist = tree_cons (NULL_TREE, dest, arglist);
+ fn = build_function_call_expr (fndecl, arglist);
+ if (TREE_CODE (fn) == CALL_EXPR)
+ CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (orig_exp);
+ return expand_call (fn, target, target == const0_rtx);
}
}
GEN_INT (MIN (arg1_align, arg2_align)));
}
#endif
-#if HAVE_cmpstrnsi
+#ifdef HAVE_cmpstrnsi
/* Try to determine at least one length and call cmpstrnsi. */
if (!insn && HAVE_cmpstrnsi)
{
/* If both arguments have side effects, we cannot optimize. */
if (!len || TREE_SIDE_EFFECTS (len))
- return 0;
+ goto do_libcall;
- /* Stabilize the arguments in case gen_cmpstrnsi fails. */
arg3_rtx = expand_normal (len);
/* Make a place to write the result of the instruction. */
/* Expand the library call ourselves using a stabilized argument
list to avoid re-evaluating the function's arguments twice. */
+#ifdef HAVE_cmpstrnsi
+ do_libcall:
+#endif
arglist = build_tree_list (NULL_TREE, arg2);
arglist = tree_cons (NULL_TREE, arg1, arglist);
fndecl = get_callee_fndecl (exp);
static tree
dummy_object (tree type)
{
- tree t = convert (build_pointer_type (type), null_pointer_node);
+ tree t = build_int_cst (build_pointer_type (type), 0);
return build1 (INDIRECT_REF, type, t);
}
TREE_PUBLIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
TREE_NOTHROW (decl) = 1;
+ DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+ DECL_VISIBILITY_SPECIFIED (decl) = 1;
call = build_function_call_expr (decl, arglist);
return expand_call (call, target, ignore);
if (call && retval)
{
- retval = convert
+ retval = fold_convert
(TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SPRINTF])),
retval);
return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);