return "nested function cannot be inline";
/* If its not even close, don't even look. */
- if (!TREE_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
+ if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
return "function too large to be inline";
#if 0
/* Large stacks are OK now that inlined functions can share them. */
/* Don't inline functions with large stack usage,
since they can make other recursive functions burn up stack. */
- if (!TREE_INLINE (fndecl) && get_frame_size () > 100)
+ if (!DECL_INLINE (fndecl) && get_frame_size () > 100)
return "function stack frame for inlining";
#endif
if (int_size_in_bytes (TREE_TYPE (parms)) < 0)
return "function with varying-size parameter cannot be inline";
- if (!TREE_INLINE (fndecl) && get_max_uid () > max_insns)
+ if (!DECL_INLINE (fndecl) && get_max_uid () > max_insns)
{
for (ninsns = 0, insn = get_first_nonparm_insn (); insn && ninsns < max_insns;
insn = NEXT_INSN (insn))
FIRST_PARM_INSN (head) = get_insns ();
DECL_SAVED_INSNS (fndecl) = head;
DECL_FRAME_SIZE (fndecl) = get_frame_size ();
- TREE_INLINE (fndecl) = 1;
+ DECL_INLINE (fndecl) = 1;
+}
+
+/* Adjust the BLOCK_END_NOTE pointers in a given copied DECL tree so that
+ they all point to the new (copied) rtxs. */
+
+static void
+adjust_copied_decl_tree (block)
+ register tree block;
+{
+ register tree subblock;
+ register rtx original_end;
+
+ original_end = BLOCK_END_NOTE (block);
+ if (original_end)
+ {
+ BLOCK_END_NOTE (block) = (rtx) NOTE_SOURCE_FILE (original_end);
+ NOTE_SOURCE_FILE (original_end) = 0;
+ }
+
+ /* Process all subblocks. */
+ for (subblock = BLOCK_SUBBLOCKS (block);
+ subblock;
+ subblock = TREE_CHAIN (subblock))
+ adjust_copied_decl_tree (subblock);
}
/* Make the insns and PARM_DECLs of the current function permanent
continue;
copy = rtx_alloc (NOTE);
- NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
NOTE_LINE_NUMBER (copy) = NOTE_LINE_NUMBER (insn);
+ if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END)
+ NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
+ else
+ {
+ NOTE_SOURCE_FILE (insn) = (char *) copy;
+ NOTE_SOURCE_FILE (copy) = 0;
+ }
break;
case INSN:
last_insn = copy;
}
+ adjust_copied_decl_tree (DECL_INITIAL (fndecl));
+
/* Now copy the REG_NOTES. */
for (insn = NEXT_INSN (get_insns ()); insn; insn = NEXT_INSN (insn))
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
t = copy_node (block);
BLOCK_VARS (t) = vars;
BLOCK_SUBBLOCKS (t) = nreverse (subblocks);
+ /* If the BLOCK being cloned is already marked as having been instantiated
+ from something else, then leave that `origin' marking alone. Elsewise,
+ mark the clone as having originated from the BLOCK we are cloning. */
+ if (BLOCK_ABSTRACT_ORIGIN (t) == NULL_TREE)
+ BLOCK_ABSTRACT_ORIGIN (t) = block;
return t;
}
tree type;
rtx structure_value_addr;
{
- tree formal, actual;
+ tree formal, actual, block;
rtx header = DECL_SAVED_INSNS (fndecl);
rtx insns = FIRST_FUNCTION_INSN (header);
rtx parm_insns = FIRST_PARM_INSN (header);
/* We expect PARMS to have the right length; don't crash if not. */
if (list_length (parms) != nargs)
- return (rtx)-1;
+ return (rtx) (HOST_WIDE_INT) -1;
/* Also check that the parms type match. Since the appropriate
conversions or default promotions have already been applied,
the machine modes should match exactly. */
tree arg = TREE_VALUE (actual);
enum machine_mode mode = TYPE_MODE (DECL_ARG_TYPE (formal));
if (mode != TYPE_MODE (TREE_TYPE (arg)))
- return (rtx)-1;
+ return (rtx) (HOST_WIDE_INT) -1;
/* If they are block mode, the types should match exactly.
They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE,
which could happen if the parameter has incomplete type. */
if (mode == BLKmode && TREE_TYPE (arg) != TREE_TYPE (formal))
- return (rtx)-1;
+ return (rtx) (HOST_WIDE_INT) -1;
}
/* Make a binding contour to keep inline cleanups called at
if (GET_CODE (loc) == MEM && GET_CODE (XEXP (loc, 0)) == REG
&& REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)
{
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg));
- rtx stack_slot = assign_stack_temp (mode, int_size_in_bytes (TREE_TYPE (arg)), 1);
+ rtx stack_slot
+ = assign_stack_temp (TYPE_MODE (TREE_TYPE (arg)),
+ int_size_in_bytes (TREE_TYPE (arg)), 1);
store_expr (arg, stack_slot, 0);
arg_vals[i] = XEXP (stack_slot, 0);
}
else if (GET_CODE (loc) != MEM)
- arg_vals[i] = expand_expr (arg, NULL_RTX, mode, EXPAND_SUM);
+ /* The mode if LOC and ARG can differ if LOC was a variable
+ that had its mode promoted via PROMOTED_MODE. */
+ arg_vals[i] = convert_to_mode (GET_MODE (loc),
+ expand_expr (arg, NULL_RTX, mode,
+ EXPAND_SUM),
+ TREE_UNSIGNED (TREE_TYPE (formal)));
else
arg_vals[i] = 0;
|| GET_CODE (arg_vals[i]) == SUBREG
|| GET_CODE (arg_vals[i]) == MEM)
&& reg_overlap_mentioned_p (arg_vals[i], target))))
- arg_vals[i] = copy_to_mode_reg (mode, arg_vals[i]);
+ arg_vals[i] = copy_to_mode_reg (GET_MODE (loc), arg_vals[i]);
}
/* Allocate the structures we use to remap things. */
and copied LABEL_DECLs. */
expand_end_bindings (getdecls (), 1, 1);
- poplevel (1, 1, 0);
+ block = poplevel (1, 1, 0);
+ BLOCK_ABSTRACT_ORIGIN (block) = fndecl;
poplevel (0, 0, 0);
emit_line_note (input_filename, lineno);
LEVEL indicates how far down into the BLOCK tree is the node we are
currently traversing. It is always zero except for recursive calls.
- MAP, if nonzero, is a pointer to a inline_remap map which indicates how
+ MAP, if nonzero, is a pointer to an inline_remap map which indicates how
registers used in the DECL_RTL field should be remapped. If it is zero,
no mapping is necessary. */
}
else if (DECL_RTL (t))
DECL_RTL (d) = copy_rtx (DECL_RTL (t));
- TREE_EXTERNAL (d) = TREE_EXTERNAL (t);
+ DECL_EXTERNAL (d) = DECL_EXTERNAL (t);
TREE_STATIC (d) = TREE_STATIC (t);
TREE_PUBLIC (d) = TREE_PUBLIC (t);
TREE_CONSTANT (d) = TREE_CONSTANT (t);
{
node = poplevel (1, 0, 0);
if (node)
- TREE_USED (node) = TREE_USED (let);
+ {
+ TREE_USED (node) = TREE_USED (let);
+ BLOCK_ABSTRACT_ORIGIN (node) = let;
+ }
}
}
\f
rounded = CEIL_ROUND (size, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
loc = plus_constant (loc, rounded);
#endif
- map->reg_map[regno] = temp = force_operand (loc, NULL_RTX);
+ map->reg_map[regno] = temp
+ = force_reg (Pmode, force_operand (loc, NULL_RTX));
map->const_equiv_map[REGNO (temp)] = loc;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
start_sequence ();
loc = assign_stack_temp (BLKmode, size, 1);
loc = XEXP (loc, 0);
- map->reg_map[regno] = temp = force_operand (loc, NULL_RTX);
+ map->reg_map[regno] = temp
+ = force_reg (Pmode, force_operand (loc, NULL_RTX));
map->const_equiv_map[REGNO (temp)] = loc;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
src = SET_SRC (x);
while (GET_CODE (*dest_loc) == ZERO_EXTRACT
- || GET_CODE (*dest_loc) == SIGN_EXTRACT
+ /* By convention, we always use ZERO_EXTRACT in the dest. */
+/* || GET_CODE (*dest_loc) == SIGN_EXTRACT */
|| GET_CODE (*dest_loc) == SUBREG
|| GET_CODE (*dest_loc) == STRICT_LOW_PART)
{
dest_loc = &XEXP (*dest_loc, 0);
}
+ /* Do substitute in the address of a destination in memory. */
+ if (GET_CODE (*dest_loc) == MEM)
+ subst_constants (&XEXP (*dest_loc, 0), insn, map);
+
/* Check for the case of DEST a SUBREG, both it and the underlying
register are less than one word, and the SUBREG has the wider mode.
In the case, we are really setting the underlying register to the
}
}
\f
+/* Given a pointer to some BLOCK node, if the BLOCK_ABSTRACT_ORIGIN for the
+ given BLOCK node is NULL, set the BLOCK_ABSTRACT_ORIGIN for the node so
+ that it points to the node itself, thus indicating that the node is its
+ own (abstract) origin. Additionally, if the BLOCK_ABSTRACT_ORIGIN for
+ the given node is NULL, recursively descend the decl/block tree which
+ it is the root of, and for each other ..._DECL or BLOCK node contained
+ therein whose DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also
+ still NULL, set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN
+ values to point to themselves. */
+
+static void set_decl_origin_self ();
+
+static void
+set_block_origin_self (stmt)
+ register tree stmt;
+{
+ if (BLOCK_ABSTRACT_ORIGIN (stmt) == NULL_TREE)
+ {
+ BLOCK_ABSTRACT_ORIGIN (stmt) = stmt;
+
+ {
+ register tree local_decl;
+
+ for (local_decl = BLOCK_VARS (stmt);
+ local_decl != NULL_TREE;
+ local_decl = TREE_CHAIN (local_decl))
+ set_decl_origin_self (local_decl); /* Potential recursion. */
+ }
+
+ {
+ register tree subblock;
+
+ for (subblock = BLOCK_SUBBLOCKS (stmt);
+ subblock != NULL_TREE;
+ subblock = BLOCK_CHAIN (subblock))
+ set_block_origin_self (subblock); /* Recurse. */
+ }
+ }
+}
+
+/* Given a pointer to some ..._DECL node, if the DECL_ABSTRACT_ORIGIN for
+ the given ..._DECL node is NULL, set the DECL_ABSTRACT_ORIGIN for the
+ node to so that it points to the node itself, thus indicating that the
+ node represents its own (abstract) origin. Additionally, if the
+ DECL_ABSTRACT_ORIGIN for the given node is NULL, recursively descend
+ the decl/block tree of which the given node is the root of, and for
+ each other ..._DECL or BLOCK node contained therein whose
+ DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also still NULL,
+ set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to
+ point to themselves. */
+
+static void
+set_decl_origin_self (decl)
+ register tree decl;
+{
+ if (DECL_ABSTRACT_ORIGIN (decl) == NULL_TREE)
+ {
+ DECL_ABSTRACT_ORIGIN (decl) = decl;
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ register tree arg;
+
+ for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
+ DECL_ABSTRACT_ORIGIN (arg) = arg;
+ if (DECL_INITIAL (decl) != NULL_TREE)
+ set_block_origin_self (DECL_INITIAL (decl));
+ }
+ }
+}
+\f
+/* Given a pointer to some BLOCK node, and a boolean value to set the
+ "abstract" flags to, set that value into the BLOCK_ABSTRACT flag for
+ the given block, and for all local decls and all local sub-blocks
+ (recursively) which are contained therein. */
+
+void set_decl_abstract_flags ();
+
+static void
+set_block_abstract_flags (stmt, setting)
+ register tree stmt;
+ register int setting;
+{
+ BLOCK_ABSTRACT (stmt) = setting;
+
+ {
+ register tree local_decl;
+
+ for (local_decl = BLOCK_VARS (stmt);
+ local_decl != NULL_TREE;
+ local_decl = TREE_CHAIN (local_decl))
+ set_decl_abstract_flags (local_decl, setting);
+ }
+
+ {
+ register tree subblock;
+
+ for (subblock = BLOCK_SUBBLOCKS (stmt);
+ subblock != NULL_TREE;
+ subblock = BLOCK_CHAIN (subblock))
+ set_block_abstract_flags (subblock, setting);
+ }
+}
+
+/* Given a pointer to some ..._DECL node, and a boolean value to set the
+ "abstract" flags to, set that value into the DECL_ABSTRACT flag for the
+ given decl, and (in the case where the decl is a FUNCTION_DECL) also
+ set the abstract flags for all of the parameters, local vars, local
+ blocks and sub-blocks (recursively) to the same setting. */
+
+void
+set_decl_abstract_flags (decl, setting)
+ register tree decl;
+ register int setting;
+{
+ DECL_ABSTRACT (decl) = setting;
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ register tree arg;
+
+ for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
+ DECL_ABSTRACT (arg) = setting;
+ if (DECL_INITIAL (decl) != NULL_TREE)
+ set_block_abstract_flags (DECL_INITIAL (decl), setting);
+ }
+}
+\f
/* Output the assembly language code for the function FNDECL
from its DECL_SAVED_INSNS. Used for inline functions that are output
at end of compilation instead of where they came in the source. */
set_new_first_and_last_insn (FIRST_PARM_INSN (head), last);
set_new_first_and_last_label_num (FIRST_LABELNO (head), LAST_LABELNO (head));
+ /* We must have already output DWARF debugging information for the
+ original (abstract) inline function declaration/definition, so
+ we want to make sure that the debugging information we generate
+ for this special instance of the inline function refers back to
+ the information we already generated. To make sure that happens,
+ we simply have to set the DECL_ABSTRACT_ORIGIN for the function
+ node (and for all of the local ..._DECL nodes which are its children)
+ so that they all point to themselves. */
+
+ set_decl_origin_self (fndecl);
+
/* Compile this function all the way down to assembly code. */
rest_of_compilation (fndecl);