1 /* Definitions of target machine for GCC,
2 For Ubicom IP2022 Communications Controller
4 Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5 Contributed by Red Hat, Inc and Ubicom, Inc.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
25 #undef ASM_SPEC /* We have a GAS assembler. */
27 #define TARGET_CPU_CPP_BUILTINS() \
30 builtin_define_std ("IP2K"); \
31 builtin_define ("_DOUBLE_IS_32BITS"); \
32 builtin_define ("_BUFSIZ=512"); \
33 builtin_define ("__FILENAME_MAX__=128"); \
37 /* This declaration should be present. */
38 extern int target_flags;
40 #define TARGET_SWITCHES {{"",0, NULL}}
42 #define TARGET_VERSION fprintf (stderr, " (ip2k, GNU assembler syntax)")
44 /* Caller-saves is not a win for the IP2K. Pretty much anywhere that
45 a register is permitted allows SP-relative addresses too.
47 This machine doesn't have PIC addressing modes, so disable that also. */
49 #define OVERRIDE_OPTIONS \
51 flag_caller_saves = 0; \
55 /* Put each function in its own section so that PAGE-instruction
56 relaxation can do its best. */
57 #define OPTIMIZATION_OPTIONS(LEVEL, SIZEFLAG) \
59 if ((LEVEL) || (SIZEFLAG)) \
60 flag_function_sections = 1; \
63 #define BITS_BIG_ENDIAN 0
64 #define BYTES_BIG_ENDIAN 1
65 #define WORDS_BIG_ENDIAN 1
66 #define BITS_PER_WORD 8
67 #define UNITS_PER_WORD (BITS_PER_WORD / BITS_PER_UNIT)
69 /* Width in bits of a pointer.
70 See also the macro `Pmode' defined below. */
71 #define POINTER_SIZE 16
73 /* Maximum sized of reasonable data type DImode or Dfmode ... */
74 #define MAX_FIXED_MODE_SIZE 64
76 #define PARM_BOUNDARY 8
77 #define FUNCTION_BOUNDARY 16
78 #define EMPTY_FIELD_BOUNDARY 8
79 #define BIGGEST_ALIGNMENT 8
81 #define STRICT_ALIGNMENT 0
83 #define PCC_BITFIELD_TYPE_MATTERS 1
86 #define INT_TYPE_SIZE 16
88 #undef SHORT_TYPE_SIZE
89 #define SHORT_TYPE_SIZE 16
92 #define LONG_TYPE_SIZE 32
94 #undef LONG_LONG_TYPE_SIZE
95 #define LONG_LONG_TYPE_SIZE 64
98 #define CHAR_TYPE_SIZE 8
100 #undef FLOAT_TYPE_SIZE
101 #define FLOAT_TYPE_SIZE 32
103 #undef DOUBLE_TYPE_SIZE
104 #define DOUBLE_TYPE_SIZE 32
106 #undef LONG_DOUBLE_TYPE_SIZE
107 #define LONG_DOUBLE_TYPE_SIZE 32
109 #define DEFAULT_SIGNED_CHAR 1
111 /* #define DEFAULT_SHORT_ENUMS 1
112 This was the default for the IP2k but gcc has a bug (as of 17th May
113 2001) in the way that library calls to the memory checker functions
114 are issues that screws things up if an enum is not equivalent to
117 #define SIZE_TYPE "unsigned int"
119 #define PTRDIFF_TYPE "int"
122 #define WCHAR_TYPE "int"
123 #undef WCHAR_TYPE_SIZE
124 #define WCHAR_TYPE_SIZE 16
126 #define HARD_REG_SIZE (UNITS_PER_WORD)
127 /* Standard register usage.
129 for the IP2K, we are going to have a LOT of registers, but only some of them
132 #define FIRST_PSEUDO_REGISTER (0x104) /* Skip over physical regs, VFP, AP. */
135 #define REG_IPH REG_IP
139 #define REG_SPH REG_SP
146 #define REG_STATUS 0xb
149 #define REG_DPH REG_DP
154 #define REG_CALLH 0x7e /* Call-stack readout. */
155 #define REG_CALLL 0x7f
158 #define REG_RESULT 0x80 /* Result register (upto 8 bytes). */
159 #define REG_FP 0xfd /* 2 bytes for FRAME chain */
161 #define REG_ZERO 0xff /* Initialized to zero by runtime. */
163 #define REG_VFP 0x100 /* Virtual frame pointer. */
164 #define REG_AP 0x102 /* Virtual arg pointer. */
166 /* Status register bits. */
171 #define FIXED_REGISTERS {\
172 1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r0.. r31*/\
173 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r32.. r63*/\
174 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r64.. r95*/\
175 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r96..r127*/\
176 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,/*r128..r159*/\
177 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r160..r191*/\
178 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r192..r223*/\
179 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r224..r255*/\
182 #define CALL_USED_REGISTERS { \
183 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r0.. r31*/\
184 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r32.. r63*/\
185 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r64.. r95*/\
186 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r96..r127*/\
187 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r128..r159*/\
188 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r160..r191*/\
189 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r192..r223*/\
190 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r224..r255*/\
193 #define NON_SAVING_SETJMP 0
195 #define REG_ALLOC_ORDER { \
196 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, \
197 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, \
198 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, \
199 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
200 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, \
201 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, \
202 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7, \
203 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, \
204 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, \
205 0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, \
206 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7, \
207 0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, \
208 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7, \
209 0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, \
210 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, \
211 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, \
212 0x00,0x01,0x02,0x03,0x0c,0x0d,0x06,0x07, \
213 0x08,0x09,0x0a,0x0b,0x04,0x05,0x0e,0x0f, \
214 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, \
215 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, \
216 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, \
217 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, \
218 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, \
219 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, \
220 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, \
221 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, \
222 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, \
223 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, \
224 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, \
225 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, \
226 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, \
227 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, \
228 0x100,0x101,0x102,0x103}
231 #define ORDER_REGS_FOR_LOCAL_ALLOC ip2k_init_local_alloc (reg_alloc_order)
233 /* Are we allowed to rename registers? For some reason, regrename was
234 changing DP to IP (when it appeared in addresses like (plus:HI
235 (reg: DP) (const_int 37)) - and that's bad because IP doesn't
238 #define HARD_REGNO_RENAME_OK(REG, NREG) \
239 (((REG) == REG_DPH) ? 0 \
240 : ((REG) == REG_IPH) ? ((NREG) == REG_DPH) \
241 : (((NREG) == REG_IPL) || ((NREG) == REG_DPL)) ? 0 : 1)
243 #define HARD_REGNO_NREGS(REGNO, MODE) \
244 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
246 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
248 #define MODES_TIEABLE_P(MODE1, MODE2) \
249 (((MODE1) == QImode && (MODE2) == HImode) \
250 || ((MODE2) == QImode && (MODE1) == HImode))
251 /* We originally had this as follows - this isn't a win on the IP2k
252 though as registers just get in our way!
254 #define MODES_TIEABLE_P(MODE1, MODE2) \
255 (((MODE1) > HImode && (MODE2) == HImode)
256 || ((MODE1) == HImode && (MODE2) > HImode)) */
272 ALL_REGS = GENERAL_REGS,
276 #define N_REG_CLASSES (int)LIM_REG_CLASSES
278 #define REG_CLASS_NAMES { \
295 #define REG_CLASS_CONTENTS { \
296 {0x00000000, 0, 0, 0, 0, 0, 0, 0, 0}, /* NO_REGS */ \
297 {0x00001000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DPH_REGS */ \
298 {0x00002000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DPL_REGS */ \
299 {0x00003000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DP_REGS */ \
300 {0x000000c0, 0, 0, 0, 0, 0, 0, 0, 0}, /* SP_REGS */ \
301 {0x00000010, 0, 0, 0, 0, 0, 0, 0, 0}, /* IPH_REGS */ \
302 {0x00000020, 0, 0, 0, 0, 0, 0, 0, 0}, /* IPL_REGS */ \
303 {0x00000030, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP_REGS */ \
304 {0x000030c0, 0, 0, 0, 0, 0, 0, 0, 0}, /* DP_SP_REGS */ \
305 {0x000030f0, 0, 0, 0, 0, 0, 0, 0, 0}, /* PTR_REGS */ \
306 {0xffffcf0f,-1,-1,-1,-1,-1,-1,-1, 0}, /* NONPTR_REGS */ \
307 {0xffffff3f,-1,-1,-1,-1,-1,-1,-1, 0}, /* NONSP_REGS */ \
308 {0xffffffff,-1,-1,-1,-1,-1,-1,-1,15} /* GENERAL_REGS */ \
311 #define REGNO_REG_CLASS(R) \
312 ( (R) == REG_IPH ? IPH_REGS \
313 : (R) == REG_IPL ? IPL_REGS \
314 : (R) == REG_DPH ? DPH_REGS \
315 : (R) == REG_DPL ? DPL_REGS \
316 : (R) == REG_SPH ? SP_REGS \
317 : (R) == REG_SPL ? SP_REGS \
320 #define MODE_BASE_REG_CLASS(MODE) ((MODE) == QImode ? PTR_REGS : DP_SP_REGS)
322 #define BASE_REG_CLASS PTR_REGS
324 #define INDEX_REG_CLASS NO_REGS
326 #define REG_CLASS_FROM_LETTER(C) \
327 ( (C) == 'j' ? IPH_REGS \
328 : (C) == 'k' ? IPL_REGS \
329 : (C) == 'f' ? IP_REGS \
330 : (C) == 'y' ? DPH_REGS \
331 : (C) == 'z' ? DPL_REGS \
332 : (C) == 'b' ? DP_REGS \
333 : (C) == 'u' ? NONSP_REGS \
334 : (C) == 'q' ? SP_REGS \
335 : (C) == 'c' ? DP_SP_REGS \
336 : (C) == 'a' ? PTR_REGS \
337 : (C) == 'd' ? NONPTR_REGS \
340 #define REGNO_OK_FOR_BASE_P(R) \
341 ((R) == REG_DP || (R) == REG_IP || (R) == REG_SP)
343 #define REGNO_MODE_OK_FOR_BASE_P(R,M) \
344 ((R) == REG_DP || (R) == REG_SP \
345 || ((R) == REG_IP && GET_MODE_SIZE (M) <= 1))
347 #define REGNO_OK_FOR_INDEX_P(NUM) 0
349 #define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
351 #define SMALL_REGISTER_CLASSES 1
353 #define CLASS_LIKELY_SPILLED_P(CLASS) class_likely_spilled_p(CLASS)
355 #define CLASS_MAX_NREGS(CLASS, MODE) GET_MODE_SIZE (MODE)
357 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
358 ((C) == 'I' ? (VALUE) >= -255 && (VALUE) <= -1 : \
359 (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 7 : \
360 (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 127 : \
361 (C) == 'L' ? (VALUE) > 0 && (VALUE) < 128: \
362 (C) == 'M' ? (VALUE) == -1: \
363 (C) == 'N' ? (VALUE) == 1: \
364 (C) == 'O' ? (VALUE) == 0: \
365 (C) == 'P' ? (VALUE) >= 0 && (VALUE) <= 255: \
368 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
370 #define EXTRA_CONSTRAINT(X, C) ip2k_extra_constraint (X, C)
372 /* This is an undocumented variable which describes
373 how GCC will pop a data. */
374 #define STACK_POP_CODE PRE_INC
376 #define STACK_PUSH_CODE POST_DEC
378 #define STACK_CHECK_BUILTIN 1
379 /* Prologue code will do stack checking as necessary. */
381 #define STARTING_FRAME_OFFSET (0)
383 #define FRAME_GROWS_DOWNWARD 1
384 #define STACK_GROWS_DOWNWARD 1
386 /* On IP2K arg pointer is virtual and resolves to either SP or FP
387 after we've resolved what registers are saved (fp chain, return
390 #define FIRST_PARM_OFFSET(FUNDECL) 0
392 #define STACK_POINTER_OFFSET 1
393 /* IP2K stack is post-decremented, so 0(sp) is address of open space
394 and 1(sp) is offset to the location avobe the forst location at which
395 outgoing arguments are placed. */
397 #define STACK_BOUNDARY 8
399 #define STACK_POINTER_REGNUM REG_SP
401 #define FRAME_POINTER_REGNUM REG_VFP
402 #define HARD_FRAME_POINTER_REGNUM REG_FP
404 #define ARG_POINTER_REGNUM REG_AP
406 /* We don't really want to support nested functions. But we'll crash
407 in various testsuite tests if we don't at least define the register
408 to contain the static chain. The return value register is about as
409 bad a place as any for this. */
411 #define STATIC_CHAIN_REGNUM REG_RESULT
413 #define FRAME_POINTER_REQUIRED (!flag_omit_frame_pointer)
415 #define ELIMINABLE_REGS { \
416 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
417 {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
418 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
419 {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
420 {HARD_FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
423 #define CAN_ELIMINATE(FROM, TO) \
424 ((FROM) == HARD_FRAME_POINTER_REGNUM \
425 ? (flag_omit_frame_pointer && !frame_pointer_needed) : 1)
426 /* Don't eliminate FP unless we EXPLICITLY_ASKED */
428 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
429 ((OFFSET) = ip2k_init_elim_offset ((FROM), (TO)))
431 #define RETURN_ADDR_RTX(COUNT, X) \
432 (((COUNT) == 0) ? gen_rtx_REG (HImode, REG_CALLH) : NULL_RTX)
434 #define PUSH_ROUNDING(NPUSHED) (NPUSHED)
436 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
437 ip2k_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE))
439 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
441 #define CUMULATIVE_ARGS int
443 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
446 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)
448 /* All arguments are passed on stack - do nothing here. */
450 #define FUNCTION_ARG_REGNO_P(R) 0
452 #define FUNCTION_VALUE(VALTYPE, FUNC) \
453 ((TYPE_MODE (VALTYPE) == QImode) \
454 ? gen_rtx_REG (TYPE_MODE (VALTYPE), REG_RESULT + 1) \
455 : gen_rtx_REG (TYPE_MODE (VALTYPE), REG_RESULT))
457 /* Because functions returning 'char' actually widen to 'int', we have to
458 use $81 as the return location if we think we only have a 'char'. */
460 #define LIBCALL_VALUE(MODE) gen_rtx_REG ((MODE), REG_RESULT)
462 #define FUNCTION_VALUE_REGNO_P(N) ((N) == REG_RESULT)
464 /* Indicate that large structures are passed by reference. */
465 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM,MODE,TYPE,NAMED) 0
467 #define DEFAULT_PCC_STRUCT_RETURN 0
469 #define EPILOGUE_USES(REGNO) 0
472 /* Hmmm. We don't actually like constants as addresses - they always need
473 to be loaded to a register, except for function calls which take an
474 address by immediate value. But changing this to zero had negative
475 effects, causing the compiler to get very confused.... */
477 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
479 #define MAX_REGS_PER_ADDRESS 1
482 # define GO_IF_LEGITIMATE_ADDRESS(MODE, OPERAND, ADDR) \
484 if (legitimate_address_p ((MODE), (OPERAND), 1)) \
488 # define GO_IF_LEGITIMATE_ADDRESS(MODE, OPERAND, ADDR) \
490 if (legitimate_address_p ((MODE), (OPERAND), 0)) \
495 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
497 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
498 (REGNO (X) >= FIRST_PSEUDO_REGISTER \
499 || (REGNO (X) == REG_FP) \
500 || (REGNO (X) == REG_VFP) \
501 || (REGNO (X) == REG_AP) \
502 || REG_OK_FOR_BASE_STRICT_P(X))
505 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
507 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NOSTRICT_P (X)
510 #define REG_OK_FOR_INDEX_P(X) 0
512 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
513 do { rtx orig_x = (X); \
514 (X) = legitimize_address ((X), (OLDX), (MODE), 0); \
515 if ((X) != orig_x && memory_address_p ((MODE), (X))) \
519 /* Is X a legitimate register to reload, or is it a pseudo stack-temp
520 that is problematic for push_reload() ? */
523 (! (reg_equiv_memory_loc[REGNO (X)] \
524 && (reg_equiv_address[REGNO (X)] \
525 || num_not_at_initial_offset)))
527 /* Given a register X that failed the LRA_REG test, replace X
528 by its memory equivalent, find the reloads needed for THAT memory
529 location and substitute that back for the higher-level reload
530 that we're conducting... */
532 /* WARNING: we reference 'ind_levels' and 'insn' which are local variables
533 in find_reloads_address (), where the LEGITIMIZE_RELOAD_ADDRESS macro
536 #define FRA_REG(X,MODE,OPNUM,TYPE) \
538 rtx tem = make_memloc ((X), REGNO (X)); \
540 if (! strict_memory_address_p (GET_MODE (tem), XEXP (tem, 0))) \
542 /* Note that we're doing address in address - cf. ADDR_TYPE */ \
543 find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0), \
544 &XEXP (tem, 0), (OPNUM), \
545 ADDR_TYPE (TYPE), ind_levels, insn); \
551 /* For the IP2K, we want to be clever about picking IP vs DP for a
552 base pointer since IP only directly supports a zero displacement.
553 (Note that we have modified all the HI patterns to correctly handle
554 IP references by manipulating iph:ipl as we fetch the pieces). */
555 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND,WIN) \
557 if (GET_CODE (X) == PLUS \
558 && REG_P (XEXP (X, 0)) \
559 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
561 int disp = INTVAL (XEXP (X, 1)); \
562 int fit = (disp >= 0 && disp <= (127 - 2 * GET_MODE_SIZE (MODE))); \
563 rtx reg = XEXP (X, 0); \
566 push_reload ((X), NULL_RTX, &(X), \
567 NULL, MODE_BASE_REG_CLASS (MODE), GET_MODE (X), \
568 VOIDmode, 0, 0, OPNUM, TYPE); \
571 if (reg_equiv_memory_loc[REGNO (reg)] \
572 && (reg_equiv_address[REGNO (reg)] || num_not_at_initial_offset)) \
574 rtx mem = make_memloc (reg, REGNO (reg)); \
575 if (! strict_memory_address_p (GET_MODE (mem), XEXP (mem, 0))) \
577 /* Note that we're doing address in address - cf. ADDR_TYPE */\
578 find_reloads_address (GET_MODE (mem), &mem, XEXP (mem, 0), \
579 &XEXP (mem, 0), (OPNUM), \
580 ADDR_TYPE (TYPE), (IND), insn); \
582 push_reload (mem, NULL, &XEXP (X, 0), NULL, \
583 GENERAL_REGS, Pmode, VOIDmode, 0, 0, \
585 push_reload (X, NULL, &X, NULL, \
586 MODE_BASE_REG_CLASS (MODE), GET_MODE (X), VOIDmode, \
587 0, 0, OPNUM, TYPE); \
593 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
595 if (ip2k_mode_dependent_address (ADDR)) goto LABEL; \
598 #define LEGITIMATE_CONSTANT_P(X) 1
600 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 7
602 #define MEMORY_MOVE_COST(MODE,CLASS,IN) 6
604 #define SLOW_BYTE_ACCESS 0
606 #define NO_FUNCTION_CSE
607 #define NO_RECURSIVE_FUNCTION_CSE
609 #define TEXT_SECTION_ASM_OP ".text"
610 #define DATA_SECTION_ASM_OP ".data"
612 #define JUMP_TABLES_IN_TEXT_SECTION 1
614 #define ASM_COMMENT_START " ; "
616 #define ASM_APP_ON "/* #APP */\n"
618 #define ASM_APP_OFF "/* #NOAPP */\n"
620 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
621 fprintf ((STREAM), ".double %.20e\n", (VALUE))
622 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
623 asm_output_float ((STREAM), (VALUE))
625 #define ASM_OUTPUT_INT(FILE, VALUE) \
626 ( fprintf ((FILE), "\t.long "), \
627 output_addr_const ((FILE), (VALUE)), \
628 fputs ("\n", (FILE)))
630 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
631 asm_output_short ((FILE), (VALUE))
632 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
633 asm_output_char ((FILE), (VALUE))
635 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
636 asm_output_byte ((FILE), (VALUE))
638 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) \
639 ((C) == '\n' || ((C) == '$'))
641 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
643 fputs ("\t.comm ", (STREAM)); \
644 assemble_name ((STREAM), (NAME)); \
645 fprintf ((STREAM), ",%d\n", (int)(SIZE)); \
648 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
650 fputs ("\t.lcomm ", (STREAM)); \
651 assemble_name ((STREAM), (NAME)); \
652 fprintf ((STREAM), ",%d\n", (int)(SIZE)); \
656 #define WEAK_ASM_OP ".weak"
658 #undef ASM_DECLARE_FUNCTION_SIZE
659 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
661 if (!flag_inhibit_size_directive) \
662 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
666 "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
667 \0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
668 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
669 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
670 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
671 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
672 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
673 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
674 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
675 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
676 corresponds to a particular byte value [0..255]. For any
677 given byte value, if the value in the corresponding table
678 position is zero, the given character can be output directly.
679 If the table value is 1, the byte must be output as a \ooo
680 octal escape. If the tables value is anything else, then the
681 byte value should be output as a \ followed by the value
682 in the table. Note that we can use standard UN*X escape
683 sequences for many control characters, but we don't use
684 \a to represent BEL because some svr4 assemblers (e.g. on
685 the i386) don't know about that. Also, we don't use \v
686 since some versions of gas, such as 2.2 did not accept it. */
688 /* Globalizing directive for a label. */
689 #define GLOBAL_ASM_OP ".global\t"
691 #define REGISTER_NAMES { \
692 "$00","$01","$02","$03","iph","ipl","sph","spl", \
693 "pch","pcl","wreg","status","dph","dpl","$0e","mulh", \
694 "$10","$11","$12","$13","$14","$15","$16","$17", \
695 "$18","$19","$1a","$1b","$1c","$1d","$1e","$1f", \
696 "$20","$21","$22","$23","$24","$25","$26","$27", \
697 "$28","$29","$2a","$2b","$2c","$2d","$2e","$2f", \
698 "$30","$31","$32","$33","$34","$35","$36","$37", \
699 "$38","$39","$3a","$3b","$3c","$3d","$3e","$3f", \
700 "$40","$41","$42","$43","$44","$45","$46","$47", \
701 "$48","$49","$4a","$4b","$4c","$4d","$4e","$4f", \
702 "$50","$51","$52","$53","$54","$55","$56","$57", \
703 "$58","$59","$5a","$5b","$5c","$5d","$5e","$5f", \
704 "$60","$61","$62","$63","$64","$65","$66","$67", \
705 "$68","$69","$6a","$6b","$6c","$6d","$6e","$6f", \
706 "$70","$71","$72","$73","$74","$75","$76","$77", \
707 "$78","$79","$7a","$7b","$7c","$7d","callh","calll", \
708 "$80","$81","$82","$83","$84","$85","$86","$87", \
709 "$88","$89","$8a","$8b","$8c","$8d","$8e","$8f", \
710 "$90","$91","$92","$93","$94","$95","$96","$97", \
711 "$98","$99","$9a","$9b","$9c","$9d","$9e","$9f", \
712 "$a0","$a1","$a2","$a3","$a4","$a5","$a6","$a7", \
713 "$a8","$a9","$aa","$ab","$ac","$ad","$ae","$af", \
714 "$b0","$b1","$b2","$b3","$b4","$b5","$b6","$b7", \
715 "$b8","$b9","$ba","$bb","$bc","$bd","$be","$bf", \
716 "$c0","$c1","$c2","$c3","$c4","$c5","$c6","$c7", \
717 "$c8","$c9","$ca","$cb","$cc","$cd","$ce","$cf", \
718 "$d0","$d1","$d2","$d3","$d4","$d5","$d6","$d7", \
719 "$d8","$d9","$da","$db","$dc","$dd","$de","$df", \
720 "$e0","$e1","$e2","$e3","$e4","$e5","$e6","$e7", \
721 "$e8","$e9","$ea","$eb","$ec","$ed","$ee","$ef", \
722 "$f0","$f1","$f2","$f3","$f4","$f5","$f6","$f7", \
723 "$f8","$f9","$fa","$fb","$fc","$fd","$fe","$ff", \
724 "vfph","vfpl","vaph","vapl"}
726 #define PRINT_OPERAND(STREAM, X, CODE) \
727 print_operand ((STREAM), (X), (CODE))
729 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
730 ((CODE) == '<' || (CODE) == '>')
732 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
734 /* Since register names don't have a prefix, we must preface all
735 user identifiers with the '_' to prevent confusion. */
737 #undef USER_LABEL_PREFIX
738 #define USER_LABEL_PREFIX "_"
739 #define LOCAL_LABEL_PREFIX ".L"
741 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
742 asm_fprintf ((STREAM), "\tpage\t%L%d\n\tjmp\t%L%d\n", (VALUE), (VALUE))
744 /* elfos.h presumes that we will want switch/case dispatch tables aligned.
745 This is not so for the ip2k. */
746 #undef ASM_OUTPUT_CASE_LABEL
748 #undef ASM_OUTPUT_ADDR_VEC_ELT
749 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
750 asm_fprintf ((STREAM), "\tpage\t%L%d\n\tjmp\t%L%d\n", (VALUE), (VALUE))
752 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
753 fprintf ((STREAM), "\t.align %d\n", (POWER))
755 /* Since instructions are 16 bit word addresses, we should lie and claim that
756 the dispatch vectors are in QImode. Otherwise the offset into the jump
757 table will be scaled by the MODE_SIZE. */
759 #define CASE_VECTOR_MODE QImode
761 #undef WORD_REGISTER_OPERATIONS
766 /* MOVE_RATIO is the number of move instructions that is better than a
767 block move. Make this small on the IP2k, since the code size grows very
768 large with each move. */
770 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
774 #define FUNCTION_MODE HImode
776 #define INTEGRATE_THRESHOLD(DECL) \
777 (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2))
779 #define DOLLARS_IN_IDENTIFIERS 0
781 extern int ip2k_reorg_in_progress;
782 /* Flag if we're in the middle of IP2k-specific reorganization. */
784 extern int ip2k_reorg_completed;
785 /* Flag if we've completed our IP2k-specific reorganization. If we have
786 then we allow quite a few more tricks than before. */
788 extern int ip2k_reorg_split_dimode;
789 extern int ip2k_reorg_split_simode;
790 extern int ip2k_reorg_split_qimode;
791 extern int ip2k_reorg_split_himode;
792 /* Flags for various split operations that we run in sequence. */
794 extern int ip2k_reorg_merge_qimode;
795 /* Flag to indicate that it's safe to merge QImode operands. */
797 #define TRAMPOLINE_TEMPLATE(FILE) abort ()
799 #define TRAMPOLINE_SIZE 4
801 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
803 emit_move_insn (gen_rtx_MEM (HImode, plus_constant ((TRAMP), 2)), \
805 emit_move_insn (gen_rtx_MEM (HImode, plus_constant ((TRAMP), 6)), \
808 /* Store in cc_status the expressions
809 that the condition codes will describe
810 after execution of an instruction whose pattern is EXP.
811 Do not alter them if the instruction would not alter the cc's. */
813 #define NOTICE_UPDATE_CC(EXP, INSN) (void)(0)
815 /* Output assembler code to FILE to increment profiler label # LABELNO
816 for profiling a function entry. */
818 #define FUNCTION_PROFILER(FILE, LABELNO) \
819 fprintf ((FILE), "/* profiler %d */", (LABELNO))
821 #define TARGET_MEM_FUNCTIONS
825 #undef STARTFILE_SPEC
827 #if defined(__STDC__) || defined(ALMOST_STDC)
828 #define AS2(a,b,c) #a "\t" #b "," #c
829 #define AS1(a,b) #a "\t" #b
831 #define AS1(a,b) "a b"
832 #define AS2(a,b,c) "a b,c"
834 #define OUT_AS1(a,b) output_asm_insn (AS1 (a,b), operands)
835 #define OUT_AS2(a,b,c) output_asm_insn (AS2 (a,b,c), operands)
836 #define CR_TAB "\n\t"
838 #define PREDICATE_CODES \
839 {"ip2k_ip_operand", {MEM}}, \
840 {"ip2k_short_operand", {MEM}}, \
841 {"ip2k_gen_operand", {MEM, REG, SUBREG}}, \
842 {"ip2k_nonptr_operand", {REG, SUBREG}}, \
843 {"ip2k_ptr_operand", {REG, SUBREG}}, \
844 {"ip2k_split_dest_operand", {REG, SUBREG, MEM}}, \
845 {"ip2k_sp_operand", {REG}}, \
846 {"ip2k_nonsp_reg_operand", {REG, SUBREG}}, \
847 {"ip2k_symbol_ref_operand", {SYMBOL_REF}}, \
848 {"ip2k_binary_operator", {PLUS, MINUS, MULT, DIV, \
849 UDIV, MOD, UMOD, AND, IOR, \
850 XOR, COMPARE, ASHIFT, \
851 ASHIFTRT, LSHIFTRT}}, \
852 {"ip2k_unary_operator", {NEG, NOT, SIGN_EXTEND, \
854 {"ip2k_unsigned_comparison_operator", {LTU, GTU, NE, \
856 {"ip2k_signed_comparison_operator", {LT, GT, LE, GE}},
858 #define DWARF2_DEBUGGING_INFO 1
860 #define DWARF2_ASM_LINE_DEBUG_INFO 1
862 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
864 /* Miscellaneous macros to describe machine specifics. */
866 #define IS_PSEUDO_P(R) (REGNO (R) >= FIRST_PSEUDO_REGISTER)
868 /* Default calculations would cause DWARF address sizes to be 2 bytes,
869 but the Harvard architecture of the IP2k and the word-addressed 64k
870 of instruction memory causes us to want a 32-bit "address" field. */
871 #undef DWARF2_ADDR_SIZE
872 #define DWARF2_ADDR_SIZE 4