]> gcc.gnu.org Git - gcc.git/blame - gcc/config/i386/i386.h
Added arg to RETURN_POPS_ARGS.
[gcc.git] / gcc / config / i386 / i386.h
CommitLineData
8b109b37
RK
1/* Definitions of target machine for GNU compiler for Intel X86
2 (386, 486, Pentium).
3 Copyright (C) 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
c98f8742
JVA
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
22/* The purpose of this file is to define the characteristics of the i386,
b4ac57ab 23 independent of assembler syntax or operating system.
c98f8742
JVA
24
25 Three other files build on this one to describe a specific assembler syntax:
26 bsd386.h, att386.h, and sun386.h.
27
28 The actual tm.h file for a particular system should include
29 this file, and then the file for the appropriate assembler syntax.
30
31 Many macros that specify assembler syntax are omitted entirely from
32 this file because they really belong in the files for particular
33 assemblers. These include AS1, AS2, AS3, RP, IP, LPREFIX, L_SIZE,
34 PUT_OP_SIZE, USE_STAR, ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE,
35 PRINT_B_I_S, and many that start with ASM_ or end in ASM_OP. */
36
37/* Names to predefine in the preprocessor for this target machine. */
38
39#define I386 1
40
95393dfd
CH
41/* Stubs for half-pic support if not OSF/1 reference platform. */
42
43#ifndef HALF_PIC_P
44#define HALF_PIC_P() 0
45#define HALF_PIC_NUMBER_PTRS 0
46#define HALF_PIC_NUMBER_REFS 0
47#define HALF_PIC_ENCODE(DECL)
48#define HALF_PIC_DECLARE(NAME)
49#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
50#define HALF_PIC_ADDRESS_P(X) 0
51#define HALF_PIC_PTR(X) X
52#define HALF_PIC_FINISH(STREAM)
53#endif
54
c98f8742
JVA
55/* Run-time compilation parameters selecting different hardware subsets. */
56
57extern int target_flags;
58
59/* Macros used in the machine description to test the flags. */
60
35b528be
RS
61/* configure can arrage to make this 2, to force a 486. */
62#ifndef TARGET_CPU_DEFAULT
63#define TARGET_CPU_DEFAULT 0
64#endif
65
3b3c6a3f
MM
66/* Masks for the -m switches */
67#define MASK_80387 000000000001 /* Hardware floating point */
68#define MASK_486 000000000002 /* 80486 specific */
69#define MASK_NOTUSED 000000000004 /* bit not currently used */
70#define MASK_RTD 000000000010 /* Use ret that pops args */
71#define MASK_REGPARM 000000000020 /* Pass args in eax, edx */
72#define MASK_SVR3_SHLIB 000000000040 /* Uninit locals into bss */
73#define MASK_IEEE_FP 000000000100 /* IEEE fp comparisons */
74#define MASK_FLOAT_RETURNS 000000000200 /* Return float in st(0) */
75#define MASK_NO_FANCY_MATH_387 000000000400 /* Disable sin, cos, sqrt */
76
77 /* Temporary codegen switches */
78#define MASK_DEBUG_ADDR 000001000000 /* Debug GO_IF_LEGITIMATE_ADDRESS */
79#define MASK_NO_WIDE_MULTIPLY 000002000000 /* Disable 32x32->64 multiplies */
80#define MASK_NO_MOVE 000004000000 /* Don't generate mem->mem */
81
82/* Use the floating point instructions */
83#define TARGET_80387 (target_flags & MASK_80387)
84
c98f8742
JVA
85/* Compile using ret insn that pops args.
86 This will not work unless you use prototypes at least
87 for all functions that can take varying numbers of args. */
3b3c6a3f
MM
88#define TARGET_RTD (target_flags & MASK_RTD)
89
c98f8742
JVA
90/* Compile passing first two args in regs 0 and 1.
91 This exists only to test compiler features that will
92 be needed for RISC chips. It is not usable
93 and is not intended to be usable on this cpu. */
3b3c6a3f 94#define TARGET_REGPARM (target_flags & MASK_RTD)
c98f8742 95
d7cd15e9
RS
96/* Put uninitialized locals into bss, not data.
97 Meaningful only on svr3. */
3b3c6a3f 98#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
d7cd15e9 99
c572e5ba
JVA
100/* Use IEEE floating point comparisons. These handle correctly the cases
101 where the result of a comparison is unordered. Normally SIGFPE is
102 generated in such cases, in which case this isn't needed. */
3b3c6a3f 103#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
c572e5ba 104
8c2bf92a
JVA
105/* Functions that return a floating point value may return that value
106 in the 387 FPU or in 386 integer registers. If set, this flag causes
107 the 387 to be used, which is compatible with most calling conventions. */
3b3c6a3f 108#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
8c2bf92a 109
099800e3
RK
110/* Disable generation of FP sin, cos and sqrt operations for 387.
111 This is because FreeBSD lacks these in the math-emulator-code */
3b3c6a3f
MM
112#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
113
114/* Temporary switches for tuning code generation */
115
116/* Disable 32x32->64 bit multiplies that are used for long long multiplies
117 and division by constants, but sometimes cause reload problems. */
118#define TARGET_NO_WIDE_MULTIPLY (target_flags & MASK_NO_WIDE_MULTIPLY)
119#define TARGET_WIDE_MULTIPLY (!TARGET_NO_WIDE_MULTIPLY)
120
121/* Debug GO_IF_LEGITIMATE_ADDRESS */
122#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
123
124/* Hack macros for tuning code generation */
125#define TARGET_MOVE ((target_flags & MASK_NO_MOVE) == 0) /* Don't generate memory->memory */
126
127/* Specific hardware switches */
128#define TARGET_486 (target_flags & MASK_486) /* 80486DX, 80486SX, 80486DX[24] */
129#define TARGET_386 (!TARGET_486) /* 80386 */
130
131#define TARGET_SWITCHES \
132{ { "80387", MASK_80387 }, \
133 { "no-80387", -MASK_80387 }, \
134 { "hard-float", MASK_80387 }, \
135 { "soft-float", -MASK_80387 }, \
136 { "no-soft-float", MASK_80387 }, \
137 { "386", -MASK_486 }, \
138 { "no-386", MASK_486 }, \
139 { "486", MASK_486 }, \
140 { "no-486", -MASK_486 }, \
141 { "rtd", MASK_RTD }, \
142 { "no-rtd", -MASK_RTD }, \
143 { "regparm", MASK_REGPARM }, \
144 { "no-regparm", -MASK_REGPARM }, \
145 { "svr3-shlib", MASK_SVR3_SHLIB }, \
146 { "no-svr3-shlib", -MASK_SVR3_SHLIB }, \
147 { "ieee-fp", MASK_IEEE_FP }, \
148 { "no-ieee-fp", -MASK_IEEE_FP }, \
149 { "fp-ret-in-387", MASK_FLOAT_RETURNS }, \
150 { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS }, \
151 { "no-fancy-math-387", MASK_NO_FANCY_MATH_387 }, \
152 { "fancy-math-387", -MASK_NO_FANCY_MATH_387 }, \
153 { "no-wide-multiply", MASK_NO_WIDE_MULTIPLY }, \
154 { "wide-multiply", -MASK_NO_WIDE_MULTIPLY }, \
155 { "debug-addr", MASK_DEBUG_ADDR }, \
156 { "no-debug-addr", -MASK_DEBUG_ADDR }, \
157 { "move", -MASK_NO_MOVE }, \
158 { "no-move", MASK_NO_MOVE }, \
159 SUBTARGET_SWITCHES \
160 { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT}}
95393dfd 161
f5316dfe
MM
162/* This macro is similar to `TARGET_SWITCHES' but defines names of
163 command options that have values. Its definition is an
164 initializer with a subgrouping for each command option.
165
166 Each subgrouping contains a string constant, that defines the
167 fixed part of the option name, and the address of a variable. The
168 variable, type `char *', is set to the variable part of the given
169 option if the fixed part matches. The actual option name is made
170 by appending `-m' to the specified name. */
171#define TARGET_OPTIONS \
172{ { "reg-alloc=", &i386_reg_alloc_order }, \
173 SUBTARGET_OPTIONS }
174
175/* Sometimes certain combinations of command options do not make
176 sense on a particular target machine. You can define a macro
177 `OVERRIDE_OPTIONS' to take account of this. This macro, if
178 defined, is executed once just after all the command options have
179 been parsed.
180
181 Don't use this macro to turn on various extra optimizations for
182 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
183
184#define OVERRIDE_OPTIONS override_options ()
185
186/* These are meant to be redefined in the host dependent files */
95393dfd 187#define SUBTARGET_SWITCHES
f5316dfe 188#define SUBTARGET_OPTIONS
95393dfd 189
c98f8742
JVA
190\f
191/* target machine storage layout */
192
0038aea6
JVA
193/* Define for XFmode extended real floating point support.
194 This will automatically cause REAL_ARITHMETIC to be defined. */
195#define LONG_DOUBLE_TYPE_SIZE 96
196
197/* Define if you don't want extended real, but do want to use the
198 software floating point emulator for REAL_ARITHMETIC and
199 decimal <-> binary conversion. */
200/* #define REAL_ARITHMETIC */
201
c98f8742
JVA
202/* Define this if most significant byte of a word is the lowest numbered. */
203/* That is true on the 80386. */
204
205#define BITS_BIG_ENDIAN 0
206
207/* Define this if most significant byte of a word is the lowest numbered. */
208/* That is not true on the 80386. */
209#define BYTES_BIG_ENDIAN 0
210
211/* Define this if most significant word of a multiword number is the lowest
212 numbered. */
213/* Not true for 80386 */
214#define WORDS_BIG_ENDIAN 0
215
b4ac57ab 216/* number of bits in an addressable storage unit */
c98f8742
JVA
217#define BITS_PER_UNIT 8
218
219/* Width in bits of a "word", which is the contents of a machine register.
220 Note that this is not necessarily the width of data type `int';
221 if using 16-bit ints on a 80386, this would still be 32.
222 But on a machine with 16-bit registers, this would be 16. */
223#define BITS_PER_WORD 32
224
225/* Width of a word, in units (bytes). */
226#define UNITS_PER_WORD 4
227
228/* Width in bits of a pointer.
229 See also the macro `Pmode' defined below. */
230#define POINTER_SIZE 32
231
232/* Allocation boundary (in *bits*) for storing arguments in argument list. */
233#define PARM_BOUNDARY 32
234
235/* Boundary (in *bits*) on which stack pointer should be aligned. */
236#define STACK_BOUNDARY 32
237
238/* Allocation boundary (in *bits*) for the code of a function.
239 For i486, we get better performance by aligning to a cache
240 line (i.e. 16 byte) boundary. */
241#define FUNCTION_BOUNDARY (TARGET_486 ? 128 : 32)
242
243/* Alignment of field after `int : 0' in a structure. */
244
245#define EMPTY_FIELD_BOUNDARY 32
246
247/* Minimum size in bits of the largest boundary to which any
248 and all fundamental data types supported by the hardware
249 might need to be aligned. No data type wants to be aligned
250 rounder than this. The i386 supports 64-bit floating point
251 quantities, but these can be aligned on any 32-bit boundary. */
252#define BIGGEST_ALIGNMENT 32
253
b4ac57ab 254/* Set this non-zero if move instructions will actually fail to work
c98f8742 255 when given unaligned data. */
b4ac57ab 256#define STRICT_ALIGNMENT 0
c98f8742
JVA
257
258/* If bit field type is int, don't let it cross an int,
259 and give entire struct the alignment of an int. */
260/* Required on the 386 since it doesn't have bitfield insns. */
261#define PCC_BITFIELD_TYPE_MATTERS 1
262
263/* Align loop starts for optimal branching. */
264#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
265 ASM_OUTPUT_ALIGN (FILE, 2)
266
267/* This is how to align an instruction for optimal branching.
268 On i486 we'll get better performance by aligning on a
269 cache line (i.e. 16 byte) boundary. */
270#define ASM_OUTPUT_ALIGN_CODE(FILE) \
271 ASM_OUTPUT_ALIGN ((FILE), (TARGET_486 ? 4 : 2))
272\f
273/* Standard register usage. */
274
275/* This processor has special stack-like registers. See reg-stack.c
276 for details. */
277
278#define STACK_REGS
279
280/* Number of actual hardware registers.
281 The hardware registers are assigned numbers for the compiler
282 from 0 to just below FIRST_PSEUDO_REGISTER.
283 All registers that the compiler knows about must be given numbers,
284 even those that are not normally considered general registers.
285
286 In the 80386 we give the 8 general purpose registers the numbers 0-7.
287 We number the floating point registers 8-15.
288 Note that registers 0-7 can be accessed as a short or int,
289 while only 0-3 may be used with byte `mov' instructions.
290
291 Reg 16 does not correspond to any hardware register, but instead
292 appears in the RTL as an argument pointer prior to reload, and is
293 eliminated during reloading in favor of either the stack or frame
294 pointer. */
295
296#define FIRST_PSEUDO_REGISTER 17
297
298/* 1 for registers that have pervasive standard uses
299 and are not available for the register allocator.
300 On the 80386, the stack pointer is such, as is the arg pointer. */
301#define FIXED_REGISTERS \
302/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
303{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
304
305/* 1 for registers not available across function calls.
306 These must include the FIXED_REGISTERS and also any
307 registers that can be used without being saved.
308 The latter must include the registers where values are returned
309 and the register where structure-value addresses are passed.
310 Aside from that, you can include as many other registers as you like. */
311
312#define CALL_USED_REGISTERS \
313/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
314{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
315
3b3c6a3f
MM
316/* Order in which to allocate registers. Each register must be
317 listed once, even those in FIXED_REGISTERS. List frame pointer
318 late and fixed registers last. Note that, in general, we prefer
319 registers listed in CALL_USED_REGISTERS, keeping the others
320 available for storage of persistent values.
321
322 Three different versions of REG_ALLOC_ORDER have been tried:
323
324 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
325 but slower code on simple functions returning values in eax.
326
327 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
328 perl 4.036 due to not being able to create a DImode register (to hold a 2
329 word union).
330
331 If the order is eax, edx, ecx, ... it produces better code for simple
332 functions, and a slightly slower compiler. Users complained about the code
333 generated by allocating edx first, so restore the 'natural' order of things. */
334
184ff798 335#define REG_ALLOC_ORDER \
f5316dfe
MM
336/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
337{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
338
339/* A C statement (sans semicolon) to choose the order in which to
340 allocate hard registers for pseudo-registers local to a basic
341 block.
342
343 Store the desired register order in the array `reg_alloc_order'.
344 Element 0 should be the register to allocate first; element 1, the
345 next register; and so on.
346
347 The macro body should not assume anything about the contents of
348 `reg_alloc_order' before execution of the macro.
349
350 On most machines, it is not necessary to define this macro. */
351
352#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
184ff798 353
c98f8742
JVA
354/* Macro to conditionally modify fixed_regs/call_used_regs. */
355#define CONDITIONAL_REGISTER_USAGE \
356 { \
357 if (flag_pic) \
358 { \
359 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
360 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
361 } \
8c2bf92a
JVA
362 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
363 { \
364 int i; \
365 HARD_REG_SET x; \
366 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
367 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
368 if (TEST_HARD_REG_BIT (x, i)) \
369 fixed_regs[i] = call_used_regs[i] = 1; \
370 } \
c98f8742
JVA
371 }
372
373/* Return number of consecutive hard regs needed starting at reg REGNO
374 to hold something of mode MODE.
375 This is ordinarily the length in words of a value of mode MODE
376 but can be less for certain modes in special long registers.
377
378 Actually there are no two word move instructions for consecutive
379 registers. And only registers 0-3 may have mov byte instructions
380 applied to them.
381 */
382
383#define HARD_REGNO_NREGS(REGNO, MODE) \
384 (FP_REGNO_P (REGNO) ? 1 \
385 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
386
387/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
388 On the 80386, the first 4 cpu registers can hold any mode
389 while the floating point registers may hold only floating point.
390 Make it clear that the fp regs could not hold a 16-byte float. */
391
48227a2c
RS
392/* The casts to int placate a compiler on a microvax,
393 for cross-compiler testing. */
394
c98f8742 395#define HARD_REGNO_MODE_OK(REGNO, MODE) \
1bbe49a6
JVA
396 ((REGNO) < 2 ? 1 \
397 : (REGNO) < 4 ? 1 \
0038aea6 398 : FP_REGNO_P (REGNO) \
48227a2c
RS
399 ? (((int) GET_MODE_CLASS (MODE) == (int) MODE_FLOAT \
400 || (int) GET_MODE_CLASS (MODE) == (int) MODE_COMPLEX_FLOAT) \
401 && GET_MODE_UNIT_SIZE (MODE) <= 12) \
402 : (int) (MODE) != (int) QImode)
c98f8742
JVA
403
404/* Value is 1 if it is a good idea to tie two pseudo registers
405 when one has mode MODE1 and one has mode MODE2.
406 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
407 for any hard reg, then this must be 0 for correct output. */
408
409#define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
410
411/* A C expression returning the cost of moving data from a register of class
412 CLASS1 to one of CLASS2.
413
414 On the i386, copying between floating-point and fixed-point
415 registers is expensive. */
416
4cbb525c
JVA
417#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
418 (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
419 || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \
420 : 2)
c98f8742
JVA
421
422/* Specify the registers used for certain standard purposes.
423 The values of these macros are register numbers. */
424
425/* on the 386 the pc register is %eip, and is not usable as a general
426 register. The ordinary mov instructions won't work */
427/* #define PC_REGNUM */
428
429/* Register to use for pushing function arguments. */
430#define STACK_POINTER_REGNUM 7
431
432/* Base register for access to local variables of the function. */
433#define FRAME_POINTER_REGNUM 6
434
435/* First floating point reg */
436#define FIRST_FLOAT_REG 8
437
438/* First & last stack-like regs */
439#define FIRST_STACK_REG FIRST_FLOAT_REG
440#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
441
442/* Value should be nonzero if functions must have frame pointers.
443 Zero means the frame pointer need not be set up (and parms
444 may be accessed via the stack pointer) in functions that seem suitable.
445 This is computed in `reload', in reload1.c. */
446#define FRAME_POINTER_REQUIRED 0
447
448/* Base register for access to arguments of the function. */
449#define ARG_POINTER_REGNUM 16
450
451/* Register in which static-chain is passed to a function. */
452#define STATIC_CHAIN_REGNUM 2
453
454/* Register to hold the addressing base for position independent
455 code access to data items. */
456#define PIC_OFFSET_TABLE_REGNUM 3
457
458/* Register in which address to store a structure value
459 arrives in the function. On the 386, the prologue
460 copies this from the stack to register %eax. */
461#define STRUCT_VALUE_INCOMING 0
462
463/* Place in which caller passes the structure value address.
464 0 means push the value on the stack like an argument. */
465#define STRUCT_VALUE 0
713225d4
MM
466
467/* A C expression which can inhibit the returning of certain function
468 values in registers, based on the type of value. A nonzero value
469 says to return the function value in memory, just as large
470 structures are always returned. Here TYPE will be a C expression
471 of type `tree', representing the data type of the value.
472
473 Note that values of mode `BLKmode' must be explicitly handled by
474 this macro. Also, the option `-fpcc-struct-return' takes effect
475 regardless of this macro. On most systems, it is possible to
476 leave the macro undefined; this causes a default definition to be
477 used, whose value is the constant 1 for `BLKmode' values, and 0
478 otherwise.
479
480 Do not use this macro to indicate that structures and unions
481 should always be returned in memory. You should instead use
482 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
483
484#define RETURN_IN_MEMORY(TYPE) \
485 ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
486
c98f8742
JVA
487\f
488/* Define the classes of registers for register constraints in the
489 machine description. Also define ranges of constants.
490
491 One of the classes must always be named ALL_REGS and include all hard regs.
492 If there is more than one class, another class must be named NO_REGS
493 and contain no registers.
494
495 The name GENERAL_REGS must be the name of a class (or an alias for
496 another name such as ALL_REGS). This is the class of registers
497 that is allowed by "g" or "r" in a register constraint.
498 Also, registers outside this class are allocated only when
499 instructions express preferences for them.
500
501 The classes must be numbered in nondecreasing order; that is,
502 a larger-numbered class must never be contained completely
503 in a smaller-numbered class.
504
505 For any two classes, it is very desirable that there be another
ab408a86
JVA
506 class that represents their union.
507
508 It might seem that class BREG is unnecessary, since no useful 386
509 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
510 and the "b" register constraint is useful in asms for syscalls. */
c98f8742
JVA
511
512enum reg_class
513{
514 NO_REGS,
ab408a86 515 AREG, DREG, CREG, BREG,
4b71cd6e 516 AD_REGS, /* %eax/%edx for DImode */
c98f8742
JVA
517 Q_REGS, /* %eax %ebx %ecx %edx */
518 SIREG, DIREG,
519 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
520 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
521 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
522 FLOAT_REGS,
523 ALL_REGS, LIM_REG_CLASSES
524};
525
526#define N_REG_CLASSES (int) LIM_REG_CLASSES
527
4cbb525c
JVA
528#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
529
c98f8742
JVA
530/* Give names of register classes as strings for dump file. */
531
532#define REG_CLASS_NAMES \
533{ "NO_REGS", \
ab408a86 534 "AREG", "DREG", "CREG", "BREG", \
4b71cd6e 535 "AD_REGS", \
c98f8742
JVA
536 "Q_REGS", \
537 "SIREG", "DIREG", \
538 "INDEX_REGS", \
539 "GENERAL_REGS", \
540 "FP_TOP_REG", "FP_SECOND_REG", \
541 "FLOAT_REGS", \
542 "ALL_REGS" }
543
544/* Define which registers fit in which classes.
545 This is an initializer for a vector of HARD_REG_SET
546 of length N_REG_CLASSES. */
547
548#define REG_CLASS_CONTENTS \
549{ 0, \
ab408a86 550 0x1, 0x2, 0x4, 0x8, /* AREG, DREG, CREG, BREG */ \
4b71cd6e 551 0x3, /* AD_REGS */ \
c98f8742
JVA
552 0xf, /* Q_REGS */ \
553 0x10, 0x20, /* SIREG, DIREG */ \
91f0226f 554 0x07f, /* INDEX_REGS */ \
c98f8742
JVA
555 0x100ff, /* GENERAL_REGS */ \
556 0x0100, 0x0200, /* FP_TOP_REG, FP_SECOND_REG */ \
557 0xff00, /* FLOAT_REGS */ \
558 0x1ffff }
559
560/* The same information, inverted:
561 Return the class number of the smallest class containing
562 reg number REGNO. This could be a conditional expression
563 or could index an array. */
564
c98f8742
JVA
565#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
566
567/* When defined, the compiler allows registers explicitly used in the
568 rtl to be used as spill registers but prevents the compiler from
569 extending the lifetime of these registers. */
570
571#define SMALL_REGISTER_CLASSES
572
573#define QI_REG_P(X) \
574 (REG_P (X) && REGNO (X) < 4)
575#define NON_QI_REG_P(X) \
576 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
577
578#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
579#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
580
581#define STACK_REG_P(xop) (REG_P (xop) && \
582 REGNO (xop) >= FIRST_STACK_REG && \
583 REGNO (xop) <= LAST_STACK_REG)
584
585#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
586
587#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
588
589/* Try to maintain the accuracy of the death notes for regs satisfying the
590 following. Important for stack like regs, to know when to pop. */
591
592/* #define PRESERVE_DEATH_INFO_REGNO_P(x) FP_REGNO_P(x) */
593
594/* 1 if register REGNO can magically overlap other regs.
595 Note that nonzero values work only in very special circumstances. */
596
597/* #define OVERLAPPING_REGNO_P(REGNO) FP_REGNO_P (REGNO) */
598
599/* The class value for index registers, and the one for base regs. */
600
601#define INDEX_REG_CLASS INDEX_REGS
602#define BASE_REG_CLASS GENERAL_REGS
603
604/* Get reg_class from a letter such as appears in the machine description. */
605
606#define REG_CLASS_FROM_LETTER(C) \
8c2bf92a
JVA
607 ((C) == 'r' ? GENERAL_REGS : \
608 (C) == 'q' ? Q_REGS : \
609 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
610 ? FLOAT_REGS \
611 : NO_REGS) : \
612 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
613 ? FP_TOP_REG \
614 : NO_REGS) : \
615 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
616 ? FP_SECOND_REG \
617 : NO_REGS) : \
618 (C) == 'a' ? AREG : \
619 (C) == 'b' ? BREG : \
620 (C) == 'c' ? CREG : \
621 (C) == 'd' ? DREG : \
4b71cd6e 622 (C) == 'A' ? AD_REGS : \
8c2bf92a 623 (C) == 'D' ? DIREG : \
c98f8742
JVA
624 (C) == 'S' ? SIREG : NO_REGS)
625
626/* The letters I, J, K, L and M in a register constraint string
627 can be used to stand for particular ranges of immediate operands.
628 This macro defines what the ranges are.
629 C is the letter, and VALUE is a constant value.
630 Return 1 if VALUE is in the range specified by C.
631
632 I is for non-DImode shifts.
633 J is for DImode shifts.
634 K and L are for an `andsi' optimization.
635 M is for shifts that can be executed by the "lea" opcode.
636 */
637
638#define CONST_OK_FOR_LETTER_P(VALUE, C) \
639 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 : \
640 (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \
641 (C) == 'K' ? (VALUE) == 0xff : \
642 (C) == 'L' ? (VALUE) == 0xffff : \
643 (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 : \
644 0)
645
646/* Similar, but for floating constants, and defining letters G and H.
b4ac57ab
RS
647 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
648 TARGET_387 isn't set, because the stack register converter may need to
649 load 0.0 into the function value register. */
c98f8742
JVA
650
651#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
b4ac57ab 652 ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
c98f8742
JVA
653
654/* Place additional restrictions on the register class to use when it
4cbb525c
JVA
655 is necessary to be able to hold a value of mode MODE in a reload
656 register for which class CLASS would ordinarily be used. */
c98f8742
JVA
657
658#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
659 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
660 ? Q_REGS : (CLASS))
661
662/* Given an rtx X being reloaded into a reg required to be
663 in class CLASS, return the class of reg to actually use.
664 In general this is just CLASS; but on some machines
665 in some cases it is preferable to use a more restrictive class.
666 On the 80386 series, we prevent floating constants from being
667 reloaded into floating registers (since no move-insn can do that)
668 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
669
d398b3b1 670/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
c98f8742 671 QImode must go into class Q_REGS.
d398b3b1
JVA
672 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
673 movdf to do mem-to-mem moves through integer regs. */
c98f8742 674
7488be4e 675#define PREFERRED_RELOAD_CLASS(X,CLASS) \
85ff473e
JVA
676 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode ? NO_REGS \
677 : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
d398b3b1
JVA
678 : ((CLASS) == ALL_REGS \
679 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
85ff473e
JVA
680 : (CLASS))
681
682/* If we are copying between general and FP registers, we need a memory
683 location. */
684
685#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
4cbb525c
JVA
686 ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
687 || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)))
c98f8742
JVA
688
689/* Return the maximum number of consecutive registers
690 needed to represent mode MODE in a register of class CLASS. */
691/* On the 80386, this is the size of MODE in words,
692 except in the FP regs, where a single reg is always enough. */
693#define CLASS_MAX_NREGS(CLASS, MODE) \
4cbb525c
JVA
694 (FLOAT_CLASS_P (CLASS) ? 1 : \
695 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
f5316dfe
MM
696
697/* A C expression whose value is nonzero if pseudos that have been
698 assigned to registers of class CLASS would likely be spilled
699 because registers of CLASS are needed for spill registers.
700
701 The default value of this macro returns 1 if CLASS has exactly one
702 register and zero otherwise. On most machines, this default
703 should be used. Only define this macro to some other expression
704 if pseudo allocated by `local-alloc.c' end up in memory because
705 their hard registers were needed for spill regisers. If this
706 macro returns nonzero for those classes, those pseudos will only
707 be allocated by `global.c', which knows how to reallocate the
708 pseudo to another register. If there would not be another
709 register available for reallocation, you should not change the
710 definition of this macro since the only effect of such a
711 definition would be to slow down register allocation. */
712
713#define CLASS_LIKELY_SPILLED_P(CLASS) \
714 (((CLASS) == AREG) \
715 || ((CLASS) == DREG) \
716 || ((CLASS) == CREG) \
717 || ((CLASS) == BREG) \
718 || ((CLASS) == AD_REGS) \
719 || ((CLASS) == SIREG) \
720 || ((CLASS) == DIREG))
721
c98f8742
JVA
722\f
723/* Stack layout; function entry, exit and calling. */
724
725/* Define this if pushing a word on the stack
726 makes the stack pointer a smaller address. */
727#define STACK_GROWS_DOWNWARD
728
729/* Define this if the nominal address of the stack frame
730 is at the high-address end of the local variables;
731 that is, each additional local variable allocated
732 goes at a more negative offset in the frame. */
733#define FRAME_GROWS_DOWNWARD
734
735/* Offset within stack frame to start allocating local variables at.
736 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
737 first local allocated. Otherwise, it is the offset to the BEGINNING
738 of the first local allocated. */
739#define STARTING_FRAME_OFFSET 0
740
741/* If we generate an insn to push BYTES bytes,
742 this says how many the stack pointer really advances by.
743 On 386 pushw decrements by exactly 2 no matter what the position was.
744 On the 386 there is no pushb; we use pushw instead, and this
745 has the effect of rounding up to 2. */
746
747#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
748
749/* Offset of first parameter from the argument pointer register value. */
750#define FIRST_PARM_OFFSET(FNDECL) 0
751
752/* Value is the number of bytes of arguments automatically
753 popped when returning from a subroutine call.
8b109b37 754 FUNDECL is the declaration node of the function (as a tree),
c98f8742
JVA
755 FUNTYPE is the data type of the function (as a tree),
756 or for a library call it is an identifier node for the subroutine name.
757 SIZE is the number of bytes of arguments passed on the stack.
758
759 On the 80386, the RTD insn may be used to pop them if the number
760 of args is fixed, but if the number is variable then the caller
761 must pop them all. RTD can't be used for library calls now
762 because the library is compiled with the Unix compiler.
763 Use of RTD is a selectable option, since it is incompatible with
764 standard Unix calling sequences. If the option is not selected,
765 the caller must always pop the args. */
766
8b109b37 767#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
c98f8742
JVA
768 (TREE_CODE (FUNTYPE) == IDENTIFIER_NODE ? 0 \
769 : (TARGET_RTD \
770 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
771 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
772 == void_type_node))) ? (SIZE) \
76c30596 773 : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0)
c98f8742 774
8c2bf92a
JVA
775/* Define how to find the value returned by a function.
776 VALTYPE is the data type of the value (as a tree).
777 If the precise function being called is known, FUNC is its FUNCTION_DECL;
778 otherwise, FUNC is 0. */
c98f8742
JVA
779#define FUNCTION_VALUE(VALTYPE, FUNC) \
780 gen_rtx (REG, TYPE_MODE (VALTYPE), \
781 VALUE_REGNO (TYPE_MODE (VALTYPE)))
782
783/* Define how to find the value returned by a library function
784 assuming the value has mode MODE. */
785
786#define LIBCALL_VALUE(MODE) \
787 gen_rtx (REG, MODE, VALUE_REGNO (MODE))
788
e9125c09
TW
789/* Define the size of the result block used for communication between
790 untyped_call and untyped_return. The block contains a DImode value
791 followed by the block used by fnsave and frstor. */
792
793#define APPLY_RESULT_SIZE (8+108)
794
c98f8742
JVA
795/* 1 if N is a possible register number for function argument passing.
796 On the 80386, no registers are used in this way.
797 *NOTE* -mregparm does not work.
798 It exists only to test register calling conventions. */
799
800#define FUNCTION_ARG_REGNO_P(N) 0
801
802/* Define a data type for recording info about an argument list
803 during the scan of that argument list. This data type should
804 hold all necessary information about the function itself
805 and about the args processed so far, enough to enable macros
806 such as FUNCTION_ARG to determine where the next arg should go.
807
808 On the 80386, this is a single integer, which is a number of bytes
809 of arguments scanned so far. */
810
811#define CUMULATIVE_ARGS int
812
813/* Initialize a variable CUM of type CUMULATIVE_ARGS
814 for a call to a function whose data type is FNTYPE.
815 For a library call, FNTYPE is 0.
816
817 On the 80386, the offset starts at 0. */
818
819#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
820 ((CUM) = 0)
821
822/* Update the data in CUM to advance over an argument
823 of mode MODE and data type TYPE.
824 (TYPE is null for libcalls where that information may not be available.) */
825
826#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
827 ((CUM) += ((MODE) != BLKmode \
828 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
829 : (int_size_in_bytes (TYPE) + 3) & ~3))
830
831/* Define where to put the arguments to a function.
832 Value is zero to push the argument on the stack,
833 or a hard register in which to store the argument.
834
835 MODE is the argument's machine mode.
836 TYPE is the data type of the argument (as a tree).
837 This is null for libcalls where that information may
838 not be available.
839 CUM is a variable of type CUMULATIVE_ARGS which gives info about
840 the preceding args and about the function being called.
841 NAMED is nonzero if this argument is a named parameter
842 (otherwise it is an extra parameter matching an ellipsis). */
843
844
845/* On the 80386 all args are pushed, except if -mregparm is specified
846 then the first two words of arguments are passed in EAX, EDX.
847 *NOTE* -mregparm does not work.
848 It exists only to test register calling conventions. */
849
850#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
851((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
852
853/* For an arg passed partly in registers and partly in memory,
854 this is the number of registers used.
855 For args passed entirely in registers or entirely in memory, zero. */
856
857
858#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
859((TARGET_REGPARM && (CUM) < 8 \
860 && 8 < ((CUM) + ((MODE) == BLKmode \
861 ? int_size_in_bytes (TYPE) \
862 : GET_MODE_SIZE (MODE)))) \
863 ? 2 - (CUM) / 4 : 0)
864
865/* This macro generates the assembly code for function entry.
866 FILE is a stdio stream to output the code to.
867 SIZE is an int: how many units of temporary storage to allocate.
868 Refer to the array `regs_ever_live' to determine which registers
869 to save; `regs_ever_live[I]' is nonzero if register number I
870 is ever used in the function. This macro is responsible for
871 knowing which registers should not be saved even if used. */
872
873#define FUNCTION_PROLOGUE(FILE, SIZE) \
874 function_prologue (FILE, SIZE)
875
876/* Output assembler code to FILE to increment profiler label # LABELNO
877 for profiling a function entry. */
878
879#define FUNCTION_PROFILER(FILE, LABELNO) \
880{ \
881 if (flag_pic) \
882 { \
883 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
884 LPREFIX, (LABELNO)); \
885 fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \
886 } \
887 else \
888 { \
889 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
890 fprintf (FILE, "\tcall _mcount\n"); \
891 } \
892}
893
1cf5eda8
MM
894/* A C statement or compound statement to output to FILE some
895 assembler code to initialize basic-block profiling for the current
896 object module. This code should call the subroutine
897 `__bb_init_func' once per object module, passing it as its sole
898 argument the address of a block allocated in the object module.
899
900 The name of the block is a local symbol made with this statement:
901
902 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
903
904 Of course, since you are writing the definition of
905 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
906 can take a short cut in the definition of this macro and use the
907 name that you know will result.
908
909 The first word of this block is a flag which will be nonzero if the
910 object module has already been initialized. So test this word
911 first, and do not call `__bb_init_func' if the flag is nonzero. */
912
913#undef FUNCTION_BLOCK_PROFILER
914#define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO) \
915do \
916 { \
917 static int num_func = 0; \
8ecf187a 918 rtx xops[8]; \
1cf5eda8
MM
919 char block_table[80], false_label[80]; \
920 \
921 ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \
922 ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \
923 \
924 xops[0] = const0_rtx; \
925 xops[1] = gen_rtx (SYMBOL_REF, VOIDmode, block_table); \
926 xops[2] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, false_label)); \
927 xops[3] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_init_func")); \
928 xops[4] = gen_rtx (MEM, Pmode, xops[1]); \
929 xops[5] = stack_pointer_rtx; \
930 xops[6] = GEN_INT (4); \
931 xops[7] = gen_rtx (REG, Pmode, 0); /* eax */ \
1cf5eda8
MM
932 \
933 CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \
934 CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; \
935 \
936 output_asm_insn (AS2(cmp%L4,%0,%4), xops); \
937 output_asm_insn (AS1(jne,%2), xops); \
938 \
939 if (!flag_pic) \
940 output_asm_insn (AS1(push%L1,%1), xops); \
941 else \
942 { \
1cf5eda8 943 output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \
8ecf187a 944 output_asm_insn (AS1 (push%L7,%7), xops); \
1cf5eda8
MM
945 } \
946 \
947 output_asm_insn (AS1(call,%P3), xops); \
948 output_asm_insn (AS2(add%L0,%6,%5), xops); \
949 ASM_OUTPUT_INTERNAL_LABEL (STREAM, "LPBZ", num_func); \
950 num_func++; \
951 } \
952while (0)
953
954
955/* A C statement or compound statement to increment the count
956 associated with the basic block number BLOCKNO. Basic blocks are
957 numbered separately from zero within each compilation. The count
958 associated with block number BLOCKNO is at index BLOCKNO in a
959 vector of words; the name of this array is a local symbol made
960 with this statement:
961
962 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
963
964 Of course, since you are writing the definition of
965 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
966 can take a short cut in the definition of this macro and use the
967 name that you know will result. */
968
969#define BLOCK_PROFILER(STREAM, BLOCKNO) \
970do \
971 { \
972 rtx xops[1], cnt_rtx; \
973 char counts[80]; \
974 \
975 ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); \
976 cnt_rtx = gen_rtx (SYMBOL_REF, VOIDmode, counts); \
05ca35c7 977 SYMBOL_REF_FLAG (cnt_rtx) = TRUE; \
1cf5eda8 978 \
05ca35c7
MM
979 if (BLOCKNO) \
980 cnt_rtx = plus_constant (cnt_rtx, (BLOCKNO)*4); \
981 \
982 if (flag_pic) \
983 cnt_rtx = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, cnt_rtx); \
984 \
985 xops[0] = gen_rtx (MEM, SImode, cnt_rtx); \
1cf5eda8
MM
986 output_asm_insn (AS1(inc%L0,%0), xops); \
987 } \
988while (0)
989
c98f8742
JVA
990/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
991 the stack pointer does not matter. The value is tested only in
992 functions that have frame pointers.
993 No definition is equivalent to always zero. */
994/* Note on the 386 it might be more efficient not to define this since
995 we have to restore it ourselves from the frame pointer, in order to
996 use pop */
997
998#define EXIT_IGNORE_STACK 1
999
1000/* This macro generates the assembly code for function exit,
1001 on machines that need it. If FUNCTION_EPILOGUE is not defined
1002 then individual return instructions are generated for each
1003 return statement. Args are same as for FUNCTION_PROLOGUE.
1004
1005 The function epilogue should not depend on the current stack pointer!
1006 It should use the frame pointer only. This is mandatory because
1007 of alloca; we also take advantage of it to omit stack adjustments
1008 before returning.
1009
1010 If the last non-note insn in the function is a BARRIER, then there
1011 is no need to emit a function prologue, because control does not fall
1012 off the end. This happens if the function ends in an "exit" call, or
1013 if a `return' insn is emitted directly into the function. */
1014
1015#define FUNCTION_EPILOGUE(FILE, SIZE) \
1016do { \
1017 rtx last = get_last_insn (); \
1018 if (last && GET_CODE (last) == NOTE) \
1019 last = prev_nonnote_insn (last); \
1020 if (! last || GET_CODE (last) != BARRIER) \
1021 function_epilogue (FILE, SIZE); \
1022} while (0)
1023
1024/* Output assembler code for a block containing the constant parts
1025 of a trampoline, leaving space for the variable parts. */
1026
1027/* On the 386, the trampoline contains three instructions:
1028 mov #STATIC,ecx
1029 mov #FUNCTION,eax
1030 jmp @eax */
8c2bf92a
JVA
1031#define TRAMPOLINE_TEMPLATE(FILE) \
1032{ \
1033 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb9)); \
1034 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1035 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1036 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb8)); \
1037 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1038 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1039 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xff)); \
1040 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xe0)); \
c98f8742
JVA
1041}
1042
1043/* Length in units of the trampoline for entering a nested function. */
1044
1045#define TRAMPOLINE_SIZE 12
1046
1047/* Emit RTL insns to initialize the variable parts of a trampoline.
1048 FNADDR is an RTX for the address of the function's pure code.
1049 CXT is an RTX for the static chain value for the function. */
1050
1051#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1052{ \
1053 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 1)), CXT); \
1054 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 6)), FNADDR); \
1055}
1056\f
1057/* Definitions for register eliminations.
1058
1059 This is an array of structures. Each structure initializes one pair
1060 of eliminable registers. The "from" register number is given first,
1061 followed by "to". Eliminations of the same "from" register are listed
1062 in order of preference.
1063
1064 We have two registers that can be eliminated on the i386. First, the
1065 frame pointer register can often be eliminated in favor of the stack
1066 pointer register. Secondly, the argument pointer register can always be
1067 eliminated; it is replaced with either the stack or frame pointer. */
1068
1069#define ELIMINABLE_REGS \
1070{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1071 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1072 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1073
1074/* Given FROM and TO register numbers, say whether this elimination is allowed.
1075 Frame pointer elimination is automatically handled.
1076
1077 For the i386, if frame pointer elimination is being done, we would like to
1078 convert ap into sp, not fp.
1079
1080 All other eliminations are valid. */
1081
1082#define CAN_ELIMINATE(FROM, TO) \
1083 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1084 ? ! frame_pointer_needed \
1085 : 1)
1086
1087/* Define the offset between two registers, one to be eliminated, and the other
1088 its replacement, at the start of a routine. */
1089
1090#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1091{ \
1092 if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1093 (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \
1094 else \
1095 { \
1096 int regno; \
1097 int offset = 0; \
1098 \
1099 for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
1100 if ((regs_ever_live[regno] && ! call_used_regs[regno]) \
1101 || (current_function_uses_pic_offset_table \
1102 && regno == PIC_OFFSET_TABLE_REGNUM)) \
1103 offset += 4; \
1104 \
1105 (OFFSET) = offset + get_frame_size (); \
1106 \
1107 if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1108 (OFFSET) += 4; /* Skip saved PC */ \
1109 } \
1110}
1111\f
1112/* Addressing modes, and classification of registers for them. */
1113
1114/* #define HAVE_POST_INCREMENT */
1115/* #define HAVE_POST_DECREMENT */
1116
1117/* #define HAVE_PRE_DECREMENT */
1118/* #define HAVE_PRE_INCREMENT */
1119
1120/* Macros to check register numbers against specific register classes. */
1121
1122/* These assume that REGNO is a hard or pseudo reg number.
1123 They give nonzero only if REGNO is a hard reg of the suitable class
1124 or a pseudo reg currently allocated to a suitable hard reg.
1125 Since they use reg_renumber, they are safe only once reg_renumber
1126 has been allocated, which happens in local-alloc.c. */
1127
1128#define REGNO_OK_FOR_INDEX_P(REGNO) \
1129 ((REGNO) < STACK_POINTER_REGNUM \
1130 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1131
1132#define REGNO_OK_FOR_BASE_P(REGNO) \
1133 ((REGNO) <= STACK_POINTER_REGNUM \
1134 || (REGNO) == ARG_POINTER_REGNUM \
1135 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1136
1137#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1138#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1139
1140/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1141 and check its validity for a certain class.
1142 We have two alternate definitions for each of them.
1143 The usual definition accepts all pseudo regs; the other rejects
1144 them unless they have been allocated suitable hard regs.
1145 The symbol REG_OK_STRICT causes the latter definition to be used.
1146
1147 Most source files want to accept pseudo regs in the hope that
1148 they will get allocated to the class that the insn wants them to be in.
1149 Source files for reload pass need to be strict.
1150 After reload, it makes no difference, since pseudo regs have
1151 been eliminated by then. */
1152
c98f8742 1153
3b3c6a3f
MM
1154/* Non strict versions, pseudos are ok */
1155#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1156 (REGNO (X) < STACK_POINTER_REGNUM \
c98f8742
JVA
1157 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1158
3b3c6a3f
MM
1159#define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1160 (REGNO (X) <= STACK_POINTER_REGNUM \
1161 || REGNO (X) == ARG_POINTER_REGNUM \
1162 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
c98f8742 1163
3b3c6a3f 1164#define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
c98f8742
JVA
1165 (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1166
3b3c6a3f
MM
1167/* Strict versions, hard registers only */
1168#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1169#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1170#define REG_OK_FOR_STRREG_STRICT_P(X) \
c98f8742
JVA
1171 (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
1172
3b3c6a3f
MM
1173#ifndef REG_OK_STRICT
1174#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1175#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
1176#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
1177
1178#else
1179#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1180#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
1181#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
c98f8742
JVA
1182#endif
1183
1184/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1185 that is a valid memory address for an instruction.
1186 The MODE argument is the machine mode for the MEM expression
1187 that wants to use this address.
1188
1189 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1190 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1191
1192 See legitimize_pic_address in i386.c for details as to what
1193 constitutes a legitimate address when -fpic is used. */
1194
1195#define MAX_REGS_PER_ADDRESS 2
1196
6eff269e
BK
1197#define CONSTANT_ADDRESS_P(X) \
1198 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1199 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1200 || GET_CODE (X) == HIGH)
c98f8742
JVA
1201
1202/* Nonzero if the constant value X is a legitimate general operand.
1203 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1204
1205#define LEGITIMATE_CONSTANT_P(X) 1
1206
3b3c6a3f
MM
1207#ifdef REG_OK_STRICT
1208#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1209{ \
1210 if (legitimate_address_p (MODE, X, 1)) \
1211 goto ADDR; \
1212}
c98f8742 1213
3b3c6a3f
MM
1214#else
1215#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
c98f8742 1216{ \
3b3c6a3f 1217 if (legitimate_address_p (MODE, X, 0)) \
c98f8742 1218 goto ADDR; \
c98f8742
JVA
1219}
1220
3b3c6a3f
MM
1221#endif
1222
c98f8742
JVA
1223/* Try machine-dependent ways of modifying an illegitimate address
1224 to be legitimate. If we find one, return the new, valid address.
1225 This macro is used in only one place: `memory_address' in explow.c.
1226
1227 OLDX is the address as it was before break_out_memory_refs was called.
1228 In some cases it is useful to look at this to decide what needs to be done.
1229
1230 MODE and WIN are passed so that this macro can use
1231 GO_IF_LEGITIMATE_ADDRESS.
1232
1233 It is always safe for this macro to do nothing. It exists to recognize
1234 opportunities to optimize the output.
1235
1236 For the 80386, we handle X+REG by loading X into a register R and
1237 using R+REG. R will go in a general reg and indexing will be used.
1238 However, if REG is a broken-out memory address or multiplication,
1239 nothing needs to be done because REG can certainly go in a general reg.
1240
1241 When -fpic is used, special handling is needed for symbolic references.
1242 See comments by legitimize_pic_address in i386.c for details. */
1243
3b3c6a3f
MM
1244#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1245{ \
1246 rtx orig_x = (X); \
1247 (X) = legitimize_address (X, OLDX, MODE); \
1248 if (memory_address_p (MODE, X)) \
1249 goto WIN; \
1250}
c98f8742
JVA
1251
1252/* Nonzero if the constant value X is a legitimate general operand
1253 when generating PIC code. It is given that flag_pic is on and
1254 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1255
1256#define LEGITIMATE_PIC_OPERAND_P(X) \
1257 (! SYMBOLIC_CONST (X) \
1258 || (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)))
1259
1260#define SYMBOLIC_CONST(X) \
1261(GET_CODE (X) == SYMBOL_REF \
1262 || GET_CODE (X) == LABEL_REF \
1263 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1264
1265/* Go to LABEL if ADDR (a legitimate address expression)
1266 has an effect that depends on the machine mode it is used for.
1267 On the 80386, only postdecrement and postincrement address depend thus
1268 (the amount of decrement or increment being the length of the operand). */
1269#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1270 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1271\f
1272/* Define this macro if references to a symbol must be treated
1273 differently depending on something about the variable or
1274 function named by the symbol (such as what section it is in).
1275
b4ac57ab 1276 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
c98f8742
JVA
1277 so that we may access it directly in the GOT. */
1278
1279#define ENCODE_SECTION_INFO(DECL) \
1280do \
1281 { \
1282 if (flag_pic) \
1283 { \
b4ac57ab
RS
1284 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1285 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1286 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1287 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1288 || ! TREE_PUBLIC (DECL)); \
c98f8742
JVA
1289 } \
1290 } \
1291while (0)
d398b3b1
JVA
1292
1293/* Initialize data used by insn expanders. This is called from
1294 init_emit, once for each function, before code is generated.
1295 For 386, clear stack slot assignments remembered from previous
1296 functions. */
1297
1298#define INIT_EXPANDERS clear_386_stack_locals ()
638b724c
MM
1299
1300/* The `FINALIZE_PIC' macro serves as a hook to emit these special
1301 codes once the function is being compiled into assembly code, but
1302 not before. (It is not done before, because in the case of
1303 compiling an inline function, it would lead to multiple PIC
1304 prologues being included in functions which used inline functions
1305 and were compiled to assembly language.) */
1306
1307#define FINALIZE_PIC \
1308do \
1309 { \
1310 extern int current_function_uses_pic_offset_table; \
1311 \
1312 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
1313 } \
1314while (0)
1315
c98f8742
JVA
1316\f
1317/* Specify the machine mode that this machine uses
1318 for the index in the tablejump instruction. */
1319#define CASE_VECTOR_MODE Pmode
1320
1321/* Define this if the tablejump instruction expects the table
1322 to contain offsets from the address of the table.
1323 Do not define this if the table should contain absolute addresses. */
1324/* #define CASE_VECTOR_PC_RELATIVE */
1325
1326/* Specify the tree operation to be used to convert reals to integers.
1327 This should be changed to take advantage of fist --wfs ??
1328 */
1329#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1330
1331/* This is the kind of divide that is easiest to do in the general case. */
1332#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1333
1334/* Define this as 1 if `char' should by default be signed; else as 0. */
1335#define DEFAULT_SIGNED_CHAR 1
1336
1337/* Max number of bytes we can move from memory to memory
1338 in one reasonably fast instruction. */
1339#define MOVE_MAX 4
1340
1341/* MOVE_RATIO is the number of move instructions that is better than a
1342 block move. Make this large on i386, since the block move is very
1343 inefficient with small blocks, and the hard register needs of the
1344 block move require much reload work. */
1345#define MOVE_RATIO 5
1346
1347/* Define this if zero-extension is slow (more than one real instruction). */
1348/* #define SLOW_ZERO_EXTEND */
1349
1350/* Nonzero if access to memory by bytes is slow and undesirable. */
1351#define SLOW_BYTE_ACCESS 0
1352
1353/* Define if shifts truncate the shift count
1354 which implies one can omit a sign-extension or zero-extension
1355 of a shift count. */
1356/* One i386, shifts do truncate the count. But bit opcodes don't. */
1357
1358/* #define SHIFT_COUNT_TRUNCATED */
1359
1360/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1361 is done just by pretending it is already truncated. */
1362#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1363
1364/* We assume that the store-condition-codes instructions store 0 for false
1365 and some other value for true. This is the value stored for true. */
1366
1367#define STORE_FLAG_VALUE 1
1368
1369/* When a prototype says `char' or `short', really pass an `int'.
1370 (The 386 can't easily push less than an int.) */
1371
1372#define PROMOTE_PROTOTYPES
1373
1374/* Specify the machine mode that pointers have.
1375 After generation of rtl, the compiler makes no further distinction
1376 between pointers and any other objects of this machine mode. */
1377#define Pmode SImode
1378
1379/* A function address in a call instruction
1380 is a byte address (for indexing purposes)
1381 so give the MEM rtx a byte's mode. */
1382#define FUNCTION_MODE QImode
1383
1384/* Define this if addresses of constant functions
1385 shouldn't be put through pseudo regs where they can be cse'd.
1386 Desirable on the 386 because a CALL with a constant address is
1387 not much slower than one with a register address. */
1388#define NO_FUNCTION_CSE
1389
1390/* Provide the costs of a rtl expression. This is in the body of a
1391 switch on CODE. */
1392
13713781
TG
1393#define RTX_COSTS(X,CODE,OUTER_CODE) \
1394 case MULT: \
1395 return COSTS_N_INSNS (20); \
1396 case DIV: \
1397 case UDIV: \
1398 case MOD: \
1399 case UMOD: \
1400 return COSTS_N_INSNS (20); \
1401 case ASHIFTRT: \
1402 case LSHIFTRT: \
1403 case ASHIFT: \
1404 return (4 + rtx_cost (XEXP (X, 0), OUTER_CODE) \
1405 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1406 case PLUS: \
1407 if (GET_CODE (XEXP (X, 0)) == MULT \
1408 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1409 && (INTVAL (XEXP (XEXP (X, 0), 1)) == 2 \
1410 || INTVAL (XEXP (XEXP (X, 0), 1)) == 4 \
1411 || INTVAL (XEXP (XEXP (X, 0), 1)) == 8)) \
1412 return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1413 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
dce838e1 1414 break;
c98f8742
JVA
1415
1416
1417/* Compute the cost of computing a constant rtl expression RTX
1418 whose rtx-code is CODE. The body of this macro is a portion
1419 of a switch statement. If the code is computed here,
1420 return it with a return statement. Otherwise, break from the switch. */
1421
3bb22aee 1422#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
c98f8742
JVA
1423 case CONST_INT: \
1424 case CONST: \
1425 case LABEL_REF: \
1426 case SYMBOL_REF: \
1427 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 0; \
1428 case CONST_DOUBLE: \
1429 { \
7488be4e
JVA
1430 int code; \
1431 if (GET_MODE (RTX) == VOIDmode) \
1432 return 2; \
1433 code = standard_80387_constant_p (RTX); \
c98f8742
JVA
1434 return code == 1 ? 0 : \
1435 code == 2 ? 1 : \
1436 2; \
3bb22aee 1437 }
c98f8742
JVA
1438
1439/* Compute the cost of an address. This is meant to approximate the size
1440 and/or execution delay of an insn using that address. If the cost is
1441 approximated by the RTL complexity, including CONST_COSTS above, as
1442 is usually the case for CISC machines, this macro should not be defined.
1443 For aggressively RISCy machines, only one insn format is allowed, so
1444 this macro should be a constant. The value of this macro only matters
1445 for valid addresses.
1446
1447 For i386, it is better to use a complex address than let gcc copy
1448 the address into a reg and make a new pseudo. But not if the address
1449 requires to two regs - that would mean more pseudos with longer
1450 lifetimes. */
1451
1452#define ADDRESS_COST(RTX) \
1453 ((CONSTANT_P (RTX) \
1454 || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
1455 && REG_P (XEXP (RTX, 0)))) ? 0 \
1456 : REG_P (RTX) ? 1 \
1457 : 2)
1458\f
c572e5ba
JVA
1459/* Add any extra modes needed to represent the condition code.
1460
1461 For the i386, we need separate modes when floating-point equality
1462 comparisons are being done. */
1463
1464#define EXTRA_CC_MODES CCFPEQmode
1465
1466/* Define the names for the modes specified above. */
1467#define EXTRA_CC_NAMES "CCFPEQ"
1468
1469/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1470 return the mode to be used for the comparison.
1471
1472 For floating-point equality comparisons, CCFPEQmode should be used.
1473 VOIDmode should be used in all other cases. */
1474
b565a316 1475#define SELECT_CC_MODE(OP,X,Y) \
c572e5ba 1476 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
4cbb525c 1477 && ((OP) == EQ || (OP) == NE) ? CCFPEQmode : VOIDmode)
c572e5ba
JVA
1478
1479/* Define the information needed to generate branch and scc insns. This is
1480 stored from the compare operation. Note that we can't use "rtx" here
1481 since it hasn't been defined! */
1482
c572e5ba
JVA
1483extern struct rtx_def *(*i386_compare_gen)(), *(*i386_compare_gen_eq)();
1484
c98f8742
JVA
1485/* Tell final.c how to eliminate redundant test instructions. */
1486
1487/* Here we define machine-dependent flags and fields in cc_status
1488 (see `conditions.h'). */
1489
1490/* Set if the cc value is actually in the 80387, so a floating point
1491 conditional branch must be output. */
1492#define CC_IN_80387 04000
1493
1494/* Set if the CC value was stored in a nonstandard way, so that
1495 the state of equality is indicated by zero in the carry bit. */
1496#define CC_Z_IN_NOT_C 010000
1497
1498/* Store in cc_status the expressions
1499 that the condition codes will describe
1500 after execution of an instruction whose pattern is EXP.
1501 Do not alter them if the instruction would not alter the cc's. */
1502
1503#define NOTICE_UPDATE_CC(EXP, INSN) \
1504 notice_update_cc((EXP))
1505
1506/* Output a signed jump insn. Use template NORMAL ordinarily, or
1507 FLOAT following a floating point comparison.
1508 Use NO_OV following an arithmetic insn that set the cc's
1509 before a test insn that was deleted.
1510 NO_OV may be zero, meaning final should reinsert the test insn
1511 because the jump cannot be handled properly without it. */
1512
1513#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
1514{ \
1515 if (cc_prev_status.flags & CC_IN_80387) \
1516 return FLOAT; \
1517 if (cc_prev_status.flags & CC_NO_OVERFLOW) \
1518 return NO_OV; \
1519 return NORMAL; \
1520}
1521\f
1522/* Control the assembler format that we output, to the extent
1523 this does not vary between assemblers. */
1524
1525/* How to refer to registers in assembler output.
1526 This sequence is indexed by compiler's hard-register-number (see above). */
1527
1528/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
1529 For non floating point regs, the following are the HImode names.
1530
1531 For float regs, the stack top is sometimes referred to as "%st(0)"
9e06e321 1532 instead of just "%st". PRINT_REG handles this with the "y" code. */
c98f8742
JVA
1533
1534#define HI_REGISTER_NAMES \
1535{"ax","dx","cx","bx","si","di","bp","sp", \
1536 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","" }
1537
1538#define REGISTER_NAMES HI_REGISTER_NAMES
1539
1540/* Table of additional register names to use in user input. */
1541
1542#define ADDITIONAL_REGISTER_NAMES \
1543{ "eax", 0, "edx", 1, "ecx", 2, "ebx", 3, \
1544 "esi", 4, "edi", 5, "ebp", 6, "esp", 7, \
1545 "al", 0, "dl", 1, "cl", 2, "bl", 3, \
1546 "ah", 0, "dh", 1, "ch", 2, "bh", 3 }
1547
1548/* Note we are omitting these since currently I don't know how
1549to get gcc to use these, since they want the same but different
1550number as al, and ax.
1551*/
1552
b4ac57ab 1553/* note the last four are not really qi_registers, but
c98f8742
JVA
1554 the md will have to never output movb into one of them
1555 only a movw . There is no movb into the last four regs */
1556
1557#define QI_REGISTER_NAMES \
1558{"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
1559
1560/* These parallel the array above, and can be used to access bits 8:15
1561 of regs 0 through 3. */
1562
1563#define QI_HIGH_REGISTER_NAMES \
1564{"ah", "dh", "ch", "bh", }
1565
1566/* How to renumber registers for dbx and gdb. */
1567
1568/* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
1569#define DBX_REGISTER_NUMBER(n) \
1570((n) == 0 ? 0 : \
1571 (n) == 1 ? 2 : \
1572 (n) == 2 ? 1 : \
1573 (n) == 3 ? 3 : \
1574 (n) == 4 ? 6 : \
1575 (n) == 5 ? 7 : \
1576 (n) == 6 ? 4 : \
1577 (n) == 7 ? 5 : \
1578 (n) + 4)
1579
1580/* This is how to output the definition of a user-level label named NAME,
1581 such as the label on a static function or variable NAME. */
1582
1583#define ASM_OUTPUT_LABEL(FILE,NAME) \
1584 (assemble_name (FILE, NAME), fputs (":\n", FILE))
1585
1586/* This is how to output an assembler line defining a `double' constant. */
1587
0038aea6
JVA
1588#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1589do { long l[2]; \
1590 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
1591 if (sizeof (int) == sizeof (long)) \
1592 fprintf (FILE, "%s 0x%x,0x%x\n", ASM_LONG, l[0], l[1]); \
1593 else \
1594 fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
1595 } while (0)
c98f8742 1596
0038aea6
JVA
1597/* This is how to output a `long double' extended real constant. */
1598
1599#undef ASM_OUTPUT_LONG_DOUBLE
1600#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
1601do { long l[3]; \
1602 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
1603 if (sizeof (int) == sizeof (long)) \
1604 fprintf (FILE, "%s 0x%x,0x%x,0x%x\n", ASM_LONG, l[0], l[1], l[2]); \
1605 else \
1606 fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
1607 } while (0)
c98f8742
JVA
1608
1609/* This is how to output an assembler line defining a `float' constant. */
1610
0038aea6
JVA
1611#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1612do { long l; \
1613 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1614 if (sizeof (int) == sizeof (long)) \
1615 fprintf ((FILE), "%s 0x%x\n", ASM_LONG, l); \
1616 else \
1617 fprintf ((FILE), "%s 0x%lx\n", ASM_LONG, l); \
c98f8742
JVA
1618 } while (0)
1619
c98f8742
JVA
1620/* Store in OUTPUT a string (made with alloca) containing
1621 an assembler-name for a local static variable named NAME.
1622 LABELNO is an integer which is different for each call. */
1623
1624#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1625( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1626 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1627
1628
1629
1630/* This is how to output an assembler line defining an `int' constant. */
1631
1632#define ASM_OUTPUT_INT(FILE,VALUE) \
1633( fprintf (FILE, "%s ", ASM_LONG), \
1634 output_addr_const (FILE,(VALUE)), \
1635 putc('\n',FILE))
1636
1637/* Likewise for `char' and `short' constants. */
1638/* is this supposed to do align too?? */
1639
1640#define ASM_OUTPUT_SHORT(FILE,VALUE) \
1641( fprintf (FILE, "%s ", ASM_SHORT), \
1642 output_addr_const (FILE,(VALUE)), \
1643 putc('\n',FILE))
1644
1645/*
1646#define ASM_OUTPUT_SHORT(FILE,VALUE) \
1647( fprintf (FILE, "%s ", ASM_BYTE_OP), \
1648 output_addr_const (FILE,(VALUE)), \
1649 fputs (",", FILE), \
1650 output_addr_const (FILE,(VALUE)), \
1651 fputs (" >> 8\n",FILE))
1652*/
1653
1654
1655#define ASM_OUTPUT_CHAR(FILE,VALUE) \
1656( fprintf (FILE, "%s ", ASM_BYTE_OP), \
1657 output_addr_const (FILE, (VALUE)), \
1658 putc ('\n', FILE))
1659
1660/* This is how to output an assembler line for a numeric constant byte. */
1661
1662#define ASM_OUTPUT_BYTE(FILE,VALUE) \
1663 fprintf ((FILE), "%s 0x%x\n", ASM_BYTE_OP, (VALUE))
1664
1665/* This is how to output an insn to push a register on the stack.
1666 It need not be very fast code. */
1667
1668#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1669 fprintf (FILE, "\tpushl e%s\n", reg_names[REGNO])
1670
1671/* This is how to output an insn to pop a register from the stack.
1672 It need not be very fast code. */
1673
1674#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1675 fprintf (FILE, "\tpopl e%s\n", reg_names[REGNO])
1676
1677/* This is how to output an element of a case-vector that is absolute.
1678 */
1679
1680#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1681 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
1682
1683/* This is how to output an element of a case-vector that is relative.
1684 We don't use these on the 386 yet, because the ATT assembler can't do
1685 forward reference the differences.
1686 */
1687
1688#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1689 fprintf (FILE, "\t.word %s%d-%s%d\n",LPREFIX, VALUE,LPREFIX, REL)
1690
1691/* Define the parentheses used to group arithmetic operations
1692 in assembler code. */
1693
1694#define ASM_OPEN_PAREN ""
1695#define ASM_CLOSE_PAREN ""
1696
1697/* Define results of standard character escape sequences. */
1698#define TARGET_BELL 007
1699#define TARGET_BS 010
1700#define TARGET_TAB 011
1701#define TARGET_NEWLINE 012
1702#define TARGET_VT 013
1703#define TARGET_FF 014
1704#define TARGET_CR 015
74b42c8b 1705\f
c98f8742
JVA
1706/* Print operand X (an rtx) in assembler syntax to file FILE.
1707 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1708 The CODE z takes the size of operand from the following digit, and
1709 outputs b,w,or l respectively.
1710
1711 On the 80386, we use several such letters:
1712 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
0038aea6 1713 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
c98f8742
JVA
1714 R -- print the prefix for register names.
1715 z -- print the opcode suffix for the size of the current operand.
1716 * -- print a star (in certain assembler syntax)
1717 w -- print the operand as if it's a "word" (HImode) even if it isn't.
1718 b -- print the operand as if it's a byte (QImode) even if it isn't.
1719 c -- don't print special prefixes before constant operands. */
1720
1721#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1722 ((CODE) == '*')
1723
74b42c8b
RS
1724/* Print the name of a register based on its machine mode and number.
1725 If CODE is 'w', pretend the mode is HImode.
1726 If CODE is 'b', pretend the mode is QImode.
1727 If CODE is 'k', pretend the mode is SImode.
1728 If CODE is 'h', pretend the reg is the `high' byte register.
1729 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
1730
aa3e8d2a
JVA
1731extern char *hi_reg_name[];
1732extern char *qi_reg_name[];
1733extern char *qi_high_reg_name[];
1734
74b42c8b 1735#define PRINT_REG(X, CODE, FILE) \
aa3e8d2a
JVA
1736 do { if (REGNO (X) == ARG_POINTER_REGNUM) \
1737 abort (); \
74b42c8b
RS
1738 fprintf (FILE, "%s", RP); \
1739 switch ((CODE == 'w' ? 2 \
1740 : CODE == 'b' ? 1 \
1741 : CODE == 'k' ? 4 \
1742 : CODE == 'y' ? 3 \
1743 : CODE == 'h' ? 0 \
1744 : GET_MODE_SIZE (GET_MODE (X)))) \
1745 { \
1746 case 3: \
1747 if (STACK_TOP_P (X)) \
aa3e8d2a
JVA
1748 { \
1749 fputs ("st(0)", FILE); \
1750 break; \
1751 } \
1752 case 4: \
1753 case 8: \
0038aea6 1754 case 12: \
9e06e321 1755 if (! FP_REG_P (X)) fputs ("e", FILE); \
74b42c8b
RS
1756 case 2: \
1757 fputs (hi_reg_name[REGNO (X)], FILE); \
1758 break; \
1759 case 1: \
1760 fputs (qi_reg_name[REGNO (X)], FILE); \
1761 break; \
1762 case 0: \
1763 fputs (qi_high_reg_name[REGNO (X)], FILE); \
1764 break; \
1765 } \
1766 } while (0)
1767
c98f8742
JVA
1768#define PRINT_OPERAND(FILE, X, CODE) \
1769 print_operand (FILE, X, CODE)
c98f8742
JVA
1770
1771#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1772 print_operand_address (FILE, ADDR)
1773
aa3e8d2a
JVA
1774/* Print the name of a register for based on its machine mode and number.
1775 This macro is used to print debugging output.
1776 This macro is different from PRINT_REG in that it may be used in
1777 programs that are not linked with aux-output.o. */
1778
1779#define DEBUG_PRINT_REG(X, CODE, FILE) \
1780 do { static char *hi_name[] = HI_REGISTER_NAMES; \
1781 static char *qi_name[] = QI_REGISTER_NAMES; \
7488be4e 1782 fprintf (FILE, "%d %s", REGNO (X), RP); \
aa3e8d2a
JVA
1783 if (REGNO (X) == ARG_POINTER_REGNUM) \
1784 { fputs ("argp", FILE); break; } \
1785 if (STACK_TOP_P (X)) \
1786 { fputs ("st(0)", FILE); break; } \
b0ceea8c
RK
1787 if (FP_REG_P (X)) \
1788 { fputs (hi_name[REGNO(X)], FILE); break; } \
aa3e8d2a
JVA
1789 switch (GET_MODE_SIZE (GET_MODE (X))) \
1790 { \
b0ceea8c
RK
1791 default: \
1792 fputs ("e", FILE); \
aa3e8d2a
JVA
1793 case 2: \
1794 fputs (hi_name[REGNO (X)], FILE); \
1795 break; \
1796 case 1: \
1797 fputs (qi_name[REGNO (X)], FILE); \
1798 break; \
1799 } \
1800 } while (0)
1801
c98f8742
JVA
1802/* Output the prefix for an immediate operand, or for an offset operand. */
1803#define PRINT_IMMED_PREFIX(FILE) fputs (IP, (FILE))
1804#define PRINT_OFFSET_PREFIX(FILE) fputs (IP, (FILE))
1805
1806/* Routines in libgcc that return floats must return them in an fp reg,
1807 just as other functions do which return such values.
1808 These macros make that happen. */
1809
1810#define FLOAT_VALUE_TYPE float
1811#define INTIFY(FLOATVAL) FLOATVAL
1812
1813/* Nonzero if INSN magically clobbers register REGNO. */
1814
1815/* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) \
1816 (FP_REGNO_P (REGNO) \
1817 && (GET_CODE (INSN) == JUMP_INSN || GET_CODE (INSN) == BARRIER))
1818*/
1819
1820/* a letter which is not needed by the normal asm syntax, which
1821 we can use for operand syntax in the extended asm */
1822
1823#define ASM_OPERAND_LETTER '#'
1824\f
1825#define RET return ""
1826#define AT_SP(mode) (gen_rtx (MEM, (mode), stack_pointer_rtx))
1827\f
3b3c6a3f 1828/* Functions in i386.c */
f5316dfe
MM
1829extern void override_options ();
1830extern void order_regs_for_local_alloc ();
3b3c6a3f
MM
1831extern void output_op_from_reg ();
1832extern void output_to_reg ();
1833extern char *singlemove_string ();
1834extern char *output_move_double ();
b840bfb0
MM
1835extern char *output_move_memory ();
1836extern char *output_move_pushmem ();
3b3c6a3f
MM
1837extern int standard_80387_constant_p ();
1838extern char *output_move_const_single ();
1839extern int symbolic_operand ();
1840extern int call_insn_operand ();
1841extern int expander_call_insn_operand ();
1842extern int symbolic_reference_mentioned_p ();
1843extern void emit_pic_move ();
1844extern void function_prologue ();
1845extern int simple_386_epilogue ();
1846extern void function_epilogue ();
1847extern int legitimate_address_p ();
1848extern struct rtx_def *legitimize_pic_address ();
1849extern struct rtx_def *legitimize_address ();
1850extern void print_operand ();
1851extern void print_operand_address ();
1852extern void notice_update_cc ();
1853extern void split_di ();
1854extern int binary_387_op ();
1855extern int shift_op ();
1856extern int VOIDmode_compare_op ();
1857extern char *output_387_binary_op ();
1858extern char *output_fix_trunc ();
1859extern char *output_float_compare ();
1860extern char *output_fp_cc0_set ();
1861extern void save_386_machine_status ();
1862extern void restore_386_machine_status ();
1863extern void clear_386_stack_locals ();
1864extern struct rtx_def *assign_386_stack_local ();
1865
f5316dfe
MM
1866/* Variables in i386.c */
1867extern char *i386_reg_alloc_order; /* register allocation order */
1868extern char *hi_reg_name[]; /* names for 16 bit regs */
1869extern char *qi_reg_name[]; /* names for 8 bit regs (low) */
1870extern char *qi_high_reg_name[]; /* names for 8 bit regs (high) */
1871extern enum reg_class regclass_map[]; /* smalled class containing REGNO */
1872extern struct rtx_def *i386_compare_op0; /* operand 0 for comparisons */
1873extern struct rtx_def *i386_compare_op1; /* operand 1 for comparisons */
1874
3b3c6a3f 1875/* External variables used */
f5316dfe
MM
1876extern int optimize; /* optimization level */
1877extern int obey_regdecls; /* TRUE if stupid register allocation */
3b3c6a3f
MM
1878
1879/* External functions used */
1880extern struct rtx_def *force_operand ();
1881\f
c98f8742
JVA
1882/*
1883Local variables:
1884version-control: t
1885End:
1886*/
This page took 0.382616 seconds and 5 git commands to generate.