Mercurial > hg > CbC > CbC_gcc
diff gcc/calls.c @ 1:caeb520cebed
patch for CbC
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 17:43:54 +0900 |
parents | a06113de4d67 |
children | d43292db8c8c |
line wrap: on
line diff
--- a/gcc/calls.c Fri Jul 17 14:47:48 2009 +0900 +++ b/gcc/calls.c Fri Jul 17 17:43:54 2009 +0900 @@ -98,6 +98,9 @@ word-sized pseudos we made. */ rtx *aligned_regs; int n_aligned_regs; +#ifndef noCbC +rtx exprs; +#endif }; /* A vector of one char per byte of stack space. A byte if nonzero if @@ -1879,6 +1882,11 @@ return true; } +#ifndef noCbC +#include "cbc-tree.h" +#include "cbc-goto.h" +#endif + /* If X is a likely-spilled register value, copy it to a pseudo register and return that register. Return X otherwise. */ @@ -1904,7 +1912,7 @@ return x; } -/* Generate all the code for a CALL_EXPR exp +/* Generate all the code for a function call and return an rtx for its value. Store the value in TARGET (specified as an rtx) if convenient. If the value is stored in TARGET then TARGET is returned. @@ -2374,6 +2382,39 @@ preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; +#ifndef noCbC + if ( fntype + //&& CbC_IS_CODE_SEGMENT (fntype) + //&& fndecl + //&& CbC_IS_CODE_SEGMENT (fndecl) + //&& CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) + //&& CALL_EXPR_TAILCALL (exp) + && CbC_IS_CbC_GOTO (exp) // it's better? than CALL_EXPR_TAILCALL() + ) + { + + // fprintf(stderr, "\n\tgoto code segment.\n"); + args_size.constant = CbC_ARGS_SIZE; + return expand_cbc_goto(exp, target, fndecl, funtype, + addr, ignore, flags, num_actuals, args, &args_size, + args_so_far, + old_stack_level, reg_parm_stack_space, old_pending_adj, + preferred_stack_boundary, preferred_unit_stack_boundary, + structure_value_addr, old_inhibit_defer_pop); + } + else if ( fndecl&&CbC_HAVE_CbC_GOTO(fndecl) ) + { + char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); + fprintf(stderr, "\nCbC: function %s having CbCgoto statement has been `CALLED'.\n", name); + //args_size.constant = CbC_ARGS_SIZE; + } + else if ( fntype&&CbC_IS_CODE_SEGMENT(fntype) ) + { + char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); + fprintf(stderr, "\nCbC error: codesegment %s has been `CALLED!'.\n", name); + } +#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 initial RTL generation is complete. */ @@ -2444,12 +2485,27 @@ and there may be a minimum required size. When generating a sibcall pattern, do not round up, since we'll be re-using whatever space our caller provided. */ +#ifndef noCbC + if ( ( fntype && CbC_IS_CODE_SEGMENT(fntype) ) + || ( fndecl && CbC_HAVE_CbC_GOTO(fndecl) ) ) + { + unadjusted_args_size = args_size.constant; + adjusted_args_size.constant = CbC_ARGS_SIZE; + compute_argument_block_size (reg_parm_stack_space, + &adjusted_args_size, + (pass == 0 ? 0 + : preferred_stack_boundary)); + } + else +#endif + { unadjusted_args_size = compute_argument_block_size (reg_parm_stack_space, &adjusted_args_size, fndecl, fntype, (pass == 0 ? 0 : preferred_stack_boundary)); + } old_stack_allocated = stack_pointer_delta - pending_stack_adjust;