Mercurial > hg > CbC > CbC_gcc
comparison gcc/calls.c @ 116:367f9f4f266e
fix gimple.h
author | mir3636 |
---|---|
date | Tue, 28 Nov 2017 20:22:01 +0900 |
parents | ab0bcb71f44d |
children | f81c5aa9f14f |
comparison
equal
deleted
inserted
replaced
115:4cb7a319550d | 116:367f9f4f266e |
---|---|
2757 gcc_unreachable (); | 2757 gcc_unreachable (); |
2758 return true; | 2758 return true; |
2759 } | 2759 } |
2760 | 2760 |
2761 #ifndef noCbC | 2761 #ifndef noCbC |
2762 #include "cbc-tree.h" | 2762 #include "c/cbc-tree.h" |
2763 #endif | 2763 #endif |
2764 | 2764 |
2765 /* If X is a likely-spilled register value, copy it to a pseudo | 2765 /* If X is a likely-spilled register value, copy it to a pseudo |
2766 register and return that register. Return X otherwise. */ | 2766 register and return that register. Return X otherwise. */ |
2767 | 2767 |
3313 optimization, attempt it. */ | 3313 optimization, attempt it. */ |
3314 if (must_tail_call) | 3314 if (must_tail_call) |
3315 try_tail_call = 1; | 3315 try_tail_call = 1; |
3316 | 3316 |
3317 /* Rest of purposes for tail call optimizations to fail. */ | 3317 /* Rest of purposes for tail call optimizations to fail. */ |
3318 <<<<<<< local | |
3319 if (try_tail_call) | 3318 if (try_tail_call) |
3320 try_tail_call = can_implement_as_sibling_call_p (exp, | 3319 try_tail_call = can_implement_as_sibling_call_p (exp, |
3321 structure_value_addr, | 3320 structure_value_addr, |
3322 funtype, | 3321 funtype, |
3323 reg_parm_stack_space, | 3322 reg_parm_stack_space, |
3324 fndecl, | 3323 fndecl, |
3325 flags, addr, args_size); | 3324 flags, addr, args_size); |
3326 ======= | |
3327 if ( | |
3328 #ifdef HAVE_sibcall_epilogue | |
3329 !HAVE_sibcall_epilogue | |
3330 #else | |
3331 1 | |
3332 #endif | |
3333 || !try_tail_call | |
3334 /* Doing sibling call optimization needs some work, since | |
3335 structure_value_addr can be allocated on the stack. | |
3336 It does not seem worth the effort since few optimizable | |
3337 sibling calls will return a structure. */ | |
3338 || structure_value_addr != NULL_RTX | |
3339 #ifdef REG_PARM_STACK_SPACE | |
3340 /* If outgoing reg parm stack space changes, we can not do sibcall. */ | |
3341 || (OUTGOING_REG_PARM_STACK_SPACE (funtype) | |
3342 != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl))) | |
3343 || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl)) | |
3344 #endif | |
3345 /* Check whether the target is able to optimize the call | |
3346 into a sibcall. */ | |
3347 || !targetm.function_ok_for_sibcall (fndecl, exp) | |
3348 /* Functions that do not return exactly once may not be sibcall | |
3349 optimized. */ | |
3350 || (flags & (ECF_RETURNS_TWICE | ECF_NORETURN)) | |
3351 || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr))) | |
3352 /* If the called function is nested in the current one, it might access | |
3353 some of the caller's arguments, but could clobber them beforehand if | |
3354 the argument areas are shared. */ | |
3355 || (fndecl && decl_function_context (fndecl) == current_function_decl) | |
3356 /* If this function requires more stack slots than the current | |
3357 function, we cannot change it into a sibling call. | |
3358 crtl->args.pretend_args_size is not part of the | |
3359 stack allocated by our caller. */ | |
3360 || args_size.constant > (crtl->args.size | |
3361 - crtl->args.pretend_args_size) | |
3362 /* If the callee pops its own arguments, then it must pop exactly | |
3363 the same number of arguments as the current function. */ | |
3364 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant) | |
3365 != targetm.calls.return_pops_args (current_function_decl, | |
3366 TREE_TYPE (current_function_decl), | |
3367 crtl->args.size)) | |
3368 || !lang_hooks.decls.ok_for_sibcall (fndecl)) | |
3369 try_tail_call = 0; | |
3370 >>>>>>> other | |
3371 | |
3372 | 3325 |
3373 /* Check if caller and callee disagree in promotion of function | 3326 /* Check if caller and callee disagree in promotion of function |
3374 return value. */ | 3327 return value. */ |
3375 #ifndef noCbC | 3328 #ifndef noCbC |
3376 if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) | 3329 if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) |