Mercurial > hg > CbC > CbC_gcc
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:a06113de4d67 | 1:caeb520cebed |
---|---|
96 copy in smaller-sized pieces into pseudos. These are stored in a | 96 copy in smaller-sized pieces into pseudos. These are stored in a |
97 block pointed to by this field. The next field says how many | 97 block pointed to by this field. The next field says how many |
98 word-sized pseudos we made. */ | 98 word-sized pseudos we made. */ |
99 rtx *aligned_regs; | 99 rtx *aligned_regs; |
100 int n_aligned_regs; | 100 int n_aligned_regs; |
101 #ifndef noCbC | |
102 rtx exprs; | |
103 #endif | |
101 }; | 104 }; |
102 | 105 |
103 /* A vector of one char per byte of stack space. A byte if nonzero if | 106 /* A vector of one char per byte of stack space. A byte if nonzero if |
104 the corresponding stack location has been used. | 107 the corresponding stack location has been used. |
105 This vector is used to prevent a function call within an argument from | 108 This vector is used to prevent a function call within an argument from |
1877 value, GEN_INT (shift), value, 1, OPTAB_WIDEN)) | 1880 value, GEN_INT (shift), value, 1, OPTAB_WIDEN)) |
1878 gcc_unreachable (); | 1881 gcc_unreachable (); |
1879 return true; | 1882 return true; |
1880 } | 1883 } |
1881 | 1884 |
1885 #ifndef noCbC | |
1886 #include "cbc-tree.h" | |
1887 #include "cbc-goto.h" | |
1888 #endif | |
1889 | |
1882 /* If X is a likely-spilled register value, copy it to a pseudo | 1890 /* If X is a likely-spilled register value, copy it to a pseudo |
1883 register and return that register. Return X otherwise. */ | 1891 register and return that register. Return X otherwise. */ |
1884 | 1892 |
1885 static rtx | 1893 static rtx |
1886 avoid_likely_spilled_reg (rtx x) | 1894 avoid_likely_spilled_reg (rtx x) |
1902 return new_rtx; | 1910 return new_rtx; |
1903 } | 1911 } |
1904 return x; | 1912 return x; |
1905 } | 1913 } |
1906 | 1914 |
1907 /* Generate all the code for a CALL_EXPR exp | 1915 /* Generate all the code for a function call |
1908 and return an rtx for its value. | 1916 and return an rtx for its value. |
1909 Store the value in TARGET (specified as an rtx) if convenient. | 1917 Store the value in TARGET (specified as an rtx) if convenient. |
1910 If the value is stored in TARGET then TARGET is returned. | 1918 If the value is stored in TARGET then TARGET is returned. |
1911 If IGNORE is nonzero, then we ignore the value of the function call. */ | 1919 If IGNORE is nonzero, then we ignore the value of the function call. */ |
1912 | 1920 |
2372 else | 2380 else |
2373 preferred_stack_boundary = crtl->preferred_stack_boundary; | 2381 preferred_stack_boundary = crtl->preferred_stack_boundary; |
2374 | 2382 |
2375 preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; | 2383 preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; |
2376 | 2384 |
2385 #ifndef noCbC | |
2386 if ( fntype | |
2387 //&& CbC_IS_CODE_SEGMENT (fntype) | |
2388 //&& fndecl | |
2389 //&& CbC_IS_CODE_SEGMENT (fndecl) | |
2390 //&& CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) | |
2391 //&& CALL_EXPR_TAILCALL (exp) | |
2392 && CbC_IS_CbC_GOTO (exp) // it's better? than CALL_EXPR_TAILCALL() | |
2393 ) | |
2394 { | |
2395 | |
2396 // fprintf(stderr, "\n\tgoto code segment.\n"); | |
2397 args_size.constant = CbC_ARGS_SIZE; | |
2398 return expand_cbc_goto(exp, target, fndecl, funtype, | |
2399 addr, ignore, flags, num_actuals, args, &args_size, | |
2400 args_so_far, | |
2401 old_stack_level, reg_parm_stack_space, old_pending_adj, | |
2402 preferred_stack_boundary, preferred_unit_stack_boundary, | |
2403 structure_value_addr, old_inhibit_defer_pop); | |
2404 } | |
2405 else if ( fndecl&&CbC_HAVE_CbC_GOTO(fndecl) ) | |
2406 { | |
2407 char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); | |
2408 fprintf(stderr, "\nCbC: function %s having CbCgoto statement has been `CALLED'.\n", name); | |
2409 //args_size.constant = CbC_ARGS_SIZE; | |
2410 } | |
2411 else if ( fntype&&CbC_IS_CODE_SEGMENT(fntype) ) | |
2412 { | |
2413 char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); | |
2414 fprintf(stderr, "\nCbC error: codesegment %s has been `CALLED!'.\n", name); | |
2415 } | |
2416 #endif | |
2417 | |
2377 /* We want to make two insn chains; one for a sibling call, the other | 2418 /* We want to make two insn chains; one for a sibling call, the other |
2378 for a normal call. We will select one of the two chains after | 2419 for a normal call. We will select one of the two chains after |
2379 initial RTL generation is complete. */ | 2420 initial RTL generation is complete. */ |
2380 for (pass = try_tail_call ? 0 : 1; pass < 2; pass++) | 2421 for (pass = try_tail_call ? 0 : 1; pass < 2; pass++) |
2381 { | 2422 { |
2442 /* Compute the actual size of the argument block required. The variable | 2483 /* Compute the actual size of the argument block required. The variable |
2443 and constant sizes must be combined, the size may have to be rounded, | 2484 and constant sizes must be combined, the size may have to be rounded, |
2444 and there may be a minimum required size. When generating a sibcall | 2485 and there may be a minimum required size. When generating a sibcall |
2445 pattern, do not round up, since we'll be re-using whatever space our | 2486 pattern, do not round up, since we'll be re-using whatever space our |
2446 caller provided. */ | 2487 caller provided. */ |
2488 #ifndef noCbC | |
2489 if ( ( fntype && CbC_IS_CODE_SEGMENT(fntype) ) | |
2490 || ( fndecl && CbC_HAVE_CbC_GOTO(fndecl) ) ) | |
2491 { | |
2492 unadjusted_args_size = args_size.constant; | |
2493 adjusted_args_size.constant = CbC_ARGS_SIZE; | |
2494 compute_argument_block_size (reg_parm_stack_space, | |
2495 &adjusted_args_size, | |
2496 (pass == 0 ? 0 | |
2497 : preferred_stack_boundary)); | |
2498 } | |
2499 else | |
2500 #endif | |
2501 { | |
2447 unadjusted_args_size | 2502 unadjusted_args_size |
2448 = compute_argument_block_size (reg_parm_stack_space, | 2503 = compute_argument_block_size (reg_parm_stack_space, |
2449 &adjusted_args_size, | 2504 &adjusted_args_size, |
2450 fndecl, fntype, | 2505 fndecl, fntype, |
2451 (pass == 0 ? 0 | 2506 (pass == 0 ? 0 |
2452 : preferred_stack_boundary)); | 2507 : preferred_stack_boundary)); |
2508 } | |
2453 | 2509 |
2454 old_stack_allocated = stack_pointer_delta - pending_stack_adjust; | 2510 old_stack_allocated = stack_pointer_delta - pending_stack_adjust; |
2455 | 2511 |
2456 /* The argument block when performing a sibling call is the | 2512 /* The argument block when performing a sibling call is the |
2457 incoming argument block. */ | 2513 incoming argument block. */ |