comparison gcc/calls.c @ 95:70c969e0d1dd

modify condition of tail call in expand_call method
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 17 Jan 2012 06:00:44 +0900
parents 12b3180c7d07
children 506ac5e3963a
comparison
equal deleted inserted replaced
94:8bd24be3a2df 95:70c969e0d1dd
2333 != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl))) 2333 != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl)))
2334 || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl)) 2334 || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl))
2335 #endif 2335 #endif
2336 /* Check whether the target is able to optimize the call 2336 /* Check whether the target is able to optimize the call
2337 into a sibcall. */ 2337 into a sibcall. */
2338 #ifndef noCbC
2339 || (!targetm.function_ok_for_sibcall (fndecl, exp)
2340 && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl))))
2341 #else
2338 || !targetm.function_ok_for_sibcall (fndecl, exp) 2342 || !targetm.function_ok_for_sibcall (fndecl, exp)
2343 #endif
2339 /* Functions that do not return exactly once may not be sibcall 2344 /* Functions that do not return exactly once may not be sibcall
2340 optimized. */ 2345 optimized. */
2341 || (flags & (ECF_RETURNS_TWICE | ECF_NORETURN)) 2346 || (flags & (ECF_RETURNS_TWICE | ECF_NORETURN))
2342 || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr))) 2347 || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr)))
2343 /* If the called function is nested in the current one, it might access 2348 /* If the called function is nested in the current one, it might access
2346 || (fndecl && decl_function_context (fndecl) == current_function_decl) 2351 || (fndecl && decl_function_context (fndecl) == current_function_decl)
2347 /* If this function requires more stack slots than the current 2352 /* If this function requires more stack slots than the current
2348 function, we cannot change it into a sibling call. 2353 function, we cannot change it into a sibling call.
2349 crtl->args.pretend_args_size is not part of the 2354 crtl->args.pretend_args_size is not part of the
2350 stack allocated by our caller. */ 2355 stack allocated by our caller. */
2356 #ifndef noCbC
2357 || (args_size.constant > (crtl->args.size
2358 - crtl->args.pretend_args_size)
2359 && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl))))
2360 #else
2351 || args_size.constant > (crtl->args.size 2361 || args_size.constant > (crtl->args.size
2352 - crtl->args.pretend_args_size) 2362 - crtl->args.pretend_args_size)
2363 #endif
2353 /* If the callee pops its own arguments, then it must pop exactly 2364 /* If the callee pops its own arguments, then it must pop exactly
2354 the same number of arguments as the current function. */ 2365 the same number of arguments as the current function. */
2355 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant) 2366 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant)
2356 != targetm.calls.return_pops_args (current_function_decl, 2367 != targetm.calls.return_pops_args (current_function_decl,
2357 TREE_TYPE (current_function_decl), 2368 TREE_TYPE (current_function_decl),