]> gcc.gnu.org Git - gcc.git/blame - gcc/config/sparc/sparc.h
*** empty log message ***
[gcc.git] / gcc / config / sparc / sparc.h
CommitLineData
1bb87f28
JW
1/* Definitions of target machine for GNU compiler, for Sun SPARC.
2 Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com).
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21/* Note that some other tm.h files include this one and then override
22 many of the definitions that relate to assembler syntax. */
23
24#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}"
25
98ccf8fe 26/* Provide required defaults for linker -e and -d switches. */
1bb87f28 27
d6f04508 28#define LINK_SPEC \
2defae7d 29 "%{!nostdlib:%{!e*:-e start}} -dc -dp %{static:-Bstatic} %{assert*}"
1bb87f28
JW
30
31/* Special flags to the Sun-4 assembler when using pipe for input. */
32
33#define ASM_SPEC " %{pipe:-} %{fpic:-k} %{fPIC:-k}"
34
885d8175
JW
35/* Define macros to distinguish architectures. */
36#define CPP_SPEC "%{msparclite:-D__sparclite__} %{mv8:-D__sparcv8__}"
37
b1fc14e5
RS
38/* Prevent error on `-sun4' and `-target sun4' options. */
39/* This used to translate -dalign to -malign, but that is no good
40 because it can't turn off the usual meaning of making debugging dumps. */
1bb87f28 41
b1fc14e5 42#define CC1_SPEC "%{sun4:} %{target:}"
1bb87f28 43
d9ca49d5
JW
44#if 0
45/* Sparc ABI says that long double is 4 words.
46 ??? This doesn't work yet. */
47#define LONG_DOUBLE_TYPE_SIZE 128
48#endif
49
1bb87f28
JW
50#define PTRDIFF_TYPE "int"
51#define SIZE_TYPE "int"
52#define WCHAR_TYPE "short unsigned int"
53#define WCHAR_TYPE_SIZE 16
54
98ccf8fe
RK
55/* Omit frame pointer at high optimization levels. */
56
1bb87f28
JW
57#define OPTIMIZATION_OPTIONS(OPTIMIZE) \
58{ \
59 if (OPTIMIZE >= 2) \
60 { \
61 flag_omit_frame_pointer = 1; \
1bb87f28
JW
62 } \
63}
64
65/* These compiler options take an argument. We ignore -target for now. */
66
67#define WORD_SWITCH_TAKES_ARG(STR) \
68 (!strcmp (STR, "Tdata") || !strcmp (STR, "include") \
69 || !strcmp (STR, "imacros") || !strcmp (STR, "target") \
b1fc14e5 70 || !strcmp (STR, "assert") || !strcmp (STR, "aux-info"))
1bb87f28
JW
71
72/* Names to predefine in the preprocessor for this target machine. */
73
74#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix"
75
76/* Print subsidiary information on the compiler version in use. */
77
78#define TARGET_VERSION fprintf (stderr, " (sparc)");
79
80/* Generate DBX debugging information. */
81
82#define DBX_DEBUGGING_INFO
83
84/* Run-time compilation parameters selecting different hardware subsets. */
85
86extern int target_flags;
87
88/* Nonzero if we should generate code to use the fpu. */
89#define TARGET_FPU (target_flags & 1)
90
91/* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we
92 use fast return insns, but lose some generality. */
93#define TARGET_EPILOGUE (target_flags & 2)
94
b1fc14e5
RS
95/* Nonzero means that reference doublewords as if they were guaranteed
96 to be aligned...if they aren't, too bad for the user!
eadf0fe6 97 Like -dalign in Sun cc. */
b1fc14e5
RS
98#define TARGET_HOPE_ALIGN (target_flags & 16)
99
0be8e859
JW
100/* Nonzero means make sure all doubles are on 8-byte boundaries.
101 This option results in a calling convention that is incompatible with
102 every other sparc compiler in the world, and thus should only ever be
103 used for experimenting. Also, varargs won't work with it, but it doesn't
104 seem worth trying to fix. */
b1fc14e5 105#define TARGET_FORCE_ALIGN (target_flags & 32)
1bb87f28 106
885d8175
JW
107/* Nonzero means that we should generate code for a v8 sparc. */
108#define TARGET_V8 (target_flags & 64)
109
110/* Nonzero means that we should generate code for a sparclite. */
111#define TARGET_SPARCLITE (target_flags & 128)
112
1bb87f28
JW
113/* Macro to define tables used to set the flags.
114 This is a list in braces of pairs in braces,
115 each pair being { "NAME", VALUE }
116 where VALUE is the bits to set or minus the bits to clear.
117 An empty string NAME is used to identify the default VALUE. */
118
119#define TARGET_SWITCHES \
120 { {"fpu", 1}, \
121 {"soft-float", -1}, \
122 {"epilogue", 2}, \
123 {"no-epilogue", -2}, \
b1fc14e5
RS
124 {"hope-align", 16}, \
125 {"force-align", 48}, \
885d8175
JW
126 {"v8", 64}, \
127 {"no-v8", -64}, \
128 {"sparclite", 128}, \
129 {"no-sparclite", -128}, \
b1fc14e5 130 { "", TARGET_DEFAULT}}
1bb87f28
JW
131
132#define TARGET_DEFAULT 3
133\f
134/* target machine storage layout */
135
136/* Define this if most significant bit is lowest numbered
137 in instructions that operate on numbered bit-fields. */
138#define BITS_BIG_ENDIAN 1
139
140/* Define this if most significant byte of a word is the lowest numbered. */
141/* This is true on the SPARC. */
142#define BYTES_BIG_ENDIAN 1
143
144/* Define this if most significant word of a multiword number is the lowest
145 numbered. */
146/* Doubles are stored in memory with the high order word first. This
147 matters when cross-compiling. */
148#define WORDS_BIG_ENDIAN 1
149
b4ac57ab 150/* number of bits in an addressable storage unit */
1bb87f28
JW
151#define BITS_PER_UNIT 8
152
153/* Width in bits of a "word", which is the contents of a machine register.
154 Note that this is not necessarily the width of data type `int';
155 if using 16-bit ints on a 68000, this would still be 32.
156 But on a machine with 16-bit registers, this would be 16. */
157#define BITS_PER_WORD 32
158#define MAX_BITS_PER_WORD 32
159
160/* Width of a word, in units (bytes). */
161#define UNITS_PER_WORD 4
162
163/* Width in bits of a pointer.
164 See also the macro `Pmode' defined below. */
165#define POINTER_SIZE 32
166
167/* Allocation boundary (in *bits*) for storing arguments in argument list. */
168#define PARM_BOUNDARY 32
169
170/* Boundary (in *bits*) on which stack pointer should be aligned. */
171#define STACK_BOUNDARY 64
172
173/* Allocation boundary (in *bits*) for the code of a function. */
174#define FUNCTION_BOUNDARY 32
175
176/* Alignment of field after `int : 0' in a structure. */
177#define EMPTY_FIELD_BOUNDARY 32
178
179/* Every structure's size must be a multiple of this. */
180#define STRUCTURE_SIZE_BOUNDARY 8
181
182/* A bitfield declared as `int' forces `int' alignment for the struct. */
183#define PCC_BITFIELD_TYPE_MATTERS 1
184
185/* No data type wants to be aligned rounder than this. */
186#define BIGGEST_ALIGNMENT 64
187
188/* Make strings word-aligned so strcpy from constants will be faster. */
189#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
190 (TREE_CODE (EXP) == STRING_CST \
191 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
192
193/* Make arrays of chars word-aligned for the same reasons. */
194#define DATA_ALIGNMENT(TYPE, ALIGN) \
195 (TREE_CODE (TYPE) == ARRAY_TYPE \
196 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
197 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
198
b4ac57ab 199/* Set this nonzero if move instructions will actually fail to work
1bb87f28 200 when given unaligned data. */
b4ac57ab 201#define STRICT_ALIGNMENT 1
1bb87f28
JW
202
203/* Things that must be doubleword aligned cannot go in the text section,
204 because the linker fails to align the text section enough!
205 Put them in the data section. */
206#define MAX_TEXT_ALIGN 32
207
208#define SELECT_SECTION(T,RELOC) \
209{ \
210 if (TREE_CODE (T) == VAR_DECL) \
211 { \
212 if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \
213 && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \
214 && ! (flag_pic && (RELOC))) \
215 text_section (); \
216 else \
217 data_section (); \
218 } \
219 else if (TREE_CODE (T) == CONSTRUCTOR) \
220 { \
221 if (flag_pic != 0 && (RELOC) != 0) \
222 data_section (); \
223 } \
224 else if (*tree_code_type[(int) TREE_CODE (T)] == 'c') \
225 { \
226 if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \
227 || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN) \
228 data_section (); \
229 else \
230 text_section (); \
231 } \
232}
233
234/* Use text section for a constant
235 unless we need more alignment than that offers. */
236#define SELECT_RTX_SECTION(MODE, X) \
237{ \
238 if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \
239 && ! (flag_pic && symbolic_operand (X))) \
240 text_section (); \
241 else \
242 data_section (); \
243}
244\f
245/* Standard register usage. */
246
247/* Number of actual hardware registers.
248 The hardware registers are assigned numbers for the compiler
249 from 0 to just below FIRST_PSEUDO_REGISTER.
250 All registers that the compiler knows about must be given numbers,
251 even those that are not normally considered general registers.
252
253 SPARC has 32 integer registers and 32 floating point registers. */
254
255#define FIRST_PSEUDO_REGISTER 64
256
257/* 1 for registers that have pervasive standard uses
258 and are not available for the register allocator.
259 0 is used for the condition code and not to represent %g0, which is
260 hardwired to 0, so reg 0 is *not* fixed.
d9ca49d5
JW
261 g1 through g4 are free to use as temporaries.
262 g5 through g7 are reserved for the operating system. */
1bb87f28 263#define FIXED_REGISTERS \
d9ca49d5 264 {0, 0, 0, 0, 0, 1, 1, 1, \
1bb87f28
JW
265 0, 0, 0, 0, 0, 0, 1, 0, \
266 0, 0, 0, 0, 0, 0, 0, 0, \
267 0, 0, 0, 0, 0, 0, 1, 1, \
268 \
269 0, 0, 0, 0, 0, 0, 0, 0, \
270 0, 0, 0, 0, 0, 0, 0, 0, \
271 0, 0, 0, 0, 0, 0, 0, 0, \
272 0, 0, 0, 0, 0, 0, 0, 0}
273
274/* 1 for registers not available across function calls.
275 These must include the FIXED_REGISTERS and also any
276 registers that can be used without being saved.
277 The latter must include the registers where values are returned
278 and the register where structure-value addresses are passed.
279 Aside from that, you can include as many other registers as you like. */
280#define CALL_USED_REGISTERS \
281 {1, 1, 1, 1, 1, 1, 1, 1, \
282 1, 1, 1, 1, 1, 1, 1, 1, \
283 0, 0, 0, 0, 0, 0, 0, 0, \
284 0, 0, 0, 0, 0, 0, 1, 1, \
285 \
286 1, 1, 1, 1, 1, 1, 1, 1, \
287 1, 1, 1, 1, 1, 1, 1, 1, \
288 1, 1, 1, 1, 1, 1, 1, 1, \
289 1, 1, 1, 1, 1, 1, 1, 1}
290
291/* Return number of consecutive hard regs needed starting at reg REGNO
292 to hold something of mode MODE.
293 This is ordinarily the length in words of a value of mode MODE
294 but can be less for certain modes in special long registers.
295
296 On SPARC, ordinary registers hold 32 bits worth;
297 this means both integer and floating point registers.
298
299 We use vectors to keep this information about registers. */
300
301/* How many hard registers it takes to make a register of this mode. */
302extern int hard_regno_nregs[];
303
304#define HARD_REGNO_NREGS(REGNO, MODE) \
305 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
306
307/* Value is 1 if register/mode pair is acceptable on sparc. */
308extern int hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
309
310/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
311 On SPARC, the cpu registers can hold any mode but the float registers
312 can only hold SFmode or DFmode. See sparc.c for how we
313 initialize this. */
314#define HARD_REGNO_MODE_OK(REGNO, MODE) \
315 ((hard_regno_mode_ok[REGNO] & (1<<(int)(MODE))) != 0)
316
317/* Value is 1 if it is a good idea to tie two pseudo registers
318 when one has mode MODE1 and one has mode MODE2.
319 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
320 for any hard reg, then this must be 0 for correct output. */
321#define MODES_TIEABLE_P(MODE1, MODE2) \
322 ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
323
324/* Specify the registers used for certain standard purposes.
325 The values of these macros are register numbers. */
326
327/* SPARC pc isn't overloaded on a register that the compiler knows about. */
328/* #define PC_REGNUM */
329
330/* Register to use for pushing function arguments. */
331#define STACK_POINTER_REGNUM 14
332
333/* Actual top-of-stack address is 92 greater than the contents
334 of the stack pointer register. 92 = 68 + 24. 64 bytes reserving space
335 for the ins and local registers, 4 byte for structure return address, and
336 24 bytes for the 6 register parameters. */
337#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)
338
339/* Base register for access to local variables of the function. */
340#define FRAME_POINTER_REGNUM 30
341
342#if 0
343/* Register that is used for the return address. */
344#define RETURN_ADDR_REGNUM 15
345#endif
346
347/* Value should be nonzero if functions must have frame pointers.
348 Zero means the frame pointer need not be set up (and parms
349 may be accessed via the stack pointer) in functions that seem suitable.
350 This is computed in `reload', in reload1.c.
351
352 Used in flow.c, global-alloc.c, and reload1.c. */
353extern int leaf_function;
354
355#define FRAME_POINTER_REQUIRED \
a72cb8ec 356 (! (leaf_function_p () && only_leaf_regs_used ()))
1bb87f28
JW
357
358/* C statement to store the difference between the frame pointer
359 and the stack pointer values immediately after the function prologue.
360
361 Note, we always pretend that this is a leaf function because if
362 it's not, there's no point in trying to eliminate the
363 frame pointer. If it is a leaf function, we guessed right! */
364#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
365 do { (VAR) = compute_frame_size (get_frame_size (), 1); } while (0)
366
367/* Base register for access to arguments of the function. */
368#define ARG_POINTER_REGNUM 30
369
370/* Register in which static-chain is passed to a function. */
371/* ??? */
372#define STATIC_CHAIN_REGNUM 1
373
374/* Register which holds offset table for position-independent
375 data references. */
376
377#define PIC_OFFSET_TABLE_REGNUM 23
378
379#define INITIALIZE_PIC initialize_pic ()
380#define FINALIZE_PIC finalize_pic ()
381
d9ca49d5
JW
382/* Sparc ABI says that quad-precision floats and all structures are returned
383 in memory. */
384#define RETURN_IN_MEMORY(TYPE) \
385 (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE \
386 || TYPE_MODE (TYPE) == TFmode)
387
1bb87f28
JW
388/* Functions which return large structures get the address
389 to place the wanted value at offset 64 from the frame.
390 Must reserve 64 bytes for the in and local registers. */
391/* Used only in other #defines in this file. */
392#define STRUCT_VALUE_OFFSET 64
393
394#define STRUCT_VALUE \
395 gen_rtx (MEM, Pmode, \
396 gen_rtx (PLUS, Pmode, stack_pointer_rtx, \
397 gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET)))
398#define STRUCT_VALUE_INCOMING \
399 gen_rtx (MEM, Pmode, \
400 gen_rtx (PLUS, Pmode, frame_pointer_rtx, \
401 gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET)))
402\f
403/* Define the classes of registers for register constraints in the
404 machine description. Also define ranges of constants.
405
406 One of the classes must always be named ALL_REGS and include all hard regs.
407 If there is more than one class, another class must be named NO_REGS
408 and contain no registers.
409
410 The name GENERAL_REGS must be the name of a class (or an alias for
411 another name such as ALL_REGS). This is the class of registers
412 that is allowed by "g" or "r" in a register constraint.
413 Also, registers outside this class are allocated only when
414 instructions express preferences for them.
415
416 The classes must be numbered in nondecreasing order; that is,
417 a larger-numbered class must never be contained completely
418 in a smaller-numbered class.
419
420 For any two classes, it is very desirable that there be another
421 class that represents their union. */
422
423/* The SPARC has two kinds of registers, general and floating point. */
424
425enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
426
427#define N_REG_CLASSES (int) LIM_REG_CLASSES
428
429/* Give names of register classes as strings for dump file. */
430
431#define REG_CLASS_NAMES \
432 {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
433
434/* Define which registers fit in which classes.
435 This is an initializer for a vector of HARD_REG_SET
436 of length N_REG_CLASSES. */
437
438#if 0 && defined (__GNUC__)
439#define REG_CLASS_CONTENTS {0LL, 0xfffffffeLL, 0xffffffff00000000LL, 0xfffffffffffffffeLL}
440#else
441#define REG_CLASS_CONTENTS {{0, 0}, {-2, 0}, {0, -1}, {-2, -1}}
442#endif
443
444/* The same information, inverted:
445 Return the class number of the smallest class containing
446 reg number REGNO. This could be a conditional expression
447 or could index an array. */
448
449#define REGNO_REG_CLASS(REGNO) \
450 ((REGNO) >= 32 ? FP_REGS : (REGNO) == 0 ? NO_REGS : GENERAL_REGS)
451
452/* This is the order in which to allocate registers
453 normally. */
454#define REG_ALLOC_ORDER \
b4ac57ab
RS
455{ 8, 9, 10, 11, 12, 13, 2, 3, \
456 15, 16, 17, 18, 19, 20, 21, 22, \
457 23, 24, 25, 26, 27, 28, 29, 31, \
1bb87f28
JW
458 32, 33, 34, 35, 36, 37, 38, 39, \
459 40, 41, 42, 43, 44, 45, 46, 47, \
460 48, 49, 50, 51, 52, 53, 54, 55, \
461 56, 57, 58, 59, 60, 61, 62, 63, \
4b69d2a3 462 1, 4, 5, 6, 7, 0, 14, 30}
1bb87f28
JW
463
464/* This is the order in which to allocate registers for
465 leaf functions. If all registers can fit in the "i" registers,
466 then we have the possibility of having a leaf function. */
467#define REG_LEAF_ALLOC_ORDER \
468{ 2, 3, 24, 25, 26, 27, 28, 29, \
469 15, 8, 9, 10, 11, 12, 13, \
470 16, 17, 18, 19, 20, 21, 22, 23, \
471 32, 33, 34, 35, 36, 37, 38, 39, \
472 40, 41, 42, 43, 44, 45, 46, 47, \
473 48, 49, 50, 51, 52, 53, 54, 55, \
474 56, 57, 58, 59, 60, 61, 62, 63, \
4b69d2a3 475 1, 4, 5, 6, 7, 0, 14, 30, 31}
1bb87f28
JW
476
477#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
478
479#define LEAF_REGISTERS \
480{ 1, 1, 1, 1, 1, 1, 1, 1, \
481 0, 0, 0, 0, 0, 0, 1, 0, \
482 0, 0, 0, 0, 0, 0, 0, 0, \
483 1, 1, 1, 1, 1, 1, 0, 1, \
484 1, 1, 1, 1, 1, 1, 1, 1, \
485 1, 1, 1, 1, 1, 1, 1, 1, \
486 1, 1, 1, 1, 1, 1, 1, 1, \
4b69d2a3 487 1, 1, 1, 1, 1, 1, 1, 1}
1bb87f28
JW
488
489extern char leaf_reg_remap[];
490#define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO])
491extern char leaf_reg_backmap[];
492#define LEAF_REG_BACKMAP(REGNO) (leaf_reg_backmap[REGNO])
493
494#define REG_USED_SO_FAR(REGNO) \
495 ((REGNO) >= 24 && (REGNO) < 30 \
496 ? (regs_ever_live[24] \
497 || regs_ever_live[25] \
498 || regs_ever_live[26] \
499 || regs_ever_live[27] \
500 || regs_ever_live[28] \
501 || regs_ever_live[29]) : 0)
502
503/* The class value for index registers, and the one for base regs. */
504#define INDEX_REG_CLASS GENERAL_REGS
505#define BASE_REG_CLASS GENERAL_REGS
506
507/* Get reg_class from a letter such as appears in the machine description. */
508
509#define REG_CLASS_FROM_LETTER(C) \
510 ((C) == 'f' ? FP_REGS : (C) == 'r' ? GENERAL_REGS : NO_REGS)
511
512/* The letters I, J, K, L and M in a register constraint string
513 can be used to stand for particular ranges of immediate operands.
514 This macro defines what the ranges are.
515 C is the letter, and VALUE is a constant value.
516 Return 1 if VALUE is in the range specified by C.
517
518 For SPARC, `I' is used for the range of constants an insn
519 can actually contain.
520 `J' is used for the range which is just zero (since that is R0).
521 `K' is used for the 5-bit operand of a compare insns. */
522
523#define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x1000) < 0x2000)
524
525#define CONST_OK_FOR_LETTER_P(VALUE, C) \
526 ((C) == 'I' ? (unsigned) ((VALUE) + 0x1000) < 0x2000 \
527 : (C) == 'J' ? (VALUE) == 0 \
528 : (C) == 'K' ? ((VALUE) & 0x3ff) == 0 \
529 : 0)
530
531/* Similar, but for floating constants, and defining letters G and H.
532 Here VALUE is the CONST_DOUBLE rtx itself. */
533
534#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
535 ((C) == 'G' ? CONST_DOUBLE_HIGH (VALUE) == 0 \
536 && CONST_DOUBLE_LOW (VALUE) == 0 \
537 : (C) == 'H' ? arith_double_operand (VALUE, DImode) \
538 : 0)
539
540/* Given an rtx X being reloaded into a reg required to be
541 in class CLASS, return the class of reg to actually use.
542 In general this is just CLASS; but on some machines
543 in some cases it is preferable to use a more restrictive class. */
2b9a9aea
JW
544/* We can't load constants into FP registers. We can't load any FP constant
545 if an 'E' constraint fails to match it. */
546#define PREFERRED_RELOAD_CLASS(X,CLASS) \
547 (CONSTANT_P (X) \
548 && ((CLASS) == FP_REGS \
549 || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
550 && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT \
551 || HOST_BITS_PER_INT != BITS_PER_WORD))) \
552 ? NO_REGS : (CLASS))
1bb87f28
JW
553
554/* Return the register class of a scratch register needed to load IN into
555 a register of class CLASS in MODE.
556
557 On the SPARC, when PIC, we need a temporary when loading some addresses
558 into a register. */
559
560#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \
561 (flag_pic && pic_address_needs_scratch (IN) ? GENERAL_REGS : NO_REGS)
562
563/* Return the maximum number of consecutive registers
564 needed to represent mode MODE in a register of class CLASS. */
565/* On SPARC, this is the size of MODE in words. */
566#define CLASS_MAX_NREGS(CLASS, MODE) \
567 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
568\f
569/* Stack layout; function entry, exit and calling. */
570
571/* Define the number of register that can hold parameters.
572 These two macros are used only in other macro definitions below. */
573#define NPARM_REGS 6
574
575/* Define this if pushing a word on the stack
576 makes the stack pointer a smaller address. */
577#define STACK_GROWS_DOWNWARD
578
579/* Define this if the nominal address of the stack frame
580 is at the high-address end of the local variables;
581 that is, each additional local variable allocated
582 goes at a more negative offset in the frame. */
583#define FRAME_GROWS_DOWNWARD
584
585/* Offset within stack frame to start allocating local variables at.
586 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
587 first local allocated. Otherwise, it is the offset to the BEGINNING
588 of the first local allocated. */
589#define STARTING_FRAME_OFFSET (-16)
590
591/* If we generate an insn to push BYTES bytes,
592 this says how many the stack pointer really advances by.
593 On SPARC, don't define this because there are no push insns. */
594/* #define PUSH_ROUNDING(BYTES) */
595
596/* Offset of first parameter from the argument pointer register value.
597 This is 64 for the ins and locals, plus 4 for the struct-return reg
0be8e859
JW
598 even if this function isn't going to use it.
599 If TARGET_FORCE_ALIGN, we must reserve 4 more bytes to ensure that the
600 stack remains aligned. */
601#define FIRST_PARM_OFFSET(FNDECL) \
602 (STRUCT_VALUE_OFFSET + UNITS_PER_WORD + (TARGET_FORCE_ALIGN ? 4 : 0))
1bb87f28
JW
603
604/* When a parameter is passed in a register, stack space is still
605 allocated for it. */
606#define REG_PARM_STACK_SPACE(DECL) (NPARM_REGS * UNITS_PER_WORD)
607
608/* Keep the stack pointer constant throughout the function.
b4ac57ab 609 This is both an optimization and a necessity: longjmp
1bb87f28
JW
610 doesn't behave itself when the stack pointer moves within
611 the function! */
612#define ACCUMULATE_OUTGOING_ARGS
613
614/* Value is the number of bytes of arguments automatically
615 popped when returning from a subroutine call.
616 FUNTYPE is the data type of the function (as a tree),
617 or for a library call it is an identifier node for the subroutine name.
618 SIZE is the number of bytes of arguments passed on the stack. */
619
620#define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
621
622/* Some subroutine macros specific to this machine. */
623#define BASE_RETURN_VALUE_REG(MODE) \
624 ((MODE) == SFmode || (MODE) == DFmode ? 32 : 8)
625#define BASE_OUTGOING_VALUE_REG(MODE) \
626 ((MODE) == SFmode || (MODE) == DFmode ? 32 : 24)
627#define BASE_PASSING_ARG_REG(MODE) (8)
628#define BASE_INCOMING_ARG_REG(MODE) (24)
629
630/* Define how to find the value returned by a function.
631 VALTYPE is the data type of the value (as a tree).
632 If the precise function being called is known, FUNC is its FUNCTION_DECL;
633 otherwise, FUNC is 0. */
634
635/* On SPARC the value is found in the first "output" register. */
636
637#define FUNCTION_VALUE(VALTYPE, FUNC) \
638 gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG (TYPE_MODE (VALTYPE)))
639
640/* But the called function leaves it in the first "input" register. */
641
642#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
643 gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_OUTGOING_VALUE_REG (TYPE_MODE (VALTYPE)))
644
645/* Define how to find the value returned by a library function
646 assuming the value has mode MODE. */
647
648#define LIBCALL_VALUE(MODE) \
649 gen_rtx (REG, MODE, BASE_RETURN_VALUE_REG (MODE))
650
651/* 1 if N is a possible register number for a function value
652 as seen by the caller.
653 On SPARC, the first "output" reg is used for integer values,
654 and the first floating point register is used for floating point values. */
655
656#define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32)
657
658/* 1 if N is a possible register number for function argument passing.
659 On SPARC, these are the "output" registers. */
660
661#define FUNCTION_ARG_REGNO_P(N) ((N) < 14 && (N) > 7)
662\f
663/* Define a data type for recording info about an argument list
664 during the scan of that argument list. This data type should
665 hold all necessary information about the function itself
666 and about the args processed so far, enough to enable macros
667 such as FUNCTION_ARG to determine where the next arg should go.
668
669 On SPARC, this is a single integer, which is a number of words
670 of arguments scanned so far (including the invisible argument,
671 if any, which holds the structure-value-address).
672 Thus 7 or more means all following args should go on the stack. */
673
674#define CUMULATIVE_ARGS int
675
676#define ROUND_ADVANCE(SIZE) \
b1fc14e5
RS
677 ((SIZE + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
678
679/* Round a register number up to a proper boundary for an arg of mode MODE.
680 Note that we need an odd/even pair for a two-word arg,
681 since that will become 8-byte aligned when stored in memory. */
682#define ROUND_REG(X, MODE) \
683 (TARGET_FORCE_ALIGN && GET_MODE_UNIT_SIZE ((MODE)) > 4 \
684 ? ((X) + ! ((X) & 1)) : (X))
1bb87f28
JW
685
686/* Initialize a variable CUM of type CUMULATIVE_ARGS
687 for a call to a function whose data type is FNTYPE.
688 For a library call, FNTYPE is 0.
689
690 On SPARC, the offset always starts at 0: the first parm reg is always
691 the same reg. */
692
693#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) ((CUM) = 0)
694
695/* Update the data in CUM to advance over an argument
696 of mode MODE and data type TYPE.
697 (TYPE is null for libcalls where that information may not be available.) */
698
699#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
b1fc14e5
RS
700 ((CUM) = (ROUND_REG ((CUM), (MODE)) \
701 + ((MODE) != BLKmode \
702 ? ROUND_ADVANCE (GET_MODE_SIZE (MODE)) \
703 : ROUND_ADVANCE (int_size_in_bytes (TYPE)))))
1bb87f28
JW
704
705/* Determine where to put an argument to a function.
706 Value is zero to push the argument on the stack,
707 or a hard register in which to store the argument.
708
709 MODE is the argument's machine mode.
710 TYPE is the data type of the argument (as a tree).
711 This is null for libcalls where that information may
712 not be available.
713 CUM is a variable of type CUMULATIVE_ARGS which gives info about
714 the preceding args and about the function being called.
715 NAMED is nonzero if this argument is a named parameter
716 (otherwise it is an extra parameter matching an ellipsis). */
717
718/* On SPARC the first six args are normally in registers
719 and the rest are pushed. Any arg that starts within the first 6 words
720 is at least partially passed in a register unless its data type forbids. */
721
722#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
b1fc14e5 723(ROUND_REG ((CUM), (MODE)) < NPARM_REGS \
1bb87f28 724 && ((TYPE)==0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
b1fc14e5
RS
725 && ((TYPE)==0 || (MODE) != BLKmode \
726 || (TYPE_ALIGN ((TYPE)) % PARM_BOUNDARY == 0)) \
727 ? gen_rtx (REG, (MODE), \
728 (BASE_PASSING_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE)))) \
729 : 0)
1bb87f28
JW
730
731/* Define where a function finds its arguments.
732 This is different from FUNCTION_ARG because of register windows. */
733
734#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
b1fc14e5 735(ROUND_REG ((CUM), (MODE)) < NPARM_REGS \
1bb87f28 736 && ((TYPE)==0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
b1fc14e5
RS
737 && ((TYPE)==0 || (MODE) != BLKmode \
738 || (TYPE_ALIGN ((TYPE)) % PARM_BOUNDARY == 0)) \
739 ? gen_rtx (REG, (MODE), \
740 (BASE_INCOMING_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE)))) \
741 : 0)
1bb87f28
JW
742
743/* For an arg passed partly in registers and partly in memory,
744 this is the number of registers used.
745 For args passed entirely in registers or entirely in memory, zero.
746 Any arg that starts in the first 6 regs but won't entirely fit in them
747 needs partial registers on the Sparc. */
748
749#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
b1fc14e5 750 ((ROUND_REG ((CUM), (MODE)) < NPARM_REGS \
1bb87f28 751 && ((TYPE)==0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
b1fc14e5
RS
752 && ((TYPE)==0 || (MODE) != BLKmode \
753 || (TYPE_ALIGN ((TYPE)) % PARM_BOUNDARY == 0)) \
754 && (ROUND_REG ((CUM), (MODE)) \
1bb87f28
JW
755 + ((MODE) == BLKmode \
756 ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
b1fc14e5
RS
757 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))) - NPARM_REGS > 0) \
758 ? (NPARM_REGS - ROUND_REG ((CUM), (MODE))) \
1bb87f28
JW
759 : 0)
760
d9ca49d5
JW
761/* The SPARC ABI stipulates passing struct arguments (of any size) and
762 quad-precision floats by invisible reference. */
1bb87f28 763#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
d9ca49d5
JW
764 ((TYPE && (TREE_CODE (TYPE) == RECORD_TYPE \
765 || TREE_CODE (TYPE) == UNION_TYPE)) \
766 || (MODE == TFmode))
1bb87f28 767
b1fc14e5
RS
768/* If defined, a C expression that gives the alignment boundary, in
769 bits, of an argument with the specified mode and type. If it is
770 not defined, `PARM_BOUNDARY' is used for all arguments.
771
772 This definition does nothing special unless TARGET_FORCE_ALIGN;
773 in that case, it aligns each arg to the natural boundary. */
774
775#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
776 (! TARGET_FORCE_ALIGN \
777 ? PARM_BOUNDARY \
778 : (((TYPE) != 0) \
779 ? (TYPE_ALIGN (TYPE) <= PARM_BOUNDARY \
780 ? PARM_BOUNDARY \
781 : TYPE_ALIGN (TYPE)) \
782 : (GET_MODE_ALIGNMENT (MODE) <= PARM_BOUNDARY \
783 ? PARM_BOUNDARY \
784 : GET_MODE_ALIGNMENT (MODE))))
785
1bb87f28
JW
786/* Define the information needed to generate branch and scc insns. This is
787 stored from the compare operation. Note that we can't use "rtx" here
788 since it hasn't been defined! */
789
790extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1;
791
792/* Define the function that build the compare insn for scc and bcc. */
793
794extern struct rtx_def *gen_compare_reg ();
795\f
4b69d2a3
RS
796/* Generate the special assembly code needed to tell the assembler whatever
797 it might need to know about the return value of a function.
798
799 For Sparc assemblers, we need to output a .proc pseudo-op which conveys
800 information to the assembler relating to peephole optimization (done in
801 the assembler). */
802
803#define ASM_DECLARE_RESULT(FILE, RESULT) \
804 fprintf ((FILE), "\t.proc\t0%o\n", sparc_type_code (TREE_TYPE (RESULT)))
805
1bb87f28
JW
806/* Output the label for a function definition. */
807
4b69d2a3
RS
808#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
809do { \
810 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
811 ASM_OUTPUT_LABEL (FILE, NAME); \
812} while (0)
1bb87f28
JW
813
814/* Two views of the size of the current frame. */
815extern int actual_fsize;
816extern int apparent_fsize;
817
818/* This macro generates the assembly code for function entry.
819 FILE is a stdio stream to output the code to.
820 SIZE is an int: how many units of temporary storage to allocate.
821 Refer to the array `regs_ever_live' to determine which registers
822 to save; `regs_ever_live[I]' is nonzero if register number I
823 is ever used in the function. This macro is responsible for
824 knowing which registers should not be saved even if used. */
825
826/* On SPARC, move-double insns between fpu and cpu need an 8-byte block
827 of memory. If any fpu reg is used in the function, we allocate
828 such a block here, at the bottom of the frame, just in case it's needed.
829
830 If this function is a leaf procedure, then we may choose not
831 to do a "save" insn. The decision about whether or not
832 to do this is made in regclass.c. */
833
834#define FUNCTION_PROLOGUE(FILE, SIZE) \
835 output_function_prologue (FILE, SIZE, leaf_function)
836
837/* Output assembler code to FILE to increment profiler label # LABELNO
838 for profiling a function entry. */
839
840#define FUNCTION_PROFILER(FILE, LABELNO) \
841 fprintf (FILE, "\tsethi %%hi(LP%d),%%o0\n\tcall mcount\n\tor %%lo(LP%d),%%o0,%%o0\n", \
842 (LABELNO), (LABELNO))
843
844/* Output assembler code to FILE to initialize this source file's
845 basic block profiling info, if that has not already been done. */
846
847#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
848 fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tld [%%lo(LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(LPBX0),%%o0\n\tcall ___bb_init_func\n\tnop\nLPY%d:\n", \
849 (LABELNO), (LABELNO))
850
851/* Output assembler code to FILE to increment the entry-count for
852 the BLOCKNO'th basic block in this source file. */
853
854#define BLOCK_PROFILER(FILE, BLOCKNO) \
855{ \
856 int blockn = (BLOCKNO); \
857 fprintf (FILE, "\tsethi %%hi(LPBX2+%d),%%g1\n\tld [%%lo(LPBX2+%d)+%%g1],%%g2\n\
858\tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(LPBX2+%d)+%%g1]\n", \
859 4 * blockn, 4 * blockn, 4 * blockn); \
860}
861
862/* Output rtl to increment the entry-count for the LABELNO'th instrumented
863 arc in this source file. */
864
865#define ARC_PROFILER(ARCNO, INSERT_AFTER) \
866 output_arc_profiler (ARCNO, INSERT_AFTER)
867
868/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
869 the stack pointer does not matter. The value is tested only in
870 functions that have frame pointers.
871 No definition is equivalent to always zero. */
872
873extern int current_function_calls_alloca;
874extern int current_function_outgoing_args_size;
875
876#define EXIT_IGNORE_STACK \
877 (get_frame_size () != 0 \
878 || current_function_calls_alloca || current_function_outgoing_args_size)
879
880/* This macro generates the assembly code for function exit,
881 on machines that need it. If FUNCTION_EPILOGUE is not defined
882 then individual return instructions are generated for each
883 return statement. Args are same as for FUNCTION_PROLOGUE.
884
885 The function epilogue should not depend on the current stack pointer!
886 It should use the frame pointer only. This is mandatory because
887 of alloca; we also take advantage of it to omit stack adjustments
888 before returning. */
889
890/* This declaration is needed due to traditional/ANSI
891 incompatibilities which cannot be #ifdefed away
892 because they occur inside of macros. Sigh. */
893extern union tree_node *current_function_decl;
894
895#define FUNCTION_EPILOGUE(FILE, SIZE) \
ef8200df 896 output_function_epilogue (FILE, SIZE, leaf_function)
1bb87f28
JW
897
898#define DELAY_SLOTS_FOR_EPILOGUE 1
899#define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \
900 eligible_for_epilogue_delay (trial, slots_filled)
901
902/* Output assembler code for a block containing the constant parts
903 of a trampoline, leaving space for the variable parts. */
904
905/* On the sparc, the trampoline contains five instructions:
906 sethi #TOP_OF_FUNCTION,%g2
907 or #BOTTOM_OF_FUNCTION,%g2,%g2
908 sethi #TOP_OF_STATIC,%g1
909 jmp g2
910 or #BOTTOM_OF_STATIC,%g1,%g1 */
911#define TRAMPOLINE_TEMPLATE(FILE) \
912{ \
913 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
914 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
915 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
916 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x81C08000)); \
917 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
918}
919
920/* Length in units of the trampoline for entering a nested function. */
921
922#define TRAMPOLINE_SIZE 20
923
924/* Emit RTL insns to initialize the variable parts of a trampoline.
925 FNADDR is an RTX for the address of the function's pure code.
926 CXT is an RTX for the static chain value for the function.
927
928 This takes 16 insns: 2 shifts & 2 ands (to split up addresses), 4 sethi
929 (to load in opcodes), 4 iors (to merge address and opcodes), and 4 writes
930 (to store insns). This is a bit excessive. Perhaps a different
931 mechanism would be better here. */
932
933#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
934{ \
935 rtx high_cxt = expand_shift (RSHIFT_EXPR, SImode, CXT, \
936 size_int (10), 0, 1); \
937 rtx high_fn = expand_shift (RSHIFT_EXPR, SImode, FNADDR, \
938 size_int (10), 0, 1); \
939 rtx low_cxt = expand_and (CXT, gen_rtx (CONST_INT, VOIDmode, 0x3ff), 0); \
940 rtx low_fn = expand_and (FNADDR, gen_rtx (CONST_INT, VOIDmode, 0x3ff), 0); \
941 rtx g1_sethi = gen_rtx (HIGH, SImode, \
942 gen_rtx (CONST_INT, VOIDmode, 0x03000000)); \
943 rtx g2_sethi = gen_rtx (HIGH, SImode, \
944 gen_rtx (CONST_INT, VOIDmode, 0x05000000)); \
945 rtx g1_ori = gen_rtx (HIGH, SImode, \
946 gen_rtx (CONST_INT, VOIDmode, 0x82106000)); \
947 rtx g2_ori = gen_rtx (HIGH, SImode, \
948 gen_rtx (CONST_INT, VOIDmode, 0x8410A000)); \
949 rtx tem = gen_reg_rtx (SImode); \
950 emit_move_insn (tem, g2_sethi); \
951 emit_insn (gen_iorsi3 (high_fn, high_fn, tem)); \
952 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 0)), high_fn);\
953 emit_move_insn (tem, g2_ori); \
954 emit_insn (gen_iorsi3 (low_fn, low_fn, tem)); \
955 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 4)), low_fn);\
956 emit_move_insn (tem, g1_sethi); \
957 emit_insn (gen_iorsi3 (high_cxt, high_cxt, tem)); \
958 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 8)), high_cxt);\
959 emit_move_insn (tem, g1_ori); \
960 emit_insn (gen_iorsi3 (low_cxt, low_cxt, tem)); \
961 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), low_cxt);\
962}
963
964/* Emit code for a call to builtin_saveregs. We must emit USE insns which
965 reference the 6 input registers. Ordinarily they are not call used
966 registers, but they are for _builtin_saveregs, so we must make this
967 explicit. */
968
969#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) \
970 (emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, TImode, 24))), \
971 emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, DImode, 28))), \
972 expand_call (exp, target, ignore))
973\f
974/* Addressing modes, and classification of registers for them. */
975
976/* #define HAVE_POST_INCREMENT */
977/* #define HAVE_POST_DECREMENT */
978
979/* #define HAVE_PRE_DECREMENT */
980/* #define HAVE_PRE_INCREMENT */
981
982/* Macros to check register numbers against specific register classes. */
983
984/* These assume that REGNO is a hard or pseudo reg number.
985 They give nonzero only if REGNO is a hard reg of the suitable class
986 or a pseudo reg currently allocated to a suitable hard reg.
987 Since they use reg_renumber, they are safe only once reg_renumber
988 has been allocated, which happens in local-alloc.c. */
989
990#define REGNO_OK_FOR_INDEX_P(REGNO) \
991(((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32) && (REGNO) != 0)
992#define REGNO_OK_FOR_BASE_P(REGNO) \
993(((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32) && (REGNO) != 0)
994#define REGNO_OK_FOR_FP_P(REGNO) \
995(((REGNO) ^ 0x20) < 32 \
996 || (((REGNO) != 0) && (unsigned) (reg_renumber[REGNO] ^ 0x20) < 32))
997
998/* Now macros that check whether X is a register and also,
999 strictly, whether it is in a specified class.
1000
1001 These macros are specific to the SPARC, and may be used only
1002 in code for printing assembler insns and in conditions for
1003 define_optimization. */
1004
1005/* 1 if X is an fp register. */
1006
1007#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1008\f
1009/* Maximum number of registers that can appear in a valid memory address. */
1010
1011#define MAX_REGS_PER_ADDRESS 2
1012
1013/* Recognize any constant value that is a valid address. */
1014
1015#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X))
1016
1017/* Nonzero if the constant value X is a legitimate general operand.
1018 Anything can be made to work except floating point constants. */
1019
1020#define LEGITIMATE_CONSTANT_P(X) \
1021 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode)
1022
1023/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1024 and check its validity for a certain class.
1025 We have two alternate definitions for each of them.
1026 The usual definition accepts all pseudo regs; the other rejects
1027 them unless they have been allocated suitable hard regs.
1028 The symbol REG_OK_STRICT causes the latter definition to be used.
1029
1030 Most source files want to accept pseudo regs in the hope that
1031 they will get allocated to the class that the insn wants them to be in.
1032 Source files for reload pass need to be strict.
1033 After reload, it makes no difference, since pseudo regs have
1034 been eliminated by then. */
1035
1036/* Optional extra constraints for this machine. Borrowed from romp.h.
1037
1038 For the SPARC, `Q' means that this is a memory operand but not a
1039 symbolic memory operand. Note that an unassigned pseudo register
1040 is such a memory operand. Needed because reload will generate
1041 these things in insns and then not re-recognize the insns, causing
1042 constrain_operands to fail.
1043
1044 `R' handles the LO_SUM which can be an address for `Q'.
1045
1046 `S' handles constraints for calls. */
1047
1048#ifndef REG_OK_STRICT
1049
1050/* Nonzero if X is a hard reg that can be used as an index
1051 or if it is a pseudo reg. */
1052#define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 32 && REGNO (X) != 0)
1053/* Nonzero if X is a hard reg that can be used as a base reg
1054 or if it is a pseudo reg. */
1055#define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 32 && REGNO (X) != 0)
1056
1057#define EXTRA_CONSTRAINT(OP, C) \
1058 ((C) == 'Q' ? \
1059 ((GET_CODE (OP) == MEM \
1060 && memory_address_p (GET_MODE (OP), XEXP (OP, 0)) \
1061 && ! symbolic_memory_operand (OP, VOIDmode))) \
1062 : ((C) == 'R' ? \
1063 (GET_CODE (OP) == LO_SUM \
1064 && GET_CODE (XEXP (OP, 0)) == REG \
1065 && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
1066 : ((C) == 'S' \
1067 ? CONSTANT_P (OP) || memory_address_p (Pmode, OP) : 0)))
1068
1069#else
1070
1071/* Nonzero if X is a hard reg that can be used as an index. */
1072#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1073/* Nonzero if X is a hard reg that can be used as a base reg. */
1074#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1075
1076#define EXTRA_CONSTRAINT(OP, C) \
1077 ((C) == 'Q' ? \
1078 (GET_CODE (OP) == REG ? \
1079 (REGNO (OP) >= FIRST_PSEUDO_REGISTER \
1080 && reg_renumber[REGNO (OP)] < 0) \
1081 : GET_CODE (OP) == MEM) \
1082 : ((C) == 'R' ? \
1083 (GET_CODE (OP) == LO_SUM \
1084 && GET_CODE (XEXP (OP, 0)) == REG \
1085 && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
1086 : ((C) == 'S' \
1087 ? (CONSTANT_P (OP) \
1088 || (GET_CODE (OP) == REG && reg_renumber[REGNO (OP)] > 0)\
1089 || strict_memory_address_p (Pmode, OP)) : 0)))
1090#endif
1091\f
1092/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1093 that is a valid memory address for an instruction.
1094 The MODE argument is the machine mode for the MEM expression
1095 that wants to use this address.
1096
1097 On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT
1098 ordinarily. This changes a bit when generating PIC.
1099
1100 If you change this, execute "rm explow.o recog.o reload.o". */
1101
bec2e359
JW
1102#define RTX_OK_FOR_BASE_P(X) \
1103 ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
1104 || (GET_CODE (X) == SUBREG \
1105 && GET_CODE (SUBREG_REG (X)) == REG \
1106 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
1107
1108#define RTX_OK_FOR_INDEX_P(X) \
1109 ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
1110 || (GET_CODE (X) == SUBREG \
1111 && GET_CODE (SUBREG_REG (X)) == REG \
1112 && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
1113
1114#define RTX_OK_FOR_OFFSET_P(X) \
1115 (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000)
1116
1bb87f28 1117#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
bec2e359
JW
1118{ if (RTX_OK_FOR_BASE_P (X)) \
1119 goto ADDR; \
1bb87f28
JW
1120 else if (GET_CODE (X) == PLUS) \
1121 { \
bec2e359
JW
1122 register rtx op0 = XEXP (X, 0); \
1123 register rtx op1 = XEXP (X, 1); \
1124 if (flag_pic && op0 == pic_offset_table_rtx) \
1bb87f28 1125 { \
bec2e359 1126 if (RTX_OK_FOR_BASE_P (op1)) \
1bb87f28
JW
1127 goto ADDR; \
1128 else if (flag_pic == 1 \
bec2e359
JW
1129 && GET_CODE (op1) != REG \
1130 && GET_CODE (op1) != LO_SUM \
1131 && GET_CODE (op1) != MEM) \
1bb87f28
JW
1132 goto ADDR; \
1133 } \
bec2e359 1134 else if (RTX_OK_FOR_BASE_P (op0)) \
1bb87f28 1135 { \
bec2e359
JW
1136 if (RTX_OK_FOR_INDEX_P (op1) \
1137 || RTX_OK_FOR_OFFSET_P (op1)) \
1bb87f28
JW
1138 goto ADDR; \
1139 } \
bec2e359 1140 else if (RTX_OK_FOR_BASE_P (op1)) \
1bb87f28 1141 { \
bec2e359
JW
1142 if (RTX_OK_FOR_INDEX_P (op0) \
1143 || RTX_OK_FOR_OFFSET_P (op0)) \
1bb87f28
JW
1144 goto ADDR; \
1145 } \
1146 } \
bec2e359
JW
1147 else if (GET_CODE (X) == LO_SUM) \
1148 { \
1149 register rtx op0 = XEXP (X, 0); \
1150 register rtx op1 = XEXP (X, 1); \
1151 if (RTX_OK_FOR_BASE_P (op0) \
1152 && CONSTANT_P (op1)) \
1153 goto ADDR; \
1154 } \
1bb87f28
JW
1155 else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \
1156 goto ADDR; \
1157}
1158\f
1159/* Try machine-dependent ways of modifying an illegitimate address
1160 to be legitimate. If we find one, return the new, valid address.
1161 This macro is used in only one place: `memory_address' in explow.c.
1162
1163 OLDX is the address as it was before break_out_memory_refs was called.
1164 In some cases it is useful to look at this to decide what needs to be done.
1165
1166 MODE and WIN are passed so that this macro can use
1167 GO_IF_LEGITIMATE_ADDRESS.
1168
1169 It is always safe for this macro to do nothing. It exists to recognize
1170 opportunities to optimize the output. */
1171
1172/* On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
1173extern struct rtx_def *legitimize_pic_address ();
1174#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1175{ rtx sparc_x = (X); \
1176 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
1177 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 1), \
1178 force_operand (XEXP (X, 0), 0)); \
1179 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
1180 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
1181 force_operand (XEXP (X, 1), 0)); \
1182 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
1183 (X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), 0),\
1184 XEXP (X, 1)); \
1185 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
1186 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
1187 force_operand (XEXP (X, 1), 0)); \
1188 if (sparc_x != (X) && memory_address_p (MODE, X)) \
1189 goto WIN; \
1190 if (flag_pic) (X) = legitimize_pic_address (X, MODE, 0, 0); \
1191 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
1192 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
1193 copy_to_mode_reg (Pmode, XEXP (X, 1))); \
1194 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
1195 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 1), \
1196 copy_to_mode_reg (Pmode, XEXP (X, 0))); \
1197 else if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
1198 || GET_CODE (X) == LABEL_REF) \
1199 (X) = gen_rtx (LO_SUM, Pmode, \
1200 copy_to_mode_reg (Pmode, gen_rtx (HIGH, Pmode, X)), X); \
1201 if (memory_address_p (MODE, X)) \
1202 goto WIN; }
1203
1204/* Go to LABEL if ADDR (a legitimate address expression)
1205 has an effect that depends on the machine mode it is used for.
1206 On the SPARC this is never true. */
1207
1208#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
1209\f
1210/* Specify the machine mode that this machine uses
1211 for the index in the tablejump instruction. */
1212#define CASE_VECTOR_MODE SImode
1213
1214/* Define this if the tablejump instruction expects the table
1215 to contain offsets from the address of the table.
1216 Do not define this if the table should contain absolute addresses. */
1217/* #define CASE_VECTOR_PC_RELATIVE */
1218
1219/* Specify the tree operation to be used to convert reals to integers. */
1220#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1221
1222/* This is the kind of divide that is easiest to do in the general case. */
1223#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1224
1225/* Define this as 1 if `char' should by default be signed; else as 0. */
1226#define DEFAULT_SIGNED_CHAR 1
1227
1228/* Max number of bytes we can move from memory to memory
1229 in one reasonably fast instruction. */
2eef2ef1 1230#define MOVE_MAX 8
1bb87f28
JW
1231
1232/* Define if normal loads of shorter-than-word items from memory clears
1233 the rest of the bigs in the register. */
1234#define BYTE_LOADS_ZERO_EXTEND
1235
1236/* Nonzero if access to memory by bytes is slow and undesirable.
1237 For RISC chips, it means that access to memory by bytes is no
1238 better than access by words when possible, so grab a whole word
1239 and maybe make use of that. */
1240#define SLOW_BYTE_ACCESS 1
1241
1242/* We assume that the store-condition-codes instructions store 0 for false
1243 and some other value for true. This is the value stored for true. */
1244
1245#define STORE_FLAG_VALUE 1
1246
1247/* When a prototype says `char' or `short', really pass an `int'. */
1248#define PROMOTE_PROTOTYPES
1249
1250/* Define if shifts truncate the shift count
1251 which implies one can omit a sign-extension or zero-extension
1252 of a shift count. */
1253#define SHIFT_COUNT_TRUNCATED
1254
1255/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1256 is done just by pretending it is already truncated. */
1257#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1258
1259/* Specify the machine mode that pointers have.
1260 After generation of rtl, the compiler makes no further distinction
1261 between pointers and any other objects of this machine mode. */
1262#define Pmode SImode
1263
b4ac57ab
RS
1264/* Generate calls to memcpy, memcmp and memset. */
1265#define TARGET_MEM_FUNCTIONS
1266
1bb87f28
JW
1267/* Add any extra modes needed to represent the condition code.
1268
1269 On the Sparc, we have a "no-overflow" mode which is used when an add or
1270 subtract insn is used to set the condition code. Different branches are
1271 used in this case for some operations.
1272
4d449554
JW
1273 We also have two modes to indicate that the relevant condition code is
1274 in the floating-point condition code register. One for comparisons which
1275 will generate an exception if the result is unordered (CCFPEmode) and
1276 one for comparisons which will never trap (CCFPmode). This really should
1277 be a separate register, but we don't want to go to 65 registers. */
1278#define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
1bb87f28
JW
1279
1280/* Define the names for the modes specified above. */
4d449554 1281#define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
1bb87f28
JW
1282
1283/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
4d449554
JW
1284 return the mode to be used for the comparison. For floating-point,
1285 CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a
1bb87f28
JW
1286 PLUS, MINUS, or NEG. CCmode should be used when no special processing is
1287 needed. */
1288#define SELECT_CC_MODE(OP,X) \
4d449554
JW
1289 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1290 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
1291 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS || GET_CODE (X) == NEG) \
1292 ? CC_NOOVmode : CCmode))
1bb87f28
JW
1293
1294/* A function address in a call instruction
1295 is a byte address (for indexing purposes)
1296 so give the MEM rtx a byte's mode. */
1297#define FUNCTION_MODE SImode
1298
1299/* Define this if addresses of constant functions
1300 shouldn't be put through pseudo regs where they can be cse'd.
1301 Desirable on machines where ordinary constants are expensive
1302 but a CALL with constant address is cheap. */
1303#define NO_FUNCTION_CSE
1304
1305/* alloca should avoid clobbering the old register save area. */
1306#define SETJMP_VIA_SAVE_AREA
1307
1308/* Define subroutines to call to handle multiply and divide.
1309 Use the subroutines that Sun's library provides.
1310 The `*' prevents an underscore from being prepended by the compiler. */
1311
1312#define DIVSI3_LIBCALL "*.div"
1313#define UDIVSI3_LIBCALL "*.udiv"
1314#define MODSI3_LIBCALL "*.rem"
1315#define UMODSI3_LIBCALL "*.urem"
1316/* .umul is a little faster than .mul. */
1317#define MULSI3_LIBCALL "*.umul"
1318
1319/* Compute the cost of computing a constant rtl expression RTX
1320 whose rtx-code is CODE. The body of this macro is a portion
1321 of a switch statement. If the code is computed here,
1322 return it with a return statement. Otherwise, break from the switch. */
1323
3bb22aee 1324#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1bb87f28
JW
1325 case CONST_INT: \
1326 if (INTVAL (RTX) == 0) \
1327 return 0; \
1328 if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \
1329 return 1; \
1330 case HIGH: \
1331 return 2; \
1332 case CONST: \
1333 case LABEL_REF: \
1334 case SYMBOL_REF: \
1335 return 4; \
1336 case CONST_DOUBLE: \
1337 if (GET_MODE (RTX) == DImode) \
1338 if ((XINT (RTX, 3) == 0 \
1339 && (unsigned) XINT (RTX, 2) < 0x1000) \
1340 || (XINT (RTX, 3) == -1 \
1341 && XINT (RTX, 2) < 0 \
1342 && XINT (RTX, 2) >= -0x1000)) \
1343 return 1; \
1344 return 8;
1345
1346/* SPARC offers addressing modes which are "as cheap as a register".
1347 See sparc.c (or gcc.texinfo) for details. */
1348
1349#define ADDRESS_COST(RTX) \
1350 (GET_CODE (RTX) == REG ? 1 : sparc_address_cost (RTX))
1351
1352/* Compute extra cost of moving data between one register class
1353 and another. */
1354#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1355 (((CLASS1 == FP_REGS && CLASS2 == GENERAL_REGS) \
1356 || (CLASS1 == GENERAL_REGS && CLASS2 == FP_REGS)) ? 6 : 2)
1357
1358/* Provide the costs of a rtl expression. This is in the body of a
1359 switch on CODE. The purpose for the cost of MULT is to encourage
1360 `synth_mult' to find a synthetic multiply when reasonable.
1361
1362 If we need more than 12 insns to do a multiply, then go out-of-line,
1363 since the call overhead will be < 10% of the cost of the multiply. */
1364
3bb22aee 1365#define RTX_COSTS(X,CODE,OUTER_CODE) \
1bb87f28
JW
1366 case MULT: \
1367 return COSTS_N_INSNS (25); \
1368 case DIV: \
1369 case UDIV: \
1370 case MOD: \
1371 case UMOD: \
1372 return COSTS_N_INSNS (20); \
1373 /* Make FLOAT more expensive than CONST_DOUBLE, \
1374 so that cse will favor the latter. */ \
1375 case FLOAT: \
1376 return 19;
1377
1378/* Conditional branches with empty delay slots have a length of two. */
1379#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
1380 if (GET_CODE (INSN) == CALL_INSN \
1381 || (GET_CODE (INSN) == JUMP_INSN && ! simplejump_p (insn))) \
1382 LENGTH += 1;
1383\f
1384/* Control the assembler format that we output. */
1385
1386/* Output at beginning of assembler file. */
1387
1388#define ASM_FILE_START(file)
1389
1390/* Output to assembler file text saying following lines
1391 may contain character constants, extra white space, comments, etc. */
1392
1393#define ASM_APP_ON ""
1394
1395/* Output to assembler file text saying following lines
1396 no longer contain unusual constructs. */
1397
1398#define ASM_APP_OFF ""
1399
1400/* Output before read-only data. */
1401
1402#define TEXT_SECTION_ASM_OP ".text"
1403
1404/* Output before writable data. */
1405
1406#define DATA_SECTION_ASM_OP ".data"
1407
1408/* How to refer to registers in assembler output.
1409 This sequence is indexed by compiler's hard-register-number (see above). */
1410
1411#define REGISTER_NAMES \
1412{"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", \
1413 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", \
1414 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
1415 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", \
1416 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", \
1417 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", \
1418 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", \
1419 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31"}
1420
ea3fa5f7
JW
1421/* Define additional names for use in asm clobbers and asm declarations.
1422
1423 We define the fake Condition Code register as an alias for reg 0 (which
1424 is our `condition code' register), so that condition codes can easily
1425 be clobbered by an asm. No such register actually exists. Condition
1426 codes are partly stored in the PSR and partly in the FSR. */
1427
0eb9f40e 1428#define ADDITIONAL_REGISTER_NAMES {"ccr", 0, "cc", 0}
ea3fa5f7 1429
1bb87f28
JW
1430/* How to renumber registers for dbx and gdb. */
1431
1432#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1433
1434/* On Sun 4, this limit is 2048. We use 1500 to be safe,
1435 since the length can run past this up to a continuation point. */
1436#define DBX_CONTIN_LENGTH 1500
1437
1438/* This is how to output a note to DBX telling it the line number
1439 to which the following sequence of instructions corresponds.
1440
1441 This is needed for SunOS 4.0, and should not hurt for 3.2
1442 versions either. */
1443#define ASM_OUTPUT_SOURCE_LINE(file, line) \
1444 { static int sym_lineno = 1; \
1445 fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
1446 line, sym_lineno, sym_lineno); \
1447 sym_lineno += 1; }
1448
1449/* This is how to output the definition of a user-level label named NAME,
1450 such as the label on a static function or variable NAME. */
1451
1452#define ASM_OUTPUT_LABEL(FILE,NAME) \
1453 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1454
1455/* This is how to output a command to make the user-level label named NAME
1456 defined for reference from other files. */
1457
1458#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1459 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1460
1461/* This is how to output a reference to a user-level label named NAME.
1462 `assemble_name' uses this. */
1463
1464#define ASM_OUTPUT_LABELREF(FILE,NAME) \
1465 fprintf (FILE, "_%s", NAME)
1466
1467/* This is how to output an internal numbered label where
1468 PREFIX is the class of label and NUM is the number within the class. */
1469
1470#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1471 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1472
1473/* This is how to store into the string LABEL
1474 the symbol_ref name of an internal numbered label where
1475 PREFIX is the class of label and NUM is the number within the class.
1476 This is suitable for output with `assemble_name'. */
1477
1478#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1479 sprintf (LABEL, "*%s%d", PREFIX, NUM)
1480
1481/* This is how to output an assembler line defining a `double' constant. */
1482
b1fc14e5
RS
1483/* Assemblers (both gas 1.35 and as in 4.0.3)
1484 seem to treat -0.0 as if it were 0.0.
1485 They reject 99e9999, but accept inf. */
1bb87f28
JW
1486#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1487 { \
1488 if (REAL_VALUE_ISINF (VALUE)) \
b1fc14e5
RS
1489 fprintf (FILE, "\t.double 0r%sinf\n", (VALUE) > 0 ? "" : "-"); \
1490 else if (REAL_VALUE_ISNAN (VALUE) \
1491 || REAL_VALUE_MINUS_ZERO (VALUE)) \
1bb87f28
JW
1492 { \
1493 union { double d; long l[2];} t; \
1494 t.d = (VALUE); \
1495 fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t.l[0], t.l[1]); \
1496 } \
1497 else \
1498 fprintf (FILE, "\t.double 0r%.17g\n", VALUE); \
1499 }
1500
1501/* This is how to output an assembler line defining a `float' constant. */
1502
1503#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1504 { \
1505 if (REAL_VALUE_ISINF (VALUE)) \
b1fc14e5
RS
1506 fprintf (FILE, "\t.single 0r%sinf\n", (VALUE) > 0 ? "" : "-"); \
1507 else if (REAL_VALUE_ISNAN (VALUE) \
1508 || REAL_VALUE_MINUS_ZERO (VALUE)) \
1bb87f28
JW
1509 { \
1510 union { float f; long l;} t; \
1511 t.f = (VALUE); \
1512 fprintf (FILE, "\t.word 0x%lx\n", t.l); \
1513 } \
1514 else \
1515 fprintf (FILE, "\t.single 0r%.9g\n", VALUE); \
1516 }
1517
1518/* This is how to output an assembler line defining an `int' constant. */
1519
1520#define ASM_OUTPUT_INT(FILE,VALUE) \
1521( fprintf (FILE, "\t.word "), \
1522 output_addr_const (FILE, (VALUE)), \
1523 fprintf (FILE, "\n"))
1524
1525/* This is how to output an assembler line defining a DImode constant. */
1526#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
1527 output_double_int (FILE, VALUE)
1528
1529/* Likewise for `char' and `short' constants. */
1530
1531#define ASM_OUTPUT_SHORT(FILE,VALUE) \
1532( fprintf (FILE, "\t.half "), \
1533 output_addr_const (FILE, (VALUE)), \
1534 fprintf (FILE, "\n"))
1535
1536#define ASM_OUTPUT_CHAR(FILE,VALUE) \
1537( fprintf (FILE, "\t.byte "), \
1538 output_addr_const (FILE, (VALUE)), \
1539 fprintf (FILE, "\n"))
1540
1541/* This is how to output an assembler line for a numeric constant byte. */
1542
1543#define ASM_OUTPUT_BYTE(FILE,VALUE) \
1544 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1545
1546/* This is how to output an element of a case-vector that is absolute. */
1547
1548#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
4b69d2a3
RS
1549do { \
1550 char label[30]; \
1551 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1552 fprintf (FILE, "\t.word\t"); \
1553 assemble_name (FILE, label); \
1554 fprintf (FILE, "\n"); \
1555} while (0)
1bb87f28
JW
1556
1557/* This is how to output an element of a case-vector that is relative.
1558 (SPARC uses such vectors only when generating PIC.) */
1559
4b69d2a3
RS
1560#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1561do { \
1562 char label[30]; \
1563 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1564 fprintf (FILE, "\t.word\t"); \
1565 assemble_name (FILE, label); \
1566 fprintf (FILE, "-1b\n"); \
1567} while (0)
1bb87f28
JW
1568
1569/* This is how to output an assembler line
1570 that says to advance the location counter
1571 to a multiple of 2**LOG bytes. */
1572
1573#define ASM_OUTPUT_ALIGN(FILE,LOG) \
1574 if ((LOG) != 0) \
1575 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
1576
1577#define ASM_OUTPUT_SKIP(FILE,SIZE) \
1578 fprintf (FILE, "\t.skip %u\n", (SIZE))
1579
1580/* This says how to output an assembler line
1581 to define a global common symbol. */
1582
1583#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1584( fputs ("\t.global ", (FILE)), \
1585 assemble_name ((FILE), (NAME)), \
1586 fputs ("\n\t.common ", (FILE)), \
1587 assemble_name ((FILE), (NAME)), \
1588 fprintf ((FILE), ",%u,\"bss\"\n", (ROUNDED)))
1589
1590/* This says how to output an assembler line
1591 to define a local common symbol. */
1592
1593#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1594( fputs ("\n\t.reserve ", (FILE)), \
1595 assemble_name ((FILE), (NAME)), \
1596 fprintf ((FILE), ",%u,\"bss\"\n", (ROUNDED)))
1597
1598/* Store in OUTPUT a string (made with alloca) containing
1599 an assembler-name for a local static variable named NAME.
1600 LABELNO is an integer which is different for each call. */
1601
1602#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1603( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1604 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1605
1606/* Define the parentheses used to group arithmetic operations
1607 in assembler code. */
1608
1609#define ASM_OPEN_PAREN "("
1610#define ASM_CLOSE_PAREN ")"
1611
1612/* Define results of standard character escape sequences. */
1613#define TARGET_BELL 007
1614#define TARGET_BS 010
1615#define TARGET_TAB 011
1616#define TARGET_NEWLINE 012
1617#define TARGET_VT 013
1618#define TARGET_FF 014
1619#define TARGET_CR 015
1620
1621#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1622 ((CHAR) == '@' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^')
1623
1624/* Print operand X (an rtx) in assembler syntax to file FILE.
1625 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1626 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1627
1628#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1629
1630/* Print a memory address as an operand to reference that memory location. */
1631
1632#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1633{ register rtx base, index = 0; \
1634 int offset = 0; \
1635 register rtx addr = ADDR; \
1636 if (GET_CODE (addr) == REG) \
1637 fputs (reg_names[REGNO (addr)], FILE); \
1638 else if (GET_CODE (addr) == PLUS) \
1639 { \
1640 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1641 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
1642 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1643 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
1644 else \
1645 base = XEXP (addr, 0), index = XEXP (addr, 1); \
1646 fputs (reg_names[REGNO (base)], FILE); \
1647 if (index == 0) \
1648 fprintf (FILE, "%+d", offset); \
1649 else if (GET_CODE (index) == REG) \
1650 fprintf (FILE, "+%s", reg_names[REGNO (index)]); \
1651 else if (GET_CODE (index) == SYMBOL_REF) \
1652 fputc ('+', FILE), output_addr_const (FILE, index); \
1653 else abort (); \
1654 } \
1655 else if (GET_CODE (addr) == MINUS \
1656 && GET_CODE (XEXP (addr, 1)) == LABEL_REF) \
1657 { \
1658 output_addr_const (FILE, XEXP (addr, 0)); \
1659 fputs ("-(", FILE); \
1660 output_addr_const (FILE, XEXP (addr, 1)); \
1661 fputs ("-.)", FILE); \
1662 } \
1663 else if (GET_CODE (addr) == LO_SUM) \
1664 { \
1665 output_operand (XEXP (addr, 0), 0); \
1666 fputs ("+%lo(", FILE); \
1667 output_address (XEXP (addr, 1)); \
1668 fputc (')', FILE); \
1669 } \
1670 else if (flag_pic && GET_CODE (addr) == CONST \
1671 && GET_CODE (XEXP (addr, 0)) == MINUS \
1672 && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST \
1673 && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) == MINUS \
1674 && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) == pc_rtx) \
1675 { \
1676 addr = XEXP (addr, 0); \
1677 output_addr_const (FILE, XEXP (addr, 0)); \
1678 /* Group the args of the second CONST in parenthesis. */ \
1679 fputs ("-(", FILE); \
1680 /* Skip past the second CONST--it does nothing for us. */\
1681 output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \
1682 /* Close the parenthesis. */ \
1683 fputc (')', FILE); \
1684 } \
1685 else \
1686 { \
1687 output_addr_const (FILE, addr); \
1688 } \
1689}
1690
1691/* Declare functions defined in sparc.c and used in templates. */
1692
1693extern char *singlemove_string ();
1694extern char *output_move_double ();
795068a4 1695extern char *output_move_quad ();
1bb87f28 1696extern char *output_fp_move_double ();
795068a4 1697extern char *output_fp_move_quad ();
1bb87f28
JW
1698extern char *output_block_move ();
1699extern char *output_scc_insn ();
1700extern char *output_cbranch ();
1701extern char *output_return ();
1702extern char *output_floatsisf2 ();
1703extern char *output_floatsidf2 ();
795068a4 1704extern char *output_floatsitf2 ();
1bb87f28
JW
1705
1706/* Defined in flags.h, but insn-emit.c does not include flags.h. */
1707
1708extern int flag_pic;
This page took 0.214686 seconds and 5 git commands to generate.