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)
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. */
40 /* Stubs for half-pic support if not OSF/1 reference platform. */
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)
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 */
65 int int_load[3]; /* cost of loading integer registers
66 in QImode, HImode and SImode relative
67 to reg-reg move (2). */
68 int int_store[3]; /* cost of storing integer register
69 in QImode, HImode and SImode */
70 int fp_move; /* cost of reg,reg fld/fst */
71 int fp_load[3]; /* cost of loading FP register
72 in SFmode, DFmode and XFmode */
73 int fp_store[3]; /* cost of storing FP register
74 in SFmode, DFmode and XFmode */
77 extern struct processor_costs *ix86_cost;
79 /* Run-time compilation parameters selecting different hardware subsets. */
81 extern int target_flags;
83 /* Macros used in the machine description to test the flags. */
85 /* configure can arrange to make this 2, to force a 486. */
87 #ifndef TARGET_CPU_DEFAULT
88 #define TARGET_CPU_DEFAULT 0
91 /* Masks for the -m switches */
92 #define MASK_80387 0x00000001 /* Hardware floating point */
93 #define MASK_RTD 0x00000002 /* Use ret that pops args */
94 #define MASK_ALIGN_DOUBLE 0x00000004 /* align doubles to 2 word boundary */
95 #define MASK_SVR3_SHLIB 0x00000008 /* Uninit locals into bss */
96 #define MASK_IEEE_FP 0x00000010 /* IEEE fp comparisons */
97 #define MASK_FLOAT_RETURNS 0x00000020 /* Return float in st(0) */
98 #define MASK_NO_FANCY_MATH_387 0x00000040 /* Disable sin, cos, sqrt */
99 #define MASK_OMIT_LEAF_FRAME_POINTER 0x080 /* omit leaf frame pointers */
100 #define MASK_STACK_PROBE 0x00000100 /* Enable stack probing */
102 /* Temporary codegen switches */
103 #define MASK_INTEL_SYNTAX 0x00000200
104 #define MASK_DEBUG_ARG 0x00000400 /* function_arg */
105 #define MASK_DEBUG_ADDR 0x00000800 /* GO_IF_LEGITIMATE_ADDRESS */
107 /* Use the floating point instructions */
108 #define TARGET_80387 (target_flags & MASK_80387)
110 /* Compile using ret insn that pops args.
111 This will not work unless you use prototypes at least
112 for all functions that can take varying numbers of args. */
113 #define TARGET_RTD (target_flags & MASK_RTD)
115 /* Align doubles to a two word boundary. This breaks compatibility with
116 the published ABI's for structures containing doubles, but produces
117 faster code on the pentium. */
118 #define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
120 /* Put uninitialized locals into bss, not data.
121 Meaningful only on svr3. */
122 #define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
124 /* Use IEEE floating point comparisons. These handle correctly the cases
125 where the result of a comparison is unordered. Normally SIGFPE is
126 generated in such cases, in which case this isn't needed. */
127 #define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
129 /* Functions that return a floating point value may return that value
130 in the 387 FPU or in 386 integer registers. If set, this flag causes
131 the 387 to be used, which is compatible with most calling conventions. */
132 #define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
134 /* Disable generation of FP sin, cos and sqrt operations for 387.
135 This is because FreeBSD lacks these in the math-emulator-code */
136 #define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
138 /* Don't create frame pointers for leaf functions */
139 #define TARGET_OMIT_LEAF_FRAME_POINTER \
140 (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
142 /* Debug GO_IF_LEGITIMATE_ADDRESS */
143 #define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
145 /* Debug FUNCTION_ARG macros */
146 #define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
148 #define TARGET_386 (ix86_cpu == PROCESSOR_I386)
149 #define TARGET_486 (ix86_cpu == PROCESSOR_I486)
150 #define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
151 #define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
152 #define TARGET_K6 (ix86_cpu == PROCESSOR_K6)
154 #define CPUMASK (1 << ix86_cpu)
155 extern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and;
156 extern const int x86_use_bit_test, x86_cmove, x86_deep_branch;
157 extern const int x86_unroll_strlen, x86_use_q_reg, x86_use_any_reg;
158 extern const int x86_double_with_add, x86_partial_reg_stall, x86_movx;
159 extern const int x86_use_loop, x86_use_fiop, x86_use_mov0;
160 extern const int x86_use_cltd, x86_read_modify_write;
161 extern const int x86_read_modify, x86_split_long_moves;
163 #define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
164 #define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK)
165 #define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & CPUMASK)
166 #define TARGET_USE_BIT_TEST (x86_use_bit_test & CPUMASK)
167 #define TARGET_UNROLL_STRLEN (x86_unroll_strlen & CPUMASK)
168 #define TARGET_USE_Q_REG (x86_use_q_reg & CPUMASK)
169 #define TARGET_USE_ANY_REG (x86_use_any_reg & CPUMASK)
170 #define TARGET_CMOVE (x86_cmove & (1 << ix86_arch))
171 #define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & CPUMASK)
172 #define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & CPUMASK)
173 #define TARGET_USE_SAHF (x86_use_sahf & CPUMASK)
174 #define TARGET_MOVX (x86_movx & CPUMASK)
175 #define TARGET_PARTIAL_REG_STALL (x86_partial_reg_stall & CPUMASK)
176 #define TARGET_USE_LOOP (x86_use_loop & CPUMASK)
177 #define TARGET_USE_FIOP (x86_use_fiop & CPUMASK)
178 #define TARGET_USE_MOV0 (x86_use_mov0 & CPUMASK)
179 #define TARGET_USE_CLTD (x86_use_cltd & CPUMASK)
180 #define TARGET_SPLIT_LONG_MOVES (x86_split_long_moves & CPUMASK)
181 #define TARGET_READ_MODIFY_WRITE (x86_read_modify_write & CPUMASK)
182 #define TARGET_READ_MODIFY (x86_read_modify & CPUMASK)
184 #define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
186 #define ASSEMBLER_DIALECT ((target_flags & MASK_INTEL_SYNTAX) != 0)
188 #define TARGET_SWITCHES \
189 { { "80387", MASK_80387, "Use hardware fp" }, \
190 { "no-80387", -MASK_80387, "Do not use hardware fp" }, \
191 { "hard-float", MASK_80387, "Use hardware fp" }, \
192 { "soft-float", -MASK_80387, "Do not use hardware fp" }, \
193 { "no-soft-float", MASK_80387, "Use hardware fp" }, \
194 { "386", 0, "Same as -mcpu=i386" }, \
195 { "486", 0, "Same as -mcpu=i486" }, \
196 { "pentium", 0, "Same as -mcpu=pentium" }, \
197 { "pentiumpro", 0, "Same as -mcpu=pentiumpro" }, \
198 { "rtd", MASK_RTD, "Alternate calling convention" }, \
199 { "no-rtd", -MASK_RTD, "Use normal calling convention" }, \
200 { "align-double", MASK_ALIGN_DOUBLE, \
201 "Align some doubles on dword boundary" }, \
202 { "no-align-double", -MASK_ALIGN_DOUBLE, \
203 "Align doubles on word boundary" }, \
204 { "svr3-shlib", MASK_SVR3_SHLIB, \
205 "Uninitialized locals in .bss" }, \
206 { "no-svr3-shlib", -MASK_SVR3_SHLIB, \
207 "Uninitialized locals in .data" }, \
208 { "ieee-fp", MASK_IEEE_FP, \
209 "Use IEEE math for fp comparisons" }, \
210 { "no-ieee-fp", -MASK_IEEE_FP, \
211 "Do not use IEEE math for fp comparisons" }, \
212 { "fp-ret-in-387", MASK_FLOAT_RETURNS, \
213 "Return values of functions in FPU registers" }, \
214 { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS , \
215 "Do not return values of functions in FPU registers"}, \
216 { "no-fancy-math-387", MASK_NO_FANCY_MATH_387, \
217 "Do not generate sin, cos, sqrt for FPU" }, \
218 { "fancy-math-387", -MASK_NO_FANCY_MATH_387, \
219 "Generate sin, cos, sqrt for FPU"}, \
220 { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER, \
221 "Omit the frame pointer in leaf functions" }, \
222 { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, "" }, \
223 { "debug-addr", MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
224 { "no-debug-addr", -MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
225 { "debug-arg", MASK_DEBUG_ARG, 0 /* undocumented */ }, \
226 { "no-debug-arg", -MASK_DEBUG_ARG, 0 /* undocumented */ }, \
227 { "stack-arg-probe", MASK_STACK_PROBE, "Enable stack probing" }, \
228 { "no-stack-arg-probe", -MASK_STACK_PROBE, "" }, \
229 { "windows", 0, 0 /* undocumented */ }, \
230 { "dll", 0, 0 /* undocumented */ }, \
231 { "intel-syntax", MASK_INTEL_SYNTAX, \
232 "Emit Intel syntax assembler opcodes" }, \
233 { "no-intel-syntax", -MASK_INTEL_SYNTAX, "" }, \
235 { "", TARGET_DEFAULT, 0 }}
237 /* Which processor to schedule for. The cpu attribute defines a list that
238 mirrors this list, so changes to i386.md must be made at the same time. */
242 PROCESSOR_I386, /* 80386 */
243 PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
245 PROCESSOR_PENTIUMPRO,
250 extern enum processor_type ix86_cpu;
252 extern int ix86_arch;
254 /* This macro is similar to `TARGET_SWITCHES' but defines names of
255 command options that have values. Its definition is an
256 initializer with a subgrouping for each command option.
258 Each subgrouping contains a string constant, that defines the
259 fixed part of the option name, and the address of a variable. The
260 variable, type `char *', is set to the variable part of the given
261 option if the fixed part matches. The actual option name is made
262 by appending `-m' to the specified name. */
263 #define TARGET_OPTIONS \
264 { { "cpu=", &ix86_cpu_string, \
265 "Schedule code for given CPU"}, \
266 { "arch=", &ix86_arch_string, \
267 "Generate code for given CPU"}, \
268 { "reg-alloc=", &ix86_reg_alloc_order, \
269 "Control allocation order of integer registers" }, \
270 { "regparm=", &ix86_regparm_string, \
271 "Number of registers used to pass integer arguments" }, \
272 { "align-loops=", &ix86_align_loops_string, \
273 "Loop code aligned to this power of 2" }, \
274 { "align-jumps=", &ix86_align_jumps_string, \
275 "Jump targets are aligned to this power of 2" }, \
276 { "align-functions=", &ix86_align_funcs_string, \
277 "Function starts are aligned to this power of 2" }, \
278 { "preferred-stack-boundary=", \
279 &ix86_preferred_stack_boundary_string, \
280 "Attempt to keep stack aligned to this power of 2" }, \
281 { "branch-cost=", &ix86_branch_cost_string, \
282 "Branches are this expensive (1-5, arbitrary units)" }, \
286 /* Sometimes certain combinations of command options do not make
287 sense on a particular target machine. You can define a macro
288 `OVERRIDE_OPTIONS' to take account of this. This macro, if
289 defined, is executed once just after all the command options have
292 Don't use this macro to turn on various extra optimizations for
293 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
295 #define OVERRIDE_OPTIONS override_options ()
297 /* These are meant to be redefined in the host dependent files */
298 #define SUBTARGET_SWITCHES
299 #define SUBTARGET_OPTIONS
301 /* Define this to change the optimizations performed by default. */
302 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
304 /* Specs for the compiler proper */
307 #define CC1_CPU_SPEC "\
311 %{mpentium:-mcpu=pentium} \
312 %{mpentiumpro:-mcpu=pentiumpro}}"
315 #ifndef CPP_CPU_DEFAULT_SPEC
316 #if TARGET_CPU_DEFAULT == 1
317 #define CPP_CPU_DEFAULT_SPEC "-D__tune_i486__"
319 #if TARGET_CPU_DEFAULT == 2
320 #define CPP_CPU_DEFAULT_SPEC "-D__tune_pentium__"
322 #if TARGET_CPU_DEFAULT == 3
323 #define CPP_CPU_DEFAULT_SPEC "-D__tune_pentiumpro__"
325 #if TARGET_CPU_DEFAULT == 4
326 #define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__"
328 #ifndef CPP_CPU_DEFAULT_SPEC
329 #define CPP_CPU_DEFAULT_SPEC "-D__tune_i386__"
331 #endif /* CPP_CPU_DEFAULT_SPEC */
334 #define CPP_CPU_SPEC "\
335 -Acpu(i386) -Amachine(i386) \
336 %{!ansi:-Di386} -D__i386 -D__i386__ \
337 %{march=i386:%{!mcpu*:-D__tune_i386__ }}\
338 %{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
339 %{march=pentium|march=i586:-D__pentium -D__pentium__ \
340 %{!mcpu*:-D__tune_pentium__ }}\
341 %{march=pentiumpro|march=i686:-D__pentiumpro -D__pentiumpro__ \
342 %{!mcpu*:-D__tune_pentiumpro__ }}\
343 %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
344 %{m386|mcpu=i386:-D__tune_i386__ }\
345 %{m486|mcpu=i486:-D__tune_i486__ }\
346 %{mpentium|mcpu=pentium|mcpu=i586:-D__tune_pentium__ }\
347 %{mpentiumpro|mcpu=pentiumpro|mcpu=i686:-D__tune_pentiumpro__ }\
348 %{mcpu=k6:-D__tune_k6__ }\
349 %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
353 #define CC1_SPEC "%(cc1_cpu) "
356 /* This macro defines names of additional specifications to put in the
357 specs that can be used in various specifications like CC1_SPEC. Its
358 definition is an initializer with a subgrouping for each command option.
360 Each subgrouping contains a string constant, that defines the
361 specification name, and a string constant that used by the GNU CC driver
364 Do not define this macro if it does not need to do anything. */
366 #ifndef SUBTARGET_EXTRA_SPECS
367 #define SUBTARGET_EXTRA_SPECS
370 #define EXTRA_SPECS \
371 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
372 { "cpp_cpu", CPP_CPU_SPEC }, \
373 { "cc1_cpu", CC1_CPU_SPEC }, \
374 SUBTARGET_EXTRA_SPECS
376 /* target machine storage layout */
378 /* Define for XFmode extended real floating point support.
379 This will automatically cause REAL_ARITHMETIC to be defined. */
380 #define LONG_DOUBLE_TYPE_SIZE 96
382 /* Define if you don't want extended real, but do want to use the
383 software floating point emulator for REAL_ARITHMETIC and
384 decimal <-> binary conversion. */
385 /* #define REAL_ARITHMETIC */
387 /* Define this if most significant byte of a word is the lowest numbered. */
388 /* That is true on the 80386. */
390 #define BITS_BIG_ENDIAN 0
392 /* Define this if most significant byte of a word is the lowest numbered. */
393 /* That is not true on the 80386. */
394 #define BYTES_BIG_ENDIAN 0
396 /* Define this if most significant word of a multiword number is the lowest
398 /* Not true for 80386 */
399 #define WORDS_BIG_ENDIAN 0
401 /* number of bits in an addressable storage unit */
402 #define BITS_PER_UNIT 8
404 /* Width in bits of a "word", which is the contents of a machine register.
405 Note that this is not necessarily the width of data type `int';
406 if using 16-bit ints on a 80386, this would still be 32.
407 But on a machine with 16-bit registers, this would be 16. */
408 #define BITS_PER_WORD 32
410 /* Width of a word, in units (bytes). */
411 #define UNITS_PER_WORD 4
413 /* Width in bits of a pointer.
414 See also the macro `Pmode' defined below. */
415 #define POINTER_SIZE 32
417 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
418 #define PARM_BOUNDARY 32
420 /* Boundary (in *bits*) on which stack pointer should be aligned. */
421 #define STACK_BOUNDARY 32
423 /* Boundary (in *bits*) on which the stack pointer preferrs to be
424 aligned; the compiler cannot rely on having this alignment. */
425 #define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
427 /* Allocation boundary for the code of a function. */
428 #define FUNCTION_BOUNDARY \
429 (1 << ((ix86_align_funcs >= 0 ? ix86_align_funcs : -ix86_align_funcs) + 3))
431 /* Alignment of field after `int : 0' in a structure. */
433 #define EMPTY_FIELD_BOUNDARY 32
435 /* Minimum size in bits of the largest boundary to which any
436 and all fundamental data types supported by the hardware
437 might need to be aligned. No data type wants to be aligned
438 rounder than this. The i386 supports 64-bit floating point
439 quantities, but these can be aligned on any 32-bit boundary.
440 The published ABIs say that doubles should be aligned on word
441 boundaries, but the Pentium gets better performance with them
442 aligned on 64 bit boundaries. */
443 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
445 /* If defined, a C expression to compute the alignment given to a
446 constant that is being placed in memory. CONSTANT is the constant
447 and ALIGN is the alignment that the object would ordinarily have.
448 The value of this macro is used instead of that alignment to align
451 If this macro is not defined, then ALIGN is used.
453 The typical use of this macro is to increase alignment for string
454 constants to be word aligned so that `strcpy' calls that copy
455 constants can be done inline. */
457 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
458 (TREE_CODE (EXP) == REAL_CST \
459 ? ((TYPE_MODE (TREE_TYPE (EXP)) == DFmode && (ALIGN) < 64) \
461 : (TYPE_MODE (TREE_TYPE (EXP)) == XFmode && (ALIGN) < 128) \
464 : TREE_CODE (EXP) == STRING_CST \
465 ? ((TREE_STRING_LENGTH (EXP) >= 31 && (ALIGN) < 256) \
470 /* If defined, a C expression to compute the alignment for a static
471 variable. TYPE is the data type, and ALIGN is the alignment that
472 the object would ordinarily have. The value of this macro is used
473 instead of that alignment to align the object.
475 If this macro is not defined, then ALIGN is used.
477 One use of this macro is to increase alignment of medium-size
478 data to make it all fit in fewer cache lines. Another is to
479 cause character arrays to be word-aligned so that `strcpy' calls
480 that copy constants to character arrays can be done inline. */
482 #define DATA_ALIGNMENT(TYPE, ALIGN) \
483 ((AGGREGATE_TYPE_P (TYPE) \
484 && TYPE_SIZE (TYPE) \
485 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
486 && (TREE_INT_CST_LOW (TYPE_SIZE (TYPE)) >= 256 \
487 || TREE_INT_CST_HIGH (TYPE_SIZE (TYPE))) && (ALIGN) < 256) \
489 : TREE_CODE (TYPE) == ARRAY_TYPE \
490 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
492 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
495 : TREE_CODE (TYPE) == COMPLEX_TYPE \
496 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
498 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
501 : ((TREE_CODE (TYPE) == RECORD_TYPE \
502 || TREE_CODE (TYPE) == UNION_TYPE \
503 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
504 && TYPE_FIELDS (TYPE)) \
505 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
507 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
510 : TREE_CODE (TYPE) == REAL_TYPE \
511 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
513 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
518 /* If defined, a C expression to compute the alignment for a local
519 variable. TYPE is the data type, and ALIGN is the alignment that
520 the object would ordinarily have. The value of this macro is used
521 instead of that alignment to align the object.
523 If this macro is not defined, then ALIGN is used.
525 One use of this macro is to increase alignment of medium-size
526 data to make it all fit in fewer cache lines. */
528 #define LOCAL_ALIGNMENT(TYPE, ALIGN) \
529 (TREE_CODE (TYPE) == ARRAY_TYPE \
530 ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \
532 : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \
535 : TREE_CODE (TYPE) == COMPLEX_TYPE \
536 ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \
538 : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \
541 : ((TREE_CODE (TYPE) == RECORD_TYPE \
542 || TREE_CODE (TYPE) == UNION_TYPE \
543 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
544 && TYPE_FIELDS (TYPE)) \
545 ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \
547 : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \
550 : TREE_CODE (TYPE) == REAL_TYPE \
551 ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \
553 : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \
558 /* Set this non-zero if move instructions will actually fail to work
559 when given unaligned data. */
560 #define STRICT_ALIGNMENT 0
562 /* If bit field type is int, don't let it cross an int,
563 and give entire struct the alignment of an int. */
564 /* Required on the 386 since it doesn't have bitfield insns. */
565 #define PCC_BITFIELD_TYPE_MATTERS 1
567 /* Align loop starts for optimal branching. */
568 #define LOOP_ALIGN(LABEL) \
569 (ix86_align_loops < 0 ? -ix86_align_loops : ix86_align_loops)
570 #define LOOP_ALIGN_MAX_SKIP \
571 (ix86_align_loops < -3 ? (1<<(-ix86_align_loops-1))-1 : 0)
573 /* This is how to align an instruction for optimal branching. */
574 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
575 (ix86_align_jumps < 0 ? -ix86_align_jumps : ix86_align_jumps)
576 #define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP \
577 (ix86_align_jumps < -3 ? (1<<(-ix86_align_jumps-1))-1 : 0)
579 /* Standard register usage. */
581 /* This processor has special stack-like registers. See reg-stack.c
585 #define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode)
587 /* Number of actual hardware registers.
588 The hardware registers are assigned numbers for the compiler
589 from 0 to just below FIRST_PSEUDO_REGISTER.
590 All registers that the compiler knows about must be given numbers,
591 even those that are not normally considered general registers.
593 In the 80386 we give the 8 general purpose registers the numbers 0-7.
594 We number the floating point registers 8-15.
595 Note that registers 0-7 can be accessed as a short or int,
596 while only 0-3 may be used with byte `mov' instructions.
598 Reg 16 does not correspond to any hardware register, but instead
599 appears in the RTL as an argument pointer prior to reload, and is
600 eliminated during reloading in favor of either the stack or frame
603 #define FIRST_PSEUDO_REGISTER 19
605 /* 1 for registers that have pervasive standard uses
606 and are not available for the register allocator.
607 On the 80386, the stack pointer is such, as is the arg pointer. */
608 #define FIXED_REGISTERS \
609 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr*/ \
610 { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }
612 /* 1 for registers not available across function calls.
613 These must include the FIXED_REGISTERS and also any
614 registers that can be used without being saved.
615 The latter must include the registers where values are returned
616 and the register where structure-value addresses are passed.
617 Aside from that, you can include as many other registers as you like. */
619 #define CALL_USED_REGISTERS \
620 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,flags,fpsr*/ \
621 { 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
623 /* Order in which to allocate registers. Each register must be
624 listed once, even those in FIXED_REGISTERS. List frame pointer
625 late and fixed registers last. Note that, in general, we prefer
626 registers listed in CALL_USED_REGISTERS, keeping the others
627 available for storage of persistent values.
629 Three different versions of REG_ALLOC_ORDER have been tried:
631 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
632 but slower code on simple functions returning values in eax.
634 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
635 perl 4.036 due to not being able to create a DImode register (to hold a 2
638 If the order is eax, edx, ecx, ... it produces better code for simple
639 functions, and a slightly slower compiler. Users complained about the code
640 generated by allocating edx first, so restore the 'natural' order of things. */
642 #define REG_ALLOC_ORDER \
643 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg,cc,fpsr*/ \
644 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 18 }
646 /* A C statement (sans semicolon) to choose the order in which to
647 allocate hard registers for pseudo-registers local to a basic
650 Store the desired register order in the array `reg_alloc_order'.
651 Element 0 should be the register to allocate first; element 1, the
652 next register; and so on.
654 The macro body should not assume anything about the contents of
655 `reg_alloc_order' before execution of the macro.
657 On most machines, it is not necessary to define this macro. */
659 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
661 /* Macro to conditionally modify fixed_regs/call_used_regs. */
662 #define CONDITIONAL_REGISTER_USAGE \
666 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
667 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
669 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
673 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
674 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
675 if (TEST_HARD_REG_BIT (x, i)) \
676 fixed_regs[i] = call_used_regs[i] = 1; \
680 /* Return number of consecutive hard regs needed starting at reg REGNO
681 to hold something of mode MODE.
682 This is ordinarily the length in words of a value of mode MODE
683 but can be less for certain modes in special long registers.
685 Actually there are no two word move instructions for consecutive
686 registers. And only registers 0-3 may have mov byte instructions
690 #define HARD_REGNO_NREGS(REGNO, MODE) \
691 (FP_REGNO_P (REGNO) ? 1 \
692 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
694 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
696 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
697 /* Flags and only flags can only hold CCmode values. */ \
698 (CC_REGNO_P (REGNO) \
699 ? GET_MODE_CLASS (MODE) == MODE_CC \
700 : GET_MODE_CLASS (MODE) == MODE_CC ? 0 \
701 /* FP regs can only hold floating point; make it clear they \
702 cannot hold TFmode floats. */ \
703 : FP_REGNO_P (REGNO) \
704 ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
705 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
706 && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\
707 /* Only allow DImode in even registers. */ \
708 : (MODE) == DImode && ((REGNO) & 1) ? 0 \
709 /* The first four integer regs can hold any mode. */ \
711 /* Other regs cannot do byte accesses. */ \
712 : (MODE) != QImode ? 1 \
713 : reload_in_progress || reload_completed)
715 /* Value is 1 if it is a good idea to tie two pseudo registers
716 when one has mode MODE1 and one has mode MODE2.
717 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
718 for any hard reg, then this must be 0 for correct output. */
720 #define MODES_TIEABLE_P(MODE1, MODE2) \
721 ((MODE1) == (MODE2) \
722 || ((MODE1) == SImode && (MODE2) == HImode) \
723 || ((MODE1) == HImode && (MODE2) == SImode))
725 /* Specify the modes required to caller save a given hard regno.
726 We do this on i386 to prevent flags from being saved at all. */
728 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS) \
729 (CC_REGNO_P (REGNO) ? VOIDmode \
730 : choose_hard_reg_mode ((REGNO), (NREGS)))
732 /* Specify the registers used for certain standard purposes.
733 The values of these macros are register numbers. */
735 /* on the 386 the pc register is %eip, and is not usable as a general
736 register. The ordinary mov instructions won't work */
737 /* #define PC_REGNUM */
739 /* Register to use for pushing function arguments. */
740 #define STACK_POINTER_REGNUM 7
742 /* Base register for access to local variables of the function. */
743 #define FRAME_POINTER_REGNUM 6
745 /* First floating point reg */
746 #define FIRST_FLOAT_REG 8
748 /* First & last stack-like regs */
749 #define FIRST_STACK_REG FIRST_FLOAT_REG
750 #define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
755 /* Value should be nonzero if functions must have frame pointers.
756 Zero means the frame pointer need not be set up (and parms
757 may be accessed via the stack pointer) in functions that seem suitable.
758 This is computed in `reload', in reload1.c. */
759 #define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
761 /* Base register for access to arguments of the function. */
762 #define ARG_POINTER_REGNUM 16
764 /* Register in which static-chain is passed to a function. */
765 #define STATIC_CHAIN_REGNUM 2
767 /* Register to hold the addressing base for position independent
768 code access to data items. */
769 #define PIC_OFFSET_TABLE_REGNUM 3
771 /* Register in which address to store a structure value
772 arrives in the function. On the 386, the prologue
773 copies this from the stack to register %eax. */
774 #define STRUCT_VALUE_INCOMING 0
776 /* Place in which caller passes the structure value address.
777 0 means push the value on the stack like an argument. */
778 #define STRUCT_VALUE 0
780 /* A C expression which can inhibit the returning of certain function
781 values in registers, based on the type of value. A nonzero value
782 says to return the function value in memory, just as large
783 structures are always returned. Here TYPE will be a C expression
784 of type `tree', representing the data type of the value.
786 Note that values of mode `BLKmode' must be explicitly handled by
787 this macro. Also, the option `-fpcc-struct-return' takes effect
788 regardless of this macro. On most systems, it is possible to
789 leave the macro undefined; this causes a default definition to be
790 used, whose value is the constant 1 for `BLKmode' values, and 0
793 Do not use this macro to indicate that structures and unions
794 should always be returned in memory. You should instead use
795 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
797 #define RETURN_IN_MEMORY(TYPE) \
798 ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
801 /* Define the classes of registers for register constraints in the
802 machine description. Also define ranges of constants.
804 One of the classes must always be named ALL_REGS and include all hard regs.
805 If there is more than one class, another class must be named NO_REGS
806 and contain no registers.
808 The name GENERAL_REGS must be the name of a class (or an alias for
809 another name such as ALL_REGS). This is the class of registers
810 that is allowed by "g" or "r" in a register constraint.
811 Also, registers outside this class are allocated only when
812 instructions express preferences for them.
814 The classes must be numbered in nondecreasing order; that is,
815 a larger-numbered class must never be contained completely
816 in a smaller-numbered class.
818 For any two classes, it is very desirable that there be another
819 class that represents their union.
821 It might seem that class BREG is unnecessary, since no useful 386
822 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
823 and the "b" register constraint is useful in asms for syscalls.
825 The flags and fpsr registers are in no class. */
830 AREG, DREG, CREG, BREG, SIREG, DIREG,
831 AD_REGS, /* %eax/%edx for DImode */
832 Q_REGS, /* %eax %ebx %ecx %edx */
833 NON_Q_REGS, /* %esi %edi %ebp %esi */
834 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
835 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
836 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
838 FLOAT_INT_REGS, /* FLOAT_REGS and GENERAL_REGS. */
839 ALL_REGS, LIM_REG_CLASSES
842 #define N_REG_CLASSES (int) LIM_REG_CLASSES
844 #define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
846 /* Give names of register classes as strings for dump file. */
848 #define REG_CLASS_NAMES \
850 "AREG", "DREG", "CREG", "BREG", \
853 "Q_REGS", "NON_Q_REGS", \
856 "FP_TOP_REG", "FP_SECOND_REG", \
861 /* Define which registers fit in which classes.
862 This is an initializer for a vector of HARD_REG_SET
863 of length N_REG_CLASSES. */
865 #define REG_CLASS_CONTENTS \
867 {0x1}, {0x2}, {0x4}, {0x8},/* AREG, DREG, CREG, BREG */ \
868 {0x10}, {0x20}, /* SIREG, DIREG */ \
869 {0x3}, /* AD_REGS */ \
870 {0xf}, /* Q_REGS */ \
871 {0xf0}, /* NON_Q_REGS */ \
872 {0x7f}, /* INDEX_REGS */ \
873 {0x100ff}, /* GENERAL_REGS */ \
874 {0x0100}, {0x0200}, /* FP_TOP_REG, FP_SECOND_REG */ \
875 {0xff00}, /* FLOAT_REGS */ \
876 {0x1ffff}, /* FLOAT_INT_REGS */ \
880 /* The same information, inverted:
881 Return the class number of the smallest class containing
882 reg number REGNO. This could be a conditional expression
883 or could index an array. */
885 #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
887 /* When defined, the compiler allows registers explicitly used in the
888 rtl to be used as spill registers but prevents the compiler from
889 extending the lifetime of these registers. */
891 #define SMALL_REGISTER_CLASSES 1
893 #define QI_REG_P(X) \
894 (REG_P (X) && REGNO (X) < 4)
895 #define NON_QI_REG_P(X) \
896 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
898 #define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
899 #define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
901 #define STACK_REG_P(xop) (REG_P (xop) && \
902 REGNO (xop) >= FIRST_STACK_REG && \
903 REGNO (xop) <= LAST_STACK_REG)
905 #define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
907 #define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
909 #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
910 #define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG)
912 /* The class value for index registers, and the one for base regs. */
914 #define INDEX_REG_CLASS INDEX_REGS
915 #define BASE_REG_CLASS GENERAL_REGS
917 /* Get reg_class from a letter such as appears in the machine description. */
919 #define REG_CLASS_FROM_LETTER(C) \
920 ((C) == 'r' ? GENERAL_REGS : \
921 (C) == 'q' ? Q_REGS : \
922 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
925 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
928 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
931 (C) == 'a' ? AREG : \
932 (C) == 'b' ? BREG : \
933 (C) == 'c' ? CREG : \
934 (C) == 'd' ? DREG : \
935 (C) == 'A' ? AD_REGS : \
936 (C) == 'D' ? DIREG : \
937 (C) == 'S' ? SIREG : NO_REGS)
939 /* The letters I, J, K, L and M in a register constraint string
940 can be used to stand for particular ranges of immediate operands.
941 This macro defines what the ranges are.
942 C is the letter, and VALUE is a constant value.
943 Return 1 if VALUE is in the range specified by C.
945 I is for non-DImode shifts.
946 J is for DImode shifts.
947 K is for signed imm8 operands.
948 L is for andsi as zero-extending move.
949 M is for shifts that can be executed by the "lea" opcode.
952 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
953 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 \
954 : (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 \
955 : (C) == 'K' ? (VALUE) >= -128 && (VALUE) <= 127 \
956 : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff \
957 : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 \
960 /* Similar, but for floating constants, and defining letters G and H.
961 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
962 TARGET_387 isn't set, because the stack register converter may need to
963 load 0.0 into the function value register. */
965 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
966 ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
968 /* Place additional restrictions on the register class to use when it
969 is necessary to be able to hold a value of mode MODE in a reload
970 register for which class CLASS would ordinarily be used. */
972 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
973 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
976 /* Given an rtx X being reloaded into a reg required to be
977 in class CLASS, return the class of reg to actually use.
978 In general this is just CLASS; but on some machines
979 in some cases it is preferable to use a more restrictive class.
980 On the 80386 series, we prevent floating constants from being
981 reloaded into floating registers (since no move-insn can do that)
982 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
984 /* Put float CONST_DOUBLE in the constant pool instead of fp regs.
985 QImode must go into class Q_REGS.
986 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
987 movdf to do mem-to-mem moves through integer regs. */
989 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
990 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \
991 ? (standard_80387_constant_p (X) \
992 ? reg_class_subset_p (CLASS, FLOAT_REGS) ? CLASS : FLOAT_REGS \
994 : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
995 : ((CLASS) == ALL_REGS \
996 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
999 /* If we are copying between general and FP registers, we need a memory
1002 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
1003 (FLOAT_CLASS_P (CLASS1) != FLOAT_CLASS_P (CLASS2))
1005 /* QImode spills from non-QI registers need a scratch. This does not
1006 happen often -- the only example so far requires an uninitialized
1009 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
1010 ((CLASS) == GENERAL_REGS && (MODE) == QImode ? Q_REGS : NO_REGS)
1012 /* Return the maximum number of consecutive registers
1013 needed to represent mode MODE in a register of class CLASS. */
1014 /* On the 80386, this is the size of MODE in words,
1015 except in the FP regs, where a single reg is always enough. */
1016 #define CLASS_MAX_NREGS(CLASS, MODE) \
1017 (FLOAT_CLASS_P (CLASS) ? 1 : \
1018 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1020 /* A C expression whose value is nonzero if pseudos that have been
1021 assigned to registers of class CLASS would likely be spilled
1022 because registers of CLASS are needed for spill registers.
1024 The default value of this macro returns 1 if CLASS has exactly one
1025 register and zero otherwise. On most machines, this default
1026 should be used. Only define this macro to some other expression
1027 if pseudo allocated by `local-alloc.c' end up in memory because
1028 their hard registers were needed for spill registers. If this
1029 macro returns nonzero for those classes, those pseudos will only
1030 be allocated by `global.c', which knows how to reallocate the
1031 pseudo to another register. If there would not be another
1032 register available for reallocation, you should not change the
1033 definition of this macro since the only effect of such a
1034 definition would be to slow down register allocation. */
1036 #define CLASS_LIKELY_SPILLED_P(CLASS) \
1037 (((CLASS) == AREG) \
1038 || ((CLASS) == DREG) \
1039 || ((CLASS) == CREG) \
1040 || ((CLASS) == BREG) \
1041 || ((CLASS) == AD_REGS) \
1042 || ((CLASS) == SIREG) \
1043 || ((CLASS) == DIREG))
1045 /* A C statement that adds to CLOBBERS any hard regs the port wishes
1046 to automatically clobber for all asms.
1048 We do this in the new i386 backend to maintain source compatibility
1049 with the old cc0-based compiler. */
1051 #define MD_ASM_CLOBBERS(CLOBBERS) \
1053 (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"), (CLOBBERS));\
1054 (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"), (CLOBBERS)); \
1057 /* Stack layout; function entry, exit and calling. */
1059 /* Define this if pushing a word on the stack
1060 makes the stack pointer a smaller address. */
1061 #define STACK_GROWS_DOWNWARD
1063 /* Define this if the nominal address of the stack frame
1064 is at the high-address end of the local variables;
1065 that is, each additional local variable allocated
1066 goes at a more negative offset in the frame. */
1067 #define FRAME_GROWS_DOWNWARD
1069 /* Offset within stack frame to start allocating local variables at.
1070 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1071 first local allocated. Otherwise, it is the offset to the BEGINNING
1072 of the first local allocated. */
1073 #define STARTING_FRAME_OFFSET 0
1075 /* If we generate an insn to push BYTES bytes,
1076 this says how many the stack pointer really advances by.
1077 On 386 pushw decrements by exactly 2 no matter what the position was.
1078 On the 386 there is no pushb; we use pushw instead, and this
1079 has the effect of rounding up to 2. */
1081 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
1083 /* Offset of first parameter from the argument pointer register value. */
1084 #define FIRST_PARM_OFFSET(FNDECL) 0
1086 /* Value is the number of bytes of arguments automatically
1087 popped when returning from a subroutine call.
1088 FUNDECL is the declaration node of the function (as a tree),
1089 FUNTYPE is the data type of the function (as a tree),
1090 or for a library call it is an identifier node for the subroutine name.
1091 SIZE is the number of bytes of arguments passed on the stack.
1093 On the 80386, the RTD insn may be used to pop them if the number
1094 of args is fixed, but if the number is variable then the caller
1095 must pop them all. RTD can't be used for library calls now
1096 because the library is compiled with the Unix compiler.
1097 Use of RTD is a selectable option, since it is incompatible with
1098 standard Unix calling sequences. If the option is not selected,
1099 the caller must always pop the args.
1101 The attribute stdcall is equivalent to RTD on a per module basis. */
1103 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
1104 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE))
1106 /* Define how to find the value returned by a function.
1107 VALTYPE is the data type of the value (as a tree).
1108 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1109 otherwise, FUNC is 0. */
1110 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1111 gen_rtx_REG (TYPE_MODE (VALTYPE), \
1112 VALUE_REGNO (TYPE_MODE (VALTYPE)))
1114 /* Define how to find the value returned by a library function
1115 assuming the value has mode MODE. */
1117 #define LIBCALL_VALUE(MODE) \
1118 gen_rtx_REG (MODE, VALUE_REGNO (MODE))
1120 /* Define the size of the result block used for communication between
1121 untyped_call and untyped_return. The block contains a DImode value
1122 followed by the block used by fnsave and frstor. */
1124 #define APPLY_RESULT_SIZE (8+108)
1126 /* 1 if N is a possible register number for function argument passing. */
1127 #define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)
1129 /* Define a data type for recording info about an argument list
1130 during the scan of that argument list. This data type should
1131 hold all necessary information about the function itself
1132 and about the args processed so far, enough to enable macros
1133 such as FUNCTION_ARG to determine where the next arg should go. */
1135 typedef struct ix86_args {
1136 int words; /* # words passed so far */
1137 int nregs; /* # registers available for passing */
1138 int regno; /* next available register number */
1141 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1142 for a call to a function whose data type is FNTYPE.
1143 For a library call, FNTYPE is 0. */
1145 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
1146 (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
1148 /* Update the data in CUM to advance over an argument
1149 of mode MODE and data type TYPE.
1150 (TYPE is null for libcalls where that information may not be available.) */
1152 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1153 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
1155 /* Define where to put the arguments to a function.
1156 Value is zero to push the argument on the stack,
1157 or a hard register in which to store the argument.
1159 MODE is the argument's machine mode.
1160 TYPE is the data type of the argument (as a tree).
1161 This is null for libcalls where that information may
1163 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1164 the preceding args and about the function being called.
1165 NAMED is nonzero if this argument is a named parameter
1166 (otherwise it is an extra parameter matching an ellipsis). */
1168 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1169 (function_arg (&CUM, MODE, TYPE, NAMED))
1171 /* For an arg passed partly in registers and partly in memory,
1172 this is the number of registers used.
1173 For args passed entirely in registers or entirely in memory, zero. */
1175 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
1177 /* This macro is invoked just before the start of a function.
1178 It is used here to output code for -fpic that will load the
1179 return address into %ebx. */
1181 #undef ASM_OUTPUT_FUNCTION_PREFIX
1182 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
1183 asm_output_function_prefix (FILE, FNNAME)
1185 /* Output assembler code to FILE to increment profiler label # LABELNO
1186 for profiling a function entry. */
1188 #define FUNCTION_PROFILER(FILE, LABELNO) \
1192 fprintf (FILE, "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n", \
1193 LPREFIX, (LABELNO)); \
1194 fprintf (FILE, "\tcall\t*_mcount@GOT(%%ebx)\n"); \
1198 fprintf (FILE, "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
1199 fprintf (FILE, "\tcall\t_mcount\n"); \
1204 /* There are three profiling modes for basic blocks available.
1205 The modes are selected at compile time by using the options
1206 -a or -ax of the gnu compiler.
1207 The variable `profile_block_flag' will be set according to the
1210 profile_block_flag == 0, no option used:
1214 profile_block_flag == 1, -a option used.
1216 Count frequency of execution of every basic block.
1218 profile_block_flag == 2, -ax option used.
1220 Generate code to allow several different profiling modes at run time.
1221 Available modes are:
1222 Produce a trace of all basic blocks.
1223 Count frequency of jump instructions executed.
1224 In every mode it is possible to start profiling upon entering
1225 certain functions and to disable profiling of some other functions.
1227 The result of basic-block profiling will be written to a file `bb.out'.
1228 If the -ax option is used parameters for the profiling will be read
1233 /* The following macro shall output assembler code to FILE
1234 to initialize basic-block profiling. */
1236 #undef FUNCTION_BLOCK_PROFILER
1237 #define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1238 ix86_output_function_block_profiler (FILE, BLOCK_OR_LABEL)
1240 /* The following macro shall output assembler code to FILE
1241 to increment a counter associated with basic block number BLOCKNO. */
1243 #define BLOCK_PROFILER(FILE, BLOCKNO) \
1244 ix86_output_block_profiler (FILE, BLOCKNO)
1246 /* The following macro shall output rtl for the epilogue
1247 to indicate a return from function during basic-block profiling.
1249 If profiling_block_flag == 2:
1251 Output assembler code to call function `__bb_trace_ret'.
1253 Note that function `__bb_trace_ret' must not change the
1254 machine state, especially the flag register. To grant
1255 this, you must output code to save and restore registers
1256 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1257 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1258 used in the function `__bb_trace_ret', so you must make
1259 sure that the function prologue does not change any
1260 register prior to saving it with MACHINE_STATE_SAVE_RET.
1262 else if profiling_block_flag != 0:
1264 The macro will not be used, so it need not distinguish
1268 #define FUNCTION_BLOCK_PROFILER_EXIT \
1269 emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \
1270 gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \
1273 /* The function `__bb_trace_func' is called in every basic block
1274 and is not allowed to change the machine state. Saving (restoring)
1275 the state can either be done in the BLOCK_PROFILER macro,
1276 before calling function (rsp. after returning from function)
1277 `__bb_trace_func', or it can be done inside the function by
1278 defining the macros:
1280 MACHINE_STATE_SAVE(ID)
1281 MACHINE_STATE_RESTORE(ID)
1283 In the latter case care must be taken, that the prologue code
1284 of function `__bb_trace_func' does not already change the
1285 state prior to saving it with MACHINE_STATE_SAVE.
1287 The parameter `ID' is a string identifying a unique macro use.
1289 On the i386 the initialization code at the begin of
1290 function `__bb_trace_func' contains a `sub' instruction
1291 therefore we handle save and restore of the flag register
1292 in the BLOCK_PROFILER macro. */
1294 #define MACHINE_STATE_SAVE(ID) \
1296 register int eax_ __asm__("eax"); \
1297 register int ecx_ __asm__("ecx"); \
1298 register int edx_ __asm__("edx"); \
1299 register int esi_ __asm__("esi"); \
1300 __asm__ __volatile__ ( \
1305 : : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
1308 #define MACHINE_STATE_RESTORE(ID) \
1310 register int eax_ __asm__("eax"); \
1311 register int ecx_ __asm__("ecx"); \
1312 register int edx_ __asm__("edx"); \
1313 register int esi_ __asm__("esi"); \
1314 __asm__ __volatile__ ( \
1319 : "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
1322 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1323 the stack pointer does not matter. The value is tested only in
1324 functions that have frame pointers.
1325 No definition is equivalent to always zero. */
1326 /* Note on the 386 it might be more efficient not to define this since
1327 we have to restore it ourselves from the frame pointer, in order to
1330 #define EXIT_IGNORE_STACK 1
1332 /* Output assembler code for a block containing the constant parts
1333 of a trampoline, leaving space for the variable parts. */
1335 /* On the 386, the trampoline contains two instructions:
1338 The trampoline is generated entirely at runtime. The operand of JMP
1339 is the address of FUNCTION relative to the instruction following the
1340 JMP (which is 5 bytes long). */
1342 /* Length in units of the trampoline for entering a nested function. */
1344 #define TRAMPOLINE_SIZE 10
1346 /* Emit RTL insns to initialize the variable parts of a trampoline.
1347 FNADDR is an RTX for the address of the function's pure code.
1348 CXT is an RTX for the static chain value for the function. */
1350 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1352 /* Compute offset from the end of the jmp to the target function. */ \
1353 rtx disp = expand_binop (SImode, sub_optab, FNADDR, \
1354 plus_constant (TRAMP, 10), \
1355 NULL_RTX, 1, OPTAB_DIRECT); \
1356 emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9)); \
1357 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
1358 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\
1359 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \
1362 /* Definitions for register eliminations.
1364 This is an array of structures. Each structure initializes one pair
1365 of eliminable registers. The "from" register number is given first,
1366 followed by "to". Eliminations of the same "from" register are listed
1367 in order of preference.
1369 We have two registers that can be eliminated on the i386. First, the
1370 frame pointer register can often be eliminated in favor of the stack
1371 pointer register. Secondly, the argument pointer register can always be
1372 eliminated; it is replaced with either the stack or frame pointer. */
1374 #define ELIMINABLE_REGS \
1375 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1376 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1377 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1379 /* Given FROM and TO register numbers, say whether this elimination is allowed.
1380 Frame pointer elimination is automatically handled.
1382 For the i386, if frame pointer elimination is being done, we would like to
1383 convert ap into sp, not fp.
1385 All other eliminations are valid. */
1387 #define CAN_ELIMINATE(FROM, TO) \
1388 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1389 ? ! frame_pointer_needed \
1392 /* Define the offset between two registers, one to be eliminated, and the other
1393 its replacement, at the start of a routine. */
1395 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1397 if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1398 (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \
1403 int preferred_alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; \
1404 HOST_WIDE_INT tsize = ix86_compute_frame_size (get_frame_size (), \
1407 (OFFSET) = (tsize + nregs * UNITS_PER_WORD); \
1410 if (frame_pointer_needed) \
1411 offset += UNITS_PER_WORD; \
1413 if ((FROM) == ARG_POINTER_REGNUM) \
1414 (OFFSET) += offset; \
1416 (OFFSET) -= ((offset + preferred_alignment - 1) \
1417 & -preferred_alignment) - offset; \
1421 /* Addressing modes, and classification of registers for them. */
1423 /* #define HAVE_POST_INCREMENT 0 */
1424 /* #define HAVE_POST_DECREMENT 0 */
1426 /* #define HAVE_PRE_DECREMENT 0 */
1427 /* #define HAVE_PRE_INCREMENT 0 */
1429 /* Macros to check register numbers against specific register classes. */
1431 /* These assume that REGNO is a hard or pseudo reg number.
1432 They give nonzero only if REGNO is a hard reg of the suitable class
1433 or a pseudo reg currently allocated to a suitable hard reg.
1434 Since they use reg_renumber, they are safe only once reg_renumber
1435 has been allocated, which happens in local-alloc.c. */
1437 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1438 ((REGNO) < STACK_POINTER_REGNUM \
1439 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1441 #define REGNO_OK_FOR_BASE_P(REGNO) \
1442 ((REGNO) <= STACK_POINTER_REGNUM \
1443 || (REGNO) == ARG_POINTER_REGNUM \
1444 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1446 #define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1447 #define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1449 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1450 and check its validity for a certain class.
1451 We have two alternate definitions for each of them.
1452 The usual definition accepts all pseudo regs; the other rejects
1453 them unless they have been allocated suitable hard regs.
1454 The symbol REG_OK_STRICT causes the latter definition to be used.
1456 Most source files want to accept pseudo regs in the hope that
1457 they will get allocated to the class that the insn wants them to be in.
1458 Source files for reload pass need to be strict.
1459 After reload, it makes no difference, since pseudo regs have
1460 been eliminated by then. */
1463 /* Non strict versions, pseudos are ok */
1464 #define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1465 (REGNO (X) < STACK_POINTER_REGNUM \
1466 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1468 #define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1469 (REGNO (X) <= STACK_POINTER_REGNUM \
1470 || REGNO (X) == ARG_POINTER_REGNUM \
1471 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1473 #define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
1474 (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1476 /* Strict versions, hard registers only */
1477 #define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1478 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1479 #define REG_OK_FOR_STRREG_STRICT_P(X) \
1480 (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
1482 #ifndef REG_OK_STRICT
1483 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1484 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
1485 #define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
1488 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1489 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
1490 #define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
1493 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1494 that is a valid memory address for an instruction.
1495 The MODE argument is the machine mode for the MEM expression
1496 that wants to use this address.
1498 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1499 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1501 See legitimize_pic_address in i386.c for details as to what
1502 constitutes a legitimate address when -fpic is used. */
1504 #define MAX_REGS_PER_ADDRESS 2
1506 #define CONSTANT_ADDRESS_P(X) \
1507 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1508 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
1510 /* Nonzero if the constant value X is a legitimate general operand.
1511 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1513 #define LEGITIMATE_CONSTANT_P(X) \
1514 (GET_CODE (X) == CONST_DOUBLE ? standard_80387_constant_p (X) : 1)
1516 #ifdef REG_OK_STRICT
1517 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1519 if (legitimate_address_p (MODE, X, 1)) \
1524 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1526 if (legitimate_address_p (MODE, X, 0)) \
1532 /* Try machine-dependent ways of modifying an illegitimate address
1533 to be legitimate. If we find one, return the new, valid address.
1534 This macro is used in only one place: `memory_address' in explow.c.
1536 OLDX is the address as it was before break_out_memory_refs was called.
1537 In some cases it is useful to look at this to decide what needs to be done.
1539 MODE and WIN are passed so that this macro can use
1540 GO_IF_LEGITIMATE_ADDRESS.
1542 It is always safe for this macro to do nothing. It exists to recognize
1543 opportunities to optimize the output.
1545 For the 80386, we handle X+REG by loading X into a register R and
1546 using R+REG. R will go in a general reg and indexing will be used.
1547 However, if REG is a broken-out memory address or multiplication,
1548 nothing needs to be done because REG can certainly go in a general reg.
1550 When -fpic is used, special handling is needed for symbolic references.
1551 See comments by legitimize_pic_address in i386.c for details. */
1553 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1555 (X) = legitimize_address (X, OLDX, MODE); \
1556 if (memory_address_p (MODE, X)) \
1560 #define REWRITE_ADDRESS(x) rewrite_address(x)
1562 /* Nonzero if the constant value X is a legitimate general operand
1563 when generating PIC code. It is given that flag_pic is on and
1564 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1566 #define LEGITIMATE_PIC_OPERAND_P(X) \
1567 (! SYMBOLIC_CONST (X) \
1568 || legitimate_pic_address_disp_p (X))
1570 #define SYMBOLIC_CONST(X) \
1571 (GET_CODE (X) == SYMBOL_REF \
1572 || GET_CODE (X) == LABEL_REF \
1573 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1575 /* Go to LABEL if ADDR (a legitimate address expression)
1576 has an effect that depends on the machine mode it is used for.
1577 On the 80386, only postdecrement and postincrement address depend thus
1578 (the amount of decrement or increment being the length of the operand). */
1579 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1580 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1582 /* Define this macro if references to a symbol must be treated
1583 differently depending on something about the variable or
1584 function named by the symbol (such as what section it is in).
1586 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
1587 so that we may access it directly in the GOT. */
1589 #define ENCODE_SECTION_INFO(DECL) \
1594 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1595 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1597 if (GET_CODE (rtl) == MEM) \
1599 if (TARGET_DEBUG_ADDR \
1600 && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
1602 fprintf (stderr, "Encode %s, public = %d\n", \
1603 IDENTIFIER_POINTER (DECL_NAME (DECL)), \
1604 TREE_PUBLIC (DECL)); \
1607 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1608 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1609 || ! TREE_PUBLIC (DECL)); \
1615 /* The `FINALIZE_PIC' macro serves as a hook to emit these special
1616 codes once the function is being compiled into assembly code, but
1617 not before. (It is not done before, because in the case of
1618 compiling an inline function, it would lead to multiple PIC
1619 prologues being included in functions which used inline functions
1620 and were compiled to assembly language.) */
1622 #define FINALIZE_PIC \
1625 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
1630 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1631 with arguments ARGS is a valid machine specific attribute for DECL.
1632 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1634 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
1635 (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
1637 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1638 with arguments ARGS is a valid machine specific attribute for TYPE.
1639 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1641 #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
1642 (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
1644 /* If defined, a C expression whose value is zero if the attributes on
1645 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1646 two if they are nearly compatible (which causes a warning to be
1649 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1650 (ix86_comp_type_attributes (TYPE1, TYPE2))
1652 /* If defined, a C statement that assigns default attributes to newly
1655 /* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
1657 /* Max number of args passed in registers. If this is more than 3, we will
1658 have problems with ebx (register #4), since it is a caller save register and
1659 is also used as the pic register in ELF. So for now, don't allow more than
1660 3 registers to be passed in registers. */
1662 #define REGPARM_MAX 3
1665 /* Specify the machine mode that this machine uses
1666 for the index in the tablejump instruction. */
1667 #define CASE_VECTOR_MODE Pmode
1669 /* Define as C expression which evaluates to nonzero if the tablejump
1670 instruction expects the table to contain offsets from the address of the
1672 Do not define this if the table should contain absolute addresses. */
1673 /* #define CASE_VECTOR_PC_RELATIVE 1 */
1675 /* Specify the tree operation to be used to convert reals to integers.
1676 This should be changed to take advantage of fist --wfs ??
1678 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1680 /* This is the kind of divide that is easiest to do in the general case. */
1681 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1683 /* Define this as 1 if `char' should by default be signed; else as 0. */
1684 #define DEFAULT_SIGNED_CHAR 1
1686 /* Max number of bytes we can move from memory to memory
1687 in one reasonably fast instruction. */
1690 /* If a memory-to-memory move would take MOVE_RATIO or more simple
1691 move-instruction pairs, we will do a movstr or libcall instead.
1692 Increasing the value will always make code faster, but eventually
1693 incurs high cost in increased code size.
1695 If you don't define this, a reasonable default is used.
1697 Make this large on i386, since the block move is very inefficient with small
1698 blocks, and the hard register needs of the block move require much reload
1701 #define MOVE_RATIO 5
1703 /* Define if shifts truncate the shift count
1704 which implies one can omit a sign-extension or zero-extension
1705 of a shift count. */
1706 /* On i386, shifts do truncate the count. But bit opcodes don't. */
1708 /* #define SHIFT_COUNT_TRUNCATED */
1710 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1711 is done just by pretending it is already truncated. */
1712 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1714 /* We assume that the store-condition-codes instructions store 0 for false
1715 and some other value for true. This is the value stored for true. */
1717 #define STORE_FLAG_VALUE 1
1719 /* When a prototype says `char' or `short', really pass an `int'.
1720 (The 386 can't easily push less than an int.) */
1722 #define PROMOTE_PROTOTYPES 1
1724 /* Specify the machine mode that pointers have.
1725 After generation of rtl, the compiler makes no further distinction
1726 between pointers and any other objects of this machine mode. */
1727 #define Pmode SImode
1729 /* A function address in a call instruction
1730 is a byte address (for indexing purposes)
1731 so give the MEM rtx a byte's mode. */
1732 #define FUNCTION_MODE QImode
1734 /* A part of a C `switch' statement that describes the relative costs
1735 of constant RTL expressions. It must contain `case' labels for
1736 expression codes `const_int', `const', `symbol_ref', `label_ref'
1737 and `const_double'. Each case must ultimately reach a `return'
1738 statement to return the relative cost of the use of that kind of
1739 constant value in an expression. The cost may depend on the
1740 precise value of the constant, which is available for examination
1741 in X, and the rtx code of the expression in which it is contained,
1742 found in OUTER_CODE.
1744 CODE is the expression code--redundant, since it can be obtained
1745 with `GET_CODE (X)'. */
1747 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1749 return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \
1753 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
1755 case CONST_DOUBLE: \
1758 if (GET_MODE (RTX) == VOIDmode) \
1761 code = standard_80387_constant_p (RTX); \
1762 return code == 1 ? 0 : \
1767 /* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
1768 #define TOPLEVEL_COSTS_N_INSNS(N) \
1769 do { total = COSTS_N_INSNS (N); goto egress_rtx_costs; } while (0)
1771 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1772 This can be used, for example, to indicate how costly a multiply
1773 instruction is. In writing this macro, you can use the construct
1774 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1775 instructions. OUTER_CODE is the code of the expression in which X
1778 This macro is optional; do not define it if the default cost
1779 assumptions are adequate for the target machine. */
1781 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1783 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1784 && GET_MODE (XEXP (X, 0)) == SImode) \
1786 HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1788 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1789 if (value == 2 || value == 3) \
1790 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
1792 /* fall through */ \
1798 if (GET_MODE (XEXP (X, 0)) == DImode) \
1800 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1802 if (INTVAL (XEXP (X, 1)) > 32) \
1803 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const + 2); \
1805 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const * 2); \
1809 if (GET_CODE (XEXP (X, 1)) == AND) \
1810 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 2); \
1812 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2); \
1817 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1818 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1820 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_var); \
1825 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1827 unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
1831 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1832 if (value == 4 || value == 8) \
1833 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
1835 while (value != 0) \
1842 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
1844 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1845 + nbits * ix86_cost->mult_bit); \
1847 else /* This is arbitrary */ \
1848 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
1849 + 7 * ix86_cost->mult_bit); \
1855 TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
1858 if (GET_CODE (XEXP (X, 0)) == PLUS \
1859 && GET_CODE (XEXP (XEXP (X, 0), 0)) == MULT \
1860 && GET_CODE (XEXP (XEXP (XEXP (X, 0), 0), 1)) == CONST_INT \
1861 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1863 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 0), 0), 1)); \
1864 if (val == 2 || val == 4 || val == 8) \
1866 return (COSTS_N_INSNS (ix86_cost->lea) \
1867 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1868 + rtx_cost (XEXP (XEXP (XEXP (X, 0), 0), 0), OUTER_CODE) \
1869 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1872 else if (GET_CODE (XEXP (X, 0)) == MULT \
1873 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \
1875 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \
1876 if (val == 2 || val == 4 || val == 8) \
1878 return (COSTS_N_INSNS (ix86_cost->lea) \
1879 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1880 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1883 else if (GET_CODE (XEXP (X, 0)) == PLUS) \
1885 return (COSTS_N_INSNS (ix86_cost->lea) \
1886 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1887 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
1888 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1891 /* fall through */ \
1896 if (GET_MODE (X) == DImode) \
1897 return (COSTS_N_INSNS (ix86_cost->add) * 2 \
1898 + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
1899 << (GET_MODE (XEXP (X, 0)) != DImode)) \
1900 + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
1901 << (GET_MODE (XEXP (X, 1)) != DImode))); \
1903 /* fall through */ \
1906 if (GET_MODE (X) == DImode) \
1907 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2); \
1908 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
1914 /* An expression giving the cost of an addressing mode that contains
1915 ADDRESS. If not defined, the cost is computed from the ADDRESS
1916 expression and the `CONST_COSTS' values.
1918 For most CISC machines, the default cost is a good approximation
1919 of the true cost of the addressing mode. However, on RISC
1920 machines, all instructions normally have the same length and
1921 execution time. Hence all addresses will have equal costs.
1923 In cases where more than one form of an address is known, the form
1924 with the lowest cost will be used. If multiple forms have the
1925 same, lowest, cost, the one that is the most complex will be used.
1927 For example, suppose an address that is equal to the sum of a
1928 register and a constant is used twice in the same basic block.
1929 When this macro is not defined, the address will be computed in a
1930 register and memory references will be indirect through that
1931 register. On machines where the cost of the addressing mode
1932 containing the sum is no higher than that of a simple indirect
1933 reference, this will produce an additional instruction and
1934 possibly require an additional register. Proper specification of
1935 this macro eliminates this overhead for such machines.
1937 Similar use of this macro is made in strength reduction of loops.
1939 ADDRESS need not be valid as an address. In such a case, the cost
1940 is not relevant and can be any value; invalid addresses need not be
1941 assigned a different cost.
1943 On machines where an address involving more than one register is as
1944 cheap as an address computation involving only one register,
1945 defining `ADDRESS_COST' to reflect this can cause two registers to
1946 be live over a region of code where only one would have been if
1947 `ADDRESS_COST' were not defined in that manner. This effect should
1948 be considered in the definition of this macro. Equivalent costs
1949 should probably only be given to addresses with different numbers
1950 of registers on machines with lots of registers.
1952 This macro will normally either not be defined or be defined as a
1955 For i386, it is better to use a complex address than let gcc copy
1956 the address into a reg and make a new pseudo. But not if the address
1957 requires to two regs - that would mean more pseudos with longer
1960 #define ADDRESS_COST(RTX) \
1961 ((CONSTANT_P (RTX) \
1962 || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
1963 && REG_P (XEXP (RTX, 0)))) ? 0 \
1967 /* A C expression for the cost of moving data from a register in class FROM to
1968 one in class TO. The classes are expressed using the enumeration values
1969 such as `GENERAL_REGS'. A value of 2 is the default; other values are
1970 interpreted relative to that.
1972 It is not required that the cost always equal 2 when FROM is the same as TO;
1973 on some machines it is expensive to move between registers if they are not
1976 On the i386, copying between floating-point and fixed-point
1977 registers is done trough memory.
1979 Integer -> fp moves are noticeably slower than the opposite direction
1980 because of the partial memory stall they cause. Give it an
1984 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1985 ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
1986 ? (MEMORY_MOVE_COST (DFmode, CLASS1, 0) \
1987 + MEMORY_MOVE_COST (DFmode, CLASS2, 1)) \
1988 : (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)) ? 10 : 2)
1990 /* A C expression for the cost of moving data of mode M between a
1991 register and memory. A value of 2 is the default; this cost is
1992 relative to those in `REGISTER_MOVE_COST'.
1994 If moving between registers and memory is more expensive than
1995 between two registers, you should define this macro to express the
1998 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
1999 (FLOAT_CLASS_P (CLASS) \
2000 ? (GET_MODE_SIZE (MODE)==4 \
2001 ? (IN ? ix86_cost->fp_load[0] : ix86_cost->fp_store[0]) \
2002 : (GET_MODE_SIZE (MODE)==8 \
2003 ? (IN ? ix86_cost->fp_load[1] : ix86_cost->fp_store[1]) \
2004 : (IN ? ix86_cost->fp_load[2] : ix86_cost->fp_store[2]))) \
2005 : (GET_MODE_SIZE (MODE)==1 \
2006 ? (IN ? ix86_cost->int_load[0] : ix86_cost->int_store[0]) \
2007 : (GET_MODE_SIZE (MODE)==2 \
2008 ? (IN ? ix86_cost->int_load[1] : ix86_cost->int_store[1]) \
2009 : ((IN ? ix86_cost->int_load[2] : ix86_cost->int_store[2]) \
2010 * GET_MODE_SIZE (MODE) / 4))))
2012 /* A C expression for the cost of a branch instruction. A value of 1
2013 is the default; other values are interpreted relative to that. */
2015 #define BRANCH_COST ix86_branch_cost
2017 /* Define this macro as a C expression which is nonzero if accessing
2018 less than a word of memory (i.e. a `char' or a `short') is no
2019 faster than accessing a word of memory, i.e., if such access
2020 require more than one instruction or if there is no difference in
2021 cost between byte and (aligned) word loads.
2023 When this macro is not defined, the compiler will access a field by
2024 finding the smallest containing object; when it is defined, a
2025 fullword load will be used if alignment permits. Unless bytes
2026 accesses are faster than word accesses, using word accesses is
2027 preferable since it may eliminate subsequent memory access if
2028 subsequent accesses occur to other fields in the same word of the
2029 structure, but to different bytes. */
2031 #define SLOW_BYTE_ACCESS 0
2033 /* Nonzero if access to memory by shorts is slow and undesirable. */
2034 #define SLOW_SHORT_ACCESS 0
2036 /* Define this macro if zero-extension (of a `char' or `short' to an
2037 `int') can be done faster if the destination is a register that is
2040 If you define this macro, you must have instruction patterns that
2041 recognize RTL structures like this:
2043 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2045 and likewise for `HImode'. */
2047 /* #define SLOW_ZERO_EXTEND */
2049 /* Define this macro to be the value 1 if unaligned accesses have a
2050 cost many times greater than aligned accesses, for example if they
2051 are emulated in a trap handler.
2053 When this macro is non-zero, the compiler will act as if
2054 `STRICT_ALIGNMENT' were non-zero when generating code for block
2055 moves. This can cause significantly more instructions to be
2056 produced. Therefore, do not set this macro non-zero if unaligned
2057 accesses only add a cycle or two to the time for a memory access.
2059 If the value of this macro is always zero, it need not be defined. */
2061 /* #define SLOW_UNALIGNED_ACCESS 0 */
2063 /* Define this macro to inhibit strength reduction of memory
2064 addresses. (On some machines, such strength reduction seems to do
2065 harm rather than good.) */
2067 /* #define DONT_REDUCE_ADDR */
2069 /* Define this macro if it is as good or better to call a constant
2070 function address than to call an address kept in a register.
2072 Desirable on the 386 because a CALL with a constant address is
2073 faster than one with a register address. */
2075 #define NO_FUNCTION_CSE
2077 /* Define this macro if it is as good or better for a function to call
2078 itself with an explicit address than to call an address kept in a
2081 #define NO_RECURSIVE_FUNCTION_CSE
2083 /* A C statement (sans semicolon) to update the integer variable COST
2084 based on the relationship between INSN that is dependent on
2085 DEP_INSN through the dependence LINK. The default is to make no
2086 adjustment to COST. This can be used for example to specify to
2087 the scheduler that an output- or anti-dependence does not incur
2088 the same cost as a data-dependence. */
2090 #define ADJUST_COST(insn,link,dep_insn,cost) \
2091 (cost) = ix86_adjust_cost(insn, link, dep_insn, cost)
2093 #define ISSUE_RATE \
2096 #define MD_SCHED_INIT(DUMP, SCHED_VERBOSE) \
2097 ix86_sched_init (DUMP, SCHED_VERBOSE)
2099 #define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK, CIM) \
2100 (CIM) = ix86_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK)
2102 #define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \
2103 ((CAN_ISSUE_MORE) = \
2104 ix86_variable_issue (DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE))
2106 /* Add any extra modes needed to represent the condition code.
2108 For the i386, we need separate modes when floating-point
2109 equality comparisons are being done.
2111 Add CCNO to indicate No Overflow, which is often also includes
2112 No Carry. This is typically used on the output of logicals,
2113 and is only valid in comparisons against zero. */
2115 #define EXTRA_CC_MODES \
2116 CC(CCNOmode, "CCNO") \
2117 CC(CCFPmode, "CCFP") \
2118 CC(CCFPUmode, "CCFPU")
2120 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2121 return the mode to be used for the comparison.
2123 For floating-point equality comparisons, CCFPEQmode should be used.
2124 VOIDmode should be used in all other cases.
2126 For integer comparisons against zero, reduce to CCNOmode if
2127 possible, to allow for more combinations. */
2129 #define SELECT_CC_MODE(OP,X,Y) \
2130 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2131 ? (OP) == EQ || (OP) == NE ? CCFPUmode : CCFPmode \
2132 : (OP) == LE || (OP) == GT ? CCmode \
2133 : (Y) != const0_rtx ? CCmode \
2136 /* Control the assembler format that we output, to the extent
2137 this does not vary between assemblers. */
2139 /* How to refer to registers in assembler output.
2140 This sequence is indexed by compiler's hard-register-number (see above). */
2142 /* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
2143 For non floating point regs, the following are the HImode names.
2145 For float regs, the stack top is sometimes referred to as "%st(0)"
2146 instead of just "%st". PRINT_REG handles this with the "y" code. */
2148 #define HI_REGISTER_NAMES \
2149 {"ax","dx","cx","bx","si","di","bp","sp", \
2150 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
2153 #define REGISTER_NAMES HI_REGISTER_NAMES
2155 /* Table of additional register names to use in user input. */
2157 #define ADDITIONAL_REGISTER_NAMES \
2158 { { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \
2159 { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \
2160 { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \
2161 { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }
2163 /* Note we are omitting these since currently I don't know how
2164 to get gcc to use these, since they want the same but different
2165 number as al, and ax.
2168 /* note the last four are not really qi_registers, but
2169 the md will have to never output movb into one of them
2170 only a movw . There is no movb into the last four regs */
2172 #define QI_REGISTER_NAMES \
2173 {"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
2175 /* These parallel the array above, and can be used to access bits 8:15
2176 of regs 0 through 3. */
2178 #define QI_HIGH_REGISTER_NAMES \
2179 {"ah", "dh", "ch", "bh", }
2181 /* How to renumber registers for dbx and gdb. */
2183 /* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
2184 #define DBX_REGISTER_NUMBER(n) \
2195 /* Before the prologue, RA is at 0(%esp). */
2196 #define INCOMING_RETURN_ADDR_RTX \
2197 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
2199 /* After the prologue, RA is at -4(AP) in the current frame. */
2200 #define RETURN_ADDR_RTX(COUNT, FRAME) \
2202 ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -4))\
2203 : gen_rtx_MEM (Pmode, plus_constant (FRAME, 4)))
2205 /* PC is dbx register 8; let's use that column for RA. */
2206 #define DWARF_FRAME_RETURN_COLUMN 8
2208 /* Before the prologue, the top of the frame is at 4(%esp). */
2209 #define INCOMING_FRAME_SP_OFFSET 4
2211 /* This is how to output the definition of a user-level label named NAME,
2212 such as the label on a static function or variable NAME. */
2214 #define ASM_OUTPUT_LABEL(FILE,NAME) \
2215 (assemble_name (FILE, NAME), fputs (":\n", FILE))
2217 /* This is how to output an assembler line defining a `double' constant. */
2219 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2221 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
2222 fprintf (FILE, "%s\t0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
2225 /* This is how to output a `long double' extended real constant. */
2227 #undef ASM_OUTPUT_LONG_DOUBLE
2228 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2230 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
2231 fprintf (FILE, "%s\t0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
2234 /* This is how to output an assembler line defining a `float' constant. */
2236 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2238 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
2239 fprintf ((FILE), "%s\t0x%lx\n", ASM_LONG, l); \
2242 /* Store in OUTPUT a string (made with alloca) containing
2243 an assembler-name for a local static variable named NAME.
2244 LABELNO is an integer which is different for each call. */
2246 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2247 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2248 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2250 /* This is how to output an assembler line defining an `int' constant. */
2252 #define ASM_OUTPUT_INT(FILE,VALUE) \
2253 ( fprintf (FILE, "%s\t", ASM_LONG), \
2254 output_addr_const (FILE,(VALUE)), \
2257 /* Likewise for `char' and `short' constants. */
2258 /* is this supposed to do align too?? */
2260 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2261 ( fprintf (FILE, "%s\t", ASM_SHORT), \
2262 output_addr_const (FILE,(VALUE)), \
2265 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2266 ( fprintf (FILE, "%s\t", ASM_BYTE_OP), \
2267 output_addr_const (FILE, (VALUE)), \
2270 /* This is how to output an assembler line for a numeric constant byte. */
2272 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2273 asm_fprintf ((FILE), "%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
2275 /* This is how to output an insn to push a register on the stack.
2276 It need not be very fast code. */
2278 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
2279 asm_fprintf (FILE, "\tpush{l}\t%%e%s\n", reg_names[REGNO])
2281 /* This is how to output an insn to pop a register from the stack.
2282 It need not be very fast code. */
2284 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
2285 asm_fprintf (FILE, "\tpop{l}\t%%e%s\n", reg_names[REGNO])
2287 /* This is how to output an element of a case-vector that is absolute.
2290 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2291 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
2293 /* This is how to output an element of a case-vector that is relative.
2294 We don't use these on the 386 yet, because the ATT assembler can't do
2295 forward reference the differences.
2298 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
2299 fprintf (FILE, "\t%s\t%s%d-%s%d\n",ASM_LONG, LPREFIX, VALUE, LPREFIX, REL)
2301 /* Define the parentheses used to group arithmetic operations
2302 in assembler code. */
2304 #define ASM_OPEN_PAREN ""
2305 #define ASM_CLOSE_PAREN ""
2307 /* Define results of standard character escape sequences. */
2308 #define TARGET_BELL 007
2309 #define TARGET_BS 010
2310 #define TARGET_TAB 011
2311 #define TARGET_NEWLINE 012
2312 #define TARGET_VT 013
2313 #define TARGET_FF 014
2314 #define TARGET_CR 015
2316 /* Print operand X (an rtx) in assembler syntax to file FILE.
2317 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2318 The CODE z takes the size of operand from the following digit, and
2319 outputs b,w,or l respectively.
2321 On the 80386, we use several such letters:
2322 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
2323 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
2324 R -- print the prefix for register names.
2325 z -- print the opcode suffix for the size of the current operand.
2326 * -- print a star (in certain assembler syntax)
2327 P -- if PIC, print an @PLT suffix.
2328 X -- don't print any sort of PIC '@' suffix for a symbol.
2329 s -- ??? something to do with double shifts. not actually used, afaik.
2330 C -- print a conditional move suffix corresponding to the op code.
2331 c -- likewise, but reverse the condition.
2332 F,f -- likewise, but for floating-point. */
2334 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2337 /* Print the name of a register based on its machine mode and number.
2338 If CODE is 'w', pretend the mode is HImode.
2339 If CODE is 'b', pretend the mode is QImode.
2340 If CODE is 'k', pretend the mode is SImode.
2341 If CODE is 'h', pretend the reg is the `high' byte register.
2342 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
2344 #define PRINT_REG(X, CODE, FILE) \
2345 print_reg (X, CODE, FILE)
2347 #define PRINT_OPERAND(FILE, X, CODE) \
2348 print_operand (FILE, X, CODE)
2350 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
2351 print_operand_address (FILE, ADDR)
2353 /* Print the name of a register for based on its machine mode and number.
2354 This macro is used to print debugging output.
2355 This macro is different from PRINT_REG in that it may be used in
2356 programs that are not linked with aux-output.o. */
2358 #define DEBUG_PRINT_REG(X, CODE, FILE) \
2359 do { static char *hi_name[] = HI_REGISTER_NAMES; \
2360 static char *qi_name[] = QI_REGISTER_NAMES; \
2361 fprintf (FILE, "%d ", REGNO (X)); \
2362 if (REGNO (X) == FLAGS_REG) \
2363 { fputs ("flags", FILE); break; } \
2364 if (REGNO (X) == FPSR_REG) \
2365 { fputs ("fpsr", FILE); break; } \
2366 if (REGNO (X) == ARG_POINTER_REGNUM) \
2367 { fputs ("argp", FILE); break; } \
2368 if (STACK_TOP_P (X)) \
2369 { fputs ("st(0)", FILE); break; } \
2371 { fputs (hi_name[REGNO(X)], FILE); break; } \
2372 switch (GET_MODE_SIZE (GET_MODE (X))) \
2375 fputs ("e", FILE); \
2377 fputs (hi_name[REGNO (X)], FILE); \
2380 fputs (qi_name[REGNO (X)], FILE); \
2385 /* Routines in libgcc that return floats must return them in an fp reg,
2386 just as other functions do which return such values.
2387 These macros make that happen. */
2389 #define FLOAT_VALUE_TYPE float
2390 #define INTIFY(FLOATVAL) FLOATVAL
2392 /* a letter which is not needed by the normal asm syntax, which
2393 we can use for operand syntax in the extended asm */
2395 #define ASM_OPERAND_LETTER '#'
2396 #define RET return ""
2397 #define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx))
2399 /* Define the codes that are matched by predicates in i386.c. */
2401 #define PREDICATE_CODES \
2402 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2403 {"pic_symbolic_operand", {CONST}}, \
2404 {"call_insn_operand", {MEM}}, \
2405 {"expander_call_insn_operand", {MEM}}, \
2406 {"constant_call_address_operand", {MEM}}, \
2407 {"const0_operand", {CONST_INT, CONST_DOUBLE}}, \
2408 {"const1_operand", {CONST_INT}}, \
2409 {"const248_operand", {CONST_INT}}, \
2410 {"incdec_operand", {CONST_INT}}, \
2411 {"reg_no_sp_operand", {SUBREG, REG}}, \
2412 {"q_regs_operand", {SUBREG, REG}}, \
2413 {"non_q_regs_operand", {SUBREG, REG}}, \
2414 {"no_comparison_operator", {EQ, NE, LT, GE, LTU, GTU, LEU, GEU}}, \
2415 {"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU}}, \
2416 {"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}}, \
2417 {"ext_register_operand", {SUBREG, REG}}, \
2418 {"binary_fp_operator", {PLUS, MINUS, MULT, DIV}}, \
2419 {"mult_operator", {MULT}}, \
2420 {"div_operator", {DIV}}, \
2421 {"arith_or_logical_operator", {PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, \
2422 UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
2423 UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
2424 LSHIFTRT, ROTATERT}}, \
2425 {"memory_displacement_operand", {MEM}}, \
2426 {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
2427 LABEL_REF, SUBREG, REG, MEM, AND}}, \
2428 {"long_memory_operand", {MEM}},
2430 /* A list of predicates that do special things with modes, and so
2431 should not elicit warnings for VOIDmode match_operand. */
2433 #define SPECIAL_MODE_PREDICATES \
2434 "ext_register_operand",
2436 /* Variables in i386.c */
2437 extern const char *ix86_cpu_string; /* for -mcpu=<xxx> */
2438 extern const char *ix86_arch_string; /* for -march=<xxx> */
2439 extern const char *ix86_reg_alloc_order; /* register allocation order */
2440 extern const char *ix86_regparm_string; /* # registers to use to pass args */
2441 extern const char *ix86_align_loops_string; /* power of two alignment for loops */
2442 extern const char *ix86_align_jumps_string; /* power of two alignment for non-loop jumps */
2443 extern const char *ix86_align_funcs_string; /* power of two alignment for functions */
2444 extern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
2445 extern const char *ix86_branch_cost_string; /* values 1-5: see jump.c */
2446 extern int ix86_regparm; /* ix86_regparm_string as a number */
2447 extern int ix86_align_loops; /* power of two alignment for loops */
2448 extern int ix86_align_jumps; /* power of two alignment for non-loop jumps */
2449 extern int ix86_align_funcs; /* power of two alignment for functions */
2450 extern int ix86_preferred_stack_boundary; /* preferred stack boundary alignment in bits */
2451 extern int ix86_branch_cost; /* values 1-5: see jump.c */
2452 extern const char * const hi_reg_name[]; /* names for 16 bit regs */
2453 extern const char * const qi_reg_name[]; /* names for 8 bit regs (low) */
2454 extern const char * const qi_high_reg_name[]; /* names for 8 bit regs (high) */
2455 extern enum reg_class const regclass_map[]; /* smalled class containing REGNO */
2456 extern struct rtx_def *ix86_compare_op0; /* operand 0 for comparisons */
2457 extern struct rtx_def *ix86_compare_op1; /* operand 1 for comparisons */