#include "tm_p.h"
#include "timevar.h"
#include "sbitmap.h"
+#include "langhooks.h"
+#include "target.h"
#if !defined FUNCTION_OK_FOR_SIBCALL
#define FUNCTION_OK_FOR_SIBCALL(DECL) 1
if (save_mode == BLKmode)
{
save_area = assign_stack_temp (BLKmode, num_to_save, 0);
- /* Cannot use emit_block_move here because it can be done by a
- library call which in turn gets into this place again and deadly
- infinite recursion happens. */
- move_by_pieces (validize_mem (save_area), stack_area, num_to_save,
- PARM_BOUNDARY);
+ emit_block_move (validize_mem (save_area), stack_area,
+ GEN_INT (num_to_save), BLOCK_OP_CALL_PARM);
}
else
{
if (save_mode != BLKmode)
emit_move_insn (stack_area, save_area);
else
- /* Cannot use emit_block_move here because it can be done by a library
- call which in turn gets into this place again and deadly infinite
- recursion happens. */
- move_by_pieces (stack_area, validize_mem (save_area),
- high_to_save - low_to_save + 1, PARM_BOUNDARY);
+ emit_block_move (stack_area, validize_mem (save_area),
+ GEN_INT (high_to_save - low_to_save + 1),
+ BLOCK_OP_CALL_PARM);
}
#endif /* REG_PARM_STACK_SPACE */
NULL_RTX, BITS_PER_UNIT);
seq = get_insns ();
end_sequence ();
- emit_insns_before (seq, first_insn);
+ emit_insn_before (seq, first_insn);
emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
}
}
warning_with_decl (fndecl, "inlining failed in call to `%s'");
warning ("called from here");
}
- mark_addressable (fndecl);
+ (*lang_hooks.mark_addressable) (fndecl);
return (rtx) (size_t) - 1;
}
warning_with_decl (fndecl, "can't inline call to `%s'");
warning ("called from here");
}
- mark_addressable (fndecl);
+ (*lang_hooks.mark_addressable) (fndecl);
}
flags |= flags_from_decl_or_type (fndecl);
/* In case this is a static function, note that it has been
used. */
if (! TREE_ADDRESSABLE (fndecl))
- mark_addressable (fndecl);
+ (*lang_hooks.mark_addressable) (fndecl);
is_integrable = 0;
}
}
!= RETURN_POPS_ARGS (current_function_decl,
TREE_TYPE (current_function_decl),
current_function_args_size))
- try_tail_call = 0;
+ try_tail_call = 0;
if (try_tail_call || try_tail_recursion)
{
if (pass == 0)
{
argblock = virtual_incoming_args_rtx;
+ argblock
+#ifdef STACK_GROWS_DOWNWARD
+ = plus_constant (argblock, current_function_pretend_args_size);
+#else
+ = plus_constant (argblock, -current_function_pretend_args_size);
+#endif
stored_args_map = sbitmap_alloc (args_size.constant);
sbitmap_zero (stored_args_map);
}
{
insns = get_insns ();
end_sequence ();
- emit_insns (insns);
+ emit_insn (insns);
}
else
{
/* Write out the sequence. */
insns = get_insns ();
end_sequence ();
- emit_insns (insns);
+ emit_insn (insns);
valreg = temp;
}
if (save_mode != BLKmode)
emit_move_insn (stack_area, args[i].save_area);
else
- emit_block_move (stack_area,
- validize_mem (args[i].save_area),
- GEN_INT (args[i].size.constant));
+ emit_block_move (stack_area, args[i].save_area,
+ GEN_INT (args[i].size.constant),
+ BLOCK_OP_CALL_PARM);
}
highest_outgoing_arg_in_use = initial_highest_arg_in_use;
tail_recursion_label));
}
else
- emit_insns (normal_call_insns);
+ emit_insn (normal_call_insns);
currently_expanding_call--;
int reg_parm_stack_space = 0;
int needed;
rtx before_call;
+ tree tfom; /* type_for_mode (outmode, 0) */
#ifdef REG_PARM_STACK_SPACE
/* Define the boundary of the register parm stack space that needs to be
/* If this kind of value comes back in memory,
decide where in memory it should come back. */
- if (outmode != VOIDmode && aggregate_value_p (type_for_mode (outmode, 0)))
+ if (outmode != VOIDmode)
{
+ tfom = (*lang_hooks.types.type_for_mode) (outmode, 0);
+ if (aggregate_value_p (tfom))
+ {
#ifdef PCC_STATIC_STRUCT_RETURN
- rtx pointer_reg
- = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)),
- 0, 0);
- mem_value = gen_rtx_MEM (outmode, pointer_reg);
- pcc_struct_value = 1;
- if (value == 0)
- value = gen_reg_rtx (outmode);
+ rtx pointer_reg
+ = hard_function_value (build_pointer_type (tfom), 0, 0);
+ mem_value = gen_rtx_MEM (outmode, pointer_reg);
+ pcc_struct_value = 1;
+ if (value == 0)
+ value = gen_reg_rtx (outmode);
#else /* not PCC_STATIC_STRUCT_RETURN */
- struct_value_size = GET_MODE_SIZE (outmode);
- if (value != 0 && GET_CODE (value) == MEM)
- mem_value = value;
- else
- mem_value = assign_temp (type_for_mode (outmode, 0), 0, 1, 1);
+ struct_value_size = GET_MODE_SIZE (outmode);
+ if (value != 0 && GET_CODE (value) == MEM)
+ mem_value = value;
+ else
+ mem_value = assign_temp (tfom, 0, 1, 1);
#endif
-
- /* This call returns a big structure. */
- flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
+ /* This call returns a big structure. */
+ flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
+ }
}
+ else
+ tfom = void_type_node;
/* ??? Unfinished: must pass the memory address as an argument. */
#endif
;
+ /* loop.c won't look at CALL_INSN_FUNCTION_USAGE of const/pure
+ functions, so we have to pretend this isn't such a function. */
+ if (flags & ECF_LIBCALL_BLOCK)
+ {
+ rtx insns = get_insns ();
+ end_sequence ();
+ emit_insn (insns);
+ }
+ flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
+
if (GET_MODE (val) == MEM && ! must_copy)
slot = val;
else if (must_copy)
{
- slot = assign_temp (type_for_mode (mode, 0), 0, 1, 1);
+ slot = assign_temp ((*lang_hooks.types.type_for_mode) (mode, 0),
+ 0, 1, 1);
emit_move_insn (slot, val);
}
else
{
- tree type = type_for_mode (mode, 0);
+ tree type = (*lang_hooks.types.type_for_mode) (mode, 0);
slot = gen_rtx_MEM (mode,
expand_expr (build1 (ADDR_EXPR,
{
save_area = assign_stack_temp (BLKmode, num_to_save, 0);
set_mem_align (save_area, PARM_BOUNDARY);
- emit_block_move (validize_mem (save_area), stack_area,
- GEN_INT (num_to_save));
+ emit_block_move (save_area, stack_area, GEN_INT (num_to_save),
+ BLOCK_OP_CALL_PARM);
}
else
{
}
}
- emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
- argblock, GEN_INT (argvec[argnum].offset.constant),
+ emit_push_insn (val, mode, NULL_TREE, NULL_RTX, PARM_BOUNDARY,
+ partial, reg, 0, argblock,
+ GEN_INT (argvec[argnum].offset.constant),
reg_parm_stack_space, ARGS_SIZE_RTX (alignment_pad));
/* Now mark the segment we just used. */
emit_call_1 (fun,
get_identifier (XSTR (orgfun, 0)),
- build_function_type (outmode == VOIDmode ? void_type_node
- : type_for_mode (outmode, 0), NULL_TREE),
+ build_function_type (tfom, NULL_TREE),
original_args_size.constant, args_size.constant,
struct_value_size,
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
{
insns = get_insns ();
end_sequence ();
- emit_insns (insns);
+ emit_insn (insns);
}
else
{
if (save_mode != BLKmode)
emit_move_insn (stack_area, save_area);
else
- emit_block_move (stack_area, validize_mem (save_area),
- GEN_INT (high_to_save - low_to_save + 1));
+ emit_block_move (stack_area, save_area,
+ GEN_INT (high_to_save - low_to_save + 1),
+ BLOCK_OP_CALL_PARM);
}
#endif
arg->save_area = assign_temp (nt, 0, 1, 1);
preserve_temp_slots (arg->save_area);
emit_block_move (validize_mem (arg->save_area), stack_area,
- expr_size (arg->tree_value));
+ expr_size (arg->tree_value),
+ BLOCK_OP_CALL_PARM);
}
else
{
/* If this isn't going to be placed on both the stack and in registers,
set up the register and number of words. */
if (! arg->pass_on_stack)
- reg = arg->reg, partial = arg->partial;
+ {
+ if (flags & ECF_SIBCALL)
+ reg = arg->tail_call_reg;
+ else
+ reg = arg->reg;
+ partial = arg->partial;
+ }
if (reg != 0 && partial == 0)
/* Being passed entirely in a register. We shouldn't be called in
/* This isn't already where we want it on the stack, so put it there.
This can either be done with push or copy insns. */
- emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX, 0,
- partial, reg, used - size, argblock,
+ emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
+ PARM_BOUNDARY, partial, reg, used - size, argblock,
ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
ARGS_SIZE_RTX (arg->alignment_pad));
{
rtx size_rtx1 = GEN_INT (reg_parm_stack_space - arg->offset.constant);
emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx1,
- TYPE_ALIGN (TREE_TYPE (pval)), partial, reg,
- excess, argblock, ARGS_SIZE_RTX (arg->offset),
- reg_parm_stack_space,
+ MAX (PARM_BOUNDARY, TYPE_ALIGN (TREE_TYPE (pval))),
+ partial, reg, excess, argblock,
+ ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
ARGS_SIZE_RTX (arg->alignment_pad));
}
}
emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
- TYPE_ALIGN (TREE_TYPE (pval)), partial, reg, excess,
- argblock, ARGS_SIZE_RTX (arg->offset),
- reg_parm_stack_space,
+ MAX (PARM_BOUNDARY, TYPE_ALIGN (TREE_TYPE (pval))),
+ partial, reg, excess, argblock,
+ ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
ARGS_SIZE_RTX (arg->alignment_pad));
/* Unless this is a partially-in-register argument, the argument is now