From: Jing Yu Date: Tue, 17 Mar 2009 20:18:21 +0000 (+0000) Subject: re PR middle-end/39378 (Multiple inheritence thunk not working with -mthumb) X-Git-Tag: releases/gcc-4.4.0~245 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c072c6ba27f5f8c18688bd3816523ee8b2e7e16;p=thirdparty%2Fgcc.git re PR middle-end/39378 (Multiple inheritence thunk not working with -mthumb) 2009-03-12 Jing Yu 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 From-SVN: r144918 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4af4b4f7d456..7875277f45e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2009-03-17 Jing Yu + + 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 PR target/39482 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 0675916a230f..5ffb8f967ff5 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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 ()); diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 7788793b3009..f5ec9e7166e4 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -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") ; \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 3073561c9f0b..17622c26f006 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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; diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 5b4c273dda98..e632fe0c9e6b 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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, diff --git a/gcc/function.h b/gcc/function.h index 3f03727dfdcf..f9bdda8594d5 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31651843422f..51bd91512ab8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-03-17 Jing Yu + + PR middle-end/39378 + * g++.dg/inherit/thunk10.C: New test. + 2009-03-17 Uros Bizjak PR target/39482 diff --git a/gcc/varasm.c b/gcc/varasm.c index c724fcd721ec..e5b9f35fee9a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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);