# HG changeset patch # User Nobuyasu Oshiro # Date 1324374826 -32400 # Node ID f214c1d5b86298fa7e6b3fc74a47e3afa00d1b17 # Parent 4a89a0a804dffc995038779b98f74034936f9d66# Parent 12b3180c7d0707ed54e2aea8b76611eb0e2d0e77 merge 89 diff -r 4a89a0a804df -r f214c1d5b862 CbC-examples/arg.c --- a/CbC-examples/arg.c Tue Dec 20 18:51:07 2011 +0900 +++ b/CbC-examples/arg.c Tue Dec 20 18:53:46 2011 +0900 @@ -13,13 +13,13 @@ void *exit_env; __code (*exit___code)(); -__code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env) +__code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env) { printf("#0017:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env); goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env); } -__code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env) +__code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env) { struct arg args0; printf("#0024:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env ); @@ -31,7 +31,7 @@ goto cargs(args0,exit1,env); } -__code cargs(struct arg args0,__code exit1(),void *env) +__code cargs(struct arg args0,__code exit1(int, void*),void *env) { printf("#0035:args: %d %d %d %d %d : %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, diff -r 4a89a0a804df -r f214c1d5b862 gcc/c-parser.c --- a/gcc/c-parser.c Tue Dec 20 18:51:07 2011 +0900 +++ b/gcc/c-parser.c Tue Dec 20 18:53:46 2011 +0900 @@ -2113,7 +2113,7 @@ attrs = build_tree_list(attrs, NULL_TREE); declspecs_add_attrs(specs, attrs); */ - if(!TARGET_64BIT) { + if(!TARGET_64BIT) { attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ declspecs_add_attrs(specs, attrs); @@ -6167,7 +6167,7 @@ decl_attributes (&tlab, NULL_TREE, 0); add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); - tree ret = c_finish_return (loc, retval, retval); //tree ret = c_finish_return (retval); + tree ret = c_finish_return (loc, retval, retval); /*tree ret = c_finish_return (retval);*/ TREE_USED(ret) = 1; diff -r 4a89a0a804df -r f214c1d5b862 gcc/calls.c --- a/gcc/calls.c Tue Dec 20 18:51:07 2011 +0900 +++ b/gcc/calls.c Tue Dec 20 18:53:46 2011 +0900 @@ -2359,9 +2359,14 @@ || !lang_hooks.decls.ok_for_sibcall (fndecl)) try_tail_call = 0; + /* Check if caller and callee disagree in promotion of function return value. */ - if (try_tail_call) +#ifndef noCbC + if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) +#else + if (try_tail_call) +#endif { enum machine_mode caller_mode, caller_promoted_mode; enum machine_mode callee_mode, callee_promoted_mode; diff -r 4a89a0a804df -r f214c1d5b862 gcc/calls.c~ --- a/gcc/calls.c~ Tue Dec 20 18:51:07 2011 +0900 +++ b/gcc/calls.c~ Tue Dec 20 18:53:46 2011 +0900 @@ -2335,7 +2335,12 @@ #endif /* Check whether the target is able to optimize the call into a sibcall. */ +#ifndef noCbC + || (!targetm.function_ok_for_sibcall (fndecl, exp) + && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) +#else || !targetm.function_ok_for_sibcall (fndecl, exp) +#endif /* Functions that do not return exactly once may not be sibcall optimized. */ || (flags & (ECF_RETURNS_TWICE | ECF_NORETURN)) @@ -2348,8 +2353,14 @@ function, we cannot change it into a sibling call. crtl->args.pretend_args_size is not part of the stack allocated by our caller. */ +#ifndef noCbC + || (args_size.constant > (crtl->args.size + - crtl->args.pretend_args_size) + && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) +#else || args_size.constant > (crtl->args.size - crtl->args.pretend_args_size) +#endif /* If the callee pops its own arguments, then it must pop exactly the same number of arguments as the current function. */ || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant) @@ -2359,9 +2370,14 @@ || !lang_hooks.decls.ok_for_sibcall (fndecl)) try_tail_call = 0; + /* Check if caller and callee disagree in promotion of function return value. */ - if (try_tail_call) +#ifndef noCbC + if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) +#else + if (try_tail_call) +#endif { enum machine_mode caller_mode, caller_promoted_mode; enum machine_mode callee_mode, callee_promoted_mode; diff -r 4a89a0a804df -r f214c1d5b862 gcc/function.c --- a/gcc/function.c Tue Dec 20 18:51:07 2011 +0900 +++ b/gcc/function.c Tue Dec 20 18:53:46 2011 +0900 @@ -65,6 +65,8 @@ #include "timevar.h" #include "vecprim.h" + + /* So we can assign to cfun in this file. */ #undef cfun @@ -3481,8 +3483,8 @@ } #ifndef noCbC - //if (CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) ) - //all.stack_args_size.constant = CbC_STACK_SIZE; + // if (CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) ) + // all.stack_args_size.constant = CbC_STACK_SIZE; #endif /* We have aligned all the args, so add space for the pretend args. */