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