Revert last patch.
[official-gcc.git] / gcc / config / i386 / i386.h
blobad52760cf38516d4b818505f67b02e0bbf13f369
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} \
300 %{m486:-mcpu=i486} \
301 %{mpentium:-mcpu=pentium} \
302 %{mpentiumpro:-mcpu=pentiumpro}}"
303 #endif
305 #ifndef CPP_CPU_DEFAULT_SPEC
306 #if TARGET_CPU_DEFAULT == 1
307 #define CPP_CPU_DEFAULT_SPEC "-D__tune_i486__"
308 #endif
309 #if TARGET_CPU_DEFAULT == 2
310 #define CPP_CPU_DEFAULT_SPEC "-D__tune_pentium__"
311 #endif
312 #if TARGET_CPU_DEFAULT == 3
313 #define CPP_CPU_DEFAULT_SPEC "-D__tune_pentiumpro__"
314 #endif
315 #if TARGET_CPU_DEFAULT == 4
316 #define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__"
317 #endif
318 #ifndef CPP_CPU_DEFAULT_SPEC
319 #define CPP_CPU_DEFAULT_SPEC "-D__tune_i386__"
320 #endif
321 #endif /* CPP_CPU_DEFAULT_SPEC */
323 #ifndef CPP_CPU_SPEC
324 #define CPP_CPU_SPEC "\
325 -Acpu(i386) -Amachine(i386) \
326 %{!ansi:-Di386} -D__i386 -D__i386__ \
327 %{march=i386:%{!mcpu*:-D__tune_i386__ }}\
328 %{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
329 %{march=pentium|march=i586:-D__pentium -D__pentium__ \
330 %{!mcpu*:-D__tune_pentium__ }}\
331 %{march=pentiumpro|march=i686:-D__pentiumpro -D__pentiumpro__ \
332 %{!mcpu*:-D__tune_pentiumpro__ }}\
333 %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
334 %{m386|mcpu=i386:-D__tune_i386__ }\
335 %{m486|mcpu=i486:-D__tune_i486__ }\
336 %{mpentium|mcpu=pentium|mcpu=i586:-D__tune_pentium__ }\
337 %{mpentiumpro|mcpu=pentiumpro|mcpu=i686:-D__tune_pentiumpro__ }\
338 %{mcpu=k6:-D__tune_k6__ }\
339 %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
340 #endif
342 #ifndef CC1_SPEC
343 #define CC1_SPEC "%(cc1_cpu) "
344 #endif
346 /* This macro defines names of additional specifications to put in the
347 specs that can be used in various specifications like CC1_SPEC. Its
348 definition is an initializer with a subgrouping for each command option.
350 Each subgrouping contains a string constant, that defines the
351 specification name, and a string constant that used by the GNU CC driver
352 program.
354 Do not define this macro if it does not need to do anything. */
356 #ifndef SUBTARGET_EXTRA_SPECS
357 #define SUBTARGET_EXTRA_SPECS
358 #endif
360 #define EXTRA_SPECS \
361 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
362 { "cpp_cpu", CPP_CPU_SPEC }, \
363 { "cc1_cpu", CC1_CPU_SPEC }, \
364 SUBTARGET_EXTRA_SPECS
366 /* target machine storage layout */
368 /* Define for XFmode extended real floating point support.
369 This will automatically cause REAL_ARITHMETIC to be defined. */
370 #define LONG_DOUBLE_TYPE_SIZE 96
372 /* Define if you don't want extended real, but do want to use the
373 software floating point emulator for REAL_ARITHMETIC and
374 decimal <-> binary conversion. */
375 /* #define REAL_ARITHMETIC */
377 /* Define this if most significant byte of a word is the lowest numbered. */
378 /* That is true on the 80386. */
380 #define BITS_BIG_ENDIAN 0
382 /* Define this if most significant byte of a word is the lowest numbered. */
383 /* That is not true on the 80386. */
384 #define BYTES_BIG_ENDIAN 0
386 /* Define this if most significant word of a multiword number is the lowest
387 numbered. */
388 /* Not true for 80386 */
389 #define WORDS_BIG_ENDIAN 0
391 /* number of bits in an addressable storage unit */
392 #define BITS_PER_UNIT 8
394 /* Width in bits of a "word", which is the contents of a machine register.
395 Note that this is not necessarily the width of data type `int';
396 if using 16-bit ints on a 80386, this would still be 32.
397 But on a machine with 16-bit registers, this would be 16. */
398 #define BITS_PER_WORD 32
400 /* Width of a word, in units (bytes). */
401 #define UNITS_PER_WORD 4
403 /* Width in bits of a pointer.
404 See also the macro `Pmode' defined below. */
405 #define POINTER_SIZE 32
407 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
408 #define PARM_BOUNDARY 32
410 /* Boundary (in *bits*) on which stack pointer should be aligned. */
411 #define STACK_BOUNDARY 32
413 /* Boundary (in *bits*) on which the stack pointer preferrs to be
414 aligned; the compiler cannot rely on having this alignment. */
415 #define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
417 /* Allocation boundary for the code of a function. */
418 #define FUNCTION_BOUNDARY \
419 (1 << ((ix86_align_funcs >= 0 ? ix86_align_funcs : -ix86_align_funcs) + 3))
421 /* Alignment of field after `int : 0' in a structure. */
423 #define EMPTY_FIELD_BOUNDARY 32
425 /* Minimum size in bits of the largest boundary to which any
426 and all fundamental data types supported by the hardware
427 might need to be aligned. No data type wants to be aligned
428 rounder than this. The i386 supports 64-bit floating point
429 quantities, but these can be aligned on any 32-bit boundary.
430 The published ABIs say that doubles should be aligned on word
431 boundaries, but the Pentium gets better performance with them
432 aligned on 64 bit boundaries. */
433 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
435 /* If defined, a C expression to compute the alignment given to a
436 constant that is being placed in memory. CONSTANT is the constant
437 and ALIGN is the alignment that the object would ordinarily have.
438 The value of this macro is used instead of that alignment to align
439 the object.
441 If this macro is not defined, then ALIGN is used.
443 The typical use of this macro is to increase alignment for string
444 constants to be word aligned so that `strcpy' calls that copy
445 constants can be done inline. */
447 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
448 (TREE_CODE (EXP) == REAL_CST \
449 ? ((TYPE_MODE (TREE_TYPE (EXP)) == DFmode && (ALIGN) < 64) \
450 ? 64 \
451 : (TYPE_MODE (TREE_TYPE (EXP)) == XFmode && (ALIGN) < 128) \
452 ? 128 \
453 : (ALIGN)) \
454 : TREE_CODE (EXP) == STRING_CST \
455 ? ((TREE_STRING_LENGTH (EXP) >= 31 && (ALIGN) < 256) \
456 ? 256 \
457 : (ALIGN)) \
458 : (ALIGN))
460 /* If defined, a C expression to compute the alignment for a static
461 variable. TYPE is the data type, and ALIGN is the alignment that
462 the object would ordinarily have. The value of this macro is used
463 instead of that alignment to align the object.
465 If this macro is not defined, then ALIGN is used.
467 One use of this macro is to increase alignment of medium-size
468 data to make it all fit in fewer cache lines. Another is to
469 cause character arrays to be word-aligned so that `strcpy' calls
470 that copy constants to character arrays can be done inline. */
472 #define DATA_ALIGNMENT(TYPE, ALIGN) \
473 ((AGGREGATE_TYPE_P (TYPE) \
474 && TYPE_SIZE (TYPE) \
475 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
476 && (TREE_INT_CST_LOW (TYPE_SIZE (TYPE)) >= 256 \
477 || TREE_INT_CST_HIGH (TYPE_SIZE (TYPE))) && (ALIGN) < 256) \
478 ? 256 \
479 : TREE_CODE (TYPE) == ARRAY_TYPE \
480 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
481 ? 64 \
482 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
483 ? 128 \
484 : (ALIGN)) \
485 : TREE_CODE (TYPE) == COMPLEX_TYPE \
486 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
487 ? 64 \
488 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
489 ? 128 \
490 : (ALIGN)) \
491 : ((TREE_CODE (TYPE) == RECORD_TYPE \
492 || TREE_CODE (TYPE) == UNION_TYPE \
493 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
494 && TYPE_FIELDS (TYPE)) \
495 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
496 ? 64 \
497 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
498 ? 128 \
499 : (ALIGN)) \
500 : TREE_CODE (TYPE) == REAL_TYPE \
501 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
502 ? 64 \
503 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
504 ? 128 \
505 : (ALIGN)) \
506 : (ALIGN))
508 /* If defined, a C expression to compute the alignment for a local
509 variable. TYPE is the data type, and ALIGN is the alignment that
510 the object would ordinarily have. The value of this macro is used
511 instead of that alignment to align the object.
513 If this macro is not defined, then ALIGN is used.
515 One use of this macro is to increase alignment of medium-size
516 data to make it all fit in fewer cache lines. */
518 #define LOCAL_ALIGNMENT(TYPE, ALIGN) \
519 (TREE_CODE (TYPE) == ARRAY_TYPE \
520 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
521 ? 64 \
522 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
523 ? 128 \
524 : (ALIGN)) \
525 : TREE_CODE (TYPE) == COMPLEX_TYPE \
526 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
527 ? 64 \
528 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
529 ? 128 \
530 : (ALIGN)) \
531 : ((TREE_CODE (TYPE) == RECORD_TYPE \
532 || TREE_CODE (TYPE) == UNION_TYPE \
533 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
534 && TYPE_FIELDS (TYPE)) \
535 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
536 ? 64 \
537 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
538 ? 128 \
539 : (ALIGN)) \
540 : TREE_CODE (TYPE) == REAL_TYPE \
541 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
542 ? 64 \
543 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
544 ? 128 \
545 : (ALIGN)) \
546 : (ALIGN))
548 /* Set this non-zero if move instructions will actually fail to work
549 when given unaligned data. */
550 #define STRICT_ALIGNMENT 0
552 /* If bit field type is int, don't let it cross an int,
553 and give entire struct the alignment of an int. */
554 /* Required on the 386 since it doesn't have bitfield insns. */
555 #define PCC_BITFIELD_TYPE_MATTERS 1
557 /* Align loop starts for optimal branching. */
558 #define LOOP_ALIGN(LABEL) \
559 (ix86_align_loops < 0 ? -ix86_align_loops : ix86_align_loops)
560 #define LOOP_ALIGN_MAX_SKIP \
561 (ix86_align_loops < -3 ? (1<<(-ix86_align_loops-1))-1 : 0)
563 /* This is how to align an instruction for optimal branching. */
564 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
565 (ix86_align_jumps < 0 ? -ix86_align_jumps : ix86_align_jumps)
566 #define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP \
567 (ix86_align_jumps < -3 ? (1<<(-ix86_align_jumps-1))-1 : 0)
569 /* Standard register usage. */
571 /* This processor has special stack-like registers. See reg-stack.c
572 for details. */
574 #define STACK_REGS
575 #define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode)
577 /* Number of actual hardware registers.
578 The hardware registers are assigned numbers for the compiler
579 from 0 to just below FIRST_PSEUDO_REGISTER.
580 All registers that the compiler knows about must be given numbers,
581 even those that are not normally considered general registers.
583 In the 80386 we give the 8 general purpose registers the numbers 0-7.
584 We number the floating point registers 8-15.
585 Note that registers 0-7 can be accessed as a short or int,
586 while only 0-3 may be used with byte `mov' instructions.
588 Reg 16 does not correspond to any hardware register, but instead
589 appears in the RTL as an argument pointer prior to reload, and is
590 eliminated during reloading in favor of either the stack or frame
591 pointer. */
593 #define FIRST_PSEUDO_REGISTER 19
595 /* 1 for registers that have pervasive standard uses
596 and are not available for the register allocator.
597 On the 80386, the stack pointer is such, as is the arg pointer. */
598 #define FIXED_REGISTERS \
599 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr*/ \
600 { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }
602 /* 1 for registers not available across function calls.
603 These must include the FIXED_REGISTERS and also any
604 registers that can be used without being saved.
605 The latter must include the registers where values are returned
606 and the register where structure-value addresses are passed.
607 Aside from that, you can include as many other registers as you like. */
609 #define CALL_USED_REGISTERS \
610 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr*/ \
611 { 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
613 /* Order in which to allocate registers. Each register must be
614 listed once, even those in FIXED_REGISTERS. List frame pointer
615 late and fixed registers last. Note that, in general, we prefer
616 registers listed in CALL_USED_REGISTERS, keeping the others
617 available for storage of persistent values.
619 Three different versions of REG_ALLOC_ORDER have been tried:
621 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
622 but slower code on simple functions returning values in eax.
624 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
625 perl 4.036 due to not being able to create a DImode register (to hold a 2
626 word union).
628 If the order is eax, edx, ecx, ... it produces better code for simple
629 functions, and a slightly slower compiler. Users complained about the code
630 generated by allocating edx first, so restore the 'natural' order of things. */
632 #define REG_ALLOC_ORDER \
633 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,cc,fpsr*/ \
634 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 18 }
636 /* A C statement (sans semicolon) to choose the order in which to
637 allocate hard registers for pseudo-registers local to a basic
638 block.
640 Store the desired register order in the array `reg_alloc_order'.
641 Element 0 should be the register to allocate first; element 1, the
642 next register; and so on.
644 The macro body should not assume anything about the contents of
645 `reg_alloc_order' before execution of the macro.
647 On most machines, it is not necessary to define this macro. */
649 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
651 /* Macro to conditionally modify fixed_regs/call_used_regs. */
652 #define CONDITIONAL_REGISTER_USAGE \
654 if (flag_pic) \
656 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
657 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
659 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
661 int i; \
662 HARD_REG_SET x; \
663 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
664 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
665 if (TEST_HARD_REG_BIT (x, i)) \
666 fixed_regs[i] = call_used_regs[i] = 1; \
670 /* Return number of consecutive hard regs needed starting at reg REGNO
671 to hold something of mode MODE.
672 This is ordinarily the length in words of a value of mode MODE
673 but can be less for certain modes in special long registers.
675 Actually there are no two word move instructions for consecutive
676 registers. And only registers 0-3 may have mov byte instructions
677 applied to them.
680 #define HARD_REGNO_NREGS(REGNO, MODE) \
681 (FP_REGNO_P (REGNO) ? 1 \
682 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
684 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
686 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
687 /* Flags and only flags can only hold CCmode values. */ \
688 (CC_REGNO_P (REGNO) \
689 ? GET_MODE_CLASS (MODE) == MODE_CC \
690 : GET_MODE_CLASS (MODE) == MODE_CC ? 0 \
691 /* FP regs can only hold floating point; make it clear they \
692 cannot hold TFmode floats. */ \
693 : FP_REGNO_P (REGNO) \
694 ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
695 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
696 && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\
697 /* Only allow DImode in even registers. */ \
698 : (MODE) == DImode && ((REGNO) & 1) ? 0 \
699 /* The first four integer regs can hold any mode. */ \
700 : (REGNO) < 4 ? 1 \
701 /* Other regs cannot do byte accesses. */ \
702 : (MODE) != QImode ? 1 \
703 : reload_in_progress || reload_completed)
705 /* Value is 1 if it is a good idea to tie two pseudo registers
706 when one has mode MODE1 and one has mode MODE2.
707 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
708 for any hard reg, then this must be 0 for correct output. */
710 #define MODES_TIEABLE_P(MODE1, MODE2) \
711 ((MODE1) == (MODE2) \
712 || ((MODE1) == SImode && (MODE2) == HImode) \
713 || ((MODE1) == HImode && (MODE2) == SImode))
715 /* Specify the modes required to caller save a given hard regno.
716 We do this on i386 to prevent flags from being saved at all. */
718 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS) \
719 (CC_REGNO_P (REGNO) ? VOIDmode \
720 : choose_hard_reg_mode ((REGNO), (NREGS)))
722 /* Specify the registers used for certain standard purposes.
723 The values of these macros are register numbers. */
725 /* on the 386 the pc register is %eip, and is not usable as a general
726 register. The ordinary mov instructions won't work */
727 /* #define PC_REGNUM */
729 /* Register to use for pushing function arguments. */
730 #define STACK_POINTER_REGNUM 7
732 /* Base register for access to local variables of the function. */
733 #define FRAME_POINTER_REGNUM 6
735 /* First floating point reg */
736 #define FIRST_FLOAT_REG 8
738 /* First & last stack-like regs */
739 #define FIRST_STACK_REG FIRST_FLOAT_REG
740 #define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
742 #define FLAGS_REG 17
743 #define FPSR_REG 18
745 /* Value should be nonzero if functions must have frame pointers.
746 Zero means the frame pointer need not be set up (and parms
747 may be accessed via the stack pointer) in functions that seem suitable.
748 This is computed in `reload', in reload1.c. */
749 #define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
751 /* Base register for access to arguments of the function. */
752 #define ARG_POINTER_REGNUM 16
754 /* Register in which static-chain is passed to a function. */
755 #define STATIC_CHAIN_REGNUM 2
757 /* Register to hold the addressing base for position independent
758 code access to data items. */
759 #define PIC_OFFSET_TABLE_REGNUM 3
761 /* Register in which address to store a structure value
762 arrives in the function. On the 386, the prologue
763 copies this from the stack to register %eax. */
764 #define STRUCT_VALUE_INCOMING 0
766 /* Place in which caller passes the structure value address.
767 0 means push the value on the stack like an argument. */
768 #define STRUCT_VALUE 0
770 /* A C expression which can inhibit the returning of certain function
771 values in registers, based on the type of value. A nonzero value
772 says to return the function value in memory, just as large
773 structures are always returned. Here TYPE will be a C expression
774 of type `tree', representing the data type of the value.
776 Note that values of mode `BLKmode' must be explicitly handled by
777 this macro. Also, the option `-fpcc-struct-return' takes effect
778 regardless of this macro. On most systems, it is possible to
779 leave the macro undefined; this causes a default definition to be
780 used, whose value is the constant 1 for `BLKmode' values, and 0
781 otherwise.
783 Do not use this macro to indicate that structures and unions
784 should always be returned in memory. You should instead use
785 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
787 #define RETURN_IN_MEMORY(TYPE) \
788 ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
791 /* Define the classes of registers for register constraints in the
792 machine description. Also define ranges of constants.
794 One of the classes must always be named ALL_REGS and include all hard regs.
795 If there is more than one class, another class must be named NO_REGS
796 and contain no registers.
798 The name GENERAL_REGS must be the name of a class (or an alias for
799 another name such as ALL_REGS). This is the class of registers
800 that is allowed by "g" or "r" in a register constraint.
801 Also, registers outside this class are allocated only when
802 instructions express preferences for them.
804 The classes must be numbered in nondecreasing order; that is,
805 a larger-numbered class must never be contained completely
806 in a smaller-numbered class.
808 For any two classes, it is very desirable that there be another
809 class that represents their union.
811 It might seem that class BREG is unnecessary, since no useful 386
812 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
813 and the "b" register constraint is useful in asms for syscalls.
815 The flags and fpsr registers are in no class. */
817 enum reg_class
819 NO_REGS,
820 AREG, DREG, CREG, BREG, SIREG, DIREG,
821 AD_REGS, /* %eax/%edx for DImode */
822 Q_REGS, /* %eax %ebx %ecx %edx */
823 NON_Q_REGS, /* %esi %edi %ebp %esi */
824 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
825 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
826 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
827 FLOAT_REGS,
828 ALL_REGS, LIM_REG_CLASSES
831 #define N_REG_CLASSES (int) LIM_REG_CLASSES
833 #define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
835 /* Give names of register classes as strings for dump file. */
837 #define REG_CLASS_NAMES \
838 { "NO_REGS", \
839 "AREG", "DREG", "CREG", "BREG", \
840 "SIREG", "DIREG", \
841 "AD_REGS", \
842 "Q_REGS", "NON_Q_REGS", \
843 "INDEX_REGS", \
844 "GENERAL_REGS", \
845 "FP_TOP_REG", "FP_SECOND_REG", \
846 "FLOAT_REGS", \
847 "ALL_REGS" }
849 /* Define which registers fit in which classes.
850 This is an initializer for a vector of HARD_REG_SET
851 of length N_REG_CLASSES. */
853 #define REG_CLASS_CONTENTS \
854 { {0}, \
855 {0x1}, {0x2}, {0x4}, {0x8},/* AREG, DREG, CREG, BREG */ \
856 {0x10}, {0x20}, /* SIREG, DIREG */ \
857 {0x3}, /* AD_REGS */ \
858 {0xf}, /* Q_REGS */ \
859 {0xf0}, /* NON_Q_REGS */ \
860 {0x7f}, /* INDEX_REGS */ \
861 {0x100ff}, /* GENERAL_REGS */ \
862 {0x0100}, {0x0200}, /* FP_TOP_REG, FP_SECOND_REG */ \
863 {0xff00}, /* FLOAT_REGS */ \
864 {0x7ffff} \
867 /* The same information, inverted:
868 Return the class number of the smallest class containing
869 reg number REGNO. This could be a conditional expression
870 or could index an array. */
872 #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
874 /* When defined, the compiler allows registers explicitly used in the
875 rtl to be used as spill registers but prevents the compiler from
876 extending the lifetime of these registers. */
878 #define SMALL_REGISTER_CLASSES 1
880 #define QI_REG_P(X) \
881 (REG_P (X) && REGNO (X) < 4)
882 #define NON_QI_REG_P(X) \
883 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
885 #define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
886 #define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
888 #define STACK_REG_P(xop) (REG_P (xop) && \
889 REGNO (xop) >= FIRST_STACK_REG && \
890 REGNO (xop) <= LAST_STACK_REG)
892 #define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
894 #define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
896 #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
897 #define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG)
899 /* 1 if register REGNO can magically overlap other regs.
900 Note that nonzero values work only in very special circumstances. */
902 /* #define OVERLAPPING_REGNO_P(REGNO) FP_REGNO_P (REGNO) */
904 /* The class value for index registers, and the one for base regs. */
906 #define INDEX_REG_CLASS INDEX_REGS
907 #define BASE_REG_CLASS GENERAL_REGS
909 /* Get reg_class from a letter such as appears in the machine description. */
911 #define REG_CLASS_FROM_LETTER(C) \
912 ((C) == 'r' ? GENERAL_REGS : \
913 (C) == 'q' ? Q_REGS : \
914 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
915 ? FLOAT_REGS \
916 : NO_REGS) : \
917 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
918 ? FP_TOP_REG \
919 : NO_REGS) : \
920 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
921 ? FP_SECOND_REG \
922 : NO_REGS) : \
923 (C) == 'a' ? AREG : \
924 (C) == 'b' ? BREG : \
925 (C) == 'c' ? CREG : \
926 (C) == 'd' ? DREG : \
927 (C) == 'A' ? AD_REGS : \
928 (C) == 'D' ? DIREG : \
929 (C) == 'S' ? SIREG : NO_REGS)
931 /* The letters I, J, K, L and M in a register constraint string
932 can be used to stand for particular ranges of immediate operands.
933 This macro defines what the ranges are.
934 C is the letter, and VALUE is a constant value.
935 Return 1 if VALUE is in the range specified by C.
937 I is for non-DImode shifts.
938 J is for DImode shifts.
939 K is for signed imm8 operands.
940 L is for andsi as zero-extending move.
941 M is for shifts that can be executed by the "lea" opcode.
944 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
945 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 \
946 : (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 \
947 : (C) == 'K' ? (VALUE) >= -128 && (VALUE) <= 127 \
948 : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff \
949 : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 \
950 : 0)
952 /* Similar, but for floating constants, and defining letters G and H.
953 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
954 TARGET_387 isn't set, because the stack register converter may need to
955 load 0.0 into the function value register. */
957 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
958 ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
960 /* Place additional restrictions on the register class to use when it
961 is necessary to be able to hold a value of mode MODE in a reload
962 register for which class CLASS would ordinarily be used. */
964 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
965 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
966 ? Q_REGS : (CLASS))
968 /* Given an rtx X being reloaded into a reg required to be
969 in class CLASS, return the class of reg to actually use.
970 In general this is just CLASS; but on some machines
971 in some cases it is preferable to use a more restrictive class.
972 On the 80386 series, we prevent floating constants from being
973 reloaded into floating registers (since no move-insn can do that)
974 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
976 /* Put float CONST_DOUBLE in the constant pool instead of fp regs.
977 QImode must go into class Q_REGS.
978 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
979 movdf to do mem-to-mem moves through integer regs. */
981 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
982 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \
983 ? (standard_80387_constant_p (X) \
984 ? reg_class_subset_p (CLASS, FLOAT_REGS) ? CLASS : FLOAT_REGS \
985 : NO_REGS) \
986 : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
987 : ((CLASS) == ALL_REGS \
988 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
989 : (CLASS))
991 /* If we are copying between general and FP registers, we need a memory
992 location. */
994 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
995 (FLOAT_CLASS_P (CLASS1) != FLOAT_CLASS_P (CLASS2))
997 /* QImode spills from non-QI registers need a scratch. This does not
998 happen often -- the only example so far requires an uninitialized
999 pseudo. */
1001 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
1002 ((CLASS) == GENERAL_REGS && (MODE) == QImode ? Q_REGS : NO_REGS)
1004 /* Return the maximum number of consecutive registers
1005 needed to represent mode MODE in a register of class CLASS. */
1006 /* On the 80386, this is the size of MODE in words,
1007 except in the FP regs, where a single reg is always enough. */
1008 #define CLASS_MAX_NREGS(CLASS, MODE) \
1009 (FLOAT_CLASS_P (CLASS) ? 1 : \
1010 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1012 /* A C expression whose value is nonzero if pseudos that have been
1013 assigned to registers of class CLASS would likely be spilled
1014 because registers of CLASS are needed for spill registers.
1016 The default value of this macro returns 1 if CLASS has exactly one
1017 register and zero otherwise. On most machines, this default
1018 should be used. Only define this macro to some other expression
1019 if pseudo allocated by `local-alloc.c' end up in memory because
1020 their hard registers were needed for spill registers. If this
1021 macro returns nonzero for those classes, those pseudos will only
1022 be allocated by `global.c', which knows how to reallocate the
1023 pseudo to another register. If there would not be another
1024 register available for reallocation, you should not change the
1025 definition of this macro since the only effect of such a
1026 definition would be to slow down register allocation. */
1028 #define CLASS_LIKELY_SPILLED_P(CLASS) \
1029 (((CLASS) == AREG) \
1030 || ((CLASS) == DREG) \
1031 || ((CLASS) == CREG) \
1032 || ((CLASS) == BREG) \
1033 || ((CLASS) == AD_REGS) \
1034 || ((CLASS) == SIREG) \
1035 || ((CLASS) == DIREG))
1037 /* A C statement that adds to CLOBBERS any hard regs the port wishes
1038 to automatically clobber for all asms.
1040 We do this in the new i386 backend to maintain source compatibility
1041 with the old cc0-based compiler. */
1043 #define MD_ASM_CLOBBERS(CLOBBERS) \
1044 do { \
1045 (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"), (CLOBBERS));\
1046 (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"), (CLOBBERS)); \
1047 } while (0)
1049 /* Stack layout; function entry, exit and calling. */
1051 /* Define this if pushing a word on the stack
1052 makes the stack pointer a smaller address. */
1053 #define STACK_GROWS_DOWNWARD
1055 /* Define this if the nominal address of the stack frame
1056 is at the high-address end of the local variables;
1057 that is, each additional local variable allocated
1058 goes at a more negative offset in the frame. */
1059 #define FRAME_GROWS_DOWNWARD
1061 /* Offset within stack frame to start allocating local variables at.
1062 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1063 first local allocated. Otherwise, it is the offset to the BEGINNING
1064 of the first local allocated. */
1065 #define STARTING_FRAME_OFFSET 0
1067 /* If we generate an insn to push BYTES bytes,
1068 this says how many the stack pointer really advances by.
1069 On 386 pushw decrements by exactly 2 no matter what the position was.
1070 On the 386 there is no pushb; we use pushw instead, and this
1071 has the effect of rounding up to 2. */
1073 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
1075 /* Offset of first parameter from the argument pointer register value. */
1076 #define FIRST_PARM_OFFSET(FNDECL) 0
1078 /* Value is the number of bytes of arguments automatically
1079 popped when returning from a subroutine call.
1080 FUNDECL is the declaration node of the function (as a tree),
1081 FUNTYPE is the data type of the function (as a tree),
1082 or for a library call it is an identifier node for the subroutine name.
1083 SIZE is the number of bytes of arguments passed on the stack.
1085 On the 80386, the RTD insn may be used to pop them if the number
1086 of args is fixed, but if the number is variable then the caller
1087 must pop them all. RTD can't be used for library calls now
1088 because the library is compiled with the Unix compiler.
1089 Use of RTD is a selectable option, since it is incompatible with
1090 standard Unix calling sequences. If the option is not selected,
1091 the caller must always pop the args.
1093 The attribute stdcall is equivalent to RTD on a per module basis. */
1095 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
1096 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE))
1098 /* Define how to find the value returned by a function.
1099 VALTYPE is the data type of the value (as a tree).
1100 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1101 otherwise, FUNC is 0. */
1102 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1103 gen_rtx_REG (TYPE_MODE (VALTYPE), \
1104 VALUE_REGNO (TYPE_MODE (VALTYPE)))
1106 /* Define how to find the value returned by a library function
1107 assuming the value has mode MODE. */
1109 #define LIBCALL_VALUE(MODE) \
1110 gen_rtx_REG (MODE, VALUE_REGNO (MODE))
1112 /* Define the size of the result block used for communication between
1113 untyped_call and untyped_return. The block contains a DImode value
1114 followed by the block used by fnsave and frstor. */
1116 #define APPLY_RESULT_SIZE (8+108)
1118 /* 1 if N is a possible register number for function argument passing. */
1119 #define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)
1121 /* Define a data type for recording info about an argument list
1122 during the scan of that argument list. This data type should
1123 hold all necessary information about the function itself
1124 and about the args processed so far, enough to enable macros
1125 such as FUNCTION_ARG to determine where the next arg should go. */
1127 typedef struct ix86_args {
1128 int words; /* # words passed so far */
1129 int nregs; /* # registers available for passing */
1130 int regno; /* next available register number */
1131 } CUMULATIVE_ARGS;
1133 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1134 for a call to a function whose data type is FNTYPE.
1135 For a library call, FNTYPE is 0. */
1137 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
1138 (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
1140 /* Update the data in CUM to advance over an argument
1141 of mode MODE and data type TYPE.
1142 (TYPE is null for libcalls where that information may not be available.) */
1144 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1145 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
1147 /* Define where to put the arguments to a function.
1148 Value is zero to push the argument on the stack,
1149 or a hard register in which to store the argument.
1151 MODE is the argument's machine mode.
1152 TYPE is the data type of the argument (as a tree).
1153 This is null for libcalls where that information may
1154 not be available.
1155 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1156 the preceding args and about the function being called.
1157 NAMED is nonzero if this argument is a named parameter
1158 (otherwise it is an extra parameter matching an ellipsis). */
1160 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1161 (function_arg (&CUM, MODE, TYPE, NAMED))
1163 /* For an arg passed partly in registers and partly in memory,
1164 this is the number of registers used.
1165 For args passed entirely in registers or entirely in memory, zero. */
1167 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
1169 /* This macro is invoked just before the start of a function.
1170 It is used here to output code for -fpic that will load the
1171 return address into %ebx. */
1173 #undef ASM_OUTPUT_FUNCTION_PREFIX
1174 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
1175 asm_output_function_prefix (FILE, FNNAME)
1177 /* Output assembler code to FILE to increment profiler label # LABELNO
1178 for profiling a function entry. */
1180 #define FUNCTION_PROFILER(FILE, LABELNO) \
1182 if (flag_pic) \
1184 fprintf (FILE, "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n", \
1185 LPREFIX, (LABELNO)); \
1186 fprintf (FILE, "\tcall\t*_mcount@GOT(%%ebx)\n"); \
1188 else \
1190 fprintf (FILE, "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
1191 fprintf (FILE, "\tcall\t_mcount\n"); \
1196 /* There are three profiling modes for basic blocks available.
1197 The modes are selected at compile time by using the options
1198 -a or -ax of the gnu compiler.
1199 The variable `profile_block_flag' will be set according to the
1200 selected option.
1202 profile_block_flag == 0, no option used:
1204 No profiling done.
1206 profile_block_flag == 1, -a option used.
1208 Count frequency of execution of every basic block.
1210 profile_block_flag == 2, -ax option used.
1212 Generate code to allow several different profiling modes at run time.
1213 Available modes are:
1214 Produce a trace of all basic blocks.
1215 Count frequency of jump instructions executed.
1216 In every mode it is possible to start profiling upon entering
1217 certain functions and to disable profiling of some other functions.
1219 The result of basic-block profiling will be written to a file `bb.out'.
1220 If the -ax option is used parameters for the profiling will be read
1221 from file `bb.in'.
1225 /* The following macro shall output assembler code to FILE
1226 to initialize basic-block profiling. */
1228 #undef FUNCTION_BLOCK_PROFILER
1229 #define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1230 ix86_output_function_block_profiler (FILE, BLOCK_OR_LABEL)
1232 /* The following macro shall output assembler code to FILE
1233 to increment a counter associated with basic block number BLOCKNO. */
1235 #define BLOCK_PROFILER(FILE, BLOCKNO) \
1236 ix86_output_block_profiler (FILE, BLOCKNO)
1238 /* The following macro shall output rtl for the epilogue
1239 to indicate a return from function during basic-block profiling.
1241 If profiling_block_flag == 2:
1243 Output assembler code to call function `__bb_trace_ret'.
1245 Note that function `__bb_trace_ret' must not change the
1246 machine state, especially the flag register. To grant
1247 this, you must output code to save and restore registers
1248 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1249 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1250 used in the function `__bb_trace_ret', so you must make
1251 sure that the function prologue does not change any
1252 register prior to saving it with MACHINE_STATE_SAVE_RET.
1254 else if profiling_block_flag != 0:
1256 The macro will not be used, so it need not distinguish
1257 these cases.
1260 #define FUNCTION_BLOCK_PROFILER_EXIT \
1261 emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \
1262 gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \
1263 const0_rtx))
1265 /* The function `__bb_trace_func' is called in every basic block
1266 and is not allowed to change the machine state. Saving (restoring)
1267 the state can either be done in the BLOCK_PROFILER macro,
1268 before calling function (rsp. after returning from function)
1269 `__bb_trace_func', or it can be done inside the function by
1270 defining the macros:
1272 MACHINE_STATE_SAVE(ID)
1273 MACHINE_STATE_RESTORE(ID)
1275 In the latter case care must be taken, that the prologue code
1276 of function `__bb_trace_func' does not already change the
1277 state prior to saving it with MACHINE_STATE_SAVE.
1279 The parameter `ID' is a string identifying a unique macro use.
1281 On the i386 the initialization code at the begin of
1282 function `__bb_trace_func' contains a `sub' instruction
1283 therefore we handle save and restore of the flag register
1284 in the BLOCK_PROFILER macro. */
1286 #define MACHINE_STATE_SAVE(ID) \
1287 do { \
1288 register int eax_ __asm__("eax"); \
1289 register int ecx_ __asm__("ecx"); \
1290 register int edx_ __asm__("edx"); \
1291 register int esi_ __asm__("esi"); \
1292 __asm__ __volatile__ ( \
1293 "push{l} %0\n\t" \
1294 "push{l} %1\n\t" \
1295 "push{l} %2\n\t" \
1296 "push{l} %3" \
1297 : : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
1298 } while (0);
1300 #define MACHINE_STATE_RESTORE(ID) \
1301 do { \
1302 register int eax_ __asm__("eax"); \
1303 register int ecx_ __asm__("ecx"); \
1304 register int edx_ __asm__("edx"); \
1305 register int esi_ __asm__("esi"); \
1306 __asm__ __volatile__ ( \
1307 "pop{l} %3\n\t" \
1308 "pop{l} %2\n\t" \
1309 "pop{l} %1\n\t" \
1310 "pop{l} %0" \
1311 : "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
1312 } while (0);
1314 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1315 the stack pointer does not matter. The value is tested only in
1316 functions that have frame pointers.
1317 No definition is equivalent to always zero. */
1318 /* Note on the 386 it might be more efficient not to define this since
1319 we have to restore it ourselves from the frame pointer, in order to
1320 use pop */
1322 #define EXIT_IGNORE_STACK 1
1324 /* Output assembler code for a block containing the constant parts
1325 of a trampoline, leaving space for the variable parts. */
1327 /* On the 386, the trampoline contains two instructions:
1328 mov #STATIC,ecx
1329 jmp FUNCTION
1330 The trampoline is generated entirely at runtime. The operand of JMP
1331 is the address of FUNCTION relative to the instruction following the
1332 JMP (which is 5 bytes long). */
1334 /* Length in units of the trampoline for entering a nested function. */
1336 #define TRAMPOLINE_SIZE 10
1338 /* Emit RTL insns to initialize the variable parts of a trampoline.
1339 FNADDR is an RTX for the address of the function's pure code.
1340 CXT is an RTX for the static chain value for the function. */
1342 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1344 /* Compute offset from the end of the jmp to the target function. */ \
1345 rtx disp = expand_binop (SImode, sub_optab, FNADDR, \
1346 plus_constant (TRAMP, 10), \
1347 NULL_RTX, 1, OPTAB_DIRECT); \
1348 emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9)); \
1349 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
1350 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\
1351 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \
1354 /* Definitions for register eliminations.
1356 This is an array of structures. Each structure initializes one pair
1357 of eliminable registers. The "from" register number is given first,
1358 followed by "to". Eliminations of the same "from" register are listed
1359 in order of preference.
1361 We have two registers that can be eliminated on the i386. First, the
1362 frame pointer register can often be eliminated in favor of the stack
1363 pointer register. Secondly, the argument pointer register can always be
1364 eliminated; it is replaced with either the stack or frame pointer. */
1366 #define ELIMINABLE_REGS \
1367 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1368 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1369 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1371 /* Given FROM and TO register numbers, say whether this elimination is allowed.
1372 Frame pointer elimination is automatically handled.
1374 For the i386, if frame pointer elimination is being done, we would like to
1375 convert ap into sp, not fp.
1377 All other eliminations are valid. */
1379 #define CAN_ELIMINATE(FROM, TO) \
1380 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1381 ? ! frame_pointer_needed \
1382 : 1)
1384 /* Define the offset between two registers, one to be eliminated, and the other
1385 its replacement, at the start of a routine. */
1387 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1389 if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1390 (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \
1391 else \
1393 int nregs; \
1394 int offset; \
1395 int preferred_alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; \
1396 HOST_WIDE_INT tsize = ix86_compute_frame_size (get_frame_size (), \
1397 &nregs); \
1399 (OFFSET) = (tsize + nregs * UNITS_PER_WORD); \
1401 offset = 4; \
1402 if (frame_pointer_needed) \
1403 offset += UNITS_PER_WORD; \
1405 if ((FROM) == ARG_POINTER_REGNUM) \
1406 (OFFSET) += offset; \
1407 else \
1408 (OFFSET) -= ((offset + preferred_alignment - 1) \
1409 & -preferred_alignment) - offset; \
1413 /* Addressing modes, and classification of registers for them. */
1415 /* #define HAVE_POST_INCREMENT 0 */
1416 /* #define HAVE_POST_DECREMENT 0 */
1418 /* #define HAVE_PRE_DECREMENT 0 */
1419 /* #define HAVE_PRE_INCREMENT 0 */
1421 /* Macros to check register numbers against specific register classes. */
1423 /* These assume that REGNO is a hard or pseudo reg number.
1424 They give nonzero only if REGNO is a hard reg of the suitable class
1425 or a pseudo reg currently allocated to a suitable hard reg.
1426 Since they use reg_renumber, they are safe only once reg_renumber
1427 has been allocated, which happens in local-alloc.c. */
1429 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1430 ((REGNO) < STACK_POINTER_REGNUM \
1431 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1433 #define REGNO_OK_FOR_BASE_P(REGNO) \
1434 ((REGNO) <= STACK_POINTER_REGNUM \
1435 || (REGNO) == ARG_POINTER_REGNUM \
1436 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1438 #define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1439 #define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1441 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1442 and check its validity for a certain class.
1443 We have two alternate definitions for each of them.
1444 The usual definition accepts all pseudo regs; the other rejects
1445 them unless they have been allocated suitable hard regs.
1446 The symbol REG_OK_STRICT causes the latter definition to be used.
1448 Most source files want to accept pseudo regs in the hope that
1449 they will get allocated to the class that the insn wants them to be in.
1450 Source files for reload pass need to be strict.
1451 After reload, it makes no difference, since pseudo regs have
1452 been eliminated by then. */
1455 /* Non strict versions, pseudos are ok */
1456 #define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1457 (REGNO (X) < STACK_POINTER_REGNUM \
1458 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1460 #define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1461 (REGNO (X) <= STACK_POINTER_REGNUM \
1462 || REGNO (X) == ARG_POINTER_REGNUM \
1463 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1465 #define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
1466 (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1468 /* Strict versions, hard registers only */
1469 #define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1470 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1471 #define REG_OK_FOR_STRREG_STRICT_P(X) \
1472 (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
1474 #ifndef REG_OK_STRICT
1475 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1476 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
1477 #define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
1479 #else
1480 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1481 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
1482 #define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
1483 #endif
1485 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1486 that is a valid memory address for an instruction.
1487 The MODE argument is the machine mode for the MEM expression
1488 that wants to use this address.
1490 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1491 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1493 See legitimize_pic_address in i386.c for details as to what
1494 constitutes a legitimate address when -fpic is used. */
1496 #define MAX_REGS_PER_ADDRESS 2
1498 #define CONSTANT_ADDRESS_P(X) \
1499 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1500 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
1502 /* Nonzero if the constant value X is a legitimate general operand.
1503 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1505 #define LEGITIMATE_CONSTANT_P(X) \
1506 (GET_CODE (X) == CONST_DOUBLE ? standard_80387_constant_p (X) : 1)
1508 #ifdef REG_OK_STRICT
1509 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1511 if (legitimate_address_p (MODE, X, 1)) \
1512 goto ADDR; \
1515 #else
1516 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1518 if (legitimate_address_p (MODE, X, 0)) \
1519 goto ADDR; \
1522 #endif
1524 /* Try machine-dependent ways of modifying an illegitimate address
1525 to be legitimate. If we find one, return the new, valid address.
1526 This macro is used in only one place: `memory_address' in explow.c.
1528 OLDX is the address as it was before break_out_memory_refs was called.
1529 In some cases it is useful to look at this to decide what needs to be done.
1531 MODE and WIN are passed so that this macro can use
1532 GO_IF_LEGITIMATE_ADDRESS.
1534 It is always safe for this macro to do nothing. It exists to recognize
1535 opportunities to optimize the output.
1537 For the 80386, we handle X+REG by loading X into a register R and
1538 using R+REG. R will go in a general reg and indexing will be used.
1539 However, if REG is a broken-out memory address or multiplication,
1540 nothing needs to be done because REG can certainly go in a general reg.
1542 When -fpic is used, special handling is needed for symbolic references.
1543 See comments by legitimize_pic_address in i386.c for details. */
1545 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1547 (X) = legitimize_address (X, OLDX, MODE); \
1548 if (memory_address_p (MODE, X)) \
1549 goto WIN; \
1552 #define REWRITE_ADDRESS(x) rewrite_address(x)
1554 /* Nonzero if the constant value X is a legitimate general operand
1555 when generating PIC code. It is given that flag_pic is on and
1556 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1558 #define LEGITIMATE_PIC_OPERAND_P(X) \
1559 (! SYMBOLIC_CONST (X) \
1560 || legitimate_pic_address_disp_p (X))
1562 #define SYMBOLIC_CONST(X) \
1563 (GET_CODE (X) == SYMBOL_REF \
1564 || GET_CODE (X) == LABEL_REF \
1565 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1567 /* Go to LABEL if ADDR (a legitimate address expression)
1568 has an effect that depends on the machine mode it is used for.
1569 On the 80386, only postdecrement and postincrement address depend thus
1570 (the amount of decrement or increment being the length of the operand). */
1571 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1572 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1574 /* Define this macro if references to a symbol must be treated
1575 differently depending on something about the variable or
1576 function named by the symbol (such as what section it is in).
1578 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
1579 so that we may access it directly in the GOT. */
1581 #define ENCODE_SECTION_INFO(DECL) \
1582 do \
1584 if (flag_pic) \
1586 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1587 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1589 if (GET_CODE (rtl) == MEM) \
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)); \
1605 while (0)
1607 /* The `FINALIZE_PIC' macro serves as a hook to emit these special
1608 codes once the function is being compiled into assembly code, but
1609 not before. (It is not done before, because in the case of
1610 compiling an inline function, it would lead to multiple PIC
1611 prologues being included in functions which used inline functions
1612 and were compiled to assembly language.) */
1614 #define FINALIZE_PIC \
1615 do \
1617 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
1619 while (0)
1622 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1623 with arguments ARGS is a valid machine specific attribute for DECL.
1624 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1626 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
1627 (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
1629 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1630 with arguments ARGS is a valid machine specific attribute for TYPE.
1631 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1633 #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
1634 (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
1636 /* If defined, a C expression whose value is zero if the attributes on
1637 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1638 two if they are nearly compatible (which causes a warning to be
1639 generated). */
1641 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1642 (ix86_comp_type_attributes (TYPE1, TYPE2))
1644 /* If defined, a C statement that assigns default attributes to newly
1645 defined TYPE. */
1647 /* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
1649 /* Max number of args passed in registers. If this is more than 3, we will
1650 have problems with ebx (register #4), since it is a caller save register and
1651 is also used as the pic register in ELF. So for now, don't allow more than
1652 3 registers to be passed in registers. */
1654 #define REGPARM_MAX 3
1657 /* Specify the machine mode that this machine uses
1658 for the index in the tablejump instruction. */
1659 #define CASE_VECTOR_MODE Pmode
1661 /* Define as C expression which evaluates to nonzero if the tablejump
1662 instruction expects the table to contain offsets from the address of the
1663 table.
1664 Do not define this if the table should contain absolute addresses. */
1665 /* #define CASE_VECTOR_PC_RELATIVE 1 */
1667 /* Specify the tree operation to be used to convert reals to integers.
1668 This should be changed to take advantage of fist --wfs ??
1670 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1672 /* This is the kind of divide that is easiest to do in the general case. */
1673 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1675 /* Define this as 1 if `char' should by default be signed; else as 0. */
1676 #define DEFAULT_SIGNED_CHAR 1
1678 /* Max number of bytes we can move from memory to memory
1679 in one reasonably fast instruction. */
1680 #define MOVE_MAX 4
1682 /* If a memory-to-memory move would take MOVE_RATIO or more simple
1683 move-instruction pairs, we will do a movstr or libcall instead.
1684 Increasing the value will always make code faster, but eventually
1685 incurs high cost in increased code size.
1687 If you don't define this, a reasonable default is used.
1689 Make this large on i386, since the block move is very inefficient with small
1690 blocks, and the hard register needs of the block move require much reload
1691 work. */
1693 #define MOVE_RATIO 5
1695 /* Define if shifts truncate the shift count
1696 which implies one can omit a sign-extension or zero-extension
1697 of a shift count. */
1698 /* On i386, shifts do truncate the count. But bit opcodes don't. */
1700 /* #define SHIFT_COUNT_TRUNCATED */
1702 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1703 is done just by pretending it is already truncated. */
1704 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1706 /* We assume that the store-condition-codes instructions store 0 for false
1707 and some other value for true. This is the value stored for true. */
1709 #define STORE_FLAG_VALUE 1
1711 /* When a prototype says `char' or `short', really pass an `int'.
1712 (The 386 can't easily push less than an int.) */
1714 #define PROMOTE_PROTOTYPES 1
1716 /* Specify the machine mode that pointers have.
1717 After generation of rtl, the compiler makes no further distinction
1718 between pointers and any other objects of this machine mode. */
1719 #define Pmode SImode
1721 /* A function address in a call instruction
1722 is a byte address (for indexing purposes)
1723 so give the MEM rtx a byte's mode. */
1724 #define FUNCTION_MODE QImode
1726 /* A part of a C `switch' statement that describes the relative costs
1727 of constant RTL expressions. It must contain `case' labels for
1728 expression codes `const_int', `const', `symbol_ref', `label_ref'
1729 and `const_double'. Each case must ultimately reach a `return'
1730 statement to return the relative cost of the use of that kind of
1731 constant value in an expression. The cost may depend on the
1732 precise value of the constant, which is available for examination
1733 in X, and the rtx code of the expression in which it is contained,
1734 found in OUTER_CODE.
1736 CODE is the expression code--redundant, since it can be obtained
1737 with `GET_CODE (X)'. */
1739 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1740 case CONST_INT: \
1741 return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \
1742 case CONST: \
1743 case LABEL_REF: \
1744 case SYMBOL_REF: \
1745 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
1747 case CONST_DOUBLE: \
1749 int code; \
1750 if (GET_MODE (RTX) == VOIDmode) \
1751 return 2; \
1753 code = standard_80387_constant_p (RTX); \
1754 return code == 1 ? 0 : \
1755 code == 2 ? 1 : \
1756 2; \
1759 /* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
1760 #define TOPLEVEL_COSTS_N_INSNS(N) \
1761 do { total = COSTS_N_INSNS (N); goto egress_rtx_costs; } while (0)
1763 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1764 This can be used, for example, to indicate how costly a multiply
1765 instruction is. In writing this macro, you can use the construct
1766 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1767 instructions. OUTER_CODE is the code of the expression in which X
1768 is contained.
1770 This macro is optional; do not define it if the default cost
1771 assumptions are adequate for the target machine. */
1773 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1774 case ASHIFT: \
1775 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1776 && GET_MODE (XEXP (X, 0)) == SImode) \
1778 HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1779 if (value == 1) \
1780 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1781 if (value == 2 || value == 3) \
1782 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
1784 /* fall through */ \
1786 case ROTATE: \
1787 case ASHIFTRT: \
1788 case LSHIFTRT: \
1789 case ROTATERT: \
1790 if (GET_MODE (XEXP (X, 0)) == DImode) \
1792 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1794 if (INTVAL (XEXP (X, 1)) > 32) \
1795 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const + 2); \
1796 else \
1797 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const * 2); \
1799 else \
1801 if (GET_CODE (XEXP (X, 1)) == AND) \
1802 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 2); \
1803 else \
1804 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2); \
1807 else \
1809 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1810 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1811 else \
1812 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_var); \
1814 break; \
1816 case MULT: \
1817 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1819 unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1820 int nbits = 0; \
1822 if (value == 2) \
1823 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1824 if (value == 4 || value == 8) \
1825 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
1827 while (value != 0) \
1829 nbits++; \
1830 value >>= 1; \
1833 if (nbits == 1) \
1834 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1835 else \
1836 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1837 + nbits * ix86_cost->mult_bit); \
1839 else /* This is arbitrary */ \
1840 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1841 + 7 * ix86_cost->mult_bit); \
1843 case DIV: \
1844 case UDIV: \
1845 case MOD: \
1846 case UMOD: \
1847 TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
1849 case PLUS: \
1850 if (GET_CODE (XEXP (X, 0)) == PLUS \
1851 && GET_CODE (XEXP (XEXP (X, 0), 0)) == MULT \
1852 && GET_CODE (XEXP (XEXP (XEXP (X, 0), 0), 1)) == CONST_INT \
1853 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1855 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 0), 0), 1)); \
1856 if (val == 2 || val == 4 || val == 8) \
1858 return (COSTS_N_INSNS (ix86_cost->lea) \
1859 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1860 + rtx_cost (XEXP (XEXP (XEXP (X, 0), 0), 0), OUTER_CODE) \
1861 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1864 else if (GET_CODE (XEXP (X, 0)) == MULT \
1865 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \
1867 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \
1868 if (val == 2 || val == 4 || val == 8) \
1870 return (COSTS_N_INSNS (ix86_cost->lea) \
1871 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1872 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1875 else if (GET_CODE (XEXP (X, 0)) == PLUS) \
1877 return (COSTS_N_INSNS (ix86_cost->lea) \
1878 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1879 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1880 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1883 /* fall through */ \
1884 case AND: \
1885 case IOR: \
1886 case XOR: \
1887 case MINUS: \
1888 if (GET_MODE (X) == DImode) \
1889 return (COSTS_N_INSNS (ix86_cost->add) * 2 \
1890 + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
1891 << (GET_MODE (XEXP (X, 0)) != DImode)) \
1892 + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
1893 << (GET_MODE (XEXP (X, 1)) != DImode))); \
1895 /* fall through */ \
1896 case NEG: \
1897 case NOT: \
1898 if (GET_MODE (X) == DImode) \
1899 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2); \
1900 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1902 egress_rtx_costs: \
1903 break;
1906 /* An expression giving the cost of an addressing mode that contains
1907 ADDRESS. If not defined, the cost is computed from the ADDRESS
1908 expression and the `CONST_COSTS' values.
1910 For most CISC machines, the default cost is a good approximation
1911 of the true cost of the addressing mode. However, on RISC
1912 machines, all instructions normally have the same length and
1913 execution time. Hence all addresses will have equal costs.
1915 In cases where more than one form of an address is known, the form
1916 with the lowest cost will be used. If multiple forms have the
1917 same, lowest, cost, the one that is the most complex will be used.
1919 For example, suppose an address that is equal to the sum of a
1920 register and a constant is used twice in the same basic block.
1921 When this macro is not defined, the address will be computed in a
1922 register and memory references will be indirect through that
1923 register. On machines where the cost of the addressing mode
1924 containing the sum is no higher than that of a simple indirect
1925 reference, this will produce an additional instruction and
1926 possibly require an additional register. Proper specification of
1927 this macro eliminates this overhead for such machines.
1929 Similar use of this macro is made in strength reduction of loops.
1931 ADDRESS need not be valid as an address. In such a case, the cost
1932 is not relevant and can be any value; invalid addresses need not be
1933 assigned a different cost.
1935 On machines where an address involving more than one register is as
1936 cheap as an address computation involving only one register,
1937 defining `ADDRESS_COST' to reflect this can cause two registers to
1938 be live over a region of code where only one would have been if
1939 `ADDRESS_COST' were not defined in that manner. This effect should
1940 be considered in the definition of this macro. Equivalent costs
1941 should probably only be given to addresses with different numbers
1942 of registers on machines with lots of registers.
1944 This macro will normally either not be defined or be defined as a
1945 constant.
1947 For i386, it is better to use a complex address than let gcc copy
1948 the address into a reg and make a new pseudo. But not if the address
1949 requires to two regs - that would mean more pseudos with longer
1950 lifetimes. */
1952 #define ADDRESS_COST(RTX) \
1953 ((CONSTANT_P (RTX) \
1954 || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
1955 && REG_P (XEXP (RTX, 0)))) ? 0 \
1956 : REG_P (RTX) ? 1 \
1957 : 2)
1959 /* A C expression for the cost of moving data of mode M between a
1960 register and memory. A value of 2 is the default; this cost is
1961 relative to those in `REGISTER_MOVE_COST'.
1963 If moving between registers and memory is more expensive than
1964 between two registers, you should define this macro to express the
1965 relative cost.
1967 On the i386, copying between floating-point and fixed-point
1968 registers is expensive. */
1970 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1971 (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
1972 || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \
1973 : 2)
1976 /* A C expression for the cost of moving data of mode M between a
1977 register and memory. A value of 2 is the default; this cost is
1978 relative to those in `REGISTER_MOVE_COST'.
1980 If moving between registers and memory is more expensive than
1981 between two registers, you should define this macro to express the
1982 relative cost. */
1984 /* #define MEMORY_MOVE_COST(M,C,I) 2 */
1986 /* A C expression for the cost of a branch instruction. A value of 1
1987 is the default; other values are interpreted relative to that. */
1989 #define BRANCH_COST ix86_branch_cost
1991 /* Define this macro as a C expression which is nonzero if accessing
1992 less than a word of memory (i.e. a `char' or a `short') is no
1993 faster than accessing a word of memory, i.e., if such access
1994 require more than one instruction or if there is no difference in
1995 cost between byte and (aligned) word loads.
1997 When this macro is not defined, the compiler will access a field by
1998 finding the smallest containing object; when it is defined, a
1999 fullword load will be used if alignment permits. Unless bytes
2000 accesses are faster than word accesses, using word accesses is
2001 preferable since it may eliminate subsequent memory access if
2002 subsequent accesses occur to other fields in the same word of the
2003 structure, but to different bytes. */
2005 #define SLOW_BYTE_ACCESS 0
2007 /* Nonzero if access to memory by shorts is slow and undesirable. */
2008 #define SLOW_SHORT_ACCESS 0
2010 /* Define this macro if zero-extension (of a `char' or `short' to an
2011 `int') can be done faster if the destination is a register that is
2012 known to be zero.
2014 If you define this macro, you must have instruction patterns that
2015 recognize RTL structures like this:
2017 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2019 and likewise for `HImode'. */
2021 /* #define SLOW_ZERO_EXTEND */
2023 /* Define this macro to be the value 1 if unaligned accesses have a
2024 cost many times greater than aligned accesses, for example if they
2025 are emulated in a trap handler.
2027 When this macro is non-zero, the compiler will act as if
2028 `STRICT_ALIGNMENT' were non-zero when generating code for block
2029 moves. This can cause significantly more instructions to be
2030 produced. Therefore, do not set this macro non-zero if unaligned
2031 accesses only add a cycle or two to the time for a memory access.
2033 If the value of this macro is always zero, it need not be defined. */
2035 /* #define SLOW_UNALIGNED_ACCESS 0 */
2037 /* Define this macro to inhibit strength reduction of memory
2038 addresses. (On some machines, such strength reduction seems to do
2039 harm rather than good.) */
2041 /* #define DONT_REDUCE_ADDR */
2043 /* Define this macro if it is as good or better to call a constant
2044 function address than to call an address kept in a register.
2046 Desirable on the 386 because a CALL with a constant address is
2047 faster than one with a register address. */
2049 #define NO_FUNCTION_CSE
2051 /* Define this macro if it is as good or better for a function to call
2052 itself with an explicit address than to call an address kept in a
2053 register. */
2055 #define NO_RECURSIVE_FUNCTION_CSE
2057 /* A C statement (sans semicolon) to update the integer variable COST
2058 based on the relationship between INSN that is dependent on
2059 DEP_INSN through the dependence LINK. The default is to make no
2060 adjustment to COST. This can be used for example to specify to
2061 the scheduler that an output- or anti-dependence does not incur
2062 the same cost as a data-dependence. */
2064 #define ADJUST_COST(insn,link,dep_insn,cost) \
2065 (cost) = ix86_adjust_cost(insn, link, dep_insn, cost)
2067 #define ISSUE_RATE \
2068 ix86_issue_rate ()
2070 #define MD_SCHED_INIT(DUMP, SCHED_VERBOSE) \
2071 ix86_sched_init (DUMP, SCHED_VERBOSE)
2073 #define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK, CIM) \
2074 (CIM) = ix86_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK)
2076 #define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \
2077 ((CAN_ISSUE_MORE) = \
2078 ix86_variable_issue (DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE))
2080 /* Add any extra modes needed to represent the condition code.
2082 For the i386, we need separate modes when floating-point
2083 equality comparisons are being done.
2085 Add CCNO to indicate No Overflow, which is often also includes
2086 No Carry. This is typically used on the output of logicals,
2087 and is only valid in comparisons against zero. */
2089 #define EXTRA_CC_MODES \
2090 CC(CCNOmode, "CCNO") \
2091 CC(CCFPmode, "CCFP") \
2092 CC(CCFPUmode, "CCFPU")
2094 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2095 return the mode to be used for the comparison.
2097 For floating-point equality comparisons, CCFPEQmode should be used.
2098 VOIDmode should be used in all other cases.
2100 For integer comparisons against zero, reduce to CCNOmode if
2101 possible, to allow for more combinations. */
2103 #define SELECT_CC_MODE(OP,X,Y) \
2104 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2105 ? (OP) == EQ || (OP) == NE ? CCFPUmode : CCFPmode \
2106 : (OP) == LE || (OP) == GT ? CCmode \
2107 : (Y) != const0_rtx ? CCmode \
2108 : CCNOmode)
2110 /* Control the assembler format that we output, to the extent
2111 this does not vary between assemblers. */
2113 /* How to refer to registers in assembler output.
2114 This sequence is indexed by compiler's hard-register-number (see above). */
2116 /* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
2117 For non floating point regs, the following are the HImode names.
2119 For float regs, the stack top is sometimes referred to as "%st(0)"
2120 instead of just "%st". PRINT_REG handles this with the "y" code. */
2122 #define HI_REGISTER_NAMES \
2123 {"ax","dx","cx","bx","si","di","bp","sp", \
2124 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
2125 "flags","fpsr" }
2127 #define REGISTER_NAMES HI_REGISTER_NAMES
2129 /* Table of additional register names to use in user input. */
2131 #define ADDITIONAL_REGISTER_NAMES \
2132 { { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \
2133 { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \
2134 { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \
2135 { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }
2137 /* Note we are omitting these since currently I don't know how
2138 to get gcc to use these, since they want the same but different
2139 number as al, and ax.
2142 /* note the last four are not really qi_registers, but
2143 the md will have to never output movb into one of them
2144 only a movw . There is no movb into the last four regs */
2146 #define QI_REGISTER_NAMES \
2147 {"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
2149 /* These parallel the array above, and can be used to access bits 8:15
2150 of regs 0 through 3. */
2152 #define QI_HIGH_REGISTER_NAMES \
2153 {"ah", "dh", "ch", "bh", }
2155 /* How to renumber registers for dbx and gdb. */
2157 /* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
2158 #define DBX_REGISTER_NUMBER(n) \
2159 ((n) == 0 ? 0 : \
2160 (n) == 1 ? 2 : \
2161 (n) == 2 ? 1 : \
2162 (n) == 3 ? 3 : \
2163 (n) == 4 ? 6 : \
2164 (n) == 5 ? 7 : \
2165 (n) == 6 ? 4 : \
2166 (n) == 7 ? 5 : \
2167 (n) + 4)
2169 /* Before the prologue, RA is at 0(%esp). */
2170 #define INCOMING_RETURN_ADDR_RTX \
2171 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
2173 /* After the prologue, RA is at -4(AP) in the current frame. */
2174 #define RETURN_ADDR_RTX(COUNT, FRAME) \
2175 ((COUNT) == 0 \
2176 ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -4))\
2177 : gen_rtx_MEM (Pmode, plus_constant (FRAME, 4)))
2179 /* PC is dbx register 8; let's use that column for RA. */
2180 #define DWARF_FRAME_RETURN_COLUMN 8
2182 /* Before the prologue, the top of the frame is at 4(%esp). */
2183 #define INCOMING_FRAME_SP_OFFSET 4
2185 /* This is how to output the definition of a user-level label named NAME,
2186 such as the label on a static function or variable NAME. */
2188 #define ASM_OUTPUT_LABEL(FILE,NAME) \
2189 (assemble_name (FILE, NAME), fputs (":\n", FILE))
2191 /* This is how to output an assembler line defining a `double' constant. */
2193 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2194 do { long l[2]; \
2195 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
2196 fprintf (FILE, "%s\t0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
2197 } while (0)
2199 /* This is how to output a `long double' extended real constant. */
2201 #undef ASM_OUTPUT_LONG_DOUBLE
2202 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2203 do { long l[3]; \
2204 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
2205 fprintf (FILE, "%s\t0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
2206 } while (0)
2208 /* This is how to output an assembler line defining a `float' constant. */
2210 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2211 do { long l; \
2212 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
2213 fprintf ((FILE), "%s\t0x%lx\n", ASM_LONG, l); \
2214 } while (0)
2216 /* Store in OUTPUT a string (made with alloca) containing
2217 an assembler-name for a local static variable named NAME.
2218 LABELNO is an integer which is different for each call. */
2220 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2221 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2222 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2224 /* This is how to output an assembler line defining an `int' constant. */
2226 #define ASM_OUTPUT_INT(FILE,VALUE) \
2227 ( fprintf (FILE, "%s\t", ASM_LONG), \
2228 output_addr_const (FILE,(VALUE)), \
2229 putc('\n',FILE))
2231 /* Likewise for `char' and `short' constants. */
2232 /* is this supposed to do align too?? */
2234 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2235 ( fprintf (FILE, "%s\t", ASM_SHORT), \
2236 output_addr_const (FILE,(VALUE)), \
2237 putc('\n',FILE))
2239 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2240 ( fprintf (FILE, "%s\t", ASM_BYTE_OP), \
2241 output_addr_const (FILE, (VALUE)), \
2242 putc ('\n', FILE))
2244 /* This is how to output an assembler line for a numeric constant byte. */
2246 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2247 asm_fprintf ((FILE), "%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
2249 /* This is how to output an insn to push a register on the stack.
2250 It need not be very fast code. */
2252 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
2253 asm_fprintf (FILE, "\tpush{l}\t%%e%s\n", reg_names[REGNO])
2255 /* This is how to output an insn to pop a register from the stack.
2256 It need not be very fast code. */
2258 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
2259 asm_fprintf (FILE, "\tpop{l}\t%%e%s\n", reg_names[REGNO])
2261 /* This is how to output an element of a case-vector that is absolute.
2264 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2265 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
2267 /* This is how to output an element of a case-vector that is relative.
2268 We don't use these on the 386 yet, because the ATT assembler can't do
2269 forward reference the differences.
2272 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
2273 fprintf (FILE, "\t%s\t%s%d-%s%d\n",ASM_LONG, LPREFIX, VALUE, LPREFIX, REL)
2275 /* Define the parentheses used to group arithmetic operations
2276 in assembler code. */
2278 #define ASM_OPEN_PAREN ""
2279 #define ASM_CLOSE_PAREN ""
2281 /* Define results of standard character escape sequences. */
2282 #define TARGET_BELL 007
2283 #define TARGET_BS 010
2284 #define TARGET_TAB 011
2285 #define TARGET_NEWLINE 012
2286 #define TARGET_VT 013
2287 #define TARGET_FF 014
2288 #define TARGET_CR 015
2290 /* Print operand X (an rtx) in assembler syntax to file FILE.
2291 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2292 The CODE z takes the size of operand from the following digit, and
2293 outputs b,w,or l respectively.
2295 On the 80386, we use several such letters:
2296 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
2297 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
2298 R -- print the prefix for register names.
2299 z -- print the opcode suffix for the size of the current operand.
2300 * -- print a star (in certain assembler syntax)
2301 P -- if PIC, print an @PLT suffix.
2302 X -- don't print any sort of PIC '@' suffix for a symbol.
2303 s -- ??? something to do with double shifts. not actually used, afaik.
2304 C -- print a conditional move suffix corresponding to the op code.
2305 c -- likewise, but reverse the condition.
2306 F,f -- likewise, but for floating-point. */
2308 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2309 ((CODE) == '*')
2311 /* Print the name of a register based on its machine mode and number.
2312 If CODE is 'w', pretend the mode is HImode.
2313 If CODE is 'b', pretend the mode is QImode.
2314 If CODE is 'k', pretend the mode is SImode.
2315 If CODE is 'h', pretend the reg is the `high' byte register.
2316 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
2318 #define PRINT_REG(X, CODE, FILE) \
2319 print_reg (X, CODE, FILE)
2321 #define PRINT_OPERAND(FILE, X, CODE) \
2322 print_operand (FILE, X, CODE)
2324 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
2325 print_operand_address (FILE, ADDR)
2327 /* Print the name of a register for based on its machine mode and number.
2328 This macro is used to print debugging output.
2329 This macro is different from PRINT_REG in that it may be used in
2330 programs that are not linked with aux-output.o. */
2332 #define DEBUG_PRINT_REG(X, CODE, FILE) \
2333 do { static char *hi_name[] = HI_REGISTER_NAMES; \
2334 static char *qi_name[] = QI_REGISTER_NAMES; \
2335 fprintf (FILE, "%d ", REGNO (X)); \
2336 if (REGNO (X) == FLAGS_REG) \
2337 { fputs ("flags", FILE); break; } \
2338 if (REGNO (X) == FPSR_REG) \
2339 { fputs ("fpsr", FILE); break; } \
2340 if (REGNO (X) == ARG_POINTER_REGNUM) \
2341 { fputs ("argp", FILE); break; } \
2342 if (STACK_TOP_P (X)) \
2343 { fputs ("st(0)", FILE); break; } \
2344 if (FP_REG_P (X)) \
2345 { fputs (hi_name[REGNO(X)], FILE); break; } \
2346 switch (GET_MODE_SIZE (GET_MODE (X))) \
2348 default: \
2349 fputs ("e", FILE); \
2350 case 2: \
2351 fputs (hi_name[REGNO (X)], FILE); \
2352 break; \
2353 case 1: \
2354 fputs (qi_name[REGNO (X)], FILE); \
2355 break; \
2357 } while (0)
2359 /* Routines in libgcc that return floats must return them in an fp reg,
2360 just as other functions do which return such values.
2361 These macros make that happen. */
2363 #define FLOAT_VALUE_TYPE float
2364 #define INTIFY(FLOATVAL) FLOATVAL
2366 /* a letter which is not needed by the normal asm syntax, which
2367 we can use for operand syntax in the extended asm */
2369 #define ASM_OPERAND_LETTER '#'
2370 #define RET return ""
2371 #define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx))
2373 /* Define the codes that are matched by predicates in i386.c. */
2375 #define PREDICATE_CODES \
2376 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2377 {"pic_symbolic_operand", {CONST}}, \
2378 {"call_insn_operand", {MEM}}, \
2379 {"expander_call_insn_operand", {MEM}}, \
2380 {"constant_call_address_operand", {MEM}}, \
2381 {"const0_operand", {CONST_INT, CONST_DOUBLE}}, \
2382 {"const1_operand", {CONST_INT}}, \
2383 {"const248_operand", {CONST_INT}}, \
2384 {"incdec_operand", {CONST_INT}}, \
2385 {"reg_no_sp_operand", {SUBREG, REG}}, \
2386 {"q_regs_operand", {SUBREG, REG}}, \
2387 {"non_q_regs_operand", {SUBREG, REG}}, \
2388 {"no_comparison_operator", {EQ, NE, LT, GE, LTU, GTU, LEU, GEU}}, \
2389 {"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU}}, \
2390 {"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}}, \
2391 {"ext_register_operand", {SUBREG, REG}}, \
2392 {"binary_fp_operator", {PLUS, MINUS, MULT, DIV}}, \
2393 {"mult_operator", {MULT}}, \
2394 {"div_operator", {DIV}}, \
2395 {"arith_or_logical_operator", {PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, \
2396 UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
2397 UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
2398 LSHIFTRT, ROTATERT}}, \
2399 {"memory_displacement_operand", {MEM}}, \
2400 {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
2401 LABEL_REF, SUBREG, REG, MEM, AND}}, \
2402 {"long_memory_operand", {MEM}},
2404 /* A list of predicates that do special things with modes, and so
2405 should not elicit warnings for VOIDmode match_operand. */
2407 #define SPECIAL_MODE_PREDICATES \
2408 "ext_register_operand",
2410 /* Variables in i386.c */
2411 extern const char *ix86_cpu_string; /* for -mcpu=<xxx> */
2412 extern const char *ix86_arch_string; /* for -march=<xxx> */
2413 extern const char *ix86_reg_alloc_order; /* register allocation order */
2414 extern const char *ix86_regparm_string; /* # registers to use to pass args */
2415 extern const char *ix86_align_loops_string; /* power of two alignment for loops */
2416 extern const char *ix86_align_jumps_string; /* power of two alignment for non-loop jumps */
2417 extern const char *ix86_align_funcs_string; /* power of two alignment for functions */
2418 extern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
2419 extern const char *ix86_branch_cost_string; /* values 1-5: see jump.c */
2420 extern int ix86_regparm; /* ix86_regparm_string as a number */
2421 extern int ix86_align_loops; /* power of two alignment for loops */
2422 extern int ix86_align_jumps; /* power of two alignment for non-loop jumps */
2423 extern int ix86_align_funcs; /* power of two alignment for functions */
2424 extern int ix86_preferred_stack_boundary; /* preferred stack boundary alignment in bits */
2425 extern int ix86_branch_cost; /* values 1-5: see jump.c */
2426 extern const char * const hi_reg_name[]; /* names for 16 bit regs */
2427 extern const char * const qi_reg_name[]; /* names for 8 bit regs (low) */
2428 extern const char * const qi_high_reg_name[]; /* names for 8 bit regs (high) */
2429 extern enum reg_class const regclass_map[]; /* smalled class containing REGNO */
2430 extern struct rtx_def *ix86_compare_op0; /* operand 0 for comparisons */
2431 extern struct rtx_def *ix86_compare_op1; /* operand 1 for comparisons */
2434 Local variables:
2435 version-control: t
2436 End: