00001 /* Definitions of target machine for GNU compiler. Clipper version. 00002 Copyright (C) 1987, 1988, 1991, 1993, 1994, 1995, 1996, 1998, 00003 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 00004 Contributed by Holger Teutsch (holger@hotbso.rhein-main.de) 00005 00006 This file is part of GNU CC. 00007 00008 GNU CC is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2, or (at your option) 00011 any later version. 00012 00013 GNU CC is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with GNU CC; see the file COPYING. If not, write to 00020 the Free Software Foundation, 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. */ 00022 00023 /* Print subsidiary information on the compiler version in use. */ 00024 00025 #define TARGET_VERSION fprintf (stderr, " (clipper)"); 00026 00027 /* Run-time compilation parameters selecting different hardware subsets. */ 00028 00029 extern int target_flags; 00030 00031 /* Macros used in the machine description to test the flags. */ 00032 00033 /* Macro to define tables used to set the flags. 00034 This is a list in braces of pairs in braces, 00035 each pair being { "NAME", VALUE } 00036 where VALUE is the bits to set or minus the bits to clear. 00037 An empty string NAME is used to identify the default VALUE. */ 00038 00039 #define TARGET_SWITCHES \ 00040 { { "c400", 1, N_("Generate code for the C400") }, \ 00041 { "c300", -1, N_("Generate code for the C300") }, \ 00042 { "", TARGET_DEFAULT, NULL} } 00043 00044 #define TARGET_C400 1 00045 #define TARGET_C300 0 00046 00047 /* Default target_flags if no switches specified. */ 00048 00049 #ifndef TARGET_DEFAULT 00050 #define TARGET_DEFAULT TARGET_C300 00051 #endif 00052 00053 /* Show that we can debug generated code without a frame pointer. */ 00054 #define CAN_DEBUG_WITHOUT_FP 00055 00056 /* Target machine storage layout */ 00057 00058 /* Define this if most significant bit is lowest numbered 00059 in instructions that operate on numbered bit-fields. */ 00060 00061 #define BITS_BIG_ENDIAN 0 00062 00063 /* Define this if most significant byte of a word is the lowest numbered. */ 00064 00065 #define BYTES_BIG_ENDIAN 0 00066 00067 /* Define this if most significant word of a multiword number is the lowest 00068 numbered. */ 00069 00070 #define WORDS_BIG_ENDIAN 0 00071 00072 /* Number of bits in an addressable storage unit */ 00073 #define BITS_PER_UNIT 8 00074 00075 /* Width in bits of a "word", which is the contents of a machine register. 00076 Note that this is not necessarily the width of data type `int'; 00077 if using 16-bit ints on a 68000, this would still be 32. 00078 But on a machine with 16-bit registers, this would be 16. */ 00079 #define BITS_PER_WORD 32 00080 00081 /* Width of a word, in units (bytes). */ 00082 #define UNITS_PER_WORD 4 00083 00084 /* Width in bits of a pointer. 00085 See also the macro `Pmode' defined below. */ 00086 #define POINTER_SIZE 32 00087 00088 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ 00089 #define PARM_BOUNDARY 32 00090 00091 /* Largest alignment for stack parameters (if greater than PARM_BOUNDARY). */ 00092 #define MAX_PARM_BOUNDARY 64 00093 00094 /* Allocation boundary (in *bits*) for the code of a function. */ 00095 #define FUNCTION_BOUNDARY 128 00096 00097 /* Alignment of field after `int : 0' in a structure. */ 00098 #define EMPTY_FIELD_BOUNDARY 32 00099 00100 /* Every structure's size must be a multiple of this. */ 00101 #define STRUCTURE_SIZE_BOUNDARY 8 00102 00103 /* A bitfield declared as `int' forces `int' alignment for the struct. */ 00104 #define PCC_BITFIELD_TYPE_MATTERS 1 00105 00106 /* No data type wants to be aligned rounder than this. */ 00107 #define BIGGEST_ALIGNMENT 64 00108 00109 /* No structure field wants to be aligned rounder than this. */ 00110 #define BIGGEST_FIELD_ALIGNMENT 64 00111 00112 /* Make strcpy of constants fast. */ 00113 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \ 00114 ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN)) 00115 00116 /* Make arrays of chars word-aligned for the same reasons. */ 00117 #define DATA_ALIGNMENT(TYPE, ALIGN) \ 00118 (TREE_CODE (TYPE) == ARRAY_TYPE \ 00119 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ 00120 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) 00121 00122 /* Set this nonzero if move instructions will actually fail to work 00123 when given unaligned data. */ 00124 #define STRICT_ALIGNMENT 1 00125 00126 /* Let's keep the stack somewhat aligned. */ 00127 #define STACK_BOUNDARY 64 00128 00129 /* Define this macro if it is advisable to hold scalars in registers 00130 in a wider mode than that declared by the program. In such cases, 00131 the value is constrained to be within the bounds of the declared 00132 type, but kept valid in the wider mode. The signedness of the 00133 extension may differ from that of the type. 00134 00135 For Clipper, we always store objects in a full register. */ 00136 00137 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ 00138 if (GET_MODE_CLASS (MODE) == MODE_INT \ 00139 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ 00140 { \ 00141 (UNSIGNEDP) = 0; \ 00142 (MODE) = SImode; \ 00143 } 00144 00145 00146 /* Define this if function arguments should also be promoted using the above 00147 procedure. */ 00148 00149 /* FIXME: do we loose compatibility to acc if we define this? */ 00150 00151 /* #define PROMOTE_FUNCTION_ARGS */ 00152 00153 /* Likewise, if the function return value is promoted. */ 00154 00155 /* #define PROMOTE_FUNCTION_RETURN */ 00156 00157 00158 /* Standard register usage. */ 00159 00160 /* Number of actual hardware registers. 00161 The hardware registers are assigned numbers for the compiler 00162 from 0 to just below FIRST_PSEUDO_REGISTER. 00163 All registers that the compiler knows about must be given numbers, 00164 even those that are not normally considered general registers. */ 00165 #define FIRST_PSEUDO_REGISTER 32 00166 00167 /* 1 for registers that have pervasive standard uses 00168 and are not available for the register allocator. 00169 On the clipper, these are the FP and SP . */ 00170 #define FIXED_REGISTERS \ 00171 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\ 00172 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* Default: C300 */ 00173 00174 /* 1 for registers not available across function calls. 00175 These must include the FIXED_REGISTERS and also any 00176 registers that can be used without being saved. 00177 The latter must include the registers where values are returned 00178 and the register where structure-value addresses are passed. 00179 Aside from that, you can include as many other registers as you like. */ 00180 #define CALL_USED_REGISTERS \ 00181 {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\ 00182 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* default: C300 */ 00183 00184 /* Zero or more C statements that may conditionally modify two 00185 variables `fixed_regs' and `call_used_regs' (both of type `char 00186 []') after they have been initialized from the two preceding 00187 macros. A C400 has additional floating registers f8 -> f15 */ 00188 00189 #define CONDITIONAL_REGISTER_USAGE \ 00190 if (target_flags & TARGET_C400) \ 00191 { int i; \ 00192 for (i = 24; i < 32; i++) fixed_regs[i] = call_used_regs[i] = 0; } 00193 00194 /* Return number of consecutive hard regs needed starting at reg REGNO 00195 to hold something of mode MODE. 00196 This is ordinarily the length in words of a value of mode MODE 00197 but can be less for certain modes in special long registers. 00198 On the clipper, fp registers are 64 bits. */ 00199 00200 #define HARD_REGNO_NREGS(REGNO, MODE) \ 00201 ((REGNO) >= 16 ? 1 \ 00202 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) 00203 00204 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. 00205 On the clipper 0-15 may hold any mode but DImode and DFmode must be even. 00206 Registers 16-31 hold SFmode and DFmode */ 00207 00208 #define HARD_REGNO_MODE_OK(REGNO, MODE) \ 00209 ((REGNO) < 16 \ 00210 ? (((MODE) != DImode && (MODE) != DFmode) || ((REGNO) & 1) == 0) \ 00211 : ((MODE) == SFmode || (MODE) == DFmode)) 00212 00213 /* Value is 1 if it is a good idea to tie two pseudo registers 00214 when one has mode MODE1 and one has mode MODE2. 00215 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, 00216 for any hard reg, then this must be 0 for correct output. */ 00217 #define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2)) 00218 00219 /* Specify the registers used for certain standard purposes. 00220 The values of these macros are register numbers. */ 00221 00222 /* clipper has extra PC */ 00223 /* #define PC_REGNUM */ 00224 00225 /* Register to use for pushing function arguments. */ 00226 #define STACK_POINTER_REGNUM 15 00227 00228 /* Base register for access to local variables of the function. */ 00229 #define FRAME_POINTER_REGNUM 14 00230 00231 /* Value should be nonzero if functions must have frame pointers. 00232 Zero means the frame pointer need not be set up (and parms 00233 may be accessed via the stack pointer) in functions that seem suitable. 00234 This is computed in `reload', in reload1.c. */ 00235 #define FRAME_POINTER_REQUIRED \ 00236 (! leaf_function_p ()) 00237 00238 /* Base register for access to arguments of the function. */ 00239 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM 00240 00241 /* Register in which static-chain is passed to a function. */ 00242 #define STATIC_CHAIN_REGNUM 2 00243 00244 /* Register in which address to store a structure value 00245 is passed to a function. */ 00246 #define STRUCT_VALUE_REGNUM 0 00247 00248 /* Define the classes of registers for register constraints in the 00249 machine description. Also define ranges of constants. 00250 00251 One of the classes must always be named ALL_REGS and include all hard regs. 00252 If there is more than one class, another class must be named NO_REGS 00253 and contain no registers. 00254 00255 The name GENERAL_REGS must be the name of a class (or an alias for 00256 another name such as ALL_REGS). This is the class of registers 00257 that is allowed by "g" or "r" in a register constraint. 00258 Also, registers outside this class are allocated only when 00259 instructions express preferences for them. 00260 00261 The classes must be numbered in nondecreasing order; that is, 00262 a larger-numbered class must never be contained completely 00263 in a smaller-numbered class. 00264 00265 For any two classes, it is very desirable that there be another 00266 class that represents their union. */ 00267 00268 /* The clipper has general and FP regs. */ 00269 00270 enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, LIM_REG_CLASSES}; 00271 00272 #define N_REG_CLASSES (int) LIM_REG_CLASSES 00273 00274 /* Give names of register classes as strings for dump file. */ 00275 00276 #define REG_CLASS_NAMES \ 00277 {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" } 00278 00279 /* Define which registers fit in which classes. 00280 This is an initializer for a vector of HARD_REG_SET 00281 of length N_REG_CLASSES. */ 00282 00283 #define REG_CLASS_CONTENTS { {0}, {0x0000ffff}, {0xffff0000}, {0xffffffff} } 00284 00285 /* The same information, inverted: 00286 Return the class number of the smallest class containing 00287 reg number REGNO. This could be a conditional expression 00288 or could index an array. */ 00289 00290 #define REGNO_REG_CLASS(REGNO) ((REGNO) >= 16 ? FLOAT_REGS : GENERAL_REGS) 00291 00292 /* The class value for index registers, and the one for base regs. */ 00293 00294 #define INDEX_REG_CLASS GENERAL_REGS 00295 #define BASE_REG_CLASS GENERAL_REGS 00296 00297 /* Get reg_class from a letter such as appears in the machine description. */ 00298 00299 #define REG_CLASS_FROM_LETTER(C) \ 00300 ((C) == 'r' ? GENERAL_REGS : ((C) == 'f' ? FLOAT_REGS: NO_REGS)) 00301 00302 /* The letters I, J, K, L and M in a register constraint string 00303 can be used to stand for particular ranges of immediate operands. 00304 This macro defines what the ranges are. 00305 C is the letter, and VALUE is a constant value. 00306 Return 1 if VALUE is in the range specified by C. */ 00307 00308 #define CONST_OK_FOR_LETTER_P(VALUE, C) 0 00309 00310 /* Similar, but for floating constants, and defining letters G and H. 00311 Here VALUE is the CONST_DOUBLE rtx itself. */ 00312 00313 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 00314 00315 /* Optional extra constraints for this machine. */ 00316 00317 /* #define EXTRA_CONSTRAINT(OP, C) */ 00318 00319 00320 /* Given an rtx X being reloaded into a reg required to be 00321 in class CLASS, return the class of reg to actually use. 00322 In general this is just CLASS; but on some machines 00323 in some cases it is preferable to use a more restrictive class. */ 00324 00325 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) 00326 00327 /* Return the maximum number of consecutive registers 00328 needed to represent mode MODE in a register of class CLASS. */ 00329 00330 #define CLASS_MAX_NREGS(CLASS, MODE) \ 00331 ((CLASS) == FLOAT_REGS \ 00332 ? 1 \ 00333 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 00334 00335 /* Stack layout; function entry, exit and calling. */ 00336 00337 /* Define this if pushing a word on the stack 00338 makes the stack pointer a smaller address. */ 00339 #define STACK_GROWS_DOWNWARD 00340 00341 /* Define this if the nominal address of the stack frame 00342 is at the high-address end of the local variables; 00343 that is, each additional local variable allocated 00344 goes at a more negative offset in the frame. */ 00345 #define FRAME_GROWS_DOWNWARD 00346 00347 /* Offset within stack frame to start allocating local variables at. 00348 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the 00349 first local allocated. Otherwise, it is the offset to the BEGINNING 00350 of the first local allocated. */ 00351 #define STARTING_FRAME_OFFSET 0 00352 00353 /* Given an rtx for the address of a frame, 00354 return an rtx for the address of the word in the frame 00355 that holds the dynamic chain--the previous frame's address. */ 00356 #define DYNAMIC_CHAIN_ADDRESS(frame) (frame) 00357 00358 /* If we generate an insn to push BYTES bytes, 00359 this says how many the stack pointer really advances by. */ 00360 00361 /* #define PUSH_ROUNDING(BYTES) (BYTES) */ 00362 00363 /* Keep the stack pointer constant throughout the function. */ 00364 /* we can't set this for clipper as library calls may have 3 args and we pass 00365 only 2 args in regs. */ 00366 00367 /* #define ACCUMULATE_OUTGOING_ARGS 1*/ 00368 00369 00370 /* Offset of first parameter from the argument pointer register value. 00371 size of PC + FP */ 00372 00373 #define FIRST_PARM_OFFSET(FNDECL) 8 00374 00375 /* Value is the number of bytes of arguments automatically 00376 popped when returning from a subroutine call. 00377 FUNDECL is the declaration node of the function (as a tree), 00378 FUNTYPE is the data type of the function (as a tree), 00379 or for a library call it is an identifier node for the subroutine name. 00380 SIZE is the number of bytes of arguments passed on the stack. */ 00381 00382 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 00383 00384 /* Define how to find the value returned by a function. 00385 VALTYPE is the data type of the value (as a tree). 00386 If the precise function being called is known, FUNC is its FUNCTION_DECL; 00387 otherwise, FUNC is 0. */ 00388 00389 #define FUNCTION_VALUE(VALTYPE, FUNC) \ 00390 gen_rtx_REG (TYPE_MODE (VALTYPE), ((TYPE_MODE (VALTYPE) == SFmode ||\ 00391 TYPE_MODE (VALTYPE) == DFmode) ? \ 00392 16 : 0)) 00393 00394 /* Define how to find the value returned by a library function 00395 assuming the value has mode MODE. */ 00396 00397 #define LIBCALL_VALUE(MODE) \ 00398 gen_rtx_REG ((MODE), ((MODE) == SFmode || (MODE) == DFmode ? 16 : 0)) 00399 00400 00401 /* 1 if N is a possible register number for a function value 00402 as seen by the caller. */ 00403 00404 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 16) 00405 00406 /* 1 if N is a possible register number for function argument passing. */ 00407 00408 #define FUNCTION_ARG_REGNO_P(N) \ 00409 ((N) == 0 || (N) == 1 || (N) == 16 || (N) == 17) 00410 00411 /* Define this if PCC uses the nonreentrant convention for returning 00412 structure and union values. Old Green Hills C-Clipper returns static 00413 structs but the newer Apogee compiler passes structs as hidden arg 0. 00414 Structs etc are always passed in memory */ 00415 00416 /* #define PCC_STATIC_STRUCT_RETURN */ 00417 00418 00419 /* Define a data type for recording info about an argument list 00420 during the scan of that argument list. This data type should 00421 hold all necessary information about the function itself 00422 and about the args processed so far, enough to enable macros 00423 such as FUNCTION_ARG to determine where the next arg should go. 00424 00425 Clipper uses 2 register 'slots' that pass arguments in r0/r1 or f0/f1. 00426 An argument that must be passed in memory (struct... ) leaves that slot 00427 free. 00428 We pass 'long long' only in registers when both slots are free. 00429 Returned structs must be allocated by the caller, the address is passed 00430 in r0. 00431 00432 struct ss {..} 00433 00434 fun (i,j,k) i in r0, j in r1, k on stack 00435 fun (s,j,k) s on stack, j in r1, k on stack 00436 fun (i,s,k) i in r0, s on stack, k on stack 00437 s1 = fun (i,s,k) &s1 in r0, i in r1, s on stack, k on stack 00438 00439 We must keep enough information for varargs/stdargs. 00440 00441 _clipper_cum_args is a struct of 2 integers, with 00442 num = slots used 00443 size = size of all stack args = offset to next arg without alignment 00444 00445 If we use stdarg.h, size points to the first unnamed arg, 00446 see va-clipper.h */ 00447 00448 struct _clipper_cum_args { int num; int size; }; 00449 00450 #define CUMULATIVE_ARGS struct _clipper_cum_args 00451 00452 /* Initialize a variable CUM of type CUMULATIVE_ARGS 00453 for a call to a function whose data type is FNTYPE. 00454 For a library call, FNTYPE is 0. 00455 00456 clipper passes the address of a struct in r0, set num = 1 in this case */ 00457 00458 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ 00459 ((CUM).num = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE (FNTYPE))), \ 00460 (CUM).size = 0) 00461 00462 /* internal helper : size of an argument */ 00463 00464 #define CLIPPER_ARG_SIZE(MODE, TYPE) \ 00465 (((MODE) != BLKmode \ 00466 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \ 00467 : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) \ 00468 * UNITS_PER_WORD) 00469 00470 /* Update the data in CUM to advance over an argument 00471 of mode MODE and data type TYPE. 00472 (TYPE is null for libcalls where that information may not be available.) */ 00473 00474 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ 00475 do \ 00476 { \ 00477 int reg = 0; \ 00478 \ 00479 if ((CUM).num < 2 \ 00480 && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \ 00481 && (GET_MODE_SIZE (MODE) <= 8) \ 00482 && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \ 00483 && ((MODE) != DImode || (CUM).num == 0)) \ 00484 { \ 00485 reg = 1; \ 00486 if ((MODE) == DImode) \ 00487 (CUM).num = 1; \ 00488 } \ 00489 \ 00490 (CUM).num++; \ 00491 \ 00492 if (! reg) \ 00493 { \ 00494 int align = FUNCTION_ARG_BOUNDARY (MODE, TYPE) / BITS_PER_UNIT; \ 00495 (CUM).size += align - 1; \ 00496 (CUM).size &= ~(align - 1); \ 00497 (CUM).size += CLIPPER_ARG_SIZE (MODE, TYPE); \ 00498 } \ 00499 } while (0) 00500 00501 /* Define where to put the arguments to a function. 00502 Value is zero to push the argument on the stack, 00503 or a hard register in which to store the argument. 00504 00505 MODE is the argument's machine mode. 00506 TYPE is the data type of the argument (as a tree). 00507 This is null for libcalls where that information may 00508 not be available. 00509 CUM is a variable of type CUMULATIVE_ARGS which gives info about 00510 the preceding args and about the function being called. 00511 NAMED is nonzero if this argument is a named parameter 00512 (otherwise it is an extra parameter matching an ellipsis). 00513 00514 2 args may go into regs. These must be MODE_INT or MODE_FLOAT but only 00515 if they really fit into ONE register. The exception is a DImode arg 00516 that occupies both register slots. */ 00517 00518 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ 00519 (((CUM).num < 2 \ 00520 && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \ 00521 && (GET_MODE_SIZE (MODE) <= 8) \ 00522 && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \ 00523 && ((MODE) != DImode || (CUM).num == 0)) \ 00524 ? gen_rtx_REG ((MODE), \ 00525 GET_MODE_CLASS(MODE) == MODE_FLOAT \ 00526 ? (CUM).num+16 : (CUM).num) \ 00527 : 0) 00528 00529 /* If defined, a C expression that gives the alignment boundary, in bits, 00530 of an argument with the specified mode and type. If it is not defined, 00531 `PARM_BOUNDARY' is used for all arguments. */ 00532 00533 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ 00534 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_SIZE (MODE)) <= PARM_BOUNDARY \ 00535 ? PARM_BOUNDARY : 2 * PARM_BOUNDARY) 00536 00537 /* For an arg passed partly in registers and partly in memory, 00538 this is the number of registers used. 00539 For args passed entirely in registers or entirely in memory, zero. 00540 Clipper never passed args partially in regs/mem. */ 00541 00542 /* #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0 */ 00543 00544 /* Generate necessary RTL for __builtin_saveregs(). 00545 ARGLIST is the argument list; see expr.c. */ 00546 00547 #define EXPAND_BUILTIN_SAVEREGS() clipper_builtin_saveregs () 00548 00549 /* Output assembler code to FILE to increment profiler label # LABELNO 00550 for profiling a function entry. */ 00551 00552 #define FUNCTION_PROFILER(FILE, LABELNO) /* FIXME */ 00553 00554 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, 00555 the stack pointer does not matter. The value is tested only in 00556 functions that have frame pointers. 00557 No definition is equivalent to always zero. */ 00558 00559 #define EXIT_IGNORE_STACK 1 00560 00561 /* Store in the variable DEPTH the initial difference between the 00562 frame pointer reg contents and the stack pointer reg contents, 00563 as of the start of the function body. This depends on the layout 00564 of the fixed parts of the stack frame and on how registers are saved. */ 00565 00566 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \ 00567 DEPTH = clipper_frame_size (get_frame_size ()) 00568 00569 00570 /* Output assembler code for a block containing the constant parts 00571 of a trampoline, leaving space for the variable parts. */ 00572 00573 #define TRAMPOLINE_TEMPLATE(FILE) \ 00574 { \ 00575 fputs ("\t.word 0x459F,0x0004\t# call sp,.+4\n", FILE); \ 00576 fputs ("\tmovw (sp),r3\n", FILE); \ 00577 fputs ("\taddq $4,sp\n", FILE); \ 00578 fputs ("\tloadw 20(r3),r2\n", FILE); \ 00579 fputs ("\tloadw 24(r3),r3\n", FILE); \ 00580 fputs ("\tb (r3)\n", FILE); \ 00581 fputs ("\t.long 0,0\n", FILE); \ 00582 } 00583 00584 /* Length in units of the trampoline for entering a nested function. */ 00585 00586 #define TRAMPOLINE_SIZE 32 00587 00588 /* Alignment required for a trampoline. 128 is used to find the 00589 beginning of a line in the instruction cache and to allow for 00590 instruction cache lines of up to 128 bytes. */ 00591 00592 #define TRAMPOLINE_ALIGNMENT 128 00593 00594 /* Section in which to place the trampoline. */ 00595 00596 #define TRAMPOLINE_SECTION text_section 00597 00598 /* Emit RTL insns to initialize the variable parts of a trampoline. 00599 FNADDR is an RTX for the address of the function's pure code. 00600 CXT is an RTX for the static chain value for the function. */ 00601 00602 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ 00603 { \ 00604 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 24)), CXT); \ 00605 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 28)), FNADDR); \ 00606 } 00607 00608 /* Addressing modes, and classification of registers for them. */ 00609 00610 /* #define HAVE_POST_DECREMENT 0 */ 00611 00612 /* #define HAVE_PRE_INCREMENT 0 */ 00613 00614 /* Macros to check register numbers against specific register classes. */ 00615 00616 /* These assume that REGNO is a hard or pseudo reg number. 00617 They give nonzero only if REGNO is a hard reg of the suitable class 00618 or a pseudo reg currently allocated to a suitable hard reg. 00619 Since they use reg_renumber, they are safe only once reg_renumber 00620 has been allocated, which happens in local-alloc.c. */ 00621 00622 #define REGNO_OK_FOR_INDEX_P(regno) \ 00623 ((regno) < 16 || (unsigned)reg_renumber[regno] < 16) 00624 #define REGNO_OK_FOR_BASE_P(regno) \ 00625 ((regno) < 16 || (unsigned)reg_renumber[regno] < 16) 00626 00627 /* Maximum number of registers that can appear in a valid memory address. */ 00628 00629 #define MAX_REGS_PER_ADDRESS 2 00630 00631 /* 1 if X is an rtx for a constant that is a valid address. */ 00632 00633 #define CONSTANT_ADDRESS_P(X) \ 00634 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ 00635 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ 00636 || GET_CODE (X) == HIGH) 00637 00638 /* Nonzero if the constant value X is a legitimate general operand. 00639 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ 00640 00641 #define LEGITIMATE_CONSTANT_P(X) 1 00642 00643 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx 00644 and check its validity for a certain class. 00645 We have two alternate definitions for each of them. 00646 The usual definition accepts all pseudo regs; the other rejects 00647 them unless they have been allocated suitable hard regs. 00648 The symbol REG_OK_STRICT causes the latter definition to be used. 00649 00650 Most source files want to accept pseudo regs in the hope that 00651 they will get allocated to the class that the insn wants them to be in. 00652 Source files for reload pass need to be strict. 00653 After reload, it makes no difference, since pseudo regs have 00654 been eliminated by then. */ 00655 00656 /* clipper doesn't have true indexing */ 00657 00658 #ifndef REG_OK_STRICT 00659 00660 /* Nonzero if X is a hard reg that can be used as an index 00661 or if it is a pseudo reg. */ 00662 00663 #define REG_OK_FOR_INDEX_P(X) \ 00664 (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER) 00665 00666 /* Nonzero if X is a hard reg that can be used as a base reg 00667 or if it is a pseudo reg. */ 00668 00669 #define REG_OK_FOR_BASE_P(X) \ 00670 (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER) 00671 00672 #else 00673 00674 /* Nonzero if X is a hard reg that can be used as an index. */ 00675 #define REG_OK_FOR_INDEX_P(X) (REGNO(X) < 16) 00676 00677 /* Nonzero if X is a hard reg that can be used as a base reg. */ 00678 #define REG_OK_FOR_BASE_P(X) (REGNO(X) < 16) 00679 00680 #endif 00681 00682 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression 00683 that is a valid memory address for an instruction. 00684 The MODE argument is the machine mode for the MEM expression 00685 that wants to use this address. 00686 00687 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, 00688 except for CONSTANT_ADDRESS_P which is actually machine-independent. */ 00689 00690 /* Non-zero if X is an address which can be indirected. */ 00691 00692 #define INDIRECTABLE_CONSTANT_ADDRESS_P(X) 0 00693 00694 #define INDIRECTABLE_ADDRESS_P(X) \ 00695 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) 00696 00697 /* Go to ADDR if X is a valid address not using indexing. 00698 (This much is the easy part.) */ 00699 00700 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \ 00701 { if (CONSTANT_ADDRESS_P (X)) goto ADDR; \ 00702 if (INDIRECTABLE_ADDRESS_P (X)) goto ADDR; } 00703 00704 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ 00705 { register rtx xfoo = (X); \ 00706 GO_IF_NONINDEXED_ADDRESS (xfoo, ADDR); \ 00707 if (GET_CODE (xfoo) == PLUS) \ 00708 { register rtx xfoo0, xfoo1; \ 00709 xfoo0 = XEXP (xfoo, 0); \ 00710 xfoo1 = XEXP (xfoo, 1); \ 00711 /* handle reg + reg -> [r1](r0) */ \ 00712 if (INDIRECTABLE_ADDRESS_P (xfoo0) && INDIRECTABLE_ADDRESS_P (xfoo1)) \ 00713 goto ADDR; \ 00714 /* Handle <symbol>(reg) -> xxx(r0) */ \ 00715 if (INDIRECTABLE_ADDRESS_P (xfoo0) && CONSTANT_ADDRESS_P (xfoo1)) \ 00716 goto ADDR; \ 00717 if (INDIRECTABLE_ADDRESS_P (xfoo1) && CONSTANT_ADDRESS_P (xfoo0)) \ 00718 goto ADDR; }} 00719 00720 00721 /* Try machine-dependent ways of modifying an illegitimate address 00722 to be legitimate. If we find one, return the new, valid address. 00723 This macro is used in only one place: `memory_address' in explow.c. 00724 00725 OLDX is the address as it was before break_out_memory_refs was called. 00726 In some cases it is useful to look at this to decide what needs to be done. 00727 00728 MODE and WIN are passed so that this macro can use 00729 GO_IF_LEGITIMATE_ADDRESS. 00730 00731 It is always safe for this macro to do nothing. It exists to recognize 00732 opportunities to optimize the output. 00733 00734 For the clipper, nothing needs to be done. */ 00735 00736 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} 00737 00738 /* Go to LABEL if ADDR (a legitimate address expression) 00739 has an effect that depends on the machine mode it is used for. */ 00740 00741 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} 00742 00743 00744 /* Specify the machine mode that this machine uses 00745 for the index in the tablejump instruction. */ 00746 #define CASE_VECTOR_MODE SImode 00747 00748 /* Define as C expression which evaluates to nonzero if the tablejump 00749 instruction expects the table to contain offsets from the address of the 00750 table. 00751 Do not define this if the table should contain absolute addresses. */ 00752 /* #define CASE_VECTOR_PC_RELATIVE 1 */ 00753 00754 /* Define this if the case instruction drops through after the table 00755 when the index is out of range. Don't define it if the case insn 00756 jumps to the default label instead. */ 00757 /* #define CASE_DROPS_THROUGH */ 00758 00759 /* Define if operations between registers always perform the operation 00760 on the full register even if a narrower mode is specified. */ 00761 #define WORD_REGISTER_OPERATIONS 00762 00763 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD 00764 will either zero-extend or sign-extend. The value of this macro should 00765 be the code that says which one of the two operations is implicitly 00766 done, NIL if none. */ 00767 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND 00768 00769 /* Define this as 1 if `char' should by default be signed; else as 0. */ 00770 #define DEFAULT_SIGNED_CHAR 1 00771 00772 /* This flag, if defined, says the same insns that convert to a signed fixnum 00773 also convert validly to an unsigned one. */ 00774 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC 00775 00776 /* Max number of bytes we can move from memory to memory 00777 in one reasonably fast instruction. */ 00778 #define MOVE_MAX 4 00779 00780 /* If a memory-to-memory move would take MOVE_RATIO or more simple 00781 move-instruction pairs, we will do a movstr or libcall instead. 00782 00783 Make this large on clipper, since the block move is very 00784 inefficient with small blocks, and the hard register needs of the 00785 block move require much reload work. */ 00786 00787 #define MOVE_RATIO 20 00788 00789 /* Nonzero if access to memory by bytes is slow and undesirable. */ 00790 #define SLOW_BYTE_ACCESS 0 00791 00792 /* Define if shifts truncate the shift count 00793 which implies one can omit a sign-extension or zero-extension 00794 of a shift count. */ 00795 /* #define SHIFT_COUNT_TRUNCATED */ 00796 00797 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits 00798 is done just by pretending it is already truncated. */ 00799 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 00800 00801 /* Specify the machine mode that pointers have. 00802 After generation of rtl, the compiler makes no further distinction 00803 between pointers and any other objects of this machine mode. */ 00804 #define Pmode SImode 00805 00806 /* A function address in a call instruction 00807 is a byte address (for indexing purposes) 00808 so give the MEM rtx a byte's mode. */ 00809 #define FUNCTION_MODE QImode 00810 00811 /* This machine uses IEEE floats. */ 00812 00813 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT 00814 00815 /* Check a `double' value for validity for a particular machine mode. 00816 This is defined to avoid crashes outputting certain constants. 00817 Since we output the number in hex, the assembler won't choke on it. */ 00818 /* #define CHECK_FLOAT_VALUE(MODE,VALUE) */ 00819 00820 00821 /* Compute the cost of computing a constant rtl expression RTX 00822 whose rtx-code is CODE. The body of this macro is a portion 00823 of a switch statement. If the code is computed here, 00824 return it with a return statement. Otherwise, break from the switch. */ 00825 00826 /* On a Clipper, constants from 0..15 are cheap because they can use the 00827 'quick' mode. */ 00828 00829 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ 00830 case CONST_INT: \ 00831 if (0 <= INTVAL (RTX) && INTVAL(RTX) <= 15 ) return 0; \ 00832 return 1; \ 00833 case CONST: \ 00834 case LABEL_REF: \ 00835 case SYMBOL_REF: \ 00836 return 3; \ 00837 case CONST_DOUBLE: \ 00838 return 5; 00839 00840 /* Provide the costs of a rtl expression. This is in the body of a 00841 switch on CODE. */ 00842 00843 #define RTX_COSTS(X,CODE,OUTER_CODE) \ 00844 case MULT: \ 00845 return COSTS_N_INSNS (4); \ 00846 case DIV: \ 00847 case UDIV: \ 00848 case MOD: \ 00849 case UMOD: \ 00850 return COSTS_N_INSNS (40); \ 00851 case ASHIFT: \ 00852 case LSHIFTRT: \ 00853 case ASHIFTRT: \ 00854 return COSTS_N_INSNS (2); \ 00855 case SIGN_EXTEND: \ 00856 return (GET_CODE (XEXP (X,0)) == REG ? COSTS_N_INSNS (3) : 4); 00857 00858 /* Specify the cost of a branch insn; roughly the number of extra insns that 00859 should be added to avoid a branch */ 00860 00861 /* #define BRANCH_COST 0 */ 00862 00863 00864 /* Tell final.c how to eliminate redundant test instructions. */ 00865 00866 /* Here we define machine-dependent flags and fields in cc_status 00867 (see `conditions.h'). No extra ones are needed for the clipper. */ 00868 00869 /* Store in cc_status the expressions 00870 that the condition codes will describe 00871 after execution of an instruction whose pattern is EXP. 00872 Do not alter them if the instruction would not alter the cc's. */ 00873 00874 #define NOTICE_UPDATE_CC(EXP, INSN) \ 00875 { \ 00876 enum attr_cc cc = get_attr_cc (INSN); \ 00877 rtx dest = SET_DEST (EXP); \ 00878 switch (cc) \ 00879 { \ 00880 case CC_CHANGE0: \ 00881 if (GET_CODE (EXP) == PARALLEL) abort(); \ 00882 if ((cc_status.value1 && rtx_equal_p (dest, cc_status.value1)) || \ 00883 (cc_status.value2 && rtx_equal_p (dest, cc_status.value2))) \ 00884 CC_STATUS_INIT; \ 00885 break; \ 00886 \ 00887 case CC_SET1: \ 00888 if (GET_CODE (EXP) == PARALLEL) abort(); \ 00889 cc_status.flags = 0; \ 00890 cc_status.value1 = dest; \ 00891 cc_status.value2 = 0; \ 00892 break; \ 00893 \ 00894 case CC_SET2: \ 00895 if (GET_CODE (EXP) == PARALLEL) abort(); \ 00896 cc_status.flags = 0; \ 00897 cc_status.value1 = dest; \ 00898 cc_status.value2 = SET_SRC (EXP); \ 00899 break; \ 00900 \ 00901 case CC_UNCHANGED: \ 00902 break; \ 00903 \ 00904 case CC_CLOBBER: \ 00905 CC_STATUS_INIT; \ 00906 break; \ 00907 \ 00908 default: \ 00909 abort (); \ 00910 } \ 00911 } 00912 00913 00914 /* Control the assembler format that we output. */ 00915 00916 /* Output at beginning of assembler file. */ 00917 00918 #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n"); 00919 00920 /* Output to assembler file text saying following lines 00921 may contain character constants, extra white space, comments, etc. */ 00922 00923 #define ASM_APP_ON "#APP\n" 00924 00925 /* Output to assembler file text saying following lines 00926 no longer contain unusual constructs. */ 00927 00928 #define ASM_APP_OFF "#NO_APP\n" 00929 00930 /* Output before read-only data. */ 00931 00932 #define TEXT_SECTION_ASM_OP "\t.text" 00933 00934 /* Output before writable data. */ 00935 00936 #define DATA_SECTION_ASM_OP "\t.data" 00937 00938 /* How to refer to registers in assembler output. 00939 This sequence is indexed by compiler's hard-register-number (see above). */ 00940 00941 #define REGISTER_NAMES \ 00942 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \ 00943 "r9", "r10", "r11", "r12", "r13", "fp", "sp", \ 00944 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", \ 00945 "f9", "f10", "f11", "f12", "f13", "f14", "f15" } 00946 00947 /* This is how to output the definition of a user-level label named NAME, 00948 such as the label on a static function or variable NAME. */ 00949 00950 #define ASM_OUTPUT_LABEL(FILE,NAME) \ 00951 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) 00952 00953 /* This is how to output a command to make the user-level label named NAME 00954 defined for reference from other files. */ 00955 00956 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ 00957 do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) 00958 00959 /* This is how to output an insn to push a register on the stack. 00960 It need not be very fast code. */ 00961 00962 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ 00963 fprintf (FILE, "\tsubq $8,sp\n\t%s %s,(sp)\n", \ 00964 (REGNO) < 16 ? "storw" : "stord", reg_names[REGNO]) 00965 00966 /* This is how to output an insn to pop a register from the stack. 00967 It need not be very fast code. */ 00968 00969 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ 00970 fprintf (FILE, "\t%s (sp),%s\n\taddq $8,sp\n", \ 00971 (REGNO) < 16 ? "loadw" : "loadd", reg_names[REGNO]) 00972 /* This is how to output an element of a case-vector that is absolute */ 00973 00974 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ 00975 fprintf (FILE, "\t.long .L%d\n", VALUE) 00976 00977 /* This is how to output an element of a case-vector that is relative. */ 00978 00979 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ 00980 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL) 00981 00982 /* This is how to output an assembler line 00983 that says to advance the location counter by SIZE bytes. */ 00984 00985 #define ASM_OUTPUT_SKIP(FILE,SIZE) \ 00986 fprintf (FILE, "\t.space %u\n", (SIZE)) 00987 00988 /* This says how to output an assembler line 00989 to define a local common symbol. */ 00990 /* ??? The use of .bss here seems odd. */ 00991 00992 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE,NAME,SIZE,ALIGN) \ 00993 ( data_section (), \ 00994 fputs ("\t.bss\t", (FILE)), \ 00995 assemble_name ((FILE), (NAME)), \ 00996 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN)/BITS_PER_UNIT)) 00997 00998 /* Store in OUTPUT a string (made with alloca) containing 00999 an assembler-name for a local static variable named NAME. 01000 LABELNO is an integer which is different for each call. */ 01001 01002 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ 01003 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ 01004 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) 01005 01006 /* Print an instruction operand X on file FILE. 01007 CODE is the code from the %-spec that requested printing this operand; 01008 if `%z3' was used to print operand 3, then CODE is 'z'. 01009 01010 Clipper operand formatting codes: 01011 01012 letter print 01013 C reverse branch condition 01014 */ 01015 01016 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ 01017 ((CODE) == 'C') 01018 01019 #define PRINT_OPERAND(FILE, X, CODE) \ 01020 { if (CODE == 'C') \ 01021 fputs (rev_cond_name (X), FILE); \ 01022 else if (GET_CODE (X) == REG) \ 01023 fprintf (FILE, "%s", reg_names[REGNO (X)]); \ 01024 else if (GET_CODE (X) == MEM) \ 01025 output_address (XEXP (X, 0)); \ 01026 else { putc ('$', FILE); output_addr_const (FILE, X); }} 01027 01028 /* Print a memory operand whose address is X, on file FILE. 01029 This uses a function in output-clipper.c. */ 01030 01031 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ 01032 print_operand_address (FILE, ADDR) 01033 01034 /* Define the codes that are matched by predicates in clipper.c */ 01035 01036 #define PREDICATE_CODES \ 01037 {"int_reg_operand", {SUBREG, REG}}, \ 01038 {"fp_reg_operand", {SUBREG, REG}}, 01039 01040 /* Define the `__builtin_va_list' type for the ABI. */ 01041 #define BUILD_VA_LIST_TYPE(VALIST) \ 01042 (VALIST) = clipper_build_va_list () 01043 01044 /* Implement `va_start' for varargs and stdarg. */ 01045 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \ 01046 clipper_va_start (stdarg, valist, nextarg) 01047 01048 /* Implement `va_arg'. */ 01049 #define EXPAND_BUILTIN_VA_ARG(valist, type) \ 01050 clipper_va_arg (valist, type)
1.5.6