1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
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 2, 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 COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
25 #include "coretypes.h"
29 #include "hard-reg-set.h"
31 #include "insn-config.h"
32 #include "conditions.h"
33 #include "insn-attr.h"
45 #include "target-def.h"
49 /* Usable when we have an amount to add or subtract, and want the
50 optimal size of the insn. */
51 #define ADDITIVE_SIZE_MODIFIER(size) \
52 ((size) <= 63 ? "q" : (size) <= 255 ? "u.b" : (size) <= 65535 ? "u.w" : ".d")
54 #define ASSERT_PLT_UNSPEC(x) \
57 if (XEXP (x, 1) != NULL_RTX \
58 || (GET_CODE (XVECEXP (x, 0, 0)) != SYMBOL_REF \
59 && GET_CODE (XVECEXP (x, 0, 0)) != LABEL_REF)) \
63 #define LOSE_AND_RETURN(msgid, x) \
66 cris_operand_lossage (msgid, x); \
70 /* Per-function machine data. */
71 struct machine_function
GTY(())
73 int needs_return_address_on_stack
;
76 /* This little fix suppresses the 'u' or 's' when '%e' in assembly
78 static char cris_output_insn_is_bound
= 0;
80 /* This one suppresses printing out the "rPIC+" in
81 "rPIC+sym:GOTOFF+offset" when doing PIC. For a PLT symbol, it
82 suppresses outputting it as [rPIC+sym:GOTPLT] and outputs similarly
83 just the "sym:GOTOFF" part. */
84 static int cris_pic_sympart_only
= 0;
86 /* In code for output macros, this is how we know whether e.g. constant
87 goes in code or in a static initializer. */
88 static int in_code
= 0;
90 /* Fix for reg_overlap_mentioned_p. */
91 static int cris_reg_overlap_mentioned_p (rtx
, rtx
);
93 static void cris_print_base (rtx
, FILE *);
95 static void cris_print_index (rtx
, FILE *);
97 static void cris_output_addr_const (FILE *, rtx
);
99 static struct machine_function
* cris_init_machine_status (void);
101 static rtx
cris_struct_value_rtx (tree
, int);
103 static void cris_setup_incoming_varargs (CUMULATIVE_ARGS
*, enum machine_mode
,
104 tree type
, int *, int);
106 static int cris_initial_frame_pointer_offset (void);
108 static int saved_regs_mentioned (rtx
);
110 static void cris_target_asm_function_prologue (FILE *, HOST_WIDE_INT
);
112 static void cris_target_asm_function_epilogue (FILE *, HOST_WIDE_INT
);
114 static void cris_operand_lossage (const char *, rtx
);
116 static void cris_asm_output_mi_thunk
117 (FILE *, tree
, HOST_WIDE_INT
, HOST_WIDE_INT
, tree
);
119 static void cris_file_start (void);
120 static void cris_init_libfuncs (void);
122 static bool cris_rtx_costs (rtx
, int, int, int *);
123 static int cris_address_cost (rtx
);
124 static bool cris_pass_by_reference (CUMULATIVE_ARGS
*, enum machine_mode
,
126 static int cris_arg_partial_bytes (CUMULATIVE_ARGS
*, enum machine_mode
,
129 /* The function cris_target_asm_function_epilogue puts the last insn to
130 output here. It always fits; there won't be a symbol operand. Used in
131 delay_slots_for_epilogue and function_epilogue. */
132 static char save_last
[80];
134 /* This is the argument from the "-max-stack-stackframe=" option. */
135 const char *cris_max_stackframe_str
;
137 /* This is the argument from the "-march=" option. */
138 const char *cris_cpu_str
;
140 /* This is the argument from the "-mtune=" option. */
141 const char *cris_tune_str
;
143 /* This is the argument from the "-melinux-stacksize=" option. */
144 const char *cris_elinux_stacksize_str
;
146 /* This is the parsed result of the "-max-stack-stackframe=" option. If
147 it (still) is zero, then there was no such option given. */
148 int cris_max_stackframe
= 0;
150 /* This is the parsed result of the "-march=" option, if given. */
151 int cris_cpu_version
= CRIS_DEFAULT_CPU_VERSION
;
153 #undef TARGET_ASM_ALIGNED_HI_OP
154 #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
155 #undef TARGET_ASM_ALIGNED_SI_OP
156 #define TARGET_ASM_ALIGNED_SI_OP "\t.dword\t"
157 #undef TARGET_ASM_ALIGNED_DI_OP
158 #define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t"
160 /* We need to define these, since the 2byte, 4byte, 8byte op:s are only
161 available in ELF. These "normal" pseudos do not have any alignment
162 constraints or side-effects. */
163 #undef TARGET_ASM_UNALIGNED_HI_OP
164 #define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP
166 #undef TARGET_ASM_UNALIGNED_SI_OP
167 #define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP
169 #undef TARGET_ASM_UNALIGNED_DI_OP
170 #define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
172 #undef TARGET_ASM_FUNCTION_PROLOGUE
173 #define TARGET_ASM_FUNCTION_PROLOGUE cris_target_asm_function_prologue
175 #undef TARGET_ASM_FUNCTION_EPILOGUE
176 #define TARGET_ASM_FUNCTION_EPILOGUE cris_target_asm_function_epilogue
178 #undef TARGET_ASM_OUTPUT_MI_THUNK
179 #define TARGET_ASM_OUTPUT_MI_THUNK cris_asm_output_mi_thunk
180 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
181 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
183 #undef TARGET_ASM_FILE_START
184 #define TARGET_ASM_FILE_START cris_file_start
186 #undef TARGET_INIT_LIBFUNCS
187 #define TARGET_INIT_LIBFUNCS cris_init_libfuncs
189 #undef TARGET_RTX_COSTS
190 #define TARGET_RTX_COSTS cris_rtx_costs
191 #undef TARGET_ADDRESS_COST
192 #define TARGET_ADDRESS_COST cris_address_cost
194 #undef TARGET_PROMOTE_FUNCTION_ARGS
195 #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
196 #undef TARGET_STRUCT_VALUE_RTX
197 #define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
198 #undef TARGET_SETUP_INCOMING_VARARGS
199 #define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs
200 #undef TARGET_PASS_BY_REFERENCE
201 #define TARGET_PASS_BY_REFERENCE cris_pass_by_reference
202 #undef TARGET_ARG_PARTIAL_BYTES
203 #define TARGET_ARG_PARTIAL_BYTES cris_arg_partial_bytes
205 struct gcc_target targetm
= TARGET_INITIALIZER
;
207 /* Predicate functions. */
209 /* This checks a part of an address, the one that is not a plain register
210 for an addressing mode using BDAP.
211 Allowed operands is either:
213 b) a CONST operand (but not a symbol when generating PIC)
214 c) a [r] or [r+] in SImode, or sign-extend from HI or QI. */
217 cris_bdap_operand (rtx op
, enum machine_mode mode
)
219 register enum rtx_code code
= GET_CODE (op
);
221 if (mode
!= SImode
&& (mode
!= VOIDmode
|| GET_MODE (op
) != VOIDmode
))
224 /* Just return whether this is a simple register or constant. */
225 if (register_operand (op
, mode
)
226 || (CONSTANT_P (op
) && !(flag_pic
&& cris_symbol (op
))))
229 /* Is it a [r] or possibly a [r+]? */
232 rtx tem
= XEXP (op
, 0);
235 && (register_operand (tem
, SImode
)
236 || (GET_CODE (tem
) == POST_INC
237 && register_operand (XEXP (tem
, 0), SImode
))))
243 /* Perhaps a sign-extended mem: [r].(b|w) or [r+].(b|w)? */
244 if (code
== SIGN_EXTEND
)
246 rtx tem
= XEXP (op
, 0);
248 if (GET_CODE (tem
) != MEM
)
253 && (register_operand (tem
, SImode
)
254 || (GET_CODE (tem
) == POST_INC
255 && register_operand (XEXP (tem
, 0), SImode
))))
264 /* This is similar to cris_bdap_operand:
265 It checks a part of an address, the one that is not a plain register
266 for an addressing mode using BDAP *or* BIAP.
267 Allowed operands is either:
269 b) a CONST operand (but not a symbol when generating PIC)
270 c) a mult of (1, 2 or 4) and a register
271 d) a [r] or [r+] in SImode, or sign-extend from HI or QI. */
274 cris_bdap_biap_operand (rtx op
, enum machine_mode mode
)
276 register enum rtx_code code
= GET_CODE (op
);
280 /* Check for bdap operand. */
281 if (cris_bdap_operand (op
, mode
))
284 if (mode
!= SImode
&& (mode
!= VOIDmode
|| GET_MODE (op
) != VOIDmode
))
287 /* Check that we're looking at a BIAP operand. */
291 /* Canonicalize register and multiplicand. */
292 if (GET_CODE (XEXP (op
, 0)) == CONST_INT
)
303 /* Check that the operands are correct after canonicalization. */
304 if (! register_operand (reg
, SImode
) || GET_CODE (val
) != CONST_INT
)
307 /* Check that the multiplicand has a valid value. */
309 && (INTVAL (val
) == 1 || INTVAL (val
) == 2 || INTVAL (val
) == 4)))
315 /* Check if MODE is same as mode for X, and X is PLUS, MINUS, IOR or
319 cris_orthogonal_operator (rtx x
, enum machine_mode mode
)
321 enum rtx_code code
= GET_CODE (x
);
323 if (mode
== VOIDmode
)
326 return (GET_MODE (x
) == mode
327 && (code
== PLUS
|| code
== MINUS
328 || code
== IOR
|| code
== AND
|| code
== UMIN
));
331 /* Check if MODE is same as mode for X, and X is PLUS, IOR or AND or
335 cris_commutative_orth_op (rtx x
, enum machine_mode mode
)
337 enum rtx_code code
= GET_CODE (x
);
339 if (mode
== VOIDmode
)
342 return (GET_MODE (x
) == mode
&&
344 || code
== IOR
|| code
== AND
|| code
== UMIN
));
347 /* Check if MODE is same as mode for X, and X is PLUS or MINUS or UMIN.
348 By the name, you might think we should include MULT. We don't because
349 it doesn't accept the same addressing modes as the others (ony
350 registers) and there's also the problem of handling TARGET_MUL_BUG. */
353 cris_operand_extend_operator (rtx x
, enum machine_mode mode
)
355 enum rtx_code code
= GET_CODE (x
);
357 if (mode
== VOIDmode
)
360 return (GET_MODE (x
) == mode
361 && (code
== PLUS
|| code
== MINUS
|| code
== UMIN
));
364 /* Check if MODE is same as mode for X, and X is PLUS or MINUS. */
367 cris_additive_operand_extend_operator (rtx x
, enum machine_mode mode
)
369 enum rtx_code code
= GET_CODE (x
);
371 if (mode
== VOIDmode
)
374 return (GET_MODE (x
) == mode
375 && (code
== PLUS
|| code
== MINUS
));
378 /* Check to see if MODE is same as mode for X, and X is SIGN_EXTEND or
382 cris_extend_operator (rtx x
, enum machine_mode mode
)
384 enum rtx_code code
= GET_CODE (x
);
386 if (mode
== VOIDmode
)
390 (GET_MODE (x
) == mode
&& (code
== SIGN_EXTEND
|| code
== ZERO_EXTEND
));
393 /* Check to see if MODE is same as mode for X, and X is PLUS or BOUND. */
396 cris_plus_or_bound_operator (rtx x
, enum machine_mode mode
)
398 enum rtx_code code
= GET_CODE (x
);
400 if (mode
== VOIDmode
)
404 (GET_MODE (x
) == mode
&& (code
== UMIN
|| code
== PLUS
));
407 /* Used as an operator to get a handle on a already-known-valid MEM rtx:es
408 (no need to validate the address), where some address expression parts
409 have their own match_operand. */
412 cris_mem_op (rtx x
, enum machine_mode mode
)
414 if (mode
== VOIDmode
)
417 return GET_MODE (x
) == mode
&& GET_CODE (x
) == MEM
;
420 /* Since with -fPIC, not all symbols are valid PIC symbols or indeed
421 general_operands, we have to have a predicate that matches it for the
425 cris_general_operand_or_symbol (rtx op
, enum machine_mode mode
)
427 return general_operand (op
, mode
)
428 || (CONSTANT_P (op
) && cris_symbol (op
));
431 /* Since a PIC symbol without a GOT entry is not a general_operand, we
432 have to have a predicate that matches it. We use this in the expanded
433 "movsi" anonymous pattern for PIC symbols. */
436 cris_general_operand_or_gotless_symbol (rtx op
, enum machine_mode mode
)
438 return general_operand (op
, mode
)
439 || (CONSTANT_P (op
) && cris_gotless_symbol (op
));
442 /* Since a PLT symbol is not a general_operand, we have to have a
443 predicate that matches it when we need it. We use this in the expanded
444 "call" and "call_value" anonymous patterns. */
447 cris_general_operand_or_plt_symbol (rtx op
, enum machine_mode mode
)
449 return general_operand (op
, mode
)
450 || (GET_CODE (op
) == CONST
451 && GET_CODE (XEXP (op
, 0)) == UNSPEC
452 && !TARGET_AVOID_GOTPLT
);
455 /* This matches a (MEM (general_operand)) or
456 (MEM (cris_general_operand_or_symbol)). The second one isn't a valid
457 memory_operand, so we need this predicate to recognize call
458 destinations before we change them to a PLT operand (by wrapping in
462 cris_mem_call_operand (rtx op
, enum machine_mode mode
)
466 if (GET_CODE (op
) != MEM
)
469 if (memory_operand (op
, mode
))
474 return cris_general_operand_or_symbol (xmem
, GET_MODE (op
));
477 /* The CONDITIONAL_REGISTER_USAGE worker. */
480 cris_conditional_register_usage (void)
482 /* FIXME: This isn't nice. We should be able to use that register for
483 something else if the PIC table isn't needed. */
485 fixed_regs
[PIC_OFFSET_TABLE_REGNUM
]
486 = call_used_regs
[PIC_OFFSET_TABLE_REGNUM
] = 1;
489 /* Return current_function_uses_pic_offset_table. For use in cris.md,
490 since some generated files do not include function.h. */
493 cris_cfun_uses_pic_table (void)
495 return current_function_uses_pic_offset_table
;
498 /* Given an rtx, return the text string corresponding to the CODE of X.
499 Intended for use in the assembly language output section of a
505 cris_output_insn_is_bound
= 0;
506 switch (GET_CODE (x
))
517 /* This function is for retrieving a part of an instruction name for
518 an operator, for immediate output. If that ever happens for
519 MULT, we need to apply TARGET_MUL_BUG in the caller. Make sure
557 /* Used to control the sign/zero-extend character for the 'e' modifier.
559 cris_output_insn_is_bound
= 1;
564 return "Unknown operator";
569 /* Emit an error message when we're in an asm, and a fatal error for
570 "normal" insns. Formatted output isn't easily implemented, since we
571 use output_operand_lossage to output the actual message and handle the
572 categorization of the error. */
575 cris_operand_lossage (const char *msgid
, rtx op
)
578 output_operand_lossage ("%s", msgid
);
581 /* Print an index part of an address to file. */
584 cris_print_index (rtx index
, FILE *file
)
586 rtx inner
= XEXP (index
, 0);
588 /* Make the index "additive" unless we'll output a negative number, in
589 which case the sign character is free (as in free beer). */
590 if (GET_CODE (index
) != CONST_INT
|| INTVAL (index
) >= 0)
594 fprintf (file
, "$%s.b", reg_names
[REGNO (index
)]);
595 else if (CONSTANT_P (index
))
596 cris_output_addr_const (file
, index
);
597 else if (GET_CODE (index
) == MULT
)
599 fprintf (file
, "$%s.",
600 reg_names
[REGNO (XEXP (index
, 0))]);
602 putc (INTVAL (XEXP (index
, 1)) == 2 ? 'w' : 'd', file
);
604 else if (GET_CODE (index
) == SIGN_EXTEND
&&
605 GET_CODE (inner
) == MEM
)
607 rtx inner_inner
= XEXP (inner
, 0);
609 if (GET_CODE (inner_inner
) == POST_INC
)
611 fprintf (file
, "[$%s+].",
612 reg_names
[REGNO (XEXP (inner_inner
, 0))]);
613 putc (GET_MODE (inner
) == HImode
? 'w' : 'b', file
);
617 fprintf (file
, "[$%s].", reg_names
[REGNO (inner_inner
)]);
619 putc (GET_MODE (inner
) == HImode
? 'w' : 'b', file
);
622 else if (GET_CODE (index
) == MEM
)
624 if (GET_CODE (inner
) == POST_INC
)
625 fprintf (file
, "[$%s+].d", reg_names
[REGNO (XEXP (inner
, 0))]);
627 fprintf (file
, "[$%s].d", reg_names
[REGNO (inner
)]);
630 cris_operand_lossage ("unexpected index-type in cris_print_index",
634 /* Print a base rtx of an address to file. */
637 cris_print_base (rtx base
, FILE *file
)
640 fprintf (file
, "$%s", reg_names
[REGNO (base
)]);
641 else if (GET_CODE (base
) == POST_INC
)
642 fprintf (file
, "$%s+", reg_names
[REGNO (XEXP (base
, 0))]);
644 cris_operand_lossage ("unexpected base-type in cris_print_base",
648 /* Usable as a guard in expressions. */
651 cris_fatal (char *arg
)
653 internal_error (arg
);
655 /* We'll never get here; this is just to appease compilers. */
659 /* This variable belongs to cris_target_asm_function_prologue but must
660 be located outside it for GTY reasons. */
661 static GTY(()) unsigned long cfa_label_num
= 0;
663 /* Textual function prologue. */
666 cris_target_asm_function_prologue (FILE *file
, HOST_WIDE_INT size
)
670 /* Shorten the used name for readability. */
671 int cfoa_size
= current_function_outgoing_args_size
;
672 int last_movem_reg
= -1;
673 int doing_dwarf
= dwarf2out_do_frame ();
675 int faked_args_size
= 0;
676 int cfa_write_offset
= 0;
677 static char cfa_label
[30];
678 int return_address_on_stack
679 = regs_ever_live
[CRIS_SRP_REGNUM
]
680 || cfun
->machine
->needs_return_address_on_stack
!= 0;
682 /* Don't do anything if no prologues or epilogues are wanted. */
683 if (!TARGET_PROLOGUE_EPILOGUE
)
689 /* Align the size to what's best for the CPU model. */
690 if (TARGET_STACK_ALIGN
)
691 size
= TARGET_ALIGN_BY_32
? (size
+ 3) & ~3 : (size
+ 1) & ~1;
693 if (current_function_pretend_args_size
)
695 int pretend
= current_function_pretend_args_size
;
696 for (regno
= CRIS_FIRST_ARG_REG
+ CRIS_MAX_ARGS_IN_REGS
- 1;
698 regno
--, pretend
-= 4)
700 fprintf (file
, "\tpush $%s\n", reg_names
[regno
]);
701 faked_args_size
+= 4;
705 framesize
= faked_args_size
;
709 /* FIXME: Slightly redundant calculation, as we do the same in
710 pieces below. This offset must be the total adjustment of the
711 stack-pointer. We can then def_cfa call at the end of this
712 function with the current implementation of execute_cfa_insn, but
713 that wouldn't really be clean. */
717 + (return_address_on_stack
? 4 : 0)
718 + (frame_pointer_needed
? 4 : 0);
722 if (frame_pointer_needed
)
723 cfa_reg
= FRAME_POINTER_REGNUM
;
726 cfa_reg
= STACK_POINTER_REGNUM
;
727 cfa_offset
+= cris_initial_frame_pointer_offset ();
730 ASM_GENERATE_INTERNAL_LABEL (cfa_label
, "LCFIT",
732 dwarf2out_def_cfa (cfa_label
, cfa_reg
, cfa_offset
);
734 cfa_write_offset
= - faked_args_size
- 4;
737 /* Save SRP if not a leaf function. */
738 if (return_address_on_stack
)
740 fprintf (file
, "\tPush $srp\n");
745 dwarf2out_return_save (cfa_label
, cfa_write_offset
);
746 cfa_write_offset
-= 4;
750 /* Set up frame pointer if needed. */
751 if (frame_pointer_needed
)
753 fprintf (file
, "\tpush $%s\n\tmove.d $sp,$%s\n",
754 reg_names
[FRAME_POINTER_REGNUM
],
755 reg_names
[FRAME_POINTER_REGNUM
]);
760 dwarf2out_reg_save (cfa_label
, FRAME_POINTER_REGNUM
,
762 cfa_write_offset
-= 4;
766 /* Local vars are located above saved regs. */
767 cfa_write_offset
-= size
;
769 /* Get a contiguous sequence of registers, starting with r0, that need
771 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
773 if ((((regs_ever_live
[regno
]
774 && !call_used_regs
[regno
])
775 || (regno
== (int) PIC_OFFSET_TABLE_REGNUM
776 && (current_function_uses_pic_offset_table
777 /* It is saved anyway, if there would be a gap. */
779 && regs_ever_live
[regno
+ 1]
780 && !call_used_regs
[regno
+ 1]))))
781 && (regno
!= FRAME_POINTER_REGNUM
|| !frame_pointer_needed
)
782 && regno
!= CRIS_SRP_REGNUM
)
783 || (current_function_calls_eh_return
784 && (regno
== EH_RETURN_DATA_REGNO (0)
785 || regno
== EH_RETURN_DATA_REGNO (1)
786 || regno
== EH_RETURN_DATA_REGNO (2)
787 || regno
== EH_RETURN_DATA_REGNO (3))))
789 /* Check if movem may be used for registers so far. */
790 if (regno
== last_movem_reg
+ 1)
791 /* Yes, update next expected register. */
795 /* We cannot use movem for all registers. We have to flush
796 any movem:ed registers we got so far. */
797 if (last_movem_reg
!= -1)
799 /* It is a win to use a side-effect assignment for
800 64 <= size <= 128. But side-effect on movem was
801 not usable for CRIS v0..3. Also only do it if
802 side-effects insns are allowed. */
803 if ((last_movem_reg
+ 1) * 4 + size
>= 64
804 && (last_movem_reg
+ 1) * 4 + size
<= 128
805 && cris_cpu_version
>= CRIS_CPU_SVINTO
806 && TARGET_SIDE_EFFECT_PREFIXES
)
807 fprintf (file
, "\tmovem $%s,[$sp=$sp-"HOST_WIDE_INT_PRINT_DEC
"]\n",
808 reg_names
[last_movem_reg
],
809 (last_movem_reg
+ 1) * 4 + size
);
812 /* Avoid printing multiple subsequent sub:s for sp. */
813 fprintf (file
, "\tsub%s "HOST_WIDE_INT_PRINT_DEC
",$sp\n",
814 ADDITIVE_SIZE_MODIFIER ((last_movem_reg
+ 1)
816 (last_movem_reg
+ 1) * 4 + size
);
818 fprintf (file
, "\tmovem $%s,[$sp]\n",
819 reg_names
[last_movem_reg
]);
822 framesize
+= (last_movem_reg
+ 1) * 4 + size
;
825 fprintf (file
, "; frame "HOST_WIDE_INT_PRINT_DEC
826 ", #regs %d, bytes %d args %d\n",
829 (last_movem_reg
+ 1) * 4,
830 current_function_args_size
);
837 /* Local vars on stack, but there are no movem:s.
838 Just allocate space. */
839 fprintf (file
, "\tSub%s "HOST_WIDE_INT_PRINT_DEC
",$sp\n",
840 ADDITIVE_SIZE_MODIFIER (size
),
846 fprintf (file
, "\tPush $%s\n", reg_names
[regno
]);
852 /* Registers are stored lowest numbered at highest address,
853 which matches the loop order; we just need to update the
855 dwarf2out_reg_save (cfa_label
, regno
, cfa_write_offset
);
856 cfa_write_offset
-= 4;
861 /* Check after, if we can movem all registers. This is the normal
863 if (last_movem_reg
!= -1)
865 /* Side-effect assignment on movem was not supported for CRIS v0..3,
866 and don't do it if we're asked not to.
868 The movem is already accounted for, for unwind. */
870 if ((last_movem_reg
+ 1) * 4 + size
>= 64
871 && (last_movem_reg
+ 1) * 4 + size
<= 128
872 && cris_cpu_version
>= CRIS_CPU_SVINTO
873 && TARGET_SIDE_EFFECT_PREFIXES
)
874 fprintf (file
, "\tmovem $%s,[$sp=$sp-"HOST_WIDE_INT_PRINT_DEC
"]\n",
875 reg_names
[last_movem_reg
],
876 (last_movem_reg
+1) * 4 + size
);
879 /* Avoid printing multiple subsequent sub:s for sp. FIXME:
880 Clean up the conditional expression. */
881 fprintf (file
, "\tsub%s "HOST_WIDE_INT_PRINT_DEC
",$sp\n",
882 ADDITIVE_SIZE_MODIFIER ((last_movem_reg
+ 1) * 4 + size
),
883 (last_movem_reg
+ 1) * 4 + size
);
884 /* To be compatible with v0..v3 means we do not use an assignment
885 addressing mode with movem. We normally don't need that
886 anyway. It would only be slightly more efficient for 64..128
888 fprintf (file
, "\tmovem $%s,[$sp]\n", reg_names
[last_movem_reg
]);
891 framesize
+= (last_movem_reg
+ 1) * 4 + size
;
894 fprintf (file
, "; frame "HOST_WIDE_INT_PRINT_DEC
895 ", #regs %d, bytes %d args %d\n",
898 (last_movem_reg
+ 1) * 4,
899 current_function_args_size
);
901 /* We have to put outgoing argument space after regs. */
904 /* This does not need to be accounted for, for unwind. */
906 fprintf (file
, "\tSub%s %d,$sp\n",
907 ADDITIVE_SIZE_MODIFIER (cfoa_size
),
909 framesize
+= cfoa_size
;
912 else if ((size
+ cfoa_size
) > 0)
914 /* This does not need to be accounted for, for unwind. */
916 /* Local vars on stack, and we could not use movem. Add a sub here. */
917 fprintf (file
, "\tSub%s "HOST_WIDE_INT_PRINT_DEC
",$sp\n",
918 ADDITIVE_SIZE_MODIFIER (size
+ cfoa_size
),
920 framesize
+= size
+ cfoa_size
;
923 /* Set up the PIC register. */
924 if (current_function_uses_pic_offset_table
)
925 fprintf (file
, "\tmove.d $pc,$%s\n\tsub.d .:GOTOFF,$%s\n",
926 reg_names
[PIC_OFFSET_TABLE_REGNUM
],
927 reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
930 ASM_OUTPUT_LABEL (file
, cfa_label
);
934 "; parm #%d @ %d; frame " HOST_WIDE_INT_PRINT_DEC
935 ", FP-SP is %d; leaf: %s%s; fp %s, outg: %d arg %d\n",
936 CRIS_MAX_ARGS_IN_REGS
+ 1, FIRST_PARM_OFFSET (0),
938 cris_initial_frame_pointer_offset (),
939 leaf_function_p () ? "yes" : "no",
940 return_address_on_stack
? "no" :"yes",
941 frame_pointer_needed
? "yes" : "no",
942 cfoa_size
, current_function_args_size
);
944 if (cris_max_stackframe
&& framesize
> cris_max_stackframe
)
945 warning ("stackframe too big: %d bytes", framesize
);
948 /* Return nonzero if there are regs mentioned in the insn that are not all
949 in the call_used regs. This is part of the decision whether an insn
950 can be put in the epilogue. */
953 saved_regs_mentioned (rtx x
)
959 /* Mainly stolen from refers_to_regno_p in rtlanal.c. */
967 return !call_used_regs
[i
];
970 /* If this is a SUBREG of a hard reg, we can see exactly which
971 registers are being modified. Otherwise, handle normally. */
972 i
= REGNO (SUBREG_REG (x
));
973 return !call_used_regs
[i
];
979 fmt
= GET_RTX_FORMAT (code
);
980 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
984 if (saved_regs_mentioned (XEXP (x
, i
)))
987 else if (fmt
[i
] == 'E')
990 for (j
= XVECLEN (x
, i
) - 1; j
>=0; j
--)
991 if (saved_regs_mentioned (XEXP (x
, i
)))
999 /* Figure out if the insn may be put in the epilogue. */
1002 cris_eligible_for_epilogue_delay (rtx insn
)
1004 /* First of all, it must be as slottable as for a delayed branch insn. */
1005 if (get_attr_slottable (insn
) != SLOTTABLE_YES
)
1008 /* It must not refer to the stack pointer (may be valid for some cases
1009 that I can't think of). */
1010 if (reg_mentioned_p (stack_pointer_rtx
, PATTERN (insn
)))
1013 /* The frame pointer will be restored in the epilogue, before the
1014 "ret", so it can't be referred to. */
1015 if (frame_pointer_needed
1016 && reg_mentioned_p (frame_pointer_rtx
, PATTERN (insn
)))
1019 /* All saved regs are restored before the delayed insn.
1020 This means that we cannot have any instructions that mention the
1021 registers that are restored by the epilogue. */
1022 if (saved_regs_mentioned (PATTERN (insn
)))
1025 /* It seems to be ok. */
1029 /* Return the number of delay-slots in the epilogue: return 1 if it
1030 contains "ret", else 0. */
1033 cris_delay_slots_for_epilogue (void)
1035 /* Check if we use a return insn, which we only do for leaf functions.
1036 Else there is no slot to fill. */
1037 if (regs_ever_live
[CRIS_SRP_REGNUM
]
1038 || cfun
->machine
->needs_return_address_on_stack
!= 0)
1041 /* By calling function_epilogue with the same parameters as from gcc
1042 we can get info about if the epilogue can fill the delay-slot by itself.
1043 If it is filled from the epilogue, then the corresponding string
1045 This depends on that the "size" argument to function_epilogue
1046 always is get_frame_size.
1047 FIXME: Kludgy. At least make it a separate function that is not
1048 misnamed or abuses the stream parameter. */
1049 cris_target_asm_function_epilogue (NULL
, get_frame_size ());
1056 /* Textual function epilogue. When file is NULL, it serves doubly as
1057 a test for whether the epilogue can fill any "ret" delay-slots by
1058 itself by storing the delay insn in save_last. */
1061 cris_target_asm_function_epilogue (FILE *file
, HOST_WIDE_INT size
)
1064 int last_movem_reg
= -1;
1065 rtx insn
= get_last_insn ();
1066 int argspace_offset
= current_function_outgoing_args_size
;
1067 int pretend
= current_function_pretend_args_size
;
1068 int return_address_on_stack
1069 = regs_ever_live
[CRIS_SRP_REGNUM
]
1070 || cfun
->machine
->needs_return_address_on_stack
!= 0;
1074 if (file
&& !TARGET_PROLOGUE_EPILOGUE
)
1077 if (TARGET_PDEBUG
&& file
)
1078 fprintf (file
, ";;\n");
1080 /* Align byte count of stack frame. */
1081 if (TARGET_STACK_ALIGN
)
1082 size
= TARGET_ALIGN_BY_32
? (size
+ 3) & ~3 : (size
+ 1) & ~1;
1084 /* If the last insn was a BARRIER, we don't have to write any code,
1085 then all returns were covered by "return" insns. */
1086 if (GET_CODE (insn
) == NOTE
)
1087 insn
= prev_nonnote_insn (insn
);
1089 && (GET_CODE (insn
) == BARRIER
1090 /* We must make sure that the insn really is a "return" and
1091 not a conditional branch. Try to match the return exactly,
1092 and if it doesn't match, assume it is a conditional branch
1093 (and output an epilogue). */
1094 || (GET_CODE (insn
) == JUMP_INSN
1095 && GET_CODE (PATTERN (insn
)) == RETURN
)))
1097 if (TARGET_PDEBUG
&& file
)
1098 fprintf (file
, ";;;;;\n");
1102 /* Check how many saved regs we can movem. They start at r0 and must
1105 regno
< FIRST_PSEUDO_REGISTER
;
1107 if ((((regs_ever_live
[regno
]
1108 && !call_used_regs
[regno
])
1109 || (regno
== (int) PIC_OFFSET_TABLE_REGNUM
1110 && (current_function_uses_pic_offset_table
1111 /* It is saved anyway, if there would be a gap. */
1113 && regs_ever_live
[regno
+ 1]
1114 && !call_used_regs
[regno
+ 1]))))
1115 && (regno
!= FRAME_POINTER_REGNUM
|| !frame_pointer_needed
)
1116 && regno
!= CRIS_SRP_REGNUM
)
1117 || (current_function_calls_eh_return
1118 && (regno
== EH_RETURN_DATA_REGNO (0)
1119 || regno
== EH_RETURN_DATA_REGNO (1)
1120 || regno
== EH_RETURN_DATA_REGNO (2)
1121 || regno
== EH_RETURN_DATA_REGNO (3))))
1124 if (regno
== last_movem_reg
+ 1)
1130 for (regno
= FIRST_PSEUDO_REGISTER
- 1;
1131 regno
> last_movem_reg
;
1133 if ((((regs_ever_live
[regno
]
1134 && !call_used_regs
[regno
])
1135 || (regno
== (int) PIC_OFFSET_TABLE_REGNUM
1136 && (current_function_uses_pic_offset_table
1137 /* It is saved anyway, if there would be a gap. */
1139 && regs_ever_live
[regno
+ 1]
1140 && !call_used_regs
[regno
+ 1]))))
1141 && (regno
!= FRAME_POINTER_REGNUM
|| !frame_pointer_needed
)
1142 && regno
!= CRIS_SRP_REGNUM
)
1143 || (current_function_calls_eh_return
1144 && (regno
== EH_RETURN_DATA_REGNO (0)
1145 || regno
== EH_RETURN_DATA_REGNO (1)
1146 || regno
== EH_RETURN_DATA_REGNO (2)
1147 || regno
== EH_RETURN_DATA_REGNO (3))))
1149 if (argspace_offset
)
1151 /* There is an area for outgoing parameters located before
1152 the saved registers. We have to adjust for that. */
1154 fprintf (file
, "\tAdd%s %d,$sp\n",
1155 ADDITIVE_SIZE_MODIFIER (argspace_offset
),
1158 /* Make sure we only do this once. */
1159 argspace_offset
= 0;
1162 /* Flush previous non-movem:ed registers. */
1163 if (*save_last
&& file
)
1164 fprintf (file
, save_last
);
1165 sprintf (save_last
, "\tPop $%s\n", reg_names
[regno
]);
1168 if (last_movem_reg
!= -1)
1170 if (argspace_offset
)
1172 /* Adjust for the outgoing parameters area, if that's not
1174 if (*save_last
&& file
)
1176 fprintf (file
, save_last
);
1181 fprintf (file
, "\tAdd%s %d,$sp\n",
1182 ADDITIVE_SIZE_MODIFIER (argspace_offset
),
1184 argspace_offset
= 0;
1186 /* Flush previous non-movem:ed registers. */
1187 else if (*save_last
&& file
)
1188 fprintf (file
, save_last
);
1189 sprintf (save_last
, "\tmovem [$sp+],$%s\n", reg_names
[last_movem_reg
]);
1192 /* Restore frame pointer if necessary. */
1193 if (frame_pointer_needed
)
1195 if (*save_last
&& file
)
1196 fprintf (file
, save_last
);
1199 fprintf (file
, "\tmove.d $%s,$sp\n",
1200 reg_names
[FRAME_POINTER_REGNUM
]);
1201 sprintf (save_last
, "\tPop $%s\n",
1202 reg_names
[FRAME_POINTER_REGNUM
]);
1206 /* If there was no frame-pointer to restore sp from, we must
1207 explicitly deallocate local variables. */
1209 /* Handle space for outgoing parameters that hasn't been handled
1211 size
+= argspace_offset
;
1215 if (*save_last
&& file
)
1216 fprintf (file
, save_last
);
1218 sprintf (save_last
, "\tadd%s "HOST_WIDE_INT_PRINT_DEC
",$sp\n",
1219 ADDITIVE_SIZE_MODIFIER (size
), size
);
1222 /* If the size was not in the range for a "quick", we must flush
1227 fprintf (file
, save_last
);
1232 /* If this function has no pushed register parameters
1233 (stdargs/varargs), and if it is not a leaf function, then we can
1234 just jump-return here. */
1235 if (return_address_on_stack
&& pretend
== 0)
1237 if (*save_last
&& file
)
1238 fprintf (file
, save_last
);
1243 if (current_function_calls_eh_return
)
1245 /* The installed EH-return address is in *this* frame, so we
1246 need to pop it before we return. */
1247 fprintf (file
, "\tpop $srp\n");
1248 fprintf (file
, "\tret\n");
1249 fprintf (file
, "\tadd.d $%s,$sp\n", reg_names
[CRIS_STACKADJ_REG
]);
1252 fprintf (file
, "\tJump [$sp+]\n");
1254 /* Do a sanity check to avoid generating invalid code. */
1255 if (current_function_epilogue_delay_list
)
1256 internal_error ("allocated but unused delay list in epilogue");
1261 /* Rather than add current_function_calls_eh_return conditions
1262 everywhere in the following code (and not be able to test it
1263 thoroughly), assert the assumption that all usage of
1264 __builtin_eh_return are handled above. */
1265 if (current_function_calls_eh_return
)
1266 internal_error ("unexpected function type needing stack adjustment for\
1267 __builtin_eh_return");
1269 /* If we pushed some register parameters, then adjust the stack for
1273 /* Since srp is stored on the way, we need to restore it first. */
1274 if (return_address_on_stack
)
1276 if (*save_last
&& file
)
1277 fprintf (file
, save_last
);
1281 fprintf (file
, "\tpop $srp\n");
1284 if (*save_last
&& file
)
1285 fprintf (file
, save_last
);
1287 sprintf (save_last
, "\tadd%s %d,$sp\n",
1288 ADDITIVE_SIZE_MODIFIER (pretend
), pretend
);
1291 /* Here's where we have a delay-slot we need to fill. */
1292 if (file
&& current_function_epilogue_delay_list
)
1294 /* If gcc has allocated an insn for the epilogue delay slot, but
1295 things were arranged so we now thought we could do it
1296 ourselves, don't forget to flush that insn. */
1298 fprintf (file
, save_last
);
1300 fprintf (file
, "\tRet\n");
1302 /* Output the delay-slot-insn the mandated way. */
1303 final_scan_insn (XEXP (current_function_epilogue_delay_list
, 0),
1304 file
, 1, -2, 1, NULL
);
1308 fprintf (file
, "\tRet\n");
1310 /* If the GCC did not do it, we have to use whatever insn we have,
1313 fprintf (file
, save_last
);
1315 fprintf (file
, "\tnOp\n");
1319 /* The PRINT_OPERAND worker. */
1322 cris_print_operand (FILE *file
, rtx x
, int code
)
1326 /* Size-strings corresponding to MULT expressions. */
1327 static const char *const mults
[] = { "BAD:0", ".b", ".w", "BAD:3", ".d" };
1329 /* New code entries should just be added to the switch below. If
1330 handling is finished, just return. If handling was just a
1331 modification of the operand, the modified operand should be put in
1332 "operand", and then do a break to let default handling
1333 (zero-modifier) output the operand. */
1338 /* Print the unsigned supplied integer as if it were signed
1339 and < 0, i.e print 255 or 65535 as -1, 254, 65534 as -2, etc. */
1340 if (GET_CODE (x
) != CONST_INT
1341 || ! CONST_OK_FOR_LETTER_P (INTVAL (x
), 'O'))
1342 LOSE_AND_RETURN ("invalid operand for 'b' modifier", x
);
1343 fprintf (file
, HOST_WIDE_INT_PRINT_DEC
,
1344 INTVAL (x
)| (INTVAL (x
) <= 255 ? ~255 : ~65535));
1348 /* Print assembler code for operator. */
1349 fprintf (file
, "%s", cris_op_str (operand
));
1353 /* Print the operand without the PIC register. */
1354 if (! flag_pic
|| ! CONSTANT_P (x
) || ! cris_gotless_symbol (x
))
1355 LOSE_AND_RETURN ("invalid operand for 'v' modifier", x
);
1356 cris_pic_sympart_only
++;
1357 cris_output_addr_const (file
, x
);
1358 cris_pic_sympart_only
--;
1362 /* Print the PIC register. Applied to a GOT-less PIC symbol for
1364 if (! flag_pic
|| ! CONSTANT_P (x
) || ! cris_gotless_symbol (x
))
1365 LOSE_AND_RETURN ("invalid operand for 'P' modifier", x
);
1366 fprintf (file
, "$%s", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
1370 /* Adjust a power of two to its log2. */
1371 if (GET_CODE (x
) != CONST_INT
|| exact_log2 (INTVAL (x
)) < 0 )
1372 LOSE_AND_RETURN ("invalid operand for 'p' modifier", x
);
1373 fprintf (file
, "%d", exact_log2 (INTVAL (x
)));
1377 /* For an integer, print 'b' or 'w' if <= 255 or <= 65535
1378 respectively. This modifier also terminates the inhibiting
1379 effects of the 'x' modifier. */
1380 cris_output_insn_is_bound
= 0;
1381 if (GET_MODE (x
) == VOIDmode
&& GET_CODE (x
) == CONST_INT
)
1383 if (INTVAL (x
) >= 0)
1385 if (INTVAL (x
) <= 255)
1387 else if (INTVAL (x
) <= 65535)
1397 /* For a non-integer, print the size of the operand. */
1398 putc ((GET_MODE (x
) == SImode
|| GET_MODE (x
) == SFmode
)
1399 ? 'd' : GET_MODE (x
) == HImode
? 'w'
1400 : GET_MODE (x
) == QImode
? 'b'
1401 /* If none of the above, emit an erroneous size letter. */
1407 /* Const_int: print b for -127 <= x <= 255,
1408 w for -32768 <= x <= 65535, else abort. */
1409 if (GET_CODE (x
) != CONST_INT
1410 || INTVAL (x
) < -32768 || INTVAL (x
) > 65535)
1411 LOSE_AND_RETURN ("invalid operand for 'z' modifier", x
);
1412 putc (INTVAL (x
) >= -128 && INTVAL (x
) <= 255 ? 'b' : 'w', file
);
1416 /* Output a 'nop' if there's nothing for the delay slot.
1417 This method stolen from the sparc files. */
1418 if (dbr_sequence_length () == 0)
1419 fputs ("\n\tnop", file
);
1423 /* Output directive for alignment padded with "nop" insns.
1424 Optimizing for size, it's plain 4-byte alignment, otherwise we
1425 align the section to a cache-line (32 bytes) and skip at max 2
1426 bytes, i.e. we skip if it's the last insn on a cache-line. The
1427 latter is faster by a small amount (for two test-programs 99.6%
1428 and 99.9%) and larger by a small amount (ditto 100.1% and
1429 100.2%). This is supposed to be the simplest yet performance-
1430 wise least intrusive way to make sure the immediately following
1431 (supposed) muls/mulu insn isn't located at the end of a
1434 fputs (optimize_size
1435 ? ".p2alignw 2,0x050f\n\t"
1436 : ".p2alignw 5,0x050f,2\n\t", file
);
1440 /* Print high (most significant) part of something. */
1441 switch (GET_CODE (operand
))
1444 if (HOST_BITS_PER_WIDE_INT
== 32)
1445 /* Sign-extension from a normal int to a long long. */
1446 fprintf (file
, INTVAL (operand
) < 0 ? "-1" : "0");
1448 fprintf (file
, "0x%x", (unsigned int)(INTVAL (x
) >> 31 >> 1));
1452 /* High part of a long long constant. */
1453 if (GET_MODE (operand
) == VOIDmode
)
1455 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
, CONST_DOUBLE_HIGH (x
));
1459 LOSE_AND_RETURN ("invalid operand for 'H' modifier", x
);
1462 /* Print reg + 1. Check that there's not an attempt to print
1463 high-parts of registers like stack-pointer or higher. */
1464 if (REGNO (operand
) > STACK_POINTER_REGNUM
- 2)
1465 LOSE_AND_RETURN ("bad register", operand
);
1466 fprintf (file
, "$%s", reg_names
[REGNO (operand
) + 1]);
1470 /* Adjust memory address to high part. */
1472 rtx adj_mem
= operand
;
1474 = GET_MODE_BITSIZE (GET_MODE (operand
)) / BITS_PER_UNIT
;
1476 /* Adjust so we can use two SImode in DImode.
1477 Calling adj_offsettable_operand will make sure it is an
1478 offsettable address. Don't do this for a postincrement
1479 though; it should remain as it was. */
1480 if (GET_CODE (XEXP (adj_mem
, 0)) != POST_INC
)
1482 = adjust_address (adj_mem
, GET_MODE (adj_mem
), size
/ 2);
1484 output_address (XEXP (adj_mem
, 0));
1489 LOSE_AND_RETURN ("invalid operand for 'H' modifier", x
);
1493 /* Strip the MEM expression. */
1494 operand
= XEXP (operand
, 0);
1498 /* Print 's' if operand is SIGN_EXTEND or 'u' if ZERO_EXTEND unless
1499 cris_output_insn_is_bound is nonzero. */
1500 if (GET_CODE (operand
) != SIGN_EXTEND
1501 && GET_CODE (operand
) != ZERO_EXTEND
1502 && GET_CODE (operand
) != CONST_INT
)
1503 LOSE_AND_RETURN ("invalid operand for 'e' modifier", x
);
1505 if (cris_output_insn_is_bound
)
1507 cris_output_insn_is_bound
= 0;
1511 putc (GET_CODE (operand
) == SIGN_EXTEND
1512 || (GET_CODE (operand
) == CONST_INT
&& INTVAL (operand
) < 0)
1517 /* Print the size letter of the inner element. We can do it by
1518 calling ourselves with the 's' modifier. */
1519 if (GET_CODE (operand
) != SIGN_EXTEND
&& GET_CODE (operand
) != ZERO_EXTEND
)
1520 LOSE_AND_RETURN ("invalid operand for 'm' modifier", x
);
1521 cris_print_operand (file
, XEXP (operand
, 0), 's');
1525 /* Print the least significant part of operand. */
1526 if (GET_CODE (operand
) == CONST_DOUBLE
)
1528 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
, CONST_DOUBLE_LOW (x
));
1531 else if (HOST_BITS_PER_WIDE_INT
> 32 && GET_CODE (operand
) == CONST_INT
)
1533 fprintf (file
, HOST_WIDE_INT_PRINT_HEX
,
1534 INTVAL (x
) & ((unsigned int) 0x7fffffff * 2 + 1));
1537 /* Otherwise the least significant part equals the normal part,
1538 so handle it normally. */
1542 /* When emitting an add for the high part of a DImode constant, we
1543 want to use addq for 0 and adds.w for -1. */
1544 if (GET_CODE (operand
) != CONST_INT
)
1545 LOSE_AND_RETURN ("invalid operand for 'A' modifier", x
);
1546 fprintf (file
, INTVAL (operand
) < 0 ? "adds.w" : "addq");
1550 /* When emitting an sub for the high part of a DImode constant, we
1551 want to use subq for 0 and subs.w for -1. */
1552 if (GET_CODE (operand
) != CONST_INT
)
1553 LOSE_AND_RETURN ("invalid operand for 'D' modifier", x
);
1554 fprintf (file
, INTVAL (operand
) < 0 ? "subs.w" : "subq");
1558 /* Print the operand as the index-part of an address.
1559 Easiest way out is to use cris_print_index. */
1560 cris_print_index (operand
, file
);
1564 /* Print the size letter for an operand to a MULT, which must be a
1565 const_int with a suitable value. */
1566 if (GET_CODE (operand
) != CONST_INT
|| INTVAL (operand
) > 4)
1567 LOSE_AND_RETURN ("invalid operand for 'T' modifier", x
);
1568 fprintf (file
, "%s", mults
[INTVAL (operand
)]);
1572 /* No code, print as usual. */
1576 LOSE_AND_RETURN ("invalid operand modifier letter", x
);
1579 /* Print an operand as without a modifier letter. */
1580 switch (GET_CODE (operand
))
1583 if (REGNO (operand
) > 15)
1584 internal_error ("internal error: bad register: %d", REGNO (operand
));
1585 fprintf (file
, "$%s", reg_names
[REGNO (operand
)]);
1589 output_address (XEXP (operand
, 0));
1593 if (GET_MODE (operand
) == VOIDmode
)
1594 /* A long long constant. */
1595 output_addr_const (file
, operand
);
1598 /* Only single precision is allowed as plain operands the
1599 moment. FIXME: REAL_VALUE_FROM_CONST_DOUBLE isn't
1604 /* FIXME: Perhaps check overflow of the "single". */
1605 REAL_VALUE_FROM_CONST_DOUBLE (r
, operand
);
1606 REAL_VALUE_TO_TARGET_SINGLE (r
, l
);
1608 fprintf (file
, "0x%lx", l
);
1613 ASSERT_PLT_UNSPEC (operand
);
1617 cris_output_addr_const (file
, operand
);
1623 /* For a (MULT (reg X) const_int) we output "rX.S". */
1624 int i
= GET_CODE (XEXP (operand
, 1)) == CONST_INT
1625 ? INTVAL (XEXP (operand
, 1)) : INTVAL (XEXP (operand
, 0));
1626 rtx reg
= GET_CODE (XEXP (operand
, 1)) == CONST_INT
1627 ? XEXP (operand
, 0) : XEXP (operand
, 1);
1629 if (GET_CODE (reg
) != REG
1630 || (GET_CODE (XEXP (operand
, 0)) != CONST_INT
1631 && GET_CODE (XEXP (operand
, 1)) != CONST_INT
))
1632 LOSE_AND_RETURN ("unexpected multiplicative operand", x
);
1634 cris_print_base (reg
, file
);
1635 fprintf (file
, ".%c",
1636 i
== 0 || (i
== 1 && GET_CODE (operand
) == MULT
) ? 'b'
1638 : (i
== 2 && GET_CODE (operand
) == MULT
) || i
== 1 ? 'w'
1644 /* No need to handle all strange variants, let output_addr_const
1646 if (CONSTANT_P (operand
))
1648 cris_output_addr_const (file
, operand
);
1652 LOSE_AND_RETURN ("unexpected operand", x
);
1656 /* The PRINT_OPERAND_ADDRESS worker. */
1659 cris_print_operand_address (FILE *file
, rtx x
)
1661 /* All these were inside MEM:s so output indirection characters. */
1664 if (CONSTANT_ADDRESS_P (x
))
1665 cris_output_addr_const (file
, x
);
1666 else if (BASE_OR_AUTOINCR_P (x
))
1667 cris_print_base (x
, file
);
1668 else if (GET_CODE (x
) == PLUS
)
1676 cris_print_base (x1
, file
);
1677 cris_print_index (x2
, file
);
1679 else if (BASE_P (x2
))
1681 cris_print_base (x2
, file
);
1682 cris_print_index (x1
, file
);
1685 LOSE_AND_RETURN ("unrecognized address", x
);
1687 else if (GET_CODE (x
) == MEM
)
1689 /* A DIP. Output more indirection characters. */
1691 cris_print_base (XEXP (x
, 0), file
);
1695 LOSE_AND_RETURN ("unrecognized address", x
);
1700 /* The RETURN_ADDR_RTX worker.
1701 We mark that the return address is used, either by EH or
1702 __builtin_return_address, for use by the function prologue and
1703 epilogue. FIXME: This isn't optimal; we just use the mark in the
1704 prologue and epilogue to say that the return address is to be stored
1705 in the stack frame. We could return SRP for leaf-functions and use the
1706 initial-value machinery. */
1709 cris_return_addr_rtx (int count
, rtx frameaddr ATTRIBUTE_UNUSED
)
1711 cfun
->machine
->needs_return_address_on_stack
= 1;
1713 /* The return-address is stored just above the saved frame-pointer (if
1714 present). Apparently we can't eliminate from the frame-pointer in
1715 that direction, so use the incoming args (maybe pretended) pointer. */
1717 ? gen_rtx_MEM (Pmode
, plus_constant (virtual_incoming_args_rtx
, -4))
1721 /* Accessor used in cris.md:return because cfun->machine isn't available
1725 cris_return_address_on_stack ()
1727 return cfun
->machine
->needs_return_address_on_stack
;
1730 /* This used to be the INITIAL_FRAME_POINTER_OFFSET worker; now only
1731 handles FP -> SP elimination offset. */
1734 cris_initial_frame_pointer_offset (void)
1738 /* Initial offset is 0 if we don't have a frame pointer. */
1741 /* And 4 for each register pushed. */
1742 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
1743 if ((((regs_ever_live
[regno
]
1744 && !call_used_regs
[regno
])
1745 || (regno
== (int) PIC_OFFSET_TABLE_REGNUM
1746 && (current_function_uses_pic_offset_table
1747 /* It is saved anyway, if there would be a gap. */
1749 && regs_ever_live
[regno
+ 1]
1750 && !call_used_regs
[regno
+ 1]))))
1751 && (regno
!= FRAME_POINTER_REGNUM
|| !frame_pointer_needed
)
1752 && regno
!= CRIS_SRP_REGNUM
)
1753 || (current_function_calls_eh_return
1754 && (regno
== EH_RETURN_DATA_REGNO (0)
1755 || regno
== EH_RETURN_DATA_REGNO (1)
1756 || regno
== EH_RETURN_DATA_REGNO (2)
1757 || regno
== EH_RETURN_DATA_REGNO (3))))
1760 /* And then, last, we add the locals allocated. */
1761 offs
+= get_frame_size ();
1763 /* And more; the accumulated args size. */
1764 offs
+= current_function_outgoing_args_size
;
1766 /* Then round it off, in case we use aligned stack. */
1767 if (TARGET_STACK_ALIGN
)
1768 offs
= TARGET_ALIGN_BY_32
? (offs
+ 3) & ~3 : (offs
+ 1) & ~1;
1773 /* The INITIAL_ELIMINATION_OFFSET worker.
1774 Calculate the difference between imaginary registers such as frame
1775 pointer and the stack pointer. Used to eliminate the frame pointer
1776 and imaginary arg pointer. */
1779 cris_initial_elimination_offset (int fromreg
, int toreg
)
1782 = cris_initial_frame_pointer_offset ();
1784 /* We should be able to use regs_ever_live and related prologue
1785 information here, or alpha should not as well. */
1786 int return_address_on_stack
1787 = regs_ever_live
[CRIS_SRP_REGNUM
]
1788 || cfun
->machine
->needs_return_address_on_stack
!= 0;
1790 /* Here we act as if the frame-pointer were needed. */
1791 int ap_fp_offset
= 4 + (return_address_on_stack
? 4 : 0);
1793 if (fromreg
== ARG_POINTER_REGNUM
1794 && toreg
== FRAME_POINTER_REGNUM
)
1795 return ap_fp_offset
;
1797 /* Between the frame pointer and the stack are only "normal" stack
1798 variables and saved registers. */
1799 if (fromreg
== FRAME_POINTER_REGNUM
1800 && toreg
== STACK_POINTER_REGNUM
)
1801 return fp_sp_offset
;
1803 /* We need to balance out the frame pointer here. */
1804 if (fromreg
== ARG_POINTER_REGNUM
1805 && toreg
== STACK_POINTER_REGNUM
)
1806 return ap_fp_offset
+ fp_sp_offset
- 4;
1811 /* This function looks into the pattern to see how this insn affects
1814 Used when to eliminate test insns before a condition-code user,
1815 such as a "scc" insn or a conditional branch. This includes
1816 checking if the entities that cc was updated by, are changed by the
1819 Currently a jumble of the old peek-inside-the-insn and the newer
1820 check-cc-attribute methods. */
1823 cris_notice_update_cc (rtx exp
, rtx insn
)
1825 /* Check if user specified "-mcc-init" as a bug-workaround. FIXME:
1826 TARGET_CCINIT does not work; we must set CC_REVERSED as below.
1827 Several testcases will otherwise fail, for example
1828 gcc.c-torture/execute/20000217-1.c -O0 and -O1. */
1835 /* Slowly, we're converting to using attributes to control the setting
1836 of condition-code status. */
1837 switch (get_attr_cc (insn
))
1840 /* Even if it is "none", a setting may clobber a previous
1841 cc-value, so check. */
1842 if (GET_CODE (exp
) == SET
)
1844 if (cc_status
.value1
1845 && modified_in_p (cc_status
.value1
, insn
))
1846 cc_status
.value1
= 0;
1848 if (cc_status
.value2
1849 && modified_in_p (cc_status
.value2
, insn
))
1850 cc_status
.value2
= 0;
1859 /* Which means, for:
1864 CC is (reg) and (...) - unless (...) is 0, then CC does not change.
1865 CC_NO_OVERFLOW unless (...) is reg or mem.
1874 (set (reg1) (mem (bdap/biap)))
1875 (set (reg2) (bdap/biap))):
1876 CC is (reg1) and (mem (reg2))
1879 (set (mem (bdap/biap)) (reg1)) [or 0]
1880 (set (reg2) (bdap/biap))):
1883 (where reg and mem includes strict_low_parts variants thereof)
1885 For all others, assume CC is clobbered.
1886 Note that we do not have to care about setting CC_NO_OVERFLOW,
1887 since the overflow flag is set to 0 (i.e. right) for
1888 instructions where it does not have any sane sense, but where
1889 other flags have meanings. (This includes shifts; the carry is
1892 Note that there are other parallel constructs we could match,
1893 but we don't do that yet. */
1895 if (GET_CODE (exp
) == SET
)
1897 /* FIXME: Check when this happens. It looks like we should
1898 actually do a CC_STATUS_INIT here to be safe. */
1899 if (SET_DEST (exp
) == pc_rtx
)
1902 /* Record CC0 changes, so we do not have to output multiple
1904 if (SET_DEST (exp
) == cc0_rtx
)
1906 cc_status
.value1
= SET_SRC (exp
);
1907 cc_status
.value2
= 0;
1909 /* Handle flags for the special btstq on one bit. */
1910 if (GET_CODE (SET_SRC (exp
)) == ZERO_EXTRACT
1911 && XEXP (SET_SRC (exp
), 1) == const1_rtx
)
1913 if (GET_CODE (XEXP (SET_SRC (exp
), 0)) == CONST_INT
)
1915 cc_status
.flags
= CC_INVERTED
;
1917 /* A one-bit btstq. */
1918 cc_status
.flags
= CC_Z_IN_NOT_N
;
1921 cc_status
.flags
= 0;
1923 if (GET_CODE (SET_SRC (exp
)) == COMPARE
)
1925 if (!REG_P (XEXP (SET_SRC (exp
), 0))
1926 && XEXP (SET_SRC (exp
), 1) != const0_rtx
)
1927 /* For some reason gcc will not canonicalize compare
1928 operations, reversing the sign by itself if
1929 operands are in wrong order. */
1930 /* (But NOT inverted; eq is still eq.) */
1931 cc_status
.flags
= CC_REVERSED
;
1933 /* This seems to be overlooked by gcc. FIXME: Check again.
1934 FIXME: Is it really safe? */
1936 = gen_rtx_MINUS (GET_MODE (SET_SRC (exp
)),
1937 XEXP (SET_SRC (exp
), 0),
1938 XEXP (SET_SRC (exp
), 1));
1942 else if (REG_P (SET_DEST (exp
))
1943 || (GET_CODE (SET_DEST (exp
)) == STRICT_LOW_PART
1944 && REG_P (XEXP (SET_DEST (exp
), 0))))
1946 /* A register is set; normally CC is set to show that no
1947 test insn is needed. Catch the exceptions. */
1949 /* If not to cc0, then no "set"s in non-natural mode give
1951 if (GET_MODE_SIZE (GET_MODE (SET_DEST (exp
))) > UNITS_PER_WORD
1952 || GET_MODE_CLASS (GET_MODE (SET_DEST (exp
))) == MODE_FLOAT
)
1954 /* ... except add:s and sub:s in DImode. */
1955 if (GET_MODE (SET_DEST (exp
)) == DImode
1956 && (GET_CODE (SET_SRC (exp
)) == PLUS
1957 || GET_CODE (SET_SRC (exp
)) == MINUS
))
1959 cc_status
.flags
= 0;
1960 cc_status
.value1
= SET_DEST (exp
);
1961 cc_status
.value2
= SET_SRC (exp
);
1963 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
1965 cc_status
.value2
= 0;
1967 /* Add and sub may set V, which gets us
1968 unoptimizable results in "gt" and "le" condition
1970 cc_status
.flags
|= CC_NO_OVERFLOW
;
1975 else if (SET_SRC (exp
) == const0_rtx
)
1977 /* There's no CC0 change when clearing a register or
1978 memory. Just check for overlap. */
1979 if (cc_status
.value1
1980 && modified_in_p (cc_status
.value1
, insn
))
1981 cc_status
.value1
= 0;
1983 if (cc_status
.value2
1984 && modified_in_p (cc_status
.value2
, insn
))
1985 cc_status
.value2
= 0;
1991 cc_status
.flags
= 0;
1992 cc_status
.value1
= SET_DEST (exp
);
1993 cc_status
.value2
= SET_SRC (exp
);
1995 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
1997 cc_status
.value2
= 0;
1999 /* Some operations may set V, which gets us
2000 unoptimizable results in "gt" and "le" condition
2002 if (GET_CODE (SET_SRC (exp
)) == PLUS
2003 || GET_CODE (SET_SRC (exp
)) == MINUS
2004 || GET_CODE (SET_SRC (exp
)) == NEG
)
2005 cc_status
.flags
|= CC_NO_OVERFLOW
;
2010 else if (GET_CODE (SET_DEST (exp
)) == MEM
2011 || (GET_CODE (SET_DEST (exp
)) == STRICT_LOW_PART
2012 && GET_CODE (XEXP (SET_DEST (exp
), 0)) == MEM
))
2014 /* When SET to MEM, then CC is not changed (except for
2016 if (cc_status
.value1
2017 && modified_in_p (cc_status
.value1
, insn
))
2018 cc_status
.value1
= 0;
2020 if (cc_status
.value2
2021 && modified_in_p (cc_status
.value2
, insn
))
2022 cc_status
.value2
= 0;
2027 else if (GET_CODE (exp
) == PARALLEL
)
2029 if (GET_CODE (XVECEXP (exp
, 0, 0)) == SET
2030 && GET_CODE (XVECEXP (exp
, 0, 1)) == SET
2031 && REG_P (XEXP (XVECEXP (exp
, 0, 1), 0)))
2033 if (REG_P (XEXP (XVECEXP (exp
, 0, 0), 0))
2034 && GET_CODE (XEXP (XVECEXP (exp
, 0, 0), 1)) == MEM
)
2036 /* For "move.S [rx=ry+o],rz", say CC reflects
2037 value1=rz and value2=[rx] */
2038 cc_status
.value1
= XEXP (XVECEXP (exp
, 0, 0), 0);
2040 = replace_equiv_address (XEXP (XVECEXP (exp
, 0, 0), 1),
2041 XEXP (XVECEXP (exp
, 0, 1), 0));
2042 cc_status
.flags
= 0;
2044 /* Huh? A side-effect cannot change the destination
2046 if (cris_reg_overlap_mentioned_p (cc_status
.value1
,
2048 internal_error ("internal error: sideeffect-insn affecting main effect");
2051 else if ((REG_P (XEXP (XVECEXP (exp
, 0, 0), 1))
2052 || XEXP (XVECEXP (exp
, 0, 0), 1) == const0_rtx
)
2053 && GET_CODE (XEXP (XVECEXP (exp
, 0, 0), 0)) == MEM
)
2055 /* For "move.S rz,[rx=ry+o]" and "clear.S [rx=ry+o]",
2056 say flags are not changed, except for overlap. */
2057 if (cc_status
.value1
2058 && modified_in_p (cc_status
.value1
, insn
))
2059 cc_status
.value1
= 0;
2061 if (cc_status
.value2
2062 && modified_in_p (cc_status
.value2
, insn
))
2063 cc_status
.value2
= 0;
2072 /* Unknown cc_attr value. */
2079 /* Return != 0 if the return sequence for the current function is short,
2080 like "ret" or "jump [sp+]". Prior to reloading, we can't tell how
2081 many registers must be saved, so return 0 then. */
2084 cris_simple_epilogue (void)
2087 int reglimit
= STACK_POINTER_REGNUM
;
2090 if (! reload_completed
2091 || frame_pointer_needed
2092 || get_frame_size () != 0
2093 || current_function_pretend_args_size
2094 || current_function_args_size
2095 || current_function_outgoing_args_size
2096 || current_function_calls_eh_return
2098 /* If we're not supposed to emit prologue and epilogue, we must
2099 not emit return-type instructions. */
2100 || !TARGET_PROLOGUE_EPILOGUE
)
2103 /* We allow a "movem [sp+],rN" to sit in front if the "jump [sp+]" or
2104 in the delay-slot of the "ret". */
2105 for (regno
= 0; regno
< reglimit
; regno
++)
2106 if ((regs_ever_live
[regno
] && ! call_used_regs
[regno
])
2107 || (regno
== (int) PIC_OFFSET_TABLE_REGNUM
2108 && (current_function_uses_pic_offset_table
2109 /* It is saved anyway, if there would be a gap. */
2111 && regs_ever_live
[regno
+ 1]
2112 && !call_used_regs
[regno
+ 1]))))
2114 if (lastreg
!= regno
- 1)
2122 /* Compute a (partial) cost for rtx X. Return true if the complete
2123 cost has been computed, and false if subexpressions should be
2124 scanned. In either case, *TOTAL contains the cost result. */
2127 cris_rtx_costs (rtx x
, int code
, int outer_code
, int *total
)
2133 HOST_WIDE_INT val
= INTVAL (x
);
2136 else if (val
< 32 && val
>= -32)
2138 /* Eight or 16 bits are a word and cycle more expensive. */
2139 else if (val
<= 32767 && val
>= -32768)
2141 /* A 32 bit constant (or very seldom, unsigned 16 bits) costs
2142 another word. FIXME: This isn't linear to 16 bits. */
2154 /* For PIC, we need a prefix (if it isn't already there),
2155 and the PIC register. For a global PIC symbol, we also
2156 need a read of the GOT. */
2159 if (cris_got_symbol (x
))
2169 if (x
!= CONST0_RTX (GET_MODE (x
) == VOIDmode
? DImode
: GET_MODE (x
)))
2172 /* Make 0.0 cheap, else test-insns will not be used. */
2177 /* Identify values that are no powers of two. Powers of 2 are
2178 taken care of already and those values should not be changed. */
2179 if (GET_CODE (XEXP (x
, 1)) != CONST_INT
2180 || exact_log2 (INTVAL (XEXP (x
, 1)) < 0))
2182 /* If we have a multiply insn, then the cost is between
2183 1 and 2 "fast" instructions. */
2184 if (TARGET_HAS_MUL_INSNS
)
2186 *total
= COSTS_N_INSNS (1) + COSTS_N_INSNS (1) / 2;
2190 /* Estimate as 4 + 4 * #ofbits. */
2191 *total
= COSTS_N_INSNS (132);
2200 if (GET_CODE (XEXP (x
, 1)) != CONST_INT
2201 || exact_log2 (INTVAL (XEXP (x
, 1)) < 0))
2203 /* Estimate this as 4 + 8 * #of bits. */
2204 *total
= COSTS_N_INSNS (260);
2210 if (GET_CODE (XEXP (x
, 1)) == CONST_INT
2211 /* Two constants may actually happen before optimization. */
2212 && GET_CODE (XEXP (x
, 0)) != CONST_INT
2213 && !CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x
, 1)), 'I'))
2215 *total
= (rtx_cost (XEXP (x
, 0), outer_code
) + 2
2216 + 2 * GET_MODE_NUNITS (GET_MODE (XEXP (x
, 0))));
2221 case ZERO_EXTEND
: case SIGN_EXTEND
:
2222 *total
= rtx_cost (XEXP (x
, 0), outer_code
);
2230 /* The ADDRESS_COST worker. */
2233 cris_address_cost (rtx x
)
2235 /* The metric to use for the cost-macros is unclear.
2236 The metric used here is (the number of cycles needed) / 2,
2237 where we consider equal a cycle for a word of code and a cycle to
2240 /* The cheapest addressing modes get 0, since nothing extra is needed. */
2241 if (BASE_OR_AUTOINCR_P (x
))
2244 /* An indirect mem must be a DIP. This means two bytes extra for code,
2245 and 4 bytes extra for memory read, i.e. (2 + 4) / 2. */
2246 if (GET_CODE (x
) == MEM
)
2249 /* Assume (2 + 4) / 2 for a single constant; a dword, since it needs
2250 an extra DIP prefix and 4 bytes of constant in most cases.
2251 For PIC and a symbol with a GOT entry, we double the cost since we
2252 add a [rPIC+...] offset. A GOT-less symbol uses a BDAP prefix
2253 equivalent to the DIP prefix for non-PIC, hence the same cost. */
2255 return flag_pic
&& cris_got_symbol (x
) ? 2 * (2 + 4) / 2 : (2 + 4) / 2;
2257 /* Handle BIAP and BDAP prefixes. */
2258 if (GET_CODE (x
) == PLUS
)
2260 rtx tem1
= XEXP (x
, 0);
2261 rtx tem2
= XEXP (x
, 1);
2263 /* A BIAP is 2 extra bytes for the prefix insn, nothing more. We
2264 recognize the typical MULT which is always in tem1 because of
2265 insn canonicalization. */
2266 if ((GET_CODE (tem1
) == MULT
&& BIAP_INDEX_P (tem1
))
2270 /* A BDAP (quick) is 2 extra bytes. Any constant operand to the
2271 PLUS is always found in tem2. */
2272 if (GET_CODE (tem2
) == CONST_INT
2273 && INTVAL (tem2
) < 128 && INTVAL (tem2
) >= -128)
2276 /* A BDAP -32768 .. 32767 is like BDAP quick, but with 2 extra
2278 if (GET_CODE (tem2
) == CONST_INT
2279 && CONST_OK_FOR_LETTER_P (INTVAL (tem2
), 'L'))
2282 /* A BDAP with some other constant is 2 bytes extra. */
2283 if (CONSTANT_P (tem2
))
2284 return (2 + 2 + 2) / 2;
2286 /* BDAP with something indirect should have a higher cost than
2287 BIAP with register. FIXME: Should it cost like a MEM or more? */
2288 /* Don't need to check it, it's the only one left.
2289 FIXME: There was a REG test missing, perhaps there are others.
2291 return (2 + 2 + 2) / 2;
2294 /* What else? Return a high cost. It matters only for valid
2295 addressing modes. */
2299 /* Check various objections to the side-effect. Used in the test-part
2300 of an anonymous insn describing an insn with a possible side-effect.
2301 Returns nonzero if the implied side-effect is ok.
2304 ops : An array of rtx:es. lreg, rreg, rval,
2305 The variables multop and other_op are indexes into this,
2306 or -1 if they are not applicable.
2307 lreg : The register that gets assigned in the side-effect.
2308 rreg : One register in the side-effect expression
2309 rval : The other register, or an int.
2310 multop : An integer to multiply rval with.
2311 other_op : One of the entities of the main effect,
2312 whose mode we must consider. */
2315 cris_side_effect_mode_ok (enum rtx_code code
, rtx
*ops
,
2316 int lreg
, int rreg
, int rval
,
2317 int multop
, int other_op
)
2319 /* Find what value to multiply with, for rx =ry + rz * n. */
2320 int mult
= multop
< 0 ? 1 : INTVAL (ops
[multop
]);
2322 rtx reg_rtx
= ops
[rreg
];
2323 rtx val_rtx
= ops
[rval
];
2325 /* The operands may be swapped. Canonicalize them in reg_rtx and
2326 val_rtx, where reg_rtx always is a reg (for this constraint to
2328 if (! BASE_P (reg_rtx
))
2329 reg_rtx
= val_rtx
, val_rtx
= ops
[rreg
];
2331 /* Don't forget to check that reg_rtx really is a reg. If it isn't,
2332 we have no business. */
2333 if (! BASE_P (reg_rtx
))
2336 /* Don't do this when -mno-split. */
2337 if (!TARGET_SIDE_EFFECT_PREFIXES
)
2340 /* The mult expression may be hidden in lreg. FIXME: Add more
2341 commentary about that. */
2342 if (GET_CODE (val_rtx
) == MULT
)
2344 mult
= INTVAL (XEXP (val_rtx
, 1));
2345 val_rtx
= XEXP (val_rtx
, 0);
2349 /* First check the "other operand". */
2352 if (GET_MODE_SIZE (GET_MODE (ops
[other_op
])) > UNITS_PER_WORD
)
2355 /* Check if the lvalue register is the same as the "other
2356 operand". If so, the result is undefined and we shouldn't do
2357 this. FIXME: Check again. */
2358 if ((BASE_P (ops
[lreg
])
2359 && BASE_P (ops
[other_op
])
2360 && REGNO (ops
[lreg
]) == REGNO (ops
[other_op
]))
2361 || rtx_equal_p (ops
[other_op
], ops
[lreg
]))
2365 /* Do not accept frame_pointer_rtx as any operand. */
2366 if (ops
[lreg
] == frame_pointer_rtx
|| ops
[rreg
] == frame_pointer_rtx
2367 || ops
[rval
] == frame_pointer_rtx
2368 || (other_op
>= 0 && ops
[other_op
] == frame_pointer_rtx
))
2372 && ! BASE_P (val_rtx
))
2375 /* Do not allow rx = rx + n if a normal add or sub with same size
2377 if (rtx_equal_p (ops
[lreg
], reg_rtx
)
2378 && GET_CODE (val_rtx
) == CONST_INT
2379 && (INTVAL (val_rtx
) <= 63 && INTVAL (val_rtx
) >= -63))
2382 /* Check allowed cases, like [r(+)?].[bwd] and const.
2383 A symbol is not allowed with PIC. */
2384 if (CONSTANT_P (val_rtx
))
2385 return flag_pic
== 0 || cris_symbol (val_rtx
) == 0;
2387 if (GET_CODE (val_rtx
) == MEM
2388 && BASE_OR_AUTOINCR_P (XEXP (val_rtx
, 0)))
2391 if (GET_CODE (val_rtx
) == SIGN_EXTEND
2392 && GET_CODE (XEXP (val_rtx
, 0)) == MEM
2393 && BASE_OR_AUTOINCR_P (XEXP (XEXP (val_rtx
, 0), 0)))
2396 /* If we got here, it's not a valid addressing mode. */
2399 else if (code
== MULT
2400 || (code
== PLUS
&& BASE_P (val_rtx
)))
2402 /* Do not allow rx = rx + ry.S, since it doesn't give better code. */
2403 if (rtx_equal_p (ops
[lreg
], reg_rtx
)
2404 || (mult
== 1 && rtx_equal_p (ops
[lreg
], val_rtx
)))
2407 /* Do not allow bad multiply-values. */
2408 if (mult
!= 1 && mult
!= 2 && mult
!= 4)
2411 /* Only allow r + ... */
2412 if (! BASE_P (reg_rtx
))
2415 /* If we got here, all seems ok.
2416 (All checks need to be done above). */
2420 /* If we get here, the caller got its initial tests wrong. */
2421 internal_error ("internal error: cris_side_effect_mode_ok with bad operands");
2424 /* The function reg_overlap_mentioned_p in CVS (still as of 2001-05-16)
2425 does not handle the case where the IN operand is strict_low_part; it
2426 does handle it for X. Test-case in Axis-20010516. This function takes
2427 care of that for THIS port. FIXME: strict_low_part is going away
2431 cris_reg_overlap_mentioned_p (rtx x
, rtx in
)
2433 /* The function reg_overlap_mentioned now handles when X is
2434 strict_low_part, but not when IN is a STRICT_LOW_PART. */
2435 if (GET_CODE (in
) == STRICT_LOW_PART
)
2438 return reg_overlap_mentioned_p (x
, in
);
2441 /* The TARGET_ASM_NAMED_SECTION worker.
2442 We just dispatch to the functions for ELF and a.out. */
2445 cris_target_asm_named_section (const char *name
, unsigned int flags
,
2449 default_no_named_section (name
, flags
, decl
);
2451 default_elf_asm_named_section (name
, flags
, decl
);
2454 /* The LEGITIMATE_PIC_OPERAND_P worker. */
2457 cris_legitimate_pic_operand (rtx x
)
2459 /* The PIC representation of a symbol with a GOT entry will be (for
2460 example; relocations differ):
2461 sym => [rPIC+sym:GOT]
2462 and for a GOT-less symbol it will be (for example, relocation differ):
2463 sym => rPIC+sym:GOTOFF
2464 so only a symbol with a GOT is by itself a valid operand, and it
2465 can't be a sum of a symbol and an offset. */
2466 return ! cris_symbol (x
) || cris_got_symbol (x
);
2469 /* Return nonzero if there's a SYMBOL_REF or LABEL_REF hiding inside this
2475 switch (GET_CODE (x
))
2482 /* A PLT reference. */
2483 ASSERT_PLT_UNSPEC (x
);
2487 return cris_symbol (XEXP (x
, 0));
2491 return cris_symbol (XEXP (x
, 0)) || cris_symbol (XEXP (x
, 1));
2498 fatal_insn ("unrecognized supposed constant", x
);
2504 /* Return nonzero if there's a SYMBOL_REF or LABEL_REF hiding inside this
2505 CONSTANT_P, and the symbol does not need a GOT entry. Also set
2506 current_function_uses_pic_offset_table if we're generating PIC and ever
2507 see something that would need one. */
2510 cris_gotless_symbol (rtx x
)
2512 #ifdef ENABLE_CHECKING
2517 switch (GET_CODE (x
))
2520 ASSERT_PLT_UNSPEC (x
);
2525 current_function_uses_pic_offset_table
= 1;
2526 return SYMBOL_REF_LOCAL_P (x
);
2529 /* We don't set current_function_uses_pic_offset_table for
2530 LABEL_REF:s in here, since they are almost always originating
2531 from some branch. The only time it does not come from a label is
2532 when GCC does something like __builtin_setjmp. Then we get the
2533 LABEL_REF from the movsi expander, so we mark it there as a
2538 return cris_gotless_symbol (XEXP (x
, 0));
2543 int x0
= cris_gotless_symbol (XEXP (x
, 0)) != 0;
2544 int x1
= cris_gotless_symbol (XEXP (x
, 1)) != 0;
2546 /* One and only one of them must be a local symbol. Neither must
2547 be some other, more general kind of symbol. */
2550 && ! (x0
== 0 && cris_symbol (XEXP (x
, 0)))
2551 && ! (x1
== 0 && cris_symbol (XEXP (x
, 1)));
2559 fatal_insn ("unrecognized supposed constant", x
);
2565 /* Return nonzero if there's a SYMBOL_REF or LABEL_REF hiding inside this
2566 CONSTANT_P, and the symbol needs a GOT entry. */
2569 cris_got_symbol (rtx x
)
2571 #ifdef ENABLE_CHECKING
2576 switch (GET_CODE (x
))
2579 ASSERT_PLT_UNSPEC (x
);
2584 current_function_uses_pic_offset_table
= 1;
2585 return ! SYMBOL_REF_LOCAL_P (x
);
2588 return cris_got_symbol (XEXP (x
, 0));
2591 /* A LABEL_REF is never visible as a symbol outside the local
2595 /* Nope, can't access the GOT for "symbol + offset". */
2603 fatal_insn ("unrecognized supposed constant in cris_global_pic_symbol",
2610 /* The OVERRIDE_OPTIONS worker.
2611 As is the norm, this also parses -mfoo=bar type parameters. */
2614 cris_override_options (void)
2616 if (cris_max_stackframe_str
)
2618 cris_max_stackframe
= atoi (cris_max_stackframe_str
);
2620 /* Do some sanity checking. */
2621 if (cris_max_stackframe
< 0 || cris_max_stackframe
> 0x20000000)
2622 internal_error ("-max-stackframe=%d is not usable, not between 0 and %d",
2623 cris_max_stackframe
, 0x20000000);
2626 /* Let "-metrax4" and "-metrax100" change the cpu version. */
2627 if (TARGET_SVINTO
&& cris_cpu_version
< CRIS_CPU_SVINTO
)
2628 cris_cpu_version
= CRIS_CPU_SVINTO
;
2629 else if (TARGET_ETRAX4_ADD
&& cris_cpu_version
< CRIS_CPU_ETRAX4
)
2630 cris_cpu_version
= CRIS_CPU_ETRAX4
;
2632 /* Parse -march=... and its synonym, the deprecated -mcpu=... */
2636 = (*cris_cpu_str
== 'v' ? atoi (cris_cpu_str
+ 1) : -1);
2638 if (strcmp ("etrax4", cris_cpu_str
) == 0)
2639 cris_cpu_version
= 3;
2641 if (strcmp ("svinto", cris_cpu_str
) == 0
2642 || strcmp ("etrax100", cris_cpu_str
) == 0)
2643 cris_cpu_version
= 8;
2645 if (strcmp ("ng", cris_cpu_str
) == 0
2646 || strcmp ("etrax100lx", cris_cpu_str
) == 0)
2647 cris_cpu_version
= 10;
2649 if (cris_cpu_version
< 0 || cris_cpu_version
> 10)
2650 error ("unknown CRIS version specification in -march= or -mcpu= : %s",
2653 /* Set the target flags. */
2654 if (cris_cpu_version
>= CRIS_CPU_ETRAX4
)
2655 target_flags
|= TARGET_MASK_ETRAX4_ADD
;
2657 /* If this is Svinto or higher, align for 32 bit accesses. */
2658 if (cris_cpu_version
>= CRIS_CPU_SVINTO
)
2660 |= (TARGET_MASK_SVINTO
| TARGET_MASK_ALIGN_BY_32
2661 | TARGET_MASK_STACK_ALIGN
| TARGET_MASK_CONST_ALIGN
2662 | TARGET_MASK_DATA_ALIGN
);
2664 /* Note that we do not add new flags when it can be completely
2665 described with a macro that uses -mcpu=X. So
2666 TARGET_HAS_MUL_INSNS is (cris_cpu_version >= CRIS_CPU_NG). */
2672 = (*cris_tune_str
== 'v' ? atoi (cris_tune_str
+ 1) : -1);
2674 if (strcmp ("etrax4", cris_tune_str
) == 0)
2677 if (strcmp ("svinto", cris_tune_str
) == 0
2678 || strcmp ("etrax100", cris_tune_str
) == 0)
2681 if (strcmp ("ng", cris_tune_str
) == 0
2682 || strcmp ("etrax100lx", cris_tune_str
) == 0)
2685 if (cris_tune
< 0 || cris_tune
> 10)
2686 error ("unknown CRIS cpu version specification in -mtune= : %s",
2689 if (cris_tune
>= CRIS_CPU_SVINTO
)
2690 /* We have currently nothing more to tune than alignment for
2693 |= (TARGET_MASK_STACK_ALIGN
| TARGET_MASK_CONST_ALIGN
2694 | TARGET_MASK_DATA_ALIGN
| TARGET_MASK_ALIGN_BY_32
);
2699 /* Use error rather than warning, so invalid use is easily
2700 detectable. Still change to the values we expect, to avoid
2704 error ("-fPIC and -fpic are not supported in this configuration");
2708 /* Turn off function CSE. We need to have the addresses reach the
2709 call expanders to get PLT-marked, as they could otherwise be
2710 compared against zero directly or indirectly. After visiting the
2711 call expanders they will then be cse:ed, as the call expanders
2712 force_reg the addresses, effectively forcing flag_no_function_cse
2714 flag_no_function_cse
= 1;
2717 if (write_symbols
== DWARF2_DEBUG
&& ! TARGET_ELF
)
2719 warning ("that particular -g option is invalid with -maout and -melinux");
2720 write_symbols
= DBX_DEBUG
;
2723 /* Set the per-function-data initializer. */
2724 init_machine_status
= cris_init_machine_status
;
2727 /* The TARGET_ASM_OUTPUT_MI_THUNK worker. */
2730 cris_asm_output_mi_thunk (FILE *stream
,
2731 tree thunkdecl ATTRIBUTE_UNUSED
,
2732 HOST_WIDE_INT delta
,
2733 HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED
,
2737 fprintf (stream
, "\tadd%s " HOST_WIDE_INT_PRINT_DEC
",$%s\n",
2738 ADDITIVE_SIZE_MODIFIER (delta
), delta
,
2739 reg_names
[CRIS_FIRST_ARG_REG
]);
2741 fprintf (stream
, "\tsub%s " HOST_WIDE_INT_PRINT_DEC
",$%s\n",
2742 ADDITIVE_SIZE_MODIFIER (-delta
), -delta
,
2743 reg_names
[CRIS_FIRST_ARG_REG
]);
2747 const char *name
= XSTR (XEXP (DECL_RTL (funcdecl
), 0), 0);
2749 name
= (* targetm
.strip_name_encoding
) (name
);
2750 fprintf (stream
, "add.d ");
2751 assemble_name (stream
, name
);
2752 fprintf (stream
, "%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX
);
2756 fprintf (stream
, "jump ");
2757 assemble_name (stream
, XSTR (XEXP (DECL_RTL (funcdecl
), 0), 0));
2758 fprintf (stream
, "\n");
2762 /* Boilerplate emitted at start of file.
2764 NO_APP *only at file start* means faster assembly. It also means
2765 comments are not allowed. In some cases comments will be output
2766 for debugging purposes. Make sure they are allowed then.
2768 We want a .file directive only if TARGET_ELF. */
2770 cris_file_start (void)
2772 /* These expressions can vary at run time, so we cannot put
2773 them into TARGET_INITIALIZER. */
2774 targetm
.file_start_app_off
= !(TARGET_PDEBUG
|| flag_print_asm_name
);
2775 targetm
.file_start_file_directive
= TARGET_ELF
;
2777 default_file_start ();
2780 /* Rename the function calls for integer multiply and divide. */
2782 cris_init_libfuncs (void)
2784 set_optab_libfunc (smul_optab
, SImode
, "__Mul");
2785 set_optab_libfunc (sdiv_optab
, SImode
, "__Div");
2786 set_optab_libfunc (udiv_optab
, SImode
, "__Udiv");
2787 set_optab_libfunc (smod_optab
, SImode
, "__Mod");
2788 set_optab_libfunc (umod_optab
, SImode
, "__Umod");
2791 /* The INIT_EXPANDERS worker sets the per-function-data initializer and
2795 cris_init_expanders (void)
2797 /* Nothing here at the moment. */
2800 /* Zero initialization is OK for all current fields. */
2802 static struct machine_function
*
2803 cris_init_machine_status (void)
2805 return ggc_alloc_cleared (sizeof (struct machine_function
));
2808 /* Split a 2 word move (DI or presumably DF) into component parts.
2809 Originally a copy of gen_split_move_double in m32r.c. */
2812 cris_split_movdx (rtx
*operands
)
2814 enum machine_mode mode
= GET_MODE (operands
[0]);
2815 rtx dest
= operands
[0];
2816 rtx src
= operands
[1];
2819 /* We used to have to handle (SUBREG (MEM)) here, but that should no
2820 longer happen; after reload there are no SUBREGs any more, and we're
2821 only called after reload. */
2822 if (GET_CODE (dest
) == SUBREG
|| GET_CODE (src
) == SUBREG
)
2826 if (GET_CODE (dest
) == REG
)
2828 int dregno
= REGNO (dest
);
2830 /* Reg-to-reg copy. */
2831 if (GET_CODE (src
) == REG
)
2833 int sregno
= REGNO (src
);
2835 int reverse
= (dregno
== sregno
+ 1);
2837 /* We normally copy the low-numbered register first. However, if
2838 the first register operand 0 is the same as the second register of
2839 operand 1, we must copy in the opposite order. */
2840 emit_insn (gen_rtx_SET (VOIDmode
,
2841 operand_subword (dest
, reverse
, TRUE
, mode
),
2842 operand_subword (src
, reverse
, TRUE
, mode
)));
2844 emit_insn (gen_rtx_SET (VOIDmode
,
2845 operand_subword (dest
, !reverse
, TRUE
, mode
),
2846 operand_subword (src
, !reverse
, TRUE
, mode
)));
2848 /* Constant-to-reg copy. */
2849 else if (GET_CODE (src
) == CONST_INT
|| GET_CODE (src
) == CONST_DOUBLE
)
2852 split_double (src
, &words
[0], &words
[1]);
2853 emit_insn (gen_rtx_SET (VOIDmode
,
2854 operand_subword (dest
, 0, TRUE
, mode
),
2857 emit_insn (gen_rtx_SET (VOIDmode
,
2858 operand_subword (dest
, 1, TRUE
, mode
),
2861 /* Mem-to-reg copy. */
2862 else if (GET_CODE (src
) == MEM
)
2864 /* If the high-address word is used in the address, we must load it
2865 last. Otherwise, load it first. */
2866 rtx addr
= XEXP (src
, 0);
2868 = (refers_to_regno_p (dregno
, dregno
+ 1, addr
, NULL
) != 0);
2870 /* The original code implies that we can't do
2871 move.x [rN+],rM move.x [rN],rM+1
2872 when rN is dead, because of REG_NOTES damage. That is
2873 consistent with what I've seen, so don't try it.
2875 We have two different cases here; if the addr is POST_INC,
2876 just pass it through, otherwise add constants. */
2878 if (GET_CODE (addr
) == POST_INC
)
2880 emit_insn (gen_rtx_SET (VOIDmode
,
2881 operand_subword (dest
, 0, TRUE
, mode
),
2882 change_address (src
, SImode
, addr
)));
2883 emit_insn (gen_rtx_SET (VOIDmode
,
2884 operand_subword (dest
, 1, TRUE
, mode
),
2885 change_address (src
, SImode
, addr
)));
2889 /* Make sure we don't get any other addresses with
2890 embedded postincrements. They should be stopped in
2891 GO_IF_LEGITIMATE_ADDRESS, but we're here for your
2893 if (side_effects_p (addr
))
2894 fatal_insn ("unexpected side-effects in address", addr
);
2896 emit_insn (gen_rtx_SET
2898 operand_subword (dest
, reverse
, TRUE
, mode
),
2901 plus_constant (addr
,
2902 reverse
* UNITS_PER_WORD
))));
2903 emit_insn (gen_rtx_SET
2905 operand_subword (dest
, ! reverse
, TRUE
, mode
),
2908 plus_constant (addr
,
2916 /* Reg-to-mem copy or clear mem. */
2917 else if (GET_CODE (dest
) == MEM
2918 && (GET_CODE (src
) == REG
2919 || src
== const0_rtx
2920 || src
== CONST0_RTX (DFmode
)))
2922 rtx addr
= XEXP (dest
, 0);
2924 if (GET_CODE (addr
) == POST_INC
)
2926 emit_insn (gen_rtx_SET (VOIDmode
,
2927 change_address (dest
, SImode
, addr
),
2928 operand_subword (src
, 0, TRUE
, mode
)));
2929 emit_insn (gen_rtx_SET (VOIDmode
,
2930 change_address (dest
, SImode
, addr
),
2931 operand_subword (src
, 1, TRUE
, mode
)));
2935 /* Make sure we don't get any other addresses with embedded
2936 postincrements. They should be stopped in
2937 GO_IF_LEGITIMATE_ADDRESS, but we're here for your safety. */
2938 if (side_effects_p (addr
))
2939 fatal_insn ("unexpected side-effects in address", addr
);
2941 emit_insn (gen_rtx_SET
2943 change_address (dest
, SImode
, addr
),
2944 operand_subword (src
, 0, TRUE
, mode
)));
2946 emit_insn (gen_rtx_SET
2948 change_address (dest
, SImode
,
2949 plus_constant (addr
,
2951 operand_subword (src
, 1, TRUE
, mode
)));
2963 /* Use from within code, from e.g. PRINT_OPERAND and
2964 PRINT_OPERAND_ADDRESS. Macros used in output_addr_const need to emit
2965 different things depending on whether code operand or constant is
2969 cris_output_addr_const (FILE *file
, rtx x
)
2972 output_addr_const (file
, x
);
2976 /* Worker function for ASM_OUTPUT_SYMBOL_REF. */
2979 cris_asm_output_symbol_ref (FILE *file
, rtx x
)
2981 if (flag_pic
&& in_code
> 0)
2983 const char *origstr
= XSTR (x
, 0);
2986 str
= (* targetm
.strip_name_encoding
) (origstr
);
2988 if (cris_gotless_symbol (x
))
2990 if (! cris_pic_sympart_only
)
2991 fprintf (file
, "$%s+", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
2992 assemble_name (file
, str
);
2993 fprintf (file
, ":GOTOFF");
2995 else if (cris_got_symbol (x
))
2997 if (cris_pic_sympart_only
)
2999 fprintf (file
, "[$%s+", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
3000 assemble_name (file
, XSTR (x
, 0));
3003 fprintf (file
, ":GOT16]");
3005 fprintf (file
, ":GOT]");
3008 LOSE_AND_RETURN ("unexpected PIC symbol", x
);
3011 if (! current_function_uses_pic_offset_table
)
3012 output_operand_lossage ("PIC register isn't set up");
3015 assemble_name (file
, XSTR (x
, 0));
3018 /* Worker function for ASM_OUTPUT_LABEL_REF. */
3021 cris_asm_output_label_ref (FILE *file
, char *buf
)
3023 if (flag_pic
&& in_code
> 0)
3025 if (! cris_pic_sympart_only
)
3026 fprintf (file
, "$%s+", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
3027 assemble_name (file
, buf
);
3029 fprintf (file
, ":GOTOFF");
3032 if (! current_function_uses_pic_offset_table
)
3033 internal_error ("emitting PIC operand, but PIC register isn't set up");
3036 assemble_name (file
, buf
);
3039 /* Worker function for OUTPUT_ADDR_CONST_EXTRA. */
3042 cris_output_addr_const_extra (FILE *file
, rtx x
)
3044 switch (GET_CODE (x
))
3046 const char *origstr
;
3050 ASSERT_PLT_UNSPEC (x
);
3051 x
= XVECEXP (x
, 0, 0);
3052 origstr
= XSTR (x
, 0);
3053 str
= (* targetm
.strip_name_encoding
) (origstr
);
3054 if (cris_pic_sympart_only
)
3056 assemble_name (file
, str
);
3057 fprintf (file
, ":PLTG");
3061 if (TARGET_AVOID_GOTPLT
)
3062 /* We shouldn't get here. */
3065 fprintf (file
, "[$%s+", reg_names
[PIC_OFFSET_TABLE_REGNUM
]);
3066 assemble_name (file
, XSTR (x
, 0));
3069 fprintf (file
, ":GOTPLT16]");
3071 fprintf (file
, ":GOTPLT]");
3080 /* Worker function for TARGET_STRUCT_VALUE_RTX. */
3083 cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED
,
3084 int incoming ATTRIBUTE_UNUSED
)
3086 return gen_rtx_REG (Pmode
, CRIS_STRUCT_VALUE_REGNUM
);
3089 /* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
3092 cris_setup_incoming_varargs (CUMULATIVE_ARGS
*ca
,
3093 enum machine_mode mode ATTRIBUTE_UNUSED
,
3094 tree type ATTRIBUTE_UNUSED
,
3095 int *pretend_arg_size
,
3098 if (ca
->regs
< CRIS_MAX_ARGS_IN_REGS
)
3099 *pretend_arg_size
= (CRIS_MAX_ARGS_IN_REGS
- ca
->regs
) * 4;
3102 fprintf (asm_out_file
,
3103 "\n; VA:: ANSI: %d args before, anon @ #%d, %dtime\n",
3104 ca
->regs
, *pretend_arg_size
, second_time
);
3108 /* Return true if TYPE must be passed by invisible reference.
3109 For cris, we pass <= 8 bytes by value, others by reference. */
3112 cris_pass_by_reference (CUMULATIVE_ARGS
*ca ATTRIBUTE_UNUSED
,
3113 enum machine_mode mode
, tree type
,
3114 bool named ATTRIBUTE_UNUSED
)
3116 return (targetm
.calls
.must_pass_in_stack (mode
, type
)
3117 || CRIS_FUNCTION_ARG_SIZE (mode
, type
) > 8);
3122 cris_arg_partial_bytes (CUMULATIVE_ARGS
*ca
, enum machine_mode mode
,
3123 tree type
, bool named ATTRIBUTE_UNUSED
)
3125 if (ca
->regs
== CRIS_MAX_ARGS_IN_REGS
- 1
3126 && !targetm
.calls
.must_pass_in_stack (mode
, type
)
3127 && CRIS_FUNCTION_ARG_SIZE (mode
, type
) > 4
3128 && CRIS_FUNCTION_ARG_SIZE (mode
, type
) <= 8)
3129 return UNITS_PER_WORD
;
3136 /* Various small functions to replace macros. Only called from a
3137 debugger. They might collide with gcc functions or system functions,
3138 so only emit them when '#if 1' above. */
3140 enum rtx_code
Get_code (rtx
);
3145 return GET_CODE (x
);
3148 const char *Get_mode (rtx
);
3153 return GET_MODE_NAME (GET_MODE (x
));
3156 rtx
Xexp (rtx
, int);
3164 rtx
Xvecexp (rtx
, int, int);
3167 Xvecexp (rtx x
, int n
, int m
)
3169 return XVECEXP (x
, n
, m
);
3172 int Get_rtx_len (rtx
);
3177 return GET_RTX_LENGTH (GET_CODE (x
));
3180 /* Use upper-case to distinguish from local variables that are sometimes
3181 called next_insn and prev_insn. */
3183 rtx
Next_insn (rtx
);
3186 Next_insn (rtx insn
)
3188 return NEXT_INSN (insn
);
3191 rtx
Prev_insn (rtx
);
3194 Prev_insn (rtx insn
)
3196 return PREV_INSN (insn
);
3200 #include "gt-cris.h"
3204 * eval: (c-set-style "gnu")
3205 * indent-tabs-mode: t