Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/iq2000/iq2000.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Definitions of target machine for GNU compiler. | 1 /* Definitions of target machine for GNU compiler. |
2 Vitesse IQ2000 processors | 2 Vitesse IQ2000 processors |
3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 | 3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it | 8 GCC is free software; you can redistribute it and/or modify it |
343 #define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2) | 343 #define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2) |
344 | 344 |
345 | 345 |
346 /* Eliminating the Frame Pointer and the Arg Pointer. */ | 346 /* Eliminating the Frame Pointer and the Arg Pointer. */ |
347 | 347 |
348 #define FRAME_POINTER_REQUIRED 0 | |
349 | |
350 #define ELIMINABLE_REGS \ | 348 #define ELIMINABLE_REGS \ |
351 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | 349 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
352 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | 350 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ |
353 { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | 351 { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
354 { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | 352 { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ |
355 { RETURN_ADDRESS_POINTER_REGNUM, GP_REG_FIRST + 31}, \ | 353 { RETURN_ADDRESS_POINTER_REGNUM, GP_REG_FIRST + 31}, \ |
356 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | 354 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
357 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} | 355 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} |
358 | |
359 | |
360 /* We can always eliminate to the frame pointer. We can eliminate to the | |
361 stack pointer unless a frame pointer is needed. */ | |
362 | |
363 #define CAN_ELIMINATE(FROM, TO) \ | |
364 (((FROM) == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p () \ | |
365 || (TO == GP_REG_FIRST + 31 && leaf_function_p))) \ | |
366 || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM \ | |
367 && ((TO) == HARD_FRAME_POINTER_REGNUM \ | |
368 || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed)))) | |
369 | 356 |
370 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | 357 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
371 (OFFSET) = iq2000_initial_elimination_offset ((FROM), (TO)) | 358 (OFFSET) = iq2000_initial_elimination_offset ((FROM), (TO)) |
372 | 359 |
373 /* Passing Function Arguments on the Stack. */ | 360 /* Passing Function Arguments on the Stack. */ |
433 | 420 |
434 #define FUNCTION_ARG_REGNO_P(N) \ | 421 #define FUNCTION_ARG_REGNO_P(N) \ |
435 (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST)) | 422 (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST)) |
436 | 423 |
437 | 424 |
438 /* How Scalar Function Values are Returned. */ | |
439 | |
440 #define FUNCTION_VALUE(VALTYPE, FUNC) iq2000_function_value (VALTYPE, FUNC) | |
441 | |
442 #define LIBCALL_VALUE(MODE) \ | |
443 gen_rtx_REG (((GET_MODE_CLASS (MODE) != MODE_INT \ | |
444 || GET_MODE_SIZE (MODE) >= 4) \ | |
445 ? (MODE) \ | |
446 : SImode), \ | |
447 GP_RETURN) | |
448 | |
449 /* On the IQ2000, R2 and R3 are the only register thus used. */ | 425 /* On the IQ2000, R2 and R3 are the only register thus used. */ |
450 | 426 |
451 #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN) | 427 #define FUNCTION_VALUE_REGNO_P(N) iq2000_function_value_regno_p (N) |
452 | 428 |
453 | 429 |
454 /* How Large Values are Returned. */ | 430 /* How Large Values are Returned. */ |
455 | 431 |
456 #define DEFAULT_PCC_STRUCT_RETURN 0 | 432 #define DEFAULT_PCC_STRUCT_RETURN 0 |
480 } | 456 } |
481 | 457 |
482 | 458 |
483 /* Trampolines for Nested Functions. */ | 459 /* Trampolines for Nested Functions. */ |
484 | 460 |
485 /* A C statement to output, on the stream FILE, assembler code for a | 461 #define TRAMPOLINE_CODE_SIZE (8*4) |
486 block of data that contains the constant parts of a trampoline. | 462 #define TRAMPOLINE_SIZE (TRAMPOLINE_CODE_SIZE + 2*GET_MODE_SIZE (Pmode)) |
487 This code should not include a label--the label is taken care of | 463 #define TRAMPOLINE_ALIGNMENT GET_MODE_ALIGNMENT (Pmode) |
488 automatically. */ | |
489 | |
490 #define TRAMPOLINE_TEMPLATE(STREAM) \ | |
491 { \ | |
492 fprintf (STREAM, "\t.word\t0x03e00821\t\t# move $1,$31\n"); \ | |
493 fprintf (STREAM, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n"); \ | |
494 fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n"); \ | |
495 if (Pmode == DImode) \ | |
496 { \ | |
497 fprintf (STREAM, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n"); \ | |
498 fprintf (STREAM, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n"); \ | |
499 } \ | |
500 else \ | |
501 { \ | |
502 fprintf (STREAM, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n"); \ | |
503 fprintf (STREAM, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n"); \ | |
504 } \ | |
505 fprintf (STREAM, "\t.word\t0x0060c821\t\t# move $25,$3 (abicalls)\n"); \ | |
506 fprintf (STREAM, "\t.word\t0x00600008\t\t# jr $3\n"); \ | |
507 fprintf (STREAM, "\t.word\t0x0020f821\t\t# move $31,$1\n"); \ | |
508 fprintf (STREAM, "\t.word\t0x00000000\t\t# <function address>\n"); \ | |
509 fprintf (STREAM, "\t.word\t0x00000000\t\t# <static chain value>\n"); \ | |
510 } | |
511 | |
512 #define TRAMPOLINE_SIZE (40) | |
513 | |
514 #define TRAMPOLINE_ALIGNMENT 32 | |
515 | |
516 #define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \ | |
517 { \ | |
518 rtx addr = ADDR; \ | |
519 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 32)), FUNC); \ | |
520 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 36)), CHAIN);\ | |
521 } | |
522 | 464 |
523 | 465 |
524 /* Addressing Modes. */ | 466 /* Addressing Modes. */ |
525 | 467 |
526 #define CONSTANT_ADDRESS_P(X) \ | 468 #define CONSTANT_ADDRESS_P(X) \ |
528 || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \ | 470 || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \ |
529 || (GET_CODE (X) == CONST))) | 471 || (GET_CODE (X) == CONST))) |
530 | 472 |
531 #define MAX_REGS_PER_ADDRESS 1 | 473 #define MAX_REGS_PER_ADDRESS 1 |
532 | 474 |
533 #ifdef REG_OK_STRICT | |
534 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
535 { \ | |
536 if (iq2000_legitimate_address_p (MODE, X, 1)) \ | |
537 goto ADDR; \ | |
538 } | |
539 #else | |
540 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
541 { \ | |
542 if (iq2000_legitimate_address_p (MODE, X, 0)) \ | |
543 goto ADDR; \ | |
544 } | |
545 #endif | |
546 | |
547 #define REG_OK_FOR_INDEX_P(X) 0 | 475 #define REG_OK_FOR_INDEX_P(X) 0 |
548 | |
549 | |
550 /* For the IQ2000, transform: | |
551 | |
552 memory(X + <large int>) | |
553 into: | |
554 Y = <large int> & ~0x7fff; | |
555 Z = X + Y | |
556 memory (Z + (<large int> & 0x7fff)); | |
557 */ | |
558 | |
559 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ | |
560 { \ | |
561 rtx xinsn = (X); \ | |
562 \ | |
563 if (TARGET_DEBUG_B_MODE) \ | |
564 { \ | |
565 GO_PRINTF ("\n========== LEGITIMIZE_ADDRESS\n"); \ | |
566 GO_DEBUG_RTX (xinsn); \ | |
567 } \ | |
568 \ | |
569 if (iq2000_check_split (X, MODE)) \ | |
570 { \ | |
571 X = gen_rtx_LO_SUM (Pmode, \ | |
572 copy_to_mode_reg (Pmode, \ | |
573 gen_rtx_HIGH (Pmode, X)), \ | |
574 X); \ | |
575 goto WIN; \ | |
576 } \ | |
577 \ | |
578 if (GET_CODE (xinsn) == PLUS) \ | |
579 { \ | |
580 rtx xplus0 = XEXP (xinsn, 0); \ | |
581 rtx xplus1 = XEXP (xinsn, 1); \ | |
582 enum rtx_code code0 = GET_CODE (xplus0); \ | |
583 enum rtx_code code1 = GET_CODE (xplus1); \ | |
584 \ | |
585 if (code0 != REG && code1 == REG) \ | |
586 { \ | |
587 xplus0 = XEXP (xinsn, 1); \ | |
588 xplus1 = XEXP (xinsn, 0); \ | |
589 code0 = GET_CODE (xplus0); \ | |
590 code1 = GET_CODE (xplus1); \ | |
591 } \ | |
592 \ | |
593 if (code0 == REG && REG_MODE_OK_FOR_BASE_P (xplus0, MODE) \ | |
594 && code1 == CONST_INT && !SMALL_INT (xplus1)) \ | |
595 { \ | |
596 rtx int_reg = gen_reg_rtx (Pmode); \ | |
597 rtx ptr_reg = gen_reg_rtx (Pmode); \ | |
598 \ | |
599 emit_move_insn (int_reg, \ | |
600 GEN_INT (INTVAL (xplus1) & ~ 0x7fff)); \ | |
601 \ | |
602 emit_insn (gen_rtx_SET (VOIDmode, \ | |
603 ptr_reg, \ | |
604 gen_rtx_PLUS (Pmode, xplus0, int_reg))); \ | |
605 \ | |
606 X = plus_constant (ptr_reg, INTVAL (xplus1) & 0x7fff); \ | |
607 goto WIN; \ | |
608 } \ | |
609 } \ | |
610 \ | |
611 if (TARGET_DEBUG_B_MODE) \ | |
612 GO_PRINTF ("LEGITIMIZE_ADDRESS could not fix.\n"); \ | |
613 } | |
614 | |
615 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} | |
616 | 476 |
617 #define LEGITIMATE_CONSTANT_P(X) (1) | 477 #define LEGITIMATE_CONSTANT_P(X) (1) |
618 | 478 |
619 | 479 |
620 /* Describing Relative Costs of Operations. */ | 480 /* Describing Relative Costs of Operations. */ |
1068 /* The target cpu for optimization and scheduling. */ | 928 /* The target cpu for optimization and scheduling. */ |
1069 extern enum processor_type iq2000_tune; | 929 extern enum processor_type iq2000_tune; |
1070 | 930 |
1071 /* Which instruction set architecture to use. */ | 931 /* Which instruction set architecture to use. */ |
1072 extern int iq2000_isa; | 932 extern int iq2000_isa; |
1073 | |
1074 /* Cached operands, and operator to compare for use in set/branch/trap | |
1075 on condition codes. */ | |
1076 extern rtx branch_cmp[2]; | |
1077 | |
1078 /* What type of branch to use. */ | |
1079 extern enum cmp_type branch_type; | |
1080 | 933 |
1081 enum iq2000_builtins | 934 enum iq2000_builtins |
1082 { | 935 { |
1083 IQ2000_BUILTIN_ADO16, | 936 IQ2000_BUILTIN_ADO16, |
1084 IQ2000_BUILTIN_CFC0, | 937 IQ2000_BUILTIN_CFC0, |