Commit 3c072c6b by Jing Yu Committed by Doug Kwan

re PR middle-end/39378 (Multiple inheritence thunk not working with -mthumb)

2009-03-12  Jing Yu  <jingyu@google.com>

	PR middle-end/39378
	* function.h: Move is_thunk from rtl_data structure to function
	structure.
	* cp/method.c (use_thunk): Change is_thunk from crtl to cfun.
	* varasm.c (assemble_start_function): Change is_thunk from crtl to
	cfun.
	* config/alpha/alpha.c: Change is_thunk from crtl to cfun.
	* config/rs6000/rs6000.c: Change is_thunk from crtl to cfun.
	* config/arm/arm.h: Change is_thunk from crtl to cfun.
	* testsuite/g++.dg/inherit/thunk10.C: New file.

	Patch submitted by Doug Kwan <dougkwan@google.com>

From-SVN: r144918
parent 9ade279b
2009-03-17 Jing Yu <jingyu@google.com>
PR middle-end/39378
* function.h: Move is_thunk from rtl_data structure to function
structure.
* cp/method.c (use_thunk): Change is_thunk from crtl to cfun.
* varasm.c (assemble_start_function): Change is_thunk from crtl to
cfun.
* config/alpha/alpha.c: Change is_thunk from crtl to cfun.
* config/rs6000/rs6000.c: Change is_thunk from crtl to cfun.
* config/arm/arm.h: Change is_thunk from crtl to cfun.
2009-03-17 Uros Bizjak <ubizjak@gmail.com>
PR target/39482
......
......@@ -7135,7 +7135,7 @@ alpha_sa_mask (unsigned long *imaskP, unsigned long *fmaskP)
/* When outputting a thunk, we don't have valid register life info,
but assemble_start_function wants to output .frame and .mask
directives. */
if (crtl->is_thunk)
if (cfun->is_thunk)
{
*imaskP = 0;
*fmaskP = 0;
......@@ -7365,7 +7365,7 @@ alpha_does_function_need_gp (void)
return 1;
/* The code emitted by alpha_output_mi_thunk_osf uses the gp. */
if (crtl->is_thunk)
if (cfun->is_thunk)
return 1;
/* The nonlocal receiver pattern assumes that the gp is valid for
......@@ -7888,7 +7888,7 @@ alpha_start_function (FILE *file, const char *fnname,
Otherwise, do it here. */
if (TARGET_ABI_OSF
&& ! alpha_function_needs_gp
&& ! crtl->is_thunk)
&& ! cfun->is_thunk)
{
putc ('$', file);
assemble_name (file, fnname);
......@@ -7999,7 +7999,7 @@ alpha_output_function_end_prologue (FILE *file)
fputs ("\t.prologue 0\n", file);
else if (!flag_inhibit_size_directive)
fprintf (file, "\t.prologue %d\n",
alpha_function_needs_gp || crtl->is_thunk);
alpha_function_needs_gp || cfun->is_thunk);
}
/* Write function epilogue. */
......@@ -8283,7 +8283,7 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL);
#if TARGET_ABI_OSF
if (crtl->is_thunk)
if (cfun->is_thunk)
free_after_compilation (cfun);
#endif
......@@ -8326,7 +8326,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT hi, lo;
rtx this_rtx, insn, funexp;
gcc_assert (crtl->is_thunk);
gcc_assert (cfun->is_thunk);
/* We always require a valid GP. */
emit_insn (gen_prologue_ldgp ());
......
......@@ -2448,7 +2448,7 @@ extern int making_const_table;
{ \
if (is_called_in_ARM_mode (DECL) \
|| (TARGET_THUMB1 && !TARGET_THUMB1_ONLY \
&& crtl->is_thunk)) \
&& cfun->is_thunk)) \
fprintf (STREAM, "\t.code 32\n") ; \
else if (TARGET_THUMB1) \
fprintf (STREAM, "\t.code\t16\n\t.thumb_func\n") ; \
......
......@@ -15254,7 +15254,7 @@ rs6000_ra_ever_killed (void)
rtx reg;
rtx insn;
if (crtl->is_thunk)
if (cfun->is_thunk)
return 0;
/* regs_ever_live has LR marked as used if any sibcalls are present,
......@@ -17556,7 +17556,7 @@ rs6000_output_function_epilogue (FILE *file,
System V.4 Powerpc's (and the embedded ABI derived from it) use a
different traceback table. */
if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive
&& rs6000_traceback != traceback_none && !crtl->is_thunk)
&& rs6000_traceback != traceback_none && !cfun->is_thunk)
{
const char *fname = NULL;
const char *language_string = lang_hooks.name;
......
......@@ -436,7 +436,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
BLOCK_VARS (fn_block) = a;
DECL_INITIAL (thunk_fndecl) = fn_block;
init_function_start (thunk_fndecl);
crtl->is_thunk = 1;
cfun->is_thunk = 1;
assemble_start_function (thunk_fndecl, fnname);
targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
......
......@@ -378,12 +378,6 @@ struct rtl_data GTY(())
/* Nonzero if function being compiled has an asm statement. */
bool has_asm_statement;
/* Nonzero if the current function is a thunk, i.e., a lightweight
function implemented by the output_mi_thunk hook) that just
adjusts one of its arguments and forwards to another
function. */
bool is_thunk;
/* This bit is used by the exception handling logic. It is set if all
calls (if any) are sibling calls. Such functions do not have to
have EH tables generated, as they cannot throw. A call to such a
......@@ -600,6 +594,12 @@ struct function GTY(())
/* Nonzero if this function has local DECL_HARD_REGISTER variables.
In this case code motion has to be done more carefully. */
unsigned int has_local_explicit_reg_vars : 1;
/* Nonzero if the current function is a thunk, i.e., a lightweight
function implemented by the output_mi_thunk hook) that just
adjusts one of its arguments and forwards to another
function. */
unsigned int is_thunk : 1;
};
/* If va_list_[gf]pr_size is set to this, it means we don't know how
......
2009-03-17 Jing Yu <jingyu@google.com>
PR middle-end/39378
* g++.dg/inherit/thunk10.C: New test.
2009-03-17 Uros Bizjak <ubizjak@gmail.com>
PR target/39482
......
......@@ -1677,7 +1677,7 @@ assemble_start_function (tree decl, const char *fnname)
/* When the function starts with a cold section, we need to explicitly
align the hot section and write out the hot section label.
But if the current function is a thunk, we do not have a CFG. */
if (!crtl->is_thunk
if (!cfun->is_thunk
&& BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION)
{
switch_to_section (text_section);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment