+Mon Jun 8 01:21:13 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * function.c: Define current_function_cannot_inline.
+ (push_function_context_to): Save it.
+ (pop_function_context_from): Restore it.
+ * function.h (struct function): Provide it a home.
+ * output.h: Declare it.
+ * integrate.c (function_cannot_inline_p): Check it.
+
Mon Jun 8 10:43:15 1998 Richard Henderson <rth@cygnus.com>
* expr.c (force_operand): Detect PIC address loads before
+1998-06-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cp_finish_decl): Disable inlining of extern inlines
+ with static variables.
+
1998-06-08 Mark Mitchell <mark@markmitchell.com>
* init.c (build_offset_ref): Correct previous change to use build,
if (was_temp)
end_temporary_allocation ();
- /* Extern inline function static data has external linkage. */
+ /* Extern inline function static data has external linkage.
+ Instead of trying to deal with that, we disable inlining of
+ such functions. The ASM_WRITTEN check is to avoid hitting this
+ for __FUNCTION__. */
if (TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl)
+ && ! TREE_ASM_WRITTEN (decl)
&& current_function_decl
&& DECL_CONTEXT (decl) == current_function_decl
&& DECL_THIS_INLINE (current_function_decl)
&& TREE_PUBLIC (current_function_decl))
{
- if (DECL_INTERFACE_KNOWN (current_function_decl))
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
- }
- /* We can only do this if we can use common or weak, and we
- can't if it has been initialized and we don't support weak. */
- else if (DECL_INITIAL (decl) == NULL_TREE
- || DECL_INITIAL (decl) == error_mark_node)
- {
- TREE_PUBLIC (decl) = 1;
- DECL_COMMON (decl) = 1;
- }
- else if (flag_weak)
- make_decl_one_only (decl);
-
- if (TREE_PUBLIC (decl))
- DECL_ASSEMBLER_NAME (decl)
- = build_static_name (current_function_decl, DECL_NAME (decl));
- else if (! DECL_ARTIFICIAL (decl))
- cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
+ current_function_cannot_inline
+ = "function with static variable cannot be inline";
}
else if (TREE_CODE (decl) == VAR_DECL
/* The arg pointer hard register, or the pseudo into which it was copied. */
rtx current_function_internal_arg_pointer;
+/* Language-specific reason why the current function cannot be made inline. */
+char *current_function_cannot_inline;
+
/* The FUNCTION_DECL for an inline function currently being expanded. */
tree inline_function_decl;
p->uses_const_pool = current_function_uses_const_pool;
p->uses_pic_offset_table = current_function_uses_pic_offset_table;
p->internal_arg_pointer = current_function_internal_arg_pointer;
+ p->cannot_inline = current_function_cannot_inline;
p->max_parm_reg = max_parm_reg;
p->parm_reg_stack_loc = parm_reg_stack_loc;
p->outgoing_args_size = current_function_outgoing_args_size;
current_function_uses_const_pool = p->uses_const_pool;
current_function_uses_pic_offset_table = p->uses_pic_offset_table;
current_function_internal_arg_pointer = p->internal_arg_pointer;
+ current_function_cannot_inline = p->cannot_inline;
max_parm_reg = p->max_parm_reg;
parm_reg_stack_loc = p->parm_reg_stack_loc;
current_function_outgoing_args_size = p->outgoing_args_size;
current_function_epilogue_delay_list = 0;
current_function_uses_const_pool = 0;
current_function_uses_pic_offset_table = 0;
+ current_function_cannot_inline = 0;
/* We have not yet needed to make a label to jump to for tail-recursion. */
tail_recursion_label = 0;
rtx tail_recursion_label;
rtx tail_recursion_reentry;
rtx internal_arg_pointer;
+ char *cannot_inline;
rtx arg_pointer_save_area;
tree rtl_expr_chain;
rtx last_parm_insn;
if (current_function_contains_functions)
return "function with nested functions cannot be inline";
+ if (current_function_cannot_inline)
+ return current_function_cannot_inline;
+
/* If its not even close, don't even look. */
if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
return "function too large to be inline";
/* This is nonzero if the current function uses the constant pool. */
extern int current_function_uses_const_pool;
+/* Language-specific reason why the current function cannot be made inline. */
+extern char *current_function_cannot_inline;
+
/* The line number of the beginning of the current function.
sdbout.c needs this so that it can output relative linenumbers. */