comparison gcc/config/crx/crx.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 /* Output routines for GCC for CRX. 1 /* Output routines for GCC for CRX.
2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc.
4 5
5 This file is part of GCC. 6 This file is part of GCC.
6 7
7 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
8 under the terms of the GNU General Public License as published 9 under the terms of the GNU General Public License as published
43 #include "recog.h" 44 #include "recog.h"
44 #include "expr.h" 45 #include "expr.h"
45 #include "optabs.h" 46 #include "optabs.h"
46 #include "toplev.h" 47 #include "toplev.h"
47 #include "basic-block.h" 48 #include "basic-block.h"
49 #include "df.h"
48 #include "target.h" 50 #include "target.h"
49 #include "target-def.h" 51 #include "target-def.h"
50 52
51 /*****************************************************************************/ 53 /*****************************************************************************/
52 /* DEFINITIONS */ 54 /* DEFINITIONS */
116 /* In case of a POST_INC or POST_DEC memory reference, we must report the mode 118 /* In case of a POST_INC or POST_DEC memory reference, we must report the mode
117 * of the memory reference from PRINT_OPERAND to PRINT_OPERAND_ADDRESS. */ 119 * of the memory reference from PRINT_OPERAND to PRINT_OPERAND_ADDRESS. */
118 static enum machine_mode output_memory_reference_mode; 120 static enum machine_mode output_memory_reference_mode;
119 121
120 /*****************************************************************************/ 122 /*****************************************************************************/
121 /* GLOBAL VARIABLES */
122 /*****************************************************************************/
123
124 /* Table of machine attributes. */
125 const struct attribute_spec crx_attribute_table[];
126
127 /* Test and compare insns use these globals to generate branch insns. */
128 rtx crx_compare_op0 = NULL_RTX;
129 rtx crx_compare_op1 = NULL_RTX;
130
131 /*****************************************************************************/
132 /* TARGETM FUNCTION PROTOTYPES */ 123 /* TARGETM FUNCTION PROTOTYPES */
133 /*****************************************************************************/ 124 /*****************************************************************************/
134 125
135 static bool crx_fixed_condition_code_regs (unsigned int *, unsigned int *); 126 static bool crx_fixed_condition_code_regs (unsigned int *, unsigned int *);
136 static rtx crx_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, 127 static rtx crx_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
137 int incoming ATTRIBUTE_UNUSED); 128 int incoming ATTRIBUTE_UNUSED);
138 static bool crx_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED); 129 static bool crx_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED);
139 static int crx_address_cost (rtx, bool); 130 static int crx_address_cost (rtx, bool);
131 static bool crx_legitimate_address_p (enum machine_mode, rtx, bool);
132 static bool crx_can_eliminate (const int, const int);
133
134 /*****************************************************************************/
135 /* RTL VALIDITY */
136 /*****************************************************************************/
137
138 #undef TARGET_LEGITIMATE_ADDRESS_P
139 #define TARGET_LEGITIMATE_ADDRESS_P crx_legitimate_address_p
140
141 #undef TARGET_CAN_ELIMINATE
142 #define TARGET_CAN_ELIMINATE crx_can_eliminate
140 143
141 /*****************************************************************************/ 144 /*****************************************************************************/
142 /* STACK LAYOUT AND CALLING CONVENTIONS */ 145 /* STACK LAYOUT AND CALLING CONVENTIONS */
143 /*****************************************************************************/ 146 /*****************************************************************************/
144 147
163 /*****************************************************************************/ 166 /*****************************************************************************/
164 167
165 #undef TARGET_ATTRIBUTE_TABLE 168 #undef TARGET_ATTRIBUTE_TABLE
166 #define TARGET_ATTRIBUTE_TABLE crx_attribute_table 169 #define TARGET_ATTRIBUTE_TABLE crx_attribute_table
167 170
168 const struct attribute_spec crx_attribute_table[] = { 171 static const struct attribute_spec crx_attribute_table[] = {
169 /* ISRs have special prologue and epilogue requirements. */ 172 /* ISRs have special prologue and epilogue requirements. */
170 {"interrupt", 0, 0, false, true, true, NULL}, 173 {"interrupt", 0, 0, false, true, true, NULL},
171 {NULL, 0, 0, false, false, false, NULL} 174 {NULL, 0, 0, false, false, false, NULL}
172 }; 175 };
173 176
317 320
318 local_vars_size += padding_locals; 321 local_vars_size += padding_locals;
319 322
320 size_for_adjusting_sp = local_vars_size + (ACCUMULATE_OUTGOING_ARGS ? 323 size_for_adjusting_sp = local_vars_size + (ACCUMULATE_OUTGOING_ARGS ?
321 crtl->outgoing_args_size : 0); 324 crtl->outgoing_args_size : 0);
325 }
326
327 /* Worker function for TARGET_CAN_ELIMINATE. */
328
329 bool
330 crx_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
331 {
332 return (to == STACK_POINTER_REGNUM ? ! frame_pointer_needed : true);
322 } 333 }
323 334
324 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */ 335 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */
325 336
326 int 337 int
539 } 550 }
540 551
541 /* ADDRESSING MODES */ 552 /* ADDRESSING MODES */
542 /* ---------------- */ 553 /* ---------------- */
543 554
544 /* Implements the macro GO_IF_LEGITIMATE_ADDRESS defined in crx.h. 555 /* Implements the hook for TARGET_LEGITIMATE_ADDRESS_P defined in crx.h.
545 * The following addressing modes are supported on CRX: 556 * The following addressing modes are supported on CRX:
546 * 557 *
547 * Relocations --> const | symbol_ref | label_ref 558 * Relocations --> const | symbol_ref | label_ref
548 * Absolute address --> 32-bit absolute 559 * Absolute address --> 32-bit absolute
549 * Post increment --> reg + 12-bit disp. 560 * Post increment --> reg + 12-bit disp.
724 out->side_effect = side_effect; 735 out->side_effect = side_effect;
725 736
726 return retval; 737 return retval;
727 } 738 }
728 739
729 int 740 bool
730 crx_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, 741 crx_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
731 rtx addr, int strict) 742 rtx addr, bool strict)
732 { 743 {
733 enum crx_addrtype addrtype; 744 enum crx_addrtype addrtype;
734 struct crx_address address; 745 struct crx_address address;
735 746
736 if (TARGET_DEBUG_ADDR) 747 if (TARGET_DEBUG_ADDR)
1213 } 1224 }
1214 1225
1215 gcc_assert (offset == count); 1226 gcc_assert (offset == count);
1216 1227
1217 return 1; 1228 return 1;
1218 }
1219
1220 rtx
1221 crx_expand_compare (enum rtx_code code, enum machine_mode mode)
1222 {
1223 rtx op0, op1, cc_reg, ret;
1224
1225 op0 = crx_compare_op0;
1226 op1 = crx_compare_op1;
1227
1228 /* Emit the compare that writes into CC_REGNUM) */
1229 cc_reg = gen_rtx_REG (CCmode, CC_REGNUM);
1230 ret = gen_rtx_COMPARE (CCmode, op0, op1);
1231 emit_insn (gen_rtx_SET (VOIDmode, cc_reg, ret));
1232 /* debug_rtx (get_last_insn ()); */
1233
1234 /* Return the rtx for using the result in CC_REGNUM */
1235 return gen_rtx_fmt_ee (code, mode, cc_reg, const0_rtx);
1236 }
1237
1238 void
1239 crx_expand_branch (enum rtx_code code, rtx label)
1240 {
1241 rtx tmp = crx_expand_compare (code, VOIDmode);
1242 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
1243 gen_rtx_LABEL_REF (VOIDmode, label),
1244 pc_rtx);
1245 emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
1246 /* debug_rtx (get_last_insn ()); */
1247 }
1248
1249 void
1250 crx_expand_scond (enum rtx_code code, rtx dest)
1251 {
1252 rtx tmp = crx_expand_compare (code, GET_MODE (dest));
1253 emit_move_insn (dest, tmp);
1254 /* debug_rtx (get_last_insn ()); */
1255 } 1229 }
1256 1230
1257 static void 1231 static void
1258 mpushpop_str (char *stringbuffer, const char *mnemonic, char *mask) 1232 mpushpop_str (char *stringbuffer, const char *mnemonic, char *mask)
1259 { 1233 {
1466 else if (only_popret_RA) 1440 else if (only_popret_RA)
1467 emit_jump_insn (gen_popret_RA_return ()); 1441 emit_jump_insn (gen_popret_RA_return ());
1468 else 1442 else
1469 emit_jump_insn (gen_pop_and_popret_return (GEN_INT (sum_regs))); 1443 emit_jump_insn (gen_pop_and_popret_return (GEN_INT (sum_regs)));
1470 } 1444 }
1471