]> gcc.gnu.org Git - gcc.git/blob - gcc/config/mips/mips.h
f7df3a038c17bd34f1411c6491f397338539fea0
[gcc.git] / gcc / config / mips / mips.h
1 /* Definitions of target machine for GNU compiler. MIPS version.
2 Contributed by A. Lichnewsky, lich@inria.inria.fr
3 Changed by Michael Meissner, meissner@osf.org
4 Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21
22
23 /* Make Saber happier on obstack.[ch]. */
24 #if defined(__mips__) || defined(mips)
25 #define __PTR_TO_INT(P) ((int)(P))
26 #define __INT_TO_PTR(P) ((char *)(P))
27 #endif
28
29 /* Standard GCC variables that we reference. */
30
31 extern char *asm_file_name;
32 extern char call_used_regs[];
33 extern int current_function_calls_alloca;
34 extern int flag_omit_frame_pointer;
35 extern int frame_pointer_needed;
36 extern char *language_string;
37 extern int may_call_alloca;
38 extern int optimize;
39 extern char **save_argv;
40 extern int target_flags;
41 extern char *version_string;
42
43 /* MIPS external variables defined in mips.c. */
44
45 /* comparison type */
46 enum cmp_type {
47 CMP_SI, /* compare integers */
48 CMP_SF, /* compare single precision floats */
49 CMP_DF, /* compare double precision floats */
50 CMP_MAX /* max comparison type */
51 };
52
53 /* types of delay slot */
54 enum delay_type {
55 DELAY_NONE, /* no delay slot */
56 DELAY_LOAD, /* load from memory delay */
57 DELAY_HILO, /* move from/to hi/lo registers */
58 DELAY_FCMP /* delay after doing c.<xx>.{d,s} */
59 };
60
61 /* Which processor to schedule for. Since there is no difference between
62 a R2000 and R3000 in terms of the scheduler, we collapse them into
63 just an R3000. The elements of the enumeration must match exactly
64 the cpu attribute in the mips.md machine description. */
65
66 enum processor_type {
67 PROCESSOR_DEFAULT,
68 PROCESSOR_R3000,
69 PROCESSOR_R6000,
70 PROCESSOR_R4000
71 };
72
73 /* Recast the cpu class to be the cpu attribute. */
74 #define mips_cpu_attr ((enum attr_cpu)mips_cpu)
75
76 /* Which type of block move to do (whether or not the last store is
77 split out so it can fill a branch delay slot). */
78
79 enum block_move_type {
80 BLOCK_MOVE_NORMAL, /* generate complete block move */
81 BLOCK_MOVE_NOT_LAST, /* generate all but last store */
82 BLOCK_MOVE_LAST /* generate just the last store */
83 };
84
85 extern char mips_reg_names[][8]; /* register names (a0 vs. $4). */
86 extern char mips_print_operand_punct[]; /* print_operand punctuation chars */
87 extern char *current_function_name; /* current function being compiled */
88 extern char *current_function_file; /* filename current function is in */
89 extern int num_source_filenames; /* current .file # */
90 extern int inside_function; /* != 0 if inside of a function */
91 extern int ignore_line_number; /* != 0 if we are to ignore next .loc */
92 extern int file_in_function_warning; /* warning given about .file in func */
93 extern int sdb_label_count; /* block start/end next label # */
94 extern int mips_section_threshold; /* # bytes of data/sdata cutoff */
95 extern int g_switch_value; /* value of the -G xx switch */
96 extern int g_switch_set; /* whether -G xx was passed. */
97 extern int sym_lineno; /* sgi next label # for each stmt */
98 extern int set_noreorder; /* # of nested .set noreorder's */
99 extern int set_nomacro; /* # of nested .set nomacro's */
100 extern int set_noat; /* # of nested .set noat's */
101 extern int set_volatile; /* # of nested .set volatile's */
102 extern int mips_branch_likely; /* emit 'l' after br (branch likely) */
103 extern int mips_dbx_regno[]; /* Map register # to debug register # */
104 extern char mips_rtx_classify[]; /* classify an RTX code */
105 extern struct rtx_def *branch_cmp[2]; /* operands for compare */
106 extern enum cmp_type branch_type; /* what type of branch to use */
107 extern enum processor_type mips_cpu; /* which cpu are we scheduling for */
108 extern int mips_isa; /* architectural level */
109 extern char *mips_cpu_string; /* for -mcpu=<xxx> */
110 extern char *mips_isa_string; /* for -mips{1,2,3} */
111 extern int dslots_load_total; /* total # load related delay slots */
112 extern int dslots_load_filled; /* # filled load delay slots */
113 extern int dslots_jump_total; /* total # jump related delay slots */
114 extern int dslots_jump_filled; /* # filled jump delay slots */
115 extern int dslots_number_nops; /* # of nops needed by previous insn */
116 extern int num_refs[3]; /* # 1/2/3 word references */
117 extern struct rtx_def *mips_load_reg; /* register to check for load delay */
118 extern struct rtx_def *mips_load_reg2; /* 2nd reg to check for load delay */
119 extern struct rtx_def *mips_load_reg3; /* 3rd reg to check for load delay */
120 extern struct rtx_def *mips_load_reg4; /* 4th reg to check for load delay */
121
122 /* Functions within mips.c that we reference. */
123
124 extern void abort_with_insn ();
125 extern int arith32_operand ();
126 extern int arith_operand ();
127 extern int cmp_op ();
128 extern int cmp2_op ();
129 extern unsigned long compute_frame_size ();
130 extern void expand_block_move ();
131 extern int equality_op ();
132 extern int fcmp_op ();
133 extern void final_prescan_insn ();
134 extern int fpsw_register_operand ();
135 extern struct rtx_def * function_arg ();
136 extern void function_arg_advance ();
137 extern int function_arg_partial_nregs ();
138 extern void function_epilogue ();
139 extern void function_prologue ();
140 extern void gen_conditional_branch ();
141 extern struct rtx_def * gen_int_relational ();
142 extern void init_cumulative_args ();
143 extern int large_int ();
144 extern int md_register_operand ();
145 extern int mips_address_cost ();
146 extern void mips_asm_file_end ();
147 extern void mips_asm_file_start ();
148 extern int mips_const_double_ok ();
149 extern void mips_count_memory_refs ();
150 extern int mips_debugger_offset ();
151 extern void mips_declare_object ();
152 extern int mips_epilogue_delay_slots ();
153 extern void mips_expand_epilogue ();
154 extern void mips_expand_prologue ();
155 extern char *mips_fill_delay_slot ();
156 extern char *mips_move_1word ();
157 extern char *mips_move_2words ();
158 extern void mips_output_double ();
159 extern int mips_output_external ();
160 extern void mips_output_float ();
161 extern void mips_output_filename ();
162 extern void mips_output_lineno ();
163 extern char *output_block_move ();
164 extern void override_options ();
165 extern int pc_or_label_operand ();
166 extern void print_operand_address ();
167 extern void print_operand ();
168 extern void print_options ();
169 extern int reg_or_0_operand ();
170 extern int simple_epilogue_p ();
171 extern int simple_memory_operand ();
172 extern int small_int ();
173 extern void trace();
174 extern int uns_arith_operand ();
175 extern int uns_cmp_op ();
176
177 /* Recognition functions that return if a condition is true. */
178 extern int address_operand ();
179 extern int const_double_operand ();
180 extern int const_int_operand ();
181 extern int general_operand ();
182 extern int immediate_operand ();
183 extern int memory_address_p ();
184 extern int memory_operand ();
185 extern int nonimmediate_operand ();
186 extern int nonmemory_operand ();
187 extern int register_operand ();
188 extern int scratch_operand ();
189
190 /* Functions to change what output section we are using. */
191 extern void data_section ();
192 extern void rdata_section ();
193 extern void readonly_data_section ();
194 extern void sdata_section ();
195 extern void text_section ();
196
197 /* Functions in the rest of the compiler that we reference. */
198 extern void abort_with_insn ();
199 extern void debug_rtx ();
200 extern void fatal_io_error ();
201 extern int get_frame_size ();
202 extern int offsettable_address_p ();
203 extern void output_address ();
204 extern char *permalloc ();
205 extern int reg_mentioned_p ();
206
207 /* Functions in the standard library that we reference. */
208 extern void abort ();
209 extern int atoi ();
210 extern char *getenv ();
211 extern char *mktemp ();
212
213
214 /* Stubs for half-pic support if not OSF/1 reference platform. */
215
216 #ifndef HALF_PIC_P
217 #define HALF_PIC_P() 0
218 #define HALF_PIC_NUMBER_PTRS 0
219 #define HALF_PIC_NUMBER_REFS 0
220 #define HALF_PIC_ENCODE(DECL)
221 #define HALF_PIC_DECLARE(NAME)
222 #define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
223 #define HALF_PIC_ADDRESS_P(X) 0
224 #define HALF_PIC_PTR(X) X
225 #define HALF_PIC_FINISH(STREAM)
226 #endif
227
228 \f
229 /* Switch Recognition by gcc.c. Add -G xx support */
230
231 #ifdef SWITCH_TAKES_ARG
232 #undef SWITCH_TAKES_ARG
233 #endif
234
235 #define SWITCH_TAKES_ARG(CHAR) \
236 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
237 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
238 || (CHAR) == 'I' || (CHAR) == 'm' \
239 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G')
240
241 /* Sometimes certain combinations of command options do not make sense
242 on a particular target machine. You can define a macro
243 `OVERRIDE_OPTIONS' to take account of this. This macro, if
244 defined, is executed once just after all the command options have
245 been parsed.
246
247 On the MIPS, it is used to handle -G. We also use it to set up all
248 of the tables referenced in the other macros. */
249
250 #define OVERRIDE_OPTIONS override_options ()
251
252 /* Zero or more C statements that may conditionally modify two
253 variables `fixed_regs' and `call_used_regs' (both of type `char
254 []') after they have been initialized from the two preceding
255 macros.
256
257 This is necessary in case the fixed or call-clobbered registers
258 depend on target flags.
259
260 You need not define this macro if it has no work to do.
261
262 If the usage of an entire class of registers depends on the target
263 flags, you may indicate this to GCC by using this macro to modify
264 `fixed_regs' and `call_used_regs' to 1 for each of the registers in
265 the classes which should not be used by GCC. Also define the macro
266 `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
267 letter for a class that shouldn't be used.
268
269 (However, if this class is not included in `GENERAL_REGS' and all
270 of the insn patterns whose constraints permit this class are
271 controlled by target switches, then GCC will automatically avoid
272 using these registers when the target switches are opposed to
273 them.) */
274
275 #define CONDITIONAL_REGISTER_USAGE \
276 do \
277 { \
278 if (!TARGET_HARD_FLOAT) \
279 { \
280 int regno; \
281 \
282 for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno++) \
283 fixed_regs[regno] = call_used_regs[regno] = 1; \
284 } \
285 } \
286 while (0)
287
288
289 /* Some machines may desire to change what optimizations are
290 performed for various optimization levels. This macro, if
291 defined, is executed once just after the optimization level is
292 determined and before the remainder of the command options have
293 been parsed. Values set in this macro are used as the default
294 values for the other command line options.
295
296 LEVEL is the optimization level specified; 2 if -O2 is
297 specified, 1 if -O is specified, and 0 if neither is specified. */
298
299 #define OPTIMIZATION_OPTIONS(LEVEL) \
300 { \
301 flag_no_function_cse = TRUE; \
302 flag_gnu_linker = FALSE; \
303 \
304 if (LEVEL) \
305 { \
306 flag_omit_frame_pointer = TRUE; \
307 flag_delayed_branch = TRUE; \
308 flag_thread_jumps = TRUE; \
309 flag_schedule_insns_after_reload = TRUE; \
310 } \
311 \
312 if (LEVEL >= 2) \
313 { \
314 flag_strength_reduce = TRUE; \
315 flag_cse_follow_jumps = TRUE; \
316 flag_expensive_optimizations = TRUE; \
317 flag_rerun_cse_after_loop = TRUE; \
318 flag_schedule_insns = TRUE; \
319 } \
320 \
321 if (LEVEL >= 3) \
322 { \
323 flag_inline_functions = TRUE; \
324 } \
325 }
326
327 \f
328
329 /* Complain about missing specs and predefines that should be defined in each
330 of the target tm files to override the defaults. This is mostly a place-
331 holder until I can get each of the files updated [mm]. */
332
333 #if defined(OSF_OS) \
334 || defined(DECSTATION) \
335 || defined(SGI_TARGET) \
336 || defined(MIPS_NEWS) \
337 || defined(MIPS_SYSV) \
338 || defined(MIPS_SVR4) \
339 || defined(MIPS_BSD43)
340
341 #ifndef CPP_PREDEFINES
342 #error "Define CPP_PREDEFINES in the appropriate tm.h file"
343 #endif
344
345 #ifndef CPP_SPEC
346 #error "Define CPP_SPEC in the appropriate tm.h file"
347 #endif
348
349 #ifndef LINK_SPEC
350 #error "Define LINK_SPEC in the appropriate tm.h file"
351 #endif
352
353 #ifndef LIB_SPEC
354 #error "Define LIB_SPEC in the appropriate tm.h file"
355 #endif
356
357 #ifndef STARTFILE_SPEC
358 #error "Define STARTFILE_SPEC in the appropriate tm.h file"
359 #endif
360
361 #ifndef MACHINE_TYPE
362 #error "Define MACHINE_TYPE in the appropriate tm.h file"
363 #endif
364 #endif
365
366 /* Tell collect what flags to pass to nm. */
367 #ifndef NM_FLAGS
368 #define NM_FLAGS "-Bp"
369 #endif
370
371 \f
372 /* Names to predefine in the preprocessor for this target machine. */
373
374 #ifndef CPP_PREDEFINES
375 #define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43"
376 #endif
377
378 /* Extra switches sometimes passed to the assembler. */
379
380 #ifndef ASM_SPEC
381 #define ASM_SPEC "\
382 %{!mgas: \
383 %{!mrnames: %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}}} \
384 %{pipe: %e-pipe is not supported.} \
385 %{EB} %{!EB:-EB} \
386 %{EL: %e-EL not supported} \
387 %{mips1} %{mips2} %{mips3} \
388 %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
389 %{g} %{g0} %{g1} %{g2} %{g3} %{v} %{K}} \
390 %{G*}"
391
392 #endif /* ASM_SPEC */
393
394 /* Specify to run a post-processor, mips-tfile after the assembler
395 has run to stuff the mips debug information into the object file.
396 This is needed because the $#!%^ MIPS assembler provides no way
397 of specifying such information in the assembly file. */
398
399 #ifndef ASM_FINAL_SPEC
400 #define ASM_FINAL_SPEC "\
401 %{!mgas: %{!mno-mips-tfile: \
402 \n mips-tfile %{v*: -v} \
403 %{K: -I %b.o~} \
404 %{!K: %{save-temps: -I %b.o~}} \
405 %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
406 %{.s:%i} %{!.s:%g.s}}}"
407 #endif
408
409 /* Redefinition of libraries used. Mips doesn't support normal
410 UNIX style profiling via calling _mcount. It does offer
411 profiling that samples the PC, so do what we can... */
412
413 #ifndef LIB_SPEC
414 #define LIB_SPEC "%{pg:-lprof1} %{p:-lprof1} -lc"
415 #endif
416
417 /* Extra switches sometimes passed to the linker. */
418
419 #ifndef LINK_SPEC
420 #define LINK_SPEC "\
421 %{G*} \
422 %{!mgas: \
423 %{pipe: %e-pipe is not supported.} \
424 %{EB} %{!EB:-EB} \
425 %{EL: %e-EL not supported} \
426 %{mips1} %{mips2} %{mips3} \
427 %{bestGnum} %{shared} %{non_shared}}"
428 #endif /* LINK_SPEC defined */
429
430 /* Define this macro meaning that `gcc' should find the library
431 `libgcc.a' by hand, rather than passing the argument `-lgcc' to
432 tell the linker to do the search. */
433
434 #define LINK_LIBGCC_SPECIAL 1
435
436 /* Specs for the compiler proper */
437
438 #ifndef CC1_SPEC
439 #define CC1_SPEC "\
440 %{O*: %{!mno-gpOPT:%{!mno-gpopt: -mgpopt}}} \
441 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
442 %{G*} \
443 %{pic-none: -mno-half-pic} \
444 %{pic-lib: -mhalf-pic} \
445 %{pic-extern: -mhalf-pic} \
446 %{pic-calls: -mhalf-pic} \
447 %{save-temps: }"
448 #endif
449
450 /* Preprocessor specs */
451
452 #ifndef CPP_SPEC
453 #define CPP_SPEC "\
454 %{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
455 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
456 %{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
457 %{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C} \
458 %{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
459 %{!.S: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
460 #endif
461
462 /* If defined, this macro is an additional prefix to try after
463 `STANDARD_EXEC_PREFIX'. */
464
465 #ifndef MD_EXEC_PREFIX
466 #define MD_EXEC_PREFIX "/usr/lib/cmplrs/cc/"
467 #endif
468
469 #ifndef MD_STARTFILE_PREFIX
470 #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
471 #endif
472
473 \f
474 /* Print subsidiary information on the compiler version in use. */
475
476 #define MIPS_VERSION "[AL 1.1, MM 25]"
477
478 #ifndef MACHINE_TYPE
479 #define MACHINE_TYPE "BSD Mips"
480 #endif
481
482 #ifndef TARGET_VERSION_INTERNAL
483 #define TARGET_VERSION_INTERNAL(STREAM) \
484 fprintf (STREAM, " %s %s", MIPS_VERSION, MACHINE_TYPE)
485 #endif
486
487 #ifndef TARGET_VERSION
488 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
489 #endif
490
491 \f
492 #define SDB_DEBUGGING_INFO /* generate info for mips-tfile */
493 #define DBX_DEBUGGING_INFO /* generate stabs (OSF/rose) */
494 #define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */
495
496 #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
497 #define PREFERRED_DEBUGGING_TYPE ((len > 1 && !strncmp (str, "ggdb", len)) ? DBX_DEBUG : SDB_DEBUG)
498 #endif
499
500 /* By default, turn on GDB extensions. */
501 #define DEFAULT_GDB_EXTENSIONS 1
502
503 /* If we are passing smuggling stabs through the MIPS ECOFF object
504 format, put a comment in front of the .stab<x> operation so
505 that the MIPS assembler does not choke. The mips-tfile program
506 will correctly put the stab into the object file. */
507
508 #define ASM_STABS_OP ((TARGET_GAS) ? ".stabs" : " #.stabs")
509 #define ASM_STABN_OP ((TARGET_GAS) ? ".stabn" : " #.stabn")
510 #define ASM_STABD_OP ((TARGET_GAS) ? ".stabd" : " #.stabd")
511
512 /* Forward references to tags are allowed. */
513 #define SDB_ALLOW_FORWARD_REFERENCES
514
515 /* Unknown tags are also allowed. */
516 #define SDB_ALLOW_UNKNOWN_REFERENCES
517
518 /* On Sun 4, this limit is 2048. We use 1500 to be safe,
519 since the length can run past this up to a continuation point. */
520 #define DBX_CONTIN_LENGTH 1500
521
522
523 /* How to renumber registers for dbx and gdb. */
524 #define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[ (REGNO) ]
525
526
527 /* Overrides for the COFF debug format. */
528 #define PUT_SDB_SCL(a) \
529 do { \
530 extern FILE *asm_out_text_file; \
531 fprintf (asm_out_text_file, "\t.scl\t%d;", (a)); \
532 } while (0)
533
534 #define PUT_SDB_INT_VAL(a) \
535 do { \
536 extern FILE *asm_out_text_file; \
537 fprintf (asm_out_text_file, "\t.val\t%d;", (a)); \
538 } while (0)
539
540 #define PUT_SDB_VAL(a) \
541 do { \
542 extern FILE *asm_out_text_file; \
543 fputs ("\t.val\t", asm_out_text_file); \
544 output_addr_const (asm_out_text_file, (a)); \
545 fputc (';', asm_out_text_file); \
546 } while (0)
547
548 #define PUT_SDB_DEF(a) \
549 do { \
550 extern FILE *asm_out_text_file; \
551 fprintf (asm_out_text_file, "\t#.def\t"); \
552 ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
553 fputc (';', asm_out_text_file); \
554 } while (0)
555
556 #define PUT_SDB_PLAIN_DEF(a) \
557 do { \
558 extern FILE *asm_out_text_file; \
559 fprintf (asm_out_text_file, "\t#.def\t.%s;", (a)); \
560 } while (0)
561
562 #define PUT_SDB_ENDEF \
563 do { \
564 extern FILE *asm_out_text_file; \
565 fprintf (asm_out_text_file, "\t.endef\n"); \
566 } while (0)
567
568 #define PUT_SDB_TYPE(a) \
569 do { \
570 extern FILE *asm_out_text_file; \
571 fprintf (asm_out_text_file, "\t.type\t0x%x;", (a)); \
572 } while (0)
573
574 #define PUT_SDB_SIZE(a) \
575 do { \
576 extern FILE *asm_out_text_file; \
577 fprintf (asm_out_text_file, "\t.size\t%d;", (a)); \
578 } while (0)
579
580 #define PUT_SDB_DIM(a) \
581 do { \
582 extern FILE *asm_out_text_file; \
583 fprintf (asm_out_text_file, "\t.dim\t%d;", (a)); \
584 } while (0)
585
586 #ifndef PUT_SDB_START_DIM
587 #define PUT_SDB_START_DIM \
588 do { \
589 extern FILE *asm_out_text_file; \
590 fprintf (asm_out_text_file, "\t.dim\t"); \
591 } while (0)
592 #endif
593
594 #ifndef PUT_SDB_NEXT_DIM
595 #define PUT_SDB_NEXT_DIM(a) \
596 do { \
597 extern FILE *asm_out_text_file; \
598 fprintf (asm_out_text_file, "%d,", a); \
599 } while (0)
600 #endif
601
602 #ifndef PUT_SDB_LAST_DIM
603 #define PUT_SDB_LAST_DIM(a) \
604 do { \
605 extern FILE *asm_out_text_file; \
606 fprintf (asm_out_text_file, "%d;", a); \
607 } while (0)
608 #endif
609
610 #define PUT_SDB_TAG(a) \
611 do { \
612 extern FILE *asm_out_text_file; \
613 fprintf (asm_out_text_file, "\t.tag\t"); \
614 ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
615 fputc (';', asm_out_text_file); \
616 } while (0)
617
618 /* For block start and end, we create labels, so that
619 later we can figure out where the correct offset is.
620 The normal .ent/.end serve well enough for functions,
621 so those are just commented out. */
622
623 #define PUT_SDB_BLOCK_START(LINE) \
624 do { \
625 extern FILE *asm_out_text_file; \
626 fprintf (asm_out_text_file, \
627 "$Lb%d:\n\t#.begin\t$Lb%d\t%d\n", \
628 sdb_label_count, \
629 sdb_label_count, \
630 (LINE)); \
631 sdb_label_count++; \
632 } while (0)
633
634 #define PUT_SDB_BLOCK_END(LINE) \
635 do { \
636 extern FILE *asm_out_text_file; \
637 fprintf (asm_out_text_file, \
638 "$Le%d:\n\t#.bend\t$Le%d\t%d\n", \
639 sdb_label_count, \
640 sdb_label_count, \
641 (LINE)); \
642 sdb_label_count++; \
643 } while (0)
644
645 #define PUT_SDB_FUNCTION_START(LINE)
646
647 #define PUT_SDB_FUNCTION_END(LINE)
648
649 #define PUT_SDB_EPILOGUE_END(NAME)
650
651 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
652 sprintf ((BUFFER), ".%dfake", (NUMBER));
653
654 /* Correct the offset of automatic variables and arguments. Note that
655 the MIPS debug format wants all automatic variables and arguments
656 to be in terms of the virtual frame pointer (stack pointer before
657 any adjustment in the function), while the MIPS 3.0 linker wants
658 the frame pointer to be the stack pointer after the initial
659 adjustment. */
660
661 #define DEBUGGER_AUTO_OFFSET(X) mips_debugger_offset (X, 0)
662 #define DEBUGGER_ARG_OFFSET(OFFSET, X) mips_debugger_offset (X, OFFSET)
663
664
665 /* Tell collect that the object format is ECOFF */
666 #ifndef OBJECT_FORMAT_ROSE
667 #define OBJECT_FORMAT_COFF /* Object file looks like COFF */
668 #define EXTENDED_COFF /* ECOFF, not normal coff */
669 #endif
670
671 /* Don't use the default definitions, because we don't have gld.
672 Also, we don't want stabs when generating ECOFF output.
673 Instead we depend on collect to handle these. */
674
675 #define ASM_OUTPUT_CONSTRUCTOR(file, name)
676 #define ASM_OUTPUT_DESTRUCTOR(file, name)
677
678 \f
679 /* Run-time compilation parameters selecting different hardware subsets. */
680
681 /* Macros used in the machine description to test the flags. */
682
683 /* Bits for real switches */
684 #define MASK_INT64 0x00000001 /* ints are 64 bits */
685 #define MASK_LONG64 0x00000002 /* longs are 64 bits */
686 #define MASK_LLONG128 0x00000004 /* long longs are 128 bits */
687 #define MASK_GPOPT 0x00000008 /* Optimize for global pointer */
688 #define MASK_GAS 0x00000010 /* Gas used instead of MIPS as */
689 #define MASK_NAME_REGS 0x00000020 /* Use MIPS s/w reg name convention */
690 #define MASK_STATS 0x00000040 /* print statistics to stderr */
691 #define MASK_MEMCPY 0x00000080 /* call memcpy instead of inline code*/
692 #define MASK_SOFT_FLOAT 0x00000100 /* software floating point */
693 #define MASK_FLOAT64 0x00000200 /* fp registers are 64 bits */
694 #define MASK_ABICALLS 0x00000400 /* emit .abicalls/.cprestore/.cpload */
695 #define MASK_HALF_PIC 0x00000800 /* Emit OSF-style pic refs to externs*/
696 #define MASK_UNUSED1 0x00001000
697 #define MASK_UNUSED2 0x00002000
698 #define MASK_UNUSED3 0x00004000
699 #define MASK_UNUSED4 0x00008000
700 #define MASK_UNUSED5 0x00010000
701 #define MASK_UNUSED6 0x00020000
702 #define MASK_UNUSED7 0x00040000
703 #define MASK_UNUSED8 0x00080000
704
705 /* Dummy switches used only in spec's*/
706 #define MASK_MIPS_TFILE 0x00000000 /* flag for mips-tfile usage */
707
708 /* switches not used yet */
709 #define MASK_WC8 0x00000000 /* wchar's are 8 bits, not 32 */
710 #define MASK_WC16 0x00000000 /* wchar's are 16 bits, not 32 */
711 #define MASK_WC32 0x00000000 /* dummy for consistency */
712
713 /* Debug switches, not documented */
714 #define MASK_DEBUG 0x40000000 /* Eliminate version # in .s file */
715 #define MASK_DEBUG_A 0x20000000 /* don't allow <label>($reg) addrs */
716 #define MASK_DEBUG_B 0x10000000 /* GO_IF_LEGITIMATE_ADDRESS debug */
717 #define MASK_DEBUG_C 0x08000000 /* don't expand seq, etc. */
718 #define MASK_DEBUG_D 0x04000000 /* don't do define_split's */
719 #define MASK_DEBUG_E 0x02000000 /* function_arg debug */
720 #define MASK_DEBUG_F 0x01000000 /* don't try to suppress load nop's */
721 #define MASK_DEBUG_G 0x00800000 /* don't support 64 bit arithmetic */
722 #define MASK_DEBUG_H 0x00400000 /* allow ints in FP registers */
723 #define MASK_DEBUG_I 0x00200000 /* unused */
724 #define MASK_DEBUG_J 0x00100000 /* unused */
725
726 /* r4000 64 bit sizes */
727 #define TARGET_INT64 (target_flags & MASK_INT64)
728 #define TARGET_LONG64 (target_flags & MASK_LONG64)
729 #define TARGET_LLONG128 (target_flags & MASK_LLONG128)
730 #define TARGET_FLOAT64 (target_flags & MASK_FLOAT64)
731
732 /* Mips vs. GNU assembler */
733 #define TARGET_GAS (target_flags & MASK_GAS)
734 #define TARGET_UNIX_ASM (!TARGET_GAS)
735 #define TARGET_MIPS_AS TARGET_UNIX_ASM
736
737 /* Debug Mode */
738 #define TARGET_DEBUG_MODE (target_flags & MASK_DEBUG)
739 #define TARGET_DEBUG_A_MODE (target_flags & MASK_DEBUG_A)
740 #define TARGET_DEBUG_B_MODE (target_flags & MASK_DEBUG_B)
741 #define TARGET_DEBUG_C_MODE (target_flags & MASK_DEBUG_C)
742 #define TARGET_DEBUG_D_MODE (target_flags & MASK_DEBUG_D)
743 #define TARGET_DEBUG_E_MODE (target_flags & MASK_DEBUG_E)
744 #define TARGET_DEBUG_F_MODE (target_flags & MASK_DEBUG_F)
745 #define TARGET_DEBUG_G_MODE (target_flags & MASK_DEBUG_G)
746 #define TARGET_DEBUG_H_MODE (target_flags & MASK_DEBUG_H)
747 #define TARGET_DEBUG_I_MODE (target_flags & MASK_DEBUG_I)
748 #define TARGET_DEBUG_J_MODE (target_flags & MASK_DEBUG_J)
749
750 /* Reg. Naming in .s ($21 vs. $a0) */
751 #define TARGET_NAME_REGS (target_flags & MASK_NAME_REGS)
752
753 /* Optimize for Sdata/Sbss */
754 #define TARGET_GP_OPT (target_flags & MASK_GPOPT)
755
756 /* print program statistics */
757 #define TARGET_STATS (target_flags & MASK_STATS)
758
759 /* call memcpy instead of inline code */
760 #define TARGET_MEMCPY (target_flags & MASK_MEMCPY)
761
762 /* .abicalls, etc from Pyramid V.4 */
763 #define TARGET_ABICALLS (target_flags & MASK_ABICALLS)
764
765 /* OSF pic references to externs */
766 #define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)
767
768 /* wchar size */
769 #define TARGET_WC8 (target_flags & MASK_WC8)
770 #define TARGET_WC16 (target_flags & MASK_WC16)
771 #define TARGET_WC32 ((target_flags & (MASK_WC8 | MASK_WC16)) == 0)
772
773 /* software floating point */
774 #define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
775 #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
776
777 /* Macro to define tables used to set the flags.
778 This is a list in braces of pairs in braces,
779 each pair being { "NAME", VALUE }
780 where VALUE is the bits to set or minus the bits to clear.
781 An empty string NAME is used to identify the default VALUE. */
782
783 #define TARGET_SWITCHES \
784 { \
785 {"int64", MASK_INT64 | MASK_LONG64}, \
786 {"long64", MASK_LONG64}, \
787 {"longlong128", MASK_INT64 | MASK_LONG64 | MASK_LLONG128}, \
788 {"mips-as", -MASK_GAS}, \
789 {"gas", MASK_GAS}, \
790 {"rnames", MASK_NAME_REGS}, \
791 {"no-rnames", -MASK_NAME_REGS}, \
792 {"gpOPT", MASK_GPOPT}, \
793 {"gpopt", MASK_GPOPT}, \
794 {"no-gpOPT", -MASK_GPOPT}, \
795 {"no-gpopt", -MASK_GPOPT}, \
796 {"stats", MASK_STATS}, \
797 {"no-stats", -MASK_STATS}, \
798 {"memcpy", MASK_MEMCPY}, \
799 {"no-memcpy", -MASK_MEMCPY}, \
800 {"wc8", MASK_WC8}, \
801 {"wc16", MASK_WC16}, \
802 {"wc32", MASK_WC32}, \
803 {"mips-tfile", MASK_MIPS_TFILE}, \
804 {"no-mips-tfile", -MASK_MIPS_TFILE}, \
805 {"soft-float", MASK_SOFT_FLOAT}, \
806 {"hard-float", -MASK_SOFT_FLOAT}, \
807 {"fp64", MASK_FLOAT64}, \
808 {"fp32", -MASK_FLOAT64}, \
809 {"abicalls", MASK_ABICALLS}, \
810 {"no-abicalls", -MASK_ABICALLS}, \
811 {"half-pic", MASK_HALF_PIC}, \
812 {"no-half-pic", -MASK_HALF_PIC}, \
813 {"debug", MASK_DEBUG}, \
814 {"debuga", MASK_DEBUG_A}, \
815 {"debugb", MASK_DEBUG_B}, \
816 {"debugc", MASK_DEBUG_C}, \
817 {"debugd", MASK_DEBUG_D}, \
818 {"debuge", MASK_DEBUG_E}, \
819 {"debugf", MASK_DEBUG_F}, \
820 {"debugg", MASK_DEBUG_G}, \
821 {"debugh", MASK_DEBUG_H}, \
822 {"debugi", MASK_DEBUG_I}, \
823 {"debugj", MASK_DEBUG_J}, \
824 {"", TARGET_DEFAULT} \
825 }
826
827 /* Default target_flags if no switches are specified */
828
829 #ifndef TARGET_DEFAULT
830 #define TARGET_DEFAULT 0
831 #endif
832
833 /* This macro is similar to `TARGET_SWITCHES' but defines names of
834 command options that have values. Its definition is an
835 initializer with a subgrouping for each command option.
836
837 Each subgrouping contains a string constant, that defines the
838 fixed part of the option name, and the address of a variable.
839 The variable, type `char *', is set to the variable part of the
840 given option if the fixed part matches. The actual option name
841 is made by appending `-m' to the specified name.
842
843 Here is an example which defines `-mshort-data-NUMBER'. If the
844 given option is `-mshort-data-512', the variable `m88k_short_data'
845 will be set to the string `"512"'.
846
847 extern char *m88k_short_data;
848 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
849
850 #define TARGET_OPTIONS \
851 { \
852 { "cpu=", &mips_cpu_string }, \
853 { "ips", &mips_isa_string } \
854 }
855
856 /* Macros to decide whether certain features are available or not,
857 depending on the instruction set architecture level. */
858
859 #define BRANCH_LIKELY_P() (mips_isa >= 2)
860 #define HAVE_64BIT_P() (mips_isa >= 3)
861 #define HAVE_SQRT_P() (mips_isa >= 2)
862
863 \f
864 /* Target machine storage layout */
865
866 /* Define this if most significant bit is lowest numbered
867 in instructions that operate on numbered bit-fields.
868 */
869 /* #define BITS_BIG_ENDIAN */
870
871 /* Define this if most significant byte of a word is the lowest numbered. */
872 #ifndef BYTES_BIG_ENDIAN
873 #ifndef DECSTATION
874 #define BYTES_BIG_ENDIAN 1
875 #else
876 #define BYTES_BIG_ENDIAN 0
877 #endif
878 #endif
879
880 /* Define this if most significant word of a multiword number is the lowest. */
881 #ifndef WORDS_BIG_ENDIAN
882 #ifndef DECSTATION
883 #define WORDS_BIG_ENDIAN 1
884 #else
885 #define WORDS_BIG_ENDIAN 0
886 #endif
887 #endif
888
889 /* Define macros to easily access the most and least significant words
890 without a lot of #ifdef's. */
891
892 #if WORDS_BIG_ENDIAN
893 #define MOST_SIGNIFICANT_WORD 0
894 #define LEAST_SIGNIFICANT_WORD 1
895
896 #else
897 #define MOST_SIGNIFICANT_WORD 1
898 #define LEAST_SIGNIFICANT_WORD 0
899 #endif
900
901 /* Number of bits in an addressable storage unit */
902 #define BITS_PER_UNIT 8
903
904 /* Width in bits of a "word", which is the contents of a machine register.
905 Note that this is not necessarily the width of data type `int';
906 if using 16-bit ints on a 68000, this would still be 32.
907 But on a machine with 16-bit registers, this would be 16. */
908 #define BITS_PER_WORD 32
909
910 /* Width of a word, in units (bytes). */
911 #define UNITS_PER_WORD 4
912
913 /* A C expression for the size in bits of the type `int' on the
914 target machine. If you don't define this, the default is one
915 word. */
916 #define INT_TYPE_SIZE 32
917
918 /* A C expression for the size in bits of the type `short' on the
919 target machine. If you don't define this, the default is half a
920 word. (If this would be less than one storage unit, it is
921 rounded up to one unit.) */
922 #define SHORT_TYPE_SIZE 16
923
924 /* A C expression for the size in bits of the type `long' on the
925 target machine. If you don't define this, the default is one
926 word. */
927 #define LONG_TYPE_SIZE 32
928
929 /* A C expression for the size in bits of the type `long long' on the
930 target machine. If you don't define this, the default is two
931 words. */
932 #define LONG_LONG_TYPE_SIZE 64
933
934 /* A C expression for the size in bits of the type `char' on the
935 target machine. If you don't define this, the default is one
936 quarter of a word. (If this would be less than one storage unit,
937 it is rounded up to one unit.) */
938 #define CHAR_TYPE_SIZE BITS_PER_UNIT
939
940 /* A C expression for the size in bits of the type `float' on the
941 target machine. If you don't define this, the default is one
942 word. */
943 #define FLOAT_TYPE_SIZE 32
944
945 /* A C expression for the size in bits of the type `double' on the
946 target machine. If you don't define this, the default is two
947 words. */
948 #define DOUBLE_TYPE_SIZE 64
949
950 /* A C expression for the size in bits of the type `long double' on
951 the target machine. If you don't define this, the default is two
952 words. */
953 #define LONG_DOUBLE_TYPE_SIZE 64
954
955 /* Width in bits of a pointer.
956 See also the macro `Pmode' defined below. */
957 #define POINTER_SIZE 32
958
959 /* Allocation boundary (in *bits*) for storing pointers in memory. */
960 #define POINTER_BOUNDARY 32
961
962 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
963 #define PARM_BOUNDARY 32
964
965 /* Allocation boundary (in *bits*) for the code of a function. */
966 #define FUNCTION_BOUNDARY 32
967
968 /* Alignment of field after `int : 0' in a structure. */
969 #define EMPTY_FIELD_BOUNDARY 32
970
971 /* Every structure's size must be a multiple of this. */
972 /* 8 is observed right on a DECstation and on riscos 4.02. */
973 #define STRUCTURE_SIZE_BOUNDARY 8
974
975 /* There is no point aligning anything to a rounder boundary than this. */
976 #define BIGGEST_ALIGNMENT 64
977
978 /* Biggest alignment any structure field can require in bits. */
979 #define BIGGEST_FIELD_ALIGNMENT 64
980
981 /* Set this nonzero if move instructions will actually fail to work
982 when given unaligned data. */
983 #define STRICT_ALIGNMENT 1
984
985 /* Define this if you wish to imitate the way many other C compilers
986 handle alignment of bitfields and the structures that contain
987 them.
988
989 The behavior is that the type written for a bitfield (`int',
990 `short', or other integer type) imposes an alignment for the
991 entire structure, as if the structure really did contain an
992 ordinary field of that type. In addition, the bitfield is placed
993 within the structure so that it would fit within such a field,
994 not crossing a boundary for it.
995
996 Thus, on most machines, a bitfield whose type is written as `int'
997 would not cross a four-byte boundary, and would force four-byte
998 alignment for the whole structure. (The alignment used may not
999 be four bytes; it is controlled by the other alignment
1000 parameters.)
1001
1002 If the macro is defined, its definition should be a C expression;
1003 a nonzero value for the expression enables this behavior. */
1004
1005 #define PCC_BITFIELD_TYPE_MATTERS 1
1006
1007 /* If defined, a C expression to compute the alignment given to a
1008 constant that is being placed in memory. CONSTANT is the constant
1009 and ALIGN is the alignment that the object would ordinarily have.
1010 The value of this macro is used instead of that alignment to align
1011 the object.
1012
1013 If this macro is not defined, then ALIGN is used.
1014
1015 The typical use of this macro is to increase alignment for string
1016 constants to be word aligned so that `strcpy' calls that copy
1017 constants can be done inline. */
1018
1019 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
1020 ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
1021 && (ALIGN) < BITS_PER_WORD \
1022 ? BITS_PER_WORD \
1023 : (ALIGN))
1024
1025 /* If defined, a C expression to compute the alignment for a static
1026 variable. TYPE is the data type, and ALIGN is the alignment that
1027 the object would ordinarily have. The value of this macro is used
1028 instead of that alignment to align the object.
1029
1030 If this macro is not defined, then ALIGN is used.
1031
1032 One use of this macro is to increase alignment of medium-size
1033 data to make it all fit in fewer cache lines. Another is to
1034 cause character arrays to be word-aligned so that `strcpy' calls
1035 that copy constants to character arrays can be done inline. */
1036
1037 #undef DATA_ALIGNMENT
1038 #define DATA_ALIGNMENT(TYPE, ALIGN) \
1039 ((((ALIGN) < BITS_PER_WORD) \
1040 && (TREE_CODE (TYPE) == ARRAY_TYPE \
1041 || TREE_CODE (TYPE) == UNION_TYPE \
1042 || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
1043
1044 /* Define this macro if an argument declared as `char' or `short' in a
1045 prototype should actually be passed as an `int'. In addition to
1046 avoiding errors in certain cases of mismatch, it also makes for
1047 better code on certain machines. */
1048
1049 #define PROMOTE_PROTOTYPES
1050
1051 /* Define this macro if an instruction to load a value narrower
1052 than a word from memory into a register also zero-extends the
1053 value to the whole register. */
1054
1055 #define BYTE_LOADS_ZERO_EXTEND
1056
1057 \f
1058 /* Standard register usage. */
1059
1060 /* Number of actual hardware registers.
1061 The hardware registers are assigned numbers for the compiler
1062 from 0 to just below FIRST_PSEUDO_REGISTER.
1063 All registers that the compiler knows about must be given numbers,
1064 even those that are not normally considered general registers.
1065
1066 On the Mips, we have 32 integer registers, 32 floating point registers
1067 and the special registers hi, lo, and fp status. */
1068
1069 #define FIRST_PSEUDO_REGISTER 67
1070
1071 /* 1 for registers that have pervasive standard uses
1072 and are not available for the register allocator.
1073
1074 On the MIPS, see conventions, page D-2 */
1075
1076 #define FIXED_REGISTERS \
1077 { \
1078 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
1079 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \
1080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
1081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
1082 1, 1, 1 \
1083 }
1084
1085
1086 /* 1 for registers not available across function calls.
1087 These must include the FIXED_REGISTERS and also any
1088 registers that can be used without being saved.
1089 The latter must include the registers where values are returned
1090 and the register where structure-value addresses are passed.
1091 Aside from that, you can include as many other registers as you like. */
1092
1093 #define CALL_USED_REGISTERS \
1094 { \
1095 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1096 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, \
1097 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1098 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
1099 1, 1, 1 \
1100 }
1101
1102
1103 /* Internal macros to classify a register number as to whether it's a
1104 general purpose register, a floating point register, a
1105 multiply/divide register, or a status register.
1106
1107 The macro FP_CALL_REG_P also allows registers $4 and $6 as floating
1108 point registers to pass floating point as per MIPS spec. */
1109
1110 #define GP_REG_FIRST 0
1111 #define GP_REG_LAST 31
1112 #define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)
1113 #define GP_DBX_FIRST 0
1114
1115 #define FP_REG_FIRST 32
1116 #define FP_REG_LAST 63
1117 #define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1)
1118 #define FP_DBX_FIRST ((write_symbols == DBX_DEBUG) ? 38 : 32)
1119
1120 #define MD_REG_FIRST 64
1121 #define MD_REG_LAST 65
1122 #define MD_REG_NUM (MD_REG_LAST - MD_REG_FIRST + 1)
1123
1124 #define ST_REG_FIRST 66
1125 #define ST_REG_LAST 66
1126 #define ST_REG_NUM (ST_REG_LAST - ST_REG_FIRST + 1)
1127
1128 #define AT_REGNUM (GP_REG_FIRST + 1)
1129 #define HI_REGNUM (MD_REG_FIRST + 0)
1130 #define LO_REGNUM (MD_REG_FIRST + 1)
1131 #define FPSW_REGNUM ST_REG_FIRST
1132
1133 #define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)
1134 #define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)
1135 #define MD_REG_P(REGNO) ((unsigned) ((REGNO) - MD_REG_FIRST) < MD_REG_NUM)
1136 #define ST_REG_P(REGNO) ((REGNO) == ST_REG_FIRST)
1137
1138 #define FP_CALL_REG_P(REGNO) \
1139 (FP_REG_P (REGNO) \
1140 || (REGNO) == (4 + GP_REG_FIRST) \
1141 || (REGNO) == (6 + GP_REG_FIRST))
1142
1143 /* Return number of consecutive hard regs needed starting at reg REGNO
1144 to hold something of mode MODE.
1145 This is ordinarily the length in words of a value of mode MODE
1146 but can be less for certain modes in special long registers.
1147
1148 On the MIPS, all general registers are one word long. Except on
1149 the R4000 with the FR bit set, the floating point uses register
1150 pairs, with the second register not being allocatable. */
1151
1152 #define HARD_REGNO_NREGS(REGNO, MODE) \
1153 (! FP_REG_P (REGNO) \
1154 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) \
1155 : (((GET_MODE_SIZE (MODE) + (2*UNITS_PER_WORD) - 1) / (2*UNITS_PER_WORD)) \
1156 << (TARGET_FLOAT64 == 0)))
1157
1158 /* Value is 1 if hard register REGNO can hold a value of machine-mode
1159 MODE. Require that DImode and DFmode be in even registers. For
1160 DImode, this makes some of the insns easier to write, since you
1161 don't have to worry about a DImode value in registers 3 & 4,
1162 producing a result in 4 & 5.
1163
1164 To make the code simpler HARD_REGNO_MODE_OK now just references an
1165 array built in override_options. Because machmodes.h is not yet
1166 included before this file is processed, the MODE bound can't be
1167 expressed here. */
1168
1169 extern char mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
1170
1171 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
1172 mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ]
1173
1174 /* Value is 1 if it is a good idea to tie two pseudo registers
1175 when one has mode MODE1 and one has mode MODE2.
1176 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
1177 for any hard reg, then this must be 0 for correct output. */
1178 #define MODES_TIEABLE_P(MODE1, MODE2) \
1179 ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \
1180 GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
1181 == (GET_MODE_CLASS (MODE2) == MODE_FLOAT || \
1182 GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
1183
1184 /* MIPS pc is not overloaded on a register. */
1185 /* #define PC_REGNUM xx */
1186
1187 /* Register to use for pushing function arguments. */
1188 #define STACK_POINTER_REGNUM (GP_REG_FIRST + 29)
1189
1190 /* Offset from the stack pointer to the first available location. */
1191 #define STACK_POINTER_OFFSET 0
1192
1193 /* Base register for access to local variables of the function. */
1194 #define FRAME_POINTER_REGNUM (GP_REG_FIRST + 30)
1195
1196 /* Value should be nonzero if functions must have frame pointers.
1197 Zero means the frame pointer need not be set up (and parms
1198 may be accessed via the stack pointer) in functions that seem suitable.
1199 This is computed in `reload', in reload1.c. */
1200 #define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
1201
1202 /* Base register for access to arguments of the function. */
1203 #define ARG_POINTER_REGNUM GP_REG_FIRST
1204
1205 /* Register in which static-chain is passed to a function. */
1206 #define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2)
1207
1208 /* Register in which address to store a structure value
1209 is passed to a function. */
1210 #define STRUCT_VALUE_REGNUM (GP_REG_FIRST + 4)
1211
1212 /* Mips registers used in prologue/epilogue code when the stack frame
1213 is larger than 32K bytes. These registers must come from the
1214 scratch register set, and not used for passing and returning
1215 arguments and any other information used in the calling sequence
1216 (such as pic). */
1217 #define MIPS_TEMP1_REGNUM (GP_REG_FIRST + 8)
1218 #define MIPS_TEMP2_REGNUM (GP_REG_FIRST + 9)
1219
1220 /* Define this macro if it is as good or better to call a constant
1221 function address than to call an address kept in a register. */
1222 #define NO_FUNCTION_CSE 1
1223
1224 /* Define this macro if it is as good or better for a function to
1225 call itself with an explicit address than to call an address
1226 kept in a register. */
1227 #define NO_RECURSIVE_FUNCTION_CSE 1
1228
1229 /* The register number of the register used to address a table of
1230 static data addresses in memory. In some cases this register is
1231 defined by a processor's "application binary interface" (ABI).
1232 When this macro is defined, RTL is generated for this register
1233 once, as with the stack pointer and frame pointer registers. If
1234 this macro is not defined, it is up to the machine-dependent
1235 files to allocate such a register (if necessary). */
1236 #define PIC_OFFSET_TABLE_REGNUM (GP_REG_FIRST + 28)
1237
1238 \f
1239 /* Define the classes of registers for register constraints in the
1240 machine description. Also define ranges of constants.
1241
1242 One of the classes must always be named ALL_REGS and include all hard regs.
1243 If there is more than one class, another class must be named NO_REGS
1244 and contain no registers.
1245
1246 The name GENERAL_REGS must be the name of a class (or an alias for
1247 another name such as ALL_REGS). This is the class of registers
1248 that is allowed by "g" or "r" in a register constraint.
1249 Also, registers outside this class are allocated only when
1250 instructions express preferences for them.
1251
1252 The classes must be numbered in nondecreasing order; that is,
1253 a larger-numbered class must never be contained completely
1254 in a smaller-numbered class.
1255
1256 For any two classes, it is very desirable that there be another
1257 class that represents their union. */
1258
1259 enum reg_class
1260 {
1261 NO_REGS, /* no registers in set */
1262 GR_REGS, /* integer registers */
1263 FP_REGS, /* floating point registers */
1264 HI_REG, /* hi register */
1265 LO_REG, /* lo register */
1266 MD_REGS, /* multiply/divide registers (hi/lo) */
1267 ST_REGS, /* status registers (fp status) */
1268 ALL_REGS, /* all registers */
1269 LIM_REG_CLASSES /* max value + 1 */
1270 };
1271
1272 #define N_REG_CLASSES (int) LIM_REG_CLASSES
1273
1274 #define GENERAL_REGS GR_REGS
1275
1276 /* An initializer containing the names of the register classes as C
1277 string constants. These names are used in writing some of the
1278 debugging dumps. */
1279
1280 #define REG_CLASS_NAMES \
1281 { \
1282 "NO_REGS", \
1283 "GR_REGS", \
1284 "FP_REGS", \
1285 "HI_REG", \
1286 "LO_REG", \
1287 "MD_REGS", \
1288 "ST_REGS", \
1289 "ALL_REGS" \
1290 }
1291
1292 /* An initializer containing the contents of the register classes,
1293 as integers which are bit masks. The Nth integer specifies the
1294 contents of class N. The way the integer MASK is interpreted is
1295 that register R is in the class if `MASK & (1 << R)' is 1.
1296
1297 When the machine has more than 32 registers, an integer does not
1298 suffice. Then the integers are replaced by sub-initializers,
1299 braced groupings containing several integers. Each
1300 sub-initializer must be suitable as an initializer for the type
1301 `HARD_REG_SET' which is defined in `hard-reg-set.h'. */
1302
1303 #define REG_CLASS_CONTENTS \
1304 { \
1305 { 0x00000000, 0x00000000, 0x00000000 }, /* no registers */ \
1306 { 0xffffffff, 0x00000000, 0x00000000 }, /* integer registers */ \
1307 { 0x00000000, 0xffffffff, 0x00000000 }, /* floating registers*/ \
1308 { 0x00000000, 0x00000000, 0x00000001 }, /* hi register */ \
1309 { 0x00000000, 0x00000000, 0x00000002 }, /* lo register */ \
1310 { 0x00000000, 0x00000000, 0x00000003 }, /* mul/div registers */ \
1311 { 0x00000000, 0x00000000, 0x00000004 }, /* status registers */ \
1312 { 0xffffffff, 0xffffffff, 0x00000007 } /* all registers */ \
1313 }
1314
1315
1316 /* A C expression whose value is a register class containing hard
1317 register REGNO. In general there is more that one such class;
1318 choose a class which is "minimal", meaning that no smaller class
1319 also contains the register. */
1320
1321 extern enum reg_class mips_regno_to_class[];
1322
1323 #define REGNO_REG_CLASS(REGNO) mips_regno_to_class[ (REGNO) ]
1324
1325 /* A macro whose definition is the name of the class to which a
1326 valid base register must belong. A base register is one used in
1327 an address which is the register value plus a displacement. */
1328
1329 #define BASE_REG_CLASS GR_REGS
1330
1331 /* A macro whose definition is the name of the class to which a
1332 valid index register must belong. An index register is one used
1333 in an address where its value is either multiplied by a scale
1334 factor or added to another register (as well as added to a
1335 displacement). */
1336
1337 #define INDEX_REG_CLASS GR_REGS
1338
1339
1340 /* REGISTER AND CONSTANT CLASSES */
1341
1342 /* Get reg_class from a letter such as appears in the machine
1343 description.
1344
1345 DEFINED REGISTER CLASSES:
1346
1347 'd' General (aka integer) registers
1348 'f' Floating point registers
1349 'h' Hi register
1350 'l' Lo register
1351 'x' Multiply/divide registers
1352 'z' FP Status register */
1353
1354 extern enum reg_class mips_char_to_class[];
1355
1356 #define REG_CLASS_FROM_LETTER(C) mips_char_to_class[ (C) ]
1357
1358 /* The letters I, J, K, L, M, N, O, and P in a register constraint
1359 string can be used to stand for particular ranges of immediate
1360 operands. This macro defines what the ranges are. C is the
1361 letter, and VALUE is a constant value. Return 1 if VALUE is
1362 in the range specified by C. */
1363
1364 /* For MIPS:
1365
1366 `I' is used for the range of constants an arithmetic insn can
1367 actually contain (16 bits signed integers).
1368
1369 `J' is used for the range which is just zero (ie, $r0).
1370
1371 `K' is used for the range of constants a logical insn can actually
1372 contain (16 bit zero-extended integers).
1373
1374 `L' is used for the range of constants that be loaded with lui
1375 (ie, the bottom 16 bits are zero).
1376
1377 `M' is used for the range of constants that take two words to load
1378 (ie, not matched by `I', `K', and `L').
1379
1380 `N' is used for negative 16 bit constants.
1381
1382 `O' is an exact power of 2 (not yet used in the md file).
1383
1384 `P' is used for positive 16 bit constants. */
1385
1386 #define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x8000) < 0x10000)
1387 #define SMALL_INT_UNSIGNED(X) ((unsigned) (INTVAL (X)) < 0x10000)
1388
1389 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1390 ((C) == 'I' ? ((unsigned) ((VALUE) + 0x8000) < 0x10000) \
1391 : (C) == 'J' ? ((VALUE) == 0) \
1392 : (C) == 'K' ? ((unsigned) (VALUE) < 0x10000) \
1393 : (C) == 'L' ? (((VALUE) & 0xffff0000) == (VALUE)) \
1394 : (C) == 'M' ? ((((VALUE) & ~0x0000ffff) != 0) \
1395 && (((VALUE) & ~0x0000ffff) != ~0x0000ffff) \
1396 && ((VALUE) & 0x0000ffff) != 0) \
1397 : (C) == 'N' ? (((VALUE) & ~0x0000ffff) == ~0x0000ffff) \
1398 : (C) == 'O' ? (exact_log2 (VALUE) >= 0) \
1399 : (C) == 'P' ? ((VALUE) != 0 && (((VALUE) & ~0x0000ffff) == 0)) \
1400 : 0)
1401
1402 /* Similar, but for floating constants, and defining letters G and H.
1403 Here VALUE is the CONST_DOUBLE rtx itself. */
1404
1405 /* For Mips
1406
1407 'G' : Floating point 0 */
1408
1409 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1410 ((C) == 'G' \
1411 && CONST_DOUBLE_HIGH (VALUE) == 0 \
1412 && CONST_DOUBLE_LOW (VALUE) == 0)
1413
1414 /* Letters in the range `Q' through `U' may be defined in a
1415 machine-dependent fashion to stand for arbitrary operand types.
1416 The machine description macro `EXTRA_CONSTRAINT' is passed the
1417 operand as its first argument and the constraint letter as its
1418 second operand.
1419
1420 `Q' is for memory references which take more than 1 instruction.
1421 `R' is for memory references which take 1 word for the instruction.
1422 `S' is for references to extern items which are PIC for OSF/rose. */
1423
1424 #define EXTRA_CONSTRAINT(OP,CODE) \
1425 ((GET_CODE (OP) != MEM) ? FALSE \
1426 : ((CODE) == 'Q') ? !simple_memory_operand (OP, GET_MODE (OP)) \
1427 : ((CODE) == 'R') ? simple_memory_operand (OP, GET_MODE (OP)) \
1428 : ((CODE) == 'S') ? (HALF_PIC_P () && CONSTANT_P (OP) \
1429 && HALF_PIC_ADDRESS_P (OP)) \
1430 : FALSE)
1431
1432 /* Given an rtx X being reloaded into a reg required to be
1433 in class CLASS, return the class of reg to actually use.
1434 In general this is just CLASS; but on some machines
1435 in some cases it is preferable to use a more restrictive class. */
1436
1437 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1438 ((GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1439 || GET_MODE_CLASS (GET_MODE (X)) == MODE_COMPLEX_FLOAT) \
1440 ? (TARGET_SOFT_FLOAT ? GR_REGS : FP_REGS) \
1441 : ((GET_MODE (X) == VOIDmode) \
1442 ? GR_REGS \
1443 : CLASS))
1444
1445 /* Certain machines have the property that some registers cannot be
1446 copied to some other registers without using memory. Define this
1447 macro on those machines to be a C expression that is non-zero if
1448 objects of mode MODE in registers of CLASS1 can only be copied to
1449 registers of class CLASS2 by storing a register of CLASS1 into
1450 memory and loading that memory location into a register of CLASS2.
1451
1452 Do not define this macro if its value would always be zero. */
1453
1454 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
1455 (!TARGET_DEBUG_H_MODE \
1456 && GET_MODE_CLASS (MODE) == MODE_INT \
1457 && ((CLASS1 == FP_REGS && CLASS2 == GR_REGS) \
1458 || (CLASS1 == GR_REGS && CLASS2 == FP_REGS)))
1459
1460 /* Return the maximum number of consecutive registers
1461 needed to represent mode MODE in a register of class CLASS. */
1462
1463 #define CLASS_MAX_NREGS(CLASS, MODE) \
1464 ((((MODE) == DFmode) || ((MODE) == SFmode)) ? 2 \
1465 : ((MODE) == VOIDmode)? ((CLASS) == FP_REGS ? 2 : 1) \
1466 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1467
1468 /* If defined, this is a C expression whose value should be
1469 nonzero if the insn INSN has the effect of mysteriously
1470 clobbering the contents of hard register number REGNO. By
1471 "mysterious" we mean that the insn's RTL expression doesn't
1472 describe such an effect.
1473
1474 If this macro is not defined, it means that no insn clobbers
1475 registers mysteriously. This is the usual situation; all else
1476 being equal, it is best for the RTL expression to show all the
1477 activity. */
1478
1479 /* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) */
1480
1481 \f
1482 /* Stack layout; function entry, exit and calling. */
1483
1484 /* Define this if pushing a word on the stack
1485 makes the stack pointer a smaller address. */
1486 #define STACK_GROWS_DOWNWARD
1487
1488 /* Define this if the nominal address of the stack frame
1489 is at the high-address end of the local variables;
1490 that is, each additional local variable allocated
1491 goes at a more negative offset in the frame. */
1492 /* #define FRAME_GROWS_DOWNWARD */
1493
1494 /* Offset within stack frame to start allocating local variables at.
1495 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1496 first local allocated. Otherwise, it is the offset to the BEGINNING
1497 of the first local allocated. */
1498 #define STARTING_FRAME_OFFSET current_function_outgoing_args_size
1499
1500 /* Offset from the stack pointer register to an item dynamically
1501 allocated on the stack, e.g., by `alloca'.
1502
1503 The default value for this macro is `STACK_POINTER_OFFSET' plus the
1504 length of the outgoing arguments. The default is correct for most
1505 machines. See `function.c' for details.
1506
1507 The MIPS 3.0 linker does not like functions that dynamically
1508 allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it
1509 looks like we are trying to create a second frame pointer to the
1510 function, so allocate some stack space to make it happy. */
1511
1512 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
1513 ((current_function_outgoing_args_size == 0 && current_function_calls_alloca) \
1514 ? 4*UNITS_PER_WORD \
1515 : current_function_outgoing_args_size)
1516
1517 /* Structure to be filled in by compute_frame_size with register
1518 save masks, and offsets for the current function. */
1519
1520 struct mips_frame_info
1521 {
1522 unsigned long total_size; /* # bytes that the entire frame takes up */
1523 unsigned long var_size; /* # bytes that variables take up */
1524 unsigned long args_size; /* # bytes that outgoing arguments take up */
1525 unsigned long extra_size; /* # bytes of extra gunk */
1526 unsigned int gp_reg_size; /* # bytes needed to store gp regs */
1527 unsigned int fp_reg_size; /* # bytes needed to store fp regs */
1528 unsigned long mask; /* mask of saved gp registers */
1529 unsigned long fmask; /* mask of saved fp registers */
1530 long gp_save_offset; /* offset from vfp to store gp registers */
1531 long fp_save_offset; /* offset from vfp to store fp registers */
1532 unsigned long gp_sp_offset; /* offset from new sp to store gp registers */
1533 unsigned long fp_sp_offset; /* offset from new sp to store fp registers */
1534 int initialized; /* != 0 if frame size already calculated */
1535 int num_gp; /* number of gp registers saved */
1536 int num_fp; /* number of fp registers saved */
1537 };
1538
1539 extern struct mips_frame_info current_frame_info;
1540
1541 /* Store in the variable DEPTH the initial difference between the
1542 frame pointer reg contents and the stack pointer reg contents,
1543 as of the start of the function body. This depends on the layout
1544 of the fixed parts of the stack frame and on how registers are saved. */
1545
1546 /* #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
1547 ((VAR) = compute_frame_size (get_frame_size ())) */
1548
1549 /* If defined, this macro specifies a table of register pairs used to
1550 eliminate unneeded registers that point into the stack frame. If
1551 it is not defined, the only elimination attempted by the compiler
1552 is to replace references to the frame pointer with references to
1553 the stack pointer.
1554
1555 The definition of this macro is a list of structure
1556 initializations, each of which specifies an original and
1557 replacement register.
1558
1559 On some machines, the position of the argument pointer is not
1560 known until the compilation is completed. In such a case, a
1561 separate hard register must be used for the argument pointer.
1562 This register can be eliminated by replacing it with either the
1563 frame pointer or the argument pointer, depending on whether or not
1564 the frame pointer has been eliminated.
1565
1566 In this case, you might specify:
1567 #define ELIMINABLE_REGS \
1568 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1569 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1570 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1571
1572 Note that the elimination of the argument pointer with the stack
1573 pointer is specified first since that is the preferred elimination. */
1574
1575 #define ELIMINABLE_REGS \
1576 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1577 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1578 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1579
1580
1581 /* A C expression that returns non-zero if the compiler is allowed to
1582 try to replace register number FROM-REG with register number
1583 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
1584 defined, and will usually be the constant 1, since most of the
1585 cases preventing register elimination are things that the compiler
1586 already knows about. */
1587
1588 #define CAN_ELIMINATE(FROM, TO) \
1589 (!frame_pointer_needed \
1590 || ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM))
1591
1592 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
1593 specifies the initial difference between the specified pair of
1594 registers. This macro must be defined if `ELIMINABLE_REGS' is
1595 defined. */
1596
1597 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1598 { compute_frame_size (get_frame_size ()); \
1599 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1600 (OFFSET) = 0; \
1601 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1602 (OFFSET) = current_frame_info.total_size; \
1603 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1604 (OFFSET) = current_frame_info.total_size; \
1605 else \
1606 abort (); \
1607 }
1608
1609
1610 /* If we generate an insn to push BYTES bytes,
1611 this says how many the stack pointer really advances by.
1612 On the vax, sp@- in a byte insn really pushes a word. */
1613
1614 /* #define PUSH_ROUNDING(BYTES) 0 */
1615
1616 /* If defined, the maximum amount of space required for outgoing
1617 arguments will be computed and placed into the variable
1618 `current_function_outgoing_args_size'. No space will be pushed
1619 onto the stack for each call; instead, the function prologue
1620 should increase the stack frame size by this amount.
1621
1622 It is not proper to define both `PUSH_ROUNDING' and
1623 `ACCUMULATE_OUTGOING_ARGS'. */
1624 #define ACCUMULATE_OUTGOING_ARGS
1625
1626 /* Offset of first parameter from the argument pointer register value. */
1627 #define FIRST_PARM_OFFSET(FNDECL) 0
1628
1629 /* Offset from top-of-stack address to location to store the
1630 function parameter if it can't go in a register.
1631 Addresses for following parameters are computed relative to this one.
1632
1633 It also has the effect of counting register arguments in the total
1634 argument size. */
1635 #define FIRST_PARM_CALLER_OFFSET(FNDECL) 0
1636
1637 /* When a parameter is passed in a register, stack space is still
1638 allocated for it. For the MIPS, stack space must be allocated, cf
1639 Asm Lang Prog Guide page 7-8.
1640
1641 BEWARE that some space is also allocated for non existing arguments
1642 in register. In case an argument list is of form GF used registers
1643 are a0 (a2,a3), but we should push over a1... */
1644
1645 #define REG_PARM_STACK_SPACE(FNDECL) (4*4)
1646
1647 /* Define this if it is the responsibility of the caller to
1648 allocate the area reserved for arguments passed in registers.
1649 If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
1650 of this macro is to determine whether the space is included in
1651 `current_function_outgoing_args_size'. */
1652 #define OUTGOING_REG_PARM_STACK_SPACE
1653
1654 /* Align stack frames on 64 bits (Double Word ). */
1655 #define STACK_BOUNDARY 64
1656
1657 /* Make sure 16 bytes are always allocated on the stack. */
1658
1659 #ifndef STACK_ARGS_ADJUST
1660 #define STACK_ARGS_ADJUST(SIZE) \
1661 { \
1662 if (SIZE.constant < 16) \
1663 SIZE.constant = 16; \
1664 }
1665 #endif
1666
1667 \f
1668 /* A C expression that should indicate the number of bytes of its
1669 own arguments that a function function pops on returning, or 0
1670 if the function pops no arguments and the caller must therefore
1671 pop them all after the function returns.
1672
1673 FUNTYPE is a C variable whose value is a tree node that
1674 describes the function in question. Normally it is a node of
1675 type `FUNCTION_TYPE' that describes the data type of the function.
1676 From this it is possible to obtain the data types of the value
1677 and arguments (if known).
1678
1679 When a call to a library function is being considered, FUNTYPE
1680 will contain an identifier node for the library function. Thus,
1681 if you need to distinguish among various library functions, you
1682 can do so by their names. Note that "library function" in this
1683 context means a function used to perform arithmetic, whose name
1684 is known specially in the compiler and was not mentioned in the
1685 C code being compiled.
1686
1687 STACK-SIZE is the number of bytes of arguments passed on the
1688 stack. If a variable number of bytes is passed, it is zero, and
1689 argument popping will always be the responsibility of the
1690 calling function. */
1691
1692 #define RETURN_POPS_ARGS(FUNTYPE, SIZE) 0
1693
1694
1695 /* Symbolic macros for the registers used to return integer and floating
1696 point values. */
1697
1698 #define GP_RETURN (GP_REG_FIRST + 2)
1699 #define FP_RETURN ((TARGET_SOFT_FLOAT) ? GP_RETURN : (FP_REG_FIRST + 0))
1700
1701 /* Symbolic macros for the first/last argument registers. */
1702
1703 #define GP_ARG_FIRST (GP_REG_FIRST + 4)
1704 #define GP_ARG_LAST (GP_REG_FIRST + 7)
1705 #define FP_ARG_FIRST (FP_REG_FIRST + 12)
1706 #define FP_ARG_LAST (FP_REG_FIRST + 15)
1707
1708 #define MAX_ARGS_IN_REGISTERS 4
1709
1710 /* Define how to find the value returned by a library function
1711 assuming the value has mode MODE. */
1712
1713 #define LIBCALL_VALUE(MODE) \
1714 gen_rtx (REG, MODE, \
1715 (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
1716 ? FP_RETURN \
1717 : GP_RETURN)
1718
1719 /* Define how to find the value returned by a function.
1720 VALTYPE is the data type of the value (as a tree).
1721 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1722 otherwise, FUNC is 0. */
1723
1724 #define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
1725
1726
1727 /* 1 if N is a possible register number for a function value.
1728 On the MIPS, R2 R3 and F0 F2 are the only register thus used.
1729 Currently, R2 and F0 are only implemented here (C has no complex type) */
1730
1731 #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN)
1732
1733 /* 1 if N is a possible register number for function argument passing. */
1734
1735 #define FUNCTION_ARG_REGNO_P(N) (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST) \
1736 || ((N) >= FP_ARG_FIRST && (N) <= FP_ARG_LAST \
1737 && (0 == (N) % 2)))
1738
1739 /* A C expression which can inhibit the returning of certain function
1740 values in registers, based on the type of value. A nonzero value says
1741 to return the function value in memory, just as large structures are
1742 always returned. Here TYPE will be a C expression of type
1743 `tree', representing the data type of the value.
1744
1745 Note that values of mode `BLKmode' are returned in memory
1746 regardless of this macro. Also, the option `-fpcc-struct-return'
1747 takes effect regardless of this macro. On most systems, it is
1748 possible to leave the macro undefined; this causes a default
1749 definition to be used, whose value is the constant 0.
1750
1751 GCC normally converts 1 byte structures into chars, 2 byte
1752 structs into shorts, and 4 byte structs into ints, and returns
1753 them this way. Defining the following macro overrides this,
1754 to give us MIPS cc compatibility. */
1755
1756 #define RETURN_IN_MEMORY(TYPE) \
1757 ((TREE_CODE (TYPE) == RECORD_TYPE) || (TREE_CODE (TYPE) == UNION_TYPE))
1758
1759 \f
1760 /* A code distinguishing the floating point format of the target
1761 machine. There are three defined values: IEEE_FLOAT_FORMAT,
1762 VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT. */
1763
1764 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
1765
1766 \f
1767 /* Define a data type for recording info about an argument list
1768 during the scan of that argument list. This data type should
1769 hold all necessary information about the function itself
1770 and about the args processed so far, enough to enable macros
1771 such as FUNCTION_ARG to determine where the next arg should go.
1772 */
1773
1774 typedef struct mips_args {
1775 int gp_reg_found;
1776 int arg_number;
1777 int arg_words;
1778 } CUMULATIVE_ARGS;
1779
1780 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1781 for a call to a function whose data type is FNTYPE.
1782 For a library call, FNTYPE is 0.
1783
1784 */
1785
1786 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
1787 init_cumulative_args (&CUM, FNTYPE, LIBNAME) \
1788
1789 /* Update the data in CUM to advance over an argument
1790 of mode MODE and data type TYPE.
1791 (TYPE is null for libcalls where that information may not be available.) */
1792
1793 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1794 function_arg_advance (&CUM, MODE, TYPE, NAMED)
1795
1796 /* Determine where to put an argument to a function.
1797 Value is zero to push the argument on the stack,
1798 or a hard register in which to store the argument.
1799
1800 MODE is the argument's machine mode.
1801 TYPE is the data type of the argument (as a tree).
1802 This is null for libcalls where that information may
1803 not be available.
1804 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1805 the preceding args and about the function being called.
1806 NAMED is nonzero if this argument is a named parameter
1807 (otherwise it is an extra parameter matching an ellipsis). */
1808
1809 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1810 function_arg( &CUM, MODE, TYPE, NAMED)
1811
1812 /* For an arg passed partly in registers and partly in memory,
1813 this is the number of registers used.
1814 For args passed entirely in registers or entirely in memory, zero. */
1815
1816 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1817 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
1818
1819 /* If defined, a C expression that gives the alignment boundary, in
1820 bits, of an argument with the specified mode and type. If it is
1821 not defined, `PARM_BOUNDARY' is used for all arguments. */
1822
1823 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1824 (((TYPE) != 0) \
1825 ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
1826 ? PARM_BOUNDARY \
1827 : TYPE_ALIGN(TYPE)) \
1828 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
1829 ? PARM_BOUNDARY \
1830 : GET_MODE_ALIGNMENT(MODE)))
1831
1832 \f
1833 /* This macro generates the assembly code for function entry.
1834 FILE is a stdio stream to output the code to.
1835 SIZE is an int: how many units of temporary storage to allocate.
1836 Refer to the array `regs_ever_live' to determine which registers
1837 to save; `regs_ever_live[I]' is nonzero if register number I
1838 is ever used in the function. This macro is responsible for
1839 knowing which registers should not be saved even if used. */
1840
1841 #define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue(FILE, SIZE)
1842
1843 /* This macro generates the assembly code for function exit,
1844 on machines that need it. If FUNCTION_EPILOGUE is not defined
1845 then individual return instructions are generated for each
1846 return statement. Args are same as for FUNCTION_PROLOGUE. */
1847
1848 #define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue(FILE, SIZE)
1849
1850 /* Define the number of delay slots needed for the function epilogue.
1851
1852 On the mips, we need a slot if either no stack has been allocated,
1853 or the only register saved is the return register. */
1854
1855 #define DELAY_SLOTS_FOR_EPILOGUE mips_epilogue_delay_slots ()
1856
1857 /* Define whether INSN can be placed in delay slot N for the epilogue.
1858 No references to the stack must be made, since on the MIPS, the
1859 delay slot is done after the stack has been cleaned up. */
1860
1861 #define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \
1862 (get_attr_dslot (INSN) == DSLOT_NO \
1863 && get_attr_length (INSN) == 1 \
1864 && ! reg_mentioned_p (stack_pointer_rtx, PATTERN (INSN)) \
1865 && ! reg_mentioned_p (frame_pointer_rtx, PATTERN (INSN)) \
1866 && ! reg_mentioned_p (arg_pointer_rtx, PATTERN (INSN)))
1867
1868 /* Tell prologue and epilogue if register REGNO should be saved / restored. */
1869
1870 #define MUST_SAVE_REGISTER(regno) \
1871 ((regs_ever_live[regno] && !call_used_regs[regno]) \
1872 || (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) \
1873 || (regno == (GP_REG_FIRST + 31) && regs_ever_live[GP_REG_FIRST + 31]))
1874
1875 /* ALIGN FRAMES on double word boundaries */
1876
1877 #define MIPS_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
1878
1879 \f
1880 /* Output assembler code to FILE to increment profiler label # LABELNO
1881 for profiling a function entry. */
1882
1883 #define FUNCTION_PROFILER(FILE, LABELNO) \
1884 { \
1885 fprintf (FILE, "\t.set\tnoreorder\n"); \
1886 fprintf (FILE, "\t.set\tnoat\n"); \
1887 fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
1888 reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]); \
1889 fprintf (FILE, "\tjal\t_mcount\n"); \
1890 fprintf (FILE, "\tsubu\t%s,%s,8\t\t# _mcount pops 2 words from stack\n", \
1891 reg_names[STACK_POINTER_REGNUM], \
1892 reg_names[STACK_POINTER_REGNUM]); \
1893 fprintf (FILE, "\t.set\treorder\n"); \
1894 fprintf (FILE, "\t.set\tat\n"); \
1895 }
1896
1897 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1898 the stack pointer does not matter. The value is tested only in
1899 functions that have frame pointers.
1900 No definition is equivalent to always zero. */
1901
1902 #define EXIT_IGNORE_STACK 1
1903
1904 \f
1905 /* A C statement to output, on the stream FILE, assembler code for a
1906 block of data that contains the constant parts of a trampoline.
1907 This code should not include a label--the label is taken care of
1908 automatically. */
1909
1910 #define TRAMPOLINE_TEMPLATE(STREAM) \
1911 { \
1912 fprintf (STREAM, "\t.word\t0x03e00821\t\t# move $1,$31\n"); \
1913 fprintf (STREAM, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n"); \
1914 fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n"); \
1915 fprintf (STREAM, "\t.word\t0x8fe30010\t\t# lw $3,16($31)\n"); \
1916 fprintf (STREAM, "\t.word\t0x8fe20014\t\t# lw $2,20($31)\n"); \
1917 fprintf (STREAM, "\t.word\t0x00600008\t\t# jr $3\n"); \
1918 fprintf (STREAM, "\t.word\t0x0020f821\t\t# move $31,$1\n"); \
1919 fprintf (STREAM, "\t.word\t0x00000000\t\t# <function address>\n"); \
1920 fprintf (STREAM, "\t.word\t0x00000000\t\t# <static chain value>\n"); \
1921 }
1922
1923 /* A C expression for the size in bytes of the trampoline, as an
1924 integer. */
1925
1926 #define TRAMPOLINE_SIZE (9*4)
1927
1928 /* Alignment required for trampolines, in bits.
1929
1930 If you don't define this macro, the value of `BIGGEST_ALIGNMENT'
1931 is used for aligning trampolines. */
1932
1933 /* #define TRAMPOLINE_ALIGNMENT 32 */
1934
1935 /* A C statement to initialize the variable parts of a trampoline.
1936 ADDR is an RTX for the address of the trampoline; FNADDR is an
1937 RTX for the address of the nested function; STATIC_CHAIN is an
1938 RTX for the static chain value that should be passed to the
1939 function when it is called. */
1940
1941 #define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \
1942 { \
1943 rtx addr = ADDR; \
1944 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (addr, 28)), FUNC); \
1945 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (addr, 32)), CHAIN); \
1946 \
1947 /* Attempt to make stack executable */ \
1948 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"), \
1949 0, VOIDmode, 1, addr, Pmode); \
1950 }
1951
1952
1953 /* Attempt to turn on access permissions for the stack. */
1954
1955 #define TRANSFER_FROM_TRAMPOLINE \
1956 \
1957 void \
1958 __enable_execute_stack (addr) \
1959 char *addr; \
1960 { \
1961 int size = getpagesize (); \
1962 int mask = ~(size-1); \
1963 char *page = (char *) (((int) addr) & mask); \
1964 char *end = (char *) ((((int) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
1965 \
1966 /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
1967 if (mprotect (page, end - page, 7) < 0) \
1968 perror ("mprotect of trampoline code"); \
1969 \
1970 /* \
1971 if (cacheflush (addr, TRAMPOLINE_SIZE, 1) < 0) \
1972 perror ("cacheflush of trampoline code"); \
1973 */ \
1974 }
1975
1976 \f
1977 /* Addressing modes, and classification of registers for them. */
1978
1979 /* #define HAVE_POST_INCREMENT */
1980 /* #define HAVE_POST_DECREMENT */
1981
1982 /* #define HAVE_PRE_DECREMENT */
1983 /* #define HAVE_PRE_INCREMENT */
1984
1985 /* These assume that REGNO is a hard or pseudo reg number.
1986 They give nonzero only if REGNO is a hard reg of the suitable class
1987 or a pseudo reg currently allocated to a suitable hard reg.
1988 These definitions are NOT overridden anywhere. */
1989
1990 #define GP_REG_OR_PSEUDO_STRICT_P(regno) \
1991 GP_REG_P((regno < FIRST_PSEUDO_REGISTER) ? regno : reg_renumber[regno])
1992
1993 #define GP_REG_OR_PSEUDO_NONSTRICT_P(regno) \
1994 (((regno) >= FIRST_PSEUDO_REGISTER) || (GP_REG_P (regno)))
1995
1996 #define REGNO_OK_FOR_INDEX_P(regno) GP_REG_OR_PSEUDO_STRICT_P (regno)
1997 #define REGNO_OK_FOR_BASE_P(regno) GP_REG_OR_PSEUDO_STRICT_P (regno)
1998
1999 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
2000 and check its validity for a certain class.
2001 We have two alternate definitions for each of them.
2002 The usual definition accepts all pseudo regs; the other rejects them all.
2003 The symbol REG_OK_STRICT causes the latter definition to be used.
2004
2005 Most source files want to accept pseudo regs in the hope that
2006 they will get allocated to the class that the insn wants them to be in.
2007 Some source files that are used after register allocation
2008 need to be strict. */
2009
2010 #ifndef REG_OK_STRICT
2011
2012 #define REG_OK_STRICT_P 0
2013 #define REG_OK_FOR_INDEX_P(X) GP_REG_OR_PSEUDO_NONSTRICT_P (REGNO (X))
2014 #define REG_OK_FOR_BASE_P(X) GP_REG_OR_PSEUDO_NONSTRICT_P (REGNO (X))
2015
2016 #else
2017
2018 #define REG_OK_STRICT_P 1
2019 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
2020 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
2021
2022 #endif
2023
2024 \f
2025 /* Maximum number of registers that can appear in a valid memory address. */
2026
2027 #define MAX_REGS_PER_ADDRESS 1
2028
2029 /* A C compound statement with a conditional `goto LABEL;' executed
2030 if X (an RTX) is a legitimate memory address on the target
2031 machine for a memory operand of mode MODE.
2032
2033 It usually pays to define several simpler macros to serve as
2034 subroutines for this one. Otherwise it may be too complicated
2035 to understand.
2036
2037 This macro must exist in two variants: a strict variant and a
2038 non-strict one. The strict variant is used in the reload pass.
2039 It must be defined so that any pseudo-register that has not been
2040 allocated a hard register is considered a memory reference. In
2041 contexts where some kind of register is required, a
2042 pseudo-register with no hard register must be rejected.
2043
2044 The non-strict variant is used in other passes. It must be
2045 defined to accept all pseudo-registers in every context where
2046 some kind of register is required.
2047
2048 Compiler source files that want to use the strict variant of
2049 this macro define the macro `REG_OK_STRICT'. You should use an
2050 `#ifdef REG_OK_STRICT' conditional to define the strict variant
2051 in that case and the non-strict variant otherwise.
2052
2053 Typically among the subroutines used to define
2054 `GO_IF_LEGITIMATE_ADDRESS' are subroutines to check for
2055 acceptable registers for various purposes (one for base
2056 registers, one for index registers, and so on). Then only these
2057 subroutine macros need have two variants; the higher levels of
2058 macros may be the same whether strict or not.
2059
2060 Normally, constant addresses which are the sum of a `symbol_ref'
2061 and an integer are stored inside a `const' RTX to mark them as
2062 constant. Therefore, there is no need to recognize such sums
2063 specifically as legitimate addresses. Normally you would simply
2064 recognize any `const' as legitimate.
2065
2066 Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle
2067 constant sums that are not marked with `const'. It assumes
2068 that a naked `plus' indicates indexing. If so, then you *must*
2069 reject such naked constant sums as illegitimate addresses, so
2070 that none of them will be given to `PRINT_OPERAND_ADDRESS'.
2071
2072 On some machines, whether a symbolic address is legitimate
2073 depends on the section that the address refers to. On these
2074 machines, define the macro `ENCODE_SECTION_INFO' to store the
2075 information into the `symbol_ref', and then check for it here.
2076 When you see a `const', you will have to look inside it to find
2077 the `symbol_ref' in order to determine the section. */
2078
2079 #if 1
2080 #define GO_PRINTF(x) trace(x)
2081 #define GO_PRINTF2(x,y) trace(x,y)
2082 #define GO_DEBUG_RTX(x) debug_rtx(x)
2083
2084 #else
2085 #define GO_PRINTF(x)
2086 #define GO_PRINTF2(x,y)
2087 #define GO_DEBUG_RTX(x)
2088 #endif
2089
2090 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
2091 { \
2092 register rtx xinsn = (X); \
2093 \
2094 if (TARGET_DEBUG_B_MODE) \
2095 { \
2096 GO_PRINTF2 ("\n========== GO_IF_LEGITIMATE_ADDRESS, %sstrict\n", \
2097 (REG_OK_STRICT_P) ? "" : "not "); \
2098 GO_DEBUG_RTX (xinsn); \
2099 } \
2100 \
2101 if (GET_CODE (xinsn) == REG && REG_OK_FOR_BASE_P (xinsn)) \
2102 goto ADDR; \
2103 \
2104 if (CONSTANT_ADDRESS_P (xinsn)) \
2105 goto ADDR; \
2106 \
2107 if (GET_CODE (xinsn) == PLUS) \
2108 { \
2109 register rtx xplus0 = XEXP (xinsn, 0); \
2110 register rtx xplus1 = XEXP (xinsn, 1); \
2111 register enum rtx_code code0 = GET_CODE (xplus0); \
2112 register enum rtx_code code1 = GET_CODE (xplus1); \
2113 \
2114 if (code0 != REG && code1 == REG) \
2115 { \
2116 xplus0 = XEXP (xinsn, 1); \
2117 xplus1 = XEXP (xinsn, 0); \
2118 code0 = GET_CODE (xplus0); \
2119 code1 = GET_CODE (xplus1); \
2120 } \
2121 \
2122 if (code0 == REG && REG_OK_FOR_BASE_P (xplus0)) \
2123 { \
2124 if (code1 == CONST_INT) \
2125 { \
2126 register unsigned adj_offset = INTVAL (xplus1) + 0x8000; \
2127 \
2128 if ((adj_offset <= 0xffff) \
2129 && (adj_offset + GET_MODE_SIZE (MODE) - 1 <= 0xffff)) \
2130 goto ADDR; \
2131 } \
2132 \
2133 /* For some code sequences, you actually get better code by \
2134 pretending that the MIPS supports an address mode of a \
2135 constant address + a register, even though the real \
2136 machine doesn't support it. This is because the \
2137 assembler can use $r1 to load just the high 16 bits, add \
2138 in the register, and fold the low 16 bits into the memory \
2139 reference, whereas the compiler generates a 4 instruction \
2140 sequence. On the other hand, CSE is not as effective. \
2141 It would be a win to generate the lui directly, but the \
2142 MIPS assembler does not have syntax to generate the \
2143 appropriate relocation. */ \
2144 \
2145 else if (!TARGET_DEBUG_A_MODE \
2146 && code0 == REG \
2147 && CONSTANT_ADDRESS_P (xplus1)) \
2148 goto ADDR; \
2149 } \
2150 } \
2151 \
2152 if (TARGET_DEBUG_B_MODE) \
2153 GO_PRINTF ("Not a legitimate address\n"); \
2154 }
2155
2156
2157 /* A C expression that is 1 if the RTX X is a constant which is a
2158 valid address. On most machines, this can be defined as
2159 `CONSTANT_P (X)', but a few machines are more restrictive in
2160 which constant addresses are supported.
2161
2162 `CONSTANT_P' accepts integer-values expressions whose values are
2163 not explicitly known, such as `symbol_ref', `label_ref', and
2164 `high' expressions and `const' arithmetic expressions, in
2165 addition to `const_int' and `const_double' expressions. */
2166
2167 #define CONSTANT_ADDRESS_P(X) \
2168 (CONSTANT_P (X) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
2169
2170
2171 /* Nonzero if the constant value X is a legitimate general operand.
2172 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
2173
2174 At present, GAS doesn't understand li.[sd], so don't allow it
2175 to be generated at present. Also, the MIPS assembler does not
2176 grok li.d Infinity. */
2177
2178 #define LEGITIMATE_CONSTANT_P(X) \
2179 (GET_CODE (X) != CONST_DOUBLE || mips_const_double_ok (X, GET_MODE (X)))
2180
2181
2182 /* A C compound statement that attempts to replace X with a valid
2183 memory address for an operand of mode MODE. WIN will be a C
2184 statement label elsewhere in the code; the macro definition may
2185 use
2186
2187 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
2188
2189 to avoid further processing if the address has become legitimate.
2190
2191 X will always be the result of a call to `break_out_memory_refs',
2192 and OLDX will be the operand that was given to that function to
2193 produce X.
2194
2195 The code generated by this macro should not alter the
2196 substructure of X. If it transforms X into a more legitimate
2197 form, it should assign X (which will always be a C variable) a
2198 new value.
2199
2200 It is not necessary for this macro to come up with a legitimate
2201 address. The compiler has standard ways of doing so in all
2202 cases. In fact, it is safe for this macro to do nothing. But
2203 often a machine-dependent strategy can generate better code. */
2204
2205 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
2206
2207
2208 /* A C statement or compound statement with a conditional `goto
2209 LABEL;' executed if memory address X (an RTX) can have different
2210 meanings depending on the machine mode of the memory reference it
2211 is used for.
2212
2213 Autoincrement and autodecrement addresses typically have
2214 mode-dependent effects because the amount of the increment or
2215 decrement is the size of the operand being addressed. Some
2216 machines have other mode-dependent addresses. Many RISC machines
2217 have no mode-dependent addresses.
2218
2219 You may assume that ADDR is a valid address for the machine. */
2220
2221 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
2222
2223
2224 /* Define this macro if references to a symbol must be treated
2225 differently depending on something about the variable or
2226 function named by the symbol (such as what section it is in).
2227
2228 The macro definition, if any, is executed immediately after the
2229 rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
2230 The value of the rtl will be a `mem' whose address is a
2231 `symbol_ref'.
2232
2233 The usual thing for this macro to do is to a flag in the
2234 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
2235 name string in the `symbol_ref' (if one bit is not enough
2236 information).
2237
2238 The best way to modify the name string is by adding text to the
2239 beginning, with suitable punctuation to prevent any ambiguity.
2240 Allocate the new name in `saveable_obstack'. You will have to
2241 modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
2242 and output the name accordingly.
2243
2244 You can also check the information stored in the `symbol_ref' in
2245 the definition of `GO_IF_LEGITIMATE_ADDRESS' or
2246 `PRINT_OPERAND_ADDRESS'. */
2247
2248 #define ENCODE_SECTION_INFO(DECL) \
2249 do \
2250 { \
2251 if (optimize && mips_section_threshold > 0 && TARGET_GP_OPT \
2252 && TREE_CODE (DECL) == VAR_DECL) \
2253 { \
2254 int size = int_size_in_bytes (TREE_TYPE (DECL)); \
2255 \
2256 if (size > 0 && size <= mips_section_threshold) \
2257 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
2258 } \
2259 \
2260 else if (HALF_PIC_P ()) \
2261 HALF_PIC_ENCODE (DECL); \
2262 } \
2263 while (0)
2264
2265 \f
2266 /* Specify the machine mode that this machine uses
2267 for the index in the tablejump instruction. */
2268 #define CASE_VECTOR_MODE SImode
2269
2270 /* Define this if the tablejump instruction expects the table
2271 to contain offsets from the address of the table.
2272 Do not define this if the table should contain absolute addresses. */
2273 /* #define CASE_VECTOR_PC_RELATIVE */
2274
2275 /* Specify the tree operation to be used to convert reals to integers. */
2276 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2277
2278 /* This is the kind of divide that is easiest to do in the general case. */
2279 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2280
2281 /* Define this as 1 if `char' should by default be signed; else as 0. */
2282 #ifndef DEFAULT_SIGNED_CHAR
2283 #define DEFAULT_SIGNED_CHAR 1
2284 #endif
2285
2286 /* Max number of bytes we can move from memory to memory
2287 in one reasonably fast instruction. */
2288 #define MOVE_MAX 4
2289
2290 /* Define this macro as a C expression which is nonzero if
2291 accessing less than a word of memory (i.e. a `char' or a
2292 `short') is no faster than accessing a word of memory, i.e., if
2293 such access require more than one instruction or if there is no
2294 difference in cost between byte and (aligned) word loads.
2295
2296 On RISC machines, it tends to generate better code to define
2297 this as 1, since it avoids making a QI or HI mode register. */
2298 #define SLOW_BYTE_ACCESS 1
2299
2300 /* We assume that the store-condition-codes instructions store 0 for false
2301 and some other value for true. This is the value stored for true. */
2302
2303 #define STORE_FLAG_VALUE 1
2304
2305 /* Define this if zero-extension is slow (more than one real instruction). */
2306 #define SLOW_ZERO_EXTEND
2307
2308 /* Define if shifts truncate the shift count
2309 which implies one can omit a sign-extension or zero-extension
2310 of a shift count.
2311
2312 Only 5 bits are used in SLLV and SRLV */
2313
2314 #define SHIFT_COUNT_TRUNCATED
2315
2316 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2317 is done just by pretending it is already truncated. */
2318 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2319
2320 /* Define this macro to control use of the character `$' in
2321 identifier names. The value should be 0, 1, or 2. 0 means `$'
2322 is not allowed by default; 1 means it is allowed by default if
2323 `-traditional' is used; 2 means it is allowed by default provided
2324 `-ansi' is not used. 1 is the default; there is no need to
2325 define this macro in that case. */
2326
2327 #ifndef DOLLARS_IN_IDENTIFIERS
2328 #define DOLLARS_IN_IDENTIFIERS 1
2329 #endif
2330
2331 /* Specify the machine mode that pointers have.
2332 After generation of rtl, the compiler makes no further distinction
2333 between pointers and any other objects of this machine mode. */
2334 #define Pmode SImode
2335
2336 /* A function address in a call instruction
2337 is a word address (for indexing purposes)
2338 so give the MEM rtx a words's mode. */
2339
2340 #define FUNCTION_MODE SImode
2341
2342 /* Define TARGET_MEM_FUNCTIONS if we want to use calls to memcpy and
2343 memset, instead of the BSD functions bcopy and bzero. */
2344
2345 #if defined(MIPS_SYSV) || defined(OSF_OS)
2346 #define TARGET_MEM_FUNCTIONS
2347 #endif
2348
2349 \f
2350 /* A part of a C `switch' statement that describes the relative
2351 costs of constant RTL expressions. It must contain `case'
2352 labels for expression codes `const_int', `const', `symbol_ref',
2353 `label_ref' and `const_double'. Each case must ultimately reach
2354 a `return' statement to return the relative cost of the use of
2355 that kind of constant value in an expression. The cost may
2356 depend on the precise value of the constant, which is available
2357 for examination in X.
2358
2359 CODE is the expression code--redundant, since it can be obtained
2360 with `GET_CODE (X)'. */
2361
2362 #define CONST_COSTS(X,CODE,OUTER_CODE) \
2363 case CONST_INT: \
2364 /* Always return 0, since we don't have different sized \
2365 instructions, hence different costs according to Richard \
2366 Kenner */ \
2367 return COSTS_N_INSNS (0); \
2368 \
2369 case LABEL_REF: \
2370 return COSTS_N_INSNS (2); \
2371 \
2372 case CONST: \
2373 { \
2374 rtx offset = const0_rtx; \
2375 rtx symref = eliminate_constant_term (X, &offset); \
2376 \
2377 if (GET_CODE (symref) == LABEL_REF) \
2378 return COSTS_N_INSNS (2); \
2379 \
2380 if (GET_CODE (symref) != SYMBOL_REF) \
2381 return COSTS_N_INSNS (4); \
2382 \
2383 /* let's be paranoid.... */ \
2384 if (INTVAL (offset) < -32768 || INTVAL (offset) > 32767) \
2385 return COSTS_N_INSNS (2); \
2386 \
2387 return COSTS_N_INSNS (SYMBOL_REF_FLAG (symref) ? 1 : 2); \
2388 } \
2389 \
2390 case SYMBOL_REF: \
2391 return COSTS_N_INSNS (SYMBOL_REF_FLAG (X) ? 1 : 2); \
2392 \
2393 case CONST_DOUBLE: \
2394 return COSTS_N_INSNS ((CONST_DOUBLE_HIGH (X) == 0 \
2395 && CONST_DOUBLE_LOW (X)) ? 2 : 4);
2396
2397
2398 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
2399 This can be used, for example, to indicate how costly a multiply
2400 instruction is. In writing this macro, you can use the construct
2401 `COSTS_N_INSNS (N)' to specify a cost equal to N fast instructions.
2402
2403 This macro is optional; do not define it if the default cost
2404 assumptions are adequate for the target machine.
2405
2406 If -mdebugd is used, change the multiply cost to 2, so multiply by
2407 a constant isn't converted to a series of shifts. This helps
2408 strength reduction, and also makes it easier to identify what the
2409 compiler is doing. */
2410
2411 #define RTX_COSTS(X,CODE,OUTER_CODE) \
2412 case MEM: \
2413 { \
2414 int num_words = (GET_MODE_SIZE (GET_MODE (X)) > UNITS_PER_WORD) ? 2 : 1; \
2415 if (simple_memory_operand (X, GET_MODE (X))) \
2416 return COSTS_N_INSNS (num_words); \
2417 \
2418 return COSTS_N_INSNS (2*num_words); \
2419 } \
2420 \
2421 case FFS: \
2422 return COSTS_N_INSNS (6); \
2423 \
2424 case NOT: \
2425 return COSTS_N_INSNS ((GET_MODE (X) == DImode) ? 2 : 1); \
2426 \
2427 case AND: \
2428 case IOR: \
2429 case XOR: \
2430 if (GET_MODE (X) == DImode) \
2431 return COSTS_N_INSNS (2); \
2432 \
2433 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
2434 { \
2435 rtx number = XEXP (X, 1); \
2436 if (SMALL_INT_UNSIGNED (number)) \
2437 return COSTS_N_INSNS (1); \
2438 \
2439 else if (SMALL_INT (number)) \
2440 return COSTS_N_INSNS (2); \
2441 \
2442 return COSTS_N_INSNS (3); \
2443 } \
2444 \
2445 return COSTS_N_INSNS (1); \
2446 \
2447 case ASHIFT: \
2448 case ASHIFTRT: \
2449 case LSHIFT: \
2450 case LSHIFTRT: \
2451 if (GET_MODE (X) == DImode) \
2452 return COSTS_N_INSNS ((GET_CODE (XEXP (X, 1)) == CONST_INT) ? 12 : 4); \
2453 \
2454 return COSTS_N_INSNS (1); \
2455 \
2456 case ABS: \
2457 { \
2458 enum machine_mode xmode = GET_MODE (X); \
2459 if (xmode == SFmode || xmode == DFmode) \
2460 return COSTS_N_INSNS (1); \
2461 \
2462 return COSTS_N_INSNS (4); \
2463 } \
2464 \
2465 case PLUS: \
2466 case MINUS: \
2467 { \
2468 enum machine_mode xmode = GET_MODE (X); \
2469 if (xmode == SFmode || xmode == DFmode) \
2470 return COSTS_N_INSNS (2); \
2471 \
2472 if (xmode == DImode) \
2473 return COSTS_N_INSNS (4); \
2474 \
2475 return COSTS_N_INSNS (1); \
2476 } \
2477 \
2478 case NEG: \
2479 return COSTS_N_INSNS ((GET_MODE (X) == DImode) ? 4 : 1); \
2480 \
2481 case MULT: \
2482 { \
2483 enum machine_mode xmode = GET_MODE (X); \
2484 if (xmode == SFmode) \
2485 return COSTS_N_INSNS (4); \
2486 \
2487 if (xmode == DFmode) \
2488 return COSTS_N_INSNS (5); \
2489 \
2490 return COSTS_N_INSNS (12); \
2491 } \
2492 \
2493 case DIV: \
2494 case MOD: \
2495 { \
2496 enum machine_mode xmode = GET_MODE (X); \
2497 if (xmode == SFmode) \
2498 return COSTS_N_INSNS (12); \
2499 \
2500 if (xmode == DFmode) \
2501 return COSTS_N_INSNS (19); \
2502 } \
2503 /* fall through */ \
2504 \
2505 case UDIV: \
2506 case UMOD: \
2507 return COSTS_N_INSNS (35);
2508
2509 /* An expression giving the cost of an addressing mode that
2510 contains ADDRESS. If not defined, the cost is computed from the
2511 form of the ADDRESS expression and the `CONST_COSTS' values.
2512
2513 For most CISC machines, the default cost is a good approximation
2514 of the true cost of the addressing mode. However, on RISC
2515 machines, all instructions normally have the same length and
2516 execution time. Hence all addresses will have equal costs.
2517
2518 In cases where more than one form of an address is known, the
2519 form with the lowest cost will be used. If multiple forms have
2520 the same, lowest, cost, the one that is the most complex will be
2521 used.
2522
2523 For example, suppose an address that is equal to the sum of a
2524 register and a constant is used twice in the same basic block.
2525 When this macro is not defined, the address will be computed in
2526 a register and memory references will be indirect through that
2527 register. On machines where the cost of the addressing mode
2528 containing the sum is no higher than that of a simple indirect
2529 reference, this will produce an additional instruction and
2530 possibly require an additional register. Proper specification
2531 of this macro eliminates this overhead for such machines.
2532
2533 Similar use of this macro is made in strength reduction of loops.
2534
2535 ADDRESS need not be valid as an address. In such a case, the
2536 cost is not relevant and can be any value; invalid addresses
2537 need not be assigned a different cost.
2538
2539 On machines where an address involving more than one register is
2540 as cheap as an address computation involving only one register,
2541 defining `ADDRESS_COST' to reflect this can cause two registers
2542 to be live over a region of code where only one would have been
2543 if `ADDRESS_COST' were not defined in that manner. This effect
2544 should be considered in the definition of this macro.
2545 Equivalent costs should probably only be given to addresses with
2546 different numbers of registers on machines with lots of registers.
2547
2548 This macro will normally either not be defined or be defined as
2549 a constant. */
2550
2551 #define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : mips_address_cost (ADDR))
2552
2553 /* A C expression for the cost of moving data from a register in
2554 class FROM to one in class TO. The classes are expressed using
2555 the enumeration values such as `GENERAL_REGS'. A value of 2 is
2556 the default; other values are interpreted relative to that.
2557
2558 It is not required that the cost always equal 2 when FROM is the
2559 same as TO; on some machines it is expensive to move between
2560 registers if they are not general registers.
2561
2562 If reload sees an insn consisting of a single `set' between two
2563 hard registers, and if `REGISTER_MOVE_COST' applied to their
2564 classes returns a value of 2, reload does not check to ensure
2565 that the constraints of the insn are met. Setting a cost of
2566 other than 2 will allow reload to verify that the constraints are
2567 met. You should do this if the `movM' pattern's constraints do
2568 not allow such copying. */
2569
2570 #define REGISTER_MOVE_COST(FROM, TO) 4 /* force reload to use constraints */
2571
2572 /* A C expression for the cost of a branch instruction. A value of
2573 1 is the default; other values are interpreted relative to that. */
2574
2575 #define BRANCH_COST \
2576 ((mips_cpu == PROCESSOR_R4000 || mips_cpu == PROCESSOR_R6000) ? 2 : 1)
2577
2578 \f
2579 /* Used in by the peephole code. */
2580 #define classify_op(op,mode) (mips_rtx_classify[ (int)GET_CODE (op) ])
2581 #define additive_op(op,mode) ((classify_op (op,mode) & CLASS_ADD_OP) != 0)
2582 #define divmod_op(op,mode) ((classify_op (op,mode) & CLASS_DIVMOD_OP) != 0)
2583 #define unsigned_op(op,mode) ((classify_op (op,mode) & CLASS_UNSIGNED_OP) != 0)
2584
2585 #define CLASS_ADD_OP 0x01 /* operator is PLUS/MINUS */
2586 #define CLASS_DIVMOD_OP 0x02 /* operator is {,U}{DIV,MOD} */
2587 #define CLASS_UNSIGNED_OP 0x04 /* operator is U{DIV,MOD} */
2588 #define CLASS_CMP_OP 0x08 /* operator is comparison */
2589 #define CLASS_EQUALITY_OP 0x10 /* operator is == or != */
2590 #define CLASS_FCMP_OP 0x08 /* operator is fp. compare */
2591
2592 #define CLASS_UNS_CMP_OP (CLASS_UNSIGNED_OP | CLASS_CMP_OP)
2593
2594 \f
2595 /* Optionally define this if you have added predicates to
2596 `MACHINE.c'. This macro is called within an initializer of an
2597 array of structures. The first field in the structure is the
2598 name of a predicate and the second field is an array of rtl
2599 codes. For each predicate, list all rtl codes that can be in
2600 expressions matched by the predicate. The list should have a
2601 trailing comma. Here is an example of two entries in the list
2602 for a typical RISC machine:
2603
2604 #define PREDICATE_CODES \
2605 {"gen_reg_rtx_operand", {SUBREG, REG}}, \
2606 {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
2607
2608 Defining this macro does not affect the generated code (however,
2609 incorrect definitions that omit an rtl code that may be matched
2610 by the predicate can cause the compiler to malfunction).
2611 Instead, it allows the table built by `genrecog' to be more
2612 compact and efficient, thus speeding up the compiler. The most
2613 important predicates to include in the list specified by this
2614 macro are thoses used in the most insn patterns. */
2615
2616 #define PREDICATE_CODES \
2617 {"uns_arith_operand", { REG, CONST_INT, SUBREG }}, \
2618 {"arith_operand", { REG, CONST_INT, SUBREG }}, \
2619 {"arith32_operand", { REG, CONST_INT, SUBREG }}, \
2620 {"reg_or_0_operand", { REG, CONST_INT, SUBREG }}, \
2621 {"small_int", { CONST_INT }}, \
2622 {"large_int", { CONST_INT }}, \
2623 {"md_register_operand", { REG }}, \
2624 {"mips_const_double_ok", { CONST_DOUBLE }}, \
2625 {"simple_memory_operand", { MEM, SUBREG }}, \
2626 {"equality_op", { EQ, NE }}, \
2627 {"cmp_op", { EQ, NE, GT, GE, GTU, GEU, LT, LE, \
2628 LTU, LEU }}, \
2629 {"cmp2_op", { EQ, NE, GT, GE, GTU, GEU, LT, LE, \
2630 LTU, LEU }}, \
2631 {"fcmp_op", { EQ, NE, GT, GE, LT, LE }}, \
2632 {"uns_cmp_op", { GTU, GEU, LTU, LEU }},
2633
2634 \f
2635 /* If defined, a C statement to be executed just prior to the
2636 output of assembler code for INSN, to modify the extracted
2637 operands so they will be output differently.
2638
2639 Here the argument OPVEC is the vector containing the operands
2640 extracted from INSN, and NOPERANDS is the number of elements of
2641 the vector which contain meaningful data for this insn. The
2642 contents of this vector are what will be used to convert the
2643 insn template into assembler code, so you can change the
2644 assembler output by changing the contents of the vector.
2645
2646 We use it to check if the current insn needs a nop in front of it
2647 because of load delays, and also to update the delay slot
2648 statistics. */
2649
2650 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
2651 final_prescan_insn (INSN, OPVEC, NOPERANDS)
2652
2653 \f
2654 /* Tell final.c how to eliminate redundant test instructions.
2655 Here we define machine-dependent flags and fields in cc_status
2656 (see `conditions.h'). */
2657
2658 /* A C compound statement to set the components of `cc_status'
2659 appropriately for an insn INSN whose body is EXP. It is this
2660 macro's responsibility to recognize insns that set the condition
2661 code as a byproduct of other activity as well as those that
2662 explicitly set `(cc0)'.
2663
2664 This macro is not used on machines that do not use `cc0'. */
2665
2666 #define NOTICE_UPDATE_CC(EXP, INSN) \
2667 do \
2668 { \
2669 enum attr_type type = get_attr_type (INSN); \
2670 if (type == TYPE_ICMP || type == TYPE_FCMP) \
2671 CC_STATUS_INIT; \
2672 } \
2673 while (0)
2674
2675 /* A list of names to be used for additional modes for condition code
2676 values in registers. These names are added to `enum machine_mode'
2677 and all have class `MODE_CC'. By convention, they should start
2678 with `CC' and end with `mode'.
2679
2680 You should only define this macro if your machine does not use
2681 `cc0' and only if additional modes are required.
2682
2683 On the MIPS, we use CC_FPmode for all floating point except for not
2684 equal, CC_REV_FPmode for not equal (to reverse the sense of the
2685 jump), CC_EQmode for integer equality/inequality comparisons,
2686 CC_0mode for comparisons against 0, and CCmode for other integer
2687 comparisons. */
2688
2689 #define EXTRA_CC_MODES CC_EQmode, CC_FPmode, CC_0mode, CC_REV_FPmode
2690
2691 /* A list of C strings giving the names for the modes listed in
2692 `EXTRA_CC_MODES'. */
2693
2694 #define EXTRA_CC_NAMES "CC_EQ", "CC_FP", "CC_0", "CC_REV_FP"
2695
2696 /* Returns a mode from class `MODE_CC' to be used when comparison
2697 operation code OP is applied to rtx X. */
2698
2699 #define SELECT_CC_MODE(OP, X, Y) \
2700 (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
2701 ? SImode \
2702 : ((OP == NE) ? CC_REV_FPmode : CC_FPmode))
2703
2704 \f
2705 /* Control the assembler format that we output. */
2706
2707 /* Output at beginning of assembler file.
2708 If we are optimizing to use the global pointer, create a temporary
2709 file to hold all of the text stuff, and write it out to the end.
2710 This is needed because the MIPS assembler is evidently one pass,
2711 and if it hasn't seen the relevant .comm/.lcomm/.extern/.sdata
2712 declaration when the code is processed, it generates a two
2713 instruction sequence. */
2714
2715 #define ASM_FILE_START(STREAM) mips_asm_file_start (STREAM)
2716
2717 /* Output to assembler file text saying following lines
2718 may contain character constants, extra white space, comments, etc. */
2719
2720 #define ASM_APP_ON " #APP\n"
2721
2722 /* Output to assembler file text saying following lines
2723 no longer contain unusual constructs. */
2724
2725 #define ASM_APP_OFF " #NO_APP\n"
2726
2727 /* How to refer to registers in assembler output.
2728 This sequence is indexed by compiler's hard-register-number (see above).
2729
2730 In order to support the two different conventions for register names,
2731 we use the name of a table set up in mips.c, which is overwritten
2732 if -mrnames is used. */
2733
2734 #define REGISTER_NAMES \
2735 { \
2736 &mips_reg_names[ 0][0], \
2737 &mips_reg_names[ 1][0], \
2738 &mips_reg_names[ 2][0], \
2739 &mips_reg_names[ 3][0], \
2740 &mips_reg_names[ 4][0], \
2741 &mips_reg_names[ 5][0], \
2742 &mips_reg_names[ 6][0], \
2743 &mips_reg_names[ 7][0], \
2744 &mips_reg_names[ 8][0], \
2745 &mips_reg_names[ 9][0], \
2746 &mips_reg_names[10][0], \
2747 &mips_reg_names[11][0], \
2748 &mips_reg_names[12][0], \
2749 &mips_reg_names[13][0], \
2750 &mips_reg_names[14][0], \
2751 &mips_reg_names[15][0], \
2752 &mips_reg_names[16][0], \
2753 &mips_reg_names[17][0], \
2754 &mips_reg_names[18][0], \
2755 &mips_reg_names[19][0], \
2756 &mips_reg_names[20][0], \
2757 &mips_reg_names[21][0], \
2758 &mips_reg_names[22][0], \
2759 &mips_reg_names[23][0], \
2760 &mips_reg_names[24][0], \
2761 &mips_reg_names[25][0], \
2762 &mips_reg_names[26][0], \
2763 &mips_reg_names[27][0], \
2764 &mips_reg_names[28][0], \
2765 &mips_reg_names[29][0], \
2766 &mips_reg_names[30][0], \
2767 &mips_reg_names[31][0], \
2768 &mips_reg_names[32][0], \
2769 &mips_reg_names[33][0], \
2770 &mips_reg_names[34][0], \
2771 &mips_reg_names[35][0], \
2772 &mips_reg_names[36][0], \
2773 &mips_reg_names[37][0], \
2774 &mips_reg_names[38][0], \
2775 &mips_reg_names[39][0], \
2776 &mips_reg_names[40][0], \
2777 &mips_reg_names[41][0], \
2778 &mips_reg_names[42][0], \
2779 &mips_reg_names[43][0], \
2780 &mips_reg_names[44][0], \
2781 &mips_reg_names[45][0], \
2782 &mips_reg_names[46][0], \
2783 &mips_reg_names[47][0], \
2784 &mips_reg_names[48][0], \
2785 &mips_reg_names[49][0], \
2786 &mips_reg_names[50][0], \
2787 &mips_reg_names[51][0], \
2788 &mips_reg_names[52][0], \
2789 &mips_reg_names[53][0], \
2790 &mips_reg_names[54][0], \
2791 &mips_reg_names[55][0], \
2792 &mips_reg_names[56][0], \
2793 &mips_reg_names[57][0], \
2794 &mips_reg_names[58][0], \
2795 &mips_reg_names[59][0], \
2796 &mips_reg_names[60][0], \
2797 &mips_reg_names[61][0], \
2798 &mips_reg_names[62][0], \
2799 &mips_reg_names[63][0], \
2800 &mips_reg_names[64][0], \
2801 &mips_reg_names[65][0], \
2802 &mips_reg_names[66][0], \
2803 }
2804
2805 /* If defined, a C initializer for an array of structures
2806 containing a name and a register number. This macro defines
2807 additional names for hard registers, thus allowing the `asm'
2808 option in declarations to refer to registers using alternate
2809 names.
2810
2811 We define both names for the integer registers here. */
2812
2813 #define ADDITIONAL_REGISTER_NAMES \
2814 { \
2815 { "$0", 0 + GP_REG_FIRST }, \
2816 { "$1", 1 + GP_REG_FIRST }, \
2817 { "$2", 2 + GP_REG_FIRST }, \
2818 { "$3", 3 + GP_REG_FIRST }, \
2819 { "$4", 4 + GP_REG_FIRST }, \
2820 { "$5", 5 + GP_REG_FIRST }, \
2821 { "$6", 6 + GP_REG_FIRST }, \
2822 { "$7", 7 + GP_REG_FIRST }, \
2823 { "$8", 8 + GP_REG_FIRST }, \
2824 { "$9", 9 + GP_REG_FIRST }, \
2825 { "$10", 10 + GP_REG_FIRST }, \
2826 { "$11", 11 + GP_REG_FIRST }, \
2827 { "$12", 12 + GP_REG_FIRST }, \
2828 { "$13", 13 + GP_REG_FIRST }, \
2829 { "$14", 14 + GP_REG_FIRST }, \
2830 { "$15", 15 + GP_REG_FIRST }, \
2831 { "$16", 16 + GP_REG_FIRST }, \
2832 { "$17", 17 + GP_REG_FIRST }, \
2833 { "$18", 18 + GP_REG_FIRST }, \
2834 { "$19", 19 + GP_REG_FIRST }, \
2835 { "$20", 20 + GP_REG_FIRST }, \
2836 { "$21", 21 + GP_REG_FIRST }, \
2837 { "$22", 22 + GP_REG_FIRST }, \
2838 { "$23", 23 + GP_REG_FIRST }, \
2839 { "$24", 24 + GP_REG_FIRST }, \
2840 { "$25", 25 + GP_REG_FIRST }, \
2841 { "$26", 26 + GP_REG_FIRST }, \
2842 { "$27", 27 + GP_REG_FIRST }, \
2843 { "$28", 28 + GP_REG_FIRST }, \
2844 { "$29", 29 + GP_REG_FIRST }, \
2845 { "$30", 30 + GP_REG_FIRST }, \
2846 { "$31", 31 + GP_REG_FIRST }, \
2847 { "$sp", 29 + GP_REG_FIRST }, \
2848 { "$fp", 30 + GP_REG_FIRST }, \
2849 { "at", 1 + GP_REG_FIRST }, \
2850 { "v0", 2 + GP_REG_FIRST }, \
2851 { "v1", 3 + GP_REG_FIRST }, \
2852 { "a0", 4 + GP_REG_FIRST }, \
2853 { "a1", 5 + GP_REG_FIRST }, \
2854 { "a2", 6 + GP_REG_FIRST }, \
2855 { "a3", 7 + GP_REG_FIRST }, \
2856 { "t0", 8 + GP_REG_FIRST }, \
2857 { "t1", 9 + GP_REG_FIRST }, \
2858 { "t2", 10 + GP_REG_FIRST }, \
2859 { "t3", 11 + GP_REG_FIRST }, \
2860 { "t4", 12 + GP_REG_FIRST }, \
2861 { "t5", 13 + GP_REG_FIRST }, \
2862 { "t6", 14 + GP_REG_FIRST }, \
2863 { "t7", 15 + GP_REG_FIRST }, \
2864 { "s0", 16 + GP_REG_FIRST }, \
2865 { "s1", 17 + GP_REG_FIRST }, \
2866 { "s2", 18 + GP_REG_FIRST }, \
2867 { "s3", 19 + GP_REG_FIRST }, \
2868 { "s4", 20 + GP_REG_FIRST }, \
2869 { "s5", 21 + GP_REG_FIRST }, \
2870 { "s6", 22 + GP_REG_FIRST }, \
2871 { "s7", 23 + GP_REG_FIRST }, \
2872 { "t8", 24 + GP_REG_FIRST }, \
2873 { "t9", 25 + GP_REG_FIRST }, \
2874 { "k0", 26 + GP_REG_FIRST }, \
2875 { "k1", 27 + GP_REG_FIRST }, \
2876 { "gp", 28 + GP_REG_FIRST }, \
2877 { "sp", 29 + GP_REG_FIRST }, \
2878 { "fp", 30 + GP_REG_FIRST }, \
2879 { "ra", 31 + GP_REG_FIRST }, \
2880 { "$sp", 29 + GP_REG_FIRST }, \
2881 { "$fp", 30 + GP_REG_FIRST }, \
2882 { "cc", FPSW_REGNUM }, \
2883 }
2884
2885 /* Define results of standard character escape sequences. */
2886 #define TARGET_BELL 007
2887 #define TARGET_BS 010
2888 #define TARGET_TAB 011
2889 #define TARGET_NEWLINE 012
2890 #define TARGET_VT 013
2891 #define TARGET_FF 014
2892 #define TARGET_CR 015
2893
2894 /* A C compound statement to output to stdio stream STREAM the
2895 assembler syntax for an instruction operand X. X is an RTL
2896 expression.
2897
2898 CODE is a value that can be used to specify one of several ways
2899 of printing the operand. It is used when identical operands
2900 must be printed differently depending on the context. CODE
2901 comes from the `%' specification that was used to request
2902 printing of the operand. If the specification was just `%DIGIT'
2903 then CODE is 0; if the specification was `%LTR DIGIT' then CODE
2904 is the ASCII code for LTR.
2905
2906 If X is a register, this macro should print the register's name.
2907 The names can be found in an array `reg_names' whose type is
2908 `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
2909
2910 When the machine description has a specification `%PUNCT' (a `%'
2911 followed by a punctuation character), this macro is called with
2912 a null pointer for X and the punctuation character for CODE.
2913
2914 See mips.c for the MIPS specific codes. */
2915
2916 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
2917
2918 /* A C expression which evaluates to true if CODE is a valid
2919 punctuation character for use in the `PRINT_OPERAND' macro. If
2920 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
2921 punctuation characters (except for the standard one, `%') are
2922 used in this way. */
2923
2924 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) mips_print_operand_punct[CODE]
2925
2926 /* A C compound statement to output to stdio stream STREAM the
2927 assembler syntax for an instruction operand that is a memory
2928 reference whose address is ADDR. ADDR is an RTL expression.
2929
2930 On some machines, the syntax for a symbolic address depends on
2931 the section that the address refers to. On these machines,
2932 define the macro `ENCODE_SECTION_INFO' to store the information
2933 into the `symbol_ref', and then check for it here. */
2934
2935 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
2936
2937
2938 /* A C statement, to be executed after all slot-filler instructions
2939 have been output. If necessary, call `dbr_sequence_length' to
2940 determine the number of slots filled in a sequence (zero if not
2941 currently outputting a sequence), to decide how many no-ops to
2942 output, or whatever.
2943
2944 Don't define this macro if it has nothing to do, but it is
2945 helpful in reading assembly output if the extent of the delay
2946 sequence is made explicit (e.g. with white space).
2947
2948 Note that output routines for instructions with delay slots must
2949 be prepared to deal with not being output as part of a sequence
2950 (i.e. when the scheduling pass is not run, or when no slot
2951 fillers could be found.) The variable `final_sequence' is null
2952 when not processing a sequence, otherwise it contains the
2953 `sequence' rtx being output. */
2954
2955 #define DBR_OUTPUT_SEQEND(STREAM) \
2956 do \
2957 { \
2958 if (set_nomacro > 0 && --set_nomacro == 0) \
2959 fputs ("\t.set\tmacro\n", STREAM); \
2960 \
2961 if (set_noreorder > 0 && --set_noreorder == 0) \
2962 fputs ("\t.set\treorder\n", STREAM); \
2963 \
2964 dslots_jump_filled++; \
2965 fputs ("\n", STREAM); \
2966 } \
2967 while (0)
2968
2969
2970 /* How to tell the debugger about changes of source files. Note, the
2971 mips ECOFF format cannot deal with changes of files inside of
2972 functions, which means the output of parser generators like bison
2973 is generally not debuggable without using the -l switch. Lose,
2974 lose, lose. Silicon graphics seems to want all .file's hardwired
2975 to 1. */
2976
2977 #ifndef SET_FILE_NUMBER
2978 #define SET_FILE_NUMBER() ++num_source_filenames
2979 #endif
2980
2981 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
2982 mips_output_filename (STREAM, NAME)
2983
2984 /* This is how to output a note the debugger telling it the line number
2985 to which the following sequence of instructions corresponds.
2986 Silicon graphics puts a label after each .loc. */
2987
2988 #ifndef LABEL_AFTER_LOC
2989 #define LABEL_AFTER_LOC(STREAM)
2990 #endif
2991
2992 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
2993 mips_output_lineno (STREAM, LINE)
2994
2995 /* The MIPS implementation uses some labels for it's own purposed. The
2996 following lists what labels are created, and are all formed by the
2997 pattern $L[a-z].*. The machine independent portion of GCC creates
2998 labels matching: $L[A-Z][0-9]+ and $L[0-9]+.
2999
3000 LM[0-9]+ Silicon Graphics/ECOFF stabs label before each stmt.
3001 $Lb[0-9]+ Begin blocks for MIPS debug support
3002 $Lc[0-9]+ Label for use in s<xx> operation.
3003 $Le[0-9]+ End blocks for MIPS debug support
3004 $Lp\..+ Half-pic labels. */
3005
3006 /* This is how to output the definition of a user-level label named NAME,
3007 such as the label on a static function or variable NAME.
3008
3009 If we are optimizing the gp, remember that this label has been put
3010 out, so we know not to emit an .extern for it in mips_asm_file_end.
3011 We use one of the common bits in the IDENTIFIER tree node for this,
3012 since those bits seem to be unused, and we don't have any method
3013 of getting the decl nodes from the name. */
3014
3015 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
3016 do { \
3017 assemble_name (STREAM, NAME); \
3018 fputs (":\n", STREAM); \
3019 } while (0)
3020
3021
3022 /* A C statement (sans semicolon) to output to the stdio stream
3023 STREAM any text necessary for declaring the name NAME of an
3024 initialized variable which is being defined. This macro must
3025 output the label definition (perhaps using `ASM_OUTPUT_LABEL').
3026 The argument DECL is the `VAR_DECL' tree node representing the
3027 variable.
3028
3029 If this macro is not defined, then the variable name is defined
3030 in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
3031
3032 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
3033 do \
3034 { \
3035 mips_declare_object (STREAM, NAME, "", ":\n", 0); \
3036 HALF_PIC_DECLARE (NAME); \
3037 } \
3038 while (0)
3039
3040
3041 /* This is how to output a command to make the user-level label named NAME
3042 defined for reference from other files. */
3043
3044 #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
3045 do { \
3046 fputs ("\t.globl\t", STREAM); \
3047 assemble_name (STREAM, NAME); \
3048 fputs ("\n", STREAM); \
3049 } while (0)
3050
3051 /* This says how to define a global common symbol. */
3052
3053 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
3054 mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", (ROUNDED))
3055
3056 /* This says how to define a local common symbol (ie, not visible to
3057 linker). */
3058
3059 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
3060 mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (ROUNDED))
3061
3062
3063 /* This says how to output an external. It would be possible not to
3064 output anything and let undefined symbol become external. However
3065 the assembler uses length information on externals to allocate in
3066 data/sdata bss/sbss, thereby saving exec time. */
3067
3068 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
3069 mips_output_external(STREAM,DECL,NAME)
3070
3071 /* This says what to print at the end of the assembly file */
3072 #define ASM_FILE_END(STREAM) mips_asm_file_end(STREAM)
3073
3074
3075 /* This is how to declare a function name. The actual work of
3076 emitting the label is moved to function_prologue, so that we can
3077 get the line number correctly emitted before the .ent directive,
3078 and after any .file directives.
3079
3080 Also, switch files if we are optimizing the global pointer. */
3081
3082 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
3083 { \
3084 extern FILE *asm_out_text_file; \
3085 if (TARGET_GP_OPT) \
3086 STREAM = asm_out_text_file; \
3087 \
3088 current_function_name = NAME; \
3089 HALF_PIC_DECLARE (NAME); \
3090 }
3091
3092 /* This is how to output a reference to a user-level label named NAME.
3093 `assemble_name' uses this. */
3094
3095 #define ASM_OUTPUT_LABELREF(STREAM,NAME) fprintf (STREAM, "%s", NAME)
3096
3097 /* This is how to output an internal numbered label where
3098 PREFIX is the class of label and NUM is the number within the class. */
3099
3100 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM,PREFIX,NUM) \
3101 fprintf (STREAM, "$%s%d:\n", PREFIX, NUM)
3102
3103 /* This is how to store into the string LABEL
3104 the symbol_ref name of an internal numbered label where
3105 PREFIX is the class of label and NUM is the number within the class.
3106 This is suitable for output with `assemble_name'. */
3107
3108 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
3109 sprintf (LABEL, "*$%s%d", PREFIX, NUM)
3110
3111 /* This is how to output an assembler line defining a `double' constant. */
3112
3113 #define ASM_OUTPUT_DOUBLE(STREAM,VALUE) \
3114 mips_output_double (STREAM, VALUE)
3115
3116
3117 /* This is how to output an assembler line defining a `float' constant. */
3118
3119 #define ASM_OUTPUT_FLOAT(STREAM,VALUE) \
3120 mips_output_float (STREAM, VALUE)
3121
3122
3123 /* This is how to output an assembler line defining an `int' constant. */
3124
3125 #define ASM_OUTPUT_INT(STREAM,VALUE) \
3126 do { \
3127 fprintf (STREAM, "\t.word\t"); \
3128 output_addr_const (STREAM, (VALUE)); \
3129 fprintf (STREAM, "\n"); \
3130 } while (0)
3131
3132 /* Likewise for `char' and `short' constants. */
3133
3134 #define ASM_OUTPUT_SHORT(STREAM,VALUE) \
3135 { \
3136 fprintf (STREAM, "\t.half\t"); \
3137 output_addr_const (STREAM, (VALUE)); \
3138 fprintf (STREAM, "\n"); \
3139 }
3140
3141 #define ASM_OUTPUT_CHAR(STREAM,VALUE) \
3142 { \
3143 fprintf (STREAM, "\t.byte\t"); \
3144 output_addr_const (STREAM, (VALUE)); \
3145 fprintf (STREAM, "\n"); \
3146 }
3147
3148 /* This is how to output an assembler line for a numeric constant byte. */
3149
3150 #define ASM_OUTPUT_BYTE(STREAM,VALUE) \
3151 fprintf (STREAM, "\t.byte\t0x%x\n", (VALUE))
3152
3153 /* This is how to output an element of a case-vector that is absolute. */
3154
3155 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
3156 fprintf (STREAM, "\t.word\t$L%d\n", VALUE)
3157
3158 /* This is how to output an element of a case-vector that is relative.
3159 (We do not use such vectors,
3160 but we must define this macro anyway.) */
3161
3162 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, VALUE, REL) \
3163 fprintf (STREAM, "\t.word\t$L%d-$L%d\n", VALUE, REL)
3164
3165 /* This is how to emit the initial label for switch statements. We
3166 need to put the switch labels somewhere else from the text section,
3167 because the MIPS assembler gets real confused about line numbers if
3168 .word's appear in the text section. */
3169
3170 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, JUMPTABLE) \
3171 { \
3172 rdata_section (); \
3173 ASM_OUTPUT_ALIGN (STREAM, 2); \
3174 ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM); \
3175 }
3176
3177 /* This is how to output an assembler line
3178 that says to advance the location counter
3179 to a multiple of 2**LOG bytes. */
3180
3181 #define ASM_OUTPUT_ALIGN(STREAM,LOG) \
3182 { \
3183 int mask = (1 << (LOG)) - 1; \
3184 fprintf (STREAM, "\t.align\t%d\n", (LOG)); \
3185 }
3186
3187 /* This is how to output an assembler line to to advance the location
3188 counter by SIZE bytes. */
3189
3190 #define ASM_OUTPUT_SKIP(STREAM,SIZE) \
3191 fprintf (STREAM, "\t.space\t%u\n", (SIZE))
3192
3193
3194 /* This is how to output a string. */
3195 #define ASM_OUTPUT_ASCII(STREAM, STRING, LEN) \
3196 do { \
3197 register int i, c, len = (LEN), cur_pos = 17; \
3198 register unsigned char *string = (unsigned char *)(STRING); \
3199 fprintf ((STREAM), "\t.ascii\t\""); \
3200 for (i = 0; i < len; i++) \
3201 { \
3202 register int c = string[i]; \
3203 \
3204 switch (c) \
3205 { \
3206 case '\"': \
3207 case '\\': \
3208 putc ('\\', (STREAM)); \
3209 putc (c, (STREAM)); \
3210 cur_pos += 2; \
3211 break; \
3212 \
3213 case TARGET_NEWLINE: \
3214 fputs ("\\n", (STREAM)); \
3215 if (i+1 < len \
3216 && (((c = string[i+1]) >= '\040' && c <= '~') \
3217 || c == TARGET_TAB)) \
3218 cur_pos = 32767; /* break right here */ \
3219 else \
3220 cur_pos += 2; \
3221 break; \
3222 \
3223 case TARGET_TAB: \
3224 fputs ("\\t", (STREAM)); \
3225 cur_pos += 2; \
3226 break; \
3227 \
3228 case TARGET_FF: \
3229 fputs ("\\f", (STREAM)); \
3230 cur_pos += 2; \
3231 break; \
3232 \
3233 case TARGET_BS: \
3234 fputs ("\\b", (STREAM)); \
3235 cur_pos += 2; \
3236 break; \
3237 \
3238 case TARGET_CR: \
3239 fputs ("\\r", (STREAM)); \
3240 cur_pos += 2; \
3241 break; \
3242 \
3243 default: \
3244 if (c >= ' ' && c < 0177) \
3245 { \
3246 putc (c, (STREAM)); \
3247 cur_pos++; \
3248 } \
3249 else \
3250 { \
3251 fprintf ((STREAM), "\\%03o", c); \
3252 cur_pos += 4; \
3253 } \
3254 } \
3255 \
3256 if (cur_pos > 72 && i+1 < len) \
3257 { \
3258 cur_pos = 17; \
3259 fprintf ((STREAM), "\"\n\t.ascii\t\""); \
3260 } \
3261 } \
3262 fprintf ((STREAM), "\"\n"); \
3263 } while (0)
3264
3265 /* Handle certain cpp directives used in header files on sysV. */
3266 #define SCCS_DIRECTIVE
3267
3268 /* Output #ident as a in the read-only data section. */
3269 #define ASM_OUTPUT_IDENT(FILE, STRING) \
3270 { \
3271 char *p = STRING; \
3272 int size = strlen (p) + 1; \
3273 rdata_section (); \
3274 assemble_string (p, size); \
3275 }
3276 \f
3277
3278 /* Define the strings to put out for each section in the object file. */
3279 #define TEXT_SECTION_ASM_OP "\t.text" /* instructions */
3280 #define DATA_SECTION_ASM_OP "\t.data" /* large data */
3281 #define SDATA_SECTION_ASM_OP "\t.sdata" /* small data */
3282 #define RDATA_SECTION_ASM_OP "\t.rdata" /* read-only data */
3283 #define READONLY_DATA_SECTION rdata_section
3284
3285 /* What other sections we support other than the normal .data/.text. */
3286
3287 #define EXTRA_SECTIONS in_sdata, in_rdata, in_last_p1
3288
3289 /* Define the additional functions to select our additional sections. */
3290
3291 /* on the MIPS it is not a good idea to put constants in the text
3292 section, since this defeats the sdata/data mechanism. This is
3293 especially true when -O is used. In this case an effort is made to
3294 address with faster (gp) register relative addressing, which can
3295 only get at sdata and sbss items (there is no stext !!) However,
3296 if the constant is too large for sdata, and it's readonly, it
3297 will go into the .rdata section. */
3298
3299 #define EXTRA_SECTION_FUNCTIONS \
3300 void \
3301 sdata_section () \
3302 { \
3303 if (in_section != in_sdata) \
3304 { \
3305 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
3306 in_section = in_sdata; \
3307 } \
3308 } \
3309 \
3310 void \
3311 rdata_section () \
3312 { \
3313 if (in_section != in_rdata) \
3314 { \
3315 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
3316 in_section = in_rdata; \
3317 } \
3318 }
3319
3320 /* Given a decl node or constant node, choose the section to output it in
3321 and select that section. */
3322
3323 #define SELECT_SECTION_MODE(MODE,RTX) \
3324 { \
3325 if ((GET_MODE_SIZE(MODE) / BITS_PER_UNIT) <= mips_section_threshold \
3326 && mips_section_threshold > 0) \
3327 sdata_section (); \
3328 else \
3329 rdata_section (); \
3330 } \
3331
3332 #define SELECT_SECTION(DECL,RELOC) \
3333 { \
3334 if (int_size_in_bytes (TREE_TYPE (DECL)) <= mips_section_threshold \
3335 && mips_section_threshold > 0) \
3336 sdata_section (); \
3337 else if (TREE_CODE (DECL) == STRING_CST) \
3338 { \
3339 if (flag_writable_strings) \
3340 data_section (); \
3341 else \
3342 rdata_section (); \
3343 } \
3344 else if (TREE_CODE (DECL) != VAR_DECL) \
3345 rdata_section (); \
3346 else if (!TREE_READONLY (DECL)) \
3347 data_section (); \
3348 else \
3349 rdata_section (); \
3350 }
3351
3352 \f
3353 /* Store in OUTPUT a string (made with alloca) containing
3354 an assembler-name for a local static variable named NAME.
3355 LABELNO is an integer which is different for each call. */
3356
3357 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
3358 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
3359 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
3360
3361 #define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \
3362 do \
3363 { \
3364 fprintf (STREAM, "\tsubu\t%s,%s,8\n\tsw\t%s,0(%s)\n", \
3365 reg_names[STACK_POINTER_REGNUM], \
3366 reg_names[STACK_POINTER_REGNUM], \
3367 reg_names[REGNO], \
3368 reg_names[STACK_POINTER_REGNUM]); \
3369 } \
3370 while (0)
3371
3372 #define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
3373 do \
3374 { \
3375 if (! set_noreorder) \
3376 fprintf (STREAM, "\t.set\tnoreorder\n"); \
3377 \
3378 dslots_load_total++; \
3379 dslots_load_filled++; \
3380 fprintf (STREAM, "\tlw\t%s,0(%s)\n\taddu\t%s,%s,8\n", \
3381 reg_names[REGNO], \
3382 reg_names[STACK_POINTER_REGNUM], \
3383 reg_names[STACK_POINTER_REGNUM], \
3384 reg_names[STACK_POINTER_REGNUM]); \
3385 \
3386 if (! set_noreorder) \
3387 fprintf (STREAM, "\t.set\treorder\n"); \
3388 } \
3389 while (0)
3390
3391 /* Define the parentheses used to group arithmetic operations
3392 in assembler code. */
3393
3394 #define ASM_OPEN_PAREN "("
3395 #define ASM_CLOSE_PAREN ")"
3396
3397 /* How to start an assembler comment. */
3398 #ifndef ASM_COMMENT_START
3399 #define ASM_COMMENT_START "\t\t# "
3400 #endif
3401
3402 \f
3403
3404 /* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
3405 and mips-tdump.c to print them out.
3406
3407 These must match the corresponding definitions in gdb/mipsread.c.
3408 Unfortunately, gcc and gdb do not currently share any directories. */
3409
3410 #define CODE_MASK 0x8F300
3411 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
3412 #define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
3413 #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
This page took 0.19418 seconds and 4 git commands to generate.