Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/moxie/moxie.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
31 #include "output.h" | 31 #include "output.h" |
32 #include "insn-attr.h" | 32 #include "insn-attr.h" |
33 #include "flags.h" | 33 #include "flags.h" |
34 #include "recog.h" | 34 #include "recog.h" |
35 #include "reload.h" | 35 #include "reload.h" |
36 #include "toplev.h" | 36 #include "diagnostic-core.h" |
37 #include "obstack.h" | 37 #include "obstack.h" |
38 #include "tree.h" | 38 #include "tree.h" |
39 #include "expr.h" | 39 #include "expr.h" |
40 #include "optabs.h" | 40 #include "optabs.h" |
41 #include "except.h" | 41 #include "except.h" |
68 If the precise function being called is known, FUNC is its | 68 If the precise function being called is known, FUNC is its |
69 FUNCTION_DECL; otherwise, FUNC is 0. | 69 FUNCTION_DECL; otherwise, FUNC is 0. |
70 | 70 |
71 We always return values in register $r0 for moxie. */ | 71 We always return values in register $r0 for moxie. */ |
72 | 72 |
73 rtx | 73 static rtx |
74 moxie_function_value (const_tree valtype, | 74 moxie_function_value (const_tree valtype, |
75 const_tree fntype_or_decl ATTRIBUTE_UNUSED, | 75 const_tree fntype_or_decl ATTRIBUTE_UNUSED, |
76 bool outgoing ATTRIBUTE_UNUSED) | 76 bool outgoing ATTRIBUTE_UNUSED) |
77 { | 77 { |
78 return gen_rtx_REG (TYPE_MODE (valtype), MOXIE_R0); | 78 return gen_rtx_REG (TYPE_MODE (valtype), MOXIE_R0); |
79 } | |
80 | |
81 /* Define how to find the value returned by a library function. | |
82 | |
83 We always return values in register $r0 for moxie. */ | |
84 | |
85 static rtx | |
86 moxie_libcall_value (enum machine_mode mode, | |
87 const_rtx fun ATTRIBUTE_UNUSED) | |
88 { | |
89 return gen_rtx_REG (mode, MOXIE_R0); | |
90 } | |
91 | |
92 /* Handle TARGET_FUNCTION_VALUE_REGNO_P. | |
93 | |
94 We always return values in register $r0 for moxie. */ | |
95 | |
96 static bool | |
97 moxie_function_value_regno_p (const unsigned int regno) | |
98 { | |
99 return (regno == MOXIE_R0); | |
79 } | 100 } |
80 | 101 |
81 /* Emit an error message when we're in an asm, and a fatal error for | 102 /* Emit an error message when we're in an asm, and a fatal error for |
82 "normal" insns. Formatted output isn't easily implemented, since we | 103 "normal" insns. Formatted output isn't easily implemented, since we |
83 use output_operand_lossage to output the actual message and handle the | 104 use output_operand_lossage to output the actual message and handle the |
203 /* Zero initialization is OK for all current fields. */ | 224 /* Zero initialization is OK for all current fields. */ |
204 | 225 |
205 static struct machine_function * | 226 static struct machine_function * |
206 moxie_init_machine_status (void) | 227 moxie_init_machine_status (void) |
207 { | 228 { |
208 return GGC_CNEW (struct machine_function); | 229 return ggc_alloc_cleared_machine_function (); |
209 } | 230 } |
210 | 231 |
211 | 232 |
212 /* The OVERRIDE_OPTIONS worker. | 233 /* The TARGET_OPTION_OVERRIDE worker. |
213 All this curently does is set init_machine_status. */ | 234 All this curently does is set init_machine_status. */ |
214 void | 235 static void |
215 moxie_override_options (void) | 236 moxie_option_override (void) |
216 { | 237 { |
217 /* Set the per-function-data initializer. */ | 238 /* Set the per-function-data initializer. */ |
218 init_machine_status = moxie_init_machine_status; | 239 init_machine_status = moxie_init_machine_status; |
219 } | 240 } |
220 | 241 |
293 | 314 |
294 void | 315 void |
295 moxie_expand_epilogue (void) | 316 moxie_expand_epilogue (void) |
296 { | 317 { |
297 int regno; | 318 int regno; |
298 rtx insn, reg, cfa_restores = NULL; | 319 rtx reg; |
299 | 320 |
300 if (cfun->machine->callee_saved_reg_size != 0) | 321 if (cfun->machine->callee_saved_reg_size != 0) |
301 { | 322 { |
302 reg = gen_rtx_REG (Pmode, MOXIE_R5); | 323 reg = gen_rtx_REG (Pmode, MOXIE_R5); |
303 if (cfun->machine->callee_saved_reg_size <= 255) | 324 if (cfun->machine->callee_saved_reg_size <= 255) |
316 for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; ) | 337 for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; ) |
317 if (!fixed_regs[regno] && !call_used_regs[regno] | 338 if (!fixed_regs[regno] && !call_used_regs[regno] |
318 && df_regs_ever_live_p (regno)) | 339 && df_regs_ever_live_p (regno)) |
319 { | 340 { |
320 rtx preg = gen_rtx_REG (Pmode, regno); | 341 rtx preg = gen_rtx_REG (Pmode, regno); |
321 insn = emit_insn (gen_movsi_pop (reg, preg)); | 342 emit_insn (gen_movsi_pop (reg, preg)); |
322 } | 343 } |
323 } | 344 } |
324 | 345 |
325 emit_jump_insn (gen_returner ()); | 346 emit_jump_insn (gen_returner ()); |
326 } | 347 } |
385 } | 406 } |
386 | 407 |
387 /* Return the next register to be used to hold a function argument or | 408 /* Return the next register to be used to hold a function argument or |
388 NULL_RTX if there's no more space. */ | 409 NULL_RTX if there's no more space. */ |
389 | 410 |
390 rtx | 411 static rtx |
391 moxie_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, | 412 moxie_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, |
392 tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) | 413 const_tree type ATTRIBUTE_UNUSED, |
393 { | 414 bool named ATTRIBUTE_UNUSED) |
394 if (cum < 8) | 415 { |
395 return gen_rtx_REG (mode, cum); | 416 if (*cum < 8) |
417 return gen_rtx_REG (mode, *cum); | |
396 else | 418 else |
397 return NULL_RTX; | 419 return NULL_RTX; |
420 } | |
421 | |
422 #define MOXIE_FUNCTION_ARG_SIZE(MODE, TYPE) \ | |
423 ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \ | |
424 : (unsigned) int_size_in_bytes (TYPE)) | |
425 | |
426 static void | |
427 moxie_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, | |
428 const_tree type, bool named ATTRIBUTE_UNUSED) | |
429 { | |
430 *cum = (*cum < MOXIE_R6 | |
431 ? *cum + ((3 + MOXIE_FUNCTION_ARG_SIZE (mode, type)) / 4) | |
432 : *cum); | |
398 } | 433 } |
399 | 434 |
400 /* Return non-zero if the function argument described by TYPE is to be | 435 /* Return non-zero if the function argument described by TYPE is to be |
401 passed by reference. */ | 436 passed by reference. */ |
402 | 437 |
515 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size | 550 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size |
516 #undef TARGET_PASS_BY_REFERENCE | 551 #undef TARGET_PASS_BY_REFERENCE |
517 #define TARGET_PASS_BY_REFERENCE moxie_pass_by_reference | 552 #define TARGET_PASS_BY_REFERENCE moxie_pass_by_reference |
518 #undef TARGET_ARG_PARTIAL_BYTES | 553 #undef TARGET_ARG_PARTIAL_BYTES |
519 #define TARGET_ARG_PARTIAL_BYTES moxie_arg_partial_bytes | 554 #define TARGET_ARG_PARTIAL_BYTES moxie_arg_partial_bytes |
555 #undef TARGET_FUNCTION_ARG | |
556 #define TARGET_FUNCTION_ARG moxie_function_arg | |
557 #undef TARGET_FUNCTION_ARG_ADVANCE | |
558 #define TARGET_FUNCTION_ARG_ADVANCE moxie_function_arg_advance | |
520 | 559 |
521 | 560 |
522 #undef TARGET_SETUP_INCOMING_VARARGS | 561 #undef TARGET_SETUP_INCOMING_VARARGS |
523 #define TARGET_SETUP_INCOMING_VARARGS moxie_setup_incoming_varargs | 562 #define TARGET_SETUP_INCOMING_VARARGS moxie_setup_incoming_varargs |
524 | 563 |
528 /* Define this to return an RTX representing the place where a | 567 /* Define this to return an RTX representing the place where a |
529 function returns or receives a value of data type RET_TYPE, a tree | 568 function returns or receives a value of data type RET_TYPE, a tree |
530 node node representing a data type. */ | 569 node node representing a data type. */ |
531 #undef TARGET_FUNCTION_VALUE | 570 #undef TARGET_FUNCTION_VALUE |
532 #define TARGET_FUNCTION_VALUE moxie_function_value | 571 #define TARGET_FUNCTION_VALUE moxie_function_value |
572 #undef TARGET_LIBCALL_VALUE | |
573 #define TARGET_LIBCALL_VALUE moxie_libcall_value | |
574 #undef TARGET_FUNCTION_VALUE_REGNO_P | |
575 #define TARGET_FUNCTION_VALUE_REGNO_P moxie_function_value_regno_p | |
533 | 576 |
534 #undef TARGET_FRAME_POINTER_REQUIRED | 577 #undef TARGET_FRAME_POINTER_REQUIRED |
535 #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true | 578 #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true |
536 | 579 |
537 #undef TARGET_STATIC_CHAIN | 580 #undef TARGET_STATIC_CHAIN |
539 #undef TARGET_ASM_TRAMPOLINE_TEMPLATE | 582 #undef TARGET_ASM_TRAMPOLINE_TEMPLATE |
540 #define TARGET_ASM_TRAMPOLINE_TEMPLATE moxie_asm_trampoline_template | 583 #define TARGET_ASM_TRAMPOLINE_TEMPLATE moxie_asm_trampoline_template |
541 #undef TARGET_TRAMPOLINE_INIT | 584 #undef TARGET_TRAMPOLINE_INIT |
542 #define TARGET_TRAMPOLINE_INIT moxie_trampoline_init | 585 #define TARGET_TRAMPOLINE_INIT moxie_trampoline_init |
543 | 586 |
587 #undef TARGET_OPTION_OVERRIDE | |
588 #define TARGET_OPTION_OVERRIDE moxie_option_override | |
589 | |
544 struct gcc_target targetm = TARGET_INITIALIZER; | 590 struct gcc_target targetm = TARGET_INITIALIZER; |
545 | 591 |
546 #include "gt-moxie.h" | 592 #include "gt-moxie.h" |