[c++ patch] fix for mi-thunk emission
Michael Matz <matz <at> suse.de>
2005-07-31 23:37:29 GMT
Hi,
this patch is required at least on sparc for the genattrtab speedup
patches, to generate the same code with and without them for kdecore.cc.
But the bug is lurking anyway. The problem is how some backends
(alpha,ia64,mips,rs6000 on OSF,sh and sparc) emit mi-thunks by not going
through the proper channels and instead calling final() themself.
The code in the arch.c usually looks similar to this:
insn = get_insns ();
insn_locators_initialize ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
final_end_function ();
with the C++ frontend side (in method.c) being (partly):
current_function_decl = thunk_fndecl;
init_function_start (thunk_fndecl);
current_function_is_thunk = 1;
assemble_start_function (thunk_fndecl, fnname);
targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
assemble_end_function (thunk_fndecl, fnname);
current_function_decl = 0;
cfun = 0;
Now the problem is, that this together creates a new function calling
passes from the backend on it, and generally doing stuff. But it misses
to call the pass_clean_state, which is done normally right after
(Continue reading)