1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
3 Free Software Foundation, Inc.
4 Contributed by Axis Communications. Written by Hans-Peter Nilsson.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
28 #include "hard-reg-set.h"
30 #include "insn-config.h"
31 #include "conditions.h"
32 #include "insn-attr.h"
45 #include "target-def.h"
50 /* Usable when we have an amount to add or subtract, and want the
51 optimal size of the insn. */
52 #define ADDITIVE_SIZE_MODIFIER(size) \
53 ((size) <= 63 ? "q" : (size) <= 255 ? "u.b" : (size) <= 65535 ? "u.w" : ".d")
55 #define LOSE_AND_RETURN(msgid, x) \
58 cris_operand_lossage (msgid, x); \
62 enum cris_retinsn_type
63 { CRIS_RETINSN_UNKNOWN
= 0, CRIS_RETINSN_RET
, CRIS_RETINSN_JUMP
};
65 /* Per-function machine data. */
66 struct machine_function
GTY(())
68 int needs_return_address_on_stack
;
70 /* This is the number of registers we save in the prologue due to
74 enum cris_retinsn_type return_type
;
77 /* This little fix suppresses the 'u' or 's' when '%e' in assembly
79 static char cris_output_insn_is_bound
= 0;
81 /* In code for output macros, this is how we know whether e.g. constant
82 goes in code or in a static initializer. */
83 static int in_code
= 0;
85 /* Fix for reg_overlap_mentioned_p. */
86 static int cris_reg_overlap_mentioned_p (rtx
, rtx
);
88 static void cris_print_base (rtx
, FILE *);
90 static void cris_print_index (rtx
, FILE *);
92 static void cris_output_addr_const (FILE *, rtx
);
94 static struct machine_function
* cris_init_machine_status (void);
96 static rtx
cris_struct_value_rtx (tree
, int);
98 static void cris_setup_incoming_varargs (CUMULATIVE_ARGS
*, enum machine_mode
,
99 tree type
, int *, int);
101 static int cris_initial_frame_pointer_offset (void);
103 static int saved_regs_mentioned (rtx
);
105 static void cris_operand_lossage (const char *, rtx
);
107 static int cris_reg_saved_in_regsave_area (unsigned int, bool);
109 static void cris_asm_output_mi_thunk
110 (FILE *, tree
, HOST_WIDE_INT
, HOST_WIDE_INT
, tree
);
112 static void cris_file_start (void);
113 static void cris_init_libfuncs (void);
115 static bool cris_rtx_costs (rtx
, int, int, int *);
116 static int cris_address_cost (rtx
);
117 static bool cris_pass_by_reference (CUMULATIVE_ARGS
*, enum machine_mode
,
119 static int cris_arg_partial_bytes (CUMULATIVE_ARGS
*, enum machine_mode
,
121 static tree
cris_md_asm_clobbers (tree
, tree
, tree
);
123 static bool cris_handle_option (size_t, const char *, int);
125 /* This is the parsed result of the "-max-stack-stackframe=" option. If
126 it (still) is zero, then there was no such option given. */
127 int cris_max_stackframe
= 0;
129 /* This is the parsed result of the "-march=" option, if given. */
130 int cris_cpu_version
= CRIS_DEFAULT_CPU_VERSION
;
132 #undef TARGET_ASM_ALIGNED_HI_OP
133 #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
134 #undef TARGET_ASM_ALIGNED_SI_OP
135 #define TARGET_ASM_ALIGNED_SI_OP "\t.dword\t"
136 #undef TARGET_ASM_ALIGNED_DI_OP
137 #define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t"
139 /* We need to define these, since the 2byte, 4byte, 8byte op:s are only
140 available in ELF. These "normal" pseudos do not have any alignment
141 constraints or side-effects. */
142 #undef TARGET_ASM_UNALIGNED_HI_OP
143 #define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP
145 #undef TARGET_ASM_UNALIGNED_SI_OP
146 #define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP
148 #undef TARGET_ASM_UNALIGNED_DI_OP
149 #define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
151 #undef TARGET_ASM_OUTPUT_MI_THUNK
152 #define TARGET_ASM_OUTPUT_MI_THUNK cris_asm_output_mi_thunk
153 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
154 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
156 #undef TARGET_ASM_FILE_START
157 #define TARGET_ASM_FILE_START cris_file_start
159 #undef TARGET_INIT_LIBFUNCS
160 #define TARGET_INIT_LIBFUNCS cris_init_libfuncs
162 #undef TARGET_RTX_COSTS
163 #define TARGET_RTX_COSTS cris_rtx_costs
164 #undef TARGET_ADDRESS_COST
165 #define TARGET_ADDRESS_COST cris_address_cost
167 #undef TARGET_PROMOTE_FUNCTION_ARGS
168 #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
169 #undef TARGET_STRUCT_VALUE_RTX
170 #define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
171 #undef TARGET_SETUP_INCOMING_VARARGS
172 #define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs
173 #undef TARGET_PASS_BY_REFERENCE
174 #define TARGET_PASS_BY_REFERENCE cris_pass_by_reference
175 #undef TARGET_ARG_PARTIAL_BYTES
176 #define TARGET_ARG_PARTIAL_BYTES cris_arg_partial_bytes
177 #undef TARGET_MD_ASM_CLOBBERS
178 #define TARGET_MD_ASM_CLOBBERS cris_md_asm_clobbers
179 #undef TARGET_DEFAULT_TARGET_FLAGS
180 #define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | CRIS_SUBTARGET_DEFAULT)
181 #undef TARGET_HANDLE_OPTION
182 #define TARGET_HANDLE_OPTION cris_handle_option
184 struct gcc_target targetm
= TARGET_INITIALIZER
;
186 /* Helper for cris_load_multiple_op and cris_ret_movem_op. */
189 cris_movem_load_rest_p (rtx op
, int offs
)
191 unsigned int reg_count
= XVECLEN (op
, 0) - offs
;
197 unsigned int regno
= 0;
199 /* Perform a quick check so we don't blow up below. FIXME: Adjust for
200 other than (MEM reg). */
202 || GET_CODE (XVECEXP (op
, 0, offs
)) != SET
203 || !REG_P (SET_DEST (XVECEXP (op
, 0, offs
)))
204 || !MEM_P (SET_SRC (XVECEXP (op
, 0, offs
))))
207 /* Check a possible post-inc indicator. */
208 if (GET_CODE (SET_SRC (XVECEXP (op
, 0, offs
+ 1))) == PLUS
)
210 rtx reg
= XEXP (SET_SRC (XVECEXP (op
, 0, offs
+ 1)), 0);
211 rtx inc
= XEXP (SET_SRC (XVECEXP (op
, 0, offs
+ 1)), 1);
217 || !REG_P (SET_DEST (XVECEXP (op
, 0, offs
+ 1)))
218 || REGNO (reg
) != REGNO (SET_DEST (XVECEXP (op
, 0, offs
+ 1)))
219 || !CONST_INT_P (inc
)
220 || INTVAL (inc
) != (HOST_WIDE_INT
) reg_count
* 4)
230 regno
= reg_count
- 1;
233 elt
= XVECEXP (op
, 0, offs
);
234 src_addr
= XEXP (SET_SRC (elt
), 0);
236 if (GET_CODE (elt
) != SET
237 || !REG_P (SET_DEST (elt
))
238 || GET_MODE (SET_DEST (elt
)) != SImode
239 || REGNO (SET_DEST (elt
)) != regno
240 || !MEM_P (SET_SRC (elt
))
241 || GET_MODE (SET_SRC (elt
)) != SImode
242 || !memory_address_p (SImode
, src_addr
))
245 for (setno
= 1; i
< XVECLEN (op
, 0); setno
++, i
++)
247 rtx elt
= XVECEXP (op
, 0, i
);
250 if (GET_CODE (elt
) != SET
251 || !REG_P (SET_DEST (elt
))
252 || GET_MODE (SET_DEST (elt
)) != SImode
253 || REGNO (SET_DEST (elt
)) != regno
254 || !MEM_P (SET_SRC (elt
))
255 || GET_MODE (SET_SRC (elt
)) != SImode
256 || GET_CODE (XEXP (SET_SRC (elt
), 0)) != PLUS
257 || ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt
), 0), 0), src_addr
)
258 || !CONST_INT_P (XEXP (XEXP (SET_SRC (elt
), 0), 1))
259 || INTVAL (XEXP (XEXP (SET_SRC (elt
), 0), 1)) != setno
* 4)
266 /* Worker function for predicate for the parallel contents in a movem
270 cris_store_multiple_op_p (rtx op
)
272 int reg_count
= XVECLEN (op
, 0);
283 /* Perform a quick check so we don't blow up below. FIXME: Adjust for
284 other than (MEM reg) and (MEM (PLUS reg const)). */
288 elt
= XVECEXP (op
, 0, 0);
290 if (GET_CODE (elt
) != SET
)
293 dest
= SET_DEST (elt
);
295 if (!REG_P (SET_SRC (elt
)) || !MEM_P (dest
))
298 dest_addr
= XEXP (dest
, 0);
300 /* Check a possible post-inc indicator. */
301 if (GET_CODE (SET_SRC (XVECEXP (op
, 0, 1))) == PLUS
)
303 rtx reg
= XEXP (SET_SRC (XVECEXP (op
, 0, 1)), 0);
304 rtx inc
= XEXP (SET_SRC (XVECEXP (op
, 0, 1)), 1);
310 || !REG_P (SET_DEST (XVECEXP (op
, 0, 1)))
311 || REGNO (reg
) != REGNO (SET_DEST (XVECEXP (op
, 0, 1)))
312 || !CONST_INT_P (inc
)
313 /* Support increment by number of registers, and by the offset
314 of the destination, if it has the form (MEM (PLUS reg
316 || !((REG_P (dest_addr
)
317 && REGNO (dest_addr
) == REGNO (reg
)
318 && INTVAL (inc
) == (HOST_WIDE_INT
) reg_count
* 4)
319 || (GET_CODE (dest_addr
) == PLUS
320 && REG_P (XEXP (dest_addr
, 0))
321 && REGNO (XEXP (dest_addr
, 0)) == REGNO (reg
)
322 && CONST_INT_P (XEXP (dest_addr
, 1))
323 && INTVAL (XEXP (dest_addr
, 1)) == INTVAL (inc
))))
334 regno
= reg_count
- 1;
337 if (GET_CODE (elt
) != SET
338 || !REG_P (SET_SRC (elt
))
339 || GET_MODE (SET_SRC (elt
)) != SImode
340 || REGNO (SET_SRC (elt
)) != (unsigned int) regno
341 || !MEM_P (SET_DEST (elt
))
342 || GET_MODE (SET_DEST (elt
)) != SImode
)
345 if (REG_P (dest_addr
))
347 dest_base
= dest_addr
;
350 else if (GET_CODE (dest_addr
) == PLUS
351 && REG_P (XEXP (dest_addr
, 0))
352 && CONST_INT_P (XEXP (dest_addr
, 1)))
354 dest_base
= XEXP (dest_addr
, 0);
355 offset
= INTVAL (XEXP (dest_addr
, 1));
360 for (setno
= 1; i
< XVECLEN (op
, 0); setno
++, i
++)
362 rtx elt
= XVECEXP (op
, 0, i
);
365 if (GET_CODE (elt
) != SET
366 || !REG_P (SET_SRC (elt
))
367 || GET_MODE (SET_SRC (elt
)) != SImode
368 || REGNO (SET_SRC (elt
)) != (unsigned int) regno
369 || !MEM_P (SET_DEST (elt
))
370 || GET_MODE (SET_DEST (elt
)) != SImode
371 || GET_CODE (XEXP (SET_DEST (elt
), 0)) != PLUS
372 || ! rtx_equal_p (XEXP (XEXP (SET_DEST (elt
), 0), 0), dest_base
)
373 || !CONST_INT_P (XEXP (XEXP (SET_DEST (elt
), 0), 1))
374 || INTVAL (XEXP (XEXP (SET_DEST (elt
), 0), 1)) != setno
* 4 + offset
)
381 /* The CONDITIONAL_REGISTER_USAGE worker. */
384 cris_conditional_register_usage (void)
386 /* FIXME: This isn't nice. We should be able to use that register for
387 something else if the PIC table isn't needed. */
389 fixed_regs
[PIC_OFFSET_TABLE_REGNUM
]
390 = call_used_regs
[PIC_OFFSET_TABLE_REGNUM
] = 1;
392 /* Allow use of ACR (PC in pre-V32) and tweak order. */
395 static const int reg_alloc_order_v32
[] = REG_ALLOC_ORDER_V32
;
398 fixed_regs
[CRIS_ACR_REGNUM
] = 0;
401 i
< sizeof (reg_alloc_order_v32
)/sizeof (reg_alloc_order_v32
[0]);
403 reg_alloc_order
[i
] = reg_alloc_order_v32
[i
];
406 if (TARGET_HAS_MUL_INSNS
)
407 fixed_regs
[CRIS_MOF_REGNUM
] = 0;
409 /* On early versions, we must use the 16-bit condition-code register,
410 which has another name. */
411 if (cris_cpu_version
< 8)
412 reg_names
[CRIS_CC0_REGNUM
] = "ccr";
415 /* Return crtl->uses_pic_offset_table. For use in cris.md,
416 since some generated files do not include function.h. */
419 cris_cfun_uses_pic_table (void)
421 return crtl
->uses_pic_offset_table
;
424 /* Given an rtx, return the text string corresponding to the CODE of X.
425 Intended for use in the assembly language output section of a
431 cris_output_insn_is_bound
= 0;
432 switch (GET_CODE (x
))
443 /* This function is for retrieving a part of an instruction name for
444 an operator, for immediate output. If that ever happens for
445 MULT, we need to apply TARGET_MUL_BUG in the caller. Make sure
447 internal_error ("MULT case in cris_op_str");
483 /* Used to control the sign/zero-extend character for the 'E' modifier.
485 cris_output_insn_is_bound
= 1;
490 return "Unknown operator";
495 /* Emit an error message when we're in an asm, and a fatal error for
496 "normal" insns. Formatted output isn't easily implemented, since we
497 use output_operand_lossage to output the actual message and handle the
498 categorization of the error. */
501 cris_operand_lossage (const char *msgid
, rtx op
)
504 output_operand_lossage ("%s", msgid
);
507 /* Print an index part of an address to file. */
510 cris_print_index (rtx index
, FILE *file
)
512 /* Make the index "additive" unless we'll output a negative number, in
513 which case the sign character is free (as in free beer). */
514 if (!CONST_INT_P (index
) || INTVAL (index
) >= 0)
518 fprintf (file
, "$%s.b", reg_names
[REGNO (index
)]);
519 else if (CONSTANT_P (index
))
520 cris_output_addr_const (file
, index
);
521 else if (GET_CODE (index
) == MULT
)
523 fprintf (file
, "$%s.",
524 reg_names
[REGNO (XEXP (index
, 0))]);
526 putc (INTVAL (XEXP (index
, 1)) == 2 ? 'w' : 'd', file
);
528 else if (GET_CODE (index
) == SIGN_EXTEND
&& MEM_P (XEXP (index
, 0)))
530 rtx inner
= XEXP (index
, 0);
531 rtx inner_inner
= XEXP (inner
, 0);
533 if (GET_CODE (inner_inner
) == POST_INC
)
535 fprintf (file
, "[$%s+].",
536 reg_names
[REGNO (XEXP (inner_inner
, 0))]);
537 putc (GET_MODE (inner
) == HImode
? 'w' : 'b', file
);
541 fprintf (file
, "[$%s].", reg_names
[REGNO (inner_inner
)]);
543 putc (GET_MODE (inner
) == HImode
? 'w' : 'b', file
);
546 else if (MEM_P (index
))
548 rtx inner
= XEXP (index
, 0);
549 if (GET_CODE (inner
) == POST_INC
)
550 fprintf (file
, "[$%s+].d", reg_names
[REGNO (XEXP (inner
, 0))]);
552 fprintf (file
, "[$%s].d", reg_names
[REGNO (inner
)]);
555 cris_operand_lossage ("unexpected index-type in cris_print_index",
559 /* Print a base rtx of an address to file. */
562 cris_print_base (rtx base
, FILE *file
)
565 fprintf (file
, "$%s", reg_names
[REGNO (base
)]);
566 else if (GET_CODE (base
) == POST_INC
)
568 gcc_assert (REGNO (XEXP (base
, 0)) != CRIS_ACR_REGNUM
);
569 fprintf (file
, "$%s+", reg_names
[REGNO (XEXP (base
, 0))]);
572 cris_operand_lossage ("unexpected base-type in cris_print_base",
576 /* Usable as a guard in expressions. */
579 cris_fatal (char *arg
)
581 internal_error (arg
);
583 /* We'll never get here; this is just to appease compilers. */
587 /* Return nonzero if REGNO is an ordinary register that *needs* to be
588 saved together with other registers, possibly by a MOVEM instruction,
589 or is saved for target-independent reasons. There may be
590 target-dependent reasons to save the register anyway; this is just a
591 wrapper for a complicated conditional. */
594 cris_reg_saved_in_regsave_area (unsigned int regno
, bool got_really_used
)
597 (((df_regs_ever_live_p (regno
)
598 && !call_used_regs
[regno
])
599 || (regno
== PIC_OFFSET_TABLE_REGNUM
601 /* It is saved anyway, if there would be a gap. */
603 && df_regs_ever_live_p (regno
+ 1)
604 && !call_used_regs
[regno
+ 1]))))
605 && (regno
!= FRAME_POINTER_REGNUM
|| !frame_pointer_needed
)
606 && regno
!= CRIS_SRP_REGNUM
)
607 || (crtl
->calls_eh_return
608 && (regno
== EH_RETURN_DATA_REGNO (0)
609 || regno
== EH_RETURN_DATA_REGNO (1)
610 || regno
== EH_RETURN_DATA_REGNO (2)
611 || regno
== EH_RETURN_DATA_REGNO (3)));
614 /* Return nonzero if there are regs mentioned in the insn that are not all
615 in the call_used regs. This is part of the decision whether an insn
616 can be put in the epilogue. */
619 saved_regs_mentioned (rtx x
)
625 /* Mainly stolen from refers_to_regno_p in rtlanal.c. */
633 return !call_used_regs
[i
];
636 /* If this is a SUBREG of a hard reg, we can see exactly which
637 registers are being modified. Otherwise, handle normally. */
638 i
= REGNO (SUBREG_REG (x
));
639 return !call_used_regs
[i
];
645 fmt
= GET_RTX_FORMAT (code
);
646 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
650 if (saved_regs_mentioned (XEXP (x
, i
)))
653 else if (fmt
[i
] == 'E')
656 for (j
= XVECLEN (x
, i
) - 1; j
>=0; j
--)
657 if (saved_regs_mentioned (XEXP (x
, i
)))
665 /* The PRINT_OPERAND worker. */
668 cris_print_operand (FILE *file
, rtx x
, int code
)
672 /* Size-strings corresponding to MULT expressions. */
673 static const char *const mults
[] = { "BAD:0", ".b", ".w", "BAD:3", ".d" };
675 /* New code entries should just be added to the switch below. If
676 handling is finished, just return. If handling was just a
677 modification of the operand, the modified operand should be put in
678 "operand", and then do a break to let default handling
679 (zero-modifier) output the operand. */
684 /* Print the unsigned supplied integer as if it were signed
685 and < 0, i.e print 255 or 65535 as -1, 254, 65534 as -2, etc. */
687 || ! CONST_OK_FOR_LETTER_P (INTVAL (x
), 'O'))
688 LOSE_AND_RETURN ("invalid operand for 'b' modifier", x
);
689 fprintf (file
, HOST_WIDE_INT_PRINT_DEC
,
690 INTVAL (x
)| (INTVAL (x
) <= 255 ? ~255 : ~65535));
694 /* Print assembler code for operator. */
695 fprintf (file
, "%s", cris_op_str (operand
));
700 /* A movem modifier working on a parallel; output the register
704 if (GET_CODE (x
) != PARALLEL
)
705 LOSE_AND_RETURN ("invalid operand for 'o' modifier", x
);
707 /* The second item can be (set reg (plus reg const)) to denote a
710 = (GET_CODE (SET_SRC (XVECEXP (x
, 0, 1))) == PLUS
712 : XVECLEN (x
, 0) - 1);
714 fprintf (file
, "$%s", reg_names
[regno
]);
720 /* A similar movem modifier; output the memory operand. */
723 if (GET_CODE (x
) != PARALLEL
)
724 LOSE_AND_RETURN ("invalid operand for 'O' modifier", x
);
726 /* The lowest mem operand is in the first item, but perhaps it
727 needs to be output as postincremented. */
728 addr
= MEM_P (SET_SRC (XVECEXP (x
, 0, 0)))
729 ? XEXP (SET_SRC (XVECEXP (x
, 0, 0)), 0)
730 : XEXP (SET_DEST (XVECEXP (x
, 0, 0)), 0);
732 /* The second item can be a (set reg (plus reg const)) to denote
734 if (GET_CODE (SET_SRC (XVECEXP (x
, 0, 1))) == PLUS
)
736 /* It's a post-increment, if the address is a naked (reg). */
738 addr
= gen_rtx_POST_INC (SImode
, addr
);
741 /* Otherwise, it's a side-effect; RN=RN+M. */
742 fprintf (file
, "[$%s=$%s%s%d]",
743 reg_names
[REGNO (SET_DEST (XVECEXP (x
, 0, 1)))],
744 reg_names
[REGNO (XEXP (addr
, 0))],
745 INTVAL (XEXP (addr
, 1)) < 0 ? "" : "+",
746 (int) INTVAL (XEXP (addr
, 1)));
750 output_address (addr
);
755 /* Adjust a power of two to its log2. */
756 if (!CONST_INT_P (x
) || exact_log2 (INTVAL (x
)) < 0 )
757 LOSE_AND_RETURN ("invalid operand for 'p' modifier", x
);
758 fprintf (file
, "%d", exact_log2 (INTVAL (x
)));
762 /* For an integer, print 'b' or 'w' if <= 255 or <= 65535
763 respectively. This modifier also terminates the inhibiting
764 effects of the 'x' modifier. */
765 cris_output_insn_is_bound
= 0;
766 if (GET_MODE (x
) == VOIDmode
&& CONST_INT_P (x
))
770 if (INTVAL (x
) <= 255)
772 else if (INTVAL (x
) <= 65535)
782 /* For a non-integer, print the size of the operand. */
783 putc ((GET_MODE (x
) == SImode
|| GET_MODE (x
) == SFmode
)
784 ? 'd' : GET_MODE (x
) == HImode
? 'w'
785 : GET_MODE (x
) == QImode
? 'b'
786 /* If none of the above, emit an erroneous size letter. */
792 /* Const_int: print b for -127 <= x <= 255,
793 w for -32768 <= x <= 65535, else die. */
795 || INTVAL (x
) < -32768 || INTVAL (x
) > 65535)
796 LOSE_AND_RETURN ("invalid operand for 'z' modifier", x
);
797 putc (INTVAL (x
) >= -128 && INTVAL (x
) <= 255 ? 'b' : 'w', file
);
801 /* If this is a GOT-symbol, print the size-letter corresponding to
802 -fpic/-fPIC. For everything else, print "d". */
804 && GET_CODE (x
) == CONST
805 && GET_CODE (XEXP (x
, 0)) == UNSPEC
806 && XINT (XEXP (x
, 0), 1) == CRIS_UNSPEC_GOTREAD
)
811 /* Output a 'nop' if there's nothing for the delay slot.
812 This method stolen from the sparc files. */
813 if (dbr_sequence_length () == 0)
814 fputs ("\n\tnop", file
);
818 /* Output directive for alignment padded with "nop" insns.
819 Optimizing for size, it's plain 4-byte alignment, otherwise we
820 align the section to a cache-line (32 bytes) and skip at max 2
821 bytes, i.e. we skip if it's the last insn on a cache-line. The
822 latter is faster by a small amount (for two test-programs 99.6%
823 and 99.9%) and larger by a small amount (ditto 100.1% and
824 100.2%). This is supposed to be the simplest yet performance-
825 wise least intrusive way to make sure the immediately following
826 (supposed) muls/mulu insn isn't located at the end of a
830 ? ".p2alignw 2,0x050f\n\t"
831 : ".p2alignw 5,0x050f,2\n\t", file
);
835 /* The PIC register. */
837 internal_error ("invalid use of ':' modifier");
838 fprintf (file
, "$%s", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
842 /* Print high (most significant) part of something. */
843 switch (GET_CODE (operand
))
846 /* If we're having 64-bit HOST_WIDE_INTs, the whole (DImode)
847 value is kept here, and so may be other than 0 or -1. */
848 fprintf (file
, HOST_WIDE_INT_PRINT_DEC
,
849 INTVAL (operand_subword (operand
, 1, 0, DImode
)));
853 /* High part of a long long constant. */
854 if (GET_MODE (operand
) == VOIDmode
)
856 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
, CONST_DOUBLE_HIGH (x
));
860 LOSE_AND_RETURN ("invalid operand for 'H' modifier", x
);
863 /* Print reg + 1. Check that there's not an attempt to print
864 high-parts of registers like stack-pointer or higher, except
865 for SRP (where the "high part" is MOF). */
866 if (REGNO (operand
) > STACK_POINTER_REGNUM
- 2
867 && (REGNO (operand
) != CRIS_SRP_REGNUM
868 || CRIS_SRP_REGNUM
+ 1 != CRIS_MOF_REGNUM
869 || fixed_regs
[CRIS_MOF_REGNUM
] != 0))
870 LOSE_AND_RETURN ("bad register", operand
);
871 fprintf (file
, "$%s", reg_names
[REGNO (operand
) + 1]);
875 /* Adjust memory address to high part. */
877 rtx adj_mem
= operand
;
879 = GET_MODE_BITSIZE (GET_MODE (operand
)) / BITS_PER_UNIT
;
881 /* Adjust so we can use two SImode in DImode.
882 Calling adj_offsettable_operand will make sure it is an
883 offsettable address. Don't do this for a postincrement
884 though; it should remain as it was. */
885 if (GET_CODE (XEXP (adj_mem
, 0)) != POST_INC
)
887 = adjust_address (adj_mem
, GET_MODE (adj_mem
), size
/ 2);
889 output_address (XEXP (adj_mem
, 0));
894 LOSE_AND_RETURN ("invalid operand for 'H' modifier", x
);
898 /* Strip the MEM expression. */
899 operand
= XEXP (operand
, 0);
903 /* Like 'E', but ignore state set by 'x'. FIXME: Use code
904 iterators and attributes in cris.md to avoid the need for %x
905 and %E (and %e) and state passed between those modifiers. */
906 cris_output_insn_is_bound
= 0;
909 /* Print 's' if operand is SIGN_EXTEND or 'u' if ZERO_EXTEND unless
910 cris_output_insn_is_bound is nonzero. */
911 if (GET_CODE (operand
) != SIGN_EXTEND
912 && GET_CODE (operand
) != ZERO_EXTEND
913 && !CONST_INT_P (operand
))
914 LOSE_AND_RETURN ("invalid operand for 'e' modifier", x
);
916 if (cris_output_insn_is_bound
)
918 cris_output_insn_is_bound
= 0;
922 putc (GET_CODE (operand
) == SIGN_EXTEND
923 || (CONST_INT_P (operand
) && INTVAL (operand
) < 0)
928 /* Print the size letter of the inner element. We can do it by
929 calling ourselves with the 's' modifier. */
930 if (GET_CODE (operand
) != SIGN_EXTEND
&& GET_CODE (operand
) != ZERO_EXTEND
)
931 LOSE_AND_RETURN ("invalid operand for 'm' modifier", x
);
932 cris_print_operand (file
, XEXP (operand
, 0), 's');
936 /* Print the least significant part of operand. */
937 if (GET_CODE (operand
) == CONST_DOUBLE
)
939 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
, CONST_DOUBLE_LOW (x
));
942 else if (HOST_BITS_PER_WIDE_INT
> 32 && CONST_INT_P (operand
))
944 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
,
945 INTVAL (x
) & ((unsigned int) 0x7fffffff * 2 + 1));
948 /* Otherwise the least significant part equals the normal part,
949 so handle it normally. */
953 /* When emitting an add for the high part of a DImode constant, we
954 want to use addq for 0 and adds.w for -1. */
955 if (!CONST_INT_P (operand
))
956 LOSE_AND_RETURN ("invalid operand for 'A' modifier", x
);
957 fprintf (file
, INTVAL (operand
) < 0 ? "adds.w" : "addq");
961 /* If this is a GOT symbol, force it to be emitted as :GOT and
962 :GOTPLT regardless of -fpic (i.e. not as :GOT16, :GOTPLT16).
963 Avoid making this too much of a special case. */
964 if (flag_pic
== 1 && CONSTANT_P (operand
))
966 int flag_pic_save
= flag_pic
;
969 cris_output_addr_const (file
, operand
);
970 flag_pic
= flag_pic_save
;
976 /* When emitting an sub for the high part of a DImode constant, we
977 want to use subq for 0 and subs.w for -1. */
978 if (!CONST_INT_P (operand
))
979 LOSE_AND_RETURN ("invalid operand for 'D' modifier", x
);
980 fprintf (file
, INTVAL (operand
) < 0 ? "subs.w" : "subq");
984 /* Print the operand as the index-part of an address.
985 Easiest way out is to use cris_print_index. */
986 cris_print_index (operand
, file
);
990 /* Print the size letter for an operand to a MULT, which must be a
991 const_int with a suitable value. */
992 if (!CONST_INT_P (operand
) || INTVAL (operand
) > 4)
993 LOSE_AND_RETURN ("invalid operand for 'T' modifier", x
);
994 fprintf (file
, "%s", mults
[INTVAL (operand
)]);
998 /* Print "u.w" if a GOT symbol and flag_pic == 1, else ".d". */
1000 && GET_CODE (operand
) == CONST
1001 && GET_CODE (XEXP (operand
, 0)) == UNSPEC
1002 && XINT (XEXP (operand
, 0), 1) == CRIS_UNSPEC_GOTREAD
)
1003 fprintf (file
, "u.w");
1005 fprintf (file
, ".d");
1009 /* No code, print as usual. */
1013 LOSE_AND_RETURN ("invalid operand modifier letter", x
);
1016 /* Print an operand as without a modifier letter. */
1017 switch (GET_CODE (operand
))
1020 if (REGNO (operand
) > 15
1021 && REGNO (operand
) != CRIS_MOF_REGNUM
1022 && REGNO (operand
) != CRIS_SRP_REGNUM
1023 && REGNO (operand
) != CRIS_CC0_REGNUM
)
1024 internal_error ("internal error: bad register: %d", REGNO (operand
));
1025 fprintf (file
, "$%s", reg_names
[REGNO (operand
)]);
1029 output_address (XEXP (operand
, 0));
1033 if (GET_MODE (operand
) == VOIDmode
)
1034 /* A long long constant. */
1035 output_addr_const (file
, operand
);
1038 /* Only single precision is allowed as plain operands the
1039 moment. FIXME: REAL_VALUE_FROM_CONST_DOUBLE isn't
1044 /* FIXME: Perhaps check overflow of the "single". */
1045 REAL_VALUE_FROM_CONST_DOUBLE (r
, operand
);
1046 REAL_VALUE_TO_TARGET_SINGLE (r
, l
);
1048 fprintf (file
, "0x%lx", l
);
1055 cris_output_addr_const (file
, operand
);
1061 /* For a (MULT (reg X) const_int) we output "rX.S". */
1062 int i
= CONST_INT_P (XEXP (operand
, 1))
1063 ? INTVAL (XEXP (operand
, 1)) : INTVAL (XEXP (operand
, 0));
1064 rtx reg
= CONST_INT_P (XEXP (operand
, 1))
1065 ? XEXP (operand
, 0) : XEXP (operand
, 1);
1068 || (!CONST_INT_P (XEXP (operand
, 0))
1069 && !CONST_INT_P (XEXP (operand
, 1))))
1070 LOSE_AND_RETURN ("unexpected multiplicative operand", x
);
1072 cris_print_base (reg
, file
);
1073 fprintf (file
, ".%c",
1074 i
== 0 || (i
== 1 && GET_CODE (operand
) == MULT
) ? 'b'
1076 : (i
== 2 && GET_CODE (operand
) == MULT
) || i
== 1 ? 'w'
1082 /* No need to handle all strange variants, let output_addr_const
1084 if (CONSTANT_P (operand
))
1086 cris_output_addr_const (file
, operand
);
1090 LOSE_AND_RETURN ("unexpected operand", x
);
1094 /* The PRINT_OPERAND_ADDRESS worker. */
1097 cris_print_operand_address (FILE *file
, rtx x
)
1099 /* All these were inside MEM:s so output indirection characters. */
1102 if (CONSTANT_ADDRESS_P (x
))
1103 cris_output_addr_const (file
, x
);
1104 else if (BASE_OR_AUTOINCR_P (x
))
1105 cris_print_base (x
, file
);
1106 else if (GET_CODE (x
) == PLUS
)
1114 cris_print_base (x1
, file
);
1115 cris_print_index (x2
, file
);
1117 else if (BASE_P (x2
))
1119 cris_print_base (x2
, file
);
1120 cris_print_index (x1
, file
);
1123 LOSE_AND_RETURN ("unrecognized address", x
);
1127 /* A DIP. Output more indirection characters. */
1129 cris_print_base (XEXP (x
, 0), file
);
1133 LOSE_AND_RETURN ("unrecognized address", x
);
1138 /* The RETURN_ADDR_RTX worker.
1139 We mark that the return address is used, either by EH or
1140 __builtin_return_address, for use by the function prologue and
1141 epilogue. FIXME: This isn't optimal; we just use the mark in the
1142 prologue and epilogue to say that the return address is to be stored
1143 in the stack frame. We could return SRP for leaf-functions and use the
1144 initial-value machinery. */
1147 cris_return_addr_rtx (int count
, rtx frameaddr ATTRIBUTE_UNUSED
)
1149 cfun
->machine
->needs_return_address_on_stack
= 1;
1151 /* The return-address is stored just above the saved frame-pointer (if
1152 present). Apparently we can't eliminate from the frame-pointer in
1153 that direction, so use the incoming args (maybe pretended) pointer. */
1155 ? gen_rtx_MEM (Pmode
, plus_constant (virtual_incoming_args_rtx
, -4))
1159 /* Accessor used in cris.md:return because cfun->machine isn't available
1163 cris_return_address_on_stack (void)
1165 return df_regs_ever_live_p (CRIS_SRP_REGNUM
)
1166 || cfun
->machine
->needs_return_address_on_stack
;
1169 /* Accessor used in cris.md:return because cfun->machine isn't available
1173 cris_return_address_on_stack_for_return (void)
1175 return cfun
->machine
->return_type
== CRIS_RETINSN_RET
? false
1176 : cris_return_address_on_stack ();
1179 /* This used to be the INITIAL_FRAME_POINTER_OFFSET worker; now only
1180 handles FP -> SP elimination offset. */
1183 cris_initial_frame_pointer_offset (void)
1187 /* Initial offset is 0 if we don't have a frame pointer. */
1189 bool got_really_used
= false;
1191 if (crtl
->uses_pic_offset_table
)
1193 push_topmost_sequence ();
1195 = reg_used_between_p (pic_offset_table_rtx
, get_insns (),
1197 pop_topmost_sequence ();
1200 /* And 4 for each register pushed. */
1201 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
1202 if (cris_reg_saved_in_regsave_area (regno
, got_really_used
))
1205 /* And then, last, we add the locals allocated. */
1206 offs
+= get_frame_size ();
1208 /* And more; the accumulated args size. */
1209 offs
+= crtl
->outgoing_args_size
;
1211 /* Then round it off, in case we use aligned stack. */
1212 if (TARGET_STACK_ALIGN
)
1213 offs
= TARGET_ALIGN_BY_32
? (offs
+ 3) & ~3 : (offs
+ 1) & ~1;
1218 /* The INITIAL_ELIMINATION_OFFSET worker.
1219 Calculate the difference between imaginary registers such as frame
1220 pointer and the stack pointer. Used to eliminate the frame pointer
1221 and imaginary arg pointer. */
1224 cris_initial_elimination_offset (int fromreg
, int toreg
)
1227 = cris_initial_frame_pointer_offset ();
1229 /* We should be able to use regs_ever_live and related prologue
1230 information here, or alpha should not as well. */
1231 bool return_address_on_stack
= cris_return_address_on_stack ();
1233 /* Here we act as if the frame-pointer were needed. */
1234 int ap_fp_offset
= 4 + (return_address_on_stack
? 4 : 0);
1236 if (fromreg
== ARG_POINTER_REGNUM
1237 && toreg
== FRAME_POINTER_REGNUM
)
1238 return ap_fp_offset
;
1240 /* Between the frame pointer and the stack are only "normal" stack
1241 variables and saved registers. */
1242 if (fromreg
== FRAME_POINTER_REGNUM
1243 && toreg
== STACK_POINTER_REGNUM
)
1244 return fp_sp_offset
;
1246 /* We need to balance out the frame pointer here. */
1247 if (fromreg
== ARG_POINTER_REGNUM
1248 && toreg
== STACK_POINTER_REGNUM
)
1249 return ap_fp_offset
+ fp_sp_offset
- 4;
1254 /* Worker function for LEGITIMIZE_RELOAD_ADDRESS. */
1257 cris_reload_address_legitimized (rtx x
,
1258 enum machine_mode mode ATTRIBUTE_UNUSED
,
1259 int opnum ATTRIBUTE_UNUSED
,
1261 int ind_levels ATTRIBUTE_UNUSED
)
1263 enum reload_type type
= itype
;
1268 if (GET_CODE (x
) != PLUS
)
1275 op0p
= &XEXP (x
, 0);
1277 op1p
= &XEXP (x
, 1);
1282 if (GET_CODE (op0
) == SIGN_EXTEND
&& MEM_P (XEXP (op0
, 0)))
1284 rtx op00
= XEXP (op0
, 0);
1285 rtx op000
= XEXP (op00
, 0);
1286 rtx
*op000p
= &XEXP (op00
, 0);
1288 if ((GET_MODE (op00
) == HImode
|| GET_MODE (op00
) == QImode
)
1290 || (GET_CODE (op000
) == POST_INC
&& REG_P (XEXP (op000
, 0)))))
1292 bool something_reloaded
= false;
1294 if (GET_CODE (op000
) == POST_INC
1295 && REG_P (XEXP (op000
, 0))
1296 && REGNO (XEXP (op000
, 0)) > CRIS_LAST_GENERAL_REGISTER
)
1297 /* No, this gets too complicated and is too rare to care
1298 about trying to improve on the general code Here.
1299 As the return-value is an all-or-nothing indicator, we
1300 punt on the other register too. */
1304 && REGNO (op000
) > CRIS_LAST_GENERAL_REGISTER
))
1306 /* The address of the inner mem is a pseudo or wrong
1307 reg: reload that. */
1308 push_reload (op000
, NULL_RTX
, op000p
, NULL
, GENERAL_REGS
,
1309 GET_MODE (x
), VOIDmode
, 0, 0, opnum
, type
);
1310 something_reloaded
= true;
1313 if (REGNO (op1
) > CRIS_LAST_GENERAL_REGISTER
)
1315 /* Base register is a pseudo or wrong reg: reload it. */
1316 push_reload (op1
, NULL_RTX
, op1p
, NULL
, GENERAL_REGS
,
1317 GET_MODE (x
), VOIDmode
, 0, 0,
1319 something_reloaded
= true;
1322 gcc_assert (something_reloaded
);
1331 /* Worker function for REGISTER_MOVE_COST. */
1334 cris_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED
,
1335 enum reg_class from
, enum reg_class to
)
1339 /* Pretend that classes that we don't support are ALL_REGS, so
1340 we give them the highest cost. */
1341 if (from
!= SPECIAL_REGS
&& from
!= MOF_REGS
1342 && from
!= GENERAL_REGS
&& from
!= GENNONACR_REGS
)
1345 if (to
!= SPECIAL_REGS
&& to
!= MOF_REGS
1346 && to
!= GENERAL_REGS
&& to
!= GENNONACR_REGS
)
1350 /* Can't move to and from a SPECIAL_REGS register, so we have to say
1351 their move cost within that class is higher. How about 7? That's 3
1352 for a move to a GENERAL_REGS register, 3 for the move from the
1353 GENERAL_REGS register, and 1 for the increased register pressure.
1354 Also, it's higher than the memory move cost, which is in order.
1355 We also do this for ALL_REGS, since we don't want that class to be
1356 preferred (even to memory) at all where GENERAL_REGS doesn't fit.
1357 Whenever it's about to be used, it's for SPECIAL_REGS. If we don't
1358 present a higher cost for ALL_REGS than memory, a SPECIAL_REGS may be
1359 used when a GENERAL_REGS should be used, even if there are call-saved
1360 GENERAL_REGS left to allocate. This is because the fall-back when
1361 the most preferred register class isn't available, isn't the next
1362 (or next good) wider register class, but the *most widest* register
1365 if ((reg_classes_intersect_p (from
, SPECIAL_REGS
)
1366 && reg_classes_intersect_p (to
, SPECIAL_REGS
))
1367 || from
== ALL_REGS
|| to
== ALL_REGS
)
1370 if (reg_classes_intersect_p (from
, SPECIAL_REGS
)
1371 || reg_classes_intersect_p (to
, SPECIAL_REGS
))
1377 /* Worker for cris_notice_update_cc; handles the "normal" cases.
1378 FIXME: this code is historical; its functionality should be
1379 refactored to look at insn attributes and moved to
1380 cris_notice_update_cc. Except, we better lose cc0 entirely. */
1383 cris_normal_notice_update_cc (rtx exp
, rtx insn
)
1385 /* "Normal" means, for:
1390 CC is (reg) and (...) - unless (...) is 0 or reg is a special
1391 register or (v32 and (...) is -32..-1), then CC does not change.
1392 CC_NO_OVERFLOW unless (...) is reg or mem.
1401 (set (reg1) (mem (bdap/biap)))
1402 (set (reg2) (bdap/biap))):
1403 CC is (reg1) and (mem (reg2))
1406 (set (mem (bdap/biap)) (reg1)) [or 0]
1407 (set (reg2) (bdap/biap))):
1410 (where reg and mem includes strict_low_parts variants thereof)
1412 For all others, assume CC is clobbered.
1413 Note that we do not have to care about setting CC_NO_OVERFLOW,
1414 since the overflow flag is set to 0 (i.e. right) for
1415 instructions where it does not have any sane sense, but where
1416 other flags have meanings. (This includes shifts; the carry is
1419 Note that there are other parallel constructs we could match,
1420 but we don't do that yet. */
1422 if (GET_CODE (exp
) == SET
)
1424 /* FIXME: Check when this happens. It looks like we should
1425 actually do a CC_STATUS_INIT here to be safe. */
1426 if (SET_DEST (exp
) == pc_rtx
)
1429 /* Record CC0 changes, so we do not have to output multiple
1431 if (SET_DEST (exp
) == cc0_rtx
)
1434 cc_status
.value1
= SET_SRC (exp
);
1436 /* Handle flags for the special btstq on one bit. */
1437 if (GET_CODE (SET_SRC (exp
)) == ZERO_EXTRACT
1438 && XEXP (SET_SRC (exp
), 1) == const1_rtx
)
1440 if (CONST_INT_P (XEXP (SET_SRC (exp
), 0)))
1442 cc_status
.flags
= CC_INVERTED
;
1444 /* A one-bit btstq. */
1445 cc_status
.flags
= CC_Z_IN_NOT_N
;
1448 if (GET_CODE (SET_SRC (exp
)) == COMPARE
)
1450 if (!REG_P (XEXP (SET_SRC (exp
), 0))
1451 && XEXP (SET_SRC (exp
), 1) != const0_rtx
)
1452 /* For some reason gcc will not canonicalize compare
1453 operations, reversing the sign by itself if
1454 operands are in wrong order. */
1455 /* (But NOT inverted; eq is still eq.) */
1456 cc_status
.flags
= CC_REVERSED
;
1458 /* This seems to be overlooked by gcc. FIXME: Check again.
1459 FIXME: Is it really safe? */
1461 = gen_rtx_MINUS (GET_MODE (SET_SRC (exp
)),
1462 XEXP (SET_SRC (exp
), 0),
1463 XEXP (SET_SRC (exp
), 1));
1467 else if (REG_P (SET_DEST (exp
))
1468 || (GET_CODE (SET_DEST (exp
)) == STRICT_LOW_PART
1469 && REG_P (XEXP (SET_DEST (exp
), 0))))
1471 /* A register is set; normally CC is set to show that no
1472 test insn is needed. Catch the exceptions. */
1474 /* If not to cc0, then no "set"s in non-natural mode give
1476 if (GET_MODE_SIZE (GET_MODE (SET_DEST (exp
))) > UNITS_PER_WORD
1477 || GET_MODE_CLASS (GET_MODE (SET_DEST (exp
))) == MODE_FLOAT
)
1479 /* ... except add:s and sub:s in DImode. */
1480 if (GET_MODE (SET_DEST (exp
)) == DImode
1481 && (GET_CODE (SET_SRC (exp
)) == PLUS
1482 || GET_CODE (SET_SRC (exp
)) == MINUS
))
1485 cc_status
.value1
= SET_DEST (exp
);
1486 cc_status
.value2
= SET_SRC (exp
);
1488 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
1490 cc_status
.value2
= 0;
1492 /* Add and sub may set V, which gets us
1493 unoptimizable results in "gt" and "le" condition
1495 cc_status
.flags
|= CC_NO_OVERFLOW
;
1500 else if (SET_SRC (exp
) == const0_rtx
1501 || (REG_P (SET_SRC (exp
))
1502 && (REGNO (SET_SRC (exp
))
1503 > CRIS_LAST_GENERAL_REGISTER
))
1505 && GET_CODE (SET_SRC (exp
)) == CONST_INT
1506 && CONST_OK_FOR_LETTER_P (INTVAL (SET_SRC (exp
)),
1509 /* There's no CC0 change for this case. Just check
1511 if (cc_status
.value1
1512 && modified_in_p (cc_status
.value1
, insn
))
1513 cc_status
.value1
= 0;
1515 if (cc_status
.value2
1516 && modified_in_p (cc_status
.value2
, insn
))
1517 cc_status
.value2
= 0;
1524 cc_status
.value1
= SET_DEST (exp
);
1525 cc_status
.value2
= SET_SRC (exp
);
1527 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
1529 cc_status
.value2
= 0;
1531 /* Some operations may set V, which gets us
1532 unoptimizable results in "gt" and "le" condition
1534 if (GET_CODE (SET_SRC (exp
)) == PLUS
1535 || GET_CODE (SET_SRC (exp
)) == MINUS
1536 || GET_CODE (SET_SRC (exp
)) == NEG
)
1537 cc_status
.flags
|= CC_NO_OVERFLOW
;
1539 /* For V32, nothing with a register destination sets
1540 C and V usefully. */
1542 cc_status
.flags
|= CC_NO_OVERFLOW
;
1547 else if (MEM_P (SET_DEST (exp
))
1548 || (GET_CODE (SET_DEST (exp
)) == STRICT_LOW_PART
1549 && MEM_P (XEXP (SET_DEST (exp
), 0))))
1551 /* When SET to MEM, then CC is not changed (except for
1553 if (cc_status
.value1
1554 && modified_in_p (cc_status
.value1
, insn
))
1555 cc_status
.value1
= 0;
1557 if (cc_status
.value2
1558 && modified_in_p (cc_status
.value2
, insn
))
1559 cc_status
.value2
= 0;
1564 else if (GET_CODE (exp
) == PARALLEL
)
1566 if (GET_CODE (XVECEXP (exp
, 0, 0)) == SET
1567 && GET_CODE (XVECEXP (exp
, 0, 1)) == SET
1568 && REG_P (XEXP (XVECEXP (exp
, 0, 1), 0)))
1570 if (REG_P (XEXP (XVECEXP (exp
, 0, 0), 0))
1571 && MEM_P (XEXP (XVECEXP (exp
, 0, 0), 1)))
1575 /* For "move.S [rx=ry+o],rz", say CC reflects
1576 value1=rz and value2=[rx] */
1577 cc_status
.value1
= XEXP (XVECEXP (exp
, 0, 0), 0);
1579 = replace_equiv_address (XEXP (XVECEXP (exp
, 0, 0), 1),
1580 XEXP (XVECEXP (exp
, 0, 1), 0));
1582 /* Huh? A side-effect cannot change the destination
1584 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
1586 internal_error ("internal error: sideeffect-insn affecting main effect");
1588 /* For V32, moves to registers don't set C and V. */
1590 cc_status
.flags
|= CC_NO_OVERFLOW
;
1593 else if ((REG_P (XEXP (XVECEXP (exp
, 0, 0), 1))
1594 || XEXP (XVECEXP (exp
, 0, 0), 1) == const0_rtx
)
1595 && MEM_P (XEXP (XVECEXP (exp
, 0, 0), 0)))
1597 /* For "move.S rz,[rx=ry+o]" and "clear.S [rx=ry+o]",
1598 say flags are not changed, except for overlap. */
1599 if (cc_status
.value1
1600 && modified_in_p (cc_status
.value1
, insn
))
1601 cc_status
.value1
= 0;
1603 if (cc_status
.value2
1604 && modified_in_p (cc_status
.value2
, insn
))
1605 cc_status
.value2
= 0;
1612 /* If we got here, the case wasn't covered by the code above. */
1616 /* This function looks into the pattern to see how this insn affects
1619 Used when to eliminate test insns before a condition-code user,
1620 such as a "scc" insn or a conditional branch. This includes
1621 checking if the entities that cc was updated by, are changed by the
1624 Currently a jumble of the old peek-inside-the-insn and the newer
1625 check-cc-attribute methods. */
1628 cris_notice_update_cc (rtx exp
, rtx insn
)
1630 enum attr_cc attrval
= get_attr_cc (insn
);
1632 /* Check if user specified "-mcc-init" as a bug-workaround. Remember
1633 to still set CC_REVERSED as below, since that's required by some
1634 compare insn alternatives. (FIXME: GCC should do this virtual
1635 operand swap by itself.) A test-case that may otherwise fail is
1636 gcc.c-torture/execute/20000217-1.c -O0 and -O1. */
1641 if (attrval
== CC_REV
)
1642 cc_status
.flags
= CC_REVERSED
;
1646 /* Slowly, we're converting to using attributes to control the setting
1647 of condition-code status. */
1651 /* Even if it is "none", a setting may clobber a previous
1652 cc-value, so check. */
1653 if (GET_CODE (exp
) == SET
)
1655 if (cc_status
.value1
1656 && modified_in_p (cc_status
.value1
, insn
))
1657 cc_status
.value1
= 0;
1659 if (cc_status
.value2
1660 && modified_in_p (cc_status
.value2
, insn
))
1661 cc_status
.value2
= 0;
1672 cris_normal_notice_update_cc (exp
, insn
);
1674 /* The "test" insn doesn't clear (carry and) overflow on V32. We
1675 can change bge => bpl and blt => bmi by passing on to the cc0
1676 user that V should not be considered; bgt and ble are taken
1677 care of by other methods (see {tst,cmp}{si,hi,qi}). */
1678 if (attrval
== CC_NOOV32
&& TARGET_V32
)
1679 cc_status
.flags
|= CC_NO_OVERFLOW
;
1683 internal_error ("unknown cc_attr value");
1689 /* Return != 0 if the return sequence for the current function is short,
1690 like "ret" or "jump [sp+]". Prior to reloading, we can't tell if
1691 registers must be saved, so return 0 then. */
1694 cris_simple_epilogue (void)
1697 unsigned int reglimit
= STACK_POINTER_REGNUM
;
1698 bool got_really_used
= false;
1700 if (! reload_completed
1701 || frame_pointer_needed
1702 || get_frame_size () != 0
1703 || crtl
->args
.pretend_args_size
1705 || crtl
->outgoing_args_size
1706 || crtl
->calls_eh_return
1708 /* If we're not supposed to emit prologue and epilogue, we must
1709 not emit return-type instructions. */
1710 || !TARGET_PROLOGUE_EPILOGUE
)
1713 /* Can't return from stacked return address with v32. */
1714 if (TARGET_V32
&& cris_return_address_on_stack ())
1717 if (crtl
->uses_pic_offset_table
)
1719 push_topmost_sequence ();
1721 = reg_used_between_p (pic_offset_table_rtx
, get_insns (), NULL_RTX
);
1722 pop_topmost_sequence ();
1725 /* No simple epilogue if there are saved registers. */
1726 for (regno
= 0; regno
< reglimit
; regno
++)
1727 if (cris_reg_saved_in_regsave_area (regno
, got_really_used
))
1733 /* Expand a return insn (just one insn) marked as using SRP or stack
1734 slot depending on parameter ON_STACK. */
1737 cris_expand_return (bool on_stack
)
1739 /* FIXME: emit a parallel with a USE for SRP or the stack-slot, to
1740 tell "ret" from "jump [sp+]". Some, but not all, other parts of
1741 GCC expect just (return) to do the right thing when optimizing, so
1742 we do that until they're fixed. Currently, all return insns in a
1743 function must be the same (not really a limiting factor) so we need
1744 to check that it doesn't change half-way through. */
1745 emit_jump_insn (gen_rtx_RETURN (VOIDmode
));
1747 CRIS_ASSERT (cfun
->machine
->return_type
!= CRIS_RETINSN_RET
|| !on_stack
);
1748 CRIS_ASSERT (cfun
->machine
->return_type
!= CRIS_RETINSN_JUMP
|| on_stack
);
1750 cfun
->machine
->return_type
1751 = on_stack
? CRIS_RETINSN_JUMP
: CRIS_RETINSN_RET
;
1754 /* Compute a (partial) cost for rtx X. Return true if the complete
1755 cost has been computed, and false if subexpressions should be
1756 scanned. In either case, *TOTAL contains the cost result. */
1759 cris_rtx_costs (rtx x
, int code
, int outer_code
, int *total
)
1765 HOST_WIDE_INT val
= INTVAL (x
);
1768 else if (val
< 32 && val
>= -32)
1770 /* Eight or 16 bits are a word and cycle more expensive. */
1771 else if (val
<= 32767 && val
>= -32768)
1773 /* A 32-bit constant (or very seldom, unsigned 16 bits) costs
1774 another word. FIXME: This isn't linear to 16 bits. */
1790 if (x
!= CONST0_RTX (GET_MODE (x
) == VOIDmode
? DImode
: GET_MODE (x
)))
1793 /* Make 0.0 cheap, else test-insns will not be used. */
1798 /* Identify values that are no powers of two. Powers of 2 are
1799 taken care of already and those values should not be changed. */
1800 if (!CONST_INT_P (XEXP (x
, 1))
1801 || exact_log2 (INTVAL (XEXP (x
, 1)) < 0))
1803 /* If we have a multiply insn, then the cost is between
1804 1 and 2 "fast" instructions. */
1805 if (TARGET_HAS_MUL_INSNS
)
1807 *total
= COSTS_N_INSNS (1) + COSTS_N_INSNS (1) / 2;
1811 /* Estimate as 4 + 4 * #ofbits. */
1812 *total
= COSTS_N_INSNS (132);
1821 if (!CONST_INT_P (XEXP (x
, 1))
1822 || exact_log2 (INTVAL (XEXP (x
, 1)) < 0))
1824 /* Estimate this as 4 + 8 * #of bits. */
1825 *total
= COSTS_N_INSNS (260);
1831 if (CONST_INT_P (XEXP (x
, 1))
1832 /* Two constants may actually happen before optimization. */
1833 && !CONST_INT_P (XEXP (x
, 0))
1834 && !CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x
, 1)), 'I'))
1836 *total
= (rtx_cost (XEXP (x
, 0), outer_code
) + 2
1837 + 2 * GET_MODE_NUNITS (GET_MODE (XEXP (x
, 0))));
1842 case ZERO_EXTEND
: case SIGN_EXTEND
:
1843 *total
= rtx_cost (XEXP (x
, 0), outer_code
);
1851 /* The ADDRESS_COST worker. */
1854 cris_address_cost (rtx x
)
1856 /* The metric to use for the cost-macros is unclear.
1857 The metric used here is (the number of cycles needed) / 2,
1858 where we consider equal a cycle for a word of code and a cycle to
1859 read memory. FIXME: Adding "+ 1" to all values would avoid
1860 returning 0, as tree-ssa-loop-ivopts.c as of r128272 "normalizes"
1861 0 to 1, thereby giving equal costs to [rN + rM] and [rN].
1862 Unfortunately(?) such a hack would expose other pessimizations,
1863 at least with g++.dg/tree-ssa/ivopts-1.C, adding insns to the
1864 loop there, without apparent reason. */
1866 /* The cheapest addressing modes get 0, since nothing extra is needed. */
1867 if (BASE_OR_AUTOINCR_P (x
))
1870 /* An indirect mem must be a DIP. This means two bytes extra for code,
1871 and 4 bytes extra for memory read, i.e. (2 + 4) / 2. */
1875 /* Assume (2 + 4) / 2 for a single constant; a dword, since it needs
1876 an extra DIP prefix and 4 bytes of constant in most cases. */
1880 /* Handle BIAP and BDAP prefixes. */
1881 if (GET_CODE (x
) == PLUS
)
1883 rtx tem1
= XEXP (x
, 0);
1884 rtx tem2
= XEXP (x
, 1);
1886 /* Local extended canonicalization rule: the first operand must
1887 be REG, unless it's an operation (MULT). */
1888 if (!REG_P (tem1
) && GET_CODE (tem1
) != MULT
)
1889 tem1
= tem2
, tem2
= XEXP (x
, 0);
1891 /* We'll "assume" we have canonical RTX now. */
1892 gcc_assert (REG_P (tem1
) || GET_CODE (tem1
) == MULT
);
1894 /* A BIAP is 2 extra bytes for the prefix insn, nothing more. We
1895 recognize the typical MULT which is always in tem1 because of
1896 insn canonicalization. */
1897 if ((GET_CODE (tem1
) == MULT
&& BIAP_INDEX_P (tem1
))
1901 /* A BDAP (quick) is 2 extra bytes. Any constant operand to the
1902 PLUS is always found in tem2. */
1903 if (CONST_INT_P (tem2
) && INTVAL (tem2
) < 128 && INTVAL (tem2
) >= -128)
1906 /* A BDAP -32768 .. 32767 is like BDAP quick, but with 2 extra
1908 if (CONST_INT_P (tem2
) && CONST_OK_FOR_LETTER_P (INTVAL (tem2
), 'L'))
1911 /* A BDAP with some other constant is 2 bytes extra. */
1912 if (CONSTANT_P (tem2
))
1913 return (2 + 2 + 2) / 2;
1915 /* BDAP with something indirect should have a higher cost than
1916 BIAP with register. FIXME: Should it cost like a MEM or more? */
1917 return (2 + 2 + 2) / 2;
1920 /* What else? Return a high cost. It matters only for valid
1921 addressing modes. */
1925 /* Check various objections to the side-effect. Used in the test-part
1926 of an anonymous insn describing an insn with a possible side-effect.
1927 Returns nonzero if the implied side-effect is ok.
1930 ops : An array of rtx:es. lreg, rreg, rval,
1931 The variables multop and other_op are indexes into this,
1932 or -1 if they are not applicable.
1933 lreg : The register that gets assigned in the side-effect.
1934 rreg : One register in the side-effect expression
1935 rval : The other register, or an int.
1936 multop : An integer to multiply rval with.
1937 other_op : One of the entities of the main effect,
1938 whose mode we must consider. */
1941 cris_side_effect_mode_ok (enum rtx_code code
, rtx
*ops
,
1942 int lreg
, int rreg
, int rval
,
1943 int multop
, int other_op
)
1945 /* Find what value to multiply with, for rx =ry + rz * n. */
1946 int mult
= multop
< 0 ? 1 : INTVAL (ops
[multop
]);
1948 rtx reg_rtx
= ops
[rreg
];
1949 rtx val_rtx
= ops
[rval
];
1951 /* The operands may be swapped. Canonicalize them in reg_rtx and
1952 val_rtx, where reg_rtx always is a reg (for this constraint to
1954 if (! BASE_P (reg_rtx
))
1955 reg_rtx
= val_rtx
, val_rtx
= ops
[rreg
];
1957 /* Don't forget to check that reg_rtx really is a reg. If it isn't,
1958 we have no business. */
1959 if (! BASE_P (reg_rtx
))
1962 /* Don't do this when -mno-split. */
1963 if (!TARGET_SIDE_EFFECT_PREFIXES
)
1966 /* The mult expression may be hidden in lreg. FIXME: Add more
1967 commentary about that. */
1968 if (GET_CODE (val_rtx
) == MULT
)
1970 mult
= INTVAL (XEXP (val_rtx
, 1));
1971 val_rtx
= XEXP (val_rtx
, 0);
1975 /* First check the "other operand". */
1978 if (GET_MODE_SIZE (GET_MODE (ops
[other_op
])) > UNITS_PER_WORD
)
1981 /* Check if the lvalue register is the same as the "other
1982 operand". If so, the result is undefined and we shouldn't do
1983 this. FIXME: Check again. */
1984 if ((BASE_P (ops
[lreg
])
1985 && BASE_P (ops
[other_op
])
1986 && REGNO (ops
[lreg
]) == REGNO (ops
[other_op
]))
1987 || rtx_equal_p (ops
[other_op
], ops
[lreg
]))
1991 /* Do not accept frame_pointer_rtx as any operand. */
1992 if (ops
[lreg
] == frame_pointer_rtx
|| ops
[rreg
] == frame_pointer_rtx
1993 || ops
[rval
] == frame_pointer_rtx
1994 || (other_op
>= 0 && ops
[other_op
] == frame_pointer_rtx
))
1998 && ! BASE_P (val_rtx
))
2001 /* Do not allow rx = rx + n if a normal add or sub with same size
2003 if (rtx_equal_p (ops
[lreg
], reg_rtx
)
2004 && CONST_INT_P (val_rtx
)
2005 && (INTVAL (val_rtx
) <= 63 && INTVAL (val_rtx
) >= -63))
2008 /* Check allowed cases, like [r(+)?].[bwd] and const. */
2009 if (CONSTANT_P (val_rtx
))
2012 if (MEM_P (val_rtx
) && BASE_OR_AUTOINCR_P (XEXP (val_rtx
, 0)))
2015 if (GET_CODE (val_rtx
) == SIGN_EXTEND
2016 && MEM_P (XEXP (val_rtx
, 0))
2017 && BASE_OR_AUTOINCR_P (XEXP (XEXP (val_rtx
, 0), 0)))
2020 /* If we got here, it's not a valid addressing mode. */
2023 else if (code
== MULT
2024 || (code
== PLUS
&& BASE_P (val_rtx
)))
2026 /* Do not allow rx = rx + ry.S, since it doesn't give better code. */
2027 if (rtx_equal_p (ops
[lreg
], reg_rtx
)
2028 || (mult
== 1 && rtx_equal_p (ops
[lreg
], val_rtx
)))
2031 /* Do not allow bad multiply-values. */
2032 if (mult
!= 1 && mult
!= 2 && mult
!= 4)
2035 /* Only allow r + ... */
2036 if (! BASE_P (reg_rtx
))
2039 /* If we got here, all seems ok.
2040 (All checks need to be done above). */
2044 /* If we get here, the caller got its initial tests wrong. */
2045 internal_error ("internal error: cris_side_effect_mode_ok with bad operands");
2048 /* Whether next_cc0_user of insn is LE or GT or requires a real compare
2049 insn for other reasons. */
2052 cris_cc0_user_requires_cmp (rtx insn
)
2054 rtx cc0_user
= NULL
;
2058 gcc_assert (insn
!= NULL
);
2063 cc0_user
= next_cc0_user (insn
);
2064 if (cc0_user
== NULL
)
2067 body
= PATTERN (cc0_user
);
2068 set
= single_set (cc0_user
);
2070 /* Users can be sCC and bCC. */
2071 if (JUMP_P (cc0_user
)
2072 && GET_CODE (body
) == SET
2073 && SET_DEST (body
) == pc_rtx
2074 && GET_CODE (SET_SRC (body
)) == IF_THEN_ELSE
2075 && XEXP (XEXP (SET_SRC (body
), 0), 0) == cc0_rtx
)
2078 GET_CODE (XEXP (SET_SRC (body
), 0)) == GT
2079 || GET_CODE (XEXP (SET_SRC (body
), 0)) == LE
;
2084 GET_CODE (SET_SRC (body
)) == GT
2085 || GET_CODE (SET_SRC (body
)) == LE
;
2091 /* The function reg_overlap_mentioned_p in CVS (still as of 2001-05-16)
2092 does not handle the case where the IN operand is strict_low_part; it
2093 does handle it for X. Test-case in Axis-20010516. This function takes
2094 care of that for THIS port. FIXME: strict_low_part is going away
2098 cris_reg_overlap_mentioned_p (rtx x
, rtx in
)
2100 /* The function reg_overlap_mentioned now handles when X is
2101 strict_low_part, but not when IN is a STRICT_LOW_PART. */
2102 if (GET_CODE (in
) == STRICT_LOW_PART
)
2105 return reg_overlap_mentioned_p (x
, in
);
2108 /* The TARGET_ASM_NAMED_SECTION worker.
2109 We just dispatch to the functions for ELF and a.out. */
2112 cris_target_asm_named_section (const char *name
, unsigned int flags
,
2116 default_no_named_section (name
, flags
, decl
);
2118 default_elf_asm_named_section (name
, flags
, decl
);
2121 /* Return TRUE iff X is a CONST valid for e.g. indexing.
2122 ANY_OPERAND is 0 if X is in a CALL_P insn or movsi, 1
2126 cris_valid_pic_const (rtx x
, bool any_operand
)
2128 gcc_assert (flag_pic
);
2130 switch (GET_CODE (x
))
2139 if (GET_CODE (x
) != CONST
)
2144 /* Handle (const (plus (unspec .. UNSPEC_GOTREL) (const_int ...))). */
2145 if (GET_CODE (x
) == PLUS
2146 && GET_CODE (XEXP (x
, 0)) == UNSPEC
2147 && (XINT (XEXP (x
, 0), 1) == CRIS_UNSPEC_GOTREL
2148 || XINT (XEXP (x
, 0), 1) == CRIS_UNSPEC_PCREL
)
2149 && CONST_INT_P (XEXP (x
, 1)))
2152 if (GET_CODE (x
) == UNSPEC
)
2153 switch (XINT (x
, 1))
2155 /* A PCREL operand is only valid for call and movsi. */
2156 case CRIS_UNSPEC_PLT_PCREL
:
2157 case CRIS_UNSPEC_PCREL
:
2158 return !any_operand
;
2160 case CRIS_UNSPEC_PLT_GOTREL
:
2161 case CRIS_UNSPEC_PLTGOTREAD
:
2162 case CRIS_UNSPEC_GOTREAD
:
2163 case CRIS_UNSPEC_GOTREL
:
2169 return cris_pic_symbol_type_of (x
) == cris_no_symbol
;
2172 /* Helper function to find the right PIC-type symbol to generate,
2173 given the original (non-PIC) representation. */
2175 enum cris_pic_symbol_type
2176 cris_pic_symbol_type_of (rtx x
)
2178 switch (GET_CODE (x
))
2181 return SYMBOL_REF_LOCAL_P (x
)
2182 ? cris_rel_symbol
: cris_got_symbol
;
2185 return cris_rel_symbol
;
2188 return cris_pic_symbol_type_of (XEXP (x
, 0));
2193 enum cris_pic_symbol_type t1
= cris_pic_symbol_type_of (XEXP (x
, 0));
2194 enum cris_pic_symbol_type t2
= cris_pic_symbol_type_of (XEXP (x
, 1));
2196 gcc_assert (t1
== cris_no_symbol
|| t2
== cris_no_symbol
);
2198 if (t1
== cris_got_symbol
|| t1
== cris_got_symbol
)
2199 return cris_got_symbol_needing_fixup
;
2201 return t1
!= cris_no_symbol
? t1
: t2
;
2206 return cris_no_symbol
;
2209 /* Likely an offsettability-test attempting to add a constant to
2210 a GOTREAD symbol, which can't be handled. */
2211 return cris_invalid_pic_symbol
;
2214 fatal_insn ("unrecognized supposed constant", x
);
2220 /* The LEGITIMATE_PIC_OPERAND_P worker. */
2223 cris_legitimate_pic_operand (rtx x
)
2225 /* Symbols are not valid PIC operands as-is; just constants. */
2226 return cris_valid_pic_const (x
, true);
2229 /* The ASM_OUTPUT_CASE_END worker. */
2232 cris_asm_output_case_end (FILE *stream
, int num
, rtx table
)
2236 rtx whole_jump_insn
= PATTERN (PREV_INSN (PREV_INSN (table
)));
2238 /* This can be a SEQUENCE, meaning the delay-slot of the jump is
2241 = (GET_CODE (whole_jump_insn
) == SEQUENCE
2242 ? PATTERN (XVECEXP (whole_jump_insn
, 0, 0)) : whole_jump_insn
);
2244 asm_fprintf (stream
,
2245 "\t.word %LL%d-.%s\n",
2246 CODE_LABEL_NUMBER (XEXP (XEXP (XEXP (XVECEXP
2247 (parallel_jump
, 0, 0),
2249 (TARGET_PDEBUG
? "; default" : ""));
2253 asm_fprintf (stream
,
2254 "\t.word %LL%d-%LL%d%s\n",
2255 CODE_LABEL_NUMBER (XEXP
2261 (PREV_INSN (table
))), 0, 0), 1),
2264 (TARGET_PDEBUG
? "; default" : ""));
2267 /* TARGET_HANDLE_OPTION worker. We just store the values into local
2268 variables here. Checks for correct semantics are in
2269 cris_override_options. */
2272 cris_handle_option (size_t code
, const char *arg ATTRIBUTE_UNUSED
,
2273 int value ATTRIBUTE_UNUSED
)
2281 + MASK_ALIGN_BY_32
);
2284 case OPT_mno_etrax100
:
2288 + MASK_ALIGN_BY_32
);
2294 |= (MASK_STACK_ALIGN
2297 + MASK_ALIGN_BY_32
);
2303 |= (MASK_STACK_ALIGN
2311 &= ~(MASK_STACK_ALIGN
2320 CRIS_SUBTARGET_HANDLE_OPTION(code
, arg
, value
);
2325 /* The OVERRIDE_OPTIONS worker.
2326 As is the norm, this also parses -mfoo=bar type parameters. */
2329 cris_override_options (void)
2331 if (cris_max_stackframe_str
)
2333 cris_max_stackframe
= atoi (cris_max_stackframe_str
);
2335 /* Do some sanity checking. */
2336 if (cris_max_stackframe
< 0 || cris_max_stackframe
> 0x20000000)
2337 internal_error ("-max-stackframe=%d is not usable, not between 0 and %d",
2338 cris_max_stackframe
, 0x20000000);
2341 /* Let "-metrax4" and "-metrax100" change the cpu version. */
2342 if (TARGET_SVINTO
&& cris_cpu_version
< CRIS_CPU_SVINTO
)
2343 cris_cpu_version
= CRIS_CPU_SVINTO
;
2344 else if (TARGET_ETRAX4_ADD
&& cris_cpu_version
< CRIS_CPU_ETRAX4
)
2345 cris_cpu_version
= CRIS_CPU_ETRAX4
;
2347 /* Parse -march=... and its synonym, the deprecated -mcpu=... */
2351 = (*cris_cpu_str
== 'v' ? atoi (cris_cpu_str
+ 1) : -1);
2353 if (strcmp ("etrax4", cris_cpu_str
) == 0)
2354 cris_cpu_version
= 3;
2356 if (strcmp ("svinto", cris_cpu_str
) == 0
2357 || strcmp ("etrax100", cris_cpu_str
) == 0)
2358 cris_cpu_version
= 8;
2360 if (strcmp ("ng", cris_cpu_str
) == 0
2361 || strcmp ("etrax100lx", cris_cpu_str
) == 0)
2362 cris_cpu_version
= 10;
2364 if (cris_cpu_version
< 0 || cris_cpu_version
> 32)
2365 error ("unknown CRIS version specification in -march= or -mcpu= : %s",
2368 /* Set the target flags. */
2369 if (cris_cpu_version
>= CRIS_CPU_ETRAX4
)
2370 target_flags
|= MASK_ETRAX4_ADD
;
2372 /* If this is Svinto or higher, align for 32 bit accesses. */
2373 if (cris_cpu_version
>= CRIS_CPU_SVINTO
)
2375 |= (MASK_SVINTO
| MASK_ALIGN_BY_32
2376 | MASK_STACK_ALIGN
| MASK_CONST_ALIGN
2379 /* Note that we do not add new flags when it can be completely
2380 described with a macro that uses -mcpu=X. So
2381 TARGET_HAS_MUL_INSNS is (cris_cpu_version >= CRIS_CPU_NG). */
2387 = (*cris_tune_str
== 'v' ? atoi (cris_tune_str
+ 1) : -1);
2389 if (strcmp ("etrax4", cris_tune_str
) == 0)
2392 if (strcmp ("svinto", cris_tune_str
) == 0
2393 || strcmp ("etrax100", cris_tune_str
) == 0)
2396 if (strcmp ("ng", cris_tune_str
) == 0
2397 || strcmp ("etrax100lx", cris_tune_str
) == 0)
2400 if (cris_tune
< 0 || cris_tune
> 32)
2401 error ("unknown CRIS cpu version specification in -mtune= : %s",
2404 if (cris_tune
>= CRIS_CPU_SVINTO
)
2405 /* We have currently nothing more to tune than alignment for
2408 |= (MASK_STACK_ALIGN
| MASK_CONST_ALIGN
2409 | MASK_DATA_ALIGN
| MASK_ALIGN_BY_32
);
2412 if (cris_cpu_version
>= CRIS_CPU_V32
)
2413 target_flags
&= ~(MASK_SIDE_EFFECT_PREFIXES
|MASK_MUL_BUG
);
2417 /* Use error rather than warning, so invalid use is easily
2418 detectable. Still change to the values we expect, to avoid
2422 error ("-fPIC and -fpic are not supported in this configuration");
2426 /* Turn off function CSE. We need to have the addresses reach the
2427 call expanders to get PLT-marked, as they could otherwise be
2428 compared against zero directly or indirectly. After visiting the
2429 call expanders they will then be cse:ed, as the call expanders
2430 force_reg the addresses, effectively forcing flag_no_function_cse
2432 flag_no_function_cse
= 1;
2435 if (write_symbols
== DWARF2_DEBUG
&& ! TARGET_ELF
)
2437 warning (0, "that particular -g option is invalid with -maout and -melinux");
2438 write_symbols
= DBX_DEBUG
;
2441 /* Set the per-function-data initializer. */
2442 init_machine_status
= cris_init_machine_status
;
2445 /* The TARGET_ASM_OUTPUT_MI_THUNK worker. */
2448 cris_asm_output_mi_thunk (FILE *stream
,
2449 tree thunkdecl ATTRIBUTE_UNUSED
,
2450 HOST_WIDE_INT delta
,
2451 HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED
,
2455 fprintf (stream
, "\tadd%s " HOST_WIDE_INT_PRINT_DEC
",$%s\n",
2456 ADDITIVE_SIZE_MODIFIER (delta
), delta
,
2457 reg_names
[CRIS_FIRST_ARG_REG
]);
2459 fprintf (stream
, "\tsub%s " HOST_WIDE_INT_PRINT_DEC
",$%s\n",
2460 ADDITIVE_SIZE_MODIFIER (-delta
), -delta
,
2461 reg_names
[CRIS_FIRST_ARG_REG
]);
2465 const char *name
= XSTR (XEXP (DECL_RTL (funcdecl
), 0), 0);
2467 name
= (* targetm
.strip_name_encoding
) (name
);
2471 fprintf (stream
, "\tba ");
2472 assemble_name (stream
, name
);
2473 fprintf (stream
, "%s\n", CRIS_PLT_PCOFFSET_SUFFIX
);
2477 fprintf (stream
, "add.d ");
2478 assemble_name (stream
, name
);
2479 fprintf (stream
, "%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX
);
2484 fprintf (stream
, "jump ");
2485 assemble_name (stream
, XSTR (XEXP (DECL_RTL (funcdecl
), 0), 0));
2486 fprintf (stream
, "\n");
2489 fprintf (stream
, "\tnop\n");
2493 /* Boilerplate emitted at start of file.
2495 NO_APP *only at file start* means faster assembly. It also means
2496 comments are not allowed. In some cases comments will be output
2497 for debugging purposes. Make sure they are allowed then.
2499 We want a .file directive only if TARGET_ELF. */
2501 cris_file_start (void)
2503 /* These expressions can vary at run time, so we cannot put
2504 them into TARGET_INITIALIZER. */
2505 targetm
.file_start_app_off
= !(TARGET_PDEBUG
|| flag_print_asm_name
);
2506 targetm
.file_start_file_directive
= TARGET_ELF
;
2508 default_file_start ();
2511 /* Rename the function calls for integer multiply and divide. */
2513 cris_init_libfuncs (void)
2515 set_optab_libfunc (smul_optab
, SImode
, "__Mul");
2516 set_optab_libfunc (sdiv_optab
, SImode
, "__Div");
2517 set_optab_libfunc (udiv_optab
, SImode
, "__Udiv");
2518 set_optab_libfunc (smod_optab
, SImode
, "__Mod");
2519 set_optab_libfunc (umod_optab
, SImode
, "__Umod");
2522 /* The INIT_EXPANDERS worker sets the per-function-data initializer and
2526 cris_init_expanders (void)
2528 /* Nothing here at the moment. */
2531 /* Zero initialization is OK for all current fields. */
2533 static struct machine_function
*
2534 cris_init_machine_status (void)
2536 return ggc_alloc_cleared (sizeof (struct machine_function
));
2539 /* Split a 2 word move (DI or presumably DF) into component parts.
2540 Originally a copy of gen_split_move_double in m32r.c. */
2543 cris_split_movdx (rtx
*operands
)
2545 enum machine_mode mode
= GET_MODE (operands
[0]);
2546 rtx dest
= operands
[0];
2547 rtx src
= operands
[1];
2550 /* We used to have to handle (SUBREG (MEM)) here, but that should no
2551 longer happen; after reload there are no SUBREGs any more, and we're
2552 only called after reload. */
2553 CRIS_ASSERT (GET_CODE (dest
) != SUBREG
&& GET_CODE (src
) != SUBREG
);
2558 int dregno
= REGNO (dest
);
2560 /* Reg-to-reg copy. */
2563 int sregno
= REGNO (src
);
2565 int reverse
= (dregno
== sregno
+ 1);
2567 /* We normally copy the low-numbered register first. However, if
2568 the first register operand 0 is the same as the second register of
2569 operand 1, we must copy in the opposite order. */
2570 emit_insn (gen_rtx_SET (VOIDmode
,
2571 operand_subword (dest
, reverse
, TRUE
, mode
),
2572 operand_subword (src
, reverse
, TRUE
, mode
)));
2574 emit_insn (gen_rtx_SET (VOIDmode
,
2575 operand_subword (dest
, !reverse
, TRUE
, mode
),
2576 operand_subword (src
, !reverse
, TRUE
, mode
)));
2578 /* Constant-to-reg copy. */
2579 else if (CONST_INT_P (src
) || GET_CODE (src
) == CONST_DOUBLE
)
2582 split_double (src
, &words
[0], &words
[1]);
2583 emit_insn (gen_rtx_SET (VOIDmode
,
2584 operand_subword (dest
, 0, TRUE
, mode
),
2587 emit_insn (gen_rtx_SET (VOIDmode
,
2588 operand_subword (dest
, 1, TRUE
, mode
),
2591 /* Mem-to-reg copy. */
2592 else if (MEM_P (src
))
2594 /* If the high-address word is used in the address, we must load it
2595 last. Otherwise, load it first. */
2596 rtx addr
= XEXP (src
, 0);
2598 = (refers_to_regno_p (dregno
, dregno
+ 1, addr
, NULL
) != 0);
2600 /* The original code implies that we can't do
2601 move.x [rN+],rM move.x [rN],rM+1
2602 when rN is dead, because of REG_NOTES damage. That is
2603 consistent with what I've seen, so don't try it.
2605 We have two different cases here; if the addr is POST_INC,
2606 just pass it through, otherwise add constants. */
2608 if (GET_CODE (addr
) == POST_INC
)
2613 /* Whenever we emit insns with post-incremented
2614 addresses ourselves, we must add a post-inc note
2616 mem
= change_address (src
, SImode
, addr
);
2618 = gen_rtx_SET (VOIDmode
,
2619 operand_subword (dest
, 0, TRUE
, mode
), mem
);
2620 insn
= emit_insn (insn
);
2621 if (GET_CODE (XEXP (mem
, 0)) == POST_INC
)
2623 = alloc_EXPR_LIST (REG_INC
, XEXP (XEXP (mem
, 0), 0),
2626 mem
= copy_rtx (mem
);
2628 = gen_rtx_SET (VOIDmode
,
2629 operand_subword (dest
, 1, TRUE
, mode
), mem
);
2630 insn
= emit_insn (insn
);
2631 if (GET_CODE (XEXP (mem
, 0)) == POST_INC
)
2633 = alloc_EXPR_LIST (REG_INC
, XEXP (XEXP (mem
, 0), 0),
2638 /* Make sure we don't get any other addresses with
2639 embedded postincrements. They should be stopped in
2640 GO_IF_LEGITIMATE_ADDRESS, but we're here for your
2642 if (side_effects_p (addr
))
2643 fatal_insn ("unexpected side-effects in address", addr
);
2645 emit_insn (gen_rtx_SET
2647 operand_subword (dest
, reverse
, TRUE
, mode
),
2650 plus_constant (addr
,
2651 reverse
* UNITS_PER_WORD
))));
2652 emit_insn (gen_rtx_SET
2654 operand_subword (dest
, ! reverse
, TRUE
, mode
),
2657 plus_constant (addr
,
2663 internal_error ("Unknown src");
2665 /* Reg-to-mem copy or clear mem. */
2666 else if (MEM_P (dest
)
2668 || src
== const0_rtx
2669 || src
== CONST0_RTX (DFmode
)))
2671 rtx addr
= XEXP (dest
, 0);
2673 if (GET_CODE (addr
) == POST_INC
)
2678 /* Whenever we emit insns with post-incremented addresses
2679 ourselves, we must add a post-inc note manually. */
2680 mem
= change_address (dest
, SImode
, addr
);
2682 = gen_rtx_SET (VOIDmode
,
2683 mem
, operand_subword (src
, 0, TRUE
, mode
));
2684 insn
= emit_insn (insn
);
2685 if (GET_CODE (XEXP (mem
, 0)) == POST_INC
)
2687 = alloc_EXPR_LIST (REG_INC
, XEXP (XEXP (mem
, 0), 0),
2690 mem
= copy_rtx (mem
);
2692 = gen_rtx_SET (VOIDmode
,
2694 operand_subword (src
, 1, TRUE
, mode
));
2695 insn
= emit_insn (insn
);
2696 if (GET_CODE (XEXP (mem
, 0)) == POST_INC
)
2698 = alloc_EXPR_LIST (REG_INC
, XEXP (XEXP (mem
, 0), 0),
2703 /* Make sure we don't get any other addresses with embedded
2704 postincrements. They should be stopped in
2705 GO_IF_LEGITIMATE_ADDRESS, but we're here for your safety. */
2706 if (side_effects_p (addr
))
2707 fatal_insn ("unexpected side-effects in address", addr
);
2709 emit_insn (gen_rtx_SET
2711 change_address (dest
, SImode
, addr
),
2712 operand_subword (src
, 0, TRUE
, mode
)));
2714 emit_insn (gen_rtx_SET
2716 change_address (dest
, SImode
,
2717 plus_constant (addr
,
2719 operand_subword (src
, 1, TRUE
, mode
)));
2724 internal_error ("Unknown dest");
2731 /* The expander for the prologue pattern name. */
2734 cris_expand_prologue (void)
2737 int size
= get_frame_size ();
2738 /* Shorten the used name for readability. */
2739 int cfoa_size
= crtl
->outgoing_args_size
;
2740 int last_movem_reg
= -1;
2743 int return_address_on_stack
= cris_return_address_on_stack ();
2744 int got_really_used
= false;
2745 int n_movem_regs
= 0;
2746 int pretend
= crtl
->args
.pretend_args_size
;
2748 /* Don't do anything if no prologues or epilogues are wanted. */
2749 if (!TARGET_PROLOGUE_EPILOGUE
)
2752 CRIS_ASSERT (size
>= 0);
2754 if (crtl
->uses_pic_offset_table
)
2756 /* A reference may have been optimized out (like the abort () in
2757 fde_split in unwind-dw2-fde.c, at least 3.2.1) so check that
2759 push_topmost_sequence ();
2761 = reg_used_between_p (pic_offset_table_rtx
, get_insns (), NULL_RTX
);
2762 pop_topmost_sequence ();
2765 /* Align the size to what's best for the CPU model. */
2766 if (TARGET_STACK_ALIGN
)
2767 size
= TARGET_ALIGN_BY_32
? (size
+ 3) & ~3 : (size
+ 1) & ~1;
2771 /* See also cris_setup_incoming_varargs where
2772 cfun->machine->stdarg_regs is set. There are other setters of
2773 crtl->args.pretend_args_size than stdarg handling, like
2774 for an argument passed with parts in R13 and stack. We must
2775 not store R13 into the pretend-area for that case, as GCC does
2776 that itself. "Our" store would be marked as redundant and GCC
2777 will attempt to remove it, which will then be flagged as an
2778 internal error; trying to remove a frame-related insn. */
2779 int stdarg_regs
= cfun
->machine
->stdarg_regs
;
2781 framesize
+= pretend
;
2783 for (regno
= CRIS_FIRST_ARG_REG
+ CRIS_MAX_ARGS_IN_REGS
- 1;
2785 regno
--, pretend
-= 4, stdarg_regs
--)
2787 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2789 plus_constant (stack_pointer_rtx
,
2791 /* FIXME: When dwarf2 frame output and unless asynchronous
2792 exceptions, make dwarf2 bundle together all stack
2793 adjustments like it does for registers between stack
2795 RTX_FRAME_RELATED_P (insn
) = 1;
2797 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2798 set_mem_alias_set (mem
, get_varargs_alias_set ());
2799 insn
= emit_move_insn (mem
, gen_rtx_raw_REG (SImode
, regno
));
2801 /* Note the absence of RTX_FRAME_RELATED_P on the above insn:
2802 the value isn't restored, so we don't want to tell dwarf2
2803 that it's been stored to stack, else EH handling info would
2807 /* For other setters of crtl->args.pretend_args_size, we
2808 just adjust the stack by leaving the remaining size in
2809 "pretend", handled below. */
2812 /* Save SRP if not a leaf function. */
2813 if (return_address_on_stack
)
2815 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2817 plus_constant (stack_pointer_rtx
,
2820 RTX_FRAME_RELATED_P (insn
) = 1;
2822 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2823 set_mem_alias_set (mem
, get_frame_alias_set ());
2824 insn
= emit_move_insn (mem
, gen_rtx_raw_REG (SImode
, CRIS_SRP_REGNUM
));
2825 RTX_FRAME_RELATED_P (insn
) = 1;
2829 /* Set up the frame pointer, if needed. */
2830 if (frame_pointer_needed
)
2832 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2834 plus_constant (stack_pointer_rtx
,
2837 RTX_FRAME_RELATED_P (insn
) = 1;
2839 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2840 set_mem_alias_set (mem
, get_frame_alias_set ());
2841 insn
= emit_move_insn (mem
, frame_pointer_rtx
);
2842 RTX_FRAME_RELATED_P (insn
) = 1;
2844 insn
= emit_move_insn (frame_pointer_rtx
, stack_pointer_rtx
);
2845 RTX_FRAME_RELATED_P (insn
) = 1;
2850 /* Between frame-pointer and saved registers lie the area for local
2851 variables. If we get here with "pretended" size remaining, count
2852 it into the general stack size. */
2855 /* Get a contiguous sequence of registers, starting with R0, that need
2857 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
2859 if (cris_reg_saved_in_regsave_area (regno
, got_really_used
))
2863 /* Check if movem may be used for registers so far. */
2864 if (regno
== last_movem_reg
+ 1)
2865 /* Yes, update next expected register. */
2866 last_movem_reg
= regno
;
2869 /* We cannot use movem for all registers. We have to flush
2870 any movem:ed registers we got so far. */
2871 if (last_movem_reg
!= -1)
2874 = (n_movem_regs
== 1) ? 1 : last_movem_reg
+ 1;
2876 /* It is a win to use a side-effect assignment for
2877 64 <= size <= 128. But side-effect on movem was
2878 not usable for CRIS v0..3. Also only do it if
2879 side-effects insns are allowed. */
2880 if ((last_movem_reg
+ 1) * 4 + size
>= 64
2881 && (last_movem_reg
+ 1) * 4 + size
<= 128
2882 && (cris_cpu_version
>= CRIS_CPU_SVINTO
|| n_saved
== 1)
2883 && TARGET_SIDE_EFFECT_PREFIXES
)
2886 = gen_rtx_MEM (SImode
,
2887 plus_constant (stack_pointer_rtx
,
2888 -(n_saved
* 4 + size
)));
2889 set_mem_alias_set (mem
, get_frame_alias_set ());
2891 = cris_emit_movem_store (mem
, GEN_INT (n_saved
),
2892 -(n_saved
* 4 + size
),
2898 = gen_rtx_SET (VOIDmode
,
2900 plus_constant (stack_pointer_rtx
,
2901 -(n_saved
* 4 + size
)));
2902 insn
= emit_insn (insn
);
2903 RTX_FRAME_RELATED_P (insn
) = 1;
2905 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2906 set_mem_alias_set (mem
, get_frame_alias_set ());
2907 insn
= cris_emit_movem_store (mem
, GEN_INT (n_saved
),
2911 framesize
+= n_saved
* 4 + size
;
2912 last_movem_reg
= -1;
2916 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2918 plus_constant (stack_pointer_rtx
,
2920 RTX_FRAME_RELATED_P (insn
) = 1;
2922 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2923 set_mem_alias_set (mem
, get_frame_alias_set ());
2924 insn
= emit_move_insn (mem
, gen_rtx_raw_REG (SImode
, regno
));
2925 RTX_FRAME_RELATED_P (insn
) = 1;
2927 framesize
+= 4 + size
;
2933 /* Check after, if we could movem all registers. This is the normal case. */
2934 if (last_movem_reg
!= -1)
2937 = (n_movem_regs
== 1) ? 1 : last_movem_reg
+ 1;
2939 /* Side-effect on movem was not usable for CRIS v0..3. Also only
2940 do it if side-effects insns are allowed. */
2941 if ((last_movem_reg
+ 1) * 4 + size
>= 64
2942 && (last_movem_reg
+ 1) * 4 + size
<= 128
2943 && (cris_cpu_version
>= CRIS_CPU_SVINTO
|| n_saved
== 1)
2944 && TARGET_SIDE_EFFECT_PREFIXES
)
2947 = gen_rtx_MEM (SImode
,
2948 plus_constant (stack_pointer_rtx
,
2949 -(n_saved
* 4 + size
)));
2950 set_mem_alias_set (mem
, get_frame_alias_set ());
2951 insn
= cris_emit_movem_store (mem
, GEN_INT (n_saved
),
2952 -(n_saved
* 4 + size
), true);
2957 = gen_rtx_SET (VOIDmode
,
2959 plus_constant (stack_pointer_rtx
,
2960 -(n_saved
* 4 + size
)));
2961 insn
= emit_insn (insn
);
2962 RTX_FRAME_RELATED_P (insn
) = 1;
2964 mem
= gen_rtx_MEM (SImode
, stack_pointer_rtx
);
2965 set_mem_alias_set (mem
, get_frame_alias_set ());
2966 insn
= cris_emit_movem_store (mem
, GEN_INT (n_saved
), 0, true);
2969 framesize
+= n_saved
* 4 + size
;
2970 /* We have to put outgoing argument space after regs. */
2973 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2975 plus_constant (stack_pointer_rtx
,
2977 RTX_FRAME_RELATED_P (insn
) = 1;
2978 framesize
+= cfoa_size
;
2981 else if ((size
+ cfoa_size
) > 0)
2983 insn
= emit_insn (gen_rtx_SET (VOIDmode
,
2985 plus_constant (stack_pointer_rtx
,
2986 -(cfoa_size
+ size
))));
2987 RTX_FRAME_RELATED_P (insn
) = 1;
2988 framesize
+= size
+ cfoa_size
;
2991 /* Set up the PIC register, if it is used. */
2992 if (got_really_used
)
2995 = gen_rtx_UNSPEC (SImode
, gen_rtvec (1, const0_rtx
), CRIS_UNSPEC_GOT
);
2996 emit_move_insn (pic_offset_table_rtx
, got
);
2998 /* FIXME: This is a cover-up for flow2 messing up; it doesn't
2999 follow exceptional paths and tries to delete the GOT load as
3000 unused, if it isn't used on the non-exceptional paths. Other
3001 ports have similar or other cover-ups, or plain bugs marking
3002 the GOT register load as maybe-dead. To see this, remove the
3003 line below and try libsupc++/vec.cc or a trivial
3004 "static void y (); void x () {try {y ();} catch (...) {}}". */
3005 emit_use (pic_offset_table_rtx
);
3008 if (cris_max_stackframe
&& framesize
> cris_max_stackframe
)
3009 warning (0, "stackframe too big: %d bytes", framesize
);
3012 /* The expander for the epilogue pattern. */
3015 cris_expand_epilogue (void)
3018 int size
= get_frame_size ();
3019 int last_movem_reg
= -1;
3020 int argspace_offset
= crtl
->outgoing_args_size
;
3021 int pretend
= crtl
->args
.pretend_args_size
;
3023 bool return_address_on_stack
= cris_return_address_on_stack ();
3024 /* A reference may have been optimized out
3025 (like the abort () in fde_split in unwind-dw2-fde.c, at least 3.2.1)
3026 so check that it's still used. */
3027 int got_really_used
= false;
3028 int n_movem_regs
= 0;
3030 if (!TARGET_PROLOGUE_EPILOGUE
)
3033 if (crtl
->uses_pic_offset_table
)
3035 /* A reference may have been optimized out (like the abort () in
3036 fde_split in unwind-dw2-fde.c, at least 3.2.1) so check that
3038 push_topmost_sequence ();
3040 = reg_used_between_p (pic_offset_table_rtx
, get_insns (), NULL_RTX
);
3041 pop_topmost_sequence ();
3044 /* Align byte count of stack frame. */
3045 if (TARGET_STACK_ALIGN
)
3046 size
= TARGET_ALIGN_BY_32
? (size
+ 3) & ~3 : (size
+ 1) & ~1;
3048 /* Check how many saved regs we can movem. They start at r0 and must
3051 regno
< FIRST_PSEUDO_REGISTER
;
3053 if (cris_reg_saved_in_regsave_area (regno
, got_really_used
))
3057 if (regno
== last_movem_reg
+ 1)
3058 last_movem_reg
= regno
;
3063 /* If there was only one register that really needed to be saved
3064 through movem, don't use movem. */
3065 if (n_movem_regs
== 1)
3066 last_movem_reg
= -1;
3068 /* Now emit "normal" move insns for all regs higher than the movem
3070 for (regno
= FIRST_PSEUDO_REGISTER
- 1;
3071 regno
> last_movem_reg
;
3073 if (cris_reg_saved_in_regsave_area (regno
, got_really_used
))
3077 if (argspace_offset
)
3079 /* There is an area for outgoing parameters located before
3080 the saved registers. We have to adjust for that. */
3081 emit_insn (gen_rtx_SET (VOIDmode
,
3083 plus_constant (stack_pointer_rtx
,
3085 /* Make sure we only do this once. */
3086 argspace_offset
= 0;
3089 mem
= gen_rtx_MEM (SImode
, gen_rtx_POST_INC (SImode
,
3090 stack_pointer_rtx
));
3091 set_mem_alias_set (mem
, get_frame_alias_set ());
3092 insn
= emit_move_insn (gen_rtx_raw_REG (SImode
, regno
), mem
);
3094 /* Whenever we emit insns with post-incremented addresses
3095 ourselves, we must add a post-inc note manually. */
3097 = alloc_EXPR_LIST (REG_INC
, stack_pointer_rtx
, REG_NOTES (insn
));
3100 /* If we have any movem-restore, do it now. */
3101 if (last_movem_reg
!= -1)
3105 if (argspace_offset
)
3107 emit_insn (gen_rtx_SET (VOIDmode
,
3109 plus_constant (stack_pointer_rtx
,
3111 argspace_offset
= 0;
3114 mem
= gen_rtx_MEM (SImode
,
3115 gen_rtx_POST_INC (SImode
, stack_pointer_rtx
));
3116 set_mem_alias_set (mem
, get_frame_alias_set ());
3118 = emit_insn (cris_gen_movem_load (mem
,
3119 GEN_INT (last_movem_reg
+ 1), 0));
3120 /* Whenever we emit insns with post-incremented addresses
3121 ourselves, we must add a post-inc note manually. */
3122 if (side_effects_p (PATTERN (insn
)))
3124 = alloc_EXPR_LIST (REG_INC
, stack_pointer_rtx
, REG_NOTES (insn
));
3127 /* If we don't clobber all of the allocated stack area (we've already
3128 deallocated saved registers), GCC might want to schedule loads from
3129 the stack to *after* the stack-pointer restore, which introduces an
3130 interrupt race condition. This happened for the initial-value
3131 SRP-restore for g++.dg/eh/registers1.C (noticed by inspection of
3132 other failure for that test). It also happened for the stack slot
3133 for the return value in (one version of)
3134 linux/fs/dcache.c:__d_lookup, at least with "-O2
3135 -fno-omit-frame-pointer". */
3137 /* Restore frame pointer if necessary. */
3138 if (frame_pointer_needed
)
3142 emit_insn (gen_cris_frame_deallocated_barrier ());
3144 emit_move_insn (stack_pointer_rtx
, frame_pointer_rtx
);
3145 mem
= gen_rtx_MEM (SImode
, gen_rtx_POST_INC (SImode
,
3146 stack_pointer_rtx
));
3147 set_mem_alias_set (mem
, get_frame_alias_set ());
3148 insn
= emit_move_insn (frame_pointer_rtx
, mem
);
3150 /* Whenever we emit insns with post-incremented addresses
3151 ourselves, we must add a post-inc note manually. */
3153 = alloc_EXPR_LIST (REG_INC
, stack_pointer_rtx
, REG_NOTES (insn
));
3155 else if ((size
+ argspace_offset
) != 0)
3157 emit_insn (gen_cris_frame_deallocated_barrier ());
3159 /* If there was no frame-pointer to restore sp from, we must
3160 explicitly deallocate local variables. */
3162 /* Handle space for outgoing parameters that hasn't been handled
3164 size
+= argspace_offset
;
3166 emit_insn (gen_rtx_SET (VOIDmode
,
3168 plus_constant (stack_pointer_rtx
, size
)));
3171 /* If this function has no pushed register parameters
3172 (stdargs/varargs), and if it is not a leaf function, then we have
3173 the return address on the stack. */
3174 if (return_address_on_stack
&& pretend
== 0)
3176 if (TARGET_V32
|| crtl
->calls_eh_return
)
3180 rtx srpreg
= gen_rtx_raw_REG (SImode
, CRIS_SRP_REGNUM
);
3181 mem
= gen_rtx_MEM (SImode
,
3182 gen_rtx_POST_INC (SImode
,
3183 stack_pointer_rtx
));
3184 set_mem_alias_set (mem
, get_frame_alias_set ());
3185 insn
= emit_move_insn (srpreg
, mem
);
3187 /* Whenever we emit insns with post-incremented addresses
3188 ourselves, we must add a post-inc note manually. */
3190 = alloc_EXPR_LIST (REG_INC
, stack_pointer_rtx
, REG_NOTES (insn
));
3192 if (crtl
->calls_eh_return
)
3193 emit_insn (gen_addsi3 (stack_pointer_rtx
,
3195 gen_rtx_raw_REG (SImode
,
3196 CRIS_STACKADJ_REG
)));
3197 cris_expand_return (false);
3200 cris_expand_return (true);
3205 /* If we pushed some register parameters, then adjust the stack for
3209 /* If SRP is stored on the way, we need to restore it first. */
3210 if (return_address_on_stack
)
3213 rtx srpreg
= gen_rtx_raw_REG (SImode
, CRIS_SRP_REGNUM
);
3216 mem
= gen_rtx_MEM (SImode
,
3217 gen_rtx_POST_INC (SImode
,
3218 stack_pointer_rtx
));
3219 set_mem_alias_set (mem
, get_frame_alias_set ());
3220 insn
= emit_move_insn (srpreg
, mem
);
3222 /* Whenever we emit insns with post-incremented addresses
3223 ourselves, we must add a post-inc note manually. */
3225 = alloc_EXPR_LIST (REG_INC
, stack_pointer_rtx
, REG_NOTES (insn
));
3228 emit_insn (gen_rtx_SET (VOIDmode
,
3230 plus_constant (stack_pointer_rtx
, pretend
)));
3233 /* Perform the "physical" unwinding that the EH machinery calculated. */
3234 if (crtl
->calls_eh_return
)
3235 emit_insn (gen_addsi3 (stack_pointer_rtx
,
3237 gen_rtx_raw_REG (SImode
,
3238 CRIS_STACKADJ_REG
)));
3239 cris_expand_return (false);
3242 /* Worker function for generating movem from mem for load_multiple. */
3245 cris_gen_movem_load (rtx src
, rtx nregs_rtx
, int nprefix
)
3247 int nregs
= INTVAL (nregs_rtx
);
3251 rtx srcreg
= XEXP (src
, 0);
3252 unsigned int regno
= nregs
- 1;
3261 if (GET_CODE (srcreg
) == POST_INC
)
3262 srcreg
= XEXP (srcreg
, 0);
3264 CRIS_ASSERT (REG_P (srcreg
));
3266 /* Don't use movem for just one insn. The insns are equivalent except
3267 for the pipeline hazard (on v32); movem does not forward the loaded
3268 registers so there's a three cycles penalty for their use. */
3270 return gen_movsi (gen_rtx_REG (SImode
, 0), src
);
3272 vec
= rtvec_alloc (nprefix
+ nregs
3273 + (GET_CODE (XEXP (src
, 0)) == POST_INC
));
3275 if (GET_CODE (XEXP (src
, 0)) == POST_INC
)
3277 RTVEC_ELT (vec
, nprefix
+ 1)
3278 = gen_rtx_SET (VOIDmode
, srcreg
, plus_constant (srcreg
, nregs
* 4));
3282 src
= replace_equiv_address (src
, srcreg
);
3283 RTVEC_ELT (vec
, nprefix
)
3284 = gen_rtx_SET (VOIDmode
, gen_rtx_REG (SImode
, regno
), src
);
3287 for (i
= 1; i
< nregs
; i
++, eltno
++)
3289 RTVEC_ELT (vec
, nprefix
+ eltno
)
3290 = gen_rtx_SET (VOIDmode
, gen_rtx_REG (SImode
, regno
),
3291 adjust_address_nv (src
, SImode
, i
* 4));
3295 return gen_rtx_PARALLEL (VOIDmode
, vec
);
3298 /* Worker function for generating movem to mem. If FRAME_RELATED, notes
3299 are added that the dwarf2 machinery understands. */
3302 cris_emit_movem_store (rtx dest
, rtx nregs_rtx
, int increment
,
3305 int nregs
= INTVAL (nregs_rtx
);
3310 rtx destreg
= XEXP (dest
, 0);
3311 unsigned int regno
= nregs
- 1;
3320 if (GET_CODE (destreg
) == POST_INC
)
3321 increment
+= nregs
* 4;
3323 if (GET_CODE (destreg
) == POST_INC
|| GET_CODE (destreg
) == PLUS
)
3324 destreg
= XEXP (destreg
, 0);
3326 CRIS_ASSERT (REG_P (destreg
));
3328 /* Don't use movem for just one insn. The insns are equivalent except
3329 for the pipeline hazard (on v32); movem does not forward the loaded
3330 registers so there's a three cycles penalty for use. */
3333 rtx mov
= gen_rtx_SET (VOIDmode
, dest
, gen_rtx_REG (SImode
, 0));
3337 insn
= emit_insn (mov
);
3339 RTX_FRAME_RELATED_P (insn
) = 1;
3343 /* If there was a request for a side-effect, create the ordinary
3345 vec
= rtvec_alloc (2);
3347 RTVEC_ELT (vec
, 0) = mov
;
3348 RTVEC_ELT (vec
, 1) = gen_rtx_SET (VOIDmode
, destreg
,
3349 plus_constant (destreg
, increment
));
3352 RTX_FRAME_RELATED_P (mov
) = 1;
3353 RTX_FRAME_RELATED_P (RTVEC_ELT (vec
, 1)) = 1;
3358 vec
= rtvec_alloc (nregs
+ (increment
!= 0 ? 1 : 0));
3360 = gen_rtx_SET (VOIDmode
,
3361 replace_equiv_address (dest
,
3362 plus_constant (destreg
,
3364 gen_rtx_REG (SImode
, regno
));
3367 /* The dwarf2 info wants this mark on each component in a parallel
3368 that's part of the prologue (though it's optional on the first
3371 RTX_FRAME_RELATED_P (RTVEC_ELT (vec
, 0)) = 1;
3376 = gen_rtx_SET (VOIDmode
, destreg
,
3377 plus_constant (destreg
,
3379 ? increment
: nregs
* 4));
3383 RTX_FRAME_RELATED_P (RTVEC_ELT (vec
, 1)) = 1;
3385 /* Don't call adjust_address_nv on a post-incremented address if
3387 if (GET_CODE (XEXP (dest
, 0)) == POST_INC
)
3388 dest
= replace_equiv_address (dest
, destreg
);
3391 for (i
= 1; i
< nregs
; i
++, eltno
++)
3393 RTVEC_ELT (vec
, eltno
)
3394 = gen_rtx_SET (VOIDmode
, adjust_address_nv (dest
, SImode
, i
* 4),
3395 gen_rtx_REG (SImode
, regno
));
3397 RTX_FRAME_RELATED_P (RTVEC_ELT (vec
, eltno
)) = 1;
3402 insn
= emit_insn (gen_rtx_PARALLEL (VOIDmode
, vec
));
3404 /* Because dwarf2out.c handles the insns in a parallel as a sequence,
3405 we need to keep the stack adjustment separate, after the
3406 MEM-setters. Else the stack-adjustment in the second component of
3407 the parallel would be mishandled; the offsets for the SETs that
3408 follow it would be wrong. We prepare for this by adding a
3409 REG_FRAME_RELATED_EXPR with the MEM-setting parts in a SEQUENCE
3410 followed by the increment. Note that we have FRAME_RELATED_P on
3411 all the SETs, including the original stack adjustment SET in the
3417 rtx seq
= gen_rtx_SEQUENCE (VOIDmode
, rtvec_alloc (nregs
+ 1));
3418 XVECEXP (seq
, 0, 0) = copy_rtx (XVECEXP (PATTERN (insn
), 0, 0));
3419 for (i
= 1; i
< nregs
; i
++)
3421 = copy_rtx (XVECEXP (PATTERN (insn
), 0, i
+ 1));
3422 XVECEXP (seq
, 0, nregs
) = copy_rtx (XVECEXP (PATTERN (insn
), 0, 1));
3424 = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR
, seq
,
3428 RTX_FRAME_RELATED_P (insn
) = 1;
3434 /* Worker function for expanding the address for PIC function calls. */
3437 cris_expand_pic_call_address (rtx
*opp
)
3441 gcc_assert (MEM_P (op
));
3444 /* It might be that code can be generated that jumps to 0 (or to a
3445 specific address). Don't die on that. (There is a
3447 if (CONSTANT_ADDRESS_P (op
) && !CONST_INT_P (op
))
3449 enum cris_pic_symbol_type t
= cris_pic_symbol_type_of (op
);
3451 CRIS_ASSERT (can_create_pseudo_p ());
3453 /* For local symbols (non-PLT), just get the plain symbol
3454 reference into a register. For symbols that can be PLT, make
3456 if (t
== cris_rel_symbol
)
3458 /* For v32, we're fine as-is; just PICify the symbol. Forcing
3459 into a register caused performance regression for 3.2.1,
3460 observable in __floatdidf and elsewhere in libgcc. */
3463 rtx sym
= GET_CODE (op
) != CONST
? op
: get_related_value (op
);
3464 HOST_WIDE_INT offs
= get_integer_term (op
);
3466 /* We can't get calls to sym+N, N integer, can we? */
3467 gcc_assert (offs
== 0);
3469 op
= gen_rtx_CONST (Pmode
,
3470 gen_rtx_UNSPEC (Pmode
, gen_rtvec (1, sym
),
3471 CRIS_UNSPEC_PCREL
));
3474 op
= force_reg (Pmode
, op
);
3476 else if (t
== cris_got_symbol
)
3478 if (TARGET_AVOID_GOTPLT
)
3480 /* Change a "jsr sym" into (allocate register rM, rO)
3481 "move.d (const (unspec [sym rPIC] CRIS_UNSPEC_PLT_GOTREL)),rM"
3482 "add.d rPIC,rM,rO", "jsr rO" for pre-v32 and
3483 "jsr (const (unspec [sym rPIC] CRIS_UNSPEC_PLT_PCREL))"
3486 gcc_assert (can_create_pseudo_p ());
3487 crtl
->uses_pic_offset_table
= 1;
3488 tem
= gen_rtx_UNSPEC (Pmode
, gen_rtvec (1, op
),
3490 ? CRIS_UNSPEC_PLT_PCREL
3491 : CRIS_UNSPEC_PLT_GOTREL
);
3492 tem
= gen_rtx_CONST (Pmode
, tem
);
3497 rm
= gen_reg_rtx (Pmode
);
3498 emit_move_insn (rm
, tem
);
3499 ro
= gen_reg_rtx (Pmode
);
3500 if (expand_binop (Pmode
, add_optab
, rm
,
3501 pic_offset_table_rtx
,
3502 ro
, 0, OPTAB_LIB_WIDEN
) != ro
)
3503 internal_error ("expand_binop failed in movsi got");
3509 /* Change a "jsr sym" into (allocate register rM, rO)
3510 "move.d (const (unspec [sym] CRIS_UNSPEC_PLTGOTREAD)),rM"
3511 "add.d rPIC,rM,rO" "jsr [rO]" with the memory access
3512 marked as not trapping and not aliasing. No "move.d
3513 [rO],rP" as that would invite to re-use of a value
3514 that should not be reused. FIXME: Need a peephole2
3515 for cases when this is cse:d from the call, to change
3516 back to just get the PLT entry address, so we don't
3517 resolve the same symbol over and over (the memory
3518 access of the PLTGOT isn't constant). */
3519 rtx tem
, mem
, rm
, ro
;
3521 gcc_assert (can_create_pseudo_p ());
3522 crtl
->uses_pic_offset_table
= 1;
3523 tem
= gen_rtx_UNSPEC (Pmode
, gen_rtvec (1, op
),
3524 CRIS_UNSPEC_PLTGOTREAD
);
3525 rm
= gen_reg_rtx (Pmode
);
3526 emit_move_insn (rm
, gen_rtx_CONST (Pmode
, tem
));
3527 ro
= gen_reg_rtx (Pmode
);
3528 if (expand_binop (Pmode
, add_optab
, rm
,
3529 pic_offset_table_rtx
,
3530 ro
, 0, OPTAB_LIB_WIDEN
) != ro
)
3531 internal_error ("expand_binop failed in movsi got");
3532 mem
= gen_rtx_MEM (Pmode
, ro
);
3534 /* This MEM doesn't alias anything. Whether it aliases
3535 other same symbols is unimportant. */
3536 set_mem_alias_set (mem
, new_alias_set ());
3537 MEM_NOTRAP_P (mem
) = 1;
3542 /* Can't possibly get a GOT-needing-fixup for a function-call,
3544 fatal_insn ("Unidentifiable call op", op
);
3546 *opp
= replace_equiv_address (*opp
, op
);
3550 /* Make sure operands are in the right order for an addsi3 insn as
3551 generated by a define_split. A MEM as the first operand isn't
3552 recognized by addsi3 after reload. OPERANDS contains the operands,
3553 with the first at OPERANDS[N] and the second at OPERANDS[N+1]. */
3556 cris_order_for_addsi3 (rtx
*operands
, int n
)
3558 if (MEM_P (operands
[n
]))
3560 rtx tem
= operands
[n
];
3561 operands
[n
] = operands
[n
+ 1];
3562 operands
[n
+ 1] = tem
;
3566 /* Use from within code, from e.g. PRINT_OPERAND and
3567 PRINT_OPERAND_ADDRESS. Macros used in output_addr_const need to emit
3568 different things depending on whether code operand or constant is
3572 cris_output_addr_const (FILE *file
, rtx x
)
3575 output_addr_const (file
, x
);
3579 /* Worker function for ASM_OUTPUT_SYMBOL_REF. */
3582 cris_asm_output_symbol_ref (FILE *file
, rtx x
)
3584 gcc_assert (GET_CODE (x
) == SYMBOL_REF
);
3586 if (flag_pic
&& in_code
> 0)
3588 const char *origstr
= XSTR (x
, 0);
3590 str
= (* targetm
.strip_name_encoding
) (origstr
);
3591 assemble_name (file
, str
);
3594 if (!TARGET_V32
&& !crtl
->uses_pic_offset_table
)
3595 output_operand_lossage ("PIC register isn't set up");
3598 assemble_name (file
, XSTR (x
, 0));
3601 /* Worker function for ASM_OUTPUT_LABEL_REF. */
3604 cris_asm_output_label_ref (FILE *file
, char *buf
)
3606 if (flag_pic
&& in_code
> 0)
3608 assemble_name (file
, buf
);
3611 if (!TARGET_V32
&& !crtl
->uses_pic_offset_table
)
3612 internal_error ("emitting PIC operand, but PIC register isn't set up");
3615 assemble_name (file
, buf
);
3618 /* Worker function for OUTPUT_ADDR_CONST_EXTRA. */
3621 cris_output_addr_const_extra (FILE *file
, rtx xconst
)
3623 switch (GET_CODE (xconst
))
3628 x
= XVECEXP (xconst
, 0, 0);
3629 CRIS_ASSERT (GET_CODE (x
) == SYMBOL_REF
3630 || GET_CODE (x
) == LABEL_REF
3631 || GET_CODE (x
) == CONST
);
3632 output_addr_const (file
, x
);
3633 switch (XINT (xconst
, 1))
3635 case CRIS_UNSPEC_PCREL
:
3636 /* We only get this with -fpic/PIC to tell it apart from an
3637 invalid symbol. We can't tell here, but it should only
3638 be the operand of a call or movsi. */
3639 gcc_assert (TARGET_V32
&& flag_pic
);
3642 case CRIS_UNSPEC_PLT_PCREL
:
3643 gcc_assert (TARGET_V32
);
3644 fprintf (file
, ":PLT");
3647 case CRIS_UNSPEC_PLT_GOTREL
:
3648 gcc_assert (!TARGET_V32
);
3649 fprintf (file
, ":PLTG");
3652 case CRIS_UNSPEC_GOTREL
:
3653 gcc_assert (!TARGET_V32
);
3654 fprintf (file
, ":GOTOFF");
3657 case CRIS_UNSPEC_GOTREAD
:
3659 fprintf (file
, ":GOT16");
3661 fprintf (file
, ":GOT");
3664 case CRIS_UNSPEC_PLTGOTREAD
:
3666 fprintf (file
, CRIS_GOTPLT_SUFFIX
"16");
3668 fprintf (file
, CRIS_GOTPLT_SUFFIX
);
3681 /* Worker function for TARGET_STRUCT_VALUE_RTX. */
3684 cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED
,
3685 int incoming ATTRIBUTE_UNUSED
)
3687 return gen_rtx_REG (Pmode
, CRIS_STRUCT_VALUE_REGNUM
);
3690 /* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
3693 cris_setup_incoming_varargs (CUMULATIVE_ARGS
*ca
,
3694 enum machine_mode mode ATTRIBUTE_UNUSED
,
3695 tree type ATTRIBUTE_UNUSED
,
3696 int *pretend_arg_size
,
3699 if (ca
->regs
< CRIS_MAX_ARGS_IN_REGS
)
3701 int stdarg_regs
= CRIS_MAX_ARGS_IN_REGS
- ca
->regs
;
3702 cfun
->machine
->stdarg_regs
= stdarg_regs
;
3703 *pretend_arg_size
= stdarg_regs
* 4;
3707 fprintf (asm_out_file
,
3708 "\n; VA:: ANSI: %d args before, anon @ #%d, %dtime\n",
3709 ca
->regs
, *pretend_arg_size
, second_time
);
3712 /* Return true if TYPE must be passed by invisible reference.
3713 For cris, we pass <= 8 bytes by value, others by reference. */
3716 cris_pass_by_reference (CUMULATIVE_ARGS
*ca ATTRIBUTE_UNUSED
,
3717 enum machine_mode mode
, const_tree type
,
3718 bool named ATTRIBUTE_UNUSED
)
3720 return (targetm
.calls
.must_pass_in_stack (mode
, type
)
3721 || CRIS_FUNCTION_ARG_SIZE (mode
, type
) > 8);
3726 cris_arg_partial_bytes (CUMULATIVE_ARGS
*ca
, enum machine_mode mode
,
3727 tree type
, bool named ATTRIBUTE_UNUSED
)
3729 if (ca
->regs
== CRIS_MAX_ARGS_IN_REGS
- 1
3730 && !targetm
.calls
.must_pass_in_stack (mode
, type
)
3731 && CRIS_FUNCTION_ARG_SIZE (mode
, type
) > 4
3732 && CRIS_FUNCTION_ARG_SIZE (mode
, type
) <= 8)
3733 return UNITS_PER_WORD
;
3738 /* Worker function for TARGET_MD_ASM_CLOBBERS. */
3741 cris_md_asm_clobbers (tree outputs
, tree inputs
, tree in_clobbers
)
3743 HARD_REG_SET mof_set
;
3747 CLEAR_HARD_REG_SET (mof_set
);
3748 SET_HARD_REG_BIT (mof_set
, CRIS_MOF_REGNUM
);
3750 /* For the time being, all asms clobber condition codes. Revisit when
3751 there's a reasonable use for inputs/outputs that mention condition
3754 = tree_cons (NULL_TREE
,
3755 build_string (strlen (reg_names
[CRIS_CC0_REGNUM
]),
3756 reg_names
[CRIS_CC0_REGNUM
]),
3759 for (t
= outputs
; t
!= NULL
; t
= TREE_CHAIN (t
))
3761 tree val
= TREE_VALUE (t
);
3763 /* The constraint letter for the singleton register class of MOF
3764 is 'h'. If it's mentioned in the constraints, the asm is
3765 MOF-aware and adding it to the clobbers would cause it to have
3766 impossible constraints. */
3767 if (strchr (TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t
))),
3769 || tree_overlaps_hard_reg_set (val
, &mof_set
) != NULL_TREE
)
3773 for (t
= inputs
; t
!= NULL
; t
= TREE_CHAIN (t
))
3775 tree val
= TREE_VALUE (t
);
3777 if (strchr (TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t
))),
3779 || tree_overlaps_hard_reg_set (val
, &mof_set
) != NULL_TREE
)
3783 return tree_cons (NULL_TREE
,
3784 build_string (strlen (reg_names
[CRIS_MOF_REGNUM
]),
3785 reg_names
[CRIS_MOF_REGNUM
]),
3790 /* Various small functions to replace macros. Only called from a
3791 debugger. They might collide with gcc functions or system functions,
3792 so only emit them when '#if 1' above. */
3794 enum rtx_code
Get_code (rtx
);
3799 return GET_CODE (x
);
3802 const char *Get_mode (rtx
);
3807 return GET_MODE_NAME (GET_MODE (x
));
3810 rtx
Xexp (rtx
, int);
3818 rtx
Xvecexp (rtx
, int, int);
3821 Xvecexp (rtx x
, int n
, int m
)
3823 return XVECEXP (x
, n
, m
);
3826 int Get_rtx_len (rtx
);
3831 return GET_RTX_LENGTH (GET_CODE (x
));
3834 /* Use upper-case to distinguish from local variables that are sometimes
3835 called next_insn and prev_insn. */
3837 rtx
Next_insn (rtx
);
3840 Next_insn (rtx insn
)
3842 return NEXT_INSN (insn
);
3845 rtx
Prev_insn (rtx
);
3848 Prev_insn (rtx insn
)
3850 return PREV_INSN (insn
);
3854 #include "gt-cris.h"
3858 * eval: (c-set-style "gnu")
3859 * indent-tabs-mode: t