Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/fr30/fr30.c @ 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 /* FR30 specific functions. | 1 /* FR30 specific functions. |
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008 | 2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Contributed by Cygnus Solutions. | 4 Contributed by Cygnus Solutions. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
45 #include "target.h" | 45 #include "target.h" |
46 #include "target-def.h" | 46 #include "target-def.h" |
47 | 47 |
48 /*}}}*/ | 48 /*}}}*/ |
49 /*{{{ Function Prologues & Epilogues */ | 49 /*{{{ Function Prologues & Epilogues */ |
50 | |
51 /* Define the information needed to generate branch and scc insns. This is | |
52 stored from the compare operation. */ | |
53 | |
54 struct rtx_def * fr30_compare_op0; | |
55 struct rtx_def * fr30_compare_op1; | |
56 | 50 |
57 /* The FR30 stack looks like this: | 51 /* The FR30 stack looks like this: |
58 | 52 |
59 Before call After call | 53 Before call After call |
60 FP ->| | | | | 54 FP ->| | | | |
123 static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, | 117 static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, |
124 tree, int *, int); | 118 tree, int *, int); |
125 static bool fr30_must_pass_in_stack (enum machine_mode, const_tree); | 119 static bool fr30_must_pass_in_stack (enum machine_mode, const_tree); |
126 static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, | 120 static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, |
127 tree, bool); | 121 tree, bool); |
128 | 122 static bool fr30_frame_pointer_required (void); |
123 static bool fr30_can_eliminate (const int, const int); | |
124 static void fr30_asm_trampoline_template (FILE *); | |
125 static void fr30_trampoline_init (rtx, tree, rtx); | |
129 | 126 |
130 #define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM)) | 127 #define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM)) |
131 #define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM)) | 128 #define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM)) |
132 | 129 |
133 /* Tell prologue and epilogue if register REGNO should be saved / restored. | 130 /* Tell prologue and epilogue if register REGNO should be saved / restored. |
162 #undef TARGET_SETUP_INCOMING_VARARGS | 159 #undef TARGET_SETUP_INCOMING_VARARGS |
163 #define TARGET_SETUP_INCOMING_VARARGS fr30_setup_incoming_varargs | 160 #define TARGET_SETUP_INCOMING_VARARGS fr30_setup_incoming_varargs |
164 #undef TARGET_MUST_PASS_IN_STACK | 161 #undef TARGET_MUST_PASS_IN_STACK |
165 #define TARGET_MUST_PASS_IN_STACK fr30_must_pass_in_stack | 162 #define TARGET_MUST_PASS_IN_STACK fr30_must_pass_in_stack |
166 | 163 |
164 #undef TARGET_FRAME_POINTER_REQUIRED | |
165 #define TARGET_FRAME_POINTER_REQUIRED fr30_frame_pointer_required | |
166 | |
167 #undef TARGET_CAN_ELIMINATE | |
168 #define TARGET_CAN_ELIMINATE fr30_can_eliminate | |
169 | |
170 #undef TARGET_ASM_TRAMPOLINE_TEMPLATE | |
171 #define TARGET_ASM_TRAMPOLINE_TEMPLATE fr30_asm_trampoline_template | |
172 #undef TARGET_TRAMPOLINE_INIT | |
173 #define TARGET_TRAMPOLINE_INIT fr30_trampoline_init | |
174 | |
167 struct gcc_target targetm = TARGET_INITIALIZER; | 175 struct gcc_target targetm = TARGET_INITIALIZER; |
168 | 176 |
177 | |
178 /* Worker function for TARGET_CAN_ELIMINATE. */ | |
179 | |
180 bool | |
181 fr30_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) | |
182 { | |
183 return (to == FRAME_POINTER_REGNUM || ! frame_pointer_needed); | |
184 } | |
185 | |
169 /* Returns the number of bytes offset between FROM_REG and TO_REG | 186 /* Returns the number of bytes offset between FROM_REG and TO_REG |
170 for the current function. As a side effect it fills in the | 187 for the current function. As a side effect it fills in the |
171 current_frame_info structure, if the data is available. */ | 188 current_frame_info structure, if the data is available. */ |
172 unsigned int | 189 unsigned int |
173 fr30_compute_frame_size (int from_reg, int to_reg) | 190 fr30_compute_frame_size (int from_reg, int to_reg) |
903 end_sequence (); | 920 end_sequence (); |
904 | 921 |
905 return val; | 922 return val; |
906 } | 923 } |
907 | 924 |
925 /* Implement TARGET_FRAME_POINTER_REQUIRED. */ | |
926 | |
927 bool | |
928 fr30_frame_pointer_required (void) | |
929 { | |
930 return (flag_omit_frame_pointer == 0 || crtl->args.pretend_args_size > 0); | |
931 } | |
932 | |
933 /*}}}*/ | |
934 /*{{{ Trampoline Output Routines */ | |
935 | |
936 /* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE. | |
937 On the FR30, the trampoline is: | |
938 | |
939 nop | |
940 ldi:32 STATIC, r12 | |
941 nop | |
942 ldi:32 FUNCTION, r0 | |
943 jmp @r0 | |
944 | |
945 The no-ops are to guarantee that the static chain and final | |
946 target are 32 bit aligned within the trampoline. That allows us to | |
947 initialize those locations with simple SImode stores. The alternative | |
948 would be to use HImode stores. */ | |
949 | |
950 static void | |
951 fr30_asm_trampoline_template (FILE *f) | |
952 { | |
953 fprintf (f, "\tnop\n"); | |
954 fprintf (f, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]); | |
955 fprintf (f, "\tnop\n"); | |
956 fprintf (f, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]); | |
957 fprintf (f, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]); | |
958 } | |
959 | |
960 /* Implement TARGET_TRAMPOLINE_INIT. */ | |
961 | |
962 static void | |
963 fr30_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) | |
964 { | |
965 rtx fnaddr = XEXP (DECL_RTL (fndecl), 0); | |
966 rtx mem; | |
967 | |
968 emit_block_move (m_tramp, assemble_trampoline_template (), | |
969 GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL); | |
970 | |
971 mem = adjust_address (m_tramp, SImode, 4); | |
972 emit_move_insn (mem, chain_value); | |
973 mem = adjust_address (m_tramp, SImode, 12); | |
974 emit_move_insn (mem, fnaddr); | |
975 } | |
976 | |
908 /*}}}*/ | 977 /*}}}*/ |
909 /* Local Variables: */ | 978 /* Local Variables: */ |
910 /* folded-file: t */ | 979 /* folded-file: t */ |
911 /* End: */ | 980 /* End: */ |