]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/i386.h
(struct globals): Likewise.
[thirdparty/gcc.git] / gcc / config / i386 / i386.h
CommitLineData
e075ae69 1/* Definitions of target machine for GNU compiler for IA-32.
d7a29404 2 Copyright (C) 1988, 92, 94-99, 2000 Free Software Foundation, Inc.
c98f8742
JVA
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
97aadbb9 18the Free Software Foundation, 59 Temple Place - Suite 330,
d4ba09c0 19Boston, MA 02111-1307, USA. */
c98f8742
JVA
20
21/* The purpose of this file is to define the characteristics of the i386,
b4ac57ab 22 independent of assembler syntax or operating system.
c98f8742
JVA
23
24 Three other files build on this one to describe a specific assembler syntax:
25 bsd386.h, att386.h, and sun386.h.
26
27 The actual tm.h file for a particular system should include
28 this file, and then the file for the appropriate assembler syntax.
29
30 Many macros that specify assembler syntax are omitted entirely from
31 this file because they really belong in the files for particular
e075ae69
RH
32 assemblers. These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR,
33 ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
34 that start with ASM_ or end in ASM_OP. */
c98f8742
JVA
35
36/* Names to predefine in the preprocessor for this target machine. */
37
38#define I386 1
39
95393dfd
CH
40/* Stubs for half-pic support if not OSF/1 reference platform. */
41
42#ifndef HALF_PIC_P
43#define HALF_PIC_P() 0
44#define HALF_PIC_NUMBER_PTRS 0
45#define HALF_PIC_NUMBER_REFS 0
46#define HALF_PIC_ENCODE(DECL)
47#define HALF_PIC_DECLARE(NAME)
48#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
49#define HALF_PIC_ADDRESS_P(X) 0
50#define HALF_PIC_PTR(X) X
51#define HALF_PIC_FINISH(STREAM)
52#endif
53
d4ba09c0
SC
54/* Define the specific costs for a given cpu */
55
56struct processor_costs {
57 int add; /* cost of an add instruction */
58 int lea; /* cost of a lea instruction */
59 int shift_var; /* variable shift costs */
60 int shift_const; /* constant shift costs */
61 int mult_init; /* cost of starting a multiply */
62 int mult_bit; /* cost of multiply per each bit set */
63 int divide; /* cost of a divide/mod */
e075ae69 64 int large_insn; /* insns larger than this cost more */
e2e52e1b
JH
65 int move_ratio; /* The threshold of number of scalar memory-to-memory
66 move insns. */
7c6b971d 67 int movzbl_load; /* cost of loading using movzbl */
96e7ae40
JH
68 int int_load[3]; /* cost of loading integer registers
69 in QImode, HImode and SImode relative
70 to reg-reg move (2). */
71 int int_store[3]; /* cost of storing integer register
72 in QImode, HImode and SImode */
73 int fp_move; /* cost of reg,reg fld/fst */
74 int fp_load[3]; /* cost of loading FP register
75 in SFmode, DFmode and XFmode */
76 int fp_store[3]; /* cost of storing FP register
77 in SFmode, DFmode and XFmode */
d4ba09c0
SC
78};
79
80extern struct processor_costs *ix86_cost;
81
c98f8742
JVA
82/* Run-time compilation parameters selecting different hardware subsets. */
83
84extern int target_flags;
85
86/* Macros used in the machine description to test the flags. */
87
ddd5a7c1 88/* configure can arrange to make this 2, to force a 486. */
e075ae69 89
35b528be
RS
90#ifndef TARGET_CPU_DEFAULT
91#define TARGET_CPU_DEFAULT 0
92#endif
93
3b3c6a3f 94/* Masks for the -m switches */
e075ae69
RH
95#define MASK_80387 0x00000001 /* Hardware floating point */
96#define MASK_RTD 0x00000002 /* Use ret that pops args */
97#define MASK_ALIGN_DOUBLE 0x00000004 /* align doubles to 2 word boundary */
98#define MASK_SVR3_SHLIB 0x00000008 /* Uninit locals into bss */
99#define MASK_IEEE_FP 0x00000010 /* IEEE fp comparisons */
100#define MASK_FLOAT_RETURNS 0x00000020 /* Return float in st(0) */
101#define MASK_NO_FANCY_MATH_387 0x00000040 /* Disable sin, cos, sqrt */
102#define MASK_OMIT_LEAF_FRAME_POINTER 0x080 /* omit leaf frame pointers */
103#define MASK_STACK_PROBE 0x00000100 /* Enable stack probing */
104
105/* Temporary codegen switches */
dc174fb1
MM
106#define MASK_INTEL_SYNTAX 0x00000200
107#define MASK_DEBUG_ARG 0x00000400 /* function_arg */
108#define MASK_DEBUG_ADDR 0x00000800 /* GO_IF_LEGITIMATE_ADDRESS */
3b3c6a3f
MM
109
110/* Use the floating point instructions */
111#define TARGET_80387 (target_flags & MASK_80387)
112
c98f8742
JVA
113/* Compile using ret insn that pops args.
114 This will not work unless you use prototypes at least
115 for all functions that can take varying numbers of args. */
3b3c6a3f
MM
116#define TARGET_RTD (target_flags & MASK_RTD)
117
b08de47e
MM
118/* Align doubles to a two word boundary. This breaks compatibility with
119 the published ABI's for structures containing doubles, but produces
120 faster code on the pentium. */
121#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
c98f8742 122
d7cd15e9
RS
123/* Put uninitialized locals into bss, not data.
124 Meaningful only on svr3. */
3b3c6a3f 125#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
d7cd15e9 126
c572e5ba
JVA
127/* Use IEEE floating point comparisons. These handle correctly the cases
128 where the result of a comparison is unordered. Normally SIGFPE is
129 generated in such cases, in which case this isn't needed. */
3b3c6a3f 130#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
c572e5ba 131
8c2bf92a
JVA
132/* Functions that return a floating point value may return that value
133 in the 387 FPU or in 386 integer registers. If set, this flag causes
134 the 387 to be used, which is compatible with most calling conventions. */
3b3c6a3f 135#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
8c2bf92a 136
099800e3
RK
137/* Disable generation of FP sin, cos and sqrt operations for 387.
138 This is because FreeBSD lacks these in the math-emulator-code */
3b3c6a3f
MM
139#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
140
2f2fa5b1 141/* Don't create frame pointers for leaf functions */
e075ae69
RH
142#define TARGET_OMIT_LEAF_FRAME_POINTER \
143 (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
f6f58ba3 144
3b3c6a3f
MM
145/* Debug GO_IF_LEGITIMATE_ADDRESS */
146#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
147
b08de47e
MM
148/* Debug FUNCTION_ARG macros */
149#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
150
f7746310
SC
151#define TARGET_386 (ix86_cpu == PROCESSOR_I386)
152#define TARGET_486 (ix86_cpu == PROCESSOR_I486)
153#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
3a0433fd 154#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
a269a03c 155#define TARGET_K6 (ix86_cpu == PROCESSOR_K6)
309ada50 156#define TARGET_ATHLON (ix86_cpu == PROCESSOR_ATHLON)
a269a03c
JC
157
158#define CPUMASK (1 << ix86_cpu)
159extern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and;
160extern const int x86_use_bit_test, x86_cmove, x86_deep_branch;
161extern const int x86_unroll_strlen, x86_use_q_reg, x86_use_any_reg;
e075ae69
RH
162extern const int x86_double_with_add, x86_partial_reg_stall, x86_movx;
163extern const int x86_use_loop, x86_use_fiop, x86_use_mov0;
164extern const int x86_use_cltd, x86_read_modify_write;
165extern const int x86_read_modify, x86_split_long_moves;
f90800f8 166extern const int x86_promote_QImode, x86_single_stringop;
a269a03c
JC
167
168#define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
169#define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK)
170#define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & CPUMASK)
171#define TARGET_USE_BIT_TEST (x86_use_bit_test & CPUMASK)
172#define TARGET_UNROLL_STRLEN (x86_unroll_strlen & CPUMASK)
173#define TARGET_USE_Q_REG (x86_use_q_reg & CPUMASK)
174#define TARGET_USE_ANY_REG (x86_use_any_reg & CPUMASK)
175#define TARGET_CMOVE (x86_cmove & (1 << ix86_arch))
176#define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & CPUMASK)
177#define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & CPUMASK)
e075ae69
RH
178#define TARGET_USE_SAHF (x86_use_sahf & CPUMASK)
179#define TARGET_MOVX (x86_movx & CPUMASK)
180#define TARGET_PARTIAL_REG_STALL (x86_partial_reg_stall & CPUMASK)
181#define TARGET_USE_LOOP (x86_use_loop & CPUMASK)
182#define TARGET_USE_FIOP (x86_use_fiop & CPUMASK)
183#define TARGET_USE_MOV0 (x86_use_mov0 & CPUMASK)
184#define TARGET_USE_CLTD (x86_use_cltd & CPUMASK)
185#define TARGET_SPLIT_LONG_MOVES (x86_split_long_moves & CPUMASK)
186#define TARGET_READ_MODIFY_WRITE (x86_read_modify_write & CPUMASK)
187#define TARGET_READ_MODIFY (x86_read_modify & CPUMASK)
e9e80858 188#define TARGET_PROMOTE_QImode (x86_promote_QImode & CPUMASK)
f90800f8 189#define TARGET_SINGLE_STRINGOP (x86_single_stringop & CPUMASK)
a269a03c 190
8c9be447 191#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
3b3c6a3f 192
e075ae69
RH
193#define ASSEMBLER_DIALECT ((target_flags & MASK_INTEL_SYNTAX) != 0)
194
195#define TARGET_SWITCHES \
196{ { "80387", MASK_80387, "Use hardware fp" }, \
197 { "no-80387", -MASK_80387, "Do not use hardware fp" }, \
198 { "hard-float", MASK_80387, "Use hardware fp" }, \
199 { "soft-float", -MASK_80387, "Do not use hardware fp" }, \
200 { "no-soft-float", MASK_80387, "Use hardware fp" }, \
201 { "386", 0, "Same as -mcpu=i386" }, \
202 { "486", 0, "Same as -mcpu=i486" }, \
203 { "pentium", 0, "Same as -mcpu=pentium" }, \
204 { "pentiumpro", 0, "Same as -mcpu=pentiumpro" }, \
205 { "rtd", MASK_RTD, "Alternate calling convention" }, \
206 { "no-rtd", -MASK_RTD, "Use normal calling convention" }, \
207 { "align-double", MASK_ALIGN_DOUBLE, \
208 "Align some doubles on dword boundary" }, \
209 { "no-align-double", -MASK_ALIGN_DOUBLE, \
210 "Align doubles on word boundary" }, \
211 { "svr3-shlib", MASK_SVR3_SHLIB, \
212 "Uninitialized locals in .bss" }, \
213 { "no-svr3-shlib", -MASK_SVR3_SHLIB, \
214 "Uninitialized locals in .data" }, \
215 { "ieee-fp", MASK_IEEE_FP, \
216 "Use IEEE math for fp comparisons" }, \
217 { "no-ieee-fp", -MASK_IEEE_FP, \
218 "Do not use IEEE math for fp comparisons" }, \
219 { "fp-ret-in-387", MASK_FLOAT_RETURNS, \
220 "Return values of functions in FPU registers" }, \
221 { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS , \
222 "Do not return values of functions in FPU registers"}, \
223 { "no-fancy-math-387", MASK_NO_FANCY_MATH_387, \
224 "Do not generate sin, cos, sqrt for FPU" }, \
225 { "fancy-math-387", -MASK_NO_FANCY_MATH_387, \
226 "Generate sin, cos, sqrt for FPU"}, \
227 { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER, \
228 "Omit the frame pointer in leaf functions" }, \
229 { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, "" }, \
230 { "debug-addr", MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
231 { "no-debug-addr", -MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
232 { "debug-arg", MASK_DEBUG_ARG, 0 /* undocumented */ }, \
233 { "no-debug-arg", -MASK_DEBUG_ARG, 0 /* undocumented */ }, \
234 { "stack-arg-probe", MASK_STACK_PROBE, "Enable stack probing" }, \
235 { "no-stack-arg-probe", -MASK_STACK_PROBE, "" }, \
236 { "windows", 0, 0 /* undocumented */ }, \
237 { "dll", 0, 0 /* undocumented */ }, \
238 { "intel-syntax", MASK_INTEL_SYNTAX, \
239 "Emit Intel syntax assembler opcodes" }, \
240 { "no-intel-syntax", -MASK_INTEL_SYNTAX, "" }, \
241 SUBTARGET_SWITCHES \
242 { "", TARGET_DEFAULT, 0 }}
241e1a89 243
d4ba09c0
SC
244/* Which processor to schedule for. The cpu attribute defines a list that
245 mirrors this list, so changes to i386.md must be made at the same time. */
246
241e1a89 247enum processor_type
e075ae69
RH
248{
249 PROCESSOR_I386, /* 80386 */
241e1a89
SC
250 PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
251 PROCESSOR_PENTIUM,
a269a03c 252 PROCESSOR_PENTIUMPRO,
e075ae69 253 PROCESSOR_K6,
309ada50 254 PROCESSOR_ATHLON,
e075ae69
RH
255 PROCESSOR_max
256};
241e1a89 257
e42ea7f9 258extern enum processor_type ix86_cpu;
241e1a89 259
bcd86433 260extern int ix86_arch;
241e1a89 261
f5316dfe
MM
262/* This macro is similar to `TARGET_SWITCHES' but defines names of
263 command options that have values. Its definition is an
264 initializer with a subgrouping for each command option.
265
266 Each subgrouping contains a string constant, that defines the
267 fixed part of the option name, and the address of a variable. The
268 variable, type `char *', is set to the variable part of the given
269 option if the fixed part matches. The actual option name is made
270 by appending `-m' to the specified name. */
e075ae69
RH
271#define TARGET_OPTIONS \
272{ { "cpu=", &ix86_cpu_string, \
273 "Schedule code for given CPU"}, \
274 { "arch=", &ix86_arch_string, \
275 "Generate code for given CPU"}, \
276 { "reg-alloc=", &ix86_reg_alloc_order, \
277 "Control allocation order of integer registers" }, \
278 { "regparm=", &ix86_regparm_string, \
279 "Number of registers used to pass integer arguments" }, \
280 { "align-loops=", &ix86_align_loops_string, \
281 "Loop code aligned to this power of 2" }, \
282 { "align-jumps=", &ix86_align_jumps_string, \
283 "Jump targets are aligned to this power of 2" }, \
284 { "align-functions=", &ix86_align_funcs_string, \
285 "Function starts are aligned to this power of 2" }, \
286 { "preferred-stack-boundary=", \
287 &ix86_preferred_stack_boundary_string, \
288 "Attempt to keep stack aligned to this power of 2" }, \
289 { "branch-cost=", &ix86_branch_cost_string, \
290 "Branches are this expensive (1-5, arbitrary units)" }, \
291 SUBTARGET_OPTIONS \
b08de47e 292}
f5316dfe
MM
293
294/* Sometimes certain combinations of command options do not make
295 sense on a particular target machine. You can define a macro
296 `OVERRIDE_OPTIONS' to take account of this. This macro, if
297 defined, is executed once just after all the command options have
298 been parsed.
299
300 Don't use this macro to turn on various extra optimizations for
301 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
302
303#define OVERRIDE_OPTIONS override_options ()
304
305/* These are meant to be redefined in the host dependent files */
95393dfd 306#define SUBTARGET_SWITCHES
f5316dfe 307#define SUBTARGET_OPTIONS
95393dfd 308
d4ba09c0 309/* Define this to change the optimizations performed by default. */
c6aded7c 310#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
d4ba09c0 311
241e1a89
SC
312/* Specs for the compiler proper */
313
628714d8
RK
314#ifndef CC1_CPU_SPEC
315#define CC1_CPU_SPEC "\
241e1a89 316%{!mcpu*: \
5a6ee819
RH
317%{m386:-mcpu=i386} \
318%{m486:-mcpu=i486} \
241e1a89
SC
319%{mpentium:-mcpu=pentium} \
320%{mpentiumpro:-mcpu=pentiumpro}}"
321#endif
c98f8742 322\f
84b77fba 323#ifndef CPP_CPU_DEFAULT_SPEC
d5c65c96 324#if TARGET_CPU_DEFAULT == 1
5a6ee819
RH
325#define CPP_CPU_DEFAULT_SPEC "-D__tune_i486__"
326#endif
da594c94 327#if TARGET_CPU_DEFAULT == 2
5a6ee819
RH
328#define CPP_CPU_DEFAULT_SPEC "-D__tune_pentium__"
329#endif
da594c94 330#if TARGET_CPU_DEFAULT == 3
5a6ee819 331#define CPP_CPU_DEFAULT_SPEC "-D__tune_pentiumpro__"
da594c94 332#endif
5a6ee819
RH
333#if TARGET_CPU_DEFAULT == 4
334#define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__"
da594c94 335#endif
309ada50
JH
336#if TARGET_CPU_DEFAULT == 5
337#define CPP_CPU_DEFAULT_SPEC "-D__tune_athlon__"
338#endif
5a6ee819
RH
339#ifndef CPP_CPU_DEFAULT_SPEC
340#define CPP_CPU_DEFAULT_SPEC "-D__tune_i386__"
84b77fba
JW
341#endif
342#endif /* CPP_CPU_DEFAULT_SPEC */
33c1d53a 343
84b77fba 344#ifndef CPP_CPU_SPEC
bcd86433 345#define CPP_CPU_SPEC "\
5d46457e 346-Acpu(i386) -Amachine(i386) \
1228a9bd 347%{!ansi:-Di386} -D__i386 -D__i386__ \
5a6ee819
RH
348%{march=i386:%{!mcpu*:-D__tune_i386__ }}\
349%{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
350%{march=pentium|march=i586:-D__pentium -D__pentium__ \
351 %{!mcpu*:-D__tune_pentium__ }}\
352%{march=pentiumpro|march=i686:-D__pentiumpro -D__pentiumpro__ \
353 %{!mcpu*:-D__tune_pentiumpro__ }}\
354%{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
309ada50 355%{march=athlon:-D__athlon -D__athlon__ %{!mcpu*:-D__tune_athlon__ }}\
5a6ee819
RH
356%{m386|mcpu=i386:-D__tune_i386__ }\
357%{m486|mcpu=i486:-D__tune_i486__ }\
358%{mpentium|mcpu=pentium|mcpu=i586:-D__tune_pentium__ }\
359%{mpentiumpro|mcpu=pentiumpro|mcpu=i686:-D__tune_pentiumpro__ }\
360%{mcpu=k6:-D__tune_k6__ }\
309ada50 361%{mcpu=athlon:-D__tune_athlon__ }\
5a6ee819 362%{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
84b77fba 363#endif
bcd86433 364
628714d8 365#ifndef CC1_SPEC
8015b78d 366#define CC1_SPEC "%(cc1_cpu) "
628714d8
RK
367#endif
368
369/* This macro defines names of additional specifications to put in the
370 specs that can be used in various specifications like CC1_SPEC. Its
371 definition is an initializer with a subgrouping for each command option.
bcd86433
SC
372
373 Each subgrouping contains a string constant, that defines the
374 specification name, and a string constant that used by the GNU CC driver
375 program.
376
377 Do not define this macro if it does not need to do anything. */
378
379#ifndef SUBTARGET_EXTRA_SPECS
380#define SUBTARGET_EXTRA_SPECS
381#endif
382
383#define EXTRA_SPECS \
84b77fba 384 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
bcd86433 385 { "cpp_cpu", CPP_CPU_SPEC }, \
628714d8 386 { "cc1_cpu", CC1_CPU_SPEC }, \
bcd86433
SC
387 SUBTARGET_EXTRA_SPECS
388\f
c98f8742
JVA
389/* target machine storage layout */
390
0038aea6
JVA
391/* Define for XFmode extended real floating point support.
392 This will automatically cause REAL_ARITHMETIC to be defined. */
393#define LONG_DOUBLE_TYPE_SIZE 96
394
395/* Define if you don't want extended real, but do want to use the
396 software floating point emulator for REAL_ARITHMETIC and
397 decimal <-> binary conversion. */
398/* #define REAL_ARITHMETIC */
399
c98f8742
JVA
400/* Define this if most significant byte of a word is the lowest numbered. */
401/* That is true on the 80386. */
402
403#define BITS_BIG_ENDIAN 0
404
405/* Define this if most significant byte of a word is the lowest numbered. */
406/* That is not true on the 80386. */
407#define BYTES_BIG_ENDIAN 0
408
409/* Define this if most significant word of a multiword number is the lowest
410 numbered. */
411/* Not true for 80386 */
412#define WORDS_BIG_ENDIAN 0
413
b4ac57ab 414/* number of bits in an addressable storage unit */
c98f8742
JVA
415#define BITS_PER_UNIT 8
416
417/* Width in bits of a "word", which is the contents of a machine register.
418 Note that this is not necessarily the width of data type `int';
419 if using 16-bit ints on a 80386, this would still be 32.
420 But on a machine with 16-bit registers, this would be 16. */
421#define BITS_PER_WORD 32
422
423/* Width of a word, in units (bytes). */
424#define UNITS_PER_WORD 4
425
426/* Width in bits of a pointer.
427 See also the macro `Pmode' defined below. */
428#define POINTER_SIZE 32
429
430/* Allocation boundary (in *bits*) for storing arguments in argument list. */
431#define PARM_BOUNDARY 32
432
e075ae69 433/* Boundary (in *bits*) on which stack pointer should be aligned. */
d5c65c96 434#define STACK_BOUNDARY 32
c98f8742 435
3af4bd89
JH
436/* Boundary (in *bits*) on which the stack pointer preferrs to be
437 aligned; the compiler cannot rely on having this alignment. */
e075ae69 438#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
65954bd8 439
e075ae69
RH
440/* Allocation boundary for the code of a function. */
441#define FUNCTION_BOUNDARY \
442 (1 << ((ix86_align_funcs >= 0 ? ix86_align_funcs : -ix86_align_funcs) + 3))
c98f8742
JVA
443
444/* Alignment of field after `int : 0' in a structure. */
445
446#define EMPTY_FIELD_BOUNDARY 32
447
448/* Minimum size in bits of the largest boundary to which any
449 and all fundamental data types supported by the hardware
450 might need to be aligned. No data type wants to be aligned
17f24ff0
JH
451 rounder than this.
452
453 Pentium+ preferrs DFmode values to be alignmed to 64 bit boundary
454 and Pentium Pro XFmode values at 128 bit boundaries. */
455
456#define BIGGEST_ALIGNMENT 128
457
458/* The published ABIs say that doubles should be aligned on word
459 boundaries, so lower the aligmnet for structure fields unless
460 -malign_double is set. */
461
462#define BIGGEST_FIELD_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
c98f8742 463
e5e8a8bf
JW
464/* If defined, a C expression to compute the alignment given to a
465 constant that is being placed in memory. CONSTANT is the constant
466 and ALIGN is the alignment that the object would ordinarily have.
467 The value of this macro is used instead of that alignment to align
468 the object.
469
470 If this macro is not defined, then ALIGN is used.
471
472 The typical use of this macro is to increase alignment for string
473 constants to be word aligned so that `strcpy' calls that copy
474 constants can be done inline. */
475
476#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
477 (TREE_CODE (EXP) == REAL_CST \
478 ? ((TYPE_MODE (TREE_TYPE (EXP)) == DFmode && (ALIGN) < 64) \
479 ? 64 \
480 : (TYPE_MODE (TREE_TYPE (EXP)) == XFmode && (ALIGN) < 128) \
481 ? 128 \
482 : (ALIGN)) \
483 : TREE_CODE (EXP) == STRING_CST \
484 ? ((TREE_STRING_LENGTH (EXP) >= 31 && (ALIGN) < 256) \
485 ? 256 \
486 : (ALIGN)) \
487 : (ALIGN))
d4ba09c0 488
8a022443
JW
489/* If defined, a C expression to compute the alignment for a static
490 variable. TYPE is the data type, and ALIGN is the alignment that
491 the object would ordinarily have. The value of this macro is used
492 instead of that alignment to align the object.
493
494 If this macro is not defined, then ALIGN is used.
495
496 One use of this macro is to increase alignment of medium-size
497 data to make it all fit in fewer cache lines. Another is to
498 cause character arrays to be word-aligned so that `strcpy' calls
499 that copy constants to character arrays can be done inline. */
500
501#define DATA_ALIGNMENT(TYPE, ALIGN) \
502 ((AGGREGATE_TYPE_P (TYPE) \
503 && TYPE_SIZE (TYPE) \
504 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
505 && (TREE_INT_CST_LOW (TYPE_SIZE (TYPE)) >= 256 \
506 || TREE_INT_CST_HIGH (TYPE_SIZE (TYPE))) && (ALIGN) < 256) \
507 ? 256 \
508 : TREE_CODE (TYPE) == ARRAY_TYPE \
509 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
510 ? 64 \
511 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
512 ? 128 \
513 : (ALIGN)) \
514 : TREE_CODE (TYPE) == COMPLEX_TYPE \
515 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
516 ? 64 \
517 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
518 ? 128 \
519 : (ALIGN)) \
520 : ((TREE_CODE (TYPE) == RECORD_TYPE \
521 || TREE_CODE (TYPE) == UNION_TYPE \
522 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
523 && TYPE_FIELDS (TYPE)) \
524 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
525 ? 64 \
526 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
527 ? 128 \
528 : (ALIGN)) \
529 : TREE_CODE (TYPE) == REAL_TYPE \
530 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
531 ? 64 \
532 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
d16790f2
JW
533 ? 128 \
534 : (ALIGN)) \
535 : (ALIGN))
536
537/* If defined, a C expression to compute the alignment for a local
538 variable. TYPE is the data type, and ALIGN is the alignment that
539 the object would ordinarily have. The value of this macro is used
540 instead of that alignment to align the object.
541
542 If this macro is not defined, then ALIGN is used.
543
544 One use of this macro is to increase alignment of medium-size
545 data to make it all fit in fewer cache lines. */
546
547#define LOCAL_ALIGNMENT(TYPE, ALIGN) \
548 (TREE_CODE (TYPE) == ARRAY_TYPE \
549 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
550 ? 64 \
551 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
552 ? 128 \
553 : (ALIGN)) \
554 : TREE_CODE (TYPE) == COMPLEX_TYPE \
555 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
556 ? 64 \
557 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
558 ? 128 \
559 : (ALIGN)) \
560 : ((TREE_CODE (TYPE) == RECORD_TYPE \
561 || TREE_CODE (TYPE) == UNION_TYPE \
562 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
563 && TYPE_FIELDS (TYPE)) \
564 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
565 ? 64 \
566 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
567 ? 128 \
568 : (ALIGN)) \
569 : TREE_CODE (TYPE) == REAL_TYPE \
570 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
571 ? 64 \
572 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
8a022443
JW
573 ? 128 \
574 : (ALIGN)) \
575 : (ALIGN))
576
b4ac57ab 577/* Set this non-zero if move instructions will actually fail to work
c98f8742 578 when given unaligned data. */
b4ac57ab 579#define STRICT_ALIGNMENT 0
c98f8742
JVA
580
581/* If bit field type is int, don't let it cross an int,
582 and give entire struct the alignment of an int. */
583/* Required on the 386 since it doesn't have bitfield insns. */
584#define PCC_BITFIELD_TYPE_MATTERS 1
585
586/* Align loop starts for optimal branching. */
e075ae69
RH
587#define LOOP_ALIGN(LABEL) \
588 (ix86_align_loops < 0 ? -ix86_align_loops : ix86_align_loops)
589#define LOOP_ALIGN_MAX_SKIP \
590 (ix86_align_loops < -3 ? (1<<(-ix86_align_loops-1))-1 : 0)
591
592/* This is how to align an instruction for optimal branching. */
593#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
594 (ix86_align_jumps < 0 ? -ix86_align_jumps : ix86_align_jumps)
595#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP \
596 (ix86_align_jumps < -3 ? (1<<(-ix86_align_jumps-1))-1 : 0)
c98f8742
JVA
597\f
598/* Standard register usage. */
599
600/* This processor has special stack-like registers. See reg-stack.c
601 for details. */
602
603#define STACK_REGS
d4ba09c0 604#define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode)
c98f8742
JVA
605
606/* Number of actual hardware registers.
607 The hardware registers are assigned numbers for the compiler
608 from 0 to just below FIRST_PSEUDO_REGISTER.
609 All registers that the compiler knows about must be given numbers,
610 even those that are not normally considered general registers.
611
612 In the 80386 we give the 8 general purpose registers the numbers 0-7.
613 We number the floating point registers 8-15.
614 Note that registers 0-7 can be accessed as a short or int,
615 while only 0-3 may be used with byte `mov' instructions.
616
617 Reg 16 does not correspond to any hardware register, but instead
618 appears in the RTL as an argument pointer prior to reload, and is
619 eliminated during reloading in favor of either the stack or frame
620 pointer. */
621
7c7ef435 622#define FIRST_PSEUDO_REGISTER 20
c98f8742 623
3073d01c
ML
624/* Number of hardware registers that go into the DWARF-2 unwind info.
625 If not defined, equals FIRST_PSEUDO_REGISTER. */
626
627#define DWARF_FRAME_REGISTERS 17
628
c98f8742
JVA
629/* 1 for registers that have pervasive standard uses
630 and are not available for the register allocator.
631 On the 80386, the stack pointer is such, as is the arg pointer. */
632#define FIXED_REGISTERS \
7c7ef435
JH
633/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr, dir*/ \
634{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }
c98f8742
JVA
635
636/* 1 for registers not available across function calls.
637 These must include the FIXED_REGISTERS and also any
638 registers that can be used without being saved.
639 The latter must include the registers where values are returned
640 and the register where structure-value addresses are passed.
641 Aside from that, you can include as many other registers as you like. */
642
643#define CALL_USED_REGISTERS \
7c7ef435
JH
644/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr, dir*/ \
645{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
c98f8742 646
3b3c6a3f
MM
647/* Order in which to allocate registers. Each register must be
648 listed once, even those in FIXED_REGISTERS. List frame pointer
649 late and fixed registers last. Note that, in general, we prefer
650 registers listed in CALL_USED_REGISTERS, keeping the others
651 available for storage of persistent values.
652
653 Three different versions of REG_ALLOC_ORDER have been tried:
654
655 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
656 but slower code on simple functions returning values in eax.
657
658 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
659 perl 4.036 due to not being able to create a DImode register (to hold a 2
660 word union).
661
662 If the order is eax, edx, ecx, ... it produces better code for simple
663 functions, and a slightly slower compiler. Users complained about the code
664 generated by allocating edx first, so restore the 'natural' order of things. */
665
184ff798 666#define REG_ALLOC_ORDER \
7c7ef435
JH
667/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,cc,fpsr, dir*/ \
668{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 18, 19 }
f5316dfe
MM
669
670/* A C statement (sans semicolon) to choose the order in which to
671 allocate hard registers for pseudo-registers local to a basic
672 block.
673
674 Store the desired register order in the array `reg_alloc_order'.
675 Element 0 should be the register to allocate first; element 1, the
676 next register; and so on.
677
678 The macro body should not assume anything about the contents of
679 `reg_alloc_order' before execution of the macro.
680
681 On most machines, it is not necessary to define this macro. */
682
683#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
184ff798 684
c98f8742
JVA
685/* Macro to conditionally modify fixed_regs/call_used_regs. */
686#define CONDITIONAL_REGISTER_USAGE \
687 { \
688 if (flag_pic) \
689 { \
690 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
691 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
692 } \
8c2bf92a
JVA
693 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
694 { \
695 int i; \
696 HARD_REG_SET x; \
697 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
698 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
699 if (TEST_HARD_REG_BIT (x, i)) \
700 fixed_regs[i] = call_used_regs[i] = 1; \
701 } \
c98f8742
JVA
702 }
703
704/* Return number of consecutive hard regs needed starting at reg REGNO
705 to hold something of mode MODE.
706 This is ordinarily the length in words of a value of mode MODE
707 but can be less for certain modes in special long registers.
708
709 Actually there are no two word move instructions for consecutive
710 registers. And only registers 0-3 may have mov byte instructions
711 applied to them.
712 */
713
714#define HARD_REGNO_NREGS(REGNO, MODE) \
715 (FP_REGNO_P (REGNO) ? 1 \
716 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
717
e075ae69 718/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
48227a2c 719
e075ae69
RH
720#define HARD_REGNO_MODE_OK(REGNO, MODE) \
721 /* Flags and only flags can only hold CCmode values. */ \
722 (CC_REGNO_P (REGNO) \
723 ? GET_MODE_CLASS (MODE) == MODE_CC \
724 : GET_MODE_CLASS (MODE) == MODE_CC ? 0 \
725 /* FP regs can only hold floating point; make it clear they \
726 cannot hold TFmode floats. */ \
0038aea6 727 : FP_REGNO_P (REGNO) \
e075ae69
RH
728 ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
729 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
62acf5fd 730 && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\
e075ae69
RH
731 : (REGNO) < 4 ? 1 \
732 /* Other regs cannot do byte accesses. */ \
733 : (MODE) != QImode ? 1 \
7c6b971d
JH
734 : reload_in_progress || reload_completed \
735 || !TARGET_PARTIAL_REG_STALL)
c98f8742
JVA
736
737/* Value is 1 if it is a good idea to tie two pseudo registers
738 when one has mode MODE1 and one has mode MODE2.
739 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
740 for any hard reg, then this must be 0 for correct output. */
741
95912252
RH
742#define MODES_TIEABLE_P(MODE1, MODE2) \
743 ((MODE1) == (MODE2) \
63be02db
JM
744 || ((MODE1) == SImode && (MODE2) == HImode) \
745 || ((MODE1) == HImode && (MODE2) == SImode))
c98f8742 746
e075ae69
RH
747/* Specify the modes required to caller save a given hard regno.
748 We do this on i386 to prevent flags from being saved at all. */
749
750#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS) \
751 (CC_REGNO_P (REGNO) ? VOIDmode \
752 : choose_hard_reg_mode ((REGNO), (NREGS)))
753
c98f8742
JVA
754/* Specify the registers used for certain standard purposes.
755 The values of these macros are register numbers. */
756
757/* on the 386 the pc register is %eip, and is not usable as a general
758 register. The ordinary mov instructions won't work */
759/* #define PC_REGNUM */
760
761/* Register to use for pushing function arguments. */
762#define STACK_POINTER_REGNUM 7
763
764/* Base register for access to local variables of the function. */
765#define FRAME_POINTER_REGNUM 6
766
767/* First floating point reg */
768#define FIRST_FLOAT_REG 8
769
770/* First & last stack-like regs */
771#define FIRST_STACK_REG FIRST_FLOAT_REG
772#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
773
e075ae69
RH
774#define FLAGS_REG 17
775#define FPSR_REG 18
7c7ef435 776#define DIRFLAG_REG 19
e075ae69 777
c98f8742
JVA
778/* Value should be nonzero if functions must have frame pointers.
779 Zero means the frame pointer need not be set up (and parms
780 may be accessed via the stack pointer) in functions that seem suitable.
781 This is computed in `reload', in reload1.c. */
2f2fa5b1 782#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
c98f8742
JVA
783
784/* Base register for access to arguments of the function. */
785#define ARG_POINTER_REGNUM 16
786
787/* Register in which static-chain is passed to a function. */
788#define STATIC_CHAIN_REGNUM 2
789
790/* Register to hold the addressing base for position independent
791 code access to data items. */
792#define PIC_OFFSET_TABLE_REGNUM 3
793
794/* Register in which address to store a structure value
795 arrives in the function. On the 386, the prologue
796 copies this from the stack to register %eax. */
797#define STRUCT_VALUE_INCOMING 0
798
799/* Place in which caller passes the structure value address.
800 0 means push the value on the stack like an argument. */
801#define STRUCT_VALUE 0
713225d4
MM
802
803/* A C expression which can inhibit the returning of certain function
804 values in registers, based on the type of value. A nonzero value
805 says to return the function value in memory, just as large
806 structures are always returned. Here TYPE will be a C expression
807 of type `tree', representing the data type of the value.
808
809 Note that values of mode `BLKmode' must be explicitly handled by
810 this macro. Also, the option `-fpcc-struct-return' takes effect
811 regardless of this macro. On most systems, it is possible to
812 leave the macro undefined; this causes a default definition to be
813 used, whose value is the constant 1 for `BLKmode' values, and 0
814 otherwise.
815
816 Do not use this macro to indicate that structures and unions
817 should always be returned in memory. You should instead use
818 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
819
820#define RETURN_IN_MEMORY(TYPE) \
821 ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
822
c98f8742
JVA
823\f
824/* Define the classes of registers for register constraints in the
825 machine description. Also define ranges of constants.
826
827 One of the classes must always be named ALL_REGS and include all hard regs.
828 If there is more than one class, another class must be named NO_REGS
829 and contain no registers.
830
831 The name GENERAL_REGS must be the name of a class (or an alias for
832 another name such as ALL_REGS). This is the class of registers
833 that is allowed by "g" or "r" in a register constraint.
834 Also, registers outside this class are allocated only when
835 instructions express preferences for them.
836
837 The classes must be numbered in nondecreasing order; that is,
838 a larger-numbered class must never be contained completely
839 in a smaller-numbered class.
840
841 For any two classes, it is very desirable that there be another
ab408a86
JVA
842 class that represents their union.
843
844 It might seem that class BREG is unnecessary, since no useful 386
845 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
e075ae69
RH
846 and the "b" register constraint is useful in asms for syscalls.
847
848 The flags and fpsr registers are in no class. */
c98f8742
JVA
849
850enum reg_class
851{
852 NO_REGS,
e075ae69 853 AREG, DREG, CREG, BREG, SIREG, DIREG,
4b71cd6e 854 AD_REGS, /* %eax/%edx for DImode */
c98f8742 855 Q_REGS, /* %eax %ebx %ecx %edx */
e075ae69 856 NON_Q_REGS, /* %esi %edi %ebp %esi */
c98f8742
JVA
857 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
858 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
859 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
860 FLOAT_REGS,
8fcaaa80 861 FLOAT_INT_REGS, /* FLOAT_REGS and GENERAL_REGS. */
c98f8742
JVA
862 ALL_REGS, LIM_REG_CLASSES
863};
864
865#define N_REG_CLASSES (int) LIM_REG_CLASSES
866
4cbb525c
JVA
867#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
868
7c6b971d
JH
869#define Q_CLASS_P(CLASS) (reg_class_subset_p (CLASS, Q_REGS))
870
c98f8742
JVA
871/* Give names of register classes as strings for dump file. */
872
873#define REG_CLASS_NAMES \
874{ "NO_REGS", \
ab408a86 875 "AREG", "DREG", "CREG", "BREG", \
c98f8742 876 "SIREG", "DIREG", \
e075ae69
RH
877 "AD_REGS", \
878 "Q_REGS", "NON_Q_REGS", \
c98f8742
JVA
879 "INDEX_REGS", \
880 "GENERAL_REGS", \
881 "FP_TOP_REG", "FP_SECOND_REG", \
882 "FLOAT_REGS", \
8fcaaa80 883 "FLOAT_INT_REGS", \
c98f8742
JVA
884 "ALL_REGS" }
885
886/* Define which registers fit in which classes.
887 This is an initializer for a vector of HARD_REG_SET
888 of length N_REG_CLASSES. */
889
e075ae69 890#define REG_CLASS_CONTENTS \
47f3558c 891{ {0}, \
e075ae69
RH
892 {0x1}, {0x2}, {0x4}, {0x8},/* AREG, DREG, CREG, BREG */ \
893 {0x10}, {0x20}, /* SIREG, DIREG */ \
47f3558c
JL
894 {0x3}, /* AD_REGS */ \
895 {0xf}, /* Q_REGS */ \
e075ae69
RH
896 {0xf0}, /* NON_Q_REGS */ \
897 {0x7f}, /* INDEX_REGS */ \
47f3558c
JL
898 {0x100ff}, /* GENERAL_REGS */ \
899 {0x0100}, {0x0200}, /* FP_TOP_REG, FP_SECOND_REG */ \
900 {0xff00}, /* FLOAT_REGS */ \
8fcaaa80 901 {0x1ffff}, /* FLOAT_INT_REGS */ \
e075ae69
RH
902 {0x7ffff} \
903}
c98f8742
JVA
904
905/* The same information, inverted:
906 Return the class number of the smallest class containing
907 reg number REGNO. This could be a conditional expression
908 or could index an array. */
909
c98f8742
JVA
910#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
911
912/* When defined, the compiler allows registers explicitly used in the
913 rtl to be used as spill registers but prevents the compiler from
914 extending the lifetime of these registers. */
915
2922fe9e 916#define SMALL_REGISTER_CLASSES 1
c98f8742
JVA
917
918#define QI_REG_P(X) \
919 (REG_P (X) && REGNO (X) < 4)
920#define NON_QI_REG_P(X) \
921 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
922
923#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
924#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
925
926#define STACK_REG_P(xop) (REG_P (xop) && \
927 REGNO (xop) >= FIRST_STACK_REG && \
928 REGNO (xop) <= LAST_STACK_REG)
929
930#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
931
932#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
933
e075ae69
RH
934#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
935#define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG)
936
c98f8742
JVA
937/* The class value for index registers, and the one for base regs. */
938
939#define INDEX_REG_CLASS INDEX_REGS
940#define BASE_REG_CLASS GENERAL_REGS
941
942/* Get reg_class from a letter such as appears in the machine description. */
943
944#define REG_CLASS_FROM_LETTER(C) \
8c2bf92a
JVA
945 ((C) == 'r' ? GENERAL_REGS : \
946 (C) == 'q' ? Q_REGS : \
947 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
948 ? FLOAT_REGS \
949 : NO_REGS) : \
950 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
951 ? FP_TOP_REG \
952 : NO_REGS) : \
953 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
954 ? FP_SECOND_REG \
955 : NO_REGS) : \
956 (C) == 'a' ? AREG : \
957 (C) == 'b' ? BREG : \
958 (C) == 'c' ? CREG : \
959 (C) == 'd' ? DREG : \
4b71cd6e 960 (C) == 'A' ? AD_REGS : \
8c2bf92a 961 (C) == 'D' ? DIREG : \
c98f8742
JVA
962 (C) == 'S' ? SIREG : NO_REGS)
963
964/* The letters I, J, K, L and M in a register constraint string
965 can be used to stand for particular ranges of immediate operands.
966 This macro defines what the ranges are.
967 C is the letter, and VALUE is a constant value.
968 Return 1 if VALUE is in the range specified by C.
969
970 I is for non-DImode shifts.
971 J is for DImode shifts.
e075ae69
RH
972 K is for signed imm8 operands.
973 L is for andsi as zero-extending move.
c98f8742
JVA
974 M is for shifts that can be executed by the "lea" opcode.
975 */
976
e075ae69
RH
977#define CONST_OK_FOR_LETTER_P(VALUE, C) \
978 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 \
979 : (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 \
980 : (C) == 'K' ? (VALUE) >= -128 && (VALUE) <= 127 \
981 : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff \
982 : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 \
983 : 0)
c98f8742
JVA
984
985/* Similar, but for floating constants, and defining letters G and H.
b4ac57ab
RS
986 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
987 TARGET_387 isn't set, because the stack register converter may need to
c47f5ea5 988 load 0.0 into the function value register. */
c98f8742
JVA
989
990#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
c47f5ea5 991 ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
c98f8742
JVA
992
993/* Place additional restrictions on the register class to use when it
4cbb525c
JVA
994 is necessary to be able to hold a value of mode MODE in a reload
995 register for which class CLASS would ordinarily be used. */
c98f8742
JVA
996
997#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
998 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
999 ? Q_REGS : (CLASS))
1000
1001/* Given an rtx X being reloaded into a reg required to be
1002 in class CLASS, return the class of reg to actually use.
1003 In general this is just CLASS; but on some machines
1004 in some cases it is preferable to use a more restrictive class.
1005 On the 80386 series, we prevent floating constants from being
1006 reloaded into floating registers (since no move-insn can do that)
1007 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
1008
d398b3b1 1009/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
c98f8742 1010 QImode must go into class Q_REGS.
d398b3b1
JVA
1011 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
1012 movdf to do mem-to-mem moves through integer regs. */
c98f8742 1013
b66a3ac1
RH
1014#define PREFERRED_RELOAD_CLASS(X,CLASS) \
1015 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \
1016 ? (standard_80387_constant_p (X) \
d7a29404
JH
1017 ? CLASS \
1018 : (reg_class_subset_p (CLASS, FLOAT_REGS) \
1019 ? NO_REGS \
1020 : reg_class_subset_p (CLASS, GENERAL_REGS) ? CLASS : GENERAL_REGS)) \
85ff473e 1021 : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
85ff473e
JVA
1022 : (CLASS))
1023
1024/* If we are copying between general and FP registers, we need a memory
1025 location. */
1026
1027#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
e075ae69
RH
1028 (FLOAT_CLASS_P (CLASS1) != FLOAT_CLASS_P (CLASS2))
1029
1030/* QImode spills from non-QI registers need a scratch. This does not
1031 happen often -- the only example so far requires an uninitialized
1032 pseudo. */
1033
1034#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
1035 ((CLASS) == GENERAL_REGS && (MODE) == QImode ? Q_REGS : NO_REGS)
c98f8742
JVA
1036
1037/* Return the maximum number of consecutive registers
1038 needed to represent mode MODE in a register of class CLASS. */
1039/* On the 80386, this is the size of MODE in words,
1040 except in the FP regs, where a single reg is always enough. */
1041#define CLASS_MAX_NREGS(CLASS, MODE) \
4cbb525c
JVA
1042 (FLOAT_CLASS_P (CLASS) ? 1 : \
1043 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
f5316dfe
MM
1044
1045/* A C expression whose value is nonzero if pseudos that have been
1046 assigned to registers of class CLASS would likely be spilled
1047 because registers of CLASS are needed for spill registers.
1048
1049 The default value of this macro returns 1 if CLASS has exactly one
1050 register and zero otherwise. On most machines, this default
1051 should be used. Only define this macro to some other expression
1052 if pseudo allocated by `local-alloc.c' end up in memory because
ddd5a7c1 1053 their hard registers were needed for spill registers. If this
f5316dfe
MM
1054 macro returns nonzero for those classes, those pseudos will only
1055 be allocated by `global.c', which knows how to reallocate the
1056 pseudo to another register. If there would not be another
1057 register available for reallocation, you should not change the
1058 definition of this macro since the only effect of such a
1059 definition would be to slow down register allocation. */
1060
1061#define CLASS_LIKELY_SPILLED_P(CLASS) \
1062 (((CLASS) == AREG) \
1063 || ((CLASS) == DREG) \
1064 || ((CLASS) == CREG) \
1065 || ((CLASS) == BREG) \
1066 || ((CLASS) == AD_REGS) \
1067 || ((CLASS) == SIREG) \
1068 || ((CLASS) == DIREG))
1069
e075ae69
RH
1070/* A C statement that adds to CLOBBERS any hard regs the port wishes
1071 to automatically clobber for all asms.
1072
1073 We do this in the new i386 backend to maintain source compatibility
1074 with the old cc0-based compiler. */
1075
1076#define MD_ASM_CLOBBERS(CLOBBERS) \
1077 do { \
1078 (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"), (CLOBBERS));\
1079 (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"), (CLOBBERS)); \
7c7ef435 1080 (CLOBBERS) = tree_cons (NULL_TREE, build_string (7, "dirflag"), (CLOBBERS)); \
e075ae69 1081 } while (0)
c98f8742
JVA
1082\f
1083/* Stack layout; function entry, exit and calling. */
1084
1085/* Define this if pushing a word on the stack
1086 makes the stack pointer a smaller address. */
1087#define STACK_GROWS_DOWNWARD
1088
1089/* Define this if the nominal address of the stack frame
1090 is at the high-address end of the local variables;
1091 that is, each additional local variable allocated
1092 goes at a more negative offset in the frame. */
1093#define FRAME_GROWS_DOWNWARD
1094
1095/* Offset within stack frame to start allocating local variables at.
1096 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1097 first local allocated. Otherwise, it is the offset to the BEGINNING
1098 of the first local allocated. */
1099#define STARTING_FRAME_OFFSET 0
1100
1101/* If we generate an insn to push BYTES bytes,
1102 this says how many the stack pointer really advances by.
1103 On 386 pushw decrements by exactly 2 no matter what the position was.
1104 On the 386 there is no pushb; we use pushw instead, and this
1105 has the effect of rounding up to 2. */
1106
1107#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
1108
1109/* Offset of first parameter from the argument pointer register value. */
1110#define FIRST_PARM_OFFSET(FNDECL) 0
1111
1112/* Value is the number of bytes of arguments automatically
1113 popped when returning from a subroutine call.
8b109b37 1114 FUNDECL is the declaration node of the function (as a tree),
c98f8742
JVA
1115 FUNTYPE is the data type of the function (as a tree),
1116 or for a library call it is an identifier node for the subroutine name.
1117 SIZE is the number of bytes of arguments passed on the stack.
1118
1119 On the 80386, the RTD insn may be used to pop them if the number
1120 of args is fixed, but if the number is variable then the caller
1121 must pop them all. RTD can't be used for library calls now
1122 because the library is compiled with the Unix compiler.
1123 Use of RTD is a selectable option, since it is incompatible with
1124 standard Unix calling sequences. If the option is not selected,
b08de47e
MM
1125 the caller must always pop the args.
1126
1127 The attribute stdcall is equivalent to RTD on a per module basis. */
c98f8742 1128
b08de47e 1129#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
e075ae69 1130 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE))
c98f8742 1131
8c2bf92a
JVA
1132/* Define how to find the value returned by a function.
1133 VALTYPE is the data type of the value (as a tree).
1134 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1135 otherwise, FUNC is 0. */
c98f8742 1136#define FUNCTION_VALUE(VALTYPE, FUNC) \
f64cecad 1137 gen_rtx_REG (TYPE_MODE (VALTYPE), \
c5c76735 1138 VALUE_REGNO (TYPE_MODE (VALTYPE)))
c98f8742
JVA
1139
1140/* Define how to find the value returned by a library function
1141 assuming the value has mode MODE. */
1142
1143#define LIBCALL_VALUE(MODE) \
f64cecad 1144 gen_rtx_REG (MODE, VALUE_REGNO (MODE))
c98f8742 1145
e9125c09
TW
1146/* Define the size of the result block used for communication between
1147 untyped_call and untyped_return. The block contains a DImode value
1148 followed by the block used by fnsave and frstor. */
1149
1150#define APPLY_RESULT_SIZE (8+108)
1151
b08de47e
MM
1152/* 1 if N is a possible register number for function argument passing. */
1153#define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)
c98f8742
JVA
1154
1155/* Define a data type for recording info about an argument list
1156 during the scan of that argument list. This data type should
1157 hold all necessary information about the function itself
1158 and about the args processed so far, enough to enable macros
b08de47e 1159 such as FUNCTION_ARG to determine where the next arg should go. */
c98f8742 1160
e075ae69 1161typedef struct ix86_args {
b08de47e
MM
1162 int words; /* # words passed so far */
1163 int nregs; /* # registers available for passing */
1164 int regno; /* next available register number */
1165} CUMULATIVE_ARGS;
c98f8742
JVA
1166
1167/* Initialize a variable CUM of type CUMULATIVE_ARGS
1168 for a call to a function whose data type is FNTYPE.
b08de47e 1169 For a library call, FNTYPE is 0. */
c98f8742 1170
2c7ee1a6 1171#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
b08de47e 1172 (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
c98f8742
JVA
1173
1174/* Update the data in CUM to advance over an argument
1175 of mode MODE and data type TYPE.
1176 (TYPE is null for libcalls where that information may not be available.) */
1177
1178#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
b08de47e 1179 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1180
1181/* Define where to put the arguments to a function.
1182 Value is zero to push the argument on the stack,
1183 or a hard register in which to store the argument.
1184
1185 MODE is the argument's machine mode.
1186 TYPE is the data type of the argument (as a tree).
1187 This is null for libcalls where that information may
1188 not be available.
1189 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1190 the preceding args and about the function being called.
1191 NAMED is nonzero if this argument is a named parameter
1192 (otherwise it is an extra parameter matching an ellipsis). */
1193
c98f8742 1194#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
b08de47e 1195 (function_arg (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1196
1197/* For an arg passed partly in registers and partly in memory,
1198 this is the number of registers used.
1199 For args passed entirely in registers or entirely in memory, zero. */
1200
e075ae69 1201#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
c98f8742 1202
3a0433fd
SC
1203/* This macro is invoked just before the start of a function.
1204 It is used here to output code for -fpic that will load the
1205 return address into %ebx. */
1206
1207#undef ASM_OUTPUT_FUNCTION_PREFIX
1208#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
1209 asm_output_function_prefix (FILE, FNNAME)
1210
c98f8742
JVA
1211/* Output assembler code to FILE to increment profiler label # LABELNO
1212 for profiling a function entry. */
1213
1214#define FUNCTION_PROFILER(FILE, LABELNO) \
1215{ \
1216 if (flag_pic) \
1217 { \
e075ae69 1218 fprintf (FILE, "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n", \
c98f8742 1219 LPREFIX, (LABELNO)); \
e075ae69 1220 fprintf (FILE, "\tcall\t*_mcount@GOT(%%ebx)\n"); \
c98f8742
JVA
1221 } \
1222 else \
1223 { \
e075ae69
RH
1224 fprintf (FILE, "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
1225 fprintf (FILE, "\tcall\t_mcount\n"); \
c98f8742
JVA
1226 } \
1227}
1228
1cf5eda8 1229
6e753900
RK
1230/* There are three profiling modes for basic blocks available.
1231 The modes are selected at compile time by using the options
1232 -a or -ax of the gnu compiler.
1233 The variable `profile_block_flag' will be set according to the
1234 selected option.
1cf5eda8 1235
6e753900 1236 profile_block_flag == 0, no option used:
1cf5eda8 1237
6e753900 1238 No profiling done.
1cf5eda8 1239
6e753900
RK
1240 profile_block_flag == 1, -a option used.
1241
1242 Count frequency of execution of every basic block.
1243
1244 profile_block_flag == 2, -ax option used.
1245
1246 Generate code to allow several different profiling modes at run time.
1247 Available modes are:
1248 Produce a trace of all basic blocks.
1249 Count frequency of jump instructions executed.
1250 In every mode it is possible to start profiling upon entering
1251 certain functions and to disable profiling of some other functions.
1252
1253 The result of basic-block profiling will be written to a file `bb.out'.
1254 If the -ax option is used parameters for the profiling will be read
1255 from file `bb.in'.
1256
1257*/
1258
1259/* The following macro shall output assembler code to FILE
e075ae69 1260 to initialize basic-block profiling. */
1cf5eda8
MM
1261
1262#undef FUNCTION_BLOCK_PROFILER
e075ae69
RH
1263#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1264 ix86_output_function_block_profiler (FILE, BLOCK_OR_LABEL)
1cf5eda8 1265
6e753900 1266/* The following macro shall output assembler code to FILE
e075ae69 1267 to increment a counter associated with basic block number BLOCKNO. */
6e753900 1268
e075ae69
RH
1269#define BLOCK_PROFILER(FILE, BLOCKNO) \
1270 ix86_output_block_profiler (FILE, BLOCKNO)
1cf5eda8 1271
e075ae69 1272/* The following macro shall output rtl for the epilogue
6e753900
RK
1273 to indicate a return from function during basic-block profiling.
1274
1275 If profiling_block_flag == 2:
1276
1277 Output assembler code to call function `__bb_trace_ret'.
1278
1279 Note that function `__bb_trace_ret' must not change the
1280 machine state, especially the flag register. To grant
1281 this, you must output code to save and restore registers
1282 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1283 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1284 used in the function `__bb_trace_ret', so you must make
1285 sure that the function prologue does not change any
1286 register prior to saving it with MACHINE_STATE_SAVE_RET.
1287
1288 else if profiling_block_flag != 0:
1289
1290 The macro will not be used, so it need not distinguish
1291 these cases.
1292*/
1293
e075ae69
RH
1294#define FUNCTION_BLOCK_PROFILER_EXIT \
1295emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \
1296 gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \
1297 const0_rtx))
6e753900
RK
1298
1299/* The function `__bb_trace_func' is called in every basic block
1300 and is not allowed to change the machine state. Saving (restoring)
1301 the state can either be done in the BLOCK_PROFILER macro,
1302 before calling function (rsp. after returning from function)
1303 `__bb_trace_func', or it can be done inside the function by
1304 defining the macros:
1305
1306 MACHINE_STATE_SAVE(ID)
1307 MACHINE_STATE_RESTORE(ID)
1308
1309 In the latter case care must be taken, that the prologue code
1310 of function `__bb_trace_func' does not already change the
1311 state prior to saving it with MACHINE_STATE_SAVE.
1312
1313 The parameter `ID' is a string identifying a unique macro use.
1314
1315 On the i386 the initialization code at the begin of
1316 function `__bb_trace_func' contains a `sub' instruction
1317 therefore we handle save and restore of the flag register
1318 in the BLOCK_PROFILER macro. */
1319
e075ae69
RH
1320#define MACHINE_STATE_SAVE(ID) \
1321do { \
1322 register int eax_ __asm__("eax"); \
1323 register int ecx_ __asm__("ecx"); \
1324 register int edx_ __asm__("edx"); \
1325 register int esi_ __asm__("esi"); \
1326 __asm__ __volatile__ ( \
1327 "push{l} %0\n\t" \
1328 "push{l} %1\n\t" \
1329 "push{l} %2\n\t" \
1330 "push{l} %3" \
1331 : : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
1332} while (0);
1333
1334#define MACHINE_STATE_RESTORE(ID) \
1335do { \
1336 register int eax_ __asm__("eax"); \
1337 register int ecx_ __asm__("ecx"); \
1338 register int edx_ __asm__("edx"); \
1339 register int esi_ __asm__("esi"); \
1340 __asm__ __volatile__ ( \
1341 "pop{l} %3\n\t" \
1342 "pop{l} %2\n\t" \
1343 "pop{l} %1\n\t" \
1344 "pop{l} %0" \
1345 : "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
1346} while (0);
6e753900 1347
c98f8742
JVA
1348/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1349 the stack pointer does not matter. The value is tested only in
1350 functions that have frame pointers.
1351 No definition is equivalent to always zero. */
1352/* Note on the 386 it might be more efficient not to define this since
1353 we have to restore it ourselves from the frame pointer, in order to
1354 use pop */
1355
1356#define EXIT_IGNORE_STACK 1
1357
c98f8742
JVA
1358/* Output assembler code for a block containing the constant parts
1359 of a trampoline, leaving space for the variable parts. */
1360
a269a03c 1361/* On the 386, the trampoline contains two instructions:
c98f8742 1362 mov #STATIC,ecx
a269a03c
JC
1363 jmp FUNCTION
1364 The trampoline is generated entirely at runtime. The operand of JMP
1365 is the address of FUNCTION relative to the instruction following the
1366 JMP (which is 5 bytes long). */
c98f8742
JVA
1367
1368/* Length in units of the trampoline for entering a nested function. */
1369
a269a03c 1370#define TRAMPOLINE_SIZE 10
c98f8742
JVA
1371
1372/* Emit RTL insns to initialize the variable parts of a trampoline.
1373 FNADDR is an RTX for the address of the function's pure code.
1374 CXT is an RTX for the static chain value for the function. */
1375
1376#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1377{ \
a269a03c
JC
1378 /* Compute offset from the end of the jmp to the target function. */ \
1379 rtx disp = expand_binop (SImode, sub_optab, FNADDR, \
1380 plus_constant (TRAMP, 10), \
1381 NULL_RTX, 1, OPTAB_DIRECT); \
1382 emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9)); \
f64cecad 1383 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
a269a03c
JC
1384 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\
1385 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \
c98f8742
JVA
1386}
1387\f
1388/* Definitions for register eliminations.
1389
1390 This is an array of structures. Each structure initializes one pair
1391 of eliminable registers. The "from" register number is given first,
1392 followed by "to". Eliminations of the same "from" register are listed
1393 in order of preference.
1394
1395 We have two registers that can be eliminated on the i386. First, the
1396 frame pointer register can often be eliminated in favor of the stack
1397 pointer register. Secondly, the argument pointer register can always be
1398 eliminated; it is replaced with either the stack or frame pointer. */
1399
1400#define ELIMINABLE_REGS \
1401{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1402 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1403 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1404
1405/* Given FROM and TO register numbers, say whether this elimination is allowed.
1406 Frame pointer elimination is automatically handled.
1407
1408 For the i386, if frame pointer elimination is being done, we would like to
1409 convert ap into sp, not fp.
1410
1411 All other eliminations are valid. */
1412
1413#define CAN_ELIMINATE(FROM, TO) \
1414 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1415 ? ! frame_pointer_needed \
1416 : 1)
1417
1418/* Define the offset between two registers, one to be eliminated, and the other
1419 its replacement, at the start of a routine. */
1420
1421#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
0903fcab 1422 (OFFSET) = ix86_initial_elimination_offset (FROM, TO)
c98f8742
JVA
1423\f
1424/* Addressing modes, and classification of registers for them. */
1425
940da324
JL
1426/* #define HAVE_POST_INCREMENT 0 */
1427/* #define HAVE_POST_DECREMENT 0 */
c98f8742 1428
940da324
JL
1429/* #define HAVE_PRE_DECREMENT 0 */
1430/* #define HAVE_PRE_INCREMENT 0 */
c98f8742
JVA
1431
1432/* Macros to check register numbers against specific register classes. */
1433
1434/* These assume that REGNO is a hard or pseudo reg number.
1435 They give nonzero only if REGNO is a hard reg of the suitable class
1436 or a pseudo reg currently allocated to a suitable hard reg.
1437 Since they use reg_renumber, they are safe only once reg_renumber
1438 has been allocated, which happens in local-alloc.c. */
1439
1440#define REGNO_OK_FOR_INDEX_P(REGNO) \
1441 ((REGNO) < STACK_POINTER_REGNUM \
1442 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1443
1444#define REGNO_OK_FOR_BASE_P(REGNO) \
1445 ((REGNO) <= STACK_POINTER_REGNUM \
1446 || (REGNO) == ARG_POINTER_REGNUM \
1447 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1448
1449#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1450#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1451
1452/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1453 and check its validity for a certain class.
1454 We have two alternate definitions for each of them.
1455 The usual definition accepts all pseudo regs; the other rejects
1456 them unless they have been allocated suitable hard regs.
1457 The symbol REG_OK_STRICT causes the latter definition to be used.
1458
1459 Most source files want to accept pseudo regs in the hope that
1460 they will get allocated to the class that the insn wants them to be in.
1461 Source files for reload pass need to be strict.
1462 After reload, it makes no difference, since pseudo regs have
1463 been eliminated by then. */
1464
c98f8742 1465
3b3c6a3f
MM
1466/* Non strict versions, pseudos are ok */
1467#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1468 (REGNO (X) < STACK_POINTER_REGNUM \
c98f8742
JVA
1469 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1470
3b3c6a3f
MM
1471#define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1472 (REGNO (X) <= STACK_POINTER_REGNUM \
1473 || REGNO (X) == ARG_POINTER_REGNUM \
1474 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
c98f8742 1475
3b3c6a3f 1476#define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
c98f8742
JVA
1477 (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1478
3b3c6a3f
MM
1479/* Strict versions, hard registers only */
1480#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1481#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1482#define REG_OK_FOR_STRREG_STRICT_P(X) \
c98f8742
JVA
1483 (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
1484
3b3c6a3f
MM
1485#ifndef REG_OK_STRICT
1486#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1487#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
1488#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
1489
1490#else
1491#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1492#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
1493#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
c98f8742
JVA
1494#endif
1495
1496/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1497 that is a valid memory address for an instruction.
1498 The MODE argument is the machine mode for the MEM expression
1499 that wants to use this address.
1500
1501 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1502 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1503
1504 See legitimize_pic_address in i386.c for details as to what
1505 constitutes a legitimate address when -fpic is used. */
1506
1507#define MAX_REGS_PER_ADDRESS 2
1508
91bb873f
RH
1509#define CONSTANT_ADDRESS_P(X) \
1510 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1511 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
c98f8742
JVA
1512
1513/* Nonzero if the constant value X is a legitimate general operand.
1514 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1515
d7a29404 1516#define LEGITIMATE_CONSTANT_P(X) 1
c98f8742 1517
3b3c6a3f
MM
1518#ifdef REG_OK_STRICT
1519#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1520{ \
1521 if (legitimate_address_p (MODE, X, 1)) \
1522 goto ADDR; \
1523}
c98f8742 1524
3b3c6a3f
MM
1525#else
1526#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
c98f8742 1527{ \
3b3c6a3f 1528 if (legitimate_address_p (MODE, X, 0)) \
c98f8742 1529 goto ADDR; \
c98f8742
JVA
1530}
1531
3b3c6a3f
MM
1532#endif
1533
c98f8742
JVA
1534/* Try machine-dependent ways of modifying an illegitimate address
1535 to be legitimate. If we find one, return the new, valid address.
1536 This macro is used in only one place: `memory_address' in explow.c.
1537
1538 OLDX is the address as it was before break_out_memory_refs was called.
1539 In some cases it is useful to look at this to decide what needs to be done.
1540
1541 MODE and WIN are passed so that this macro can use
1542 GO_IF_LEGITIMATE_ADDRESS.
1543
1544 It is always safe for this macro to do nothing. It exists to recognize
1545 opportunities to optimize the output.
1546
1547 For the 80386, we handle X+REG by loading X into a register R and
1548 using R+REG. R will go in a general reg and indexing will be used.
1549 However, if REG is a broken-out memory address or multiplication,
1550 nothing needs to be done because REG can certainly go in a general reg.
1551
1552 When -fpic is used, special handling is needed for symbolic references.
1553 See comments by legitimize_pic_address in i386.c for details. */
1554
3b3c6a3f
MM
1555#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1556{ \
3b3c6a3f
MM
1557 (X) = legitimize_address (X, OLDX, MODE); \
1558 if (memory_address_p (MODE, X)) \
1559 goto WIN; \
1560}
c98f8742 1561
d4ba09c0
SC
1562#define REWRITE_ADDRESS(x) rewrite_address(x)
1563
c98f8742
JVA
1564/* Nonzero if the constant value X is a legitimate general operand
1565 when generating PIC code. It is given that flag_pic is on and
1566 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1567
e075ae69
RH
1568#define LEGITIMATE_PIC_OPERAND_P(X) \
1569 (! SYMBOLIC_CONST (X) \
1570 || legitimate_pic_address_disp_p (X))
c98f8742
JVA
1571
1572#define SYMBOLIC_CONST(X) \
1573(GET_CODE (X) == SYMBOL_REF \
1574 || GET_CODE (X) == LABEL_REF \
1575 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1576
1577/* Go to LABEL if ADDR (a legitimate address expression)
1578 has an effect that depends on the machine mode it is used for.
1579 On the 80386, only postdecrement and postincrement address depend thus
1580 (the amount of decrement or increment being the length of the operand). */
1581#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1582 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1583\f
1584/* Define this macro if references to a symbol must be treated
1585 differently depending on something about the variable or
1586 function named by the symbol (such as what section it is in).
1587
b4ac57ab 1588 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
c98f8742
JVA
1589 so that we may access it directly in the GOT. */
1590
90e0ee00
AH
1591#define ENCODE_SECTION_INFO(DECL) \
1592do \
1593 { \
1594 if (flag_pic) \
1595 { \
1596 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1597 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1598 \
1599 if (GET_CODE (rtl) == MEM) \
1600 { \
1601 if (TARGET_DEBUG_ADDR \
1602 && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
1603 { \
1604 fprintf (stderr, "Encode %s, public = %d\n", \
1605 IDENTIFIER_POINTER (DECL_NAME (DECL)), \
1606 TREE_PUBLIC (DECL)); \
1607 } \
1608 \
1609 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1610 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1611 || ! TREE_PUBLIC (DECL)); \
1612 } \
1613 } \
1614 } \
c98f8742 1615while (0)
d398b3b1 1616
638b724c
MM
1617/* The `FINALIZE_PIC' macro serves as a hook to emit these special
1618 codes once the function is being compiled into assembly code, but
1619 not before. (It is not done before, because in the case of
1620 compiling an inline function, it would lead to multiple PIC
1621 prologues being included in functions which used inline functions
1622 and were compiled to assembly language.) */
1623
1624#define FINALIZE_PIC \
1625do \
1626 { \
638b724c
MM
1627 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
1628 } \
1629while (0)
1630
b08de47e
MM
1631\f
1632/* If defined, a C expression whose value is nonzero if IDENTIFIER
1633 with arguments ARGS is a valid machine specific attribute for DECL.
1634 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1635
7db4b149 1636#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
e075ae69 1637 (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
1638
1639/* If defined, a C expression whose value is nonzero if IDENTIFIER
1640 with arguments ARGS is a valid machine specific attribute for TYPE.
1641 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1642
7db4b149 1643#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
e075ae69 1644 (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
1645
1646/* If defined, a C expression whose value is zero if the attributes on
1647 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1648 two if they are nearly compatible (which causes a warning to be
1649 generated). */
1650
1651#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
e075ae69 1652 (ix86_comp_type_attributes (TYPE1, TYPE2))
b08de47e
MM
1653
1654/* If defined, a C statement that assigns default attributes to newly
1655 defined TYPE. */
1656
1657/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
1658
1659/* Max number of args passed in registers. If this is more than 3, we will
1660 have problems with ebx (register #4), since it is a caller save register and
1661 is also used as the pic register in ELF. So for now, don't allow more than
1662 3 registers to be passed in registers. */
1663
1664#define REGPARM_MAX 3
1665
c98f8742
JVA
1666\f
1667/* Specify the machine mode that this machine uses
1668 for the index in the tablejump instruction. */
1669#define CASE_VECTOR_MODE Pmode
1670
18543a22
ILT
1671/* Define as C expression which evaluates to nonzero if the tablejump
1672 instruction expects the table to contain offsets from the address of the
1673 table.
1674 Do not define this if the table should contain absolute addresses. */
1675/* #define CASE_VECTOR_PC_RELATIVE 1 */
c98f8742
JVA
1676
1677/* Specify the tree operation to be used to convert reals to integers.
1678 This should be changed to take advantage of fist --wfs ??
1679 */
1680#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1681
1682/* This is the kind of divide that is easiest to do in the general case. */
1683#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1684
1685/* Define this as 1 if `char' should by default be signed; else as 0. */
1686#define DEFAULT_SIGNED_CHAR 1
1687
1688/* Max number of bytes we can move from memory to memory
1689 in one reasonably fast instruction. */
1690#define MOVE_MAX 4
1691
7e24ffc9
HPN
1692/* If a memory-to-memory move would take MOVE_RATIO or more simple
1693 move-instruction pairs, we will do a movstr or libcall instead.
1694 Increasing the value will always make code faster, but eventually
1695 incurs high cost in increased code size.
c98f8742 1696
e2e52e1b 1697 If you don't define this, a reasonable default is used. */
c98f8742 1698
e2e52e1b 1699#define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio)
c98f8742
JVA
1700
1701/* Define if shifts truncate the shift count
1702 which implies one can omit a sign-extension or zero-extension
1703 of a shift count. */
241e1a89 1704/* On i386, shifts do truncate the count. But bit opcodes don't. */
c98f8742
JVA
1705
1706/* #define SHIFT_COUNT_TRUNCATED */
1707
1708/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1709 is done just by pretending it is already truncated. */
1710#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1711
1712/* We assume that the store-condition-codes instructions store 0 for false
1713 and some other value for true. This is the value stored for true. */
1714
1715#define STORE_FLAG_VALUE 1
1716
1717/* When a prototype says `char' or `short', really pass an `int'.
1718 (The 386 can't easily push less than an int.) */
1719
cb560352 1720#define PROMOTE_PROTOTYPES 1
c98f8742
JVA
1721
1722/* Specify the machine mode that pointers have.
1723 After generation of rtl, the compiler makes no further distinction
1724 between pointers and any other objects of this machine mode. */
1725#define Pmode SImode
1726
1727/* A function address in a call instruction
1728 is a byte address (for indexing purposes)
1729 so give the MEM rtx a byte's mode. */
1730#define FUNCTION_MODE QImode
d4ba09c0
SC
1731\f
1732/* A part of a C `switch' statement that describes the relative costs
1733 of constant RTL expressions. It must contain `case' labels for
1734 expression codes `const_int', `const', `symbol_ref', `label_ref'
1735 and `const_double'. Each case must ultimately reach a `return'
1736 statement to return the relative cost of the use of that kind of
1737 constant value in an expression. The cost may depend on the
1738 precise value of the constant, which is available for examination
1739 in X, and the rtx code of the expression in which it is contained,
1740 found in OUTER_CODE.
1741
1742 CODE is the expression code--redundant, since it can be obtained
1743 with `GET_CODE (X)'. */
c98f8742 1744
3bb22aee 1745#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
c98f8742 1746 case CONST_INT: \
e5e809f4 1747 return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \
c98f8742
JVA
1748 case CONST: \
1749 case LABEL_REF: \
1750 case SYMBOL_REF: \
76565a24 1751 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
d4ba09c0 1752 \
c98f8742
JVA
1753 case CONST_DOUBLE: \
1754 { \
7488be4e
JVA
1755 int code; \
1756 if (GET_MODE (RTX) == VOIDmode) \
1757 return 2; \
d4ba09c0 1758 \
7488be4e 1759 code = standard_80387_constant_p (RTX); \
c98f8742
JVA
1760 return code == 1 ? 0 : \
1761 code == 2 ? 1 : \
1762 2; \
3bb22aee 1763 }
c98f8742 1764
76565a24 1765/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
e075ae69
RH
1766#define TOPLEVEL_COSTS_N_INSNS(N) \
1767 do { total = COSTS_N_INSNS (N); goto egress_rtx_costs; } while (0)
76565a24 1768
d4ba09c0
SC
1769/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1770 This can be used, for example, to indicate how costly a multiply
1771 instruction is. In writing this macro, you can use the construct
1772 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1773 instructions. OUTER_CODE is the code of the expression in which X
1774 is contained.
1775
1776 This macro is optional; do not define it if the default cost
1777 assumptions are adequate for the target machine. */
1778
1779#define RTX_COSTS(X,CODE,OUTER_CODE) \
1780 case ASHIFT: \
1781 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1782 && GET_MODE (XEXP (X, 0)) == SImode) \
1783 { \
1784 HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
d4ba09c0 1785 if (value == 1) \
e075ae69 1786 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
d4ba09c0 1787 if (value == 2 || value == 3) \
e075ae69 1788 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
d4ba09c0
SC
1789 } \
1790 /* fall through */ \
1791 \
1792 case ROTATE: \
1793 case ASHIFTRT: \
1794 case LSHIFTRT: \
1795 case ROTATERT: \
76565a24
SC
1796 if (GET_MODE (XEXP (X, 0)) == DImode) \
1797 { \
1798 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
54d26233
MH
1799 { \
1800 if (INTVAL (XEXP (X, 1)) > 32) \
e075ae69
RH
1801 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const + 2); \
1802 else \
1803 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const * 2); \
1804 } \
1805 else \
1806 { \
1807 if (GET_CODE (XEXP (X, 1)) == AND) \
1808 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 2); \
1809 else \
1810 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2); \
54d26233 1811 } \
76565a24 1812 } \
e075ae69
RH
1813 else \
1814 { \
1815 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1816 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1817 else \
1818 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_var); \
1819 } \
1820 break; \
d4ba09c0
SC
1821 \
1822 case MULT: \
1823 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1824 { \
1825 unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1826 int nbits = 0; \
1827 \
76565a24 1828 if (value == 2) \
e075ae69 1829 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
76565a24 1830 if (value == 4 || value == 8) \
e075ae69 1831 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
76565a24 1832 \
d4ba09c0
SC
1833 while (value != 0) \
1834 { \
1835 nbits++; \
1836 value >>= 1; \
1837 } \
1838 \
76565a24 1839 if (nbits == 1) \
e075ae69
RH
1840 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1841 else \
1842 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1843 + nbits * ix86_cost->mult_bit); \
d4ba09c0 1844 } \
d4ba09c0 1845 else /* This is arbitrary */ \
76565a24
SC
1846 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1847 + 7 * ix86_cost->mult_bit); \
d4ba09c0
SC
1848 \
1849 case DIV: \
1850 case UDIV: \
1851 case MOD: \
1852 case UMOD: \
76565a24 1853 TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
d4ba09c0
SC
1854 \
1855 case PLUS: \
e075ae69
RH
1856 if (GET_CODE (XEXP (X, 0)) == PLUS \
1857 && GET_CODE (XEXP (XEXP (X, 0), 0)) == MULT \
1858 && GET_CODE (XEXP (XEXP (XEXP (X, 0), 0), 1)) == CONST_INT \
1859 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1860 { \
1861 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 0), 0), 1)); \
1862 if (val == 2 || val == 4 || val == 8) \
1863 { \
1864 return (COSTS_N_INSNS (ix86_cost->lea) \
1865 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1866 + rtx_cost (XEXP (XEXP (XEXP (X, 0), 0), 0), OUTER_CODE) \
1867 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1868 } \
1869 } \
1870 else if (GET_CODE (XEXP (X, 0)) == MULT \
1871 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \
1872 { \
1873 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \
1874 if (val == 2 || val == 4 || val == 8) \
1875 { \
1876 return (COSTS_N_INSNS (ix86_cost->lea) \
1877 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1878 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1879 } \
1880 } \
1881 else if (GET_CODE (XEXP (X, 0)) == PLUS) \
1882 { \
1883 return (COSTS_N_INSNS (ix86_cost->lea) \
1884 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1885 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1886 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1887 } \
d4ba09c0
SC
1888 \
1889 /* fall through */ \
1890 case AND: \
1891 case IOR: \
1892 case XOR: \
1893 case MINUS: \
76565a24 1894 if (GET_MODE (X) == DImode) \
e075ae69
RH
1895 return (COSTS_N_INSNS (ix86_cost->add) * 2 \
1896 + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
1897 << (GET_MODE (XEXP (X, 0)) != DImode)) \
1898 + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
1899 << (GET_MODE (XEXP (X, 1)) != DImode))); \
1900 \
1901 /* fall through */ \
d4ba09c0
SC
1902 case NEG: \
1903 case NOT: \
76565a24 1904 if (GET_MODE (X) == DImode) \
e075ae69
RH
1905 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2); \
1906 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1907 \
1908 egress_rtx_costs: \
1909 break;
d4ba09c0
SC
1910
1911
1912/* An expression giving the cost of an addressing mode that contains
1913 ADDRESS. If not defined, the cost is computed from the ADDRESS
1914 expression and the `CONST_COSTS' values.
1915
1916 For most CISC machines, the default cost is a good approximation
1917 of the true cost of the addressing mode. However, on RISC
1918 machines, all instructions normally have the same length and
1919 execution time. Hence all addresses will have equal costs.
1920
1921 In cases where more than one form of an address is known, the form
1922 with the lowest cost will be used. If multiple forms have the
1923 same, lowest, cost, the one that is the most complex will be used.
1924
1925 For example, suppose an address that is equal to the sum of a
1926 register and a constant is used twice in the same basic block.
1927 When this macro is not defined, the address will be computed in a
1928 register and memory references will be indirect through that
1929 register. On machines where the cost of the addressing mode
1930 containing the sum is no higher than that of a simple indirect
1931 reference, this will produce an additional instruction and
1932 possibly require an additional register. Proper specification of
1933 this macro eliminates this overhead for such machines.
1934
1935 Similar use of this macro is made in strength reduction of loops.
1936
1937 ADDRESS need not be valid as an address. In such a case, the cost
1938 is not relevant and can be any value; invalid addresses need not be
1939 assigned a different cost.
1940
1941 On machines where an address involving more than one register is as
1942 cheap as an address computation involving only one register,
1943 defining `ADDRESS_COST' to reflect this can cause two registers to
1944 be live over a region of code where only one would have been if
1945 `ADDRESS_COST' were not defined in that manner. This effect should
1946 be considered in the definition of this macro. Equivalent costs
1947 should probably only be given to addresses with different numbers
1948 of registers on machines with lots of registers.
1949
1950 This macro will normally either not be defined or be defined as a
1951 constant.
c98f8742
JVA
1952
1953 For i386, it is better to use a complex address than let gcc copy
1954 the address into a reg and make a new pseudo. But not if the address
1955 requires to two regs - that would mean more pseudos with longer
1956 lifetimes. */
1957
1958#define ADDRESS_COST(RTX) \
1959 ((CONSTANT_P (RTX) \
1960 || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
1961 && REG_P (XEXP (RTX, 0)))) ? 0 \
1962 : REG_P (RTX) ? 1 \
1963 : 2)
d4ba09c0 1964
96e7ae40
JH
1965/* A C expression for the cost of moving data from a register in class FROM to
1966 one in class TO. The classes are expressed using the enumeration values
1967 such as `GENERAL_REGS'. A value of 2 is the default; other values are
1968 interpreted relative to that.
d4ba09c0 1969
96e7ae40
JH
1970 It is not required that the cost always equal 2 when FROM is the same as TO;
1971 on some machines it is expensive to move between registers if they are not
1972 general registers.
d4ba09c0
SC
1973
1974 On the i386, copying between floating-point and fixed-point
96e7ae40
JH
1975 registers is done trough memory.
1976
1977 Integer -> fp moves are noticeably slower than the opposite direction
1978 because of the partial memory stall they cause. Give it an
1979 arbitary high cost.
1980 */
d4ba09c0
SC
1981
1982#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
96e7ae40
JH
1983 ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
1984 ? (MEMORY_MOVE_COST (DFmode, CLASS1, 0) \
1985 + MEMORY_MOVE_COST (DFmode, CLASS2, 1)) \
1986 : (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)) ? 10 : 2)
d4ba09c0
SC
1987
1988/* A C expression for the cost of moving data of mode M between a
1989 register and memory. A value of 2 is the default; this cost is
1990 relative to those in `REGISTER_MOVE_COST'.
1991
1992 If moving between registers and memory is more expensive than
1993 between two registers, you should define this macro to express the
7c6b971d
JH
1994 relative cost.
1995
1996 Model also increased moving costs of QImode registers in non
1997 Q_REGS classes.
1998 */
d4ba09c0 1999
96e7ae40
JH
2000#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
2001 (FLOAT_CLASS_P (CLASS) \
2002 ? (GET_MODE_SIZE (MODE)==4 \
2003 ? (IN ? ix86_cost->fp_load[0] : ix86_cost->fp_store[0]) \
2004 : (GET_MODE_SIZE (MODE)==8 \
2005 ? (IN ? ix86_cost->fp_load[1] : ix86_cost->fp_store[1]) \
2006 : (IN ? ix86_cost->fp_load[2] : ix86_cost->fp_store[2]))) \
2007 : (GET_MODE_SIZE (MODE)==1 \
7c6b971d
JH
2008 ? (IN ? (Q_CLASS_P (CLASS) ? ix86_cost->int_load[0] \
2009 : ix86_cost->movzbl_load) \
2010 : (Q_CLASS_P (CLASS) ? ix86_cost->int_store[0] \
2011 : ix86_cost->int_store[0] + 4)) \
96e7ae40
JH
2012 : (GET_MODE_SIZE (MODE)==2 \
2013 ? (IN ? ix86_cost->int_load[1] : ix86_cost->int_store[1]) \
2014 : ((IN ? ix86_cost->int_load[2] : ix86_cost->int_store[2]) \
2015 * GET_MODE_SIZE (MODE) / 4))))
d4ba09c0
SC
2016
2017/* A C expression for the cost of a branch instruction. A value of 1
2018 is the default; other values are interpreted relative to that. */
2019
e075ae69 2020#define BRANCH_COST ix86_branch_cost
d4ba09c0
SC
2021
2022/* Define this macro as a C expression which is nonzero if accessing
2023 less than a word of memory (i.e. a `char' or a `short') is no
2024 faster than accessing a word of memory, i.e., if such access
2025 require more than one instruction or if there is no difference in
2026 cost between byte and (aligned) word loads.
2027
2028 When this macro is not defined, the compiler will access a field by
2029 finding the smallest containing object; when it is defined, a
2030 fullword load will be used if alignment permits. Unless bytes
2031 accesses are faster than word accesses, using word accesses is
2032 preferable since it may eliminate subsequent memory access if
2033 subsequent accesses occur to other fields in the same word of the
2034 structure, but to different bytes. */
2035
2036#define SLOW_BYTE_ACCESS 0
2037
2038/* Nonzero if access to memory by shorts is slow and undesirable. */
2039#define SLOW_SHORT_ACCESS 0
2040
2041/* Define this macro if zero-extension (of a `char' or `short' to an
2042 `int') can be done faster if the destination is a register that is
2043 known to be zero.
2044
2045 If you define this macro, you must have instruction patterns that
2046 recognize RTL structures like this:
2047
2048 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2049
2050 and likewise for `HImode'. */
2051
2052/* #define SLOW_ZERO_EXTEND */
2053
2054/* Define this macro to be the value 1 if unaligned accesses have a
2055 cost many times greater than aligned accesses, for example if they
2056 are emulated in a trap handler.
2057
2058 When this macro is non-zero, the compiler will act as if
2059 `STRICT_ALIGNMENT' were non-zero when generating code for block
2060 moves. This can cause significantly more instructions to be
2061 produced. Therefore, do not set this macro non-zero if unaligned
2062 accesses only add a cycle or two to the time for a memory access.
2063
2064 If the value of this macro is always zero, it need not be defined. */
2065
e1565e65 2066/* #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 0 */
d4ba09c0
SC
2067
2068/* Define this macro to inhibit strength reduction of memory
2069 addresses. (On some machines, such strength reduction seems to do
2070 harm rather than good.) */
2071
2072/* #define DONT_REDUCE_ADDR */
2073
2074/* Define this macro if it is as good or better to call a constant
2075 function address than to call an address kept in a register.
2076
2077 Desirable on the 386 because a CALL with a constant address is
2078 faster than one with a register address. */
2079
2080#define NO_FUNCTION_CSE
2081
2082/* Define this macro if it is as good or better for a function to call
2083 itself with an explicit address than to call an address kept in a
2084 register. */
2085
2086#define NO_RECURSIVE_FUNCTION_CSE
2087
2088/* A C statement (sans semicolon) to update the integer variable COST
2089 based on the relationship between INSN that is dependent on
2090 DEP_INSN through the dependence LINK. The default is to make no
2091 adjustment to COST. This can be used for example to specify to
2092 the scheduler that an output- or anti-dependence does not incur
2093 the same cost as a data-dependence. */
2094
e075ae69
RH
2095#define ADJUST_COST(insn,link,dep_insn,cost) \
2096 (cost) = ix86_adjust_cost(insn, link, dep_insn, cost)
d4ba09c0 2097
e075ae69
RH
2098#define ISSUE_RATE \
2099 ix86_issue_rate ()
2100
2101#define MD_SCHED_INIT(DUMP, SCHED_VERBOSE) \
2102 ix86_sched_init (DUMP, SCHED_VERBOSE)
d4ba09c0 2103
e075ae69
RH
2104#define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK, CIM) \
2105 (CIM) = ix86_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK)
a269a03c 2106
e075ae69
RH
2107#define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \
2108 ((CAN_ISSUE_MORE) = \
2109 ix86_variable_issue (DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE))
c98f8742 2110\f
c572e5ba
JVA
2111/* Add any extra modes needed to represent the condition code.
2112
e075ae69
RH
2113 For the i386, we need separate modes when floating-point
2114 equality comparisons are being done.
2115
2116 Add CCNO to indicate No Overflow, which is often also includes
2117 No Carry. This is typically used on the output of logicals,
2118 and is only valid in comparisons against zero. */
c572e5ba 2119
e075ae69
RH
2120#define EXTRA_CC_MODES \
2121 CC(CCNOmode, "CCNO") \
2122 CC(CCFPmode, "CCFP") \
2123 CC(CCFPUmode, "CCFPU")
c572e5ba
JVA
2124
2125/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2126 return the mode to be used for the comparison.
2127
2128 For floating-point equality comparisons, CCFPEQmode should be used.
e075ae69 2129 VOIDmode should be used in all other cases.
c572e5ba 2130
e075ae69
RH
2131 For integer comparisons against zero, reduce to CCNOmode if
2132 possible, to allow for more combinations. */
c98f8742 2133
e075ae69
RH
2134#define SELECT_CC_MODE(OP,X,Y) \
2135 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2136 ? (OP) == EQ || (OP) == NE ? CCFPUmode : CCFPmode \
2137 : (OP) == LE || (OP) == GT ? CCmode \
2138 : (Y) != const0_rtx ? CCmode \
2139 : CCNOmode)
c98f8742
JVA
2140\f
2141/* Control the assembler format that we output, to the extent
2142 this does not vary between assemblers. */
2143
2144/* How to refer to registers in assembler output.
2145 This sequence is indexed by compiler's hard-register-number (see above). */
2146
2147/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
2148 For non floating point regs, the following are the HImode names.
2149
2150 For float regs, the stack top is sometimes referred to as "%st(0)"
9e06e321 2151 instead of just "%st". PRINT_REG handles this with the "y" code. */
c98f8742 2152
e075ae69
RH
2153#define HI_REGISTER_NAMES \
2154{"ax","dx","cx","bx","si","di","bp","sp", \
2155 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
7c7ef435 2156 "flags","fpsr", "dirflag" }
c98f8742
JVA
2157
2158#define REGISTER_NAMES HI_REGISTER_NAMES
2159
2160/* Table of additional register names to use in user input. */
2161
2162#define ADDITIONAL_REGISTER_NAMES \
54d26233
MH
2163{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \
2164 { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \
2165 { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \
2166 { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }
c98f8742
JVA
2167
2168/* Note we are omitting these since currently I don't know how
2169to get gcc to use these, since they want the same but different
2170number as al, and ax.
2171*/
2172
b4ac57ab 2173/* note the last four are not really qi_registers, but
c98f8742
JVA
2174 the md will have to never output movb into one of them
2175 only a movw . There is no movb into the last four regs */
2176
2177#define QI_REGISTER_NAMES \
2178{"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
2179
2180/* These parallel the array above, and can be used to access bits 8:15
2181 of regs 0 through 3. */
2182
2183#define QI_HIGH_REGISTER_NAMES \
2184{"ah", "dh", "ch", "bh", }
2185
2186/* How to renumber registers for dbx and gdb. */
2187
2188/* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
2189#define DBX_REGISTER_NUMBER(n) \
2190((n) == 0 ? 0 : \
2191 (n) == 1 ? 2 : \
2192 (n) == 2 ? 1 : \
2193 (n) == 3 ? 3 : \
2194 (n) == 4 ? 6 : \
2195 (n) == 5 ? 7 : \
2196 (n) == 6 ? 4 : \
2197 (n) == 7 ? 5 : \
2198 (n) + 4)
2199
469ac993
JM
2200/* Before the prologue, RA is at 0(%esp). */
2201#define INCOMING_RETURN_ADDR_RTX \
f64cecad 2202 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
c5c76735 2203
e414ab29
RH
2204/* After the prologue, RA is at -4(AP) in the current frame. */
2205#define RETURN_ADDR_RTX(COUNT, FRAME) \
2206 ((COUNT) == 0 \
c5c76735
JL
2207 ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -4))\
2208 : gen_rtx_MEM (Pmode, plus_constant (FRAME, 4)))
e414ab29 2209
469ac993
JM
2210/* PC is dbx register 8; let's use that column for RA. */
2211#define DWARF_FRAME_RETURN_COLUMN 8
2212
a6ab3aad
JM
2213/* Before the prologue, the top of the frame is at 4(%esp). */
2214#define INCOMING_FRAME_SP_OFFSET 4
2215
c98f8742
JVA
2216/* This is how to output the definition of a user-level label named NAME,
2217 such as the label on a static function or variable NAME. */
2218
2219#define ASM_OUTPUT_LABEL(FILE,NAME) \
2220 (assemble_name (FILE, NAME), fputs (":\n", FILE))
2221
2222/* This is how to output an assembler line defining a `double' constant. */
2223
0038aea6
JVA
2224#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2225do { long l[2]; \
2226 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
e075ae69 2227 fprintf (FILE, "%s\t0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
0038aea6 2228 } while (0)
c98f8742 2229
0038aea6
JVA
2230/* This is how to output a `long double' extended real constant. */
2231
2232#undef ASM_OUTPUT_LONG_DOUBLE
2233#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2234do { long l[3]; \
2235 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
e075ae69 2236 fprintf (FILE, "%s\t0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
0038aea6 2237 } while (0)
c98f8742
JVA
2238
2239/* This is how to output an assembler line defining a `float' constant. */
2240
0038aea6
JVA
2241#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2242do { long l; \
2243 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
e075ae69 2244 fprintf ((FILE), "%s\t0x%lx\n", ASM_LONG, l); \
c98f8742
JVA
2245 } while (0)
2246
c98f8742
JVA
2247/* Store in OUTPUT a string (made with alloca) containing
2248 an assembler-name for a local static variable named NAME.
2249 LABELNO is an integer which is different for each call. */
2250
2251#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2252( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2253 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2254
c98f8742
JVA
2255/* This is how to output an assembler line defining an `int' constant. */
2256
2257#define ASM_OUTPUT_INT(FILE,VALUE) \
e075ae69 2258( fprintf (FILE, "%s\t", ASM_LONG), \
c98f8742
JVA
2259 output_addr_const (FILE,(VALUE)), \
2260 putc('\n',FILE))
2261
2262/* Likewise for `char' and `short' constants. */
2263/* is this supposed to do align too?? */
2264
2265#define ASM_OUTPUT_SHORT(FILE,VALUE) \
e075ae69 2266( fprintf (FILE, "%s\t", ASM_SHORT), \
c98f8742
JVA
2267 output_addr_const (FILE,(VALUE)), \
2268 putc('\n',FILE))
2269
c98f8742 2270#define ASM_OUTPUT_CHAR(FILE,VALUE) \
e075ae69 2271( fprintf (FILE, "%s\t", ASM_BYTE_OP), \
c98f8742
JVA
2272 output_addr_const (FILE, (VALUE)), \
2273 putc ('\n', FILE))
2274
2275/* This is how to output an assembler line for a numeric constant byte. */
2276
2277#define ASM_OUTPUT_BYTE(FILE,VALUE) \
e075ae69 2278 asm_fprintf ((FILE), "%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
c98f8742
JVA
2279
2280/* This is how to output an insn to push a register on the stack.
2281 It need not be very fast code. */
2282
2283#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
e075ae69 2284 asm_fprintf (FILE, "\tpush{l}\t%%e%s\n", reg_names[REGNO])
c98f8742
JVA
2285
2286/* This is how to output an insn to pop a register from the stack.
2287 It need not be very fast code. */
2288
2289#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
e075ae69 2290 asm_fprintf (FILE, "\tpop{l}\t%%e%s\n", reg_names[REGNO])
c98f8742
JVA
2291
2292/* This is how to output an element of a case-vector that is absolute.
2293 */
2294
2295#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2296 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
2297
2298/* This is how to output an element of a case-vector that is relative.
2299 We don't use these on the 386 yet, because the ATT assembler can't do
2300 forward reference the differences.
2301 */
2302
33f7f353 2303#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
e075ae69 2304 fprintf (FILE, "\t%s\t%s%d-%s%d\n",ASM_LONG, LPREFIX, VALUE, LPREFIX, REL)
c98f8742
JVA
2305
2306/* Define the parentheses used to group arithmetic operations
2307 in assembler code. */
2308
2309#define ASM_OPEN_PAREN ""
2310#define ASM_CLOSE_PAREN ""
2311
2312/* Define results of standard character escape sequences. */
2313#define TARGET_BELL 007
2314#define TARGET_BS 010
2315#define TARGET_TAB 011
2316#define TARGET_NEWLINE 012
2317#define TARGET_VT 013
2318#define TARGET_FF 014
2319#define TARGET_CR 015
74b42c8b 2320\f
c98f8742
JVA
2321/* Print operand X (an rtx) in assembler syntax to file FILE.
2322 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2323 The CODE z takes the size of operand from the following digit, and
2324 outputs b,w,or l respectively.
2325
2326 On the 80386, we use several such letters:
2327 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
0038aea6 2328 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
c98f8742
JVA
2329 R -- print the prefix for register names.
2330 z -- print the opcode suffix for the size of the current operand.
2331 * -- print a star (in certain assembler syntax)
5cb6195d
RH
2332 P -- if PIC, print an @PLT suffix.
2333 X -- don't print any sort of PIC '@' suffix for a symbol.
5cb6195d
RH
2334 s -- ??? something to do with double shifts. not actually used, afaik.
2335 C -- print a conditional move suffix corresponding to the op code.
2336 c -- likewise, but reverse the condition.
2337 F,f -- likewise, but for floating-point. */
c98f8742
JVA
2338
2339#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
e075ae69 2340 ((CODE) == '*')
c98f8742 2341
74b42c8b
RS
2342/* Print the name of a register based on its machine mode and number.
2343 If CODE is 'w', pretend the mode is HImode.
2344 If CODE is 'b', pretend the mode is QImode.
2345 If CODE is 'k', pretend the mode is SImode.
2346 If CODE is 'h', pretend the reg is the `high' byte register.
2347 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
2348
e075ae69
RH
2349#define PRINT_REG(X, CODE, FILE) \
2350 print_reg (X, CODE, FILE)
74b42c8b 2351
c98f8742
JVA
2352#define PRINT_OPERAND(FILE, X, CODE) \
2353 print_operand (FILE, X, CODE)
c98f8742
JVA
2354
2355#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
2356 print_operand_address (FILE, ADDR)
2357
aa3e8d2a
JVA
2358/* Print the name of a register for based on its machine mode and number.
2359 This macro is used to print debugging output.
2360 This macro is different from PRINT_REG in that it may be used in
2361 programs that are not linked with aux-output.o. */
2362
e075ae69 2363#define DEBUG_PRINT_REG(X, CODE, FILE) \
69ddee61
KG
2364 do { static const char * const hi_name[] = HI_REGISTER_NAMES; \
2365 static const char * const qi_name[] = QI_REGISTER_NAMES; \
e075ae69
RH
2366 fprintf (FILE, "%d ", REGNO (X)); \
2367 if (REGNO (X) == FLAGS_REG) \
2368 { fputs ("flags", FILE); break; } \
7c7ef435
JH
2369 if (REGNO (X) == DIRFLAG_REG) \
2370 { fputs ("dirflag", FILE); break; } \
e075ae69
RH
2371 if (REGNO (X) == FPSR_REG) \
2372 { fputs ("fpsr", FILE); break; } \
aa3e8d2a
JVA
2373 if (REGNO (X) == ARG_POINTER_REGNUM) \
2374 { fputs ("argp", FILE); break; } \
2375 if (STACK_TOP_P (X)) \
2376 { fputs ("st(0)", FILE); break; } \
b0ceea8c
RK
2377 if (FP_REG_P (X)) \
2378 { fputs (hi_name[REGNO(X)], FILE); break; } \
aa3e8d2a
JVA
2379 switch (GET_MODE_SIZE (GET_MODE (X))) \
2380 { \
b0ceea8c
RK
2381 default: \
2382 fputs ("e", FILE); \
aa3e8d2a
JVA
2383 case 2: \
2384 fputs (hi_name[REGNO (X)], FILE); \
2385 break; \
2386 case 1: \
2387 fputs (qi_name[REGNO (X)], FILE); \
2388 break; \
2389 } \
2390 } while (0)
2391
c98f8742
JVA
2392/* Routines in libgcc that return floats must return them in an fp reg,
2393 just as other functions do which return such values.
2394 These macros make that happen. */
2395
2396#define FLOAT_VALUE_TYPE float
2397#define INTIFY(FLOATVAL) FLOATVAL
2398
c98f8742
JVA
2399/* a letter which is not needed by the normal asm syntax, which
2400 we can use for operand syntax in the extended asm */
2401
2402#define ASM_OPERAND_LETTER '#'
c98f8742 2403#define RET return ""
f64cecad 2404#define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx))
d4ba09c0 2405\f
e075ae69
RH
2406/* Define the codes that are matched by predicates in i386.c. */
2407
2408#define PREDICATE_CODES \
2409 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2410 {"pic_symbolic_operand", {CONST}}, \
2411 {"call_insn_operand", {MEM}}, \
2412 {"expander_call_insn_operand", {MEM}}, \
2413 {"constant_call_address_operand", {MEM}}, \
2414 {"const0_operand", {CONST_INT, CONST_DOUBLE}}, \
2415 {"const1_operand", {CONST_INT}}, \
2416 {"const248_operand", {CONST_INT}}, \
2417 {"incdec_operand", {CONST_INT}}, \
2418 {"reg_no_sp_operand", {SUBREG, REG}}, \
2419 {"q_regs_operand", {SUBREG, REG}}, \
2420 {"non_q_regs_operand", {SUBREG, REG}}, \
2421 {"no_comparison_operator", {EQ, NE, LT, GE, LTU, GTU, LEU, GEU}}, \
2422 {"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU}}, \
2423 {"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}}, \
2424 {"ext_register_operand", {SUBREG, REG}}, \
2425 {"binary_fp_operator", {PLUS, MINUS, MULT, DIV}}, \
2426 {"mult_operator", {MULT}}, \
2427 {"div_operator", {DIV}}, \
2428 {"arith_or_logical_operator", {PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, \
2429 UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
2430 UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
2431 LSHIFTRT, ROTATERT}}, \
e9e80858 2432 {"promotable_binary_operator", {PLUS, MULT, AND, IOR, XOR, ASHIFT}}, \
e075ae69
RH
2433 {"memory_displacement_operand", {MEM}}, \
2434 {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
6343a50e
ZW
2435 LABEL_REF, SUBREG, REG, MEM, AND}}, \
2436 {"long_memory_operand", {MEM}},
c76aab11
RH
2437
2438/* A list of predicates that do special things with modes, and so
2439 should not elicit warnings for VOIDmode match_operand. */
2440
2441#define SPECIAL_MODE_PREDICATES \
2442 "ext_register_operand",
c98f8742 2443\f
f5316dfe 2444/* Variables in i386.c */
9c23aa47
ZW
2445extern const char *ix86_cpu_string; /* for -mcpu=<xxx> */
2446extern const char *ix86_arch_string; /* for -march=<xxx> */
e075ae69
RH
2447extern const char *ix86_reg_alloc_order; /* register allocation order */
2448extern const char *ix86_regparm_string; /* # registers to use to pass args */
2449extern const char *ix86_align_loops_string; /* power of two alignment for loops */
2450extern const char *ix86_align_jumps_string; /* power of two alignment for non-loop jumps */
2451extern const char *ix86_align_funcs_string; /* power of two alignment for functions */
2452extern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
2453extern const char *ix86_branch_cost_string; /* values 1-5: see jump.c */
2454extern int ix86_regparm; /* ix86_regparm_string as a number */
2455extern int ix86_align_loops; /* power of two alignment for loops */
2456extern int ix86_align_jumps; /* power of two alignment for non-loop jumps */
2457extern int ix86_align_funcs; /* power of two alignment for functions */
2458extern int ix86_preferred_stack_boundary; /* preferred stack boundary alignment in bits */
2459extern int ix86_branch_cost; /* values 1-5: see jump.c */
2460extern const char * const hi_reg_name[]; /* names for 16 bit regs */
2461extern const char * const qi_reg_name[]; /* names for 8 bit regs (low) */
2462extern const char * const qi_high_reg_name[]; /* names for 8 bit regs (high) */
2463extern enum reg_class const regclass_map[]; /* smalled class containing REGNO */
2464extern struct rtx_def *ix86_compare_op0; /* operand 0 for comparisons */
2465extern struct rtx_def *ix86_compare_op1; /* operand 1 for comparisons */
3b3c6a3f 2466\f
c98f8742
JVA
2467/*
2468Local variables:
2469version-control: t
2470End:
2471*/