------- Comment #2 from dferbas at etech dot cz 2009-09-22 22:39 ------- We tried to modify the m68k variant of sibcall fn. But we have a problem with compilation. Is there anyone who can test if following is OK ?
/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL_P. We cannot use sibcalls for nested functions because we use the static chain register for indirect calls. */ static bool m68k_ok_for_sibcall_p (tree decl, tree exp) { tree func; rtx a, b; enum m68k_function_kind kind; if (TREE_OPERAND (exp, 2)) return false; /* --- incorporated from x386 --- * This addresses issue when 1 fn returns a pointer in an address register * it is casted and the other fn returns a value in data register. */ if (decl) func = decl; else { func = TREE_TYPE (TREE_OPERAND (exp, 0)); if (POINTER_TYPE_P (func)) func = TREE_TYPE (func); } /* Check that the return value locations are the same. Like if we are returning floats on the 80387 register stack, we cannot make a sibcall from a function that doesn't return a float to a function that does or, conversely, from a function that does return a float to a function that doesn't; the necessary stack adjustment would not be executed. This is also the place we notice differences in the return value ABI. Note that it is ok for one of the functions to have void return type as long as the return value of the other is passed in a register. */ a = m68k_function_value (TREE_TYPE (exp), func); b = m68k_function_value (TREE_TYPE (DECL_RESULT (current_function_decl)), current_function_decl); if (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl)))) ; else if (!rtx_equal_p (a, b)) return false; /* --- */ kind = m68k_get_function_kind (current_function_decl); if (kind == m68k_fk_normal_function) /* We can always sibcall from a normal function, because it's undefined if it is calling an interrupt function. */ return true; /* Otherwise we can only sibcall if the function kind is known to be the same. */ if (decl && m68k_get_function_kind (decl) == kind) return true; return false; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41302