]> gcc.gnu.org Git - gcc.git/blame - gcc/config/i386/i386.h
i386.h (CPP_486_SPEC, [...]): New specs.
[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).
e5e809f4 3 Copyright (C) 1988, 92, 94, 95, 96, 97, 1998 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
97aadbb9 19the Free Software Foundation, 59 Temple Place - Suite 330,
d4ba09c0 20Boston, MA 02111-1307, USA. */
c98f8742
JVA
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
d4ba09c0
SC
55/* Define the specific costs for a given cpu */
56
57struct processor_costs {
58 int add; /* cost of an add instruction */
59 int lea; /* cost of a lea instruction */
60 int shift_var; /* variable shift costs */
61 int shift_const; /* constant shift costs */
62 int mult_init; /* cost of starting a multiply */
63 int mult_bit; /* cost of multiply per each bit set */
64 int divide; /* cost of a divide/mod */
65};
66
67extern struct processor_costs *ix86_cost;
68
c98f8742
JVA
69/* Run-time compilation parameters selecting different hardware subsets. */
70
71extern int target_flags;
72
73/* Macros used in the machine description to test the flags. */
74
ddd5a7c1 75/* configure can arrange to make this 2, to force a 486. */
35b528be
RS
76#ifndef TARGET_CPU_DEFAULT
77#define TARGET_CPU_DEFAULT 0
78#endif
79
3b3c6a3f
MM
80/* Masks for the -m switches */
81#define MASK_80387 000000000001 /* Hardware floating point */
33c1d53a
SC
82#define MASK_NOTUSED1 000000000002 /* bit not currently used */
83#define MASK_NOTUSED2 000000000004 /* bit not currently used */
3b3c6a3f 84#define MASK_RTD 000000000010 /* Use ret that pops args */
b08de47e 85#define MASK_ALIGN_DOUBLE 000000000020 /* align doubles to 2 word boundary */
3b3c6a3f
MM
86#define MASK_SVR3_SHLIB 000000000040 /* Uninit locals into bss */
87#define MASK_IEEE_FP 000000000100 /* IEEE fp comparisons */
88#define MASK_FLOAT_RETURNS 000000000200 /* Return float in st(0) */
89#define MASK_NO_FANCY_MATH_387 000000000400 /* Disable sin, cos, sqrt */
2f2fa5b1 90#define MASK_OMIT_LEAF_FRAME_POINTER 0x00000800 /* omit leaf frame pointers */
3b3c6a3f
MM
91 /* Temporary codegen switches */
92#define MASK_DEBUG_ADDR 000001000000 /* Debug GO_IF_LEGITIMATE_ADDRESS */
93#define MASK_NO_WIDE_MULTIPLY 000002000000 /* Disable 32x32->64 multiplies */
94#define MASK_NO_MOVE 000004000000 /* Don't generate mem->mem */
d4ba09c0
SC
95#define MASK_NO_PSEUDO 000010000000 /* Move op's args -> pseudos */
96#define MASK_DEBUG_ARG 000020000000 /* Debug function_arg */
f6f58ba3 97#define MASK_SCHEDULE_PROLOGUE 000040000000 /* Emit prologue as rtl */
8c9be447 98#define MASK_STACK_PROBE 000100000000 /* Enable stack probing */
3b3c6a3f
MM
99
100/* Use the floating point instructions */
101#define TARGET_80387 (target_flags & MASK_80387)
102
c98f8742
JVA
103/* Compile using ret insn that pops args.
104 This will not work unless you use prototypes at least
105 for all functions that can take varying numbers of args. */
3b3c6a3f
MM
106#define TARGET_RTD (target_flags & MASK_RTD)
107
b08de47e
MM
108/* Align doubles to a two word boundary. This breaks compatibility with
109 the published ABI's for structures containing doubles, but produces
110 faster code on the pentium. */
111#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
c98f8742 112
d7cd15e9
RS
113/* Put uninitialized locals into bss, not data.
114 Meaningful only on svr3. */
3b3c6a3f 115#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
d7cd15e9 116
c572e5ba
JVA
117/* Use IEEE floating point comparisons. These handle correctly the cases
118 where the result of a comparison is unordered. Normally SIGFPE is
119 generated in such cases, in which case this isn't needed. */
3b3c6a3f 120#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
c572e5ba 121
8c2bf92a
JVA
122/* Functions that return a floating point value may return that value
123 in the 387 FPU or in 386 integer registers. If set, this flag causes
124 the 387 to be used, which is compatible with most calling conventions. */
3b3c6a3f 125#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
8c2bf92a 126
099800e3
RK
127/* Disable generation of FP sin, cos and sqrt operations for 387.
128 This is because FreeBSD lacks these in the math-emulator-code */
3b3c6a3f
MM
129#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
130
2f2fa5b1
SC
131/* Don't create frame pointers for leaf functions */
132#define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
133
3b3c6a3f
MM
134/* Temporary switches for tuning code generation */
135
136/* Disable 32x32->64 bit multiplies that are used for long long multiplies
137 and division by constants, but sometimes cause reload problems. */
138#define TARGET_NO_WIDE_MULTIPLY (target_flags & MASK_NO_WIDE_MULTIPLY)
139#define TARGET_WIDE_MULTIPLY (!TARGET_NO_WIDE_MULTIPLY)
140
f6f58ba3
SC
141/* Emit/Don't emit prologue as rtl */
142#define TARGET_SCHEDULE_PROLOGUE (target_flags & MASK_SCHEDULE_PROLOGUE)
143
3b3c6a3f
MM
144/* Debug GO_IF_LEGITIMATE_ADDRESS */
145#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
146
b08de47e
MM
147/* Debug FUNCTION_ARG macros */
148#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
149
3b3c6a3f
MM
150/* Hack macros for tuning code generation */
151#define TARGET_MOVE ((target_flags & MASK_NO_MOVE) == 0) /* Don't generate memory->memory */
d4ba09c0
SC
152#define TARGET_PSEUDO ((target_flags & MASK_NO_PSEUDO) == 0) /* Move op's args into pseudos */
153
f7746310
SC
154#define TARGET_386 (ix86_cpu == PROCESSOR_I386)
155#define TARGET_486 (ix86_cpu == PROCESSOR_I486)
156#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
3a0433fd 157#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
f7746310 158#define TARGET_USE_LEAVE (ix86_cpu == PROCESSOR_I386)
241e1a89 159#define TARGET_PUSH_MEMORY (ix86_cpu == PROCESSOR_I386)
5bc7cd8e
SC
160#define TARGET_ZERO_EXTEND_WITH_AND (ix86_cpu != PROCESSOR_I386 \
161 && ix86_cpu != PROCESSOR_PENTIUMPRO)
241e1a89 162#define TARGET_DOUBLE_WITH_ADD (ix86_cpu != PROCESSOR_I386)
f7746310
SC
163#define TARGET_USE_BIT_TEST (ix86_cpu == PROCESSOR_I386)
164#define TARGET_UNROLL_STRLEN (ix86_cpu != PROCESSOR_I386)
3c67a76b
SC
165#define TARGET_USE_Q_REG (ix86_cpu == PROCESSOR_PENTIUM \
166 || ix86_cpu == PROCESSOR_PENTIUMPRO)
f7746310 167#define TARGET_USE_ANY_REG (ix86_cpu == PROCESSOR_I486)
bcd86433 168#define TARGET_CMOVE (ix86_arch == PROCESSOR_PENTIUMPRO)
2f2fa5b1 169#define TARGET_DEEP_BRANCH_PREDICTION (ix86_cpu == PROCESSOR_PENTIUMPRO)
8c9be447 170#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
3b3c6a3f
MM
171
172#define TARGET_SWITCHES \
173{ { "80387", MASK_80387 }, \
174 { "no-80387", -MASK_80387 }, \
175 { "hard-float", MASK_80387 }, \
176 { "soft-float", -MASK_80387 }, \
177 { "no-soft-float", MASK_80387 }, \
241e1a89
SC
178 { "386", 0 }, \
179 { "no-386", 0 }, \
180 { "486", 0 }, \
181 { "no-486", 0 }, \
182 { "pentium", 0 }, \
183 { "pentiumpro", 0 }, \
3b3c6a3f
MM
184 { "rtd", MASK_RTD }, \
185 { "no-rtd", -MASK_RTD }, \
b08de47e
MM
186 { "align-double", MASK_ALIGN_DOUBLE }, \
187 { "no-align-double", -MASK_ALIGN_DOUBLE }, \
3b3c6a3f
MM
188 { "svr3-shlib", MASK_SVR3_SHLIB }, \
189 { "no-svr3-shlib", -MASK_SVR3_SHLIB }, \
190 { "ieee-fp", MASK_IEEE_FP }, \
191 { "no-ieee-fp", -MASK_IEEE_FP }, \
192 { "fp-ret-in-387", MASK_FLOAT_RETURNS }, \
193 { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS }, \
194 { "no-fancy-math-387", MASK_NO_FANCY_MATH_387 }, \
195 { "fancy-math-387", -MASK_NO_FANCY_MATH_387 }, \
2f2fa5b1
SC
196 { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER }, \
197 { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER }, \
3b3c6a3f
MM
198 { "no-wide-multiply", MASK_NO_WIDE_MULTIPLY }, \
199 { "wide-multiply", -MASK_NO_WIDE_MULTIPLY }, \
f6f58ba3
SC
200 { "schedule-prologue", MASK_SCHEDULE_PROLOGUE }, \
201 { "no-schedule-prologue", -MASK_SCHEDULE_PROLOGUE }, \
3b3c6a3f
MM
202 { "debug-addr", MASK_DEBUG_ADDR }, \
203 { "no-debug-addr", -MASK_DEBUG_ADDR }, \
204 { "move", -MASK_NO_MOVE }, \
205 { "no-move", MASK_NO_MOVE }, \
b08de47e
MM
206 { "debug-arg", MASK_DEBUG_ARG }, \
207 { "no-debug-arg", -MASK_DEBUG_ARG }, \
8c9be447
RK
208 { "stack-arg-probe", MASK_STACK_PROBE }, \
209 { "no-stack-arg-probe", -MASK_STACK_PROBE }, \
956d6950
JL
210 { "windows", 0 }, \
211 { "dll", 0 }, \
3b3c6a3f 212 SUBTARGET_SWITCHES \
f6f58ba3 213 { "", MASK_SCHEDULE_PROLOGUE | TARGET_DEFAULT}}
241e1a89 214
d4ba09c0
SC
215/* Which processor to schedule for. The cpu attribute defines a list that
216 mirrors this list, so changes to i386.md must be made at the same time. */
217
241e1a89
SC
218enum processor_type
219 {PROCESSOR_I386, /* 80386 */
220 PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
221 PROCESSOR_PENTIUM,
222 PROCESSOR_PENTIUMPRO};
223
224#define PROCESSOR_I386_STRING "i386"
225#define PROCESSOR_I486_STRING "i486"
226#define PROCESSOR_I586_STRING "i586"
227#define PROCESSOR_PENTIUM_STRING "pentium"
228#define PROCESSOR_I686_STRING "i686"
229#define PROCESSOR_PENTIUMPRO_STRING "pentiumpro"
230
231extern enum processor_type ix86_cpu;
232
bcd86433 233extern int ix86_arch;
241e1a89
SC
234
235/* Define the default processor. This is overridden by other tm.h files. */
236#define PROCESSOR_DEFAULT \
237 ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_I486) \
238 ? PROCESSOR_I486 \
239 : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUM) \
240 ? PROCESSOR_PENTIUM \
241 : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUMPRO) \
242 ? PROCESSOR_PENTIUMPRO \
243 : PROCESSOR_I386
244#define PROCESSOR_DEFAULT_STRING \
245 ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_I486) \
246 ? PROCESSOR_I486_STRING \
247 : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUM) \
248 ? PROCESSOR_PENTIUM_STRING \
249 : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUMPRO) \
250 ? PROCESSOR_PENTIUMPRO_STRING \
251 : PROCESSOR_I386_STRING
95393dfd 252
f5316dfe
MM
253/* This macro is similar to `TARGET_SWITCHES' but defines names of
254 command options that have values. Its definition is an
255 initializer with a subgrouping for each command option.
256
257 Each subgrouping contains a string constant, that defines the
258 fixed part of the option name, and the address of a variable. The
259 variable, type `char *', is set to the variable part of the given
260 option if the fixed part matches. The actual option name is made
261 by appending `-m' to the specified name. */
262#define TARGET_OPTIONS \
241e1a89 263{ { "cpu=", &ix86_cpu_string}, \
bcd86433 264 { "arch=", &ix86_arch_string}, \
241e1a89 265 { "reg-alloc=", &i386_reg_alloc_order }, \
b08de47e
MM
266 { "regparm=", &i386_regparm_string }, \
267 { "align-loops=", &i386_align_loops_string }, \
268 { "align-jumps=", &i386_align_jumps_string }, \
269 { "align-functions=", &i386_align_funcs_string }, \
e2a606cb 270 { "branch-cost=", &i386_branch_cost_string }, \
b08de47e
MM
271 SUBTARGET_OPTIONS \
272}
f5316dfe
MM
273
274/* Sometimes certain combinations of command options do not make
275 sense on a particular target machine. You can define a macro
276 `OVERRIDE_OPTIONS' to take account of this. This macro, if
277 defined, is executed once just after all the command options have
278 been parsed.
279
280 Don't use this macro to turn on various extra optimizations for
281 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
282
283#define OVERRIDE_OPTIONS override_options ()
284
285/* These are meant to be redefined in the host dependent files */
95393dfd 286#define SUBTARGET_SWITCHES
f5316dfe 287#define SUBTARGET_OPTIONS
95393dfd 288
d4ba09c0 289/* Define this to change the optimizations performed by default. */
c6aded7c 290#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
d4ba09c0 291
241e1a89
SC
292/* Specs for the compiler proper */
293
628714d8
RK
294#ifndef CC1_CPU_SPEC
295#define CC1_CPU_SPEC "\
241e1a89 296%{!mcpu*: \
2f2fa5b1
SC
297%{m386:-mcpu=i386 -march=i386} \
298%{mno-486:-mcpu=i386 -march=i386} \
299%{m486:-mcpu=i486 -march=i486} \
300%{mno-386:-mcpu=i486 -march=i486} \
301%{mno-pentium:-mcpu=i486 -march=i486} \
241e1a89 302%{mpentium:-mcpu=pentium} \
2f2fa5b1 303%{mno-pentiumpro:-mcpu=pentium} \
241e1a89
SC
304%{mpentiumpro:-mcpu=pentiumpro}}"
305#endif
c98f8742 306\f
1228a9bd
JW
307#define CPP_486_SPEC "%{!ansi:-Di486} -D__i486 -D__i486__"
308#define CPP_586_SPEC "%{!ansi:-Di586 -Dpentium} \
309 -D__i586 -D__i586__ -D__pentium -D__pentium__"
310#define CPP_686_SPEC "%{!ansi:-Di686 -Dpentiumpro} \
311 -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__"
312
84b77fba 313#ifndef CPP_CPU_DEFAULT_SPEC
d5c65c96 314#if TARGET_CPU_DEFAULT == 1
1228a9bd 315#define CPP_CPU_DEFAULT_SPEC "%(cpp_486)"
da594c94
JL
316#else
317#if TARGET_CPU_DEFAULT == 2
1228a9bd 318#define CPP_CPU_DEFAULT_SPEC "%(cpp_586)"
da594c94
JL
319#else
320#if TARGET_CPU_DEFAULT == 3
1228a9bd 321#define CPP_CPU_DEFAULT_SPEC "%(cpp_686)"
d5c65c96 322#else
84b77fba 323#define CPP_CPU_DEFAULT_SPEC ""
da594c94
JL
324#endif
325#endif
84b77fba
JW
326#endif
327#endif /* CPP_CPU_DEFAULT_SPEC */
33c1d53a 328
84b77fba 329#ifndef CPP_CPU_SPEC
bcd86433 330#define CPP_CPU_SPEC "\
1228a9bd
JW
331-Asystem(unix) -Acpu(i386) -Amachine(i386) \
332%{!ansi:-Di386} -D__i386 -D__i386__ \
333%{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} \
334%{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} \
335%{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} \
336%{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}"
84b77fba 337#endif
bcd86433 338
628714d8
RK
339#ifndef CC1_SPEC
340#define CC1_SPEC "%(cc1_spec) "
341#endif
342
343/* This macro defines names of additional specifications to put in the
344 specs that can be used in various specifications like CC1_SPEC. Its
345 definition is an initializer with a subgrouping for each command option.
bcd86433
SC
346
347 Each subgrouping contains a string constant, that defines the
348 specification name, and a string constant that used by the GNU CC driver
349 program.
350
351 Do not define this macro if it does not need to do anything. */
352
353#ifndef SUBTARGET_EXTRA_SPECS
354#define SUBTARGET_EXTRA_SPECS
355#endif
356
357#define EXTRA_SPECS \
1228a9bd
JW
358 { "cpp_486", CPP_486_SPEC}, \
359 { "cpp_586", CPP_586_SPEC}, \
360 { "cpp_686", CPP_686_SPEC}, \
84b77fba 361 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
bcd86433 362 { "cpp_cpu", CPP_CPU_SPEC }, \
628714d8 363 { "cc1_cpu", CC1_CPU_SPEC }, \
bcd86433
SC
364 SUBTARGET_EXTRA_SPECS
365\f
c98f8742
JVA
366/* target machine storage layout */
367
0038aea6
JVA
368/* Define for XFmode extended real floating point support.
369 This will automatically cause REAL_ARITHMETIC to be defined. */
370#define LONG_DOUBLE_TYPE_SIZE 96
371
372/* Define if you don't want extended real, but do want to use the
373 software floating point emulator for REAL_ARITHMETIC and
374 decimal <-> binary conversion. */
375/* #define REAL_ARITHMETIC */
376
c98f8742
JVA
377/* Define this if most significant byte of a word is the lowest numbered. */
378/* That is true on the 80386. */
379
380#define BITS_BIG_ENDIAN 0
381
382/* Define this if most significant byte of a word is the lowest numbered. */
383/* That is not true on the 80386. */
384#define BYTES_BIG_ENDIAN 0
385
386/* Define this if most significant word of a multiword number is the lowest
387 numbered. */
388/* Not true for 80386 */
389#define WORDS_BIG_ENDIAN 0
390
b4ac57ab 391/* number of bits in an addressable storage unit */
c98f8742
JVA
392#define BITS_PER_UNIT 8
393
394/* Width in bits of a "word", which is the contents of a machine register.
395 Note that this is not necessarily the width of data type `int';
396 if using 16-bit ints on a 80386, this would still be 32.
397 But on a machine with 16-bit registers, this would be 16. */
398#define BITS_PER_WORD 32
399
400/* Width of a word, in units (bytes). */
401#define UNITS_PER_WORD 4
402
403/* Width in bits of a pointer.
404 See also the macro `Pmode' defined below. */
405#define POINTER_SIZE 32
406
407/* Allocation boundary (in *bits*) for storing arguments in argument list. */
408#define PARM_BOUNDARY 32
409
410/* Boundary (in *bits*) on which stack pointer should be aligned. */
d5c65c96 411#define STACK_BOUNDARY 32
c98f8742
JVA
412
413/* Allocation boundary (in *bits*) for the code of a function.
414 For i486, we get better performance by aligning to a cache
415 line (i.e. 16 byte) boundary. */
b08de47e 416#define FUNCTION_BOUNDARY (1 << (i386_align_funcs + 3))
c98f8742
JVA
417
418/* Alignment of field after `int : 0' in a structure. */
419
420#define EMPTY_FIELD_BOUNDARY 32
421
422/* Minimum size in bits of the largest boundary to which any
423 and all fundamental data types supported by the hardware
424 might need to be aligned. No data type wants to be aligned
425 rounder than this. The i386 supports 64-bit floating point
b08de47e
MM
426 quantities, but these can be aligned on any 32-bit boundary.
427 The published ABIs say that doubles should be aligned on word
428 boundaries, but the Pentium gets better performance with them
429 aligned on 64 bit boundaries. */
430#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
c98f8742 431
e5e8a8bf
JW
432/* If defined, a C expression to compute the alignment given to a
433 constant that is being placed in memory. CONSTANT is the constant
434 and ALIGN is the alignment that the object would ordinarily have.
435 The value of this macro is used instead of that alignment to align
436 the object.
437
438 If this macro is not defined, then ALIGN is used.
439
440 The typical use of this macro is to increase alignment for string
441 constants to be word aligned so that `strcpy' calls that copy
442 constants can be done inline. */
443
444#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
445 (TREE_CODE (EXP) == REAL_CST \
446 ? ((TYPE_MODE (TREE_TYPE (EXP)) == DFmode && (ALIGN) < 64) \
447 ? 64 \
448 : (TYPE_MODE (TREE_TYPE (EXP)) == XFmode && (ALIGN) < 128) \
449 ? 128 \
450 : (ALIGN)) \
451 : TREE_CODE (EXP) == STRING_CST \
452 ? ((TREE_STRING_LENGTH (EXP) >= 31 && (ALIGN) < 256) \
453 ? 256 \
454 : (ALIGN)) \
455 : (ALIGN))
d4ba09c0 456
8a022443
JW
457/* If defined, a C expression to compute the alignment for a static
458 variable. TYPE is the data type, and ALIGN is the alignment that
459 the object would ordinarily have. The value of this macro is used
460 instead of that alignment to align the object.
461
462 If this macro is not defined, then ALIGN is used.
463
464 One use of this macro is to increase alignment of medium-size
465 data to make it all fit in fewer cache lines. Another is to
466 cause character arrays to be word-aligned so that `strcpy' calls
467 that copy constants to character arrays can be done inline. */
468
469#define DATA_ALIGNMENT(TYPE, ALIGN) \
470 ((AGGREGATE_TYPE_P (TYPE) \
471 && TYPE_SIZE (TYPE) \
472 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
473 && (TREE_INT_CST_LOW (TYPE_SIZE (TYPE)) >= 256 \
474 || TREE_INT_CST_HIGH (TYPE_SIZE (TYPE))) && (ALIGN) < 256) \
475 ? 256 \
476 : TREE_CODE (TYPE) == ARRAY_TYPE \
477 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
478 ? 64 \
479 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
480 ? 128 \
481 : (ALIGN)) \
482 : TREE_CODE (TYPE) == COMPLEX_TYPE \
483 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
484 ? 64 \
485 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
486 ? 128 \
487 : (ALIGN)) \
488 : ((TREE_CODE (TYPE) == RECORD_TYPE \
489 || TREE_CODE (TYPE) == UNION_TYPE \
490 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
491 && TYPE_FIELDS (TYPE)) \
492 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
493 ? 64 \
494 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
495 ? 128 \
496 : (ALIGN)) \
497 : TREE_CODE (TYPE) == REAL_TYPE \
498 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
499 ? 64 \
500 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
501 ? 128 \
502 : (ALIGN)) \
503 : (ALIGN))
504
b4ac57ab 505/* Set this non-zero if move instructions will actually fail to work
c98f8742 506 when given unaligned data. */
b4ac57ab 507#define STRICT_ALIGNMENT 0
c98f8742
JVA
508
509/* If bit field type is int, don't let it cross an int,
510 and give entire struct the alignment of an int. */
511/* Required on the 386 since it doesn't have bitfield insns. */
512#define PCC_BITFIELD_TYPE_MATTERS 1
513
b08de47e
MM
514/* Maximum power of 2 that code can be aligned to. */
515#define MAX_CODE_ALIGN 6 /* 64 byte alignment */
516
c98f8742 517/* Align loop starts for optimal branching. */
fc470718 518#define LOOP_ALIGN(LABEL) (i386_align_loops)
9e423e6d 519#define LOOP_ALIGN_MAX_SKIP (i386_align_loops_string ? 0 : 7)
c98f8742
JVA
520
521/* This is how to align an instruction for optimal branching.
522 On i486 we'll get better performance by aligning on a
523 cache line (i.e. 16 byte) boundary. */
fc470718 524#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (i386_align_jumps)
9e423e6d 525#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP (i386_align_jumps_string ? 0 : 7)
b08de47e 526
c98f8742
JVA
527\f
528/* Standard register usage. */
529
530/* This processor has special stack-like registers. See reg-stack.c
531 for details. */
532
533#define STACK_REGS
d4ba09c0 534#define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode)
c98f8742
JVA
535
536/* Number of actual hardware registers.
537 The hardware registers are assigned numbers for the compiler
538 from 0 to just below FIRST_PSEUDO_REGISTER.
539 All registers that the compiler knows about must be given numbers,
540 even those that are not normally considered general registers.
541
542 In the 80386 we give the 8 general purpose registers the numbers 0-7.
543 We number the floating point registers 8-15.
544 Note that registers 0-7 can be accessed as a short or int,
545 while only 0-3 may be used with byte `mov' instructions.
546
547 Reg 16 does not correspond to any hardware register, but instead
548 appears in the RTL as an argument pointer prior to reload, and is
549 eliminated during reloading in favor of either the stack or frame
550 pointer. */
551
552#define FIRST_PSEUDO_REGISTER 17
553
554/* 1 for registers that have pervasive standard uses
555 and are not available for the register allocator.
556 On the 80386, the stack pointer is such, as is the arg pointer. */
557#define FIXED_REGISTERS \
558/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
559{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
560
561/* 1 for registers not available across function calls.
562 These must include the FIXED_REGISTERS and also any
563 registers that can be used without being saved.
564 The latter must include the registers where values are returned
565 and the register where structure-value addresses are passed.
566 Aside from that, you can include as many other registers as you like. */
567
568#define CALL_USED_REGISTERS \
569/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
570{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
571
3b3c6a3f
MM
572/* Order in which to allocate registers. Each register must be
573 listed once, even those in FIXED_REGISTERS. List frame pointer
574 late and fixed registers last. Note that, in general, we prefer
575 registers listed in CALL_USED_REGISTERS, keeping the others
576 available for storage of persistent values.
577
578 Three different versions of REG_ALLOC_ORDER have been tried:
579
580 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
581 but slower code on simple functions returning values in eax.
582
583 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
584 perl 4.036 due to not being able to create a DImode register (to hold a 2
585 word union).
586
587 If the order is eax, edx, ecx, ... it produces better code for simple
588 functions, and a slightly slower compiler. Users complained about the code
589 generated by allocating edx first, so restore the 'natural' order of things. */
590
184ff798 591#define REG_ALLOC_ORDER \
f5316dfe
MM
592/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
593{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
594
595/* A C statement (sans semicolon) to choose the order in which to
596 allocate hard registers for pseudo-registers local to a basic
597 block.
598
599 Store the desired register order in the array `reg_alloc_order'.
600 Element 0 should be the register to allocate first; element 1, the
601 next register; and so on.
602
603 The macro body should not assume anything about the contents of
604 `reg_alloc_order' before execution of the macro.
605
606 On most machines, it is not necessary to define this macro. */
607
608#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
184ff798 609
c98f8742
JVA
610/* Macro to conditionally modify fixed_regs/call_used_regs. */
611#define CONDITIONAL_REGISTER_USAGE \
612 { \
613 if (flag_pic) \
614 { \
615 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
616 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
617 } \
8c2bf92a
JVA
618 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
619 { \
620 int i; \
621 HARD_REG_SET x; \
622 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
623 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
624 if (TEST_HARD_REG_BIT (x, i)) \
625 fixed_regs[i] = call_used_regs[i] = 1; \
626 } \
c98f8742
JVA
627 }
628
629/* Return number of consecutive hard regs needed starting at reg REGNO
630 to hold something of mode MODE.
631 This is ordinarily the length in words of a value of mode MODE
632 but can be less for certain modes in special long registers.
633
634 Actually there are no two word move instructions for consecutive
635 registers. And only registers 0-3 may have mov byte instructions
636 applied to them.
637 */
638
639#define HARD_REGNO_NREGS(REGNO, MODE) \
640 (FP_REGNO_P (REGNO) ? 1 \
641 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
642
643/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
644 On the 80386, the first 4 cpu registers can hold any mode
645 while the floating point registers may hold only floating point.
646 Make it clear that the fp regs could not hold a 16-byte float. */
647
48227a2c
RS
648/* The casts to int placate a compiler on a microvax,
649 for cross-compiler testing. */
650
c98f8742 651#define HARD_REGNO_MODE_OK(REGNO, MODE) \
95912252 652 ((REGNO) < 4 ? 1 \
0038aea6 653 : FP_REGNO_P (REGNO) \
48227a2c
RS
654 ? (((int) GET_MODE_CLASS (MODE) == (int) MODE_FLOAT \
655 || (int) GET_MODE_CLASS (MODE) == (int) MODE_COMPLEX_FLOAT) \
62acf5fd 656 && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\
b73c3f2a
SC
657 : (int) (MODE) != (int) QImode ? 1 \
658 : (reload_in_progress | reload_completed) == 1)
c98f8742
JVA
659
660/* Value is 1 if it is a good idea to tie two pseudo registers
661 when one has mode MODE1 and one has mode MODE2.
662 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
663 for any hard reg, then this must be 0 for correct output. */
664
95912252
RH
665#define MODES_TIEABLE_P(MODE1, MODE2) \
666 ((MODE1) == (MODE2) \
667 || ((MODE1) == SImode && (MODE2) == HImode \
668 || (MODE1) == HImode && (MODE2) == SImode))
c98f8742 669
c98f8742
JVA
670/* Specify the registers used for certain standard purposes.
671 The values of these macros are register numbers. */
672
673/* on the 386 the pc register is %eip, and is not usable as a general
674 register. The ordinary mov instructions won't work */
675/* #define PC_REGNUM */
676
677/* Register to use for pushing function arguments. */
678#define STACK_POINTER_REGNUM 7
679
680/* Base register for access to local variables of the function. */
681#define FRAME_POINTER_REGNUM 6
682
683/* First floating point reg */
684#define FIRST_FLOAT_REG 8
685
686/* First & last stack-like regs */
687#define FIRST_STACK_REG FIRST_FLOAT_REG
688#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
689
690/* Value should be nonzero if functions must have frame pointers.
691 Zero means the frame pointer need not be set up (and parms
692 may be accessed via the stack pointer) in functions that seem suitable.
693 This is computed in `reload', in reload1.c. */
2f2fa5b1 694#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
c98f8742
JVA
695
696/* Base register for access to arguments of the function. */
697#define ARG_POINTER_REGNUM 16
698
699/* Register in which static-chain is passed to a function. */
700#define STATIC_CHAIN_REGNUM 2
701
702/* Register to hold the addressing base for position independent
703 code access to data items. */
704#define PIC_OFFSET_TABLE_REGNUM 3
705
706/* Register in which address to store a structure value
707 arrives in the function. On the 386, the prologue
708 copies this from the stack to register %eax. */
709#define STRUCT_VALUE_INCOMING 0
710
711/* Place in which caller passes the structure value address.
712 0 means push the value on the stack like an argument. */
713#define STRUCT_VALUE 0
713225d4
MM
714
715/* A C expression which can inhibit the returning of certain function
716 values in registers, based on the type of value. A nonzero value
717 says to return the function value in memory, just as large
718 structures are always returned. Here TYPE will be a C expression
719 of type `tree', representing the data type of the value.
720
721 Note that values of mode `BLKmode' must be explicitly handled by
722 this macro. Also, the option `-fpcc-struct-return' takes effect
723 regardless of this macro. On most systems, it is possible to
724 leave the macro undefined; this causes a default definition to be
725 used, whose value is the constant 1 for `BLKmode' values, and 0
726 otherwise.
727
728 Do not use this macro to indicate that structures and unions
729 should always be returned in memory. You should instead use
730 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
731
732#define RETURN_IN_MEMORY(TYPE) \
733 ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
734
c98f8742
JVA
735\f
736/* Define the classes of registers for register constraints in the
737 machine description. Also define ranges of constants.
738
739 One of the classes must always be named ALL_REGS and include all hard regs.
740 If there is more than one class, another class must be named NO_REGS
741 and contain no registers.
742
743 The name GENERAL_REGS must be the name of a class (or an alias for
744 another name such as ALL_REGS). This is the class of registers
745 that is allowed by "g" or "r" in a register constraint.
746 Also, registers outside this class are allocated only when
747 instructions express preferences for them.
748
749 The classes must be numbered in nondecreasing order; that is,
750 a larger-numbered class must never be contained completely
751 in a smaller-numbered class.
752
753 For any two classes, it is very desirable that there be another
ab408a86
JVA
754 class that represents their union.
755
756 It might seem that class BREG is unnecessary, since no useful 386
757 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
758 and the "b" register constraint is useful in asms for syscalls. */
c98f8742
JVA
759
760enum reg_class
761{
762 NO_REGS,
ab408a86 763 AREG, DREG, CREG, BREG,
4b71cd6e 764 AD_REGS, /* %eax/%edx for DImode */
c98f8742
JVA
765 Q_REGS, /* %eax %ebx %ecx %edx */
766 SIREG, DIREG,
767 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
768 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
769 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
770 FLOAT_REGS,
771 ALL_REGS, LIM_REG_CLASSES
772};
773
774#define N_REG_CLASSES (int) LIM_REG_CLASSES
775
4cbb525c
JVA
776#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
777
c98f8742
JVA
778/* Give names of register classes as strings for dump file. */
779
780#define REG_CLASS_NAMES \
781{ "NO_REGS", \
ab408a86 782 "AREG", "DREG", "CREG", "BREG", \
4b71cd6e 783 "AD_REGS", \
c98f8742
JVA
784 "Q_REGS", \
785 "SIREG", "DIREG", \
786 "INDEX_REGS", \
787 "GENERAL_REGS", \
788 "FP_TOP_REG", "FP_SECOND_REG", \
789 "FLOAT_REGS", \
790 "ALL_REGS" }
791
792/* Define which registers fit in which classes.
793 This is an initializer for a vector of HARD_REG_SET
794 of length N_REG_CLASSES. */
795
796#define REG_CLASS_CONTENTS \
47f3558c
JL
797{ {0}, \
798 {0x1}, {0x2}, {0x4}, {0x8}, /* AREG, DREG, CREG, BREG */ \
799 {0x3}, /* AD_REGS */ \
800 {0xf}, /* Q_REGS */ \
801 {0x10}, {0x20}, /* SIREG, DIREG */ \
802 {0x7f}, /* INDEX_REGS */ \
803 {0x100ff}, /* GENERAL_REGS */ \
804 {0x0100}, {0x0200}, /* FP_TOP_REG, FP_SECOND_REG */ \
805 {0xff00}, /* FLOAT_REGS */ \
806 {0x1ffff}}
c98f8742
JVA
807
808/* The same information, inverted:
809 Return the class number of the smallest class containing
810 reg number REGNO. This could be a conditional expression
811 or could index an array. */
812
c98f8742
JVA
813#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
814
815/* When defined, the compiler allows registers explicitly used in the
816 rtl to be used as spill registers but prevents the compiler from
817 extending the lifetime of these registers. */
818
2922fe9e 819#define SMALL_REGISTER_CLASSES 1
c98f8742
JVA
820
821#define QI_REG_P(X) \
822 (REG_P (X) && REGNO (X) < 4)
823#define NON_QI_REG_P(X) \
824 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
825
826#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
827#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
828
829#define STACK_REG_P(xop) (REG_P (xop) && \
830 REGNO (xop) >= FIRST_STACK_REG && \
831 REGNO (xop) <= LAST_STACK_REG)
832
833#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
834
835#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
836
837/* Try to maintain the accuracy of the death notes for regs satisfying the
838 following. Important for stack like regs, to know when to pop. */
839
840/* #define PRESERVE_DEATH_INFO_REGNO_P(x) FP_REGNO_P(x) */
841
842/* 1 if register REGNO can magically overlap other regs.
843 Note that nonzero values work only in very special circumstances. */
844
845/* #define OVERLAPPING_REGNO_P(REGNO) FP_REGNO_P (REGNO) */
846
847/* The class value for index registers, and the one for base regs. */
848
849#define INDEX_REG_CLASS INDEX_REGS
850#define BASE_REG_CLASS GENERAL_REGS
851
852/* Get reg_class from a letter such as appears in the machine description. */
853
854#define REG_CLASS_FROM_LETTER(C) \
8c2bf92a
JVA
855 ((C) == 'r' ? GENERAL_REGS : \
856 (C) == 'q' ? Q_REGS : \
857 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
858 ? FLOAT_REGS \
859 : NO_REGS) : \
860 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
861 ? FP_TOP_REG \
862 : NO_REGS) : \
863 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
864 ? FP_SECOND_REG \
865 : NO_REGS) : \
866 (C) == 'a' ? AREG : \
867 (C) == 'b' ? BREG : \
868 (C) == 'c' ? CREG : \
869 (C) == 'd' ? DREG : \
4b71cd6e 870 (C) == 'A' ? AD_REGS : \
8c2bf92a 871 (C) == 'D' ? DIREG : \
c98f8742
JVA
872 (C) == 'S' ? SIREG : NO_REGS)
873
874/* The letters I, J, K, L and M in a register constraint string
875 can be used to stand for particular ranges of immediate operands.
876 This macro defines what the ranges are.
877 C is the letter, and VALUE is a constant value.
878 Return 1 if VALUE is in the range specified by C.
879
880 I is for non-DImode shifts.
881 J is for DImode shifts.
882 K and L are for an `andsi' optimization.
883 M is for shifts that can be executed by the "lea" opcode.
884 */
885
886#define CONST_OK_FOR_LETTER_P(VALUE, C) \
887 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 : \
888 (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \
889 (C) == 'K' ? (VALUE) == 0xff : \
890 (C) == 'L' ? (VALUE) == 0xffff : \
891 (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 : \
b4232589 892 (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255 :\
d4ba09c0 893 (C) == 'O' ? (VALUE) >= 0 && (VALUE) <= 32 : \
c98f8742
JVA
894 0)
895
896/* Similar, but for floating constants, and defining letters G and H.
b4ac57ab
RS
897 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
898 TARGET_387 isn't set, because the stack register converter may need to
899 load 0.0 into the function value register. */
c98f8742
JVA
900
901#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
b4ac57ab 902 ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
c98f8742
JVA
903
904/* Place additional restrictions on the register class to use when it
4cbb525c
JVA
905 is necessary to be able to hold a value of mode MODE in a reload
906 register for which class CLASS would ordinarily be used. */
c98f8742
JVA
907
908#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
909 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
910 ? Q_REGS : (CLASS))
911
912/* Given an rtx X being reloaded into a reg required to be
913 in class CLASS, return the class of reg to actually use.
914 In general this is just CLASS; but on some machines
915 in some cases it is preferable to use a more restrictive class.
916 On the 80386 series, we prevent floating constants from being
917 reloaded into floating registers (since no move-insn can do that)
918 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
919
d398b3b1 920/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
c98f8742 921 QImode must go into class Q_REGS.
d398b3b1
JVA
922 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
923 movdf to do mem-to-mem moves through integer regs. */
c98f8742 924
7488be4e 925#define PREFERRED_RELOAD_CLASS(X,CLASS) \
85ff473e
JVA
926 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode ? NO_REGS \
927 : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
d398b3b1
JVA
928 : ((CLASS) == ALL_REGS \
929 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
85ff473e
JVA
930 : (CLASS))
931
932/* If we are copying between general and FP registers, we need a memory
933 location. */
934
935#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
4cbb525c
JVA
936 ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
937 || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)))
c98f8742
JVA
938
939/* Return the maximum number of consecutive registers
940 needed to represent mode MODE in a register of class CLASS. */
941/* On the 80386, this is the size of MODE in words,
942 except in the FP regs, where a single reg is always enough. */
943#define CLASS_MAX_NREGS(CLASS, MODE) \
4cbb525c
JVA
944 (FLOAT_CLASS_P (CLASS) ? 1 : \
945 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
f5316dfe
MM
946
947/* A C expression whose value is nonzero if pseudos that have been
948 assigned to registers of class CLASS would likely be spilled
949 because registers of CLASS are needed for spill registers.
950
951 The default value of this macro returns 1 if CLASS has exactly one
952 register and zero otherwise. On most machines, this default
953 should be used. Only define this macro to some other expression
954 if pseudo allocated by `local-alloc.c' end up in memory because
ddd5a7c1 955 their hard registers were needed for spill registers. If this
f5316dfe
MM
956 macro returns nonzero for those classes, those pseudos will only
957 be allocated by `global.c', which knows how to reallocate the
958 pseudo to another register. If there would not be another
959 register available for reallocation, you should not change the
960 definition of this macro since the only effect of such a
961 definition would be to slow down register allocation. */
962
963#define CLASS_LIKELY_SPILLED_P(CLASS) \
964 (((CLASS) == AREG) \
965 || ((CLASS) == DREG) \
966 || ((CLASS) == CREG) \
967 || ((CLASS) == BREG) \
968 || ((CLASS) == AD_REGS) \
969 || ((CLASS) == SIREG) \
970 || ((CLASS) == DIREG))
971
c98f8742
JVA
972\f
973/* Stack layout; function entry, exit and calling. */
974
975/* Define this if pushing a word on the stack
976 makes the stack pointer a smaller address. */
977#define STACK_GROWS_DOWNWARD
978
979/* Define this if the nominal address of the stack frame
980 is at the high-address end of the local variables;
981 that is, each additional local variable allocated
982 goes at a more negative offset in the frame. */
983#define FRAME_GROWS_DOWNWARD
984
985/* Offset within stack frame to start allocating local variables at.
986 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
987 first local allocated. Otherwise, it is the offset to the BEGINNING
988 of the first local allocated. */
989#define STARTING_FRAME_OFFSET 0
990
991/* If we generate an insn to push BYTES bytes,
992 this says how many the stack pointer really advances by.
993 On 386 pushw decrements by exactly 2 no matter what the position was.
994 On the 386 there is no pushb; we use pushw instead, and this
995 has the effect of rounding up to 2. */
996
997#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
998
999/* Offset of first parameter from the argument pointer register value. */
1000#define FIRST_PARM_OFFSET(FNDECL) 0
1001
1002/* Value is the number of bytes of arguments automatically
1003 popped when returning from a subroutine call.
8b109b37 1004 FUNDECL is the declaration node of the function (as a tree),
c98f8742
JVA
1005 FUNTYPE is the data type of the function (as a tree),
1006 or for a library call it is an identifier node for the subroutine name.
1007 SIZE is the number of bytes of arguments passed on the stack.
1008
1009 On the 80386, the RTD insn may be used to pop them if the number
1010 of args is fixed, but if the number is variable then the caller
1011 must pop them all. RTD can't be used for library calls now
1012 because the library is compiled with the Unix compiler.
1013 Use of RTD is a selectable option, since it is incompatible with
1014 standard Unix calling sequences. If the option is not selected,
b08de47e
MM
1015 the caller must always pop the args.
1016
1017 The attribute stdcall is equivalent to RTD on a per module basis. */
c98f8742 1018
b08de47e
MM
1019#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
1020 (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE))
c98f8742 1021
8c2bf92a
JVA
1022/* Define how to find the value returned by a function.
1023 VALTYPE is the data type of the value (as a tree).
1024 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1025 otherwise, FUNC is 0. */
c98f8742 1026#define FUNCTION_VALUE(VALTYPE, FUNC) \
f64cecad 1027 gen_rtx_REG (TYPE_MODE (VALTYPE), \
c98f8742
JVA
1028 VALUE_REGNO (TYPE_MODE (VALTYPE)))
1029
1030/* Define how to find the value returned by a library function
1031 assuming the value has mode MODE. */
1032
1033#define LIBCALL_VALUE(MODE) \
f64cecad 1034 gen_rtx_REG (MODE, VALUE_REGNO (MODE))
c98f8742 1035
e9125c09
TW
1036/* Define the size of the result block used for communication between
1037 untyped_call and untyped_return. The block contains a DImode value
1038 followed by the block used by fnsave and frstor. */
1039
1040#define APPLY_RESULT_SIZE (8+108)
1041
b08de47e
MM
1042/* 1 if N is a possible register number for function argument passing. */
1043#define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)
c98f8742
JVA
1044
1045/* Define a data type for recording info about an argument list
1046 during the scan of that argument list. This data type should
1047 hold all necessary information about the function itself
1048 and about the args processed so far, enough to enable macros
b08de47e 1049 such as FUNCTION_ARG to determine where the next arg should go. */
c98f8742 1050
b08de47e
MM
1051typedef struct i386_args {
1052 int words; /* # words passed so far */
1053 int nregs; /* # registers available for passing */
1054 int regno; /* next available register number */
1055} CUMULATIVE_ARGS;
c98f8742
JVA
1056
1057/* Initialize a variable CUM of type CUMULATIVE_ARGS
1058 for a call to a function whose data type is FNTYPE.
b08de47e 1059 For a library call, FNTYPE is 0. */
c98f8742 1060
2c7ee1a6 1061#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
b08de47e 1062 (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
c98f8742
JVA
1063
1064/* Update the data in CUM to advance over an argument
1065 of mode MODE and data type TYPE.
1066 (TYPE is null for libcalls where that information may not be available.) */
1067
1068#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
b08de47e 1069 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1070
1071/* Define where to put the arguments to a function.
1072 Value is zero to push the argument on the stack,
1073 or a hard register in which to store the argument.
1074
1075 MODE is the argument's machine mode.
1076 TYPE is the data type of the argument (as a tree).
1077 This is null for libcalls where that information may
1078 not be available.
1079 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1080 the preceding args and about the function being called.
1081 NAMED is nonzero if this argument is a named parameter
1082 (otherwise it is an extra parameter matching an ellipsis). */
1083
c98f8742 1084#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
b08de47e 1085 (function_arg (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1086
1087/* For an arg passed partly in registers and partly in memory,
1088 this is the number of registers used.
1089 For args passed entirely in registers or entirely in memory, zero. */
1090
c98f8742 1091#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
b08de47e 1092 (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED))
c98f8742 1093
3a0433fd
SC
1094/* This macro is invoked just before the start of a function.
1095 It is used here to output code for -fpic that will load the
1096 return address into %ebx. */
1097
1098#undef ASM_OUTPUT_FUNCTION_PREFIX
1099#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
1100 asm_output_function_prefix (FILE, FNNAME)
1101
c98f8742
JVA
1102/* This macro generates the assembly code for function entry.
1103 FILE is a stdio stream to output the code to.
1104 SIZE is an int: how many units of temporary storage to allocate.
1105 Refer to the array `regs_ever_live' to determine which registers
1106 to save; `regs_ever_live[I]' is nonzero if register number I
1107 is ever used in the function. This macro is responsible for
1108 knowing which registers should not be saved even if used. */
1109
1110#define FUNCTION_PROLOGUE(FILE, SIZE) \
1111 function_prologue (FILE, SIZE)
1112
1113/* Output assembler code to FILE to increment profiler label # LABELNO
1114 for profiling a function entry. */
1115
1116#define FUNCTION_PROFILER(FILE, LABELNO) \
1117{ \
1118 if (flag_pic) \
1119 { \
1120 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
1121 LPREFIX, (LABELNO)); \
1122 fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \
1123 } \
1124 else \
1125 { \
1126 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
1127 fprintf (FILE, "\tcall _mcount\n"); \
1128 } \
1129}
1130
1cf5eda8 1131
6e753900
RK
1132/* There are three profiling modes for basic blocks available.
1133 The modes are selected at compile time by using the options
1134 -a or -ax of the gnu compiler.
1135 The variable `profile_block_flag' will be set according to the
1136 selected option.
1cf5eda8 1137
6e753900 1138 profile_block_flag == 0, no option used:
1cf5eda8 1139
6e753900 1140 No profiling done.
1cf5eda8 1141
6e753900
RK
1142 profile_block_flag == 1, -a option used.
1143
1144 Count frequency of execution of every basic block.
1145
1146 profile_block_flag == 2, -ax option used.
1147
1148 Generate code to allow several different profiling modes at run time.
1149 Available modes are:
1150 Produce a trace of all basic blocks.
1151 Count frequency of jump instructions executed.
1152 In every mode it is possible to start profiling upon entering
1153 certain functions and to disable profiling of some other functions.
1154
1155 The result of basic-block profiling will be written to a file `bb.out'.
1156 If the -ax option is used parameters for the profiling will be read
1157 from file `bb.in'.
1158
1159*/
1160
1161/* The following macro shall output assembler code to FILE
1162 to initialize basic-block profiling.
1163
1164 If profile_block_flag == 2
1165
1166 Output code to call the subroutine `__bb_init_trace_func'
1167 and pass two parameters to it. The first parameter is
1168 the address of a block allocated in the object module.
1169 The second parameter is the number of the first basic block
1170 of the function.
1171
1172 The name of the block is a local symbol made with this statement:
1173
1174 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1175
1176 Of course, since you are writing the definition of
1177 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1178 can take a short cut in the definition of this macro and use the
1179 name that you know will result.
1180
1181 The number of the first basic block of the function is
1182 passed to the macro in BLOCK_OR_LABEL.
1183
1184 If described in a virtual assembler language the code to be
1185 output looks like:
1186
1187 parameter1 <- LPBX0
1188 parameter2 <- BLOCK_OR_LABEL
1189 call __bb_init_trace_func
1190
1191 else if profile_block_flag != 0
1192
1193 Output code to call the subroutine `__bb_init_func'
1194 and pass one single parameter to it, which is the same
1195 as the first parameter to `__bb_init_trace_func'.
1196
1197 The first word of this parameter is a flag which will be nonzero if
1198 the object module has already been initialized. So test this word
1199 first, and do not call `__bb_init_func' if the flag is nonzero.
1200 Note: When profile_block_flag == 2 the test need not be done
1201 but `__bb_init_trace_func' *must* be called.
1202
1203 BLOCK_OR_LABEL may be used to generate a label number as a
1204 branch destination in case `__bb_init_func' will not be called.
1205
1206 If described in a virtual assembler language the code to be
1207 output looks like:
1208
1209 cmp (LPBX0),0
1210 jne local_label
1211 parameter1 <- LPBX0
1212 call __bb_init_func
1213local_label:
1214
1215*/
1cf5eda8
MM
1216
1217#undef FUNCTION_BLOCK_PROFILER
6e753900 1218#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1cf5eda8
MM
1219do \
1220 { \
1221 static int num_func = 0; \
8ecf187a 1222 rtx xops[8]; \
1cf5eda8
MM
1223 char block_table[80], false_label[80]; \
1224 \
1225 ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \
1cf5eda8 1226 \
f64cecad 1227 xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); \
1cf5eda8 1228 xops[5] = stack_pointer_rtx; \
f64cecad 1229 xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ \
1cf5eda8
MM
1230 \
1231 CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \
1cf5eda8 1232 \
6e753900 1233 switch (profile_block_flag) \
1cf5eda8 1234 { \
1cf5eda8 1235 \
6e753900
RK
1236 case 2: \
1237 \
1238 xops[2] = GEN_INT ((BLOCK_OR_LABEL)); \
f64cecad 1239 xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_trace_func")); \
6e753900
RK
1240 xops[6] = GEN_INT (8); \
1241 \
1242 output_asm_insn (AS1(push%L2,%2), xops); \
1243 if (!flag_pic) \
1244 output_asm_insn (AS1(push%L1,%1), xops); \
1245 else \
1246 { \
1247 output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \
1248 output_asm_insn (AS1 (push%L7,%7), xops); \
1249 } \
1250 \
1251 output_asm_insn (AS1(call,%P3), xops); \
1252 output_asm_insn (AS2(add%L0,%6,%5), xops); \
1253 \
1254 break; \
1255 \
1256 default: \
1257 \
1258 ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \
1259 \
1260 xops[0] = const0_rtx; \
f64cecad
JC
1261 xops[2] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, false_label)); \
1262 xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_func")); \
1263 xops[4] = gen_rtx_MEM (Pmode, xops[1]); \
6e753900
RK
1264 xops[6] = GEN_INT (4); \
1265 \
1266 CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; \
1267 \
1268 output_asm_insn (AS2(cmp%L4,%0,%4), xops); \
1269 output_asm_insn (AS1(jne,%2), xops); \
1270 \
1271 if (!flag_pic) \
1272 output_asm_insn (AS1(push%L1,%1), xops); \
1273 else \
1274 { \
1275 output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \
1276 output_asm_insn (AS1 (push%L7,%7), xops); \
1277 } \
1278 \
1279 output_asm_insn (AS1(call,%P3), xops); \
1280 output_asm_insn (AS2(add%L0,%6,%5), xops); \
1281 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LPBZ", num_func); \
1282 num_func++; \
1283 \
1284 break; \
1285 \
1286 } \
1cf5eda8
MM
1287 } \
1288while (0)
1289
6e753900
RK
1290/* The following macro shall output assembler code to FILE
1291 to increment a counter associated with basic block number BLOCKNO.
1292
1293 If profile_block_flag == 2
1294
1295 Output code to initialize the global structure `__bb' and
1296 call the function `__bb_trace_func' which will increment the
1297 counter.
1298
1299 `__bb' consists of two words. In the first word the number
1300 of the basic block has to be stored. In the second word
1301 the address of a block allocated in the object module
1302 has to be stored.
1303
1304 The basic block number is given by BLOCKNO.
1305
1306 The address of the block is given by the label created with
1307
1308 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1309
1310 by FUNCTION_BLOCK_PROFILER.
1cf5eda8 1311
6e753900
RK
1312 Of course, since you are writing the definition of
1313 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1314 can take a short cut in the definition of this macro and use the
1315 name that you know will result.
1cf5eda8 1316
6e753900
RK
1317 If described in a virtual assembler language the code to be
1318 output looks like:
1cf5eda8 1319
6e753900
RK
1320 move BLOCKNO -> (__bb)
1321 move LPBX0 -> (__bb+4)
1322 call __bb_trace_func
1cf5eda8 1323
6e753900
RK
1324 Note that function `__bb_trace_func' must not change the
1325 machine state, especially the flag register. To grant
1326 this, you must output code to save and restore registers
1327 either in this macro or in the macros MACHINE_STATE_SAVE
1328 and MACHINE_STATE_RESTORE. The last two macros will be
1329 used in the function `__bb_trace_func', so you must make
1330 sure that the function prologue does not change any
1331 register prior to saving it with MACHINE_STATE_SAVE.
1332
1333 else if profile_block_flag != 0
1334
1335 Output code to increment the counter directly.
1336 Basic blocks are numbered separately from zero within each
1337 compiled object module. The count associated with block number
1338 BLOCKNO is at index BLOCKNO in an array of words; the name of
1339 this array is a local symbol made with this statement:
1340
1341 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
1342
1343 Of course, since you are writing the definition of
1344 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1345 can take a short cut in the definition of this macro and use the
1346 name that you know will result.
1347
1348 If described in a virtual assembler language the code to be
1349 output looks like:
1350
1351 inc (LPBX2+4*BLOCKNO)
1352
1353*/
1354
1355#define BLOCK_PROFILER(FILE, BLOCKNO) \
1cf5eda8
MM
1356do \
1357 { \
6e753900 1358 rtx xops[8], cnt_rtx; \
1cf5eda8 1359 char counts[80]; \
6e753900
RK
1360 char *block_table = counts; \
1361 \
1362 switch (profile_block_flag) \
1363 { \
1364 \
1365 case 2: \
1366 \
1367 ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \
1368 \
f64cecad 1369 xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); \
6e753900 1370 xops[2] = GEN_INT ((BLOCKNO)); \
f64cecad
JC
1371 xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_func")); \
1372 xops[4] = gen_rtx_SYMBOL_REF (VOIDmode, "__bb"); \
6e753900 1373 xops[5] = plus_constant (xops[4], 4); \
f64cecad
JC
1374 xops[0] = gen_rtx_MEM (SImode, xops[4]); \
1375 xops[6] = gen_rtx_MEM (SImode, xops[5]); \
6e753900
RK
1376 \
1377 CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \
1378 \
1379 fprintf(FILE, "\tpushf\n"); \
1380 output_asm_insn (AS2(mov%L0,%2,%0), xops); \
1381 if (flag_pic) \
1382 { \
f64cecad 1383 xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ \
6e753900
RK
1384 output_asm_insn (AS1(push%L7,%7), xops); \
1385 output_asm_insn (AS2(lea%L7,%a1,%7), xops); \
1386 output_asm_insn (AS2(mov%L6,%7,%6), xops); \
1387 output_asm_insn (AS1(pop%L7,%7), xops); \
1388 } \
1389 else \
1390 output_asm_insn (AS2(mov%L6,%1,%6), xops); \
1391 output_asm_insn (AS1(call,%P3), xops); \
1392 fprintf(FILE, "\tpopf\n"); \
1393 \
1394 break; \
1395 \
1396 default: \
1397 \
1398 ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); \
f64cecad 1399 cnt_rtx = gen_rtx_SYMBOL_REF (VOIDmode, counts); \
6e753900 1400 SYMBOL_REF_FLAG (cnt_rtx) = TRUE; \
1cf5eda8 1401 \
6e753900
RK
1402 if (BLOCKNO) \
1403 cnt_rtx = plus_constant (cnt_rtx, (BLOCKNO)*4); \
1cf5eda8 1404 \
6e753900 1405 if (flag_pic) \
f64cecad 1406 cnt_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, cnt_rtx); \
05ca35c7 1407 \
f64cecad 1408 xops[0] = gen_rtx_MEM (SImode, cnt_rtx); \
6e753900 1409 output_asm_insn (AS1(inc%L0,%0), xops); \
05ca35c7 1410 \
6e753900
RK
1411 break; \
1412 \
1413 } \
1cf5eda8
MM
1414 } \
1415while (0)
1416
6e753900
RK
1417/* The following macro shall output assembler code to FILE
1418 to indicate a return from function during basic-block profiling.
1419
1420 If profiling_block_flag == 2:
1421
1422 Output assembler code to call function `__bb_trace_ret'.
1423
1424 Note that function `__bb_trace_ret' must not change the
1425 machine state, especially the flag register. To grant
1426 this, you must output code to save and restore registers
1427 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1428 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1429 used in the function `__bb_trace_ret', so you must make
1430 sure that the function prologue does not change any
1431 register prior to saving it with MACHINE_STATE_SAVE_RET.
1432
1433 else if profiling_block_flag != 0:
1434
1435 The macro will not be used, so it need not distinguish
1436 these cases.
1437*/
1438
1439#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
1440do \
1441 { \
1442 rtx xops[1]; \
1443 \
f64cecad 1444 xops[0] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")); \
6e753900
RK
1445 \
1446 output_asm_insn (AS1(call,%P0), xops); \
1447 \
1448 } \
1449while (0)
1450
1451/* The function `__bb_trace_func' is called in every basic block
1452 and is not allowed to change the machine state. Saving (restoring)
1453 the state can either be done in the BLOCK_PROFILER macro,
1454 before calling function (rsp. after returning from function)
1455 `__bb_trace_func', or it can be done inside the function by
1456 defining the macros:
1457
1458 MACHINE_STATE_SAVE(ID)
1459 MACHINE_STATE_RESTORE(ID)
1460
1461 In the latter case care must be taken, that the prologue code
1462 of function `__bb_trace_func' does not already change the
1463 state prior to saving it with MACHINE_STATE_SAVE.
1464
1465 The parameter `ID' is a string identifying a unique macro use.
1466
1467 On the i386 the initialization code at the begin of
1468 function `__bb_trace_func' contains a `sub' instruction
1469 therefore we handle save and restore of the flag register
1470 in the BLOCK_PROFILER macro. */
1471
1472#define MACHINE_STATE_SAVE(ID) \
1473 asm (" pushl %eax"); \
1474 asm (" pushl %ecx"); \
1475 asm (" pushl %edx"); \
1476 asm (" pushl %esi");
1477
1478#define MACHINE_STATE_RESTORE(ID) \
1479 asm (" popl %esi"); \
1480 asm (" popl %edx"); \
1481 asm (" popl %ecx"); \
1482 asm (" popl %eax");
1483
c98f8742
JVA
1484/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1485 the stack pointer does not matter. The value is tested only in
1486 functions that have frame pointers.
1487 No definition is equivalent to always zero. */
1488/* Note on the 386 it might be more efficient not to define this since
1489 we have to restore it ourselves from the frame pointer, in order to
1490 use pop */
1491
1492#define EXIT_IGNORE_STACK 1
1493
1494/* This macro generates the assembly code for function exit,
1495 on machines that need it. If FUNCTION_EPILOGUE is not defined
1496 then individual return instructions are generated for each
1497 return statement. Args are same as for FUNCTION_PROLOGUE.
1498
1499 The function epilogue should not depend on the current stack pointer!
1500 It should use the frame pointer only. This is mandatory because
1501 of alloca; we also take advantage of it to omit stack adjustments
1502 before returning.
1503
1504 If the last non-note insn in the function is a BARRIER, then there
1505 is no need to emit a function prologue, because control does not fall
1506 off the end. This happens if the function ends in an "exit" call, or
1507 if a `return' insn is emitted directly into the function. */
1508
2f2fa5b1
SC
1509#if 0
1510#define FUNCTION_BEGIN_EPILOGUE(FILE) \
c98f8742
JVA
1511do { \
1512 rtx last = get_last_insn (); \
1513 if (last && GET_CODE (last) == NOTE) \
1514 last = prev_nonnote_insn (last); \
2f2fa5b1
SC
1515/* if (! last || GET_CODE (last) != BARRIER) \
1516 function_epilogue (FILE, SIZE);*/ \
c98f8742 1517} while (0)
2f2fa5b1
SC
1518#endif
1519
1520#define FUNCTION_EPILOGUE(FILE, SIZE) \
1521 function_epilogue (FILE, SIZE)
c98f8742
JVA
1522
1523/* Output assembler code for a block containing the constant parts
1524 of a trampoline, leaving space for the variable parts. */
1525
1526/* On the 386, the trampoline contains three instructions:
1527 mov #STATIC,ecx
1528 mov #FUNCTION,eax
1529 jmp @eax */
8c2bf92a
JVA
1530#define TRAMPOLINE_TEMPLATE(FILE) \
1531{ \
1532 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb9)); \
1533 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1534 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1535 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb8)); \
1536 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1537 ASM_OUTPUT_SHORT (FILE, const0_rtx); \
1538 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xff)); \
1539 ASM_OUTPUT_CHAR (FILE, GEN_INT (0xe0)); \
c98f8742
JVA
1540}
1541
1542/* Length in units of the trampoline for entering a nested function. */
1543
1544#define TRAMPOLINE_SIZE 12
1545
1546/* Emit RTL insns to initialize the variable parts of a trampoline.
1547 FNADDR is an RTX for the address of the function's pure code.
1548 CXT is an RTX for the static chain value for the function. */
1549
1550#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1551{ \
f64cecad
JC
1552 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
1553 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), FNADDR); \
c98f8742
JVA
1554}
1555\f
1556/* Definitions for register eliminations.
1557
1558 This is an array of structures. Each structure initializes one pair
1559 of eliminable registers. The "from" register number is given first,
1560 followed by "to". Eliminations of the same "from" register are listed
1561 in order of preference.
1562
1563 We have two registers that can be eliminated on the i386. First, the
1564 frame pointer register can often be eliminated in favor of the stack
1565 pointer register. Secondly, the argument pointer register can always be
1566 eliminated; it is replaced with either the stack or frame pointer. */
1567
1568#define ELIMINABLE_REGS \
1569{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1570 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1571 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1572
1573/* Given FROM and TO register numbers, say whether this elimination is allowed.
1574 Frame pointer elimination is automatically handled.
1575
1576 For the i386, if frame pointer elimination is being done, we would like to
1577 convert ap into sp, not fp.
1578
1579 All other eliminations are valid. */
1580
1581#define CAN_ELIMINATE(FROM, TO) \
1582 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1583 ? ! frame_pointer_needed \
1584 : 1)
1585
1586/* Define the offset between two registers, one to be eliminated, and the other
1587 its replacement, at the start of a routine. */
1588
1589#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1590{ \
1591 if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1592 (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \
1593 else \
1594 { \
1595 int regno; \
1596 int offset = 0; \
1597 \
1598 for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
1599 if ((regs_ever_live[regno] && ! call_used_regs[regno]) \
6d8ccdbb
JL
1600 || ((current_function_uses_pic_offset_table \
1601 || current_function_uses_const_pool) \
1602 && flag_pic && regno == PIC_OFFSET_TABLE_REGNUM)) \
c98f8742
JVA
1603 offset += 4; \
1604 \
1605 (OFFSET) = offset + get_frame_size (); \
1606 \
1607 if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1608 (OFFSET) += 4; /* Skip saved PC */ \
1609 } \
1610}
1611\f
1612/* Addressing modes, and classification of registers for them. */
1613
1614/* #define HAVE_POST_INCREMENT */
1615/* #define HAVE_POST_DECREMENT */
1616
1617/* #define HAVE_PRE_DECREMENT */
1618/* #define HAVE_PRE_INCREMENT */
1619
1620/* Macros to check register numbers against specific register classes. */
1621
1622/* These assume that REGNO is a hard or pseudo reg number.
1623 They give nonzero only if REGNO is a hard reg of the suitable class
1624 or a pseudo reg currently allocated to a suitable hard reg.
1625 Since they use reg_renumber, they are safe only once reg_renumber
1626 has been allocated, which happens in local-alloc.c. */
1627
1628#define REGNO_OK_FOR_INDEX_P(REGNO) \
1629 ((REGNO) < STACK_POINTER_REGNUM \
1630 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1631
1632#define REGNO_OK_FOR_BASE_P(REGNO) \
1633 ((REGNO) <= STACK_POINTER_REGNUM \
1634 || (REGNO) == ARG_POINTER_REGNUM \
1635 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1636
1637#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1638#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1639
1640/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1641 and check its validity for a certain class.
1642 We have two alternate definitions for each of them.
1643 The usual definition accepts all pseudo regs; the other rejects
1644 them unless they have been allocated suitable hard regs.
1645 The symbol REG_OK_STRICT causes the latter definition to be used.
1646
1647 Most source files want to accept pseudo regs in the hope that
1648 they will get allocated to the class that the insn wants them to be in.
1649 Source files for reload pass need to be strict.
1650 After reload, it makes no difference, since pseudo regs have
1651 been eliminated by then. */
1652
c98f8742 1653
3b3c6a3f
MM
1654/* Non strict versions, pseudos are ok */
1655#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1656 (REGNO (X) < STACK_POINTER_REGNUM \
c98f8742
JVA
1657 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1658
3b3c6a3f
MM
1659#define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1660 (REGNO (X) <= STACK_POINTER_REGNUM \
1661 || REGNO (X) == ARG_POINTER_REGNUM \
1662 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
c98f8742 1663
3b3c6a3f 1664#define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
c98f8742
JVA
1665 (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1666
3b3c6a3f
MM
1667/* Strict versions, hard registers only */
1668#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1669#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1670#define REG_OK_FOR_STRREG_STRICT_P(X) \
c98f8742
JVA
1671 (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
1672
3b3c6a3f
MM
1673#ifndef REG_OK_STRICT
1674#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1675#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
1676#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
1677
1678#else
1679#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1680#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
1681#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
c98f8742
JVA
1682#endif
1683
1684/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1685 that is a valid memory address for an instruction.
1686 The MODE argument is the machine mode for the MEM expression
1687 that wants to use this address.
1688
1689 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1690 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1691
1692 See legitimize_pic_address in i386.c for details as to what
1693 constitutes a legitimate address when -fpic is used. */
1694
1695#define MAX_REGS_PER_ADDRESS 2
1696
6eff269e
BK
1697#define CONSTANT_ADDRESS_P(X) \
1698 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1699 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1700 || GET_CODE (X) == HIGH)
c98f8742
JVA
1701
1702/* Nonzero if the constant value X is a legitimate general operand.
1703 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1704
1705#define LEGITIMATE_CONSTANT_P(X) 1
1706
3b3c6a3f
MM
1707#ifdef REG_OK_STRICT
1708#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1709{ \
1710 if (legitimate_address_p (MODE, X, 1)) \
1711 goto ADDR; \
1712}
c98f8742 1713
3b3c6a3f
MM
1714#else
1715#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
c98f8742 1716{ \
3b3c6a3f 1717 if (legitimate_address_p (MODE, X, 0)) \
c98f8742 1718 goto ADDR; \
c98f8742
JVA
1719}
1720
3b3c6a3f
MM
1721#endif
1722
c98f8742
JVA
1723/* Try machine-dependent ways of modifying an illegitimate address
1724 to be legitimate. If we find one, return the new, valid address.
1725 This macro is used in only one place: `memory_address' in explow.c.
1726
1727 OLDX is the address as it was before break_out_memory_refs was called.
1728 In some cases it is useful to look at this to decide what needs to be done.
1729
1730 MODE and WIN are passed so that this macro can use
1731 GO_IF_LEGITIMATE_ADDRESS.
1732
1733 It is always safe for this macro to do nothing. It exists to recognize
1734 opportunities to optimize the output.
1735
1736 For the 80386, we handle X+REG by loading X into a register R and
1737 using R+REG. R will go in a general reg and indexing will be used.
1738 However, if REG is a broken-out memory address or multiplication,
1739 nothing needs to be done because REG can certainly go in a general reg.
1740
1741 When -fpic is used, special handling is needed for symbolic references.
1742 See comments by legitimize_pic_address in i386.c for details. */
1743
3b3c6a3f
MM
1744#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1745{ \
3b3c6a3f
MM
1746 (X) = legitimize_address (X, OLDX, MODE); \
1747 if (memory_address_p (MODE, X)) \
1748 goto WIN; \
1749}
c98f8742 1750
d4ba09c0
SC
1751#define REWRITE_ADDRESS(x) rewrite_address(x)
1752
c98f8742
JVA
1753/* Nonzero if the constant value X is a legitimate general operand
1754 when generating PIC code. It is given that flag_pic is on and
1755 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1756
1757#define LEGITIMATE_PIC_OPERAND_P(X) \
1758 (! SYMBOLIC_CONST (X) \
1759 || (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)))
1760
1761#define SYMBOLIC_CONST(X) \
1762(GET_CODE (X) == SYMBOL_REF \
1763 || GET_CODE (X) == LABEL_REF \
1764 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1765
1766/* Go to LABEL if ADDR (a legitimate address expression)
1767 has an effect that depends on the machine mode it is used for.
1768 On the 80386, only postdecrement and postincrement address depend thus
1769 (the amount of decrement or increment being the length of the operand). */
1770#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1771 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1772\f
1773/* Define this macro if references to a symbol must be treated
1774 differently depending on something about the variable or
1775 function named by the symbol (such as what section it is in).
1776
b4ac57ab 1777 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
c98f8742
JVA
1778 so that we may access it directly in the GOT. */
1779
1780#define ENCODE_SECTION_INFO(DECL) \
1781do \
1782 { \
1783 if (flag_pic) \
1784 { \
b4ac57ab
RS
1785 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1786 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
d4ba09c0
SC
1787 \
1788 if (TARGET_DEBUG_ADDR \
1789 && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
1790 { \
69d4ca36 1791 fprintf (stderr, "Encode %s, public = %d\n", \
d4ba09c0
SC
1792 IDENTIFIER_POINTER (DECL_NAME (DECL)), \
1793 TREE_PUBLIC (DECL)); \
1794 } \
1795 \
b4ac57ab
RS
1796 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1797 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1798 || ! TREE_PUBLIC (DECL)); \
c98f8742
JVA
1799 } \
1800 } \
1801while (0)
d398b3b1
JVA
1802
1803/* Initialize data used by insn expanders. This is called from
1804 init_emit, once for each function, before code is generated.
1805 For 386, clear stack slot assignments remembered from previous
1806 functions. */
1807
1808#define INIT_EXPANDERS clear_386_stack_locals ()
638b724c
MM
1809
1810/* The `FINALIZE_PIC' macro serves as a hook to emit these special
1811 codes once the function is being compiled into assembly code, but
1812 not before. (It is not done before, because in the case of
1813 compiling an inline function, it would lead to multiple PIC
1814 prologues being included in functions which used inline functions
1815 and were compiled to assembly language.) */
1816
1817#define FINALIZE_PIC \
1818do \
1819 { \
1820 extern int current_function_uses_pic_offset_table; \
1821 \
1822 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
1823 } \
1824while (0)
1825
b08de47e
MM
1826\f
1827/* If defined, a C expression whose value is nonzero if IDENTIFIER
1828 with arguments ARGS is a valid machine specific attribute for DECL.
1829 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1830
7db4b149
RK
1831#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
1832 (i386_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
1833
1834/* If defined, a C expression whose value is nonzero if IDENTIFIER
1835 with arguments ARGS is a valid machine specific attribute for TYPE.
1836 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1837
7db4b149
RK
1838#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
1839 (i386_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
1840
1841/* If defined, a C expression whose value is zero if the attributes on
1842 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1843 two if they are nearly compatible (which causes a warning to be
1844 generated). */
1845
1846#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1847 (i386_comp_type_attributes (TYPE1, TYPE2))
1848
1849/* If defined, a C statement that assigns default attributes to newly
1850 defined TYPE. */
1851
1852/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
1853
1854/* Max number of args passed in registers. If this is more than 3, we will
1855 have problems with ebx (register #4), since it is a caller save register and
1856 is also used as the pic register in ELF. So for now, don't allow more than
1857 3 registers to be passed in registers. */
1858
1859#define REGPARM_MAX 3
1860
c98f8742
JVA
1861\f
1862/* Specify the machine mode that this machine uses
1863 for the index in the tablejump instruction. */
1864#define CASE_VECTOR_MODE Pmode
1865
18543a22
ILT
1866/* Define as C expression which evaluates to nonzero if the tablejump
1867 instruction expects the table to contain offsets from the address of the
1868 table.
1869 Do not define this if the table should contain absolute addresses. */
1870/* #define CASE_VECTOR_PC_RELATIVE 1 */
c98f8742
JVA
1871
1872/* Specify the tree operation to be used to convert reals to integers.
1873 This should be changed to take advantage of fist --wfs ??
1874 */
1875#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1876
1877/* This is the kind of divide that is easiest to do in the general case. */
1878#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1879
1880/* Define this as 1 if `char' should by default be signed; else as 0. */
1881#define DEFAULT_SIGNED_CHAR 1
1882
1883/* Max number of bytes we can move from memory to memory
1884 in one reasonably fast instruction. */
1885#define MOVE_MAX 4
1886
d4ba09c0
SC
1887/* The number of scalar move insns which should be generated instead
1888 of a string move insn or a library call. Increasing the value
1889 will always make code faster, but eventually incurs high cost in
1890 increased code size.
c98f8742 1891
d4ba09c0 1892 If you don't define this, a reasonable default is used.
c98f8742 1893
d4ba09c0
SC
1894 Make this large on i386, since the block move is very inefficient with small
1895 blocks, and the hard register needs of the block move require much reload
1896 work. */
1897
1898#define MOVE_RATIO 5
c98f8742
JVA
1899
1900/* Define if shifts truncate the shift count
1901 which implies one can omit a sign-extension or zero-extension
1902 of a shift count. */
241e1a89 1903/* On i386, shifts do truncate the count. But bit opcodes don't. */
c98f8742
JVA
1904
1905/* #define SHIFT_COUNT_TRUNCATED */
1906
1907/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1908 is done just by pretending it is already truncated. */
1909#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1910
1911/* We assume that the store-condition-codes instructions store 0 for false
1912 and some other value for true. This is the value stored for true. */
1913
1914#define STORE_FLAG_VALUE 1
1915
1916/* When a prototype says `char' or `short', really pass an `int'.
1917 (The 386 can't easily push less than an int.) */
1918
1919#define PROMOTE_PROTOTYPES
1920
1921/* Specify the machine mode that pointers have.
1922 After generation of rtl, the compiler makes no further distinction
1923 between pointers and any other objects of this machine mode. */
1924#define Pmode SImode
1925
1926/* A function address in a call instruction
1927 is a byte address (for indexing purposes)
1928 so give the MEM rtx a byte's mode. */
1929#define FUNCTION_MODE QImode
d4ba09c0
SC
1930\f
1931/* A part of a C `switch' statement that describes the relative costs
1932 of constant RTL expressions. It must contain `case' labels for
1933 expression codes `const_int', `const', `symbol_ref', `label_ref'
1934 and `const_double'. Each case must ultimately reach a `return'
1935 statement to return the relative cost of the use of that kind of
1936 constant value in an expression. The cost may depend on the
1937 precise value of the constant, which is available for examination
1938 in X, and the rtx code of the expression in which it is contained,
1939 found in OUTER_CODE.
1940
1941 CODE is the expression code--redundant, since it can be obtained
1942 with `GET_CODE (X)'. */
c98f8742 1943
3bb22aee 1944#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
c98f8742 1945 case CONST_INT: \
e5e809f4 1946 return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \
c98f8742
JVA
1947 case CONST: \
1948 case LABEL_REF: \
1949 case SYMBOL_REF: \
76565a24 1950 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
d4ba09c0 1951 \
c98f8742
JVA
1952 case CONST_DOUBLE: \
1953 { \
7488be4e
JVA
1954 int code; \
1955 if (GET_MODE (RTX) == VOIDmode) \
1956 return 2; \
d4ba09c0 1957 \
7488be4e 1958 code = standard_80387_constant_p (RTX); \
c98f8742
JVA
1959 return code == 1 ? 0 : \
1960 code == 2 ? 1 : \
1961 2; \
3bb22aee 1962 }
c98f8742 1963
76565a24
SC
1964/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
1965#define TOPLEVEL_COSTS_N_INSNS(N) {total = COSTS_N_INSNS (N); break;}
1966
d4ba09c0
SC
1967/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1968 This can be used, for example, to indicate how costly a multiply
1969 instruction is. In writing this macro, you can use the construct
1970 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1971 instructions. OUTER_CODE is the code of the expression in which X
1972 is contained.
1973
1974 This macro is optional; do not define it if the default cost
1975 assumptions are adequate for the target machine. */
1976
1977#define RTX_COSTS(X,CODE,OUTER_CODE) \
1978 case ASHIFT: \
1979 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1980 && GET_MODE (XEXP (X, 0)) == SImode) \
1981 { \
1982 HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1983 \
1984 if (value == 1) \
66050251
SC
1985 return COSTS_N_INSNS (ix86_cost->add) \
1986 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
d4ba09c0
SC
1987 \
1988 if (value == 2 || value == 3) \
66050251
SC
1989 return COSTS_N_INSNS (ix86_cost->lea) \
1990 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
d4ba09c0
SC
1991 } \
1992 /* fall through */ \
1993 \
1994 case ROTATE: \
1995 case ASHIFTRT: \
1996 case LSHIFTRT: \
1997 case ROTATERT: \
76565a24
SC
1998 if (GET_MODE (XEXP (X, 0)) == DImode) \
1999 { \
2000 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
54d26233
MH
2001 { \
2002 if (INTVAL (XEXP (X, 1)) > 32) \
2003 return COSTS_N_INSNS(ix86_cost->shift_const + 2); \
76565a24 2004 return COSTS_N_INSNS(ix86_cost->shift_const * 2); \
54d26233 2005 } \
76565a24
SC
2006 return ((GET_CODE (XEXP (X, 1)) == AND \
2007 ? COSTS_N_INSNS(ix86_cost->shift_var * 2) \
2008 : COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2)) \
66050251 2009 + rtx_cost(XEXP (X, 0), OUTER_CODE)); \
76565a24
SC
2010 } \
2011 return COSTS_N_INSNS (GET_CODE (XEXP (X, 1)) == CONST_INT \
2012 ? ix86_cost->shift_const \
2013 : ix86_cost->shift_var) \
66050251 2014 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
d4ba09c0
SC
2015 \
2016 case MULT: \
2017 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
2018 { \
2019 unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
2020 int nbits = 0; \
2021 \
76565a24 2022 if (value == 2) \
66050251
SC
2023 return COSTS_N_INSNS (ix86_cost->add) \
2024 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
76565a24 2025 if (value == 4 || value == 8) \
66050251
SC
2026 return COSTS_N_INSNS (ix86_cost->lea) \
2027 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
76565a24 2028 \
d4ba09c0
SC
2029 while (value != 0) \
2030 { \
2031 nbits++; \
2032 value >>= 1; \
2033 } \
2034 \
76565a24
SC
2035 if (nbits == 1) \
2036 return COSTS_N_INSNS (ix86_cost->shift_const) \
66050251 2037 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
76565a24 2038 \
d4ba09c0 2039 return COSTS_N_INSNS (ix86_cost->mult_init \
76565a24 2040 + nbits * ix86_cost->mult_bit) \
66050251 2041 + rtx_cost(XEXP (X, 0), OUTER_CODE); \
d4ba09c0
SC
2042 } \
2043 \
2044 else /* This is arbitrary */ \
76565a24
SC
2045 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
2046 + 7 * ix86_cost->mult_bit); \
d4ba09c0
SC
2047 \
2048 case DIV: \
2049 case UDIV: \
2050 case MOD: \
2051 case UMOD: \
76565a24 2052 TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
d4ba09c0
SC
2053 \
2054 case PLUS: \
2055 if (GET_CODE (XEXP (X, 0)) == REG \
2056 && GET_MODE (XEXP (X, 0)) == SImode \
2057 && GET_CODE (XEXP (X, 1)) == PLUS) \
2058 return COSTS_N_INSNS (ix86_cost->lea); \
2059 \
2060 /* fall through */ \
2061 case AND: \
2062 case IOR: \
2063 case XOR: \
2064 case MINUS: \
76565a24
SC
2065 if (GET_MODE (X) == DImode) \
2066 return COSTS_N_INSNS (ix86_cost->add) * 2 \
66050251
SC
2067 + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
2068 << (GET_MODE (XEXP (X, 0)) != DImode)) \
2069 + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
2070 << (GET_MODE (XEXP (X, 1)) != DImode)); \
d4ba09c0
SC
2071 case NEG: \
2072 case NOT: \
76565a24
SC
2073 if (GET_MODE (X) == DImode) \
2074 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2) \
2075 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add)
d4ba09c0
SC
2076
2077
2078/* An expression giving the cost of an addressing mode that contains
2079 ADDRESS. If not defined, the cost is computed from the ADDRESS
2080 expression and the `CONST_COSTS' values.
2081
2082 For most CISC machines, the default cost is a good approximation
2083 of the true cost of the addressing mode. However, on RISC
2084 machines, all instructions normally have the same length and
2085 execution time. Hence all addresses will have equal costs.
2086
2087 In cases where more than one form of an address is known, the form
2088 with the lowest cost will be used. If multiple forms have the
2089 same, lowest, cost, the one that is the most complex will be used.
2090
2091 For example, suppose an address that is equal to the sum of a
2092 register and a constant is used twice in the same basic block.
2093 When this macro is not defined, the address will be computed in a
2094 register and memory references will be indirect through that
2095 register. On machines where the cost of the addressing mode
2096 containing the sum is no higher than that of a simple indirect
2097 reference, this will produce an additional instruction and
2098 possibly require an additional register. Proper specification of
2099 this macro eliminates this overhead for such machines.
2100
2101 Similar use of this macro is made in strength reduction of loops.
2102
2103 ADDRESS need not be valid as an address. In such a case, the cost
2104 is not relevant and can be any value; invalid addresses need not be
2105 assigned a different cost.
2106
2107 On machines where an address involving more than one register is as
2108 cheap as an address computation involving only one register,
2109 defining `ADDRESS_COST' to reflect this can cause two registers to
2110 be live over a region of code where only one would have been if
2111 `ADDRESS_COST' were not defined in that manner. This effect should
2112 be considered in the definition of this macro. Equivalent costs
2113 should probably only be given to addresses with different numbers
2114 of registers on machines with lots of registers.
2115
2116 This macro will normally either not be defined or be defined as a
2117 constant.
c98f8742
JVA
2118
2119 For i386, it is better to use a complex address than let gcc copy
2120 the address into a reg and make a new pseudo. But not if the address
2121 requires to two regs - that would mean more pseudos with longer
2122 lifetimes. */
2123
2124#define ADDRESS_COST(RTX) \
2125 ((CONSTANT_P (RTX) \
2126 || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
2127 && REG_P (XEXP (RTX, 0)))) ? 0 \
2128 : REG_P (RTX) ? 1 \
2129 : 2)
d4ba09c0
SC
2130
2131/* A C expression for the cost of moving data of mode M between a
2132 register and memory. A value of 2 is the default; this cost is
2133 relative to those in `REGISTER_MOVE_COST'.
2134
2135 If moving between registers and memory is more expensive than
2136 between two registers, you should define this macro to express the
2137 relative cost.
2138
2139 On the i386, copying between floating-point and fixed-point
2140 registers is expensive. */
2141
2142#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
2143 (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
2144 || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \
2145 : 2)
2146
2147
2148/* A C expression for the cost of moving data of mode M between a
2149 register and memory. A value of 2 is the default; this cost is
2150 relative to those in `REGISTER_MOVE_COST'.
2151
2152 If moving between registers and memory is more expensive than
2153 between two registers, you should define this macro to express the
2154 relative cost. */
2155
cbd5b9a2 2156/* #define MEMORY_MOVE_COST(M,C,I) 2 */
d4ba09c0
SC
2157
2158/* A C expression for the cost of a branch instruction. A value of 1
2159 is the default; other values are interpreted relative to that. */
2160
e2a606cb 2161#define BRANCH_COST i386_branch_cost
d4ba09c0
SC
2162
2163/* Define this macro as a C expression which is nonzero if accessing
2164 less than a word of memory (i.e. a `char' or a `short') is no
2165 faster than accessing a word of memory, i.e., if such access
2166 require more than one instruction or if there is no difference in
2167 cost between byte and (aligned) word loads.
2168
2169 When this macro is not defined, the compiler will access a field by
2170 finding the smallest containing object; when it is defined, a
2171 fullword load will be used if alignment permits. Unless bytes
2172 accesses are faster than word accesses, using word accesses is
2173 preferable since it may eliminate subsequent memory access if
2174 subsequent accesses occur to other fields in the same word of the
2175 structure, but to different bytes. */
2176
2177#define SLOW_BYTE_ACCESS 0
2178
2179/* Nonzero if access to memory by shorts is slow and undesirable. */
2180#define SLOW_SHORT_ACCESS 0
2181
2182/* Define this macro if zero-extension (of a `char' or `short' to an
2183 `int') can be done faster if the destination is a register that is
2184 known to be zero.
2185
2186 If you define this macro, you must have instruction patterns that
2187 recognize RTL structures like this:
2188
2189 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2190
2191 and likewise for `HImode'. */
2192
2193/* #define SLOW_ZERO_EXTEND */
2194
2195/* Define this macro to be the value 1 if unaligned accesses have a
2196 cost many times greater than aligned accesses, for example if they
2197 are emulated in a trap handler.
2198
2199 When this macro is non-zero, the compiler will act as if
2200 `STRICT_ALIGNMENT' were non-zero when generating code for block
2201 moves. This can cause significantly more instructions to be
2202 produced. Therefore, do not set this macro non-zero if unaligned
2203 accesses only add a cycle or two to the time for a memory access.
2204
2205 If the value of this macro is always zero, it need not be defined. */
2206
2207/* #define SLOW_UNALIGNED_ACCESS 0 */
2208
2209/* Define this macro to inhibit strength reduction of memory
2210 addresses. (On some machines, such strength reduction seems to do
2211 harm rather than good.) */
2212
2213/* #define DONT_REDUCE_ADDR */
2214
2215/* Define this macro if it is as good or better to call a constant
2216 function address than to call an address kept in a register.
2217
2218 Desirable on the 386 because a CALL with a constant address is
2219 faster than one with a register address. */
2220
2221#define NO_FUNCTION_CSE
2222
2223/* Define this macro if it is as good or better for a function to call
2224 itself with an explicit address than to call an address kept in a
2225 register. */
2226
2227#define NO_RECURSIVE_FUNCTION_CSE
2228
2229/* A C statement (sans semicolon) to update the integer variable COST
2230 based on the relationship between INSN that is dependent on
2231 DEP_INSN through the dependence LINK. The default is to make no
2232 adjustment to COST. This can be used for example to specify to
2233 the scheduler that an output- or anti-dependence does not incur
2234 the same cost as a data-dependence. */
2235
2236#define ADJUST_COST(insn,link,dep_insn,cost) \
2237 { \
2238 rtx next_inst; \
2239 if (GET_CODE (dep_insn) == CALL_INSN) \
2240 (cost) = 0; \
2241 \
2242 else if (GET_CODE (dep_insn) == INSN \
2243 && GET_CODE (PATTERN (dep_insn)) == SET \
2244 && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG \
2245 && GET_CODE (insn) == INSN \
2246 && GET_CODE (PATTERN (insn)) == SET \
2247 && !reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)), \
2248 SET_SRC (PATTERN (insn)))) \
2249 { \
2250 (cost) = 0; \
2251 } \
2252 \
2253 else if (GET_CODE (insn) == JUMP_INSN) \
2254 { \
2255 (cost) = 0; \
2256 } \
2257 \
2258 if (TARGET_PENTIUM) \
2259 { \
2260 if (cost !=0 && is_fp_insn (insn) && is_fp_insn (dep_insn) \
2261 && !is_fp_dest (dep_insn)) \
2262 { \
2263 (cost) = 0; \
2264 } \
2265 \
2266 if (agi_dependent (insn, dep_insn)) \
2267 { \
2268 (cost) = 3; \
2269 } \
2270 else if (GET_CODE (insn) == INSN \
2271 && GET_CODE (PATTERN (insn)) == SET \
2272 && SET_DEST (PATTERN (insn)) == cc0_rtx \
2273 && (next_inst = next_nonnote_insn (insn)) \
2274 && GET_CODE (next_inst) == JUMP_INSN) \
2275 { /* compare probably paired with jump */ \
2276 (cost) = 0; \
2277 } \
2278 } \
2279 else \
2280 if (!is_fp_dest (dep_insn)) \
2281 { \
2282 if(!agi_dependent (insn, dep_insn)) \
2283 (cost) = 0; \
2284 else if (TARGET_486) \
2285 (cost) = 2; \
2286 } \
2287 else \
2288 if (is_fp_store (insn) && is_fp_insn (dep_insn) \
2289 && NEXT_INSN (insn) && NEXT_INSN (NEXT_INSN (insn)) \
2290 && NEXT_INSN (NEXT_INSN (NEXT_INSN (insn))) \
2291 && (GET_CODE (NEXT_INSN (insn)) == INSN) \
2292 && (GET_CODE (NEXT_INSN (NEXT_INSN (insn))) == JUMP_INSN) \
2293 && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) == NOTE) \
2294 && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) \
2295 == NOTE_INSN_LOOP_END)) \
2296 { \
2297 (cost) = 3; \
2298 } \
2299 }
2300
2301
2302#define ADJUST_BLOCKAGE(last_insn,insn,blockage) \
2303{ \
2304 if (is_fp_store (last_insn) && is_fp_insn (insn) \
2305 && NEXT_INSN (last_insn) && NEXT_INSN (NEXT_INSN (last_insn)) \
2306 && NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn))) \
2307 && (GET_CODE (NEXT_INSN (last_insn)) == INSN) \
2308 && (GET_CODE (NEXT_INSN (NEXT_INSN (last_insn))) == JUMP_INSN) \
2309 && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) == NOTE) \
2310 && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) \
2311 == NOTE_INSN_LOOP_END)) \
2312 { \
2313 (blockage) = 3; \
2314 } \
2315}
2316
c98f8742 2317\f
c572e5ba
JVA
2318/* Add any extra modes needed to represent the condition code.
2319
2320 For the i386, we need separate modes when floating-point equality
2321 comparisons are being done. */
2322
2323#define EXTRA_CC_MODES CCFPEQmode
2324
2325/* Define the names for the modes specified above. */
2326#define EXTRA_CC_NAMES "CCFPEQ"
2327
2328/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2329 return the mode to be used for the comparison.
2330
2331 For floating-point equality comparisons, CCFPEQmode should be used.
2332 VOIDmode should be used in all other cases. */
2333
b565a316 2334#define SELECT_CC_MODE(OP,X,Y) \
c572e5ba 2335 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
4cbb525c 2336 && ((OP) == EQ || (OP) == NE) ? CCFPEQmode : VOIDmode)
c572e5ba
JVA
2337
2338/* Define the information needed to generate branch and scc insns. This is
2339 stored from the compare operation. Note that we can't use "rtx" here
2340 since it hasn't been defined! */
2341
c572e5ba
JVA
2342extern struct rtx_def *(*i386_compare_gen)(), *(*i386_compare_gen_eq)();
2343
c98f8742
JVA
2344/* Tell final.c how to eliminate redundant test instructions. */
2345
2346/* Here we define machine-dependent flags and fields in cc_status
2347 (see `conditions.h'). */
2348
62acf5fd 2349/* Set if the cc value was actually from the 80387 and
d4ba09c0
SC
2350 we are testing eax directly (i.e. no sahf) */
2351#define CC_TEST_AX 020000
2352
c98f8742
JVA
2353/* Set if the cc value is actually in the 80387, so a floating point
2354 conditional branch must be output. */
2355#define CC_IN_80387 04000
2356
2357/* Set if the CC value was stored in a nonstandard way, so that
2358 the state of equality is indicated by zero in the carry bit. */
2359#define CC_Z_IN_NOT_C 010000
2360
62acf5fd
SC
2361/* Set if the CC value was actually from the 80387 and loaded directly
2362 into the eflags instead of via eax/sahf. */
2363#define CC_FCOMI 040000
2364
c98f8742
JVA
2365/* Store in cc_status the expressions
2366 that the condition codes will describe
2367 after execution of an instruction whose pattern is EXP.
2368 Do not alter them if the instruction would not alter the cc's. */
2369
2370#define NOTICE_UPDATE_CC(EXP, INSN) \
2371 notice_update_cc((EXP))
2372
2373/* Output a signed jump insn. Use template NORMAL ordinarily, or
2374 FLOAT following a floating point comparison.
2375 Use NO_OV following an arithmetic insn that set the cc's
2376 before a test insn that was deleted.
2377 NO_OV may be zero, meaning final should reinsert the test insn
2378 because the jump cannot be handled properly without it. */
2379
2380#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
2381{ \
2382 if (cc_prev_status.flags & CC_IN_80387) \
2383 return FLOAT; \
2384 if (cc_prev_status.flags & CC_NO_OVERFLOW) \
2385 return NO_OV; \
2386 return NORMAL; \
2387}
2388\f
2389/* Control the assembler format that we output, to the extent
2390 this does not vary between assemblers. */
2391
2392/* How to refer to registers in assembler output.
2393 This sequence is indexed by compiler's hard-register-number (see above). */
2394
2395/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
2396 For non floating point regs, the following are the HImode names.
2397
2398 For float regs, the stack top is sometimes referred to as "%st(0)"
9e06e321 2399 instead of just "%st". PRINT_REG handles this with the "y" code. */
c98f8742
JVA
2400
2401#define HI_REGISTER_NAMES \
2402{"ax","dx","cx","bx","si","di","bp","sp", \
2403 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","" }
2404
2405#define REGISTER_NAMES HI_REGISTER_NAMES
2406
2407/* Table of additional register names to use in user input. */
2408
2409#define ADDITIONAL_REGISTER_NAMES \
54d26233
MH
2410{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \
2411 { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \
2412 { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \
2413 { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }
c98f8742
JVA
2414
2415/* Note we are omitting these since currently I don't know how
2416to get gcc to use these, since they want the same but different
2417number as al, and ax.
2418*/
2419
b4ac57ab 2420/* note the last four are not really qi_registers, but
c98f8742
JVA
2421 the md will have to never output movb into one of them
2422 only a movw . There is no movb into the last four regs */
2423
2424#define QI_REGISTER_NAMES \
2425{"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
2426
2427/* These parallel the array above, and can be used to access bits 8:15
2428 of regs 0 through 3. */
2429
2430#define QI_HIGH_REGISTER_NAMES \
2431{"ah", "dh", "ch", "bh", }
2432
2433/* How to renumber registers for dbx and gdb. */
2434
2435/* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
2436#define DBX_REGISTER_NUMBER(n) \
2437((n) == 0 ? 0 : \
2438 (n) == 1 ? 2 : \
2439 (n) == 2 ? 1 : \
2440 (n) == 3 ? 3 : \
2441 (n) == 4 ? 6 : \
2442 (n) == 5 ? 7 : \
2443 (n) == 6 ? 4 : \
2444 (n) == 7 ? 5 : \
2445 (n) + 4)
2446
469ac993
JM
2447/* Before the prologue, RA is at 0(%esp). */
2448#define INCOMING_RETURN_ADDR_RTX \
f64cecad 2449 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
469ac993 2450
e414ab29
RH
2451/* After the prologue, RA is at -4(AP) in the current frame. */
2452#define RETURN_ADDR_RTX(COUNT, FRAME) \
2453 ((COUNT) == 0 \
f64cecad
JC
2454 ? gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT(-4)))\
2455 : gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, (FRAME), GEN_INT(4))))
e414ab29 2456
469ac993
JM
2457/* PC is dbx register 8; let's use that column for RA. */
2458#define DWARF_FRAME_RETURN_COLUMN 8
2459
a6ab3aad
JM
2460/* Before the prologue, the top of the frame is at 4(%esp). */
2461#define INCOMING_FRAME_SP_OFFSET 4
2462
c98f8742
JVA
2463/* This is how to output the definition of a user-level label named NAME,
2464 such as the label on a static function or variable NAME. */
2465
2466#define ASM_OUTPUT_LABEL(FILE,NAME) \
2467 (assemble_name (FILE, NAME), fputs (":\n", FILE))
2468
2469/* This is how to output an assembler line defining a `double' constant. */
2470
0038aea6
JVA
2471#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2472do { long l[2]; \
2473 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
f64cecad 2474 fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
0038aea6 2475 } while (0)
c98f8742 2476
0038aea6
JVA
2477/* This is how to output a `long double' extended real constant. */
2478
2479#undef ASM_OUTPUT_LONG_DOUBLE
2480#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2481do { long l[3]; \
2482 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
f64cecad 2483 fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
0038aea6 2484 } while (0)
c98f8742
JVA
2485
2486/* This is how to output an assembler line defining a `float' constant. */
2487
0038aea6
JVA
2488#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2489do { long l; \
2490 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
f64cecad 2491 fprintf ((FILE), "%s 0x%lx\n", ASM_LONG, l); \
c98f8742
JVA
2492 } while (0)
2493
c98f8742
JVA
2494/* Store in OUTPUT a string (made with alloca) containing
2495 an assembler-name for a local static variable named NAME.
2496 LABELNO is an integer which is different for each call. */
2497
2498#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2499( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2500 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2501
2502
2503
2504/* This is how to output an assembler line defining an `int' constant. */
2505
2506#define ASM_OUTPUT_INT(FILE,VALUE) \
2507( fprintf (FILE, "%s ", ASM_LONG), \
2508 output_addr_const (FILE,(VALUE)), \
2509 putc('\n',FILE))
2510
2511/* Likewise for `char' and `short' constants. */
2512/* is this supposed to do align too?? */
2513
2514#define ASM_OUTPUT_SHORT(FILE,VALUE) \
2515( fprintf (FILE, "%s ", ASM_SHORT), \
2516 output_addr_const (FILE,(VALUE)), \
2517 putc('\n',FILE))
2518
2519/*
2520#define ASM_OUTPUT_SHORT(FILE,VALUE) \
2521( fprintf (FILE, "%s ", ASM_BYTE_OP), \
2522 output_addr_const (FILE,(VALUE)), \
2523 fputs (",", FILE), \
2524 output_addr_const (FILE,(VALUE)), \
2525 fputs (" >> 8\n",FILE))
2526*/
2527
2528
2529#define ASM_OUTPUT_CHAR(FILE,VALUE) \
2530( fprintf (FILE, "%s ", ASM_BYTE_OP), \
2531 output_addr_const (FILE, (VALUE)), \
2532 putc ('\n', FILE))
2533
2534/* This is how to output an assembler line for a numeric constant byte. */
2535
2536#define ASM_OUTPUT_BYTE(FILE,VALUE) \
2537 fprintf ((FILE), "%s 0x%x\n", ASM_BYTE_OP, (VALUE))
2538
2539/* This is how to output an insn to push a register on the stack.
2540 It need not be very fast code. */
2541
2542#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
b078c5c6 2543 fprintf (FILE, "\tpushl %%e%s\n", reg_names[REGNO])
c98f8742
JVA
2544
2545/* This is how to output an insn to pop a register from the stack.
2546 It need not be very fast code. */
2547
2548#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
b078c5c6 2549 fprintf (FILE, "\tpopl %%e%s\n", reg_names[REGNO])
c98f8742
JVA
2550
2551/* This is how to output an element of a case-vector that is absolute.
2552 */
2553
2554#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2555 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
2556
2557/* This is how to output an element of a case-vector that is relative.
2558 We don't use these on the 386 yet, because the ATT assembler can't do
2559 forward reference the differences.
2560 */
2561
33f7f353 2562#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
c98f8742
JVA
2563 fprintf (FILE, "\t.word %s%d-%s%d\n",LPREFIX, VALUE,LPREFIX, REL)
2564
2565/* Define the parentheses used to group arithmetic operations
2566 in assembler code. */
2567
2568#define ASM_OPEN_PAREN ""
2569#define ASM_CLOSE_PAREN ""
2570
2571/* Define results of standard character escape sequences. */
2572#define TARGET_BELL 007
2573#define TARGET_BS 010
2574#define TARGET_TAB 011
2575#define TARGET_NEWLINE 012
2576#define TARGET_VT 013
2577#define TARGET_FF 014
2578#define TARGET_CR 015
74b42c8b 2579\f
c98f8742
JVA
2580/* Print operand X (an rtx) in assembler syntax to file FILE.
2581 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2582 The CODE z takes the size of operand from the following digit, and
2583 outputs b,w,or l respectively.
2584
2585 On the 80386, we use several such letters:
2586 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
0038aea6 2587 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
c98f8742
JVA
2588 R -- print the prefix for register names.
2589 z -- print the opcode suffix for the size of the current operand.
2590 * -- print a star (in certain assembler syntax)
5cb6195d
RH
2591 P -- if PIC, print an @PLT suffix.
2592 X -- don't print any sort of PIC '@' suffix for a symbol.
2593 J -- print jump insn for arithmetic_comparison_operator.
2594 s -- ??? something to do with double shifts. not actually used, afaik.
2595 C -- print a conditional move suffix corresponding to the op code.
2596 c -- likewise, but reverse the condition.
2597 F,f -- likewise, but for floating-point. */
c98f8742
JVA
2598
2599#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2600 ((CODE) == '*')
2601
74b42c8b
RS
2602/* Print the name of a register based on its machine mode and number.
2603 If CODE is 'w', pretend the mode is HImode.
2604 If CODE is 'b', pretend the mode is QImode.
2605 If CODE is 'k', pretend the mode is SImode.
2606 If CODE is 'h', pretend the reg is the `high' byte register.
2607 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
2608
aa3e8d2a
JVA
2609extern char *hi_reg_name[];
2610extern char *qi_reg_name[];
2611extern char *qi_high_reg_name[];
2612
74b42c8b 2613#define PRINT_REG(X, CODE, FILE) \
aa3e8d2a
JVA
2614 do { if (REGNO (X) == ARG_POINTER_REGNUM) \
2615 abort (); \
74b42c8b
RS
2616 fprintf (FILE, "%s", RP); \
2617 switch ((CODE == 'w' ? 2 \
2618 : CODE == 'b' ? 1 \
2619 : CODE == 'k' ? 4 \
2620 : CODE == 'y' ? 3 \
2621 : CODE == 'h' ? 0 \
2622 : GET_MODE_SIZE (GET_MODE (X)))) \
2623 { \
2624 case 3: \
2625 if (STACK_TOP_P (X)) \
aa3e8d2a
JVA
2626 { \
2627 fputs ("st(0)", FILE); \
2628 break; \
2629 } \
2630 case 4: \
2631 case 8: \
0038aea6 2632 case 12: \
9e06e321 2633 if (! FP_REG_P (X)) fputs ("e", FILE); \
74b42c8b
RS
2634 case 2: \
2635 fputs (hi_reg_name[REGNO (X)], FILE); \
2636 break; \
2637 case 1: \
2638 fputs (qi_reg_name[REGNO (X)], FILE); \
2639 break; \
2640 case 0: \
2641 fputs (qi_high_reg_name[REGNO (X)], FILE); \
2642 break; \
2643 } \
2644 } while (0)
2645
c98f8742
JVA
2646#define PRINT_OPERAND(FILE, X, CODE) \
2647 print_operand (FILE, X, CODE)
c98f8742
JVA
2648
2649#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
2650 print_operand_address (FILE, ADDR)
2651
aa3e8d2a
JVA
2652/* Print the name of a register for based on its machine mode and number.
2653 This macro is used to print debugging output.
2654 This macro is different from PRINT_REG in that it may be used in
2655 programs that are not linked with aux-output.o. */
2656
2657#define DEBUG_PRINT_REG(X, CODE, FILE) \
2658 do { static char *hi_name[] = HI_REGISTER_NAMES; \
2659 static char *qi_name[] = QI_REGISTER_NAMES; \
7488be4e 2660 fprintf (FILE, "%d %s", REGNO (X), RP); \
aa3e8d2a
JVA
2661 if (REGNO (X) == ARG_POINTER_REGNUM) \
2662 { fputs ("argp", FILE); break; } \
2663 if (STACK_TOP_P (X)) \
2664 { fputs ("st(0)", FILE); break; } \
b0ceea8c
RK
2665 if (FP_REG_P (X)) \
2666 { fputs (hi_name[REGNO(X)], FILE); break; } \
aa3e8d2a
JVA
2667 switch (GET_MODE_SIZE (GET_MODE (X))) \
2668 { \
b0ceea8c
RK
2669 default: \
2670 fputs ("e", FILE); \
aa3e8d2a
JVA
2671 case 2: \
2672 fputs (hi_name[REGNO (X)], FILE); \
2673 break; \
2674 case 1: \
2675 fputs (qi_name[REGNO (X)], FILE); \
2676 break; \
2677 } \
2678 } while (0)
2679
c98f8742
JVA
2680/* Output the prefix for an immediate operand, or for an offset operand. */
2681#define PRINT_IMMED_PREFIX(FILE) fputs (IP, (FILE))
2682#define PRINT_OFFSET_PREFIX(FILE) fputs (IP, (FILE))
2683
2684/* Routines in libgcc that return floats must return them in an fp reg,
2685 just as other functions do which return such values.
2686 These macros make that happen. */
2687
2688#define FLOAT_VALUE_TYPE float
2689#define INTIFY(FLOATVAL) FLOATVAL
2690
2691/* Nonzero if INSN magically clobbers register REGNO. */
2692
2693/* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) \
2694 (FP_REGNO_P (REGNO) \
2695 && (GET_CODE (INSN) == JUMP_INSN || GET_CODE (INSN) == BARRIER))
2696*/
2697
2698/* a letter which is not needed by the normal asm syntax, which
2699 we can use for operand syntax in the extended asm */
2700
2701#define ASM_OPERAND_LETTER '#'
c98f8742 2702#define RET return ""
f64cecad 2703#define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx))
d4ba09c0
SC
2704\f
2705/* Helper macros to expand a binary/unary operator if needed */
2706#define IX86_EXPAND_BINARY_OPERATOR(OP, MODE, OPERANDS) \
2707do { \
2708 if (!ix86_expand_binary_operator (OP, MODE, OPERANDS)) \
2709 FAIL; \
2710} while (0)
2711
2712#define IX86_EXPAND_UNARY_OPERATOR(OP, MODE, OPERANDS) \
2713do { \
2714 if (!ix86_expand_unary_operator (OP, MODE, OPERANDS,)) \
2715 FAIL; \
2716} while (0)
2717
c98f8742 2718\f
3b3c6a3f 2719/* Functions in i386.c */
f5316dfe
MM
2720extern void override_options ();
2721extern void order_regs_for_local_alloc ();
d4ba09c0 2722extern char *output_strlen_unroll ();
5bc7cd8e
SC
2723extern struct rtx_def *i386_sext16_if_const ();
2724extern int i386_aligned_p ();
2725extern int i386_cc_probably_useless_p ();
b08de47e
MM
2726extern int i386_valid_decl_attribute_p ();
2727extern int i386_valid_type_attribute_p ();
2728extern int i386_return_pops_args ();
2729extern int i386_comp_type_attributes ();
2730extern void init_cumulative_args ();
2731extern void function_arg_advance ();
2732extern struct rtx_def *function_arg ();
2733extern int function_arg_partial_nregs ();
f7746310 2734extern char *output_strlen_unroll ();
3b3c6a3f
MM
2735extern void output_op_from_reg ();
2736extern void output_to_reg ();
2737extern char *singlemove_string ();
2738extern char *output_move_double ();
b840bfb0
MM
2739extern char *output_move_memory ();
2740extern char *output_move_pushmem ();
3b3c6a3f
MM
2741extern int standard_80387_constant_p ();
2742extern char *output_move_const_single ();
2743extern int symbolic_operand ();
2744extern int call_insn_operand ();
2745extern int expander_call_insn_operand ();
2746extern int symbolic_reference_mentioned_p ();
d4ba09c0
SC
2747extern int ix86_expand_binary_operator ();
2748extern int ix86_binary_operator_ok ();
2749extern int ix86_expand_unary_operator ();
2750extern int ix86_unary_operator_ok ();
3b3c6a3f
MM
2751extern void emit_pic_move ();
2752extern void function_prologue ();
2753extern int simple_386_epilogue ();
2754extern void function_epilogue ();
2755extern int legitimate_address_p ();
2756extern struct rtx_def *legitimize_pic_address ();
2757extern struct rtx_def *legitimize_address ();
2758extern void print_operand ();
2759extern void print_operand_address ();
2760extern void notice_update_cc ();
2761extern void split_di ();
2762extern int binary_387_op ();
2763extern int shift_op ();
2764extern int VOIDmode_compare_op ();
2765extern char *output_387_binary_op ();
2766extern char *output_fix_trunc ();
2767extern char *output_float_compare ();
2768extern char *output_fp_cc0_set ();
2769extern void save_386_machine_status ();
2770extern void restore_386_machine_status ();
2771extern void clear_386_stack_locals ();
2772extern struct rtx_def *assign_386_stack_local ();
d4ba09c0
SC
2773extern int is_mul ();
2774extern int is_div ();
2775extern int last_to_set_cc ();
2776extern int doesnt_set_condition_code ();
2777extern int sets_condition_code ();
2778extern int str_immediate_operand ();
2779extern int is_fp_insn ();
2780extern int is_fp_dest ();
2781extern int is_fp_store ();
2782extern int agi_dependent ();
2783extern int reg_mentioned_in_mem ();
5a77b5f3
JL
2784extern char *output_int_conditional_move ();
2785extern char *output_fp_conditional_move ();
2305ac0d 2786extern int ix86_can_use_return_insn_p ();
d4ba09c0
SC
2787
2788#ifdef NOTYET
2789extern struct rtx_def *copy_all_rtx ();
2790extern void rewrite_address ();
2791#endif
3b3c6a3f 2792
f5316dfe 2793/* Variables in i386.c */
241e1a89 2794extern char *ix86_cpu_string; /* for -mcpu=<xxx> */
bcd86433 2795extern char *ix86_arch_string; /* for -march=<xxx> */
f5316dfe 2796extern char *i386_reg_alloc_order; /* register allocation order */
b08de47e
MM
2797extern char *i386_regparm_string; /* # registers to use to pass args */
2798extern char *i386_align_loops_string; /* power of two alignment for loops */
2799extern char *i386_align_jumps_string; /* power of two alignment for non-loop jumps */
2800extern char *i386_align_funcs_string; /* power of two alignment for functions */
e2a606cb 2801extern char *i386_branch_cost_string; /* values 1-5: see jump.c */
b08de47e
MM
2802extern int i386_regparm; /* i386_regparm_string as a number */
2803extern int i386_align_loops; /* power of two alignment for loops */
2804extern int i386_align_jumps; /* power of two alignment for non-loop jumps */
2805extern int i386_align_funcs; /* power of two alignment for functions */
e2a606cb 2806extern int i386_branch_cost; /* values 1-5: see jump.c */
f5316dfe
MM
2807extern char *hi_reg_name[]; /* names for 16 bit regs */
2808extern char *qi_reg_name[]; /* names for 8 bit regs (low) */
2809extern char *qi_high_reg_name[]; /* names for 8 bit regs (high) */
2810extern enum reg_class regclass_map[]; /* smalled class containing REGNO */
2811extern struct rtx_def *i386_compare_op0; /* operand 0 for comparisons */
2812extern struct rtx_def *i386_compare_op1; /* operand 1 for comparisons */
2813
3b3c6a3f 2814/* External variables used */
d4ba09c0
SC
2815extern int optimize; /* optimization level */
2816extern int obey_regdecls; /* TRUE if stupid register allocation */
3b3c6a3f
MM
2817
2818/* External functions used */
2819extern struct rtx_def *force_operand ();
d4ba09c0 2820
3b3c6a3f 2821\f
c98f8742
JVA
2822/*
2823Local variables:
2824version-control: t
2825End:
2826*/
This page took 0.774013 seconds and 5 git commands to generate.