/* Procedure integration for GCC.
Copyright (C) 1988, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
if (current_function_calls_alloca)
return N_("function using alloca cannot be inline");
+ if (current_function_calls_longjmp)
+ return N_("function using longjmp cannot be inline");
+
if (current_function_calls_setjmp)
return N_("function using setjmp cannot be inline");
if (current_function_cannot_inline)
return current_function_cannot_inline;
- /* If its not even close, don't even look. */
+ /* If it's not even close, don't even look. */
if (get_max_uid () > 3 * max_insns)
return N_("function too large to be inline");
tree parms;
/* Clear out PARMDECL_MAP. It was allocated in the caller's frame. */
- memset ((char *) parmdecl_map, 0, max_parm_reg * sizeof (tree));
+ memset (parmdecl_map, 0, max_parm_reg * sizeof (tree));
arg_vector = rtvec_alloc (list_length (DECL_ARGUMENTS (fndecl)));
for (parms = DECL_ARGUMENTS (fndecl), i = 0;
else
{
copy = copy_node (decl);
+ /* The COPY is not abstract; it will be generated in TO_FN. */
+ DECL_ABSTRACT (copy) = 0;
(*lang_hooks.dup_lang_specific_decl) (copy);
/* TREE_ADDRESSABLE isn't used to indicate that a label's
}
/* Make the insns and PARM_DECLs of the current function permanent
- and record other information in DECL_SAVED_INSNS to allow inlining
- of this function in subsequent calls.
+ and record other information in DECL_STRUCT_FUNCTION to allow
+ inlining of this function in subsequent calls.
This routine need not copy any insns because we are not going
to immediately compile the insns in the insn chain. There
for the parms, prior to elimination of virtual registers.
These values are needed for substituting parms properly. */
if (! flag_no_inline)
- parmdecl_map = (tree *) xmalloc (max_parm_reg * sizeof (tree));
+ parmdecl_map = xmalloc (max_parm_reg * sizeof (tree));
/* Make and emit a return-label if we have not already done so. */
}
cfun->original_decl_initial = DECL_INITIAL (fndecl);
cfun->no_debugging_symbols = (write_symbols == NO_DEBUG);
- DECL_SAVED_INSNS (fndecl) = cfun;
+ cfun->saved_for_inline = 1;
/* Clean up. */
if (! flag_no_inline)
tree type, rtx structure_value_addr)
{
struct function *inlining_previous;
- struct function *inl_f = DECL_SAVED_INSNS (fndecl);
+ struct function *inl_f = DECL_STRUCT_FUNCTION (fndecl);
tree formal, actual, block;
rtx parm_insns = inl_f->emit->x_first_insn;
rtx insns = (inl_f->inl_last_parm_insn
/* Expand the function arguments. Do this first so that any
new registers get created before we allocate the maps. */
- arg_vals = (rtx *) xmalloc (nargs * sizeof (rtx));
- arg_trees = (tree *) xmalloc (nargs * sizeof (tree));
+ arg_vals = xmalloc (nargs * sizeof (rtx));
+ arg_trees = xmalloc (nargs * sizeof (tree));
for (formal = DECL_ARGUMENTS (fndecl), actual = parms, i = 0;
formal;
abort ();
/* The mode if LOC and ARG can differ if LOC was a variable
- that had its mode promoted via PROMOTED_MODE. */
+ that had its mode promoted. */
arg_vals[i] = convert_modes (pmode,
TYPE_MODE (TREE_TYPE (arg)),
expand_expr (arg, NULL_RTX, mode,
/* Allocate the structures we use to remap things. */
- map = (struct inline_remap *) xcalloc (1, sizeof (struct inline_remap));
+ map = xcalloc (1, sizeof (struct inline_remap));
map->fndecl = fndecl;
VARRAY_TREE_INIT (map->block_map, 10, "block_map");
- map->reg_map = (rtx *) xcalloc (max_regno, sizeof (rtx));
+ map->reg_map = xcalloc (max_regno, sizeof (rtx));
/* We used to use alloca here, but the size of what it would try to
allocate would occasionally cause it to exceed the stack limit and
cause unpredictable core dumps. */
- real_label_map
- = (rtx *) xmalloc ((max_labelno) * sizeof (rtx));
+ real_label_map = xmalloc ((max_labelno) * sizeof (rtx));
map->label_map = real_label_map;
map->local_return_label = NULL_RTX;
inl_max_uid = (inl_f->emit->x_cur_insn_uid + 1);
- map->insn_map = (rtx *) xcalloc (inl_max_uid, sizeof (rtx));
+ map->insn_map = xcalloc (inl_max_uid, sizeof (rtx));
map->min_insnno = 0;
map->max_insnno = inl_max_uid;
incoming arg rtx values are expanded now so that we can be
sure we have enough slots in the const equiv map since the
store_expr call can easily blow the size estimate. */
- if (DECL_SAVED_INSNS (fndecl)->args_size != 0)
+ if (DECL_STRUCT_FUNCTION (fndecl)->args_size != 0)
copy_rtx_and_substitute (virtual_incoming_args_rtx, map, 0);
}
else if (GET_CODE (loc) == REG)
else
{
if (! structure_value_addr
- || ! aggregate_value_p (DECL_RESULT (fndecl)))
+ || ! aggregate_value_p (DECL_RESULT (fndecl), fndecl))
abort ();
/* Pass the function the address in which to return a structure
/* Initialize label_map. get_label_from_map will actually make
the labels. */
- memset ((char *) &map->label_map[min_labelno], 0,
- (max_labelno - min_labelno) * sizeof (rtx));
+ memset (&map->label_map[min_labelno], 0,
+ (max_labelno - min_labelno) * sizeof (rtx));
/* Make copies of the decls of the symbols in the inline function, so that
the copies of the variables get declared in the current function. Set
out of the temp register into a BLKmode memory object. */
if (target
&& TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == BLKmode
- && ! aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl))))
+ && ! aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl)), fndecl))
target = copy_blkmode_from_reg (0, target, TREE_TYPE (TREE_TYPE (fndecl)));
if (structure_value_addr)
gen_rtx_MEM (GET_MODE (static_chain_incoming_rtx),
SET_DEST (set));
- /* emit the instruction in case it is used for something
+ /* Emit the instruction in case it is used for something
other than setting the static chain; if it's not used,
it can always be removed as dead code */
copy = emit_insn (copy_rtx_and_substitute (pattern, map, 0));
regno = REGNO (orig);
if (regno <= LAST_VIRTUAL_REGISTER
|| (map->integrating
- && DECL_SAVED_INSNS (map->fndecl)->internal_arg_pointer == orig))
+ && DECL_STRUCT_FUNCTION (map->fndecl)->internal_arg_pointer
+ == orig))
{
/* Some hard registers are also mapped,
but others are not translated. */
else if (regno == VIRTUAL_STACK_VARS_REGNUM)
{
rtx loc, seq;
- int size = get_func_frame_size (DECL_SAVED_INSNS (map->fndecl));
+ int size
+ = get_func_frame_size (DECL_STRUCT_FUNCTION (map->fndecl));
#ifdef FRAME_GROWS_DOWNWARD
int alignment
- = (DECL_SAVED_INSNS (map->fndecl)->stack_alignment_needed
+ = (DECL_STRUCT_FUNCTION (map->fndecl)->stack_alignment_needed
/ BITS_PER_UNIT);
/* In this case, virtual_stack_vars_rtx points to one byte
}
else if (regno == VIRTUAL_INCOMING_ARGS_REGNUM
|| (map->integrating
- && (DECL_SAVED_INSNS (map->fndecl)->internal_arg_pointer
+ && (DECL_STRUCT_FUNCTION (map->fndecl)->internal_arg_pointer
== orig)))
{
/* Do the same for a block to contain any arguments referenced
in memory. */
rtx loc, seq;
- int size = DECL_SAVED_INSNS (map->fndecl)->args_size;
+ int size = DECL_STRUCT_FUNCTION (map->fndecl)->args_size;
start_sequence ();
loc = assign_stack_temp (BLKmode, size, 1);
if (NOTE_LINE_NUMBER (orig) != NOTE_INSN_DELETED_LABEL)
break;
- /* ... FALLTHRU ... */
+ /* Fall through. */
case CODE_LABEL:
LABEL_PRESERVE_P (get_label_from_map (map, CODE_LABEL_NUMBER (orig)))
= LABEL_PRESERVE_P (orig);
#endif
temp = XEXP (temp, 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (temp) != GET_MODE (orig))
- temp = convert_memory_address (GET_MODE (orig), temp);
-#endif
+ temp = convert_memory_address (GET_MODE (orig), temp);
return temp;
}
else if (GET_CODE (constant) == LABEL_REF)
switch (*format_ptr++)
{
case '0':
- /* Copy this through the wide int field; that's safest. */
- X0WINT (copy, i) = X0WINT (orig, i);
+ X0ANY (copy, i) = X0ANY (orig, i);
break;
case 'e':
/* If this is a commutative operation, move a constant to the second
operand unless the second operand is already a CONST_INT. */
if (! memonly
- && (GET_RTX_CLASS (code) == 'c' || code == NE || code == EQ)
+ && (GET_RTX_CLASS (code) == RTX_COMM_ARITH
+ || GET_RTX_CLASS (code) == RTX_COMM_COMPARE)
&& CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
{
rtx tem = XEXP (x, 0);
if (! memonly)
switch (GET_RTX_CLASS (code))
{
- case '1':
+ case RTX_UNARY:
if (op0_mode == MAX_MACHINE_MODE)
abort ();
new = simplify_unary_operation (code, GET_MODE (x),
XEXP (x, 0), op0_mode);
break;
- case '<':
+ case RTX_COMPARE:
+ case RTX_COMM_COMPARE:
{
enum machine_mode op_mode = GET_MODE (XEXP (x, 0));
break;
}
- case '2':
- case 'c':
+ case RTX_BIN_ARITH:
+ case RTX_COMM_ARITH:
new = simplify_binary_operation (code, GET_MODE (x),
XEXP (x, 0), XEXP (x, 1));
break;
- case 'b':
- case '3':
+ case RTX_BITFIELD_OPS:
+ case RTX_TERNARY:
if (op0_mode == MAX_MACHINE_MODE)
abort ();
{
rtx op0 = XEXP (x, 0);
- if (GET_RTX_CLASS (GET_CODE (op0)) == '<'
+ if (COMPARISON_P (op0)
&& GET_MODE (op0) == VOIDmode
&& ! side_effects_p (op0)
&& XEXP (op0, 0) == map->compare_src
XEXP (x, 0), XEXP (x, 1),
XEXP (x, 2));
break;
+
+ default:
+ break;
}
if (new)
{
unsigned int uregno = regno;
unsigned int last_reg = (uregno >= FIRST_PSEUDO_REGISTER ? uregno
- : uregno + HARD_REGNO_NREGS (uregno, mode) - 1);
+ : uregno + hard_regno_nregs[uregno][mode] - 1);
unsigned int i;
/* Ignore virtual stack var or virtual arg register since those
}
}
\f
-/* Output the assembly language code for the function FNDECL
- from its DECL_SAVED_INSNS. Used for inline functions that are output
+/* Output the assembly language code for the function FNDECL from
+ its DECL_STRUCT_FUNCTION. Used for inline functions that are output
at end of compilation instead of where they came in the source. */
static GTY(()) struct function *old_cfun;
{
enum debug_info_type old_write_symbols = write_symbols;
const struct gcc_debug_hooks *const old_debug_hooks = debug_hooks;
- struct function *f = DECL_SAVED_INSNS (fndecl);
+ struct function *f = DECL_STRUCT_FUNCTION (fndecl);
old_cfun = cfun;
cfun = f;
if (ivs == 0)
{
- fun->hard_reg_initial_vals = (void *) ggc_alloc (sizeof (initial_value_struct));
+ fun->hard_reg_initial_vals = ggc_alloc (sizeof (initial_value_struct));
ivs = fun->hard_reg_initial_vals;
ivs->num_entries = 0;
ivs->max_entries = 5;
- ivs->entries = (initial_value_pair *) ggc_alloc (5 * sizeof (initial_value_pair));
+ ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair));
}
if (ivs->num_entries >= ivs->max_entries)
{
ivs->max_entries += 5;
- ivs->entries =
- (initial_value_pair *) ggc_realloc (ivs->entries,
- ivs->max_entries
- * sizeof (initial_value_pair));
+ ivs->entries = ggc_realloc (ivs->entries,
+ ivs->max_entries
+ * sizeof (initial_value_pair));
}
ivs->entries[ivs->num_entries].hard_reg = reg;