1 /* Definitions for Toshiba Media Processor
2 Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
4 Contributed by Red Hat, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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/>. */
26 -D__section(_x)=__attribute__((section(_x))) \
27 -D__align(_x)=__attribute__((aligned(_x))) \
28 -D__io(_x)=__attribute__((io(_x))) \
29 -D__cb(_x)=__attribute__((cb(_x))) \
30 -D__based=__attribute__((based)) \
31 -D__tiny=__attribute__((tiny)) \
32 -D__near=__attribute__((near)) \
33 -D__far=__attribute__((far)) \
34 -D__vliw=__attribute__((vliw)) \
35 -D__interrupt=__attribute__((interrupt)) \
36 -D__disinterrupt=__attribute__((disinterrupt)) \
37 %{!meb:%{!mel:-D__BIG_ENDIAN__}} \
38 %{meb:-U__LITTLE_ENDIAN__ -D__BIG_ENDIAN__} \
39 %{mel:-U__BIG_ENDIAN__ -D__LITTLE_ENDIAN__} \
40 %{mconfig=*:-D__MEP_CONFIG_%*} \
41 %{mivc2:-D__MEP_CONFIG_CP_DATA_BUS_WIDTH=64} \
45 #define CC1_SPEC "%{!mlibrary:%(config_cc_spec)} \
46 %{!.cc:%{O2:%{!funroll*:--param max-completely-peeled-insns=6 \
47 --param max-unrolled-insns=6 -funroll-loops}}}"
50 #define CC1PLUS_SPEC "%{!mlibrary:%(config_cc_spec)}"
53 #define ASM_SPEC "%{mconfig=*} %{meb:-EB} %{mel:-EL} \
54 %{mno-satur} %{msatur} %{mno-clip} %{mclip} %{mno-minmax} %{mminmax} \
55 %{mno-absdiff} %{mabsdiff} %{mno-leadz} %{mleadz} %{mno-bitops} %{mbitops} \
56 %{mno-div} %{mdiv} %{mno-mult} %{mmult} %{mno-average} %{maverage} \
57 %{mcop32} %{mno-debug} %{mdebug} %{mlibrary}"
59 /* The MeP config tool will edit this spec. */
61 #define STARTFILE_SPEC "%{msdram:%{msim:simsdram-crt0.o%s}} \
62 %{mno-sdram:%{msim:sim-crt0.o%s}} \
63 %{msdram:%{!msim*:sdram-crt0.o%s}} \
64 %{mno-sdram:%{!msim*:crt0.o%s}} \
65 %(config_start_spec) \
66 %{msimnovec:simnovec-crt0.o%s} \
70 #define LIB_SPEC "-( -lc %{msim*:-lsim}%{!msim*:-lnosys} -) %(config_link_spec)"
73 #define LINK_SPEC "%{meb:-EB} %{mel:-EL}"
76 #define ENDFILE_SPEC "crtend.o%s %{msim*:sim-crtn.o%s}%{!msim*:crtn.o%s}"
78 /* The MeP config tool will edit this spec. */
79 #define CONFIG_CC_SPEC "\
80 %{mconfig=default: -mbitops -mleadz -mabsdiff -maverage -mminmax -mclip -msatur -mvl64 -mvliw -mcop64 -D__MEP_CONFIG_CP_DATA_BUS_WIDTH=64 -mivc2}\
82 /* end-config-cc-spec */
84 /* The MeP config tool will edit this spec. */
85 #define CONFIG_LINK_SPEC "\
86 %{mconfig=default: %{!T*:-Tdefault.ld}}\
88 /* end-config-link-spec */
90 /* The MeP config tool will edit this spec. */
91 #define CONFIG_START_SPEC "\
92 %{!msdram:%{!mno-sdram:%{!msim*:crt0.o%s}}} \
93 %{!msdram:%{!mno-sdram:%{msim:sim-crt0.o%s}}} \
95 /* end-config-start-spec */
98 { "config_cc_spec", CONFIG_CC_SPEC }, \
99 { "config_link_spec", CONFIG_LINK_SPEC }, \
100 { "config_start_spec", CONFIG_START_SPEC },
103 #define TARGET_CPU_CPP_BUILTINS() \
106 builtin_define_std ("mep"); \
107 builtin_assert ("machine=mep"); \
111 /* Controlled by MeP-Integrator. */
114 #define MEP_ALL_OPTS (MASK_OPT_AVERAGE \
124 #define TARGET_DEFAULT (MASK_IO_VOLATILE | MASK_OPT_REPEAT | MEP_ALL_OPTS | MASK_LITTLE_ENDIAN)
126 #define TARGET_IO_NO_VOLATILE (! (target_flags & MASK_IO_VOLATILE))
127 #define TARGET_OPT_NOREPEAT (! (target_flags & MASK_OPT_REPEAT))
128 #define TARGET_32BIT_CR_REGS (! (target_flags & MASK_64BIT_CR_REGS))
129 #define TARGET_BIG_ENDIAN (! (target_flags & MASK_LITTLE_ENDIAN))
131 #define TARGET_COPRO_MULT 0
133 #define TARGET_VERSION fprintf (stderr, " (Toshiba Media Processor (MeP))");
135 /* The MeP config tool will replace this as appropriate. */
136 #define DEFAULT_ENDIAN_SPEC "%{!meb: -mel}"
138 /* The MeP config tool will replace this with an -mconfig= switch. */
139 #define LIBRARY_CONFIG_SPEC "-mconfig=default"
141 /* Don't add an endian option when building the libraries. */
142 #define DRIVER_SELF_SPECS \
143 "%{!mlibrary:" DEFAULT_ENDIAN_SPEC "}", \
144 "%{mlibrary: " LIBRARY_CONFIG_SPEC " %{!mel:-meb}}", \
145 "%{mall-opts:-maverage -mmult -mdiv -mbitops -mleadz \
146 -mabsdiff -mminmax -mclip -msatur -mdebug} %<mall-opts", \
147 "%{mno-opts:-mno-average -mno-mult -mno-div -mno-bitops -mno-leadz \
148 -mno-absdiff -mno-minmax -mno-clip -mno-satur -mno-debug} %<mno-opts", \
149 "%{mfar:-ml -mtf -mc=far} %<mfar", \
150 "%{mconfig=default:-mmult -mdiv -D__MEP_CONFIG_ISA=1}"
152 /* The MeP config tool will add COPROC_SELECTION_TABLE here. */
153 /* start-coproc-selection-table */
154 #define COPROC_SELECTION_TABLE \
155 {"default", ISA_EXT1}
156 /* end-coproc-selection-table */
159 #define BITS_BIG_ENDIAN 0
160 #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN ? 0 : 1)
161 #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN ? 0 : 1)
163 #define UNITS_PER_WORD 4
165 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
168 if (GET_MODE_CLASS (MODE) == MODE_INT \
169 && GET_MODE_SIZE (MODE) < 4) \
174 #define PARM_BOUNDARY 32
175 #define STACK_BOUNDARY 32
176 #define PREFERRED_STACK_BOUNDARY 64
177 #define FUNCTION_BOUNDARY 16
178 #define BIGGEST_ALIGNMENT 64
180 #define DATA_ALIGNMENT(TYPE, ALIGN) \
181 (TREE_CODE (TYPE) == ARRAY_TYPE \
182 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
183 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
185 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
186 (TREE_CODE (EXP) == STRING_CST \
187 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
189 #define STRICT_ALIGNMENT 1
191 #define PCC_BITFIELD_TYPE_MATTERS 1
193 #define DEFAULT_VTABLE_THUNKS 1
196 #define INT_TYPE_SIZE 32
197 #define SHORT_TYPE_SIZE 16
198 #define LONG_TYPE_SIZE 32
199 #define LONG_LONG_TYPE_SIZE 64
200 #define CHAR_TYPE_SIZE 8
201 #define FLOAT_TYPE_SIZE 32
202 #define DOUBLE_TYPE_SIZE 64
203 #define LONG_DOUBLE_TYPE_SIZE 64
204 #define DEFAULT_SIGNED_CHAR 1
208 16..47 control registers
209 48..79 coprocessor registers
210 80..111 coprocessor control registers
211 112 virtual arg pointer register */
213 #define FIRST_PSEUDO_REGISTER (LAST_SHADOW_REGISTER + 1)
215 /* R12 is optionally FP. R13 is TP, R14 is GP, R15 is SP. */
216 /* hi and lo can be used as general registers. Others have
218 /* A "1" here means the register is generally not available to gcc,
219 and is assumed to remain unchanged or unused throughout. */
220 #define FIXED_REGISTERS { \
221 /* core registers */ \
222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, \
223 /* control registers */ \
224 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, \
225 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
226 /* coprocessor registers */ \
227 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
228 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
229 /* coprocessor control registers */ \
230 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
231 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
232 /* virtual arg pointer */ \
233 1, FIXED_SHADOW_REGISTERS \
236 /* This is a call-clobbered reg not used for args or return value,
237 that we use as a temp for saving control registers in the prolog
238 and restoring them in the epilog. */
239 #define REGSAVE_CONTROL_TEMP 11
241 /* A "1" here means a register may be changed by a function without
242 needing to preserve its previous value. */
243 #define CALL_USED_REGISTERS { \
244 /* core registers */ \
245 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, \
246 /* control registers */ \
247 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
248 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
249 /* coprocessor registers */ \
250 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
251 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
252 /* coprocessor control registers */ \
253 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
254 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
255 /* virtual arg pointer */ \
256 1, CALL_USED_SHADOW_REGISTERS \
259 #define CONDITIONAL_REGISTER_USAGE \
260 mep_conditional_register_usage ();
262 #define REG_ALLOC_ORDER { \
263 /* core registers */ \
264 3, 2, 1, 0, 9, 10, 11, 12, 4, 5, 6, 7, 8, 13, 14, 15, \
265 /* control registers */ \
266 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \
267 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
268 /* coprocessor registers */ \
269 /* Prefer to use the non-loadable registers when looking for a \
270 member of CR_REGS (as opposed to LOADABLE_CR_REGS). */ \
271 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 48, 49, 50, 51, 52, 58, \
272 59, 60, 61, 62, 63, 53, 54, 55, 56, 57, 74, 75, 76, 77, 78, 79, \
273 /* coprocessor control registers */ \
274 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, \
275 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, \
276 /* virtual arg pointer */ \
277 112, SHADOW_REG_ALLOC_ORDER \
280 /* We must somehow disable register remapping for interrupt functions. */
281 extern char mep_leaf_registers[];
282 #define LEAF_REGISTERS mep_leaf_registers
283 #define LEAF_REG_REMAP(REG) (REG)
286 #define FIRST_GR_REGNO 0
287 #define FIRST_CONTROL_REGNO (FIRST_GR_REGNO + 16)
288 #define FIRST_CR_REGNO (FIRST_CONTROL_REGNO + 32)
289 #define FIRST_CCR_REGNO (FIRST_CR_REGNO + 32)
291 #define GR_REGNO_P(REGNO) \
292 ((unsigned) ((REGNO) - FIRST_GR_REGNO) < 16)
294 #define CONTROL_REGNO_P(REGNO) \
295 ((unsigned) ((REGNO) - FIRST_CONTROL_REGNO) < 32)
297 #define LOADABLE_CR_REGNO_P(REGNO) \
298 ((unsigned) ((REGNO) - FIRST_CR_REGNO) < 16)
300 #define CR_REGNO_P(REGNO) \
301 ((unsigned) ((REGNO) - FIRST_CR_REGNO) < 32)
303 #define CCR_REGNO_P(REGNO) \
304 ((unsigned) ((REGNO) - FIRST_CCR_REGNO) < 32)
306 #define ANY_CONTROL_REGNO_P(REGNO) \
307 (CONTROL_REGNO_P (REGNO) || CCR_REGNO_P (REGNO))
309 #define HARD_REGNO_NREGS(REGNO, MODE) \
310 ((CR_REGNO_P (REGNO) && TARGET_64BIT_CR_REGS) \
311 ? (GET_MODE_SIZE (MODE) + 8 - 1) / 8 \
312 : (GET_MODE_SIZE (MODE) + 4 - 1) / 4)
314 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
316 #define MODES_TIEABLE_P(MODE1, MODE2) 1
318 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
319 mep_cannot_change_mode_class (FROM, TO, CLASS)
336 CONTROL_OR_GENERAL_REGS,
348 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
350 #define REG_CLASS_NAMES { \
361 "GENERAL_NOT_R0_REGS", \
364 "CONTROL_OR_GENERAL_REGS", \
369 "LOADABLE_CR_REGS", \
374 #define REG_CLASS_CONTENTS { \
375 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
376 { 0x00008000, 0x00000000, 0x00000000, 0x00000000 }, /* SP_REGS */ \
377 { 0x00002000, 0x00000000, 0x00000000, 0x00000000 }, /* TP_REGS */ \
378 { 0x00004000, 0x00000000, 0x00000000, 0x00000000 }, /* GP_REGS */ \
379 { 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, /* R0_REGS */ \
380 { 0x00400000, 0x00000000, 0x00000000, 0x00000000 }, /* RPC_REGS */ \
381 { 0x00800000, 0x00000000, 0x00000000, 0x00000000 }, /* HI_REGS */ \
382 { 0x01000000, 0x00000000, 0x00000000, 0x00000000 }, /* LO_REGS */ \
383 { 0x01800000, 0x00000000, 0x00000000, 0x00000000 }, /* HILO_REGS */ \
384 { 0x000000ff, 0x00000000, 0x00000000, 0x00000000 }, /* TPREL_REGS */ \
385 { 0x0000fffe, 0x00000000, 0x00000000, 0x00000000 }, /* GENERAL_NOT_R0_REGS */ \
386 { 0x0000ffff, 0x00000000, 0x00000000, 0x00010000 }, /* GENERAL_REGS */ \
387 { 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 }, /* CONTROL_REGS */ \
388 { 0xffffffff, 0x0000ffff, 0x00000000, 0x00000000 }, /* CONTROL_OR_GENERAL_REGS */ \
389 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* USER0_REGS */ \
390 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* USER1_REGS */ \
391 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* USER2_REGS */ \
392 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* USER3_REGS */ \
393 { 0x00000000, 0xffff0000, 0x00000000, 0x00000000 }, /* LOADABLE_CR_REGS */ \
394 { 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 }, /* CR_REGS */ \
395 { 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff }, /* CCR_REGS */ \
396 { 0xffffffff, 0xffffffff, 0xffffffff, 0x0001ffff }, /* ALL_REGS */ \
399 #define REGNO_REG_CLASS(REGNO) mep_regno_reg_class (REGNO)
401 #define IRA_COVER_CLASSES { GENERAL_REGS, CONTROL_REGS, CR_REGS, CCR_REGS, LIM_REG_CLASSES }
403 #define BASE_REG_CLASS GENERAL_REGS
404 #define INDEX_REG_CLASS GENERAL_REGS
407 #define REG_CLASS_FROM_CONSTRAINT(CHAR, STRING) \
408 mep_reg_class_from_constraint (CHAR, STRING)
411 #define REGNO_OK_FOR_BASE_P(NUM) (GR_REGNO_P (NUM) \
412 || (NUM) == ARG_POINTER_REGNUM \
413 || (NUM) >= FIRST_PSEUDO_REGISTER)
415 #define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM)
417 #define PREFERRED_RELOAD_CLASS(X, CLASS) mep_preferred_reload_class (X, CLASS)
419 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
420 mep_secondary_input_reload_class (CLASS, MODE, X)
421 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
422 mep_secondary_output_reload_class (CLASS, MODE, X)
423 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
424 mep_secondary_memory_needed (CLASS1, CLASS2, MODE)
426 #define CLASS_MAX_NREGS(CLASS, MODE) \
427 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
430 #define CONST_OK_FOR_LETTER_P(VALUE, C) mep_const_ok_for_letter_p (VALUE, C)
432 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
434 #define CONSTRAINT_LEN(C, STR) \
435 ((C) == 'e' ? 2 : DEFAULT_CONSTRAINT_LEN (C, STR))
436 #define EXTRA_CONSTRAINT(VALUE, C) mep_extra_constraint (VALUE, C)
439 #define WANT_GCC_DECLARATIONS
440 #include "mep-intrin.h"
441 #undef WANT_GCC_DECLARATIONS
443 extern int mep_intrinsic_insn[];
444 extern unsigned int mep_selected_isa;
446 /* True if intrinsic X is available. X is a mep_* value declared
448 #define MEP_INTRINSIC_AVAILABLE_P(X) (mep_intrinsic_insn[X] >= 0)
450 /* Used to define CGEN_ENABLE_INTRINSIC_P in mep-intrin.h. */
451 #define CGEN_CURRENT_ISAS mep_selected_isa
452 #define CGEN_CURRENT_GROUP \
453 (mep_vliw_function_p (cfun->decl) ? GROUP_VLIW : GROUP_NORMAL)
457 #define STACK_GROWS_DOWNWARD 1
458 #define FRAME_GROWS_DOWNWARD 1
459 #define STARTING_FRAME_OFFSET 0
460 #define FIRST_PARM_OFFSET(FUNDECL) 0
461 #define INCOMING_FRAME_SP_OFFSET 0
463 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) mep_return_addr_rtx (COUNT)
464 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, LP_REGNO)
465 #define DWARF_FRAME_RETURN_COLUMN LP_REGNO
467 #define STACK_POINTER_REGNUM 15
468 #define FRAME_POINTER_REGNUM 8
469 #define ARG_POINTER_REGNUM 112
470 #define RETURN_ADDRESS_POINTER_REGNUM 17
471 #define STATIC_CHAIN_REGNUM 0
475 #define ELIMINABLE_REGS \
477 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
478 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
479 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
482 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
483 (OFFSET) = mep_elimination_offset (FROM, TO)
485 #define ACCUMULATE_OUTGOING_ARGS 1
489 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
497 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
498 mep_init_cumulative_args (& (CUM), FNTYPE, LIBNAME, FNDECL)
500 #define FUNCTION_ARG_REGNO_P(REGNO) \
501 (((REGNO) >= 1 && (REGNO) <= 4) \
502 || ((REGNO) >= FIRST_CR_REGNO + 1 \
503 && (REGNO) <= FIRST_CR_REGNO + 4 \
506 #define RETURN_VALUE_REGNUM 0
508 #define FUNCTION_VALUE(VALTYPE, FUNC) mep_function_value (VALTYPE, FUNC)
509 #define LIBCALL_VALUE(MODE) mep_libcall_value (MODE)
511 #define FUNCTION_VALUE_REGNO_P(REGNO) \
512 ((REGNO) == RETURN_VALUE_REGNUM)
514 #define DEFAULT_PCC_STRUCT_RETURN 0
516 #define STRUCT_VALUE 0
518 #define FUNCTION_OK_FOR_SIBCALL(DECL) mep_function_ok_for_sibcall(DECL)
520 /* Prologue and epilogues are all handled via RTL. */
522 #define EXIT_IGNORE_STACK 1
524 #define EPILOGUE_USES(REGNO) mep_epilogue_uses (REGNO)
526 /* Profiling is supported. */
528 #define FUNCTION_PROFILER(FILE, LABELNO) mep_function_profiler (FILE);
529 #undef TARGET_HAS_F_SETLKW
530 #define NO_PROFILE_COUNTERS 1
532 /* Trampolines are built at run-time. The cache is invalidated at
535 #define TRAMPOLINE_SIZE 20
538 #define MAX_REGS_PER_ADDRESS 1
541 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
542 if (mep_legitimate_address ((MODE), (X), 1)) goto LABEL
544 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
545 if (mep_legitimate_address ((MODE), (X), 0)) goto LABEL
549 #define REG_OK_FOR_BASE_P(X) GR_REGNO_P (REGNO (X))
551 #define REG_OK_FOR_BASE_P(X) (GR_REGNO_P (REGNO (X)) \
552 || REGNO (X) == ARG_POINTER_REGNUM \
553 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
556 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
558 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
559 if (mep_legitimize_reload_address (&(X), (MODE), (OPNUM), (TYPE), (IND_LEVELS))) \
562 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
564 #define LEGITIMATE_CONSTANT_P(X) \
565 mep_legitimate_constant_p(X)
567 #define SELECT_CC_MODE(OP, X, Y) CCmode
570 /* Moves between control regs need a scratch. */
571 #define REGISTER_MOVE_COST(MODE, FROM, TO) mep_register_move_cost (MODE, FROM, TO)
573 #define SLOW_BYTE_ACCESS 1
575 /* Define this macro if it is as good or better to call a constant function
576 address than to call an address kept in a register. */
577 #define NO_FUNCTION_CSE
580 #define TEXT_SECTION_ASM_OP "\t.text\n\t.core"
581 #define DATA_SECTION_ASM_OP "\t.data"
582 #define BSS_SECTION_ASM_OP ".bss"
584 #define USE_SELECT_SECTION_FOR_FUNCTIONS 1
586 #define JUMP_TABLES_IN_TEXT_SECTION 1
588 #define TARGET_ASM_FILE_END mep_file_cleanups
590 #define ASM_APP_ON "#APP\n"
591 #define ASM_APP_OFF "#NO_APP\n"
593 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
598 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
599 fprintf (FILE, "\t.long\t0x%lx,0x%lx\n", l[0], l[1]); \
603 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
608 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
609 fprintf ((FILE), "\t.long\t0x%lx\n", l); \
613 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
616 fprintf (FILE, "\t.byte\t"); \
617 output_addr_const (FILE, (VALUE)); \
618 fprintf (FILE, "\n"); \
622 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
625 fprintf (FILE, "\t.hword\t"); \
626 output_addr_const (FILE, (VALUE)); \
627 fprintf (FILE, "\n"); \
631 #define ASM_OUTPUT_INT(FILE, VALUE) \
634 fprintf (FILE, "\t.word\t"); \
635 output_addr_const (FILE, (VALUE)); \
636 fprintf (FILE, "\n"); \
640 #define ASM_OUTPUT_BYTE(STREAM, VALUE) \
641 fprintf (STREAM, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
643 /* Most of these are here to support based/tiny/far/io attributes. */
645 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
646 mep_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 1)
648 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
649 mep_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 0)
651 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
654 assemble_name (STREAM, NAME); \
655 fputs (":\n", STREAM); \
659 /* Globalizing directive for a label. */
660 #define GLOBAL_ASM_OP "\t.globl "
662 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
663 asm_fprintf ((STREAM), "%U%s", mep_strip_name_encoding (NAME))
665 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
668 (OUTVAR) = (char *) alloca (strlen ((NAME)) + 12); \
669 sprintf ((OUTVAR), "%s.%ld", (NAME), (long)(NUMBER)); \
674 #define REGISTER_NAMES \
676 /* Core registers. */ \
677 "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", \
678 "$8", "$9", "$10", "$11", "$12", "$tp", "$gp", "$sp", \
679 /* Control registers. */ \
680 "$pc", "$lp", "$sar", "3", "$rpb", "$rpe", "$rpc", "$hi", \
681 "$lo", "9", "10", "11", "$mb0", "$me0", "$mb1", "$me1", \
682 "$psw", "$id", "$tmp", "$epc", "$exc", "$cfg", "22", "$npc", \
683 "$dbg", "$depc", "$opt", "$rcfg", "$ccfg", "29", "30", "31", \
684 /* Coprocessor registers. */ \
685 "$c0", "$c1", "$c2", "$c3", "$c4", "$c5", "$c6", "$c7", \
686 "$c8", "$c9", "$c10", "$c11", "$c12", "$c13", "$c14", "$c15", \
687 "$c16", "$c17", "$c18", "$c19", "$c20", "$c21", "$c22", "$c23", \
688 "$c24", "$c25", "$c26", "$c27", "$c28", "$c29", "$c30", "$c31", \
689 /* Coprocessor control registers. */ \
690 "$ccr0", "$ccr1", "$ccr2", "$ccr3", "$ccr4", "$ccr5", "$ccr6", \
691 "$ccr7", "$ccr8", "$ccr9", "$ccr10", "$ccr11", "$ccr12", "$ccr13", \
692 "$ccr14", "$ccr15", "$ccr16", "$ccr17", "$ccr18", "$ccr19", "$ccr20", \
693 "$ccr21", "$ccr22", "$ccr23", "$ccr24", "$ccr25", "$ccr26", "$ccr27", \
694 "$ccr28", "$ccr29", "$ccr30", "$ccr31", \
695 /* Virtual arg pointer. */ \
696 "$argp", SHADOW_REGISTER_NAMES \
699 /* We duplicate some of the above because we twiddle the above
700 according to *how* the registers are used. Likewise, we include
701 the standard names for coprocessor control registers so that
702 coprocessor options can rename them in the default table. Note
703 that these are compared to stripped names (see REGISTER_PREFIX
705 #define ADDITIONAL_REGISTER_NAMES \
707 { "8", 8 }, { "fp", 8 }, \
708 { "13", 13 }, { "tp", 13 }, \
709 { "14", 14 }, { "gp", 14 }, \
710 { "15", 15 }, { "sp", 15 }, \
711 { "ccr0", FIRST_CCR_REGNO + 0 }, \
712 { "ccr1", FIRST_CCR_REGNO + 1 }, \
713 { "ccr2", FIRST_CCR_REGNO + 2 }, \
714 { "ccr3", FIRST_CCR_REGNO + 3 }, \
715 { "ccr4", FIRST_CCR_REGNO + 4 }, \
716 { "ccr5", FIRST_CCR_REGNO + 5 }, \
717 { "ccr6", FIRST_CCR_REGNO + 6 }, \
718 { "ccr7", FIRST_CCR_REGNO + 7 }, \
719 { "ccr8", FIRST_CCR_REGNO + 8 }, \
720 { "ccr9", FIRST_CCR_REGNO + 9 }, \
721 { "ccr10", FIRST_CCR_REGNO + 10 }, \
722 { "ccr11", FIRST_CCR_REGNO + 11 }, \
723 { "ccr12", FIRST_CCR_REGNO + 12 }, \
724 { "ccr13", FIRST_CCR_REGNO + 13 }, \
725 { "ccr14", FIRST_CCR_REGNO + 14 }, \
726 { "ccr15", FIRST_CCR_REGNO + 15 }, \
727 { "ccr16", FIRST_CCR_REGNO + 16 }, \
728 { "ccr17", FIRST_CCR_REGNO + 17 }, \
729 { "ccr18", FIRST_CCR_REGNO + 18 }, \
730 { "ccr19", FIRST_CCR_REGNO + 19 }, \
731 { "ccr20", FIRST_CCR_REGNO + 20 }, \
732 { "ccr21", FIRST_CCR_REGNO + 21 }, \
733 { "ccr22", FIRST_CCR_REGNO + 22 }, \
734 { "ccr23", FIRST_CCR_REGNO + 23 }, \
735 { "ccr24", FIRST_CCR_REGNO + 24 }, \
736 { "ccr25", FIRST_CCR_REGNO + 25 }, \
737 { "ccr26", FIRST_CCR_REGNO + 26 }, \
738 { "ccr27", FIRST_CCR_REGNO + 27 }, \
739 { "ccr28", FIRST_CCR_REGNO + 28 }, \
740 { "ccr29", FIRST_CCR_REGNO + 29 }, \
741 { "ccr30", FIRST_CCR_REGNO + 30 }, \
742 { "ccr31", FIRST_CCR_REGNO + 31 } \
745 /* We watch for pipeline hazards with these */
746 #define ASM_OUTPUT_OPCODE(STREAM, PTR) mep_asm_output_opcode (STREAM, PTR)
747 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) mep_final_prescan_insn (INSN, OPVEC, NOPERANDS)
749 #define PRINT_OPERAND(STREAM, X, CODE) mep_print_operand (STREAM, X, CODE)
751 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '!' || (CODE) == '<')
753 #define PRINT_OPERAND_ADDRESS(STREAM, X) mep_print_operand_address (STREAM, X)
755 #define REGISTER_PREFIX "$"
756 #define LOCAL_LABEL_PREFIX "."
757 #define USER_LABEL_PREFIX ""
758 #define IMMEDIATE_PREFIX ""
762 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
763 fprintf (STREAM, "\t.word .L%d\n", VALUE)
767 #undef PREFERRED_DEBUGGING_TYPE
768 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
769 #define DWARF2_DEBUGGING_INFO 1
770 #define DWARF2_UNWIND_INFO 1
772 #define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? (N) + 10 : INVALID_REGNUM)
774 #define EH_RETURN_STACKADJ_RTX mep_return_stackadj_rtx ()
775 #define EH_RETURN_HANDLER_RTX mep_return_handler_rtx ()
777 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
781 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
782 fprintf ((STREAM), "\t.p2align %d\n", (POWER))
786 #define CASE_VECTOR_MODE SImode
788 #define WORD_REGISTER_OPERATIONS
789 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
791 #define SHORT_IMMEDIATES_SIGN_EXTEND
795 #define SHIFT_COUNT_TRUNCATED 1
797 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
799 #define STORE_FLAG_VALUE 1
803 #define FUNCTION_MODE SImode
805 #define REGISTER_TARGET_PRAGMAS() mep_register_pragmas ()
807 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
809 /* If defined, a C expression to determine the base term of address X.
810 This macro is used in only one place: `find_base_term' in alias.c.
812 It is always safe for this macro to not be defined. It exists so
813 that alias analysis can understand machine-dependent addresses.
815 The typical use of this macro is to handle addresses containing
816 a label_ref or symbol_ref within an UNSPEC. */
817 #define FIND_BASE_TERM(X) mep_find_base_term (X)