Mercurial > hg > CbC > CbC_gcc
changeset 121:49957f95a4d1
fix fntype
author | anatofuz |
---|---|
date | Fri, 09 Mar 2018 19:18:14 +0900 |
parents | f93fa5091070 |
children | fb3d53c41846 |
files | gcc/calls.c |
diffstat | 1 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/gcc/calls.c Thu Mar 08 14:53:42 2018 +0900 +++ b/gcc/calls.c Fri Mar 09 19:18:14 2018 +0900 @@ -3301,7 +3301,7 @@ // -O2オプションがないときも末尾最適化が行われるように(Code Segmentのみ) if (currently_expanding_call++ != 0 #ifndef noCbC - || ((!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl))) && !flag_optimize_sibling_calls) + || ((!fntype|| !CbC_IS_CODE_SEGMENT (fntype)) && !flag_optimize_sibling_calls) #else || !flag_optimize_sibling_calls #endif @@ -3326,7 +3326,7 @@ /* Check if caller and callee disagree in promotion of function return value. */ #ifndef noCbC - if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) + if (try_tail_call && (!fntype|| !CbC_IS_CODE_SEGMENT (fntype))) #else if (try_tail_call) #endif @@ -3421,18 +3421,6 @@ // when tail call optimization flag was down, warn about them. // and flag it to force a tail call optimize. -#ifndef noCbC - if (fndecl && CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)) - && CbC_IS_CODE_SEGMENT (TREE_TYPE (current_function_decl)) - && try_tail_call == 0) - { - location_t loc = EXPR_LOCATION (exp); - const char *name_callee = IDENTIFIER_POINTER(DECL_NAME(fndecl)); - warning_at (loc, 0, "transition to code segment \"%s\" with CbC goto, but tail call optimization was cut.", - name_callee); - try_tail_call = 1; - } -#endif /* We want to make two insn chains; one for a sibling call, the other for a normal call. We will select one of the two chains after @@ -4311,9 +4299,13 @@ /* If something prevents making this a sibling call, zero out the sequence. */ - if (sibcall_failure) +#ifndef noCbC + if ((!fntype || !CbC_IS_CODE_SEGMENT (fntype)) && sibcall_failure) +#else + if (sibcall_failure) +#endif tail_call_insns = NULL; - else + else break; } @@ -4326,6 +4318,17 @@ } else { + +#ifndef noCbC + if (fndecl && CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)) + && CbC_IS_CODE_SEGMENT (TREE_TYPE (current_function_decl))) + { + location_t loc = EXPR_LOCATION (exp); + const char *name_callee = IDENTIFIER_POINTER(DECL_NAME(fndecl)); + warning_at (loc, 0, "transition to code segment \"%s\" with CbC goto, but tail call optimization was cut.", + name_callee); + } +#endif emit_insn (normal_call_insns); if (try_tail_call) /* Ideally we'd emit a message for all of the ways that it could