00001 /* Definitions of target machine for GNU compiler. 00002 Matsushita MN10200 series 00003 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 00004 Free Software Foundation, Inc. 00005 Contributed by Jeff Law (law@cygnus.com). 00006 00007 This file is part of GNU CC. 00008 00009 GNU CC is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2, or (at your option) 00012 any later version. 00013 00014 GNU CC is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with GNU CC; see the file COPYING. If not, write to 00021 the Free Software Foundation, 59 Temple Place - Suite 330, 00022 Boston, MA 02111-1307, USA. */ 00023 00024 00025 /* Get rid of svr4.h stuff we don't want/need. */ 00026 #undef ASM_SPEC 00027 #undef ASM_FINAL_SPEC 00028 #undef LIB_SPEC 00029 #undef ENDFILE_SPEC 00030 #undef LINK_SPEC 00031 #undef STARTFILE_SPEC 00032 00033 /* Names to predefine in the preprocessor for this target machine. */ 00034 00035 #define CPP_PREDEFINES "-D__mn10200__ -D__MN10200__ -D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L -D__INT_MAX__=32767" 00036 00037 /* Run-time compilation parameters selecting different hardware subsets. */ 00038 00039 /* We don't have any switched on the mn10200. Though there are some things 00040 that might be worth a switch: 00041 00042 -mspace to optimize even more for space. 00043 00044 -mrelax to enable the relaxing linker. */ 00045 00046 extern int target_flags; 00047 00048 /* Macros used in the machine description to test the flags. */ 00049 00050 /* Macro to define tables used to set the flags. 00051 This is a list in braces of pairs in braces, 00052 each pair being { "NAME", VALUE } 00053 where VALUE is the bits to set or minus the bits to clear. 00054 An empty string NAME is used to identify the default VALUE. */ 00055 00056 #define TARGET_SWITCHES \ 00057 {{ "", TARGET_DEFAULT, 0}} 00058 00059 #ifndef TARGET_DEFAULT 00060 #define TARGET_DEFAULT 0 00061 #endif 00062 00063 /* Print subsidiary information on the compiler version in use. */ 00064 00065 #define TARGET_VERSION fprintf (stderr, " (MN10200)"); 00066 00067 00068 /* Target machine storage layout */ 00069 00070 /* Define this if most significant bit is lowest numbered 00071 in instructions that operate on numbered bit-fields. 00072 This is not true on the Matsushita MN10300. */ 00073 #define BITS_BIG_ENDIAN 0 00074 00075 /* Define this if most significant byte of a word is the lowest numbered. */ 00076 /* This is not true on the Matsushita MN10200. */ 00077 #define BYTES_BIG_ENDIAN 0 00078 00079 /* Define this if most significant word of a multiword number is lowest 00080 numbered. 00081 This is not true on the Matsushita MN10200. */ 00082 #define WORDS_BIG_ENDIAN 0 00083 00084 /* Number of bits in an addressable storage unit */ 00085 #define BITS_PER_UNIT 8 00086 00087 /* Width in bits of a "word", which is the contents of a machine register. 00088 Note that this is not necessarily the width of data type `int'; 00089 if using 16-bit ints on a 68000, this would still be 32. 00090 But on a machine with 16-bit registers, this would be 16. 00091 00092 This is a white lie. Registers are really 24bits, but most operations 00093 only operate on 16 bits. GCC chokes badly if we set this to a value 00094 that is not a power of two. */ 00095 #define BITS_PER_WORD 16 00096 00097 /* Width of a word, in units (bytes). */ 00098 #define UNITS_PER_WORD 2 00099 00100 /* Width in bits of a pointer. 00101 See also the macro `Pmode' defined below. 00102 00103 This differs from Pmode because we need to allocate 32bits of space 00104 to hold the 24bit pointers on this machine. */ 00105 #define POINTER_SIZE 32 00106 00107 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ 00108 #define PARM_BOUNDARY 16 00109 00110 /* The stack goes in 16 bit lumps. */ 00111 #define STACK_BOUNDARY 16 00112 00113 /* Allocation boundary (in *bits*) for the code of a function. 00114 8 is the minimum boundary; it's unclear if bigger alignments 00115 would improve performance. */ 00116 #define FUNCTION_BOUNDARY 8 00117 00118 /* No data type wants to be aligned rounder than this. */ 00119 #define BIGGEST_ALIGNMENT 16 00120 00121 /* Alignment of field after `int : 0' in a structure. */ 00122 #define EMPTY_FIELD_BOUNDARY 16 00123 00124 /* Seems to be how the Matsushita compiler does things, and there's 00125 no real reason to be different. */ 00126 #define STRUCTURE_SIZE_BOUNDARY 16 00127 #undef PCC_BITFIELD_TYPE_MATTERS 00128 00129 /* Define this if move instructions will actually fail to work 00130 when given unaligned data. */ 00131 #define STRICT_ALIGNMENT 1 00132 00133 /* Define this as 1 if `char' should by default be signed; else as 0. */ 00134 #define DEFAULT_SIGNED_CHAR 0 00135 00136 /* Standard register usage. */ 00137 00138 /* Number of actual hardware registers. 00139 The hardware registers are assigned numbers for the compiler 00140 from 0 to just below FIRST_PSEUDO_REGISTER. 00141 00142 All registers that the compiler knows about must be given numbers, 00143 even those that are not normally considered general registers. 00144 00145 XXX Long term we should probably expose the MDR register, we use 00146 it for division, multiplication, and some extension operations. */ 00147 00148 #define FIRST_PSEUDO_REGISTER 8 00149 00150 /* 1 for registers that have pervasive standard uses 00151 and are not available for the register allocator. */ 00152 00153 #define FIXED_REGISTERS \ 00154 { 0, 0, 0, 0, 0, 0, 0, 1} 00155 00156 /* 1 for registers not available across function calls. 00157 These must include the FIXED_REGISTERS and also any 00158 registers that can be used without being saved. 00159 The latter must include the registers where values are returned 00160 and the register where structure-value addresses are passed. 00161 Aside from that, you can include as many other registers as you 00162 like. */ 00163 00164 #define CALL_USED_REGISTERS \ 00165 { 1, 1, 0, 0, 1, 0, 0, 1} 00166 00167 #define REG_ALLOC_ORDER \ 00168 { 0, 1, 4, 2, 3, 5, 6, 7} 00169 00170 /* Return number of consecutive hard regs needed starting at reg REGNO 00171 to hold something of mode MODE. 00172 00173 This is ordinarily the length in words of a value of mode MODE 00174 but can be less for certain modes in special long registers. */ 00175 00176 #define HARD_REGNO_NREGS(REGNO, MODE) \ 00177 ((MODE) == PSImode ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ 00178 / UNITS_PER_WORD)) 00179 00180 /* Value is 1 if hard register REGNO can hold a value of machine-mode 00181 MODE. 00182 00183 We allow any register to hold a PSImode value. We allow any register 00184 to hold values <= 16 bits. For values > 16 bits we require aligned 00185 register pairs. */ 00186 #define HARD_REGNO_MODE_OK(REGNO, MODE) \ 00187 ((MODE) == PSImode ? 1 : ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) <= 2) 00188 00189 /* Value is 1 if it is a good idea to tie two pseudo registers 00190 when one has mode MODE1 and one has mode MODE2. 00191 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, 00192 for any hard reg, then this must be 0 for correct output. */ 00193 #define MODES_TIEABLE_P(MODE1, MODE2) \ 00194 (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 2 && GET_MODE_SIZE (MODE2) <= 2)) 00195 00196 /* 4 data, and effectively 2 address registers is small as far as I'm 00197 concerned. Especially since we use 2 data registers for argument 00198 passing and return values. 00199 00200 We used to define CLASS_LIKELY_SPILLED_P as true for DATA_REGS too, 00201 but we've made improvements to the port which greatly reduce register 00202 pressure. As a result we no longer need to define CLASS_LIKELY_SPILLED_P 00203 for DATA_REGS (and by not defining it we get significantly better code). */ 00204 #define SMALL_REGISTER_CLASSES 1 00205 #define CLASS_LIKELY_SPILLED_P(CLASS) (CLASS == ADDRESS_REGS) 00206 00207 /* Define the classes of registers for register constraints in the 00208 machine description. Also define ranges of constants. 00209 00210 One of the classes must always be named ALL_REGS and include all hard regs. 00211 If there is more than one class, another class must be named NO_REGS 00212 and contain no registers. 00213 00214 The name GENERAL_REGS must be the name of a class (or an alias for 00215 another name such as ALL_REGS). This is the class of registers 00216 that is allowed by "g" or "r" in a register constraint. 00217 Also, registers outside this class are allocated only when 00218 instructions express preferences for them. 00219 00220 The classes must be numbered in nondecreasing order; that is, 00221 a larger-numbered class must never be contained completely 00222 in a smaller-numbered class. 00223 00224 For any two classes, it is very desirable that there be another 00225 class that represents their union. */ 00226 00227 enum reg_class { 00228 NO_REGS, DATA_REGS, ADDRESS_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES 00229 }; 00230 00231 #define N_REG_CLASSES (int) LIM_REG_CLASSES 00232 00233 /* Give names of register classes as strings for dump file. */ 00234 00235 #define REG_CLASS_NAMES \ 00236 { "NO_REGS", "DATA_REGS", "ADDRESS_REGS", \ 00237 "GENERAL_REGS", "ALL_REGS", "LIM_REGS" } 00238 00239 /* Define which registers fit in which classes. 00240 This is an initializer for a vector of HARD_REG_SET 00241 of length N_REG_CLASSES. */ 00242 00243 #define REG_CLASS_CONTENTS \ 00244 { {0}, /* No regs */ \ 00245 {0x0f}, /* DATA_REGS */ \ 00246 {0xf0}, /* ADDRESS_REGS */ \ 00247 {0xff}, /* GENERAL_REGS */ \ 00248 {0xff}, /* ALL_REGS */ \ 00249 } 00250 00251 /* The same information, inverted: 00252 Return the class number of the smallest class containing 00253 reg number REGNO. This could be a conditional expression 00254 or could index an array. */ 00255 00256 #define REGNO_REG_CLASS(REGNO) \ 00257 ((REGNO) < 4 ? DATA_REGS : ADDRESS_REGS) 00258 00259 /* The class value for index registers, and the one for base regs. */ 00260 00261 #define INDEX_REG_CLASS DATA_REGS 00262 #define BASE_REG_CLASS ADDRESS_REGS 00263 00264 /* Get reg_class from a letter such as appears in the machine description. */ 00265 00266 #define REG_CLASS_FROM_LETTER(C) \ 00267 ((C) == 'd' ? DATA_REGS : \ 00268 (C) == 'a' ? ADDRESS_REGS : NO_REGS) 00269 00270 /* Macros to check register numbers against specific register classes. */ 00271 00272 /* These assume that REGNO is a hard or pseudo reg number. 00273 They give nonzero only if REGNO is a hard reg of the suitable class 00274 or a pseudo reg currently allocated to a suitable hard reg. 00275 Since they use reg_renumber, they are safe only once reg_renumber 00276 has been allocated, which happens in local-alloc.c. */ 00277 00278 #define REGNO_OK_FOR_BASE_P(regno) \ 00279 (((regno) > 3 && regno < FIRST_PSEUDO_REGISTER) \ 00280 || (reg_renumber[regno] > 3 && reg_renumber[regno] < FIRST_PSEUDO_REGISTER)) 00281 00282 #define REGNO_OK_FOR_INDEX_P(regno) \ 00283 (IN_RANGE ((regno), 0, 3) \ 00284 || (reg_renumber[regno] >= 0 && reg_renumber[regno] < 4)) 00285 00286 00287 /* Given an rtx X being reloaded into a reg required to be 00288 in class CLASS, return the class of reg to actually use. 00289 In general this is just CLASS; but on some machines 00290 in some cases it is preferable to use a more restrictive class. */ 00291 00292 #define PREFERRED_RELOAD_CLASS(X,CLASS) \ 00293 ((GET_MODE (X) != PSImode && GET_MODE (X) != VOIDmode) ? DATA_REGS : CLASS) 00294 00295 /* We want to use DATA_REGS for anything that is not PSImode. */ 00296 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \ 00297 ((MODE != PSImode && MODE != VOIDmode) ? DATA_REGS : CLASS) 00298 00299 /* We have/need secondary reloads on the mn10200. Mostly to deal 00300 with problems using address registers. */ 00301 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \ 00302 secondary_reload_class(CLASS,MODE,IN, 1) 00303 00304 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,IN) \ 00305 secondary_reload_class(CLASS,MODE,IN, 0) 00306 00307 /* Return the maximum number of consecutive registers 00308 needed to represent mode MODE in a register of class CLASS. */ 00309 00310 #define CLASS_MAX_NREGS(CLASS, MODE) \ 00311 ((MODE) == PSImode ? 1 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 00312 00313 /* The letters I, J, K, L, M, N, O, P in a register constraint string 00314 can be used to stand for particular ranges of immediate operands. 00315 This macro defines what the ranges are. 00316 C is the letter, and VALUE is a constant value. 00317 Return 1 if VALUE is in the range specified by C. */ 00318 00319 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100) 00320 #define INT_16_BITS(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000) 00321 00322 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0) 00323 #define CONST_OK_FOR_J(VALUE) ((VALUE) >= 1 && (VALUE) <= 3) 00324 #define CONST_OK_FOR_K(VALUE) ((VALUE) >= 1 && (VALUE) <= 4) 00325 #define CONST_OK_FOR_L(VALUE) ((VALUE) == 15) 00326 #define CONST_OK_FOR_M(VALUE) ((VALUE) == 255) 00327 00328 #define CONST_OK_FOR_LETTER_P(VALUE, C) \ 00329 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \ 00330 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \ 00331 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \ 00332 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \ 00333 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : 0) 00334 00335 /* Similar, but for floating constants, and defining letters G and H. 00336 Here VALUE is the CONST_DOUBLE rtx itself. 00337 00338 `G' is a floating-point zero. */ 00339 00340 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ 00341 ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ 00342 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ 00343 : 0) 00344 00345 00346 00347 /* Stack layout; function entry, exit and calling. */ 00348 00349 /* Define this if pushing a word on the stack 00350 makes the stack pointer a smaller address. */ 00351 00352 #define STACK_GROWS_DOWNWARD 00353 00354 /* Define this if the nominal address of the stack frame 00355 is at the high-address end of the local variables; 00356 that is, each additional local variable allocated 00357 goes at a more negative offset in the frame. */ 00358 00359 #define FRAME_GROWS_DOWNWARD 00360 00361 /* Offset within stack frame to start allocating local variables at. 00362 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the 00363 first local allocated. Otherwise, it is the offset to the BEGINNING 00364 of the first local allocated. */ 00365 00366 #define STARTING_FRAME_OFFSET 0 00367 00368 /* Offset of first parameter from the argument pointer register value. */ 00369 /* Is equal to the size of the saved fp + pc, even if an fp isn't 00370 saved since the value is used before we know. */ 00371 00372 #define FIRST_PARM_OFFSET(FNDECL) (current_function_needs_context ? 8 : 4) 00373 00374 /* Specify the registers used for certain standard purposes. 00375 The values of these macros are register numbers. */ 00376 00377 /* Register to use for pushing function arguments. */ 00378 #define STACK_POINTER_REGNUM 7 00379 00380 /* Base register for access to local variables of the function. */ 00381 #define FRAME_POINTER_REGNUM 6 00382 00383 /* Base register for access to arguments of the function. */ 00384 #define ARG_POINTER_REGNUM 6 00385 00386 /* Register in which static-chain is passed to a function. */ 00387 #define STATIC_CHAIN_REGNUM 4 00388 00389 /* Value should be nonzero if functions must have frame pointers. 00390 Zero means the frame pointer need not be set up (and parms 00391 may be accessed via the stack pointer) in functions that seem suitable. 00392 This is computed in `reload', in reload1.c. 00393 00394 We allow frame pointers to be eliminated when not having one will 00395 not interfere with debugging. */ 00396 #define ACCUMULATE_OUTGOING_ARGS 1 00397 #define FRAME_POINTER_REQUIRED 0 00398 #define CAN_DEBUG_WITHOUT_FP 00399 00400 /* Store in the variable DEPTH the initial difference between the 00401 frame pointer reg contents and the stack pointer reg contents, 00402 as of the start of the function body. This depends on the layout 00403 of the fixed parts of the stack frame and on how registers are saved. */ 00404 00405 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = total_frame_size() 00406 00407 /* Various type size information. 00408 00409 The mn10200 has a limited number of small registers. Sizes of basic 00410 data types are adjusted accordingly. */ 00411 #define SHORT_TYPE_SIZE 16 00412 #define INT_TYPE_SIZE 16 00413 #define LONG_TYPE_SIZE 32 00414 #define LONG_LONG_TYPE_SIZE 32 00415 #define FLOAT_TYPE_SIZE 32 00416 #define DOUBLE_TYPE_SIZE 32 00417 #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE 00418 00419 /* Any size less than 64bits will work; but a smarter definition 00420 can make G++ code smaller and faster. Most operations on the 00421 mn10200 occur on 16bit hunks, so the best size for a boolean 00422 is 16bits. */ 00423 #define BOOL_TYPE_SIZE 16 00424 00425 /* The difference of two pointers must be at least 24bits since pointers 00426 are 24bits; however, no basic data type is 24bits, so we have to round 00427 up to a 32bits for the difference of pointers. */ 00428 #undef SIZE_TYPE 00429 #undef PTRDIFF_TYPE 00430 #define SIZE_TYPE "long unsigned int" 00431 #define PTRDIFF_TYPE "long unsigned int" 00432 00433 /* Note sizeof (WCHAR_TYPE) must be equal to the value of WCHAR_TYPE_SIZE! */ 00434 #undef WCHAR_TYPE 00435 #define WCHAR_TYPE "int" 00436 00437 #undef WCHAR_TYPE_SIZE 00438 #define WCHAR_TYPE_SIZE BITS_PER_WORD 00439 00440 #define MAX_FIXED_MODE_SIZE 32 00441 00442 /* A guess for the MN10200. */ 00443 #define PROMOTE_PROTOTYPES 1 00444 00445 /* Value is the number of bytes of arguments automatically 00446 popped when returning from a subroutine call. 00447 FUNDECL is the declaration node of the function (as a tree), 00448 FUNTYPE is the data type of the function (as a tree), 00449 or for a library call it is an identifier node for the subroutine name. 00450 SIZE is the number of bytes of arguments passed on the stack. */ 00451 00452 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 00453 00454 /* 1 if N is a possible register number for function argument passing. */ 00455 00456 #define FUNCTION_ARG_REGNO_P(N) ((N) <= 1) 00457 00458 /* Define a data type for recording info about an argument list 00459 during the scan of that argument list. This data type should 00460 hold all necessary information about the function itself 00461 and about the args processed so far, enough to enable macros 00462 such as FUNCTION_ARG to determine where the next arg should go. */ 00463 00464 #define CUMULATIVE_ARGS struct cum_arg 00465 struct cum_arg { int nbytes; }; 00466 00467 /* Initialize a variable CUM of type CUMULATIVE_ARGS 00468 for a call to a function whose data type is FNTYPE. 00469 For a library call, FNTYPE is 0. 00470 00471 On the MN10200, the offset starts at 0. */ 00472 00473 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ 00474 ((CUM).nbytes = 0) 00475 00476 /* Update the data in CUM to advance over an argument 00477 of mode MODE and data type TYPE. 00478 (TYPE is null for libcalls where that information may not be available.) */ 00479 00480 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ 00481 ((CUM).nbytes += ((MODE) != BLKmode \ 00482 ? (MODE) == PSImode ? 2 : \ 00483 (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \ 00484 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD)) 00485 00486 /* Define where to put the arguments to a function. 00487 Value is zero to push the argument on the stack, 00488 or a hard register in which to store the argument. 00489 00490 MODE is the argument's machine mode. 00491 TYPE is the data type of the argument (as a tree). 00492 This is null for libcalls where that information may 00493 not be available. 00494 CUM is a variable of type CUMULATIVE_ARGS which gives info about 00495 the preceding args and about the function being called. 00496 NAMED is nonzero if this argument is a named parameter 00497 (otherwise it is an extra parameter matching an ellipsis). */ 00498 00499 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ 00500 function_arg (&CUM, MODE, TYPE, NAMED) 00501 00502 /* Implement `va_arg'. */ 00503 #define EXPAND_BUILTIN_VA_ARG(valist, type) \ 00504 mn10200_va_arg (valist, type) 00505 00506 /* For "large" items, we pass them by invisible reference, and the 00507 callee is responsible for copying the data item if it might be 00508 modified. */ 00509 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ 00510 ((TYPE) && int_size_in_bytes (TYPE) > 8) 00511 00512 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ 00513 ((TYPE) && int_size_in_bytes (TYPE) > 8) 00514 00515 /* Define how to find the value returned by a function. 00516 VALTYPE is the data type of the value (as a tree). 00517 If the precise function being called is known, FUNC is its FUNCTION_DECL; 00518 otherwise, FUNC is 0. */ 00519 00520 #define FUNCTION_VALUE(VALTYPE, FUNC) \ 00521 gen_rtx_REG (TYPE_MODE (VALTYPE), TYPE_MODE (VALTYPE) == PSImode ? 4 : 0) 00522 00523 /* Define how to find the value returned by a library function 00524 assuming the value has mode MODE. */ 00525 00526 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, (MODE) == PSImode ? 4 : 0) 00527 00528 /* 1 if N is a possible register number for a function value. */ 00529 00530 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 4) 00531 00532 /* Return values > 8 bytes in length in memory. */ 00533 #define DEFAULT_PCC_STRUCT_RETURN 0 00534 #define RETURN_IN_MEMORY(TYPE) \ 00535 (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode) 00536 00537 /* Register in which address to store a structure value 00538 is passed to a function. On the MN10200 it's passed as 00539 the first parameter. */ 00540 00541 #define STRUCT_VALUE 0 00542 00543 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, 00544 the stack pointer does not matter. The value is tested only in 00545 functions that have frame pointers. 00546 No definition is equivalent to always zero. */ 00547 00548 #define EXIT_IGNORE_STACK 1 00549 00550 /* Output assembler code to FILE to increment profiler label # LABELNO 00551 for profiling a function entry. 00552 00553 ?!? Profiling is not currently supported. */ 00554 00555 #define FUNCTION_PROFILER(FILE, LABELNO) ; 00556 00557 /* Yes, we actually support trampolines on this machine, even though 00558 nobody is likely to ever use them. */ 00559 #define TRAMPOLINE_TEMPLATE(FILE) \ 00560 do { \ 00561 fprintf (FILE, "\t.byte 0xfd\n"); \ 00562 fprintf (FILE, "\t.byte 0x00\n"); \ 00563 fprintf (FILE, "\t.byte 0x00\n"); \ 00564 fprintf (FILE, "\tmov (a3),a0\n"); \ 00565 fprintf (FILE, "\tadd -4,a3\n"); \ 00566 fprintf (FILE, "\tmov a0,(0,a3)\n"); \ 00567 fprintf (FILE, "\tmov (21,a0),a0\n"); \ 00568 fprintf (FILE, "\tmov a0,(4,a3)\n"); \ 00569 fprintf (FILE, "\tmov (0,a3),a0\n"); \ 00570 fprintf (FILE, "\tmov (17,a0),a0\n"); \ 00571 fprintf (FILE, "\tadd 4,a3\n"); \ 00572 fprintf (FILE, "\trts\n"); \ 00573 fprintf (FILE, "\t.long 0\n"); \ 00574 fprintf (FILE, "\t.long 0\n"); \ 00575 } while (0) 00576 00577 /* Length in units of the trampoline for entering a nested function. */ 00578 00579 #define TRAMPOLINE_SIZE 0x1c 00580 00581 /* Emit RTL insns to initialize the variable parts of a trampoline. 00582 FNADDR is an RTX for the address of the function's pure code. 00583 CXT is an RTX for the static chain value for the function. */ 00584 00585 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ 00586 { \ 00587 emit_move_insn (gen_rtx_MEM (PSImode, plus_constant ((TRAMP), 20)), \ 00588 (CXT)); \ 00589 emit_move_insn (gen_rtx_MEM (PSImode, plus_constant ((TRAMP), 24)), \ 00590 (FNADDR)); \ 00591 } 00592 00593 /* A C expression whose value is RTL representing the value of the return 00594 address for the frame COUNT steps up from the current frame. */ 00595 00596 #define RETURN_ADDR_RTX(COUNT, FRAME) \ 00597 ((COUNT == 0) \ 00598 ? gen_rtx_MEM (Pmode, frame_pointer_rtx) \ 00599 : (rtx) 0) 00600 00601 00602 /* Addressing modes, and classification of registers for them. */ 00603 00604 00605 /* 1 if X is an rtx for a constant that is a valid address. */ 00606 00607 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) 00608 00609 /* Extra constraints. */ 00610 #define OK_FOR_R(OP) \ 00611 (GET_CODE (OP) == MEM \ 00612 && GET_MODE (OP) == QImode \ 00613 && REG_P (XEXP (OP, 0))) 00614 00615 /* Q is used for sp + <something> in the {zero,sign}_extendpsisi2 patterns. */ 00616 #define EXTRA_CONSTRAINT(OP, C) \ 00617 ((C) == 'R' ? OK_FOR_R (OP) : \ 00618 (C) == 'S' ? GET_CODE (OP) == SYMBOL_REF : \ 00619 (C) == 'Q' ? GET_CODE (OP) == PLUS : 0) 00620 00621 /* Maximum number of registers that can appear in a valid memory address. */ 00622 00623 #define MAX_REGS_PER_ADDRESS 2 00624 00625 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx 00626 and check its validity for a certain class. 00627 We have two alternate definitions for each of them. 00628 The usual definition accepts all pseudo regs; the other rejects 00629 them unless they have been allocated suitable hard regs. 00630 The symbol REG_OK_STRICT causes the latter definition to be used. 00631 00632 Most source files want to accept pseudo regs in the hope that 00633 they will get allocated to the class that the insn wants them to be in. 00634 Source files for reload pass need to be strict. 00635 After reload, it makes no difference, since pseudo regs have 00636 been eliminated by then. */ 00637 00638 #ifndef REG_OK_STRICT 00639 /* Nonzero if X is a hard reg that can be used as an index 00640 or if it is a pseudo reg. */ 00641 #define REG_OK_FOR_INDEX_P(X) \ 00642 (IN_RANGE (REGNO (X), 0, 3) || REGNO (X) >= FIRST_PSEUDO_REGISTER) 00643 /* Nonzero if X is a hard reg that can be used as a base reg 00644 or if it is a pseudo reg. */ 00645 #define REG_OK_FOR_BASE_P(X) \ 00646 (((REGNO (X) >= 4 && REGNO(X) <= 8) || REGNO (X) >= FIRST_PSEUDO_REGISTER)) 00647 #else 00648 /* Nonzero if X is a hard reg that can be used as an index. */ 00649 #define REG_OK_FOR_INDEX_P(X) \ 00650 REGNO_OK_FOR_INDEX_P (REGNO (X)) 00651 /* Nonzero if X is a hard reg that can be used as a base reg. */ 00652 #define REG_OK_FOR_BASE_P(X) \ 00653 REGNO_OK_FOR_BASE_P (REGNO (X)) 00654 #endif 00655 00656 00657 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression 00658 that is a valid memory address for an instruction. 00659 The MODE argument is the machine mode for the MEM expression 00660 that wants to use this address. 00661 00662 We used to allow reg+reg addresses for QImode and HImode; however, 00663 they tended to cause the register allocator to run out of registers. 00664 Basically, an indexed load/store always keeps 2 data and one address 00665 register live, which is just too many for this machine. 00666 00667 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, 00668 except for CONSTANT_ADDRESS_P which is actually machine-independent. */ 00669 00670 /* Accept either REG or SUBREG where a register is valid. */ 00671 00672 #define RTX_OK_FOR_BASE_P(X) \ 00673 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ 00674 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \ 00675 && REG_OK_FOR_BASE_P (SUBREG_REG (X)))) 00676 00677 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ 00678 { \ 00679 if ((MODE != PSImode) && CONSTANT_ADDRESS_P (X)) \ 00680 goto ADDR; \ 00681 if (RTX_OK_FOR_BASE_P (X)) \ 00682 goto ADDR; \ 00683 if (GET_CODE (X) == PLUS) \ 00684 { \ 00685 rtx base = 0, index = 0; \ 00686 if (RTX_OK_FOR_BASE_P (XEXP (X, 0))) \ 00687 base = XEXP (X, 0), index = XEXP (X, 1); \ 00688 if (RTX_OK_FOR_BASE_P (XEXP (X, 1))) \ 00689 base = XEXP (X, 1), index = XEXP (X, 0); \ 00690 if (base != 0 && index != 0) \ 00691 { \ 00692 if (GET_CODE (index) == CONST_INT) \ 00693 goto ADDR; \ 00694 } \ 00695 } \ 00696 } 00697 00698 00699 /* Try machine-dependent ways of modifying an illegitimate address 00700 to be legitimate. If we find one, return the new, valid address. 00701 This macro is used in only one place: `memory_address' in explow.c. 00702 00703 OLDX is the address as it was before break_out_memory_refs was called. 00704 In some cases it is useful to look at this to decide what needs to be done. 00705 00706 MODE and WIN are passed so that this macro can use 00707 GO_IF_LEGITIMATE_ADDRESS. 00708 00709 It is always safe for this macro to do nothing. It exists to recognize 00710 opportunities to optimize the output. */ 00711 00712 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} 00713 00714 /* Go to LABEL if ADDR (a legitimate address expression) 00715 has an effect that depends on the machine mode it is used for. */ 00716 00717 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} 00718 00719 /* Nonzero if the constant value X is a legitimate general operand. 00720 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ 00721 00722 #define LEGITIMATE_CONSTANT_P(X) 1 00723 00724 00725 /* Tell final.c how to eliminate redundant test instructions. */ 00726 00727 /* Here we define machine-dependent flags and fields in cc_status 00728 (see `conditions.h'). No extra ones are needed for the VAX. */ 00729 00730 /* Store in cc_status the expressions 00731 that the condition codes will describe 00732 after execution of an instruction whose pattern is EXP. 00733 Do not alter them if the instruction would not alter the cc's. */ 00734 00735 #define CC_OVERFLOW_UNUSABLE 0x200 00736 #define CC_NO_CARRY CC_NO_OVERFLOW 00737 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN) 00738 00739 /* The mn10200 has a limited number of registers, so CSE of function 00740 addresses generally makes code worse due to register pressure. */ 00741 #define NO_FUNCTION_CSE 00742 00743 /* Compute the cost of computing a constant rtl expression RTX 00744 whose rtx-code is CODE. The body of this macro is a portion 00745 of a switch statement. If the code is computed here, 00746 return it with a return statement. Otherwise, break from the switch. */ 00747 00748 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ 00749 case CONST_INT: \ 00750 /* Zeros are extremely cheap. */ \ 00751 if (INTVAL (RTX) == 0) \ 00752 return 0; \ 00753 /* If it fits in 8 bits, then it's still relatively cheap. */ \ 00754 if (INT_8_BITS (INTVAL (RTX))) \ 00755 return 1; \ 00756 /* This is the "base" cost, includes constants where either the \ 00757 upper or lower 16bits are all zeros. */ \ 00758 if (INT_16_BITS (INTVAL (RTX)) \ 00759 || (INTVAL (RTX) & 0xffff) == 0 \ 00760 || (INTVAL (RTX) & 0xffff0000) == 0) \ 00761 return 2; \ 00762 return 4; \ 00763 /* These are more costly than a CONST_INT, but we can relax them, \ 00764 so they're less costly than a CONST_DOUBLE. */ \ 00765 case CONST: \ 00766 case LABEL_REF: \ 00767 case SYMBOL_REF: \ 00768 return 6; \ 00769 /* We don't optimize CONST_DOUBLEs well nor do we relax them well, \ 00770 so their cost is very high. */ \ 00771 case CONST_DOUBLE: \ 00772 return 8; 00773 00774 /* Make moves between different classes more expensive than moves 00775 within the same class. */ 00776 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) (CLASS1 != CLASS2 ? 4 : 2) 00777 00778 /* Provide the costs of a rtl expression. This is in the body of a 00779 switch on CODE. 00780 00781 ?!? This probably needs more work. The definitions below were first 00782 taken from the H8 port, then tweaked slightly to improve code density 00783 on various sample codes. */ 00784 00785 #define RTX_COSTS(RTX,CODE,OUTER_CODE) \ 00786 case MOD: \ 00787 case DIV: \ 00788 return 8; \ 00789 case MULT: \ 00790 return (GET_MODE (RTX) == SImode ? 20 : 8); 00791 00792 /* Nonzero if access to memory by bytes or half words is no faster 00793 than accessing full words. */ 00794 #define SLOW_BYTE_ACCESS 1 00795 00796 /* According expr.c, a value of around 6 should minimize code size, and 00797 for the MN10200 series, code size our primary concern. */ 00798 #define MOVE_RATIO 6 00799 00800 #define TEXT_SECTION_ASM_OP "\t.section .text" 00801 #define DATA_SECTION_ASM_OP "\t.section .data" 00802 #define BSS_SECTION_ASM_OP "\t.section .bss" 00803 00804 /* Output at beginning/end of assembler file. */ 00805 #undef ASM_FILE_START 00806 #define ASM_FILE_START(FILE) asm_file_start(FILE) 00807 00808 #define ASM_COMMENT_START "#" 00809 00810 /* Output to assembler file text saying following lines 00811 may contain character constants, extra white space, comments, etc. */ 00812 00813 #define ASM_APP_ON "#APP\n" 00814 00815 /* Output to assembler file text saying following lines 00816 no longer contain unusual constructs. */ 00817 00818 #define ASM_APP_OFF "#NO_APP\n" 00819 00820 /* This says how to output the assembler to define a global 00821 uninitialized but not common symbol. 00822 Try to use asm_output_bss to implement this macro. */ 00823 00824 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 00825 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) 00826 00827 /* This is how to output the definition of a user-level label named NAME, 00828 such as the label on a static function or variable NAME. */ 00829 00830 #define ASM_OUTPUT_LABEL(FILE, NAME) \ 00831 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) 00832 00833 /* This is how to output a command to make the user-level label named NAME 00834 defined for reference from other files. */ 00835 00836 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \ 00837 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) 00838 00839 /* This is how to output a reference to a user-level label named NAME. 00840 `assemble_name' uses this. */ 00841 00842 #undef ASM_OUTPUT_LABELREF 00843 #define ASM_OUTPUT_LABELREF(FILE, NAME) \ 00844 do { \ 00845 const char* real_name; \ 00846 STRIP_NAME_ENCODING (real_name, (NAME)); \ 00847 fprintf (FILE, "_%s", real_name); \ 00848 } while (0) 00849 00850 /* Store in OUTPUT a string (made with alloca) containing 00851 an assembler-name for a local static variable named NAME. 00852 LABELNO is an integer which is different for each call. */ 00853 00854 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ 00855 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ 00856 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO))) 00857 00858 /* This is how we tell the assembler that two symbols have the same value. */ 00859 00860 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ 00861 do { assemble_name(FILE, NAME1); \ 00862 fputs(" = ", FILE); \ 00863 assemble_name(FILE, NAME2); \ 00864 fputc('\n', FILE); } while (0) 00865 00866 00867 /* How to refer to registers in assembler output. 00868 This sequence is indexed by compiler's hard-register-number (see above). */ 00869 00870 #define REGISTER_NAMES \ 00871 { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3"} 00872 00873 /* Print an instruction operand X on file FILE. 00874 look in mn10200.c for details */ 00875 00876 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE) 00877 00878 /* Print a memory operand whose address is X, on file FILE. 00879 This uses a function in output-vax.c. */ 00880 00881 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) 00882 00883 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) 00884 #define ASM_OUTPUT_REG_POP(FILE,REGNO) 00885 00886 /* This is how to output an element of a case-vector that is absolute. */ 00887 00888 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ 00889 asm_fprintf (FILE, "\t%s .L%d\n", ".long", VALUE) 00890 00891 /* This is how to output an element of a case-vector that is relative. */ 00892 00893 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ 00894 fprintf (FILE, "\t%s .L%d-.L%d\n", ".long", VALUE, REL) 00895 00896 #define ASM_OUTPUT_ALIGN(FILE,LOG) \ 00897 if ((LOG) != 0) \ 00898 fprintf (FILE, "\t.align %d\n", (LOG)) 00899 00900 /* We don't have to worry about dbx compatibility for the mn10200. */ 00901 #define DEFAULT_GDB_EXTENSIONS 1 00902 00903 /* Use stabs debugging info by default. */ 00904 #undef PREFERRED_DEBUGGING_TYPE 00905 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 00906 00907 /* GDB always assumes the current function's frame begins at the value 00908 of the stack pointer upon entry to the current function. Accessing 00909 local variables and parameters passed on the stack is done using the 00910 base of the frame + an offset provided by GCC. 00911 00912 For functions which have frame pointers this method works fine; 00913 the (frame pointer) == (stack pointer at function entry) and GCC provides 00914 an offset relative to the frame pointer. 00915 00916 This loses for functions without a frame pointer; GCC provides an offset 00917 which is relative to the stack pointer after adjusting for the function's 00918 frame size. GDB would prefer the offset to be relative to the value of 00919 the stack pointer at the function's entry. Yuk! */ 00920 #define DEBUGGER_AUTO_OFFSET(X) \ 00921 ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) \ 00922 + (frame_pointer_needed ? 0 : -total_frame_size ())) 00923 00924 #define DEBUGGER_ARG_OFFSET(OFFSET, X) \ 00925 ((GET_CODE (X) == PLUS ? OFFSET : 0) \ 00926 + (frame_pointer_needed ? 0 : -total_frame_size ())) 00927 00928 /* Define to use software floating point emulator for REAL_ARITHMETIC and 00929 decimal <-> binary conversion. */ 00930 #define REAL_ARITHMETIC 00931 00932 /* Specify the machine mode that this machine uses 00933 for the index in the tablejump instruction. */ 00934 #define CASE_VECTOR_MODE Pmode 00935 00936 /* Dispatch tables on the mn10200 are extremely expensive in terms of code 00937 and readonly data size. So we crank up the case threshold value to 00938 encourage a series of if/else comparisons to implement many small switch 00939 statements. In theory, this value could be increased much more if we 00940 were solely optimizing for space, but we keep it "reasonable" to avoid 00941 serious code efficiency lossage. */ 00942 #define CASE_VALUES_THRESHOLD 8 00943 00944 /* Define if operations between registers always perform the operation 00945 on the full register even if a narrower mode is specified. */ 00946 #define WORD_REGISTER_OPERATIONS 00947 00948 /* We could define this either way. Using ZERO_EXTEND for QImode makes slightly 00949 fast and more compact code. */ 00950 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND 00951 00952 /* This flag, if defined, says the same insns that convert to a signed fixnum 00953 also convert validly to an unsigned one. */ 00954 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC 00955 00956 /* Max number of bytes we can move from memory to memory 00957 in one reasonably fast instruction. */ 00958 #define MOVE_MAX 2 00959 00960 /* Define if shifts truncate the shift count 00961 which implies one can omit a sign-extension or zero-extension 00962 of a shift count. */ 00963 #define SHIFT_COUNT_TRUNCATED 1 00964 00965 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits 00966 is done just by pretending it is already truncated. */ 00967 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) (OUTPREC != 32) 00968 00969 /* Specify the machine mode that pointers have. 00970 After generation of rtl, the compiler makes no further distinction 00971 between pointers and any other objects of this machine mode. */ 00972 #define Pmode PSImode 00973 00974 /* A function address in a call instruction 00975 is a byte address (for indexing purposes) 00976 so give the MEM rtx a byte's mode. */ 00977 #define FUNCTION_MODE QImode 00978 00979 /* Perform target dependent optabs initialization. */ 00980 #define MODHI3_LIBCALL "__modhi3" 00981 #define DIVHI3_LIBCALL "__divhi3" 00982 00983 #define INIT_TARGET_OPTABS \ 00984 do { \ 00985 sdiv_optab->handlers[(int) HImode].libfunc \ 00986 = init_one_libfunc (DIVHI3_LIBCALL); \ 00987 smod_optab->handlers[(int) HImode].libfunc \ 00988 = init_one_libfunc (MODHI3_LIBCALL); \ 00989 } while (0) 00990 00991 /* The assembler op to get a word. */ 00992 00993 #define FILE_ASM_OP "\t.file\n" 00994 00995 #define PREDICATE_CODES \ 00996 {"call_address_operand", { SYMBOL_REF, REG }}, \ 00997 {"constant_memory_operand", { MEM }}, \ 00998 {"psimode_truncation_operand",{ PLUS, CONST_INT, CONST_DOUBLE, CONST, \ 00999 SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM }},\ 01000 {"extendpsi_operand", { PLUS, CONST_INT, CONST_DOUBLE, CONST, \ 01001 SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM }}, \ 01002 {"nshift_operator", { ASHIFTRT, LSHIFTRT, ASHIFT }}, 01003 01004 extern struct rtx_def *zero_dreg; 01005 extern struct rtx_def *zero_areg;
1.5.6