comparison gcc/config/cris/cris.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 855418dad1a3
children f6334be47118
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Definitions for GCC. Part of the machine description for CRIS. 1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
3 Free Software Foundation, Inc. 3 2009 Free Software Foundation, Inc.
4 Contributed by Axis Communications. Written by Hans-Peter Nilsson. 4 Contributed by Axis Communications. Written by Hans-Peter Nilsson.
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 8 GCC is free software; you can redistribute it and/or modify
350 post-increment on DImode indirect. */ 350 post-increment on DImode indirect. */
351 #define WORDS_BIG_ENDIAN 0 351 #define WORDS_BIG_ENDIAN 0
352 352
353 #define UNITS_PER_WORD 4 353 #define UNITS_PER_WORD 4
354 354
355 /* A combination of defining PROMOTE_FUNCTION_MODE,
356 TARGET_PROMOTE_FUNCTION_ARGS that always returns true
357 and *not* defining TARGET_PROMOTE_PROTOTYPES or PROMOTE_MODE gives the
358 best code size and speed for gcc, ipps and products in gcc-2.7.2. */
359 #define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \ 355 #define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \
360 (GET_MODE_CLASS (MODE) == MODE_INT && GET_MODE_SIZE (MODE) < 4) \ 356 (GET_MODE_CLASS (MODE) == MODE_INT && GET_MODE_SIZE (MODE) < 4) \
361 ? SImode : MODE 357 ? SImode : MODE
362
363 #define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
364 (MODE) = CRIS_PROMOTED_MODE (MODE, UNSIGNEDP, TYPE)
365
366 /* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovers bug 981110 (even
367 if defining FUNCTION_VALUE with MODE as PROMOTED_MODE ;-)
368
369 FIXME: Report this when cris.h is part of GCC, so others can easily
370 see the problem. Maybe check other systems that define
371 TARGET_PROMOTE_FUNCTION_RETURN that always returns true. */
372 358
373 /* We will be using prototype promotion, so they will be 32 bit. */ 359 /* We will be using prototype promotion, so they will be 32 bit. */
374 #define PARM_BOUNDARY 32 360 #define PARM_BOUNDARY 32
375 361
376 /* Stack boundary is guided by -mstack-align, -mno-stack-align, 362 /* Stack boundary is guided by -mstack-align, -mno-stack-align,
853 #define STATIC_CHAIN_REGNUM CRIS_STATIC_CHAIN_REGNUM 839 #define STATIC_CHAIN_REGNUM CRIS_STATIC_CHAIN_REGNUM
854 840
855 841
856 /* Node: Elimination */ 842 /* Node: Elimination */
857 843
858 /* Really only needed if the stack frame has variable length (alloca
859 or variable sized local arguments (GNU C extension). See PR39499 and
860 PR38609 for the reason this isn't just 0. */
861 #define FRAME_POINTER_REQUIRED (!current_function_sp_is_unchanging)
862
863 #define ELIMINABLE_REGS \ 844 #define ELIMINABLE_REGS \
864 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 845 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
865 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ 846 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
866 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} 847 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
867
868 /* We need not worry about when the frame-pointer is required for other
869 reasons. */
870 #define CAN_ELIMINATE(FROM, TO) 1
871 848
872 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ 849 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
873 (OFFSET) = cris_initial_elimination_offset (FROM, TO) 850 (OFFSET) = cris_initial_elimination_offset (FROM, TO)
874 851
875 852
927 && (REGNO) < CRIS_FIRST_ARG_REG + (CRIS_MAX_ARGS_IN_REGS)) 904 && (REGNO) < CRIS_FIRST_ARG_REG + (CRIS_MAX_ARGS_IN_REGS))
928 905
929 906
930 /* Node: Scalar Return */ 907 /* Node: Scalar Return */
931 908
932 /* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the 909 #define FUNCTION_VALUE_REGNO_P(N) cris_function_value_regno_p (N)
933 time being. */ 910
934 #define FUNCTION_VALUE(VALTYPE, FUNC) \
935 gen_rtx_REG (TYPE_MODE (VALTYPE), CRIS_FIRST_ARG_REG)
936
937 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, CRIS_FIRST_ARG_REG)
938
939 #define FUNCTION_VALUE_REGNO_P(N) ((N) == CRIS_FIRST_ARG_REG)
940 911
941 912
942 /* Node: Aggregate Return */ 913 /* Node: Aggregate Return */
943 914
944 #define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1) 915 #define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
961 documentation. */ 932 documentation. */
962 933
963 934
964 /* Node: Trampolines */ 935 /* Node: Trampolines */
965 936
966 /* This looks too complicated, and it is. I assigned r7 to be the
967 static chain register, but it is call-saved, so we have to save it,
968 and come back to restore it after the call, so we have to save srp...
969 Anyway, trampolines are rare enough that we can cope with this
970 somewhat lack of elegance.
971 (Do not be tempted to "straighten up" whitespace in the asms; the
972 assembler #NO_APP state mandates strict spacing). */
973 #define TRAMPOLINE_TEMPLATE(FILE) \
974 do \
975 { \
976 if (TARGET_V32) \
977 { \
978 /* This normally-unused nop insn acts as an instruction to \
979 the simulator to flush its instruction cache. None of \
980 the other instructions in the trampoline template suits \
981 as a trigger for V32. The pc-relative addressing mode \
982 works nicely as a trigger for V10. \
983 FIXME: Have specific V32 template (possibly avoiding the \
984 use of a special instruction). */ \
985 fprintf (FILE, "\tclearf x\n"); \
986 /* We have to use a register as an intermediate, choosing \
987 semi-randomly R1 (which has to not be the \
988 STATIC_CHAIN_REGNUM), so we can use it for address \
989 indirection and jsr target. */ \
990 fprintf (FILE, "\tmove $r1,$mof\n"); \
991 /* +4 */ \
992 fprintf (FILE, "\tmove.d 0,$r1\n"); \
993 fprintf (FILE, "\tmove.d $%s,[$r1]\n", \
994 reg_names[STATIC_CHAIN_REGNUM]); \
995 fprintf (FILE, "\taddq 6,$r1\n"); \
996 fprintf (FILE, "\tmove $mof,[$r1]\n"); \
997 fprintf (FILE, "\taddq 6,$r1\n"); \
998 fprintf (FILE, "\tmove $srp,[$r1]\n"); \
999 /* +20 */ \
1000 fprintf (FILE, "\tmove.d 0,$%s\n", \
1001 reg_names[STATIC_CHAIN_REGNUM]); \
1002 /* +26 */ \
1003 fprintf (FILE, "\tmove.d 0,$r1\n"); \
1004 fprintf (FILE, "\tjsr $r1\n"); \
1005 fprintf (FILE, "\tsetf\n"); \
1006 /* +36 */ \
1007 fprintf (FILE, "\tmove.d 0,$%s\n", \
1008 reg_names[STATIC_CHAIN_REGNUM]); \
1009 /* +42 */ \
1010 fprintf (FILE, "\tmove.d 0,$r1\n"); \
1011 /* +48 */ \
1012 fprintf (FILE, "\tmove.d 0,$r9\n"); \
1013 fprintf (FILE, "\tjump $r9\n"); \
1014 fprintf (FILE, "\tsetf\n"); \
1015 } \
1016 else \
1017 { \
1018 fprintf (FILE, "\tmove.d $%s,[$pc+20]\n", \
1019 reg_names[STATIC_CHAIN_REGNUM]); \
1020 fprintf (FILE, "\tmove $srp,[$pc+22]\n"); \
1021 fprintf (FILE, "\tmove.d 0,$%s\n", \
1022 reg_names[STATIC_CHAIN_REGNUM]); \
1023 fprintf (FILE, "\tjsr 0\n"); \
1024 fprintf (FILE, "\tmove.d 0,$%s\n", \
1025 reg_names[STATIC_CHAIN_REGNUM]); \
1026 fprintf (FILE, "\tjump 0\n"); \
1027 } \
1028 } \
1029 while (0)
1030
1031 #define TRAMPOLINE_SIZE (TARGET_V32 ? 58 : 32) 937 #define TRAMPOLINE_SIZE (TARGET_V32 ? 58 : 32)
1032 938
1033 /* CRIS wants instructions on word-boundary. 939 /* CRIS wants instructions on word-boundary. */
1034 Note that due to a bug (reported) in 2.7.2 and earlier, this is
1035 actually treated as alignment in _bytes_, not _bits_. (Obviously
1036 this is not fatal, only a slight waste of stack space). */
1037 #define TRAMPOLINE_ALIGNMENT 16 940 #define TRAMPOLINE_ALIGNMENT 16
1038
1039 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1040 do \
1041 if (TARGET_V32) \
1042 { \
1043 emit_move_insn (gen_rtx_MEM (SImode, \
1044 plus_constant (TRAMP, 6)), \
1045 plus_constant (TRAMP, 38)); \
1046 emit_move_insn (gen_rtx_MEM (SImode, \
1047 plus_constant (TRAMP, 22)), \
1048 CXT); \
1049 emit_move_insn (gen_rtx_MEM (SImode, \
1050 plus_constant (TRAMP, 28)), \
1051 FNADDR); \
1052 } \
1053 else \
1054 { \
1055 emit_move_insn (gen_rtx_MEM (SImode, \
1056 plus_constant (TRAMP, 10)), \
1057 CXT); \
1058 emit_move_insn (gen_rtx_MEM (SImode, \
1059 plus_constant (TRAMP, 16)), \
1060 FNADDR); \
1061 } \
1062 while (0)
1063
1064 /* Note that there is no need to do anything with the cache for sake of
1065 a trampoline. */
1066
1067 941
1068 /* Node: Library Calls */ 942 /* Node: Library Calls */
1069 943
1070 /* If you change this, you have to check whatever libraries and systems 944 /* If you change this, you have to check whatever libraries and systems
1071 that use it. */ 945 that use it. */
1073 947
1074 948
1075 /* Node: Addressing Modes */ 949 /* Node: Addressing Modes */
1076 950
1077 #define HAVE_POST_INCREMENT 1 951 #define HAVE_POST_INCREMENT 1
1078
1079 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1080 952
1081 /* Must be a compile-time constant, so we go with the highest value 953 /* Must be a compile-time constant, so we go with the highest value
1082 among all CRIS variants. */ 954 among all CRIS variants. */
1083 #define MAX_REGS_PER_ADDRESS 2 955 #define MAX_REGS_PER_ADDRESS 2
1084 956
1192 #else 1064 #else
1193 /* Nonzero if X is a hard reg that can be used as an index. */ 1065 /* Nonzero if X is a hard reg that can be used as an index. */
1194 # define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) 1066 # define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1195 #endif 1067 #endif
1196 1068
1197 /* For now, don't do anything. GCC does a good job most often.
1198
1199 Maybe we could do something about gcc:s misbehavior when it
1200 recalculates frame offsets for local variables, from fp+offs to
1201 sp+offs. The resulting address expression gets screwed up
1202 sometimes, but I'm not sure that it may be fixed here, since it is
1203 already split up in several instructions (Is this still true?).
1204 FIXME: Check and adjust for gcc-2.9x. */
1205 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) {}
1206
1207 /* Fix reloads known to cause suboptimal spilling. */ 1069 /* Fix reloads known to cause suboptimal spilling. */
1208 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, INDL, WIN) \ 1070 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, INDL, WIN) \
1209 do \ 1071 do \
1210 { \ 1072 { \
1211 if (cris_reload_address_legitimized (X, MODE, OPNUM, TYPE, INDL)) \ 1073 if (cris_reload_address_legitimized (X, MODE, OPNUM, TYPE, INDL)) \
1212 goto WIN; \ 1074 goto WIN; \
1213 } \ 1075 } \
1214 while (0) 1076 while (0)
1215
1216 /* In CRIS, only the postincrement address mode depends thus,
1217 since the increment depends on the size of the operand. This is now
1218 treated generically within recog.c. */
1219 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
1220 1077
1221 #define LEGITIMATE_CONSTANT_P(X) 1 1078 #define LEGITIMATE_CONSTANT_P(X) 1
1222 1079
1223 1080
1224 /* Node: Condition Code */ 1081 /* Node: Condition Code */