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