Mercurial > hg > CbC > CbC_gcc
comparison gcc/calls.c @ 21:959d4c8c8abc
add conv.c conv1.c
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Sep 2009 20:15:16 +0900 |
parents | d43292db8c8c |
children | 3f5886e153cb |
comparison
equal
deleted
inserted
replaced
20:9de9dad105d4 | 21:959d4c8c8abc |
---|---|
2382 | 2382 |
2383 preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; | 2383 preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; |
2384 | 2384 |
2385 #ifndef noCbC | 2385 #ifndef noCbC |
2386 if ( fntype | 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() | 2387 && CbC_IS_CbC_GOTO (exp) // it's better? than CALL_EXPR_TAILCALL() |
2388 && CbC_IS_CODE_SEGMENT (TREE_TYPE (current_function_decl)) | |
2393 ) | 2389 ) |
2394 { | 2390 { |
2395 | 2391 |
2396 // fprintf(stderr, "\n\tgoto code segment.\n"); | 2392 args_size.constant = CbC_PRETENDED_STACK_SIZE; |
2397 args_size.constant = CbC_ARGS_SIZE; | |
2398 return expand_cbc_goto(exp, target, fndecl, funtype, fntype, | 2393 return expand_cbc_goto(exp, target, fndecl, funtype, fntype, |
2399 addr, ignore, flags, num_actuals, args, &args_size, | 2394 addr, ignore, flags, num_actuals, args, &args_size, |
2400 args_so_far, | 2395 args_so_far, |
2401 old_stack_level, reg_parm_stack_space, old_pending_adj, | 2396 old_stack_level, reg_parm_stack_space, old_pending_adj, |
2402 preferred_stack_boundary, preferred_unit_stack_boundary, | 2397 preferred_stack_boundary, preferred_unit_stack_boundary, |
2403 structure_value_addr, old_inhibit_defer_pop); | 2398 structure_value_addr, old_inhibit_defer_pop); |
2404 } | 2399 } |
2405 else if ( fndecl&&CbC_HAVE_CbC_GOTO(fndecl) ) | 2400 else if ( CbC_IS_CbC_GOTO (exp) ) |
2406 { | 2401 { |
2407 char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); | 2402 // TODO: 関数からコードセグメントへの遷移 |
2408 fprintf(stderr, "\nCbC: function %s having CbCgoto statement has been `CALLED'.\n", name); | 2403 char *name_callee = IDENTIFIER_POINTER(DECL_NAME(fndecl)); |
2409 //args_size.constant = CbC_ARGS_SIZE; | 2404 warning(0, "no warning: code segment `%s' has been called from a function.", name_callee); |
2410 } | 2405 args_size.constant = CbC_PRETENDED_STACK_SIZE; |
2411 else if ( fntype&&CbC_IS_CODE_SEGMENT(fntype) ) | 2406 } |
2412 { | 2407 else if ( fndecl && CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)) ) |
2413 char *name = IDENTIFIER_POINTER(DECL_NAME(fndecl)); | 2408 { |
2414 fprintf(stderr, "\nCbC error: codesegment %s has been `CALLED!'.\n", name); | 2409 // 警告コードセグメントを関数呼び出し |
2410 char *name= IDENTIFIER_POINTER(DECL_NAME(fndecl)); | |
2411 warning (0, "code segment `%s' has been \"called\" instead \"goto\".", name); | |
2412 } | |
2413 else if (CbC_IS_CODE_SEGMENT(TREE_TYPE (current_function_decl)) ) | |
2414 { | |
2415 // code segment内部からの関数呼び出し。なんも問題ない。 | |
2416 warning (0, "no warning: normal call from a code segment."); | |
2415 } | 2417 } |
2416 #endif | 2418 #endif |
2417 | 2419 |
2418 /* We want to make two insn chains; one for a sibling call, the other | 2420 /* We want to make two insn chains; one for a sibling call, the other |
2419 for a normal call. We will select one of the two chains after | 2421 for a normal call. We will select one of the two chains after |
2484 and constant sizes must be combined, the size may have to be rounded, | 2486 and constant sizes must be combined, the size may have to be rounded, |
2485 and there may be a minimum required size. When generating a sibcall | 2487 and there may be a minimum required size. When generating a sibcall |
2486 pattern, do not round up, since we'll be re-using whatever space our | 2488 pattern, do not round up, since we'll be re-using whatever space our |
2487 caller provided. */ | 2489 caller provided. */ |
2488 #ifndef noCbC | 2490 #ifndef noCbC |
2489 if ( ( fntype && CbC_IS_CODE_SEGMENT(fntype) ) | 2491 if ( fntype && CbC_IS_CODE_SEGMENT(fntype) ) |
2490 || ( fndecl && CbC_HAVE_CbC_GOTO(fndecl) ) ) | |
2491 { | 2492 { |
2492 unadjusted_args_size = args_size.constant; | 2493 unadjusted_args_size = args_size.constant; |
2493 adjusted_args_size.constant = CbC_ARGS_SIZE; | 2494 adjusted_args_size.constant = CbC_PRETENDED_STACK_SIZE; |
2494 compute_argument_block_size (reg_parm_stack_space, | 2495 compute_argument_block_size (reg_parm_stack_space, |
2495 &adjusted_args_size, | 2496 &adjusted_args_size, |
2496 fndecl, fntype, | 2497 fndecl, fntype, |
2497 (pass == 0 ? 0 | 2498 (pass == 0 ? 0 |
2498 : preferred_stack_boundary)); | 2499 : preferred_stack_boundary)); |
2499 } | 2500 } |
2500 else | 2501 else |
2501 #endif | 2502 #endif |
2502 { | 2503 { |
2503 unadjusted_args_size | 2504 unadjusted_args_size |
2504 = compute_argument_block_size (reg_parm_stack_space, | 2505 = compute_argument_block_size (reg_parm_stack_space, |