]>
Commit | Line | Data |
---|---|---|
79e68feb | 1 | /* Output variables, constants and external declarations, for GNU compiler. |
387e854a | 2 | Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc. |
79e68feb RS |
3 | |
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | ||
21 | /* This file handles generation of all the assembler code | |
22 | *except* the instructions of a function. | |
23 | This includes declarations of variables and their initial values. | |
24 | ||
25 | We also output the assembler code for constants stored in memory | |
26 | and are responsible for combining constants with the same value. */ | |
27 | ||
28 | #include <stdio.h> | |
29 | #include <setjmp.h> | |
30 | /* #include <stab.h> */ | |
31 | #include "config.h" | |
32 | #include "rtl.h" | |
33 | #include "tree.h" | |
34 | #include "flags.h" | |
57632c51 | 35 | #include "function.h" |
79e68feb RS |
36 | #include "expr.h" |
37 | #include "hard-reg-set.h" | |
38 | #include "regs.h" | |
9a631e8e | 39 | #include "defaults.h" |
24b09b50 | 40 | #include "real.h" |
79e68feb RS |
41 | |
42 | #include "obstack.h" | |
43 | ||
b4ac57ab | 44 | #ifdef XCOFF_DEBUGGING_INFO |
f246a305 | 45 | #include "xcoffout.h" |
b4ac57ab RS |
46 | #endif |
47 | ||
6baacf63 RS |
48 | #include <ctype.h> |
49 | ||
79e68feb RS |
50 | #ifndef ASM_STABS_OP |
51 | #define ASM_STABS_OP ".stabs" | |
52 | #endif | |
53 | ||
561e6650 RS |
54 | /* This macro gets just the user-specified name |
55 | out of the string in a SYMBOL_REF. On most machines, | |
56 | we discard the * if any and that's all. */ | |
57 | #ifndef STRIP_NAME_ENCODING | |
58 | #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ | |
59 | (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*')) | |
60 | #endif | |
61 | ||
79e68feb RS |
62 | /* File in which assembler code is being written. */ |
63 | ||
64 | extern FILE *asm_out_file; | |
65 | ||
66 | /* The (assembler) name of the first globally-visible object output. */ | |
67 | char *first_global_object_name; | |
68 | ||
69 | extern struct obstack *current_obstack; | |
70 | extern struct obstack *saveable_obstack; | |
71 | extern struct obstack permanent_obstack; | |
72 | #define obstack_chunk_alloc xmalloc | |
79e68feb RS |
73 | |
74 | /* Number for making the label on the next | |
75 | constant that is stored in memory. */ | |
76 | ||
77 | int const_labelno; | |
78 | ||
79 | /* Number for making the label on the next | |
80 | static variable internal to a function. */ | |
81 | ||
82 | int var_labelno; | |
83 | ||
84 | /* Nonzero if at least one function definition has been seen. */ | |
85 | static int function_defined; | |
86 | ||
87 | extern FILE *asm_out_file; | |
88 | ||
89 | static char *compare_constant_1 (); | |
90 | static void record_constant_1 (); | |
ff8f4401 | 91 | static void output_constant_def_contents (); |
2e9effae | 92 | static int contains_pointers_p (); |
ff8f4401 | 93 | |
79e68feb RS |
94 | void output_constant_pool (); |
95 | void assemble_name (); | |
96 | int output_addressed_constants (); | |
97 | void output_constant (); | |
98 | void output_constructor (); | |
11435a40 TW |
99 | void text_section (); |
100 | void readonly_data_section (); | |
f246a305 | 101 | void data_section (); |
79e68feb RS |
102 | \f |
103 | #ifdef EXTRA_SECTIONS | |
104 | static enum in_section {no_section, in_text, in_data, EXTRA_SECTIONS} in_section | |
105 | = no_section; | |
106 | #else | |
107 | static enum in_section {no_section, in_text, in_data} in_section | |
108 | = no_section; | |
109 | #endif | |
110 | ||
111 | /* Define functions like text_section for any extra sections. */ | |
112 | #ifdef EXTRA_SECTION_FUNCTIONS | |
113 | EXTRA_SECTION_FUNCTIONS | |
114 | #endif | |
115 | ||
116 | /* Tell assembler to switch to text section. */ | |
117 | ||
118 | void | |
119 | text_section () | |
120 | { | |
121 | if (in_section != in_text) | |
122 | { | |
123 | fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP); | |
124 | in_section = in_text; | |
125 | } | |
126 | } | |
127 | ||
79e68feb RS |
128 | /* Tell assembler to switch to data section. */ |
129 | ||
130 | void | |
131 | data_section () | |
132 | { | |
133 | if (in_section != in_data) | |
134 | { | |
135 | if (flag_shared_data) | |
136 | { | |
137 | #ifdef SHARED_SECTION_ASM_OP | |
138 | fprintf (asm_out_file, "%s\n", SHARED_SECTION_ASM_OP); | |
139 | #else | |
140 | fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); | |
141 | #endif | |
142 | } | |
143 | else | |
144 | fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); | |
145 | ||
146 | in_section = in_data; | |
147 | } | |
148 | } | |
149 | ||
7c6d68c8 RS |
150 | /* Tell assembler to switch to read-only data section. This is normally |
151 | the text section. */ | |
152 | ||
153 | void | |
154 | readonly_data_section () | |
155 | { | |
156 | #ifdef READONLY_DATA_SECTION | |
157 | READONLY_DATA_SECTION (); /* Note this can call data_section. */ | |
158 | #else | |
159 | text_section (); | |
160 | #endif | |
161 | } | |
162 | ||
79e68feb RS |
163 | /* Determine if we're in the text section. */ |
164 | ||
165 | int | |
166 | in_text_section () | |
167 | { | |
168 | return in_section == in_text; | |
169 | } | |
170 | \f | |
171 | /* Create the rtl to represent a function, for a function definition. | |
172 | DECL is a FUNCTION_DECL node which describes which function. | |
173 | The rtl is stored into DECL. */ | |
174 | ||
175 | void | |
176 | make_function_rtl (decl) | |
177 | tree decl; | |
178 | { | |
179 | char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); | |
180 | ||
181 | /* Rename a nested function to avoid conflicts. */ | |
182 | if (decl_function_context (decl) != 0 | |
183 | && DECL_INITIAL (decl) != 0 | |
184 | && DECL_RTL (decl) == 0) | |
185 | { | |
186 | char *label; | |
187 | ||
188 | name = IDENTIFIER_POINTER (DECL_NAME (decl)); | |
189 | ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno); | |
190 | name = obstack_copy0 (saveable_obstack, label, strlen (label)); | |
191 | var_labelno++; | |
192 | } | |
193 | ||
194 | if (DECL_RTL (decl) == 0) | |
195 | { | |
196 | DECL_RTL (decl) | |
197 | = gen_rtx (MEM, DECL_MODE (decl), | |
198 | gen_rtx (SYMBOL_REF, Pmode, name)); | |
199 | ||
200 | /* Optionally set flags or add text to the name to record information | |
201 | such as that it is a function name. If the name is changed, the macro | |
202 | ASM_OUTPUT_LABELREF will have to know how to strip this information. | |
203 | And if it finds a * at the beginning after doing so, it must handle | |
204 | that too. */ | |
205 | #ifdef ENCODE_SECTION_INFO | |
206 | ENCODE_SECTION_INFO (decl); | |
207 | #endif | |
208 | } | |
209 | ||
210 | /* Record at least one function has been defined. */ | |
211 | function_defined = 1; | |
212 | } | |
213 | ||
b4ac57ab RS |
214 | /* Given NAME, a putative register name, discard any customary prefixes. */ |
215 | ||
216 | static char * | |
217 | strip_reg_name (name) | |
218 | char *name; | |
219 | { | |
220 | #ifdef REGISTER_PREFIX | |
221 | if (!strncmp (name, REGISTER_PREFIX, strlen (REGISTER_PREFIX))) | |
222 | name += strlen (REGISTER_PREFIX); | |
223 | #endif | |
224 | if (name[0] == '%' || name[0] == '#') | |
225 | name++; | |
226 | return name; | |
227 | } | |
dcfedcd0 | 228 | \f |
79e68feb RS |
229 | /* Decode an `asm' spec for a declaration as a register name. |
230 | Return the register number, or -1 if nothing specified, | |
c09e6498 RS |
231 | or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized, |
232 | or -3 if ASMSPEC is `cc' and is not recognized, | |
233 | or -4 if ASMSPEC is `memory' and is not recognized. | |
dcfedcd0 RK |
234 | Accept an exact spelling or a decimal number. |
235 | Prefixes such as % are optional. */ | |
79e68feb RS |
236 | |
237 | int | |
238 | decode_reg_name (asmspec) | |
239 | char *asmspec; | |
240 | { | |
241 | if (asmspec != 0) | |
242 | { | |
243 | int i; | |
244 | ||
b4ac57ab RS |
245 | /* Get rid of confusing prefixes. */ |
246 | asmspec = strip_reg_name (asmspec); | |
247 | ||
fff9e713 MT |
248 | /* Allow a decimal number as a "register name". */ |
249 | for (i = strlen (asmspec) - 1; i >= 0; i--) | |
250 | if (! (asmspec[i] >= '0' && asmspec[i] <= '9')) | |
251 | break; | |
252 | if (asmspec[0] != 0 && i < 0) | |
253 | { | |
254 | i = atoi (asmspec); | |
255 | if (i < FIRST_PSEUDO_REGISTER && i >= 0) | |
256 | return i; | |
257 | else | |
258 | return -2; | |
259 | } | |
260 | ||
79e68feb | 261 | for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) |
b4ac57ab RS |
262 | if (reg_names[i][0] |
263 | && ! strcmp (asmspec, strip_reg_name (reg_names[i]))) | |
79e68feb RS |
264 | return i; |
265 | ||
79e68feb RS |
266 | #ifdef ADDITIONAL_REGISTER_NAMES |
267 | { | |
268 | static struct { char *name; int number; } table[] | |
269 | = ADDITIONAL_REGISTER_NAMES; | |
270 | ||
271 | for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) | |
272 | if (! strcmp (asmspec, table[i].name)) | |
273 | return table[i].number; | |
79e68feb RS |
274 | } |
275 | #endif /* ADDITIONAL_REGISTER_NAMES */ | |
276 | ||
c09e6498 RS |
277 | if (!strcmp (asmspec, "memory")) |
278 | return -4; | |
279 | ||
dcfedcd0 RK |
280 | if (!strcmp (asmspec, "cc")) |
281 | return -3; | |
282 | ||
79e68feb RS |
283 | return -2; |
284 | } | |
285 | ||
286 | return -1; | |
287 | } | |
288 | \f | |
289 | /* Create the DECL_RTL for a declaration for a static or external variable | |
290 | or static or external function. | |
291 | ASMSPEC, if not 0, is the string which the user specified | |
292 | as the assembler symbol name. | |
293 | TOP_LEVEL is nonzero if this is a file-scope variable. | |
294 | ||
295 | This is never called for PARM_DECL nodes. */ | |
296 | ||
297 | void | |
298 | make_decl_rtl (decl, asmspec, top_level) | |
299 | tree decl; | |
300 | char *asmspec; | |
301 | int top_level; | |
302 | { | |
303 | register char *name; | |
304 | int reg_number = decode_reg_name (asmspec); | |
305 | ||
306 | if (DECL_ASSEMBLER_NAME (decl) != NULL_TREE) | |
307 | name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); | |
308 | ||
309 | if (reg_number == -2) | |
310 | { | |
311 | /* ASMSPEC is given, and not the name of a register. */ | |
312 | name = (char *) obstack_alloc (saveable_obstack, | |
313 | strlen (asmspec) + 2); | |
314 | name[0] = '*'; | |
315 | strcpy (&name[1], asmspec); | |
316 | } | |
317 | ||
318 | /* For a duplicate declaration, we can be called twice on the | |
ff8f4401 RS |
319 | same DECL node. Don't discard the RTL already made. */ |
320 | if (DECL_RTL (decl) == 0) | |
79e68feb RS |
321 | { |
322 | DECL_RTL (decl) = 0; | |
323 | ||
324 | /* First detect errors in declaring global registers. */ | |
44fe2e80 | 325 | if (DECL_REGISTER (decl) && reg_number == -1) |
79e68feb RS |
326 | error_with_decl (decl, |
327 | "register name not specified for `%s'"); | |
44fe2e80 | 328 | else if (DECL_REGISTER (decl) && reg_number < 0) |
79e68feb RS |
329 | error_with_decl (decl, |
330 | "invalid register name for `%s'"); | |
44fe2e80 | 331 | else if ((reg_number >= 0 || reg_number == -3) && ! DECL_REGISTER (decl)) |
79e68feb RS |
332 | error_with_decl (decl, |
333 | "register name given for non-register variable `%s'"); | |
44fe2e80 | 334 | else if (DECL_REGISTER (decl) && TREE_CODE (decl) == FUNCTION_DECL) |
79e68feb | 335 | error ("function declared `register'"); |
44fe2e80 | 336 | else if (DECL_REGISTER (decl) && TYPE_MODE (TREE_TYPE (decl)) == BLKmode) |
79e68feb | 337 | error_with_decl (decl, "data type of `%s' isn't suitable for a register"); |
ce2fb245 RS |
338 | else if (DECL_REGISTER (decl) |
339 | && ! HARD_REGNO_MODE_OK (reg_number, TYPE_MODE (TREE_TYPE (decl)))) | |
340 | error_with_decl (decl, "register number for `%s' isn't suitable for the data type"); | |
79e68feb | 341 | /* Now handle properly declared static register variables. */ |
44fe2e80 | 342 | else if (DECL_REGISTER (decl)) |
79e68feb RS |
343 | { |
344 | int nregs; | |
345 | #if 0 /* yylex should print the warning for this */ | |
346 | if (pedantic) | |
347 | pedwarn ("ANSI C forbids global register variables"); | |
348 | #endif | |
349 | if (DECL_INITIAL (decl) != 0 && top_level) | |
350 | { | |
351 | DECL_INITIAL (decl) = 0; | |
352 | error ("global register variable has initial value"); | |
353 | } | |
354 | if (fixed_regs[reg_number] == 0 | |
355 | && function_defined && top_level) | |
356 | error ("global register variable follows a function definition"); | |
357 | if (TREE_THIS_VOLATILE (decl)) | |
358 | warning ("volatile register variables don't work as you might wish"); | |
31e4b1c0 RK |
359 | |
360 | /* If the user specified one of the eliminables registers here, | |
361 | e.g., FRAME_POINTER_REGNUM, we don't want to get this variable | |
362 | confused with that register and be eliminated. Although this | |
363 | usage is somewhat suspect, we nevertheless use the following | |
364 | kludge to avoid setting DECL_RTL to frame_pointer_rtx. */ | |
365 | ||
366 | DECL_RTL (decl) | |
367 | = gen_rtx (REG, DECL_MODE (decl), FIRST_PSEUDO_REGISTER); | |
368 | REGNO (DECL_RTL (decl)) = reg_number; | |
79e68feb RS |
369 | REG_USERVAR_P (DECL_RTL (decl)) = 1; |
370 | ||
371 | if (top_level) | |
372 | { | |
373 | /* Make this register fixed, so not usable for anything else. */ | |
374 | nregs = HARD_REGNO_NREGS (reg_number, DECL_MODE (decl)); | |
375 | while (nregs > 0) | |
376 | global_regs[reg_number + --nregs] = 1; | |
377 | init_reg_sets_1 (); | |
378 | } | |
379 | } | |
380 | ||
381 | /* Now handle ordinary static variables and functions (in memory). | |
382 | Also handle vars declared register invalidly. */ | |
383 | if (DECL_RTL (decl) == 0) | |
384 | { | |
385 | /* Can't use just the variable's own name for a variable | |
386 | whose scope is less than the whole file. | |
387 | Concatenate a distinguishing number. */ | |
44fe2e80 | 388 | if (!top_level && !DECL_EXTERNAL (decl) && asmspec == 0) |
79e68feb RS |
389 | { |
390 | char *label; | |
391 | ||
392 | ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno); | |
393 | name = obstack_copy0 (saveable_obstack, label, strlen (label)); | |
394 | var_labelno++; | |
395 | } | |
396 | ||
397 | DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl), | |
398 | gen_rtx (SYMBOL_REF, Pmode, name)); | |
0f15260a RS |
399 | if (TREE_THIS_VOLATILE (decl) |
400 | || (flag_volatile_global && TREE_CODE (decl) == VAR_DECL | |
401 | && TREE_PUBLIC (decl))) | |
79e68feb RS |
402 | MEM_VOLATILE_P (DECL_RTL (decl)) = 1; |
403 | if (TREE_READONLY (decl)) | |
404 | RTX_UNCHANGING_P (DECL_RTL (decl)) = 1; | |
405 | MEM_IN_STRUCT_P (DECL_RTL (decl)) | |
406 | = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE | |
407 | || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE | |
c1b98a95 RK |
408 | || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE |
409 | || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE); | |
79e68feb RS |
410 | |
411 | /* Optionally set flags or add text to the name to record information | |
412 | such as that it is a function name. | |
413 | If the name is changed, the macro ASM_OUTPUT_LABELREF | |
414 | will have to know how to strip this information. | |
415 | And if it finds a * at the beginning after doing so, | |
416 | it must handle that too. */ | |
417 | #ifdef ENCODE_SECTION_INFO | |
418 | ENCODE_SECTION_INFO (decl); | |
419 | #endif | |
420 | } | |
421 | } | |
ff8f4401 RS |
422 | /* If the old RTL had the wrong mode, fix the mode. */ |
423 | else if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl)) | |
424 | { | |
425 | rtx rtl = DECL_RTL (decl); | |
426 | PUT_MODE (rtl, DECL_MODE (decl)); | |
427 | } | |
79e68feb | 428 | } |
4724d87a RS |
429 | |
430 | /* Make the rtl for variable VAR be volatile. | |
431 | Use this only for static variables. */ | |
432 | ||
fcbaecc6 | 433 | void |
4724d87a RS |
434 | make_var_volatile (var) |
435 | tree var; | |
436 | { | |
437 | if (GET_CODE (DECL_RTL (var)) != MEM) | |
438 | abort (); | |
439 | ||
440 | MEM_VOLATILE_P (DECL_RTL (var)) = 1; | |
441 | } | |
79e68feb | 442 | \f |
d447ec6f RS |
443 | /* Output alignment directive to align for constant expression EXP. */ |
444 | ||
445 | void | |
446 | assemble_constant_align (exp) | |
447 | tree exp; | |
448 | { | |
449 | int align; | |
450 | ||
451 | /* Align the location counter as required by EXP's data type. */ | |
452 | align = TYPE_ALIGN (TREE_TYPE (exp)); | |
453 | #ifdef CONSTANT_ALIGNMENT | |
454 | align = CONSTANT_ALIGNMENT (exp, align); | |
455 | #endif | |
456 | ||
457 | if (align > BITS_PER_UNIT) | |
458 | ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); | |
459 | } | |
460 | ||
79e68feb RS |
461 | /* Output a string of literal assembler code |
462 | for an `asm' keyword used between functions. */ | |
463 | ||
464 | void | |
465 | assemble_asm (string) | |
466 | tree string; | |
467 | { | |
468 | app_enable (); | |
469 | ||
470 | if (TREE_CODE (string) == ADDR_EXPR) | |
471 | string = TREE_OPERAND (string, 0); | |
472 | ||
473 | fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string)); | |
474 | } | |
475 | ||
9bb2e4fe RS |
476 | #if 0 /* This should no longer be needed, because |
477 | flag_gnu_linker should be 0 on these systems, | |
478 | which should prevent any output | |
479 | if ASM_OUTPUT_CONSTRUCTOR and ASM_OUTPUT_DESTRUCTOR are absent. */ | |
79e68feb RS |
480 | #if !(defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER)) |
481 | #ifndef ASM_OUTPUT_CONSTRUCTOR | |
482 | #define ASM_OUTPUT_CONSTRUCTOR(file, name) | |
483 | #endif | |
484 | #ifndef ASM_OUTPUT_DESTRUCTOR | |
485 | #define ASM_OUTPUT_DESTRUCTOR(file, name) | |
486 | #endif | |
487 | #endif | |
9bb2e4fe | 488 | #endif /* 0 */ |
79e68feb RS |
489 | |
490 | /* Record an element in the table of global destructors. | |
491 | How this is done depends on what sort of assembler and linker | |
492 | are in use. | |
493 | ||
494 | NAME should be the name of a global function to be called | |
495 | at exit time. This name is output using assemble_name. */ | |
496 | ||
497 | void | |
498 | assemble_destructor (name) | |
499 | char *name; | |
500 | { | |
501 | #ifdef ASM_OUTPUT_DESTRUCTOR | |
502 | ASM_OUTPUT_DESTRUCTOR (asm_out_file, name); | |
503 | #else | |
504 | if (flag_gnu_linker) | |
505 | { | |
506 | /* Now tell GNU LD that this is part of the static destructor set. */ | |
507 | /* This code works for any machine provided you use GNU as/ld. */ | |
508 | fprintf (asm_out_file, "%s \"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP); | |
509 | assemble_name (asm_out_file, name); | |
510 | fputc ('\n', asm_out_file); | |
511 | } | |
512 | #endif | |
513 | } | |
514 | ||
515 | /* Likewise for global constructors. */ | |
516 | ||
517 | void | |
518 | assemble_constructor (name) | |
519 | char *name; | |
520 | { | |
521 | #ifdef ASM_OUTPUT_CONSTRUCTOR | |
522 | ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name); | |
523 | #else | |
524 | if (flag_gnu_linker) | |
525 | { | |
526 | /* Now tell GNU LD that this is part of the static constructor set. */ | |
527 | /* This code works for any machine provided you use GNU as/ld. */ | |
528 | fprintf (asm_out_file, "%s \"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP); | |
529 | assemble_name (asm_out_file, name); | |
530 | fputc ('\n', asm_out_file); | |
531 | } | |
532 | #endif | |
533 | } | |
534 | ||
535 | /* Likewise for entries we want to record for garbage collection. | |
536 | Garbage collection is still under development. */ | |
537 | ||
538 | void | |
539 | assemble_gc_entry (name) | |
540 | char *name; | |
541 | { | |
542 | #ifdef ASM_OUTPUT_GC_ENTRY | |
543 | ASM_OUTPUT_GC_ENTRY (asm_out_file, name); | |
544 | #else | |
545 | if (flag_gnu_linker) | |
546 | { | |
547 | /* Now tell GNU LD that this is part of the static constructor set. */ | |
548 | fprintf (asm_out_file, "%s \"___PTR_LIST__\",22,0,0,", ASM_STABS_OP); | |
549 | assemble_name (asm_out_file, name); | |
550 | fputc ('\n', asm_out_file); | |
551 | } | |
552 | #endif | |
553 | } | |
554 | \f | |
555 | /* Output assembler code for the constant pool of a function and associated | |
556 | with defining the name of the function. DECL describes the function. | |
557 | NAME is the function's name. For the constant pool, we use the current | |
558 | constant pool data. */ | |
559 | ||
560 | void | |
561 | assemble_start_function (decl, fnname) | |
562 | tree decl; | |
563 | char *fnname; | |
564 | { | |
565 | int align; | |
566 | ||
567 | /* The following code does not need preprocessing in the assembler. */ | |
568 | ||
569 | app_disable (); | |
570 | ||
571 | output_constant_pool (fnname, decl); | |
572 | ||
573 | text_section (); | |
574 | ||
575 | ||
576 | /* Tell assembler to move to target machine's alignment for functions. */ | |
577 | align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); | |
578 | if (align > 0) | |
579 | ASM_OUTPUT_ALIGN (asm_out_file, align); | |
580 | ||
581 | #ifdef ASM_OUTPUT_FUNCTION_PREFIX | |
582 | ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname); | |
583 | #endif | |
584 | ||
585 | #ifdef SDB_DEBUGGING_INFO | |
586 | /* Output SDB definition of the function. */ | |
587 | if (write_symbols == SDB_DEBUG) | |
588 | sdbout_mark_begin_function (); | |
589 | #endif | |
590 | ||
591 | #ifdef DBX_DEBUGGING_INFO | |
e5c90c23 | 592 | /* Output DBX definition of the function. */ |
79e68feb | 593 | if (write_symbols == DBX_DEBUG) |
e5c90c23 | 594 | dbxout_begin_function (decl); |
79e68feb RS |
595 | #endif |
596 | ||
597 | /* Make function name accessible from other files, if appropriate. */ | |
598 | ||
599 | if (TREE_PUBLIC (decl)) | |
600 | { | |
601 | if (!first_global_object_name) | |
561e6650 | 602 | STRIP_NAME_ENCODING (first_global_object_name, fnname); |
79e68feb RS |
603 | ASM_GLOBALIZE_LABEL (asm_out_file, fnname); |
604 | } | |
605 | ||
606 | /* Do any machine/system dependent processing of the function name */ | |
607 | #ifdef ASM_DECLARE_FUNCTION_NAME | |
608 | ASM_DECLARE_FUNCTION_NAME (asm_out_file, fnname, current_function_decl); | |
609 | #else | |
610 | /* Standard thing is just output label for the function. */ | |
611 | ASM_OUTPUT_LABEL (asm_out_file, fnname); | |
612 | #endif /* ASM_DECLARE_FUNCTION_NAME */ | |
613 | } | |
614 | ||
615 | /* Output assembler code associated with defining the size of the | |
616 | function. DECL describes the function. NAME is the function's name. */ | |
617 | ||
618 | void | |
619 | assemble_end_function (decl, fnname) | |
620 | tree decl; | |
621 | char *fnname; | |
622 | { | |
623 | #ifdef ASM_DECLARE_FUNCTION_SIZE | |
624 | ASM_DECLARE_FUNCTION_SIZE (asm_out_file, fnname, decl); | |
625 | #endif | |
626 | } | |
627 | \f | |
628 | /* Assemble code to leave SIZE bytes of zeros. */ | |
629 | ||
630 | void | |
631 | assemble_zeros (size) | |
632 | int size; | |
633 | { | |
634 | #ifdef ASM_NO_SKIP_IN_TEXT | |
635 | /* The `space' pseudo in the text section outputs nop insns rather than 0s, | |
636 | so we must output 0s explicitly in the text section. */ | |
637 | if (ASM_NO_SKIP_IN_TEXT && in_text_section ()) | |
638 | { | |
639 | int i; | |
640 | ||
641 | for (i = 0; i < size - 20; i += 20) | |
642 | { | |
643 | #ifdef ASM_BYTE_OP | |
644 | fprintf (asm_out_file, | |
645 | "%s 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n", ASM_BYTE_OP); | |
646 | #else | |
647 | fprintf (asm_out_file, | |
648 | "\tbyte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"); | |
649 | #endif | |
650 | } | |
651 | if (i < size) | |
652 | { | |
653 | #ifdef ASM_BYTE_OP | |
654 | fprintf (asm_out_file, "%s 0", ASM_BYTE_OP); | |
655 | #else | |
656 | fprintf (asm_out_file, "\tbyte 0"); | |
657 | #endif | |
658 | i++; | |
659 | for (; i < size; i++) | |
660 | fprintf (asm_out_file, ",0"); | |
661 | fprintf (asm_out_file, "\n"); | |
662 | } | |
663 | } | |
664 | else | |
665 | #endif | |
41fe4d9e RS |
666 | if (size > 0) |
667 | ASM_OUTPUT_SKIP (asm_out_file, size); | |
79e68feb RS |
668 | } |
669 | ||
a785e67e RS |
670 | /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */ |
671 | ||
672 | void | |
673 | assemble_align (align) | |
674 | int align; | |
675 | { | |
676 | if (align > BITS_PER_UNIT) | |
677 | ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); | |
678 | } | |
679 | ||
79e68feb RS |
680 | /* Assemble a string constant with the specified C string as contents. */ |
681 | ||
682 | void | |
683 | assemble_string (p, size) | |
fcbaecc6 | 684 | char *p; |
79e68feb RS |
685 | int size; |
686 | { | |
687 | register int i; | |
688 | int pos = 0; | |
689 | int maximum = 2000; | |
690 | ||
691 | /* If the string is very long, split it up. */ | |
692 | ||
693 | while (pos < size) | |
694 | { | |
695 | int thissize = size - pos; | |
696 | if (thissize > maximum) | |
697 | thissize = maximum; | |
698 | ||
79e68feb | 699 | ASM_OUTPUT_ASCII (asm_out_file, p, thissize); |
79e68feb RS |
700 | |
701 | pos += thissize; | |
702 | p += thissize; | |
703 | } | |
704 | } | |
705 | \f | |
706 | /* Assemble everything that is needed for a variable or function declaration. | |
707 | Not used for automatic variables, and not used for function definitions. | |
708 | Should not be called for variables of incomplete structure type. | |
709 | ||
710 | TOP_LEVEL is nonzero if this variable has file scope. | |
711 | AT_END is nonzero if this is the special handling, at end of compilation, | |
ff8f4401 RS |
712 | to define things that have had only tentative definitions. |
713 | DONT_OUTPUT_DATA if nonzero means don't actually output the | |
714 | initial value (that will be done by the caller). */ | |
79e68feb RS |
715 | |
716 | void | |
ff8f4401 | 717 | assemble_variable (decl, top_level, at_end, dont_output_data) |
79e68feb RS |
718 | tree decl; |
719 | int top_level; | |
720 | int at_end; | |
721 | { | |
722 | register char *name; | |
723 | int align; | |
724 | tree size_tree; | |
725 | int reloc = 0; | |
edbc355b | 726 | enum in_section saved_in_section; |
79e68feb RS |
727 | |
728 | if (GET_CODE (DECL_RTL (decl)) == REG) | |
729 | { | |
730 | /* Do output symbol info for global register variables, but do nothing | |
731 | else for them. */ | |
732 | ||
733 | if (TREE_ASM_WRITTEN (decl)) | |
734 | return; | |
735 | TREE_ASM_WRITTEN (decl) = 1; | |
736 | ||
b4ac57ab | 737 | #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) |
79e68feb | 738 | /* File-scope global variables are output here. */ |
b4ac57ab RS |
739 | if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG) |
740 | && top_level) | |
79e68feb RS |
741 | dbxout_symbol (decl, 0); |
742 | #endif | |
743 | #ifdef SDB_DEBUGGING_INFO | |
744 | if (write_symbols == SDB_DEBUG && top_level | |
745 | /* Leave initialized global vars for end of compilation; | |
746 | see comment in compile_file. */ | |
747 | && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0)) | |
748 | sdbout_symbol (decl, 0); | |
749 | #endif | |
750 | ||
751 | /* Don't output any DWARF debugging information for variables here. | |
752 | In the case of local variables, the information for them is output | |
753 | when we do our recursive traversal of the tree representation for | |
754 | the entire containing function. In the case of file-scope variables, | |
755 | we output information for all of them at the very end of compilation | |
756 | while we are doing our final traversal of the chain of file-scope | |
757 | declarations. */ | |
758 | ||
759 | return; | |
760 | } | |
761 | ||
d36d70cc RK |
762 | /* Normally no need to say anything here for external references, |
763 | since assemble_external is called by the langauge-specific code | |
764 | when a declaration is first seen. */ | |
79e68feb | 765 | |
44fe2e80 | 766 | if (DECL_EXTERNAL (decl)) |
79e68feb RS |
767 | return; |
768 | ||
769 | /* Output no assembler code for a function declaration. | |
770 | Only definitions of functions output anything. */ | |
771 | ||
772 | if (TREE_CODE (decl) == FUNCTION_DECL) | |
773 | return; | |
774 | ||
775 | /* If type was incomplete when the variable was declared, | |
776 | see if it is complete now. */ | |
777 | ||
778 | if (DECL_SIZE (decl) == 0) | |
779 | layout_decl (decl, 0); | |
780 | ||
781 | /* Still incomplete => don't allocate it; treat the tentative defn | |
782 | (which is what it must have been) as an `extern' reference. */ | |
783 | ||
ff8f4401 | 784 | if (!dont_output_data && DECL_SIZE (decl) == 0) |
79e68feb RS |
785 | { |
786 | error_with_file_and_line (DECL_SOURCE_FILE (decl), | |
787 | DECL_SOURCE_LINE (decl), | |
ea80ee44 | 788 | "storage size of `%s' isn't known", |
79e68feb RS |
789 | IDENTIFIER_POINTER (DECL_NAME (decl))); |
790 | return; | |
791 | } | |
792 | ||
793 | /* The first declaration of a variable that comes through this function | |
794 | decides whether it is global (in C, has external linkage) | |
795 | or local (in C, has internal linkage). So do nothing more | |
796 | if this function has already run. */ | |
797 | ||
798 | if (TREE_ASM_WRITTEN (decl)) | |
799 | return; | |
800 | ||
801 | TREE_ASM_WRITTEN (decl) = 1; | |
802 | ||
79e68feb RS |
803 | /* If storage size is erroneously variable, just continue. |
804 | Error message was already made. */ | |
805 | ||
ff8f4401 RS |
806 | if (DECL_SIZE (decl)) |
807 | { | |
808 | if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) | |
809 | goto finish; | |
79e68feb | 810 | |
ff8f4401 | 811 | app_disable (); |
79e68feb | 812 | |
ff8f4401 RS |
813 | /* This is better than explicit arithmetic, since it avoids overflow. */ |
814 | size_tree = size_binop (CEIL_DIV_EXPR, | |
815 | DECL_SIZE (decl), size_int (BITS_PER_UNIT)); | |
79e68feb | 816 | |
ff8f4401 RS |
817 | if (TREE_INT_CST_HIGH (size_tree) != 0) |
818 | { | |
819 | error_with_decl (decl, "size of variable `%s' is too large"); | |
820 | goto finish; | |
821 | } | |
79e68feb RS |
822 | } |
823 | ||
824 | name = XSTR (XEXP (DECL_RTL (decl), 0), 0); | |
825 | ||
826 | /* Handle uninitialized definitions. */ | |
827 | ||
828 | /* ANSI specifies that a tentative definition which is not merged with | |
829 | a non-tentative definition behaves exactly like a definition with an | |
830 | initializer equal to zero. (Section 3.7.2) | |
21432660 JW |
831 | -fno-common gives strict ANSI behavior. Usually you don't want it. |
832 | This matters only for variables with external linkage. */ | |
833 | if ((! flag_no_common || ! TREE_PUBLIC (decl)) | |
ff8f4401 | 834 | && ! dont_output_data |
79e68feb RS |
835 | && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)) |
836 | { | |
837 | int size = TREE_INT_CST_LOW (size_tree); | |
838 | int rounded = size; | |
839 | ||
840 | if (TREE_INT_CST_HIGH (size_tree) != 0) | |
841 | error_with_decl (decl, "size of variable `%s' is too large"); | |
842 | /* Don't allocate zero bytes of common, | |
843 | since that means "undefined external" in the linker. */ | |
844 | if (size == 0) rounded = 1; | |
845 | /* Round size up to multiple of BIGGEST_ALIGNMENT bits | |
846 | so that each uninitialized object starts on such a boundary. */ | |
847 | rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; | |
848 | rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) | |
849 | * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); | |
edbc355b RS |
850 | |
851 | #ifdef DBX_DEBUGGING_INFO | |
852 | /* File-scope global variables are output here. */ | |
853 | if (write_symbols == DBX_DEBUG && top_level) | |
854 | dbxout_symbol (decl, 0); | |
855 | #endif | |
856 | #ifdef SDB_DEBUGGING_INFO | |
857 | if (write_symbols == SDB_DEBUG && top_level | |
858 | /* Leave initialized global vars for end of compilation; | |
859 | see comment in compile_file. */ | |
860 | && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0)) | |
861 | sdbout_symbol (decl, 0); | |
862 | #endif | |
863 | ||
864 | /* Don't output any DWARF debugging information for variables here. | |
865 | In the case of local variables, the information for them is output | |
866 | when we do our recursive traversal of the tree representation for | |
867 | the entire containing function. In the case of file-scope variables, | |
868 | we output information for all of them at the very end of compilation | |
869 | while we are doing our final traversal of the chain of file-scope | |
870 | declarations. */ | |
871 | ||
79e68feb RS |
872 | #if 0 |
873 | if (flag_shared_data) | |
874 | data_section (); | |
875 | #endif | |
876 | if (TREE_PUBLIC (decl)) | |
877 | { | |
878 | #ifdef ASM_OUTPUT_SHARED_COMMON | |
879 | if (flag_shared_data) | |
880 | ASM_OUTPUT_SHARED_COMMON (asm_out_file, name, size, rounded); | |
881 | else | |
882 | #endif | |
883 | #ifdef ASM_OUTPUT_ALIGNED_COMMON | |
884 | ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, name, size, | |
885 | DECL_ALIGN (decl)); | |
886 | #else | |
887 | ASM_OUTPUT_COMMON (asm_out_file, name, size, rounded); | |
888 | #endif | |
889 | } | |
890 | else | |
891 | { | |
892 | #ifdef ASM_OUTPUT_SHARED_LOCAL | |
893 | if (flag_shared_data) | |
894 | ASM_OUTPUT_SHARED_LOCAL (asm_out_file, name, size, rounded); | |
895 | else | |
896 | #endif | |
897 | #ifdef ASM_OUTPUT_ALIGNED_LOCAL | |
898 | ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, | |
899 | DECL_ALIGN (decl)); | |
900 | #else | |
901 | ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded); | |
902 | #endif | |
903 | } | |
b4ac57ab | 904 | goto finish; |
79e68feb RS |
905 | } |
906 | ||
907 | /* Handle initialized definitions. */ | |
908 | ||
909 | /* First make the assembler name(s) global if appropriate. */ | |
910 | if (TREE_PUBLIC (decl) && DECL_NAME (decl)) | |
911 | { | |
912 | if (!first_global_object_name) | |
561e6650 | 913 | STRIP_NAME_ENCODING(first_global_object_name, name); |
79e68feb RS |
914 | ASM_GLOBALIZE_LABEL (asm_out_file, name); |
915 | } | |
916 | #if 0 | |
917 | for (d = equivalents; d; d = TREE_CHAIN (d)) | |
918 | { | |
919 | tree e = TREE_VALUE (d); | |
920 | if (TREE_PUBLIC (e) && DECL_NAME (e)) | |
921 | ASM_GLOBALIZE_LABEL (asm_out_file, | |
922 | XSTR (XEXP (DECL_RTL (e), 0), 0)); | |
923 | } | |
924 | #endif | |
925 | ||
926 | /* Output any data that we will need to use the address of. */ | |
2e9effae RS |
927 | if (DECL_INITIAL (decl) == error_mark_node) |
928 | reloc = contains_pointers_p (TREE_TYPE (decl)); | |
929 | else if (DECL_INITIAL (decl)) | |
79e68feb RS |
930 | reloc = output_addressed_constants (DECL_INITIAL (decl)); |
931 | ||
932 | /* Switch to the proper section for this data. */ | |
933 | #ifdef SELECT_SECTION | |
934 | SELECT_SECTION (decl, reloc); | |
935 | #else | |
936 | if (TREE_READONLY (decl) | |
937 | && ! TREE_THIS_VOLATILE (decl) | |
938 | && ! (flag_pic && reloc)) | |
939 | readonly_data_section (); | |
940 | else | |
941 | data_section (); | |
942 | #endif | |
943 | ||
edbc355b RS |
944 | /* Record current section so we can restore it if dbxout.c clobbers it. */ |
945 | saved_in_section = in_section; | |
946 | ||
947 | /* Output the dbx info now that we have chosen the section. */ | |
948 | ||
949 | #ifdef DBX_DEBUGGING_INFO | |
950 | /* File-scope global variables are output here. */ | |
951 | if (write_symbols == DBX_DEBUG && top_level) | |
952 | dbxout_symbol (decl, 0); | |
953 | #endif | |
954 | #ifdef SDB_DEBUGGING_INFO | |
955 | if (write_symbols == SDB_DEBUG && top_level | |
956 | /* Leave initialized global vars for end of compilation; | |
957 | see comment in compile_file. */ | |
958 | && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0)) | |
959 | sdbout_symbol (decl, 0); | |
960 | #endif | |
961 | ||
962 | /* Don't output any DWARF debugging information for variables here. | |
963 | In the case of local variables, the information for them is output | |
964 | when we do our recursive traversal of the tree representation for | |
965 | the entire containing function. In the case of file-scope variables, | |
966 | we output information for all of them at the very end of compilation | |
967 | while we are doing our final traversal of the chain of file-scope | |
968 | declarations. */ | |
969 | ||
970 | if (in_section != saved_in_section) | |
971 | { | |
972 | /* Switch to the proper section for this data. */ | |
973 | #ifdef SELECT_SECTION | |
974 | SELECT_SECTION (decl, reloc); | |
975 | #else | |
976 | if (TREE_READONLY (decl) | |
977 | && ! TREE_THIS_VOLATILE (decl) | |
978 | && ! (flag_pic && reloc)) | |
979 | readonly_data_section (); | |
980 | else | |
981 | data_section (); | |
982 | #endif | |
983 | } | |
984 | ||
79e68feb RS |
985 | /* Compute and output the alignment of this data. */ |
986 | ||
987 | align = DECL_ALIGN (decl); | |
a785e67e RS |
988 | /* In the case for initialing an array whose length isn't specified, |
989 | where we have not yet been able to do the layout, | |
990 | figure out the proper alignment now. */ | |
991 | if (dont_output_data && DECL_SIZE (decl) == 0 | |
992 | && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) | |
993 | align = MAX (align, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl)))); | |
994 | ||
79e68feb RS |
995 | /* Some object file formats have a maximum alignment which they support. |
996 | In particular, a.out format supports a maximum alignment of 4. */ | |
997 | #ifndef MAX_OFILE_ALIGNMENT | |
998 | #define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT | |
999 | #endif | |
1000 | if (align > MAX_OFILE_ALIGNMENT) | |
1001 | { | |
1002 | warning_with_decl (decl, | |
1003 | "alignment of `%s' is greater than maximum object file alignment"); | |
1004 | align = MAX_OFILE_ALIGNMENT; | |
1005 | } | |
1006 | #ifdef DATA_ALIGNMENT | |
1007 | /* On some machines, it is good to increase alignment sometimes. */ | |
1008 | align = DATA_ALIGNMENT (TREE_TYPE (decl), align); | |
1009 | #endif | |
1010 | #ifdef CONSTANT_ALIGNMENT | |
1011 | if (DECL_INITIAL (decl)) | |
1012 | align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align); | |
1013 | #endif | |
1014 | ||
1015 | /* Reset the alignment in case we have made it tighter, so we can benefit | |
1016 | from it in get_pointer_alignment. */ | |
1017 | DECL_ALIGN (decl) = align; | |
1018 | ||
1019 | if (align > BITS_PER_UNIT) | |
1020 | ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); | |
1021 | ||
1022 | /* Do any machine/system dependent processing of the object. */ | |
1023 | #ifdef ASM_DECLARE_OBJECT_NAME | |
1024 | ASM_DECLARE_OBJECT_NAME (asm_out_file, name, decl); | |
1025 | #else | |
1026 | /* Standard thing is just output label for the object. */ | |
1027 | ASM_OUTPUT_LABEL (asm_out_file, name); | |
1028 | #endif /* ASM_DECLARE_OBJECT_NAME */ | |
1029 | ||
ff8f4401 | 1030 | if (!dont_output_data) |
79e68feb | 1031 | { |
ff8f4401 RS |
1032 | if (DECL_INITIAL (decl)) |
1033 | /* Output the actual data. */ | |
1034 | output_constant (DECL_INITIAL (decl), | |
1035 | int_size_in_bytes (TREE_TYPE (decl))); | |
1036 | else | |
1037 | /* Leave space for it. */ | |
1038 | assemble_zeros (int_size_in_bytes (TREE_TYPE (decl))); | |
79e68feb | 1039 | } |
b4ac57ab RS |
1040 | |
1041 | finish: | |
1042 | #ifdef XCOFF_DEBUGGING_INFO | |
1043 | /* Unfortunately, the IBM assembler cannot handle stabx before the actual | |
1044 | declaration. When something like ".stabx "aa:S-2",aa,133,0" is emitted | |
1045 | and `aa' hasn't been output yet, the assembler generates a stab entry with | |
1046 | a value of zero, in addition to creating an unnecessary external entry | |
6dc42e49 | 1047 | for `aa'. Hence, we must postpone dbxout_symbol to here at the end. */ |
b4ac57ab RS |
1048 | |
1049 | /* File-scope global variables are output here. */ | |
1050 | if (write_symbols == XCOFF_DEBUG && top_level) | |
05be4cea JW |
1051 | { |
1052 | saved_in_section = in_section; | |
1053 | ||
1054 | dbxout_symbol (decl, 0); | |
1055 | ||
1056 | if (in_section != saved_in_section) | |
1057 | { | |
1058 | /* Switch to the proper section for this data. */ | |
1059 | #ifdef SELECT_SECTION | |
1060 | SELECT_SECTION (decl, reloc); | |
1061 | #else | |
1062 | if (TREE_READONLY (decl) | |
1063 | && ! TREE_THIS_VOLATILE (decl) | |
1064 | && ! (flag_pic && reloc)) | |
1065 | readonly_data_section (); | |
1066 | else | |
1067 | data_section (); | |
1068 | #endif | |
1069 | } | |
1070 | } | |
b4ac57ab RS |
1071 | #else |
1072 | /* There must be a statement after a label. */ | |
1073 | ; | |
1074 | #endif | |
79e68feb RS |
1075 | } |
1076 | ||
2e9effae RS |
1077 | /* Return 1 if type TYPE contains any pointers. */ |
1078 | ||
1079 | static int | |
1080 | contains_pointers_p (type) | |
1081 | tree type; | |
1082 | { | |
1083 | switch (TREE_CODE (type)) | |
1084 | { | |
1085 | case POINTER_TYPE: | |
1086 | case REFERENCE_TYPE: | |
1087 | /* I'm not sure whether OFFSET_TYPE needs this treatment, | |
1088 | so I'll play safe and return 1. */ | |
1089 | case OFFSET_TYPE: | |
1090 | return 1; | |
1091 | ||
1092 | case RECORD_TYPE: | |
1093 | case UNION_TYPE: | |
1094 | case QUAL_UNION_TYPE: | |
1095 | { | |
1096 | tree fields; | |
1097 | /* For a type that has fields, see if the fields have pointers. */ | |
1098 | for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields)) | |
1099 | if (contains_pointers_p (TREE_TYPE (fields))) | |
1100 | return 1; | |
1101 | return 0; | |
1102 | } | |
1103 | ||
1104 | case ARRAY_TYPE: | |
1105 | /* An array type contains pointers if its element type does. */ | |
1106 | return contains_pointers_p (TREE_TYPE (type)); | |
1107 | ||
1108 | default: | |
1109 | return 0; | |
1110 | } | |
1111 | } | |
1112 | ||
79e68feb | 1113 | /* Output something to declare an external symbol to the assembler. |
fff9e713 MT |
1114 | (Most assemblers don't need this, so we normally output nothing.) |
1115 | Do nothing if DECL is not external. */ | |
79e68feb RS |
1116 | |
1117 | void | |
1118 | assemble_external (decl) | |
1119 | tree decl; | |
1120 | { | |
79e68feb | 1121 | #ifdef ASM_OUTPUT_EXTERNAL |
fff9e713 | 1122 | if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd' |
44fe2e80 | 1123 | && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) |
79e68feb | 1124 | { |
fff9e713 MT |
1125 | rtx rtl = DECL_RTL (decl); |
1126 | ||
1127 | if (GET_CODE (rtl) == MEM && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF | |
1128 | && ! SYMBOL_REF_USED (XEXP (rtl, 0))) | |
1129 | { | |
1130 | /* Some systems do require some output. */ | |
1131 | SYMBOL_REF_USED (XEXP (rtl, 0)) = 1; | |
1132 | ASM_OUTPUT_EXTERNAL (asm_out_file, decl, XSTR (XEXP (rtl, 0), 0)); | |
1133 | } | |
79e68feb RS |
1134 | } |
1135 | #endif | |
1136 | } | |
1137 | ||
1138 | /* Similar, for calling a library function FUN. */ | |
1139 | ||
1140 | void | |
1141 | assemble_external_libcall (fun) | |
1142 | rtx fun; | |
1143 | { | |
1144 | #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL | |
1145 | /* Declare library function name external when first used, if nec. */ | |
1146 | if (! SYMBOL_REF_USED (fun)) | |
1147 | { | |
1148 | SYMBOL_REF_USED (fun) = 1; | |
1149 | ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun); | |
1150 | } | |
1151 | #endif | |
1152 | } | |
1153 | ||
1154 | /* Declare the label NAME global. */ | |
1155 | ||
1156 | void | |
1157 | assemble_global (name) | |
1158 | char *name; | |
1159 | { | |
1160 | ASM_GLOBALIZE_LABEL (asm_out_file, name); | |
1161 | } | |
1162 | ||
1163 | /* Assemble a label named NAME. */ | |
1164 | ||
1165 | void | |
1166 | assemble_label (name) | |
1167 | char *name; | |
1168 | { | |
1169 | ASM_OUTPUT_LABEL (asm_out_file, name); | |
1170 | } | |
1171 | ||
1172 | /* Output to FILE a reference to the assembler name of a C-level name NAME. | |
1173 | If NAME starts with a *, the rest of NAME is output verbatim. | |
1174 | Otherwise NAME is transformed in an implementation-defined way | |
1175 | (usually by the addition of an underscore). | |
1176 | Many macros in the tm file are defined to call this function. */ | |
1177 | ||
1178 | void | |
1179 | assemble_name (file, name) | |
1180 | FILE *file; | |
1181 | char *name; | |
1182 | { | |
1183 | if (name[0] == '*') | |
1184 | fputs (&name[1], file); | |
1185 | else | |
1186 | ASM_OUTPUT_LABELREF (file, name); | |
1187 | } | |
1188 | ||
1189 | /* Allocate SIZE bytes writable static space with a gensym name | |
1190 | and return an RTX to refer to its address. */ | |
1191 | ||
1192 | rtx | |
1193 | assemble_static_space (size) | |
1194 | int size; | |
1195 | { | |
1196 | char name[12]; | |
1197 | char *namestring; | |
1198 | rtx x; | |
1199 | /* Round size up to multiple of BIGGEST_ALIGNMENT bits | |
1200 | so that each uninitialized object starts on such a boundary. */ | |
1201 | int rounded = ((size + (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1) | |
1202 | / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) | |
1203 | * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); | |
1204 | ||
1205 | #if 0 | |
1206 | if (flag_shared_data) | |
1207 | data_section (); | |
1208 | #endif | |
1209 | ||
1210 | ASM_GENERATE_INTERNAL_LABEL (name, "LF", const_labelno); | |
1211 | ++const_labelno; | |
1212 | ||
1213 | namestring = (char *) obstack_alloc (saveable_obstack, | |
1214 | strlen (name) + 2); | |
1215 | strcpy (namestring, name); | |
1216 | ||
1217 | x = gen_rtx (SYMBOL_REF, Pmode, namestring); | |
1218 | #ifdef ASM_OUTPUT_ALIGNED_LOCAL | |
1219 | ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, BIGGEST_ALIGNMENT); | |
1220 | #else | |
1221 | ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded); | |
1222 | #endif | |
1223 | return x; | |
1224 | } | |
1225 | ||
1226 | /* Assemble the static constant template for function entry trampolines. | |
1227 | This is done at most once per compilation. | |
1228 | Returns an RTX for the address of the template. */ | |
1229 | ||
1230 | rtx | |
1231 | assemble_trampoline_template () | |
1232 | { | |
1233 | char label[256]; | |
1234 | char *name; | |
1235 | int align; | |
1236 | ||
37552631 | 1237 | /* By default, put trampoline templates in read-only data section. */ |
f49acdb4 | 1238 | |
37552631 RS |
1239 | #ifdef TRAMPOLINE_SECTION |
1240 | TRAMPOLINE_SECTION (); | |
1241 | #else | |
c8c29f85 | 1242 | readonly_data_section (); |
37552631 | 1243 | #endif |
f49acdb4 | 1244 | |
79e68feb RS |
1245 | /* Write the assembler code to define one. */ |
1246 | align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); | |
1247 | if (align > 0) | |
1248 | ASM_OUTPUT_ALIGN (asm_out_file, align); | |
1249 | ||
1250 | ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LTRAMP", 0); | |
1251 | TRAMPOLINE_TEMPLATE (asm_out_file); | |
1252 | ||
1253 | /* Record the rtl to refer to it. */ | |
1254 | ASM_GENERATE_INTERNAL_LABEL (label, "LTRAMP", 0); | |
1255 | name | |
1256 | = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label)); | |
1257 | return gen_rtx (SYMBOL_REF, Pmode, name); | |
1258 | } | |
1259 | \f | |
1260 | /* Assemble the integer constant X into an object of SIZE bytes. | |
1261 | X must be either a CONST_INT or CONST_DOUBLE. | |
1262 | ||
1263 | Return 1 if we were able to output the constant, otherwise 0. If FORCE is | |
1264 | non-zero, abort if we can't output the constant. */ | |
1265 | ||
1266 | int | |
1267 | assemble_integer (x, size, force) | |
1268 | rtx x; | |
1269 | int size; | |
1270 | int force; | |
1271 | { | |
1272 | /* First try to use the standard 1, 2, 4, 8, and 16 byte | |
1273 | ASM_OUTPUT... macros. */ | |
1274 | ||
1275 | switch (size) | |
1276 | { | |
1277 | #ifdef ASM_OUTPUT_CHAR | |
1278 | case 1: | |
1279 | ASM_OUTPUT_CHAR (asm_out_file, x); | |
1280 | return 1; | |
1281 | #endif | |
1282 | ||
1283 | #ifdef ASM_OUTPUT_SHORT | |
1284 | case 2: | |
1285 | ASM_OUTPUT_SHORT (asm_out_file, x); | |
1286 | return 1; | |
1287 | #endif | |
1288 | ||
1289 | #ifdef ASM_OUTPUT_INT | |
1290 | case 4: | |
1291 | ASM_OUTPUT_INT (asm_out_file, x); | |
1292 | return 1; | |
1293 | #endif | |
1294 | ||
1295 | #ifdef ASM_OUTPUT_DOUBLE_INT | |
1296 | case 8: | |
1297 | ASM_OUTPUT_DOUBLE_INT (asm_out_file, x); | |
1298 | return 1; | |
1299 | #endif | |
1300 | ||
1301 | #ifdef ASM_OUTPUT_QUADRUPLE_INT | |
1302 | case 16: | |
1303 | ASM_OUTPUT_QUADRUPLE_INT (asm_out_file, x); | |
1304 | return 1; | |
1305 | #endif | |
1306 | } | |
1307 | ||
1308 | /* If we couldn't do it that way, there are two other possibilities: First, | |
1309 | if the machine can output an explicit byte and this is a 1 byte constant, | |
1310 | we can use ASM_OUTPUT_BYTE. */ | |
1311 | ||
1312 | #ifdef ASM_OUTPUT_BYTE | |
1313 | if (size == 1 && GET_CODE (x) == CONST_INT) | |
1314 | { | |
1315 | ASM_OUTPUT_BYTE (asm_out_file, INTVAL (x)); | |
1316 | return 1; | |
1317 | } | |
1318 | #endif | |
1319 | ||
1320 | /* Finally, if SIZE is larger than a single word, try to output the constant | |
1321 | one word at a time. */ | |
1322 | ||
1323 | if (size > UNITS_PER_WORD) | |
1324 | { | |
1325 | int i; | |
1326 | enum machine_mode mode | |
1327 | = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0); | |
1328 | rtx word; | |
1329 | ||
1330 | for (i = 0; i < size / UNITS_PER_WORD; i++) | |
1331 | { | |
1332 | word = operand_subword (x, i, 0, mode); | |
1333 | ||
1334 | if (word == 0) | |
1335 | break; | |
1336 | ||
fff9e713 MT |
1337 | if (! assemble_integer (word, UNITS_PER_WORD, 0)) |
1338 | break; | |
79e68feb RS |
1339 | } |
1340 | ||
1341 | if (i == size / UNITS_PER_WORD) | |
1342 | return 1; | |
fff9e713 MT |
1343 | /* If we output at least one word and then could not finish, |
1344 | there is no valid way to continue. */ | |
1345 | if (i > 0) | |
1346 | abort (); | |
79e68feb RS |
1347 | } |
1348 | ||
1349 | if (force) | |
1350 | abort (); | |
1351 | ||
1352 | return 0; | |
1353 | } | |
1354 | \f | |
1355 | /* Assemble the floating-point constant D into an object of size MODE. */ | |
1356 | ||
1357 | void | |
1358 | assemble_real (d, mode) | |
1359 | REAL_VALUE_TYPE d; | |
1360 | enum machine_mode mode; | |
1361 | { | |
1362 | jmp_buf output_constant_handler; | |
1363 | ||
1364 | if (setjmp (output_constant_handler)) | |
1365 | { | |
1366 | error ("floating point trap outputting a constant"); | |
1367 | #ifdef REAL_IS_NOT_DOUBLE | |
1368 | bzero (&d, sizeof d); | |
1369 | d = dconst0; | |
1370 | #else | |
1371 | d = 0; | |
1372 | #endif | |
1373 | } | |
1374 | ||
1375 | set_float_handler (output_constant_handler); | |
1376 | ||
1377 | switch (mode) | |
1378 | { | |
b7526ea5 RS |
1379 | #ifdef ASM_OUTPUT_BYTE_FLOAT |
1380 | case QFmode: | |
1381 | ASM_OUTPUT_BYTE_FLOAT (asm_out_file, d); | |
1382 | break; | |
1383 | #endif | |
1384 | #ifdef ASM_OUTPUT_SHORT_FLOAT | |
1385 | case HFmode: | |
1386 | ASM_OUTPUT_SHORT_FLOAT (asm_out_file, d); | |
1387 | break; | |
1388 | #endif | |
79e68feb RS |
1389 | #ifdef ASM_OUTPUT_FLOAT |
1390 | case SFmode: | |
1391 | ASM_OUTPUT_FLOAT (asm_out_file, d); | |
1392 | break; | |
1393 | #endif | |
1394 | ||
1395 | #ifdef ASM_OUTPUT_DOUBLE | |
1396 | case DFmode: | |
1397 | ASM_OUTPUT_DOUBLE (asm_out_file, d); | |
1398 | break; | |
1399 | #endif | |
1400 | ||
1401 | #ifdef ASM_OUTPUT_LONG_DOUBLE | |
2c7ff63c | 1402 | case XFmode: |
79e68feb RS |
1403 | case TFmode: |
1404 | ASM_OUTPUT_LONG_DOUBLE (asm_out_file, d); | |
1405 | break; | |
1406 | #endif | |
1407 | ||
1408 | default: | |
1409 | abort (); | |
1410 | } | |
1411 | ||
37366632 | 1412 | set_float_handler (NULL_PTR); |
79e68feb RS |
1413 | } |
1414 | \f | |
1415 | /* Here we combine duplicate floating constants to make | |
1416 | CONST_DOUBLE rtx's, and force those out to memory when necessary. */ | |
1417 | ||
1418 | /* Chain of all CONST_DOUBLE rtx's constructed for the current function. | |
1419 | They are chained through the CONST_DOUBLE_CHAIN. | |
1420 | A CONST_DOUBLE rtx has CONST_DOUBLE_MEM != cc0_rtx iff it is on this chain. | |
1421 | In that case, CONST_DOUBLE_MEM is either a MEM, | |
57632c51 RS |
1422 | or const0_rtx if no MEM has been made for this CONST_DOUBLE yet. |
1423 | ||
1424 | (CONST_DOUBLE_MEM is used only for top-level functions. | |
1425 | See force_const_mem for explanation.) */ | |
79e68feb RS |
1426 | |
1427 | static rtx const_double_chain; | |
1428 | ||
1429 | /* Return a CONST_DOUBLE for a value specified as a pair of ints. | |
1430 | For an integer, I0 is the low-order word and I1 is the high-order word. | |
1431 | For a real number, I0 is the word with the low address | |
1432 | and I1 is the word with the high address. */ | |
1433 | ||
1434 | rtx | |
1435 | immed_double_const (i0, i1, mode) | |
37366632 | 1436 | HOST_WIDE_INT i0, i1; |
79e68feb RS |
1437 | enum machine_mode mode; |
1438 | { | |
1439 | register rtx r; | |
1440 | int in_current_obstack; | |
1441 | ||
ab8ab9d0 SC |
1442 | if (GET_MODE_CLASS (mode) == MODE_INT |
1443 | || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) | |
79e68feb RS |
1444 | { |
1445 | /* We clear out all bits that don't belong in MODE, unless they and our | |
1446 | sign bit are all one. So we get either a reasonable negative value | |
1447 | or a reasonable unsigned value for this mode. */ | |
1448 | int width = GET_MODE_BITSIZE (mode); | |
37366632 RK |
1449 | if (width < HOST_BITS_PER_WIDE_INT |
1450 | && ((i0 & ((HOST_WIDE_INT) (-1) << (width - 1))) | |
1451 | != ((HOST_WIDE_INT) (-1) << (width - 1)))) | |
1452 | i0 &= ((HOST_WIDE_INT) 1 << width) - 1, i1 = 0; | |
1453 | else if (width == HOST_BITS_PER_WIDE_INT | |
79e68feb RS |
1454 | && ! (i1 == ~0 && i0 < 0)) |
1455 | i1 = 0; | |
37366632 | 1456 | else if (width > 2 * HOST_BITS_PER_WIDE_INT) |
79e68feb RS |
1457 | /* We cannot represent this value as a constant. */ |
1458 | abort (); | |
1459 | ||
37366632 | 1460 | /* If MODE fits within HOST_BITS_PER_WIDE_INT, always use a CONST_INT. |
79e68feb RS |
1461 | |
1462 | ??? Strictly speaking, this is wrong if we create a CONST_INT | |
1463 | for a large unsigned constant with the size of MODE being | |
37366632 RK |
1464 | HOST_BITS_PER_WIDE_INT and later try to interpret that constant in a |
1465 | wider mode. In that case we will mis-interpret it as a negative | |
1466 | number. | |
79e68feb RS |
1467 | |
1468 | Unfortunately, the only alternative is to make a CONST_DOUBLE | |
1469 | for any constant in any mode if it is an unsigned constant larger | |
1470 | than the maximum signed integer in an int on the host. However, | |
1471 | doing this will break everyone that always expects to see a CONST_INT | |
1472 | for SImode and smaller. | |
1473 | ||
1474 | We have always been making CONST_INTs in this case, so nothing new | |
1475 | is being broken. */ | |
1476 | ||
37366632 | 1477 | if (width <= HOST_BITS_PER_WIDE_INT) |
79e68feb RS |
1478 | i1 = (i0 < 0) ? ~0 : 0; |
1479 | ||
1480 | /* If this integer fits in one word, return a CONST_INT. */ | |
1481 | if ((i1 == 0 && i0 >= 0) | |
1482 | || (i1 == ~0 && i0 < 0)) | |
37366632 | 1483 | return GEN_INT (i0); |
79e68feb RS |
1484 | |
1485 | /* We use VOIDmode for integers. */ | |
1486 | mode = VOIDmode; | |
1487 | } | |
1488 | ||
1489 | /* Search the chain for an existing CONST_DOUBLE with the right value. | |
1490 | If one is found, return it. */ | |
1491 | ||
1492 | for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r)) | |
1493 | if (CONST_DOUBLE_LOW (r) == i0 && CONST_DOUBLE_HIGH (r) == i1 | |
1494 | && GET_MODE (r) == mode) | |
1495 | return r; | |
1496 | ||
1497 | /* No; make a new one and add it to the chain. | |
1498 | ||
1499 | We may be called by an optimizer which may be discarding any memory | |
1500 | allocated during its processing (such as combine and loop). However, | |
1501 | we will be leaving this constant on the chain, so we cannot tolerate | |
1502 | freed memory. So switch to saveable_obstack for this allocation | |
1503 | and then switch back if we were in current_obstack. */ | |
1504 | ||
2260924f JW |
1505 | push_obstacks_nochange (); |
1506 | rtl_in_saveable_obstack (); | |
79e68feb | 1507 | r = gen_rtx (CONST_DOUBLE, mode, 0, i0, i1); |
2260924f | 1508 | pop_obstacks (); |
79e68feb | 1509 | |
5145eda8 RS |
1510 | /* Don't touch const_double_chain in nested function; |
1511 | see force_const_mem. */ | |
8843f6e2 | 1512 | if (outer_function_chain == 0) |
5145eda8 RS |
1513 | { |
1514 | CONST_DOUBLE_CHAIN (r) = const_double_chain; | |
1515 | const_double_chain = r; | |
1516 | } | |
79e68feb RS |
1517 | |
1518 | /* Store const0_rtx in mem-slot since this CONST_DOUBLE is on the chain. | |
1519 | Actual use of mem-slot is only through force_const_mem. */ | |
1520 | ||
1521 | CONST_DOUBLE_MEM (r) = const0_rtx; | |
1522 | ||
1523 | return r; | |
1524 | } | |
1525 | ||
1526 | /* Return a CONST_DOUBLE for a specified `double' value | |
1527 | and machine mode. */ | |
1528 | ||
1529 | rtx | |
1530 | immed_real_const_1 (d, mode) | |
1531 | REAL_VALUE_TYPE d; | |
1532 | enum machine_mode mode; | |
1533 | { | |
1534 | union real_extract u; | |
1535 | register rtx r; | |
1536 | int in_current_obstack; | |
1537 | ||
1538 | /* Get the desired `double' value as a sequence of ints | |
1539 | since that is how they are stored in a CONST_DOUBLE. */ | |
1540 | ||
1541 | u.d = d; | |
1542 | ||
1543 | /* Detect special cases. */ | |
1544 | ||
f246a305 RS |
1545 | /* Avoid REAL_VALUES_EQUAL here in order to distinguish minus zero. */ |
1546 | if (!bcmp (&dconst0, &d, sizeof d)) | |
79e68feb | 1547 | return CONST0_RTX (mode); |
12194c38 RS |
1548 | /* Check for NaN first, because some ports (specifically the i386) do not |
1549 | emit correct ieee-fp code by default, and thus will generate a core | |
1550 | dump here if we pass a NaN to REAL_VALUES_EQUAL and if REAL_VALUES_EQUAL | |
1551 | does a floating point comparison. */ | |
1552 | else if (! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d)) | |
79e68feb RS |
1553 | return CONST1_RTX (mode); |
1554 | ||
37366632 | 1555 | if (sizeof u == 2 * sizeof (HOST_WIDE_INT)) |
79e68feb RS |
1556 | return immed_double_const (u.i[0], u.i[1], mode); |
1557 | ||
1558 | /* The rest of this function handles the case where | |
1559 | a float value requires more than 2 ints of space. | |
1560 | It will be deleted as dead code on machines that don't need it. */ | |
1561 | ||
1562 | /* Search the chain for an existing CONST_DOUBLE with the right value. | |
1563 | If one is found, return it. */ | |
1564 | ||
1565 | for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r)) | |
1566 | if (! bcmp (&CONST_DOUBLE_LOW (r), &u, sizeof u) | |
1567 | && GET_MODE (r) == mode) | |
1568 | return r; | |
1569 | ||
1570 | /* No; make a new one and add it to the chain. | |
1571 | ||
1572 | We may be called by an optimizer which may be discarding any memory | |
1573 | allocated during its processing (such as combine and loop). However, | |
1574 | we will be leaving this constant on the chain, so we cannot tolerate | |
1575 | freed memory. So switch to saveable_obstack for this allocation | |
1576 | and then switch back if we were in current_obstack. */ | |
1577 | ||
2260924f JW |
1578 | push_obstacks_nochange (); |
1579 | rtl_in_saveable_obstack (); | |
79e68feb RS |
1580 | r = rtx_alloc (CONST_DOUBLE); |
1581 | PUT_MODE (r, mode); | |
1582 | bcopy (&u, &CONST_DOUBLE_LOW (r), sizeof u); | |
2260924f | 1583 | pop_obstacks (); |
79e68feb | 1584 | |
5145eda8 RS |
1585 | /* Don't touch const_double_chain in nested function; |
1586 | see force_const_mem. */ | |
8843f6e2 | 1587 | if (outer_function_chain == 0) |
5145eda8 RS |
1588 | { |
1589 | CONST_DOUBLE_CHAIN (r) = const_double_chain; | |
1590 | const_double_chain = r; | |
1591 | } | |
79e68feb RS |
1592 | |
1593 | /* Store const0_rtx in CONST_DOUBLE_MEM since this CONST_DOUBLE is on the | |
1594 | chain, but has not been allocated memory. Actual use of CONST_DOUBLE_MEM | |
1595 | is only through force_const_mem. */ | |
1596 | ||
1597 | CONST_DOUBLE_MEM (r) = const0_rtx; | |
1598 | ||
1599 | return r; | |
1600 | } | |
1601 | ||
1602 | /* Return a CONST_DOUBLE rtx for a value specified by EXP, | |
1603 | which must be a REAL_CST tree node. */ | |
1604 | ||
1605 | rtx | |
1606 | immed_real_const (exp) | |
1607 | tree exp; | |
1608 | { | |
1609 | return immed_real_const_1 (TREE_REAL_CST (exp), TYPE_MODE (TREE_TYPE (exp))); | |
1610 | } | |
1611 | ||
1612 | /* At the end of a function, forget the memory-constants | |
1613 | previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain. | |
1614 | Also clear out real_constant_chain and clear out all the chain-pointers. */ | |
1615 | ||
1616 | void | |
1617 | clear_const_double_mem () | |
1618 | { | |
1619 | register rtx r, next; | |
1620 | ||
57632c51 RS |
1621 | /* Don't touch CONST_DOUBLE_MEM for nested functions. |
1622 | See force_const_mem for explanation. */ | |
1623 | if (outer_function_chain != 0) | |
1624 | return; | |
1625 | ||
79e68feb RS |
1626 | for (r = const_double_chain; r; r = next) |
1627 | { | |
1628 | next = CONST_DOUBLE_CHAIN (r); | |
1629 | CONST_DOUBLE_CHAIN (r) = 0; | |
1630 | CONST_DOUBLE_MEM (r) = cc0_rtx; | |
1631 | } | |
1632 | const_double_chain = 0; | |
1633 | } | |
1634 | \f | |
1635 | /* Given an expression EXP with a constant value, | |
1636 | reduce it to the sum of an assembler symbol and an integer. | |
1637 | Store them both in the structure *VALUE. | |
1638 | Abort if EXP does not reduce. */ | |
1639 | ||
1640 | struct addr_const | |
1641 | { | |
1642 | rtx base; | |
fb351073 | 1643 | HOST_WIDE_INT offset; |
79e68feb RS |
1644 | }; |
1645 | ||
1646 | static void | |
1647 | decode_addr_const (exp, value) | |
1648 | tree exp; | |
1649 | struct addr_const *value; | |
1650 | { | |
1651 | register tree target = TREE_OPERAND (exp, 0); | |
1652 | register int offset = 0; | |
1653 | register rtx x; | |
1654 | ||
1655 | while (1) | |
1656 | { | |
1657 | if (TREE_CODE (target) == COMPONENT_REF | |
1658 | && (TREE_CODE (DECL_FIELD_BITPOS (TREE_OPERAND (target, 1))) | |
1659 | == INTEGER_CST)) | |
1660 | { | |
1661 | offset += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (TREE_OPERAND (target, 1))) / BITS_PER_UNIT; | |
1662 | target = TREE_OPERAND (target, 0); | |
1663 | } | |
1664 | else if (TREE_CODE (target) == ARRAY_REF) | |
1665 | { | |
1666 | if (TREE_CODE (TREE_OPERAND (target, 1)) != INTEGER_CST | |
1667 | || TREE_CODE (TYPE_SIZE (TREE_TYPE (target))) != INTEGER_CST) | |
1668 | abort (); | |
1669 | offset += ((TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (target))) | |
1670 | * TREE_INT_CST_LOW (TREE_OPERAND (target, 1))) | |
1671 | / BITS_PER_UNIT); | |
1672 | target = TREE_OPERAND (target, 0); | |
1673 | } | |
1674 | else | |
1675 | break; | |
1676 | } | |
1677 | ||
1678 | switch (TREE_CODE (target)) | |
1679 | { | |
1680 | case VAR_DECL: | |
1681 | case FUNCTION_DECL: | |
1682 | x = DECL_RTL (target); | |
1683 | break; | |
1684 | ||
1685 | case LABEL_DECL: | |
1686 | x = gen_rtx (MEM, FUNCTION_MODE, | |
1687 | gen_rtx (LABEL_REF, VOIDmode, | |
1688 | label_rtx (TREE_OPERAND (exp, 0)))); | |
1689 | break; | |
1690 | ||
1691 | case REAL_CST: | |
1692 | case STRING_CST: | |
1693 | case COMPLEX_CST: | |
1694 | case CONSTRUCTOR: | |
1695 | x = TREE_CST_RTL (target); | |
1696 | break; | |
1697 | ||
1698 | default: | |
1699 | abort (); | |
1700 | } | |
1701 | ||
1702 | if (GET_CODE (x) != MEM) | |
1703 | abort (); | |
1704 | x = XEXP (x, 0); | |
1705 | ||
1706 | value->base = x; | |
1707 | value->offset = offset; | |
1708 | } | |
1709 | \f | |
1710 | /* Uniquize all constants that appear in memory. | |
1711 | Each constant in memory thus far output is recorded | |
1712 | in `const_hash_table' with a `struct constant_descriptor' | |
1713 | that contains a polish representation of the value of | |
1714 | the constant. | |
1715 | ||
1716 | We cannot store the trees in the hash table | |
1717 | because the trees may be temporary. */ | |
1718 | ||
1719 | struct constant_descriptor | |
1720 | { | |
1721 | struct constant_descriptor *next; | |
1722 | char *label; | |
1723 | char contents[1]; | |
1724 | }; | |
1725 | ||
1726 | #define HASHBITS 30 | |
1727 | #define MAX_HASH_TABLE 1009 | |
1728 | static struct constant_descriptor *const_hash_table[MAX_HASH_TABLE]; | |
1729 | ||
1730 | /* Compute a hash code for a constant expression. */ | |
1731 | ||
1732 | int | |
1733 | const_hash (exp) | |
1734 | tree exp; | |
1735 | { | |
1736 | register char *p; | |
1737 | register int len, hi, i; | |
1738 | register enum tree_code code = TREE_CODE (exp); | |
1739 | ||
1740 | if (code == INTEGER_CST) | |
1741 | { | |
1742 | p = (char *) &TREE_INT_CST_LOW (exp); | |
1743 | len = 2 * sizeof TREE_INT_CST_LOW (exp); | |
1744 | } | |
1745 | else if (code == REAL_CST) | |
1746 | { | |
1747 | p = (char *) &TREE_REAL_CST (exp); | |
1748 | len = sizeof TREE_REAL_CST (exp); | |
1749 | } | |
1750 | else if (code == STRING_CST) | |
1751 | p = TREE_STRING_POINTER (exp), len = TREE_STRING_LENGTH (exp); | |
1752 | else if (code == COMPLEX_CST) | |
1753 | return const_hash (TREE_REALPART (exp)) * 5 | |
1754 | + const_hash (TREE_IMAGPART (exp)); | |
1755 | else if (code == CONSTRUCTOR) | |
1756 | { | |
1757 | register tree link; | |
1758 | ||
1759 | /* For record type, include the type in the hashing. | |
1760 | We do not do so for array types | |
1761 | because (1) the sizes of the elements are sufficient | |
eb528802 RS |
1762 | and (2) distinct array types can have the same constructor. |
1763 | Instead, we include the array size because the constructor could | |
1764 | be shorter. */ | |
79e68feb | 1765 | if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE) |
fb351073 RK |
1766 | hi = ((HOST_WIDE_INT) TREE_TYPE (exp) & ((1 << HASHBITS) - 1)) |
1767 | % MAX_HASH_TABLE; | |
79e68feb | 1768 | else |
eb528802 RS |
1769 | hi = ((5 + int_size_in_bytes (TREE_TYPE (exp))) |
1770 | & ((1 << HASHBITS) - 1)) % MAX_HASH_TABLE; | |
79e68feb RS |
1771 | |
1772 | for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link)) | |
77fa0940 RK |
1773 | if (TREE_VALUE (link)) |
1774 | hi = (hi * 603 + const_hash (TREE_VALUE (link))) % MAX_HASH_TABLE; | |
79e68feb RS |
1775 | |
1776 | return hi; | |
1777 | } | |
1778 | else if (code == ADDR_EXPR) | |
1779 | { | |
1780 | struct addr_const value; | |
1781 | decode_addr_const (exp, &value); | |
1782 | if (GET_CODE (value.base) == SYMBOL_REF) | |
1783 | { | |
1784 | /* Don't hash the address of the SYMBOL_REF; | |
1785 | only use the offset and the symbol name. */ | |
1786 | hi = value.offset; | |
1787 | p = XSTR (value.base, 0); | |
1788 | for (i = 0; p[i] != 0; i++) | |
1789 | hi = ((hi * 613) + (unsigned)(p[i])); | |
1790 | } | |
1791 | else if (GET_CODE (value.base) == LABEL_REF) | |
1792 | hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13; | |
1793 | ||
1794 | hi &= (1 << HASHBITS) - 1; | |
1795 | hi %= MAX_HASH_TABLE; | |
1796 | return hi; | |
1797 | } | |
1798 | else if (code == PLUS_EXPR || code == MINUS_EXPR) | |
1799 | return const_hash (TREE_OPERAND (exp, 0)) * 9 | |
1800 | + const_hash (TREE_OPERAND (exp, 1)); | |
1801 | else if (code == NOP_EXPR || code == CONVERT_EXPR) | |
1802 | return const_hash (TREE_OPERAND (exp, 0)) * 7 + 2; | |
1803 | ||
1804 | /* Compute hashing function */ | |
1805 | hi = len; | |
1806 | for (i = 0; i < len; i++) | |
1807 | hi = ((hi * 613) + (unsigned)(p[i])); | |
1808 | ||
1809 | hi &= (1 << HASHBITS) - 1; | |
1810 | hi %= MAX_HASH_TABLE; | |
1811 | return hi; | |
1812 | } | |
1813 | \f | |
1814 | /* Compare a constant expression EXP with a constant-descriptor DESC. | |
1815 | Return 1 if DESC describes a constant with the same value as EXP. */ | |
1816 | ||
1817 | static int | |
1818 | compare_constant (exp, desc) | |
1819 | tree exp; | |
1820 | struct constant_descriptor *desc; | |
1821 | { | |
1822 | return 0 != compare_constant_1 (exp, desc->contents); | |
1823 | } | |
1824 | ||
1825 | /* Compare constant expression EXP with a substring P of a constant descriptor. | |
1826 | If they match, return a pointer to the end of the substring matched. | |
1827 | If they do not match, return 0. | |
1828 | ||
1829 | Since descriptors are written in polish prefix notation, | |
1830 | this function can be used recursively to test one operand of EXP | |
1831 | against a subdescriptor, and if it succeeds it returns the | |
1832 | address of the subdescriptor for the next operand. */ | |
1833 | ||
1834 | static char * | |
1835 | compare_constant_1 (exp, p) | |
1836 | tree exp; | |
1837 | char *p; | |
1838 | { | |
1839 | register char *strp; | |
1840 | register int len; | |
1841 | register enum tree_code code = TREE_CODE (exp); | |
1842 | ||
1843 | if (code != (enum tree_code) *p++) | |
1844 | return 0; | |
1845 | ||
1846 | if (code == INTEGER_CST) | |
1847 | { | |
1848 | /* Integer constants are the same only if the same width of type. */ | |
1849 | if (*p++ != TYPE_PRECISION (TREE_TYPE (exp))) | |
1850 | return 0; | |
1851 | strp = (char *) &TREE_INT_CST_LOW (exp); | |
1852 | len = 2 * sizeof TREE_INT_CST_LOW (exp); | |
1853 | } | |
1854 | else if (code == REAL_CST) | |
1855 | { | |
1856 | /* Real constants are the same only if the same width of type. */ | |
1857 | if (*p++ != TYPE_PRECISION (TREE_TYPE (exp))) | |
1858 | return 0; | |
1859 | strp = (char *) &TREE_REAL_CST (exp); | |
1860 | len = sizeof TREE_REAL_CST (exp); | |
1861 | } | |
1862 | else if (code == STRING_CST) | |
1863 | { | |
1864 | if (flag_writable_strings) | |
1865 | return 0; | |
1866 | strp = TREE_STRING_POINTER (exp); | |
1867 | len = TREE_STRING_LENGTH (exp); | |
1868 | if (bcmp (&TREE_STRING_LENGTH (exp), p, | |
1869 | sizeof TREE_STRING_LENGTH (exp))) | |
1870 | return 0; | |
1871 | p += sizeof TREE_STRING_LENGTH (exp); | |
1872 | } | |
1873 | else if (code == COMPLEX_CST) | |
1874 | { | |
1875 | p = compare_constant_1 (TREE_REALPART (exp), p); | |
1876 | if (p == 0) return 0; | |
1877 | p = compare_constant_1 (TREE_IMAGPART (exp), p); | |
1878 | return p; | |
1879 | } | |
1880 | else if (code == CONSTRUCTOR) | |
1881 | { | |
1882 | register tree link; | |
1883 | int length = list_length (CONSTRUCTOR_ELTS (exp)); | |
1884 | tree type; | |
1885 | ||
1886 | if (bcmp (&length, p, sizeof length)) | |
1887 | return 0; | |
1888 | p += sizeof length; | |
1889 | ||
1890 | /* For record constructors, insist that the types match. | |
1891 | For arrays, just verify both constructors are for arrays. */ | |
1892 | if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE) | |
1893 | type = TREE_TYPE (exp); | |
1894 | else | |
1895 | type = 0; | |
1896 | if (bcmp (&type, p, sizeof type)) | |
1897 | return 0; | |
1898 | p += sizeof type; | |
1899 | ||
eb528802 RS |
1900 | /* For arrays, insist that the size in bytes match. */ |
1901 | if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) | |
1902 | { | |
1903 | int size = int_size_in_bytes (TREE_TYPE (exp)); | |
1904 | if (bcmp (&size, p, sizeof size)) | |
1905 | return 0; | |
1906 | p += sizeof size; | |
1907 | } | |
1908 | ||
79e68feb | 1909 | for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link)) |
77fa0940 RK |
1910 | { |
1911 | if (TREE_VALUE (link)) | |
1912 | { | |
1913 | if ((p = compare_constant_1 (TREE_VALUE (link), p)) == 0) | |
1914 | return 0; | |
1915 | } | |
1916 | else | |
1917 | { | |
1918 | tree zero = 0; | |
1919 | ||
1920 | if (bcmp (&zero, p, sizeof zero)) | |
1921 | return 0; | |
1922 | p += sizeof zero; | |
1923 | } | |
1924 | } | |
1925 | ||
79e68feb RS |
1926 | return p; |
1927 | } | |
1928 | else if (code == ADDR_EXPR) | |
1929 | { | |
1930 | struct addr_const value; | |
1931 | decode_addr_const (exp, &value); | |
1932 | strp = (char *) &value.offset; | |
1933 | len = sizeof value.offset; | |
1934 | /* Compare the offset. */ | |
1935 | while (--len >= 0) | |
1936 | if (*p++ != *strp++) | |
1937 | return 0; | |
1938 | /* Compare symbol name. */ | |
1939 | strp = XSTR (value.base, 0); | |
1940 | len = strlen (strp) + 1; | |
1941 | } | |
1942 | else if (code == PLUS_EXPR || code == MINUS_EXPR) | |
1943 | { | |
1944 | p = compare_constant_1 (TREE_OPERAND (exp, 0), p); | |
1945 | if (p == 0) return 0; | |
1946 | p = compare_constant_1 (TREE_OPERAND (exp, 1), p); | |
1947 | return p; | |
1948 | } | |
1949 | else if (code == NOP_EXPR || code == CONVERT_EXPR) | |
1950 | { | |
1951 | p = compare_constant_1 (TREE_OPERAND (exp, 0), p); | |
1952 | return p; | |
1953 | } | |
1954 | ||
1955 | /* Compare constant contents. */ | |
1956 | while (--len >= 0) | |
1957 | if (*p++ != *strp++) | |
1958 | return 0; | |
1959 | ||
1960 | return p; | |
1961 | } | |
1962 | \f | |
1963 | /* Construct a constant descriptor for the expression EXP. | |
1964 | It is up to the caller to enter the descriptor in the hash table. */ | |
1965 | ||
1966 | static struct constant_descriptor * | |
1967 | record_constant (exp) | |
1968 | tree exp; | |
1969 | { | |
387e854a RK |
1970 | struct constant_descriptor *next = 0; |
1971 | char *label = 0; | |
79e68feb | 1972 | |
387e854a RK |
1973 | /* Make a struct constant_descriptor. The first two pointers will |
1974 | be filled in later. Here we just leave space for them. */ | |
1975 | ||
1976 | obstack_grow (&permanent_obstack, (char *) &next, sizeof next); | |
1977 | obstack_grow (&permanent_obstack, (char *) &label, sizeof label); | |
79e68feb RS |
1978 | record_constant_1 (exp); |
1979 | return (struct constant_descriptor *) obstack_finish (&permanent_obstack); | |
1980 | } | |
1981 | ||
1982 | /* Add a description of constant expression EXP | |
1983 | to the object growing in `permanent_obstack'. | |
1984 | No need to return its address; the caller will get that | |
1985 | from the obstack when the object is complete. */ | |
1986 | ||
1987 | static void | |
1988 | record_constant_1 (exp) | |
1989 | tree exp; | |
1990 | { | |
1991 | register char *strp; | |
1992 | register int len; | |
1993 | register enum tree_code code = TREE_CODE (exp); | |
1994 | ||
1995 | obstack_1grow (&permanent_obstack, (unsigned int) code); | |
1996 | ||
1997 | if (code == INTEGER_CST) | |
1998 | { | |
1999 | obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp))); | |
2000 | strp = (char *) &TREE_INT_CST_LOW (exp); | |
2001 | len = 2 * sizeof TREE_INT_CST_LOW (exp); | |
2002 | } | |
2003 | else if (code == REAL_CST) | |
2004 | { | |
2005 | obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp))); | |
2006 | strp = (char *) &TREE_REAL_CST (exp); | |
2007 | len = sizeof TREE_REAL_CST (exp); | |
2008 | } | |
2009 | else if (code == STRING_CST) | |
2010 | { | |
2011 | if (flag_writable_strings) | |
2012 | return; | |
2013 | strp = TREE_STRING_POINTER (exp); | |
2014 | len = TREE_STRING_LENGTH (exp); | |
2015 | obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp), | |
2016 | sizeof TREE_STRING_LENGTH (exp)); | |
2017 | } | |
2018 | else if (code == COMPLEX_CST) | |
2019 | { | |
2020 | record_constant_1 (TREE_REALPART (exp)); | |
2021 | record_constant_1 (TREE_IMAGPART (exp)); | |
2022 | return; | |
2023 | } | |
2024 | else if (code == CONSTRUCTOR) | |
2025 | { | |
2026 | register tree link; | |
2027 | int length = list_length (CONSTRUCTOR_ELTS (exp)); | |
2028 | tree type; | |
2029 | ||
2030 | obstack_grow (&permanent_obstack, (char *) &length, sizeof length); | |
2031 | ||
2032 | /* For record constructors, insist that the types match. | |
2033 | For arrays, just verify both constructors are for arrays. */ | |
2034 | if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE) | |
2035 | type = TREE_TYPE (exp); | |
2036 | else | |
2037 | type = 0; | |
2038 | obstack_grow (&permanent_obstack, (char *) &type, sizeof type); | |
2039 | ||
eb528802 RS |
2040 | /* For arrays, insist that the size in bytes match. */ |
2041 | if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) | |
2042 | { | |
2043 | int size = int_size_in_bytes (TREE_TYPE (exp)); | |
2044 | obstack_grow (&permanent_obstack, (char *) &size, sizeof size); | |
2045 | } | |
2046 | ||
79e68feb | 2047 | for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link)) |
77fa0940 RK |
2048 | { |
2049 | if (TREE_VALUE (link)) | |
2050 | record_constant_1 (TREE_VALUE (link)); | |
2051 | else | |
2052 | { | |
2053 | tree zero = 0; | |
2054 | ||
2055 | obstack_grow (&permanent_obstack, (char *) &zero, sizeof zero); | |
2056 | } | |
2057 | } | |
2058 | ||
79e68feb RS |
2059 | return; |
2060 | } | |
2061 | else if (code == ADDR_EXPR) | |
2062 | { | |
2063 | struct addr_const value; | |
2064 | decode_addr_const (exp, &value); | |
2065 | /* Record the offset. */ | |
2066 | obstack_grow (&permanent_obstack, | |
2067 | (char *) &value.offset, sizeof value.offset); | |
2068 | /* Record the symbol name. */ | |
2069 | obstack_grow (&permanent_obstack, XSTR (value.base, 0), | |
2070 | strlen (XSTR (value.base, 0)) + 1); | |
2071 | return; | |
2072 | } | |
2073 | else if (code == PLUS_EXPR || code == MINUS_EXPR) | |
2074 | { | |
2075 | record_constant_1 (TREE_OPERAND (exp, 0)); | |
2076 | record_constant_1 (TREE_OPERAND (exp, 1)); | |
2077 | return; | |
2078 | } | |
2079 | else if (code == NOP_EXPR || code == CONVERT_EXPR) | |
2080 | { | |
2081 | record_constant_1 (TREE_OPERAND (exp, 0)); | |
2082 | return; | |
2083 | } | |
2084 | ||
2085 | /* Record constant contents. */ | |
2086 | obstack_grow (&permanent_obstack, strp, len); | |
2087 | } | |
2088 | \f | |
ff8f4401 RS |
2089 | /* Record a list of constant expressions that were passed to |
2090 | output_constant_def but that could not be output right away. */ | |
2091 | ||
2092 | struct deferred_constant | |
2093 | { | |
2094 | struct deferred_constant *next; | |
2095 | tree exp; | |
2096 | int reloc; | |
2097 | int labelno; | |
2098 | }; | |
2099 | ||
2100 | static struct deferred_constant *deferred_constants; | |
2101 | ||
2102 | /* Nonzero means defer output of addressed subconstants | |
2103 | (i.e., those for which output_constant_def is called.) */ | |
2104 | static int defer_addressed_constants_flag; | |
2105 | ||
2106 | /* Start deferring output of subconstants. */ | |
2107 | ||
2108 | void | |
2109 | defer_addressed_constants () | |
2110 | { | |
2111 | defer_addressed_constants_flag++; | |
2112 | } | |
2113 | ||
2114 | /* Stop deferring output of subconstants, | |
2115 | and output now all those that have been deferred. */ | |
2116 | ||
2117 | void | |
2118 | output_deferred_addressed_constants () | |
2119 | { | |
2120 | struct deferred_constant *p, *next; | |
2121 | ||
2122 | defer_addressed_constants_flag--; | |
2123 | ||
2124 | if (defer_addressed_constants_flag > 0) | |
2125 | return; | |
2126 | ||
2127 | for (p = deferred_constants; p; p = next) | |
2128 | { | |
2129 | output_constant_def_contents (p->exp, p->reloc, p->labelno); | |
2130 | next = p->next; | |
2131 | free (p); | |
2132 | } | |
2133 | ||
2134 | deferred_constants = 0; | |
2135 | } | |
2136 | \f | |
79e68feb RS |
2137 | /* Return an rtx representing a reference to constant data in memory |
2138 | for the constant expression EXP. | |
ff8f4401 | 2139 | |
79e68feb RS |
2140 | If assembler code for such a constant has already been output, |
2141 | return an rtx to refer to it. | |
ff8f4401 RS |
2142 | Otherwise, output such a constant in memory (or defer it for later) |
2143 | and generate an rtx for it. | |
2144 | ||
2145 | The TREE_CST_RTL of EXP is set up to point to that rtx. | |
79e68feb RS |
2146 | The const_hash_table records which constants already have label strings. */ |
2147 | ||
2148 | rtx | |
2149 | output_constant_def (exp) | |
2150 | tree exp; | |
2151 | { | |
ff8f4401 | 2152 | register int hash; |
79e68feb RS |
2153 | register struct constant_descriptor *desc; |
2154 | char label[256]; | |
2155 | char *found = 0; | |
2156 | int reloc; | |
2157 | register rtx def; | |
2158 | ||
2159 | if (TREE_CODE (exp) == INTEGER_CST) | |
2160 | abort (); /* No TREE_CST_RTL slot in these. */ | |
2161 | ||
2162 | if (TREE_CST_RTL (exp)) | |
2163 | return TREE_CST_RTL (exp); | |
2164 | ||
2165 | /* Make sure any other constants whose addresses appear in EXP | |
2166 | are assigned label numbers. */ | |
2167 | ||
2168 | reloc = output_addressed_constants (exp); | |
2169 | ||
2170 | /* Compute hash code of EXP. Search the descriptors for that hash code | |
2171 | to see if any of them describes EXP. If yes, the descriptor records | |
2172 | the label number already assigned. */ | |
2173 | ||
2174 | hash = const_hash (exp) % MAX_HASH_TABLE; | |
2175 | ||
2176 | for (desc = const_hash_table[hash]; desc; desc = desc->next) | |
2177 | if (compare_constant (exp, desc)) | |
2178 | { | |
2179 | found = desc->label; | |
2180 | break; | |
2181 | } | |
2182 | ||
2183 | if (found == 0) | |
2184 | { | |
2185 | /* No constant equal to EXP is known to have been output. | |
2186 | Make a constant descriptor to enter EXP in the hash table. | |
2187 | Assign the label number and record it in the descriptor for | |
2188 | future calls to this function to find. */ | |
2189 | ||
2190 | /* Create a string containing the label name, in LABEL. */ | |
2191 | ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno); | |
2192 | ||
2193 | desc = record_constant (exp); | |
2194 | desc->next = const_hash_table[hash]; | |
2195 | desc->label | |
2196 | = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label)); | |
2197 | const_hash_table[hash] = desc; | |
2198 | } | |
2199 | ||
2200 | /* We have a symbol name; construct the SYMBOL_REF and the MEM. */ | |
2201 | ||
2202 | push_obstacks_nochange (); | |
2203 | if (TREE_PERMANENT (exp)) | |
2204 | end_temporary_allocation (); | |
2205 | ||
2206 | def = gen_rtx (SYMBOL_REF, Pmode, desc->label); | |
2207 | ||
2208 | TREE_CST_RTL (exp) | |
2209 | = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def); | |
2210 | RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1; | |
dd43f13d RS |
2211 | if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE |
2212 | || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) | |
2213 | MEM_IN_STRUCT_P (TREE_CST_RTL (exp)) = 1; | |
79e68feb RS |
2214 | |
2215 | pop_obstacks (); | |
2216 | ||
2217 | /* Optionally set flags or add text to the name to record information | |
2218 | such as that it is a function name. If the name is changed, the macro | |
2219 | ASM_OUTPUT_LABELREF will have to know how to strip this information. | |
2220 | And if it finds a * at the beginning after doing so, it must handle | |
2221 | that too. */ | |
2222 | #ifdef ENCODE_SECTION_INFO | |
2223 | ENCODE_SECTION_INFO (exp); | |
2224 | #endif | |
2225 | ||
ff8f4401 RS |
2226 | /* If this is the first time we've seen this particular constant, |
2227 | output it (or defer its output for later). */ | |
79e68feb RS |
2228 | if (found == 0) |
2229 | { | |
ff8f4401 RS |
2230 | if (defer_addressed_constants_flag) |
2231 | { | |
2232 | struct deferred_constant *p; | |
2233 | p = (struct deferred_constant *) xmalloc (sizeof (struct deferred_constant)); | |
2234 | ||
2235 | /* We really should copy trees in depth here, | |
2236 | but since this case is the only one that should happen now, | |
2237 | let's do it later. */ | |
2238 | if (TREE_CODE (exp) != STRING_CST) | |
2239 | abort (); | |
2240 | ||
2241 | push_obstacks_nochange (); | |
2242 | suspend_momentary (); | |
2243 | p->exp = copy_node (exp); | |
2244 | pop_obstacks (); | |
2245 | p->reloc = reloc; | |
2246 | p->labelno = const_labelno++; | |
2247 | p->next = deferred_constants; | |
2248 | deferred_constants = p; | |
2249 | } | |
2250 | else | |
2251 | output_constant_def_contents (exp, reloc, const_labelno++); | |
2252 | } | |
2253 | ||
2254 | return TREE_CST_RTL (exp); | |
2255 | } | |
2256 | ||
2257 | /* Now output assembler code to define the label for EXP, | |
2258 | and follow it with the data of EXP. */ | |
79e68feb | 2259 | |
ff8f4401 RS |
2260 | static void |
2261 | output_constant_def_contents (exp, reloc, labelno) | |
2262 | tree exp; | |
2263 | int reloc; | |
2264 | int labelno; | |
2265 | { | |
2266 | int align; | |
2267 | ||
2268 | /* First switch to text section, except for writable strings. */ | |
79e68feb | 2269 | #ifdef SELECT_SECTION |
ff8f4401 | 2270 | SELECT_SECTION (exp, reloc); |
79e68feb | 2271 | #else |
ff8f4401 RS |
2272 | if (((TREE_CODE (exp) == STRING_CST) && flag_writable_strings) |
2273 | || (flag_pic && reloc)) | |
2274 | data_section (); | |
2275 | else | |
2276 | readonly_data_section (); | |
79e68feb RS |
2277 | #endif |
2278 | ||
ff8f4401 RS |
2279 | /* Align the location counter as required by EXP's data type. */ |
2280 | align = TYPE_ALIGN (TREE_TYPE (exp)); | |
79e68feb | 2281 | #ifdef CONSTANT_ALIGNMENT |
ff8f4401 | 2282 | align = CONSTANT_ALIGNMENT (exp, align); |
79e68feb RS |
2283 | #endif |
2284 | ||
ff8f4401 RS |
2285 | if (align > BITS_PER_UNIT) |
2286 | ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); | |
79e68feb | 2287 | |
ff8f4401 RS |
2288 | /* Output the label itself. */ |
2289 | ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno); | |
79e68feb | 2290 | |
ff8f4401 RS |
2291 | /* Output the value of EXP. */ |
2292 | output_constant (exp, | |
2293 | (TREE_CODE (exp) == STRING_CST | |
2294 | ? TREE_STRING_LENGTH (exp) | |
2295 | : int_size_in_bytes (TREE_TYPE (exp)))); | |
79e68feb | 2296 | |
79e68feb RS |
2297 | } |
2298 | \f | |
2299 | /* Similar hash facility for making memory-constants | |
2300 | from constant rtl-expressions. It is used on RISC machines | |
2301 | where immediate integer arguments and constant addresses are restricted | |
2302 | so that such constants must be stored in memory. | |
2303 | ||
2304 | This pool of constants is reinitialized for each function | |
2305 | so each function gets its own constants-pool that comes right before it. | |
2306 | ||
2307 | All structures allocated here are discarded when functions are saved for | |
2308 | inlining, so they do not need to be allocated permanently. */ | |
2309 | ||
2310 | #define MAX_RTX_HASH_TABLE 61 | |
57632c51 | 2311 | static struct constant_descriptor **const_rtx_hash_table; |
79e68feb RS |
2312 | |
2313 | /* Structure to represent sufficient information about a constant so that | |
2314 | it can be output when the constant pool is output, so that function | |
2315 | integration can be done, and to simplify handling on machines that reference | |
2316 | constant pool as base+displacement. */ | |
2317 | ||
2318 | struct pool_constant | |
2319 | { | |
2320 | struct constant_descriptor *desc; | |
2321 | struct pool_constant *next; | |
2322 | enum machine_mode mode; | |
2323 | rtx constant; | |
2324 | int labelno; | |
2325 | int align; | |
2326 | int offset; | |
2327 | }; | |
2328 | ||
2329 | /* Pointers to first and last constant in pool. */ | |
2330 | ||
2331 | static struct pool_constant *first_pool, *last_pool; | |
2332 | ||
2333 | /* Current offset in constant pool (does not include any machine-specific | |
2334 | header. */ | |
2335 | ||
2336 | static int pool_offset; | |
2337 | ||
2338 | /* Structure used to maintain hash table mapping symbols used to their | |
2339 | corresponding constants. */ | |
2340 | ||
2341 | struct pool_sym | |
2342 | { | |
2343 | char *label; | |
2344 | struct pool_constant *pool; | |
2345 | struct pool_sym *next; | |
2346 | }; | |
2347 | ||
57632c51 | 2348 | static struct pool_sym **const_rtx_sym_hash_table; |
79e68feb RS |
2349 | |
2350 | /* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true. | |
2351 | The argument is XSTR (... , 0) */ | |
2352 | ||
2353 | #define SYMHASH(LABEL) \ | |
fb351073 | 2354 | ((((HOST_WIDE_INT) (LABEL)) & ((1 << HASHBITS) - 1)) % MAX_RTX_HASH_TABLE) |
79e68feb RS |
2355 | \f |
2356 | /* Initialize constant pool hashing for next function. */ | |
2357 | ||
2358 | void | |
2359 | init_const_rtx_hash_table () | |
2360 | { | |
57632c51 RS |
2361 | const_rtx_hash_table |
2362 | = ((struct constant_descriptor **) | |
2363 | oballoc (MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *))); | |
2364 | const_rtx_sym_hash_table | |
2365 | = ((struct pool_sym **) | |
2366 | oballoc (MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *))); | |
2367 | bzero (const_rtx_hash_table, | |
2368 | MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *)); | |
2369 | bzero (const_rtx_sym_hash_table, | |
2370 | MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *)); | |
79e68feb RS |
2371 | |
2372 | first_pool = last_pool = 0; | |
2373 | pool_offset = 0; | |
2374 | } | |
2375 | ||
57632c51 RS |
2376 | /* Save and restore it for a nested function. */ |
2377 | ||
2378 | void | |
2379 | save_varasm_status (p) | |
2380 | struct function *p; | |
2381 | { | |
2382 | p->const_rtx_hash_table = const_rtx_hash_table; | |
2383 | p->const_rtx_sym_hash_table = const_rtx_sym_hash_table; | |
2384 | p->first_pool = first_pool; | |
2385 | p->last_pool = last_pool; | |
2386 | p->pool_offset = pool_offset; | |
2387 | } | |
2388 | ||
2389 | void | |
2390 | restore_varasm_status (p) | |
2391 | struct function *p; | |
2392 | { | |
2393 | const_rtx_hash_table = p->const_rtx_hash_table; | |
2394 | const_rtx_sym_hash_table = p->const_rtx_sym_hash_table; | |
2395 | first_pool = p->first_pool; | |
2396 | last_pool = p->last_pool; | |
2397 | pool_offset = p->pool_offset; | |
2398 | } | |
2399 | \f | |
79e68feb RS |
2400 | enum kind { RTX_DOUBLE, RTX_INT }; |
2401 | ||
2402 | struct rtx_const | |
2403 | { | |
2404 | #ifdef ONLY_INT_FIELDS | |
2405 | unsigned int kind : 16; | |
2406 | unsigned int mode : 16; | |
2407 | #else | |
2408 | enum kind kind : 16; | |
2409 | enum machine_mode mode : 16; | |
2410 | #endif | |
2411 | union { | |
2412 | union real_extract du; | |
2413 | struct addr_const addr; | |
2414 | } un; | |
2415 | }; | |
2416 | ||
2417 | /* Express an rtx for a constant integer (perhaps symbolic) | |
2418 | as the sum of a symbol or label plus an explicit integer. | |
2419 | They are stored into VALUE. */ | |
2420 | ||
2421 | static void | |
2422 | decode_rtx_const (mode, x, value) | |
2423 | enum machine_mode mode; | |
2424 | rtx x; | |
2425 | struct rtx_const *value; | |
2426 | { | |
2427 | /* Clear the whole structure, including any gaps. */ | |
2428 | ||
2429 | { | |
2430 | int *p = (int *) value; | |
2431 | int *end = (int *) (value + 1); | |
2432 | while (p < end) | |
2433 | *p++ = 0; | |
2434 | } | |
2435 | ||
2436 | value->kind = RTX_INT; /* Most usual kind. */ | |
2437 | value->mode = mode; | |
2438 | ||
2439 | switch (GET_CODE (x)) | |
2440 | { | |
2441 | case CONST_DOUBLE: | |
2442 | value->kind = RTX_DOUBLE; | |
2443 | value->mode = GET_MODE (x); | |
2444 | bcopy (&CONST_DOUBLE_LOW (x), &value->un.du, sizeof value->un.du); | |
2445 | break; | |
2446 | ||
2447 | case CONST_INT: | |
2448 | value->un.addr.offset = INTVAL (x); | |
2449 | break; | |
2450 | ||
2451 | case SYMBOL_REF: | |
2452 | case LABEL_REF: | |
3d037392 | 2453 | case PC: |
79e68feb RS |
2454 | value->un.addr.base = x; |
2455 | break; | |
2456 | ||
2457 | case CONST: | |
2458 | x = XEXP (x, 0); | |
2459 | if (GET_CODE (x) == PLUS) | |
2460 | { | |
2461 | value->un.addr.base = XEXP (x, 0); | |
2462 | if (GET_CODE (XEXP (x, 1)) != CONST_INT) | |
2463 | abort (); | |
2464 | value->un.addr.offset = INTVAL (XEXP (x, 1)); | |
2465 | } | |
2466 | else if (GET_CODE (x) == MINUS) | |
2467 | { | |
2468 | value->un.addr.base = XEXP (x, 0); | |
2469 | if (GET_CODE (XEXP (x, 1)) != CONST_INT) | |
2470 | abort (); | |
2471 | value->un.addr.offset = - INTVAL (XEXP (x, 1)); | |
2472 | } | |
2473 | else | |
2474 | abort (); | |
2475 | break; | |
2476 | ||
2477 | default: | |
2478 | abort (); | |
2479 | } | |
2480 | ||
2481 | if (value->kind == RTX_INT && value->un.addr.base != 0) | |
2482 | switch (GET_CODE (value->un.addr.base)) | |
2483 | { | |
2484 | case SYMBOL_REF: | |
2485 | case LABEL_REF: | |
2486 | /* Use the string's address, not the SYMBOL_REF's address, | |
2487 | for the sake of addresses of library routines. | |
2488 | For a LABEL_REF, compare labels. */ | |
2489 | value->un.addr.base = XEXP (value->un.addr.base, 0); | |
2490 | } | |
2491 | } | |
2492 | ||
57632c51 RS |
2493 | /* Given a MINUS expression, simplify it if both sides |
2494 | include the same symbol. */ | |
2495 | ||
2496 | rtx | |
2497 | simplify_subtraction (x) | |
2498 | rtx x; | |
2499 | { | |
2500 | struct rtx_const val0, val1; | |
2501 | ||
2502 | decode_rtx_const (GET_MODE (x), XEXP (x, 0), &val0); | |
2503 | decode_rtx_const (GET_MODE (x), XEXP (x, 1), &val1); | |
2504 | ||
2505 | if (val0.un.addr.base == val1.un.addr.base) | |
2506 | return GEN_INT (val0.un.addr.offset - val1.un.addr.offset); | |
2507 | return x; | |
2508 | } | |
2509 | ||
79e68feb RS |
2510 | /* Compute a hash code for a constant RTL expression. */ |
2511 | ||
2512 | int | |
2513 | const_hash_rtx (mode, x) | |
2514 | enum machine_mode mode; | |
2515 | rtx x; | |
2516 | { | |
2517 | register int hi, i; | |
2518 | ||
2519 | struct rtx_const value; | |
2520 | decode_rtx_const (mode, x, &value); | |
2521 | ||
2522 | /* Compute hashing function */ | |
2523 | hi = 0; | |
2524 | for (i = 0; i < sizeof value / sizeof (int); i++) | |
2525 | hi += ((int *) &value)[i]; | |
2526 | ||
2527 | hi &= (1 << HASHBITS) - 1; | |
2528 | hi %= MAX_RTX_HASH_TABLE; | |
2529 | return hi; | |
2530 | } | |
2531 | ||
2532 | /* Compare a constant rtl object X with a constant-descriptor DESC. | |
2533 | Return 1 if DESC describes a constant with the same value as X. */ | |
2534 | ||
2535 | static int | |
2536 | compare_constant_rtx (mode, x, desc) | |
2537 | enum machine_mode mode; | |
2538 | rtx x; | |
2539 | struct constant_descriptor *desc; | |
2540 | { | |
2541 | register int *p = (int *) desc->contents; | |
2542 | register int *strp; | |
2543 | register int len; | |
2544 | struct rtx_const value; | |
2545 | ||
2546 | decode_rtx_const (mode, x, &value); | |
2547 | strp = (int *) &value; | |
2548 | len = sizeof value / sizeof (int); | |
2549 | ||
2550 | /* Compare constant contents. */ | |
2551 | while (--len >= 0) | |
2552 | if (*p++ != *strp++) | |
2553 | return 0; | |
2554 | ||
2555 | return 1; | |
2556 | } | |
2557 | ||
2558 | /* Construct a constant descriptor for the rtl-expression X. | |
2559 | It is up to the caller to enter the descriptor in the hash table. */ | |
2560 | ||
2561 | static struct constant_descriptor * | |
2562 | record_constant_rtx (mode, x) | |
2563 | enum machine_mode mode; | |
2564 | rtx x; | |
2565 | { | |
2566 | struct constant_descriptor *ptr; | |
2567 | char *label; | |
2568 | struct rtx_const value; | |
2569 | ||
2570 | decode_rtx_const (mode, x, &value); | |
2571 | ||
2572 | obstack_grow (current_obstack, &ptr, sizeof ptr); | |
2573 | obstack_grow (current_obstack, &label, sizeof label); | |
2574 | ||
2575 | /* Record constant contents. */ | |
2576 | obstack_grow (current_obstack, &value, sizeof value); | |
2577 | ||
2578 | return (struct constant_descriptor *) obstack_finish (current_obstack); | |
2579 | } | |
2580 | \f | |
2581 | /* Given a constant rtx X, make (or find) a memory constant for its value | |
2582 | and return a MEM rtx to refer to it in memory. */ | |
2583 | ||
2584 | rtx | |
2585 | force_const_mem (mode, x) | |
2586 | enum machine_mode mode; | |
2587 | rtx x; | |
2588 | { | |
2589 | register int hash; | |
2590 | register struct constant_descriptor *desc; | |
2591 | char label[256]; | |
2592 | char *found = 0; | |
2593 | rtx def; | |
2594 | ||
2595 | /* If we want this CONST_DOUBLE in the same mode as it is in memory | |
2596 | (this will always be true for floating CONST_DOUBLEs that have been | |
2597 | placed in memory, but not for VOIDmode (integer) CONST_DOUBLEs), | |
2598 | use the previous copy. Otherwise, make a new one. Note that in | |
2599 | the unlikely event that this same CONST_DOUBLE is used in two different | |
2600 | modes in an alternating fashion, we will allocate a lot of different | |
2601 | memory locations, but this should be extremely rare. */ | |
2602 | ||
57632c51 RS |
2603 | /* Don't use CONST_DOUBLE_MEM in a nested function. |
2604 | Nested functions have their own constant pools, | |
2605 | so they can't share the same values in CONST_DOUBLE_MEM | |
2606 | with the containing function. */ | |
2607 | if (outer_function_chain == 0) | |
2608 | if (GET_CODE (x) == CONST_DOUBLE | |
2609 | && GET_CODE (CONST_DOUBLE_MEM (x)) == MEM | |
2610 | && GET_MODE (CONST_DOUBLE_MEM (x)) == mode) | |
2611 | return CONST_DOUBLE_MEM (x); | |
79e68feb RS |
2612 | |
2613 | /* Compute hash code of X. Search the descriptors for that hash code | |
2614 | to see if any of them describes X. If yes, the descriptor records | |
2615 | the label number already assigned. */ | |
2616 | ||
2617 | hash = const_hash_rtx (mode, x); | |
2618 | ||
2619 | for (desc = const_rtx_hash_table[hash]; desc; desc = desc->next) | |
2620 | if (compare_constant_rtx (mode, x, desc)) | |
2621 | { | |
2622 | found = desc->label; | |
2623 | break; | |
2624 | } | |
2625 | ||
2626 | if (found == 0) | |
2627 | { | |
2628 | register struct pool_constant *pool; | |
2629 | register struct pool_sym *sym; | |
2630 | int align; | |
2631 | ||
2632 | /* No constant equal to X is known to have been output. | |
2633 | Make a constant descriptor to enter X in the hash table. | |
2634 | Assign the label number and record it in the descriptor for | |
2635 | future calls to this function to find. */ | |
2636 | ||
2637 | desc = record_constant_rtx (mode, x); | |
2638 | desc->next = const_rtx_hash_table[hash]; | |
2639 | const_rtx_hash_table[hash] = desc; | |
2640 | ||
2641 | /* Align the location counter as required by EXP's data type. */ | |
2642 | align = (mode == VOIDmode) ? UNITS_PER_WORD : GET_MODE_SIZE (mode); | |
2643 | if (align > BIGGEST_ALIGNMENT / BITS_PER_UNIT) | |
2644 | align = BIGGEST_ALIGNMENT / BITS_PER_UNIT; | |
2645 | ||
2646 | pool_offset += align - 1; | |
2647 | pool_offset &= ~ (align - 1); | |
2648 | ||
2649 | /* Allocate a pool constant descriptor, fill it in, and chain it in. */ | |
2650 | ||
2651 | pool = (struct pool_constant *) oballoc (sizeof (struct pool_constant)); | |
2652 | pool->desc = desc; | |
2653 | pool->constant = x; | |
2654 | pool->mode = mode; | |
2655 | pool->labelno = const_labelno; | |
2656 | pool->align = align; | |
2657 | pool->offset = pool_offset; | |
2658 | pool->next = 0; | |
2659 | ||
2660 | if (last_pool == 0) | |
2661 | first_pool = pool; | |
2662 | else | |
2663 | last_pool->next = pool; | |
2664 | ||
2665 | last_pool = pool; | |
2666 | pool_offset += GET_MODE_SIZE (mode); | |
2667 | ||
2668 | /* Create a string containing the label name, in LABEL. */ | |
2669 | ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno); | |
2670 | ||
2671 | ++const_labelno; | |
2672 | ||
2673 | desc->label = found | |
2674 | = (char *) obstack_copy0 (saveable_obstack, label, strlen (label)); | |
2675 | ||
2676 | /* Add label to symbol hash table. */ | |
2677 | hash = SYMHASH (found); | |
2678 | sym = (struct pool_sym *) oballoc (sizeof (struct pool_sym)); | |
2679 | sym->label = found; | |
2680 | sym->pool = pool; | |
2681 | sym->next = const_rtx_sym_hash_table[hash]; | |
2682 | const_rtx_sym_hash_table[hash] = sym; | |
2683 | } | |
2684 | ||
2685 | /* We have a symbol name; construct the SYMBOL_REF and the MEM. */ | |
2686 | ||
2687 | def = gen_rtx (MEM, mode, gen_rtx (SYMBOL_REF, Pmode, found)); | |
2688 | ||
2689 | RTX_UNCHANGING_P (def) = 1; | |
2690 | /* Mark the symbol_ref as belonging to this constants pool. */ | |
2691 | CONSTANT_POOL_ADDRESS_P (XEXP (def, 0)) = 1; | |
2692 | current_function_uses_const_pool = 1; | |
2693 | ||
57632c51 RS |
2694 | if (outer_function_chain == 0) |
2695 | if (GET_CODE (x) == CONST_DOUBLE) | |
2696 | { | |
2697 | if (CONST_DOUBLE_MEM (x) == cc0_rtx) | |
2698 | { | |
2699 | CONST_DOUBLE_CHAIN (x) = const_double_chain; | |
2700 | const_double_chain = x; | |
2701 | } | |
2702 | CONST_DOUBLE_MEM (x) = def; | |
2703 | } | |
79e68feb RS |
2704 | |
2705 | return def; | |
2706 | } | |
2707 | \f | |
2708 | /* Given a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true, return a pointer to | |
2709 | the corresponding pool_constant structure. */ | |
2710 | ||
2711 | static struct pool_constant * | |
2712 | find_pool_constant (addr) | |
2713 | rtx addr; | |
2714 | { | |
2715 | struct pool_sym *sym; | |
2716 | char *label = XSTR (addr, 0); | |
2717 | ||
2718 | for (sym = const_rtx_sym_hash_table[SYMHASH (label)]; sym; sym = sym->next) | |
2719 | if (sym->label == label) | |
2720 | return sym->pool; | |
2721 | ||
2722 | abort (); | |
2723 | } | |
2724 | ||
2725 | /* Given a constant pool SYMBOL_REF, return the corresponding constant. */ | |
2726 | ||
2727 | rtx | |
2728 | get_pool_constant (addr) | |
2729 | rtx addr; | |
2730 | { | |
2731 | return (find_pool_constant (addr))->constant; | |
2732 | } | |
2733 | ||
2734 | /* Similar, return the mode. */ | |
2735 | ||
2736 | enum machine_mode | |
2737 | get_pool_mode (addr) | |
2738 | rtx addr; | |
2739 | { | |
2740 | return (find_pool_constant (addr))->mode; | |
2741 | } | |
2742 | ||
2743 | /* Similar, return the offset in the constant pool. */ | |
2744 | ||
2745 | int | |
2746 | get_pool_offset (addr) | |
2747 | rtx addr; | |
2748 | { | |
2749 | return (find_pool_constant (addr))->offset; | |
2750 | } | |
2751 | ||
2752 | /* Return the size of the constant pool. */ | |
2753 | ||
2754 | int | |
2755 | get_pool_size () | |
2756 | { | |
2757 | return pool_offset; | |
2758 | } | |
2759 | \f | |
2760 | /* Write all the constants in the constant pool. */ | |
2761 | ||
2762 | void | |
2763 | output_constant_pool (fnname, fndecl) | |
2764 | char *fnname; | |
2765 | tree fndecl; | |
2766 | { | |
2767 | struct pool_constant *pool; | |
2768 | rtx x; | |
2769 | union real_extract u; | |
2770 | ||
2771 | #ifdef ASM_OUTPUT_POOL_PROLOGUE | |
2772 | ASM_OUTPUT_POOL_PROLOGUE (asm_out_file, fnname, fndecl, pool_offset); | |
2773 | #endif | |
2774 | ||
2775 | for (pool = first_pool; pool; pool = pool->next) | |
2776 | { | |
2777 | x = pool->constant; | |
2778 | ||
2779 | /* See if X is a LABEL_REF (or a CONST referring to a LABEL_REF) | |
2780 | whose CODE_LABEL has been deleted. This can occur if a jump table | |
2781 | is eliminated by optimization. If so, write a constant of zero | |
7b2b3f1f RK |
2782 | instead. Note that this can also happen by turning the |
2783 | CODE_LABEL into a NOTE. */ | |
2784 | if (((GET_CODE (x) == LABEL_REF | |
2785 | && (INSN_DELETED_P (XEXP (x, 0)) | |
2786 | || GET_CODE (XEXP (x, 0)) == NOTE))) | |
79e68feb RS |
2787 | || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS |
2788 | && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF | |
7b2b3f1f RK |
2789 | && (INSN_DELETED_P (XEXP (XEXP (XEXP (x, 0), 0), 0)) |
2790 | || GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == NOTE))) | |
79e68feb RS |
2791 | x = const0_rtx; |
2792 | ||
2793 | /* First switch to correct section. */ | |
2794 | #ifdef SELECT_RTX_SECTION | |
2795 | SELECT_RTX_SECTION (pool->mode, x); | |
2796 | #else | |
2797 | readonly_data_section (); | |
2798 | #endif | |
2799 | ||
2800 | #ifdef ASM_OUTPUT_SPECIAL_POOL_ENTRY | |
2801 | ASM_OUTPUT_SPECIAL_POOL_ENTRY (asm_out_file, x, pool->mode, | |
2802 | pool->align, pool->labelno, done); | |
2803 | #endif | |
2804 | ||
2805 | if (pool->align > 1) | |
2806 | ASM_OUTPUT_ALIGN (asm_out_file, exact_log2 (pool->align)); | |
2807 | ||
2808 | /* Output the label. */ | |
2809 | ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", pool->labelno); | |
2810 | ||
2811 | /* Output the value of the constant itself. */ | |
2812 | switch (GET_MODE_CLASS (pool->mode)) | |
2813 | { | |
2814 | case MODE_FLOAT: | |
2815 | if (GET_CODE (x) != CONST_DOUBLE) | |
2816 | abort (); | |
2817 | ||
2818 | bcopy (&CONST_DOUBLE_LOW (x), &u, sizeof u); | |
2819 | assemble_real (u.d, pool->mode); | |
2820 | break; | |
2821 | ||
2822 | case MODE_INT: | |
ab8ab9d0 | 2823 | case MODE_PARTIAL_INT: |
79e68feb RS |
2824 | assemble_integer (x, GET_MODE_SIZE (pool->mode), 1); |
2825 | break; | |
2826 | ||
2827 | default: | |
2828 | abort (); | |
2829 | } | |
2830 | ||
2831 | done: ; | |
2832 | } | |
2833 | ||
2834 | /* Done with this pool. */ | |
2835 | first_pool = last_pool = 0; | |
2836 | } | |
2837 | \f | |
2838 | /* Find all the constants whose addresses are referenced inside of EXP, | |
2839 | and make sure assembler code with a label has been output for each one. | |
2840 | Indicate whether an ADDR_EXPR has been encountered. */ | |
2841 | ||
2842 | int | |
2843 | output_addressed_constants (exp) | |
2844 | tree exp; | |
2845 | { | |
2846 | int reloc = 0; | |
2847 | ||
2848 | switch (TREE_CODE (exp)) | |
2849 | { | |
2850 | case ADDR_EXPR: | |
2851 | { | |
2852 | register tree constant = TREE_OPERAND (exp, 0); | |
2853 | ||
2854 | while (TREE_CODE (constant) == COMPONENT_REF) | |
2855 | { | |
2856 | constant = TREE_OPERAND (constant, 0); | |
2857 | } | |
2858 | ||
2859 | if (TREE_CODE_CLASS (TREE_CODE (constant)) == 'c' | |
2860 | || TREE_CODE (constant) == CONSTRUCTOR) | |
2861 | /* No need to do anything here | |
2862 | for addresses of variables or functions. */ | |
2863 | output_constant_def (constant); | |
2864 | } | |
2865 | reloc = 1; | |
2866 | break; | |
2867 | ||
2868 | case PLUS_EXPR: | |
2869 | case MINUS_EXPR: | |
2870 | reloc = output_addressed_constants (TREE_OPERAND (exp, 0)); | |
2871 | reloc |= output_addressed_constants (TREE_OPERAND (exp, 1)); | |
2872 | break; | |
2873 | ||
2874 | case NOP_EXPR: | |
2875 | case CONVERT_EXPR: | |
37a52112 | 2876 | case NON_LVALUE_EXPR: |
79e68feb RS |
2877 | reloc = output_addressed_constants (TREE_OPERAND (exp, 0)); |
2878 | break; | |
2879 | ||
2880 | case CONSTRUCTOR: | |
2881 | { | |
2882 | register tree link; | |
2883 | for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link)) | |
2884 | if (TREE_VALUE (link) != 0) | |
2885 | reloc |= output_addressed_constants (TREE_VALUE (link)); | |
2886 | } | |
2887 | break; | |
2888 | ||
2889 | case ERROR_MARK: | |
2890 | break; | |
2891 | } | |
2892 | return reloc; | |
2893 | } | |
2894 | \f | |
2895 | /* Output assembler code for constant EXP to FILE, with no label. | |
2896 | This includes the pseudo-op such as ".int" or ".byte", and a newline. | |
2897 | Assumes output_addressed_constants has been done on EXP already. | |
2898 | ||
2899 | Generate exactly SIZE bytes of assembler data, padding at the end | |
2900 | with zeros if necessary. SIZE must always be specified. | |
2901 | ||
2902 | SIZE is important for structure constructors, | |
2903 | since trailing members may have been omitted from the constructor. | |
2904 | It is also important for initialization of arrays from string constants | |
2905 | since the full length of the string constant might not be wanted. | |
2906 | It is also needed for initialization of unions, where the initializer's | |
2907 | type is just one member, and that may not be as long as the union. | |
2908 | ||
2909 | There a case in which we would fail to output exactly SIZE bytes: | |
2910 | for a structure constructor that wants to produce more than SIZE bytes. | |
2911 | But such constructors will never be generated for any possible input. */ | |
2912 | ||
2913 | void | |
2914 | output_constant (exp, size) | |
2915 | register tree exp; | |
2916 | register int size; | |
2917 | { | |
2918 | register enum tree_code code = TREE_CODE (TREE_TYPE (exp)); | |
2919 | rtx x; | |
2920 | ||
2921 | if (size == 0) | |
2922 | return; | |
2923 | ||
fff9e713 MT |
2924 | /* Allow a constructor with no elements for any data type. |
2925 | This means to fill the space with zeros. */ | |
77fa0940 | 2926 | if (TREE_CODE (exp) == CONSTRUCTOR && CONSTRUCTOR_ELTS (exp) == 0) |
fff9e713 MT |
2927 | { |
2928 | assemble_zeros (size); | |
2929 | return; | |
2930 | } | |
2931 | ||
79e68feb RS |
2932 | /* Eliminate the NOP_EXPR that makes a cast not be an lvalue. |
2933 | That way we get the constant (we hope) inside it. */ | |
2934 | if (TREE_CODE (exp) == NOP_EXPR | |
2935 | && TREE_TYPE (exp) == TREE_TYPE (TREE_OPERAND (exp, 0))) | |
2936 | exp = TREE_OPERAND (exp, 0); | |
2937 | ||
2938 | switch (code) | |
2939 | { | |
644ea577 RS |
2940 | case CHAR_TYPE: |
2941 | case BOOLEAN_TYPE: | |
79e68feb RS |
2942 | case INTEGER_TYPE: |
2943 | case ENUMERAL_TYPE: | |
2944 | case POINTER_TYPE: | |
2945 | case REFERENCE_TYPE: | |
2946 | /* ??? What about (int)((float)(int)&foo + 4) */ | |
2947 | while (TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR | |
2948 | || TREE_CODE (exp) == NON_LVALUE_EXPR) | |
2949 | exp = TREE_OPERAND (exp, 0); | |
2950 | ||
37366632 | 2951 | if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode, |
79e68feb RS |
2952 | EXPAND_INITIALIZER), |
2953 | size, 0)) | |
2954 | error ("initializer for integer value is too complicated"); | |
2955 | size = 0; | |
2956 | break; | |
2957 | ||
2958 | case REAL_TYPE: | |
2959 | if (TREE_CODE (exp) != REAL_CST) | |
2960 | error ("initializer for floating value is not a floating constant"); | |
2961 | ||
2962 | assemble_real (TREE_REAL_CST (exp), | |
2963 | mode_for_size (size * BITS_PER_UNIT, MODE_FLOAT, 0)); | |
2964 | size = 0; | |
2965 | break; | |
2966 | ||
2967 | case COMPLEX_TYPE: | |
2968 | output_constant (TREE_REALPART (exp), size / 2); | |
2969 | output_constant (TREE_IMAGPART (exp), size / 2); | |
2970 | size -= (size / 2) * 2; | |
2971 | break; | |
2972 | ||
2973 | case ARRAY_TYPE: | |
2974 | if (TREE_CODE (exp) == CONSTRUCTOR) | |
2975 | { | |
2976 | output_constructor (exp, size); | |
2977 | return; | |
2978 | } | |
2979 | else if (TREE_CODE (exp) == STRING_CST) | |
2980 | { | |
2981 | int excess = 0; | |
2982 | ||
2983 | if (size > TREE_STRING_LENGTH (exp)) | |
2984 | { | |
2985 | excess = size - TREE_STRING_LENGTH (exp); | |
2986 | size = TREE_STRING_LENGTH (exp); | |
2987 | } | |
2988 | ||
2989 | assemble_string (TREE_STRING_POINTER (exp), size); | |
2990 | size = excess; | |
2991 | } | |
2992 | else | |
2993 | abort (); | |
2994 | break; | |
2995 | ||
2996 | case RECORD_TYPE: | |
2997 | case UNION_TYPE: | |
2998 | if (TREE_CODE (exp) == CONSTRUCTOR) | |
2999 | output_constructor (exp, size); | |
3000 | else | |
3001 | abort (); | |
3002 | return; | |
3003 | } | |
3004 | ||
3005 | if (size > 0) | |
3006 | assemble_zeros (size); | |
3007 | } | |
3008 | \f | |
3009 | /* Subroutine of output_constant, used for CONSTRUCTORs | |
3010 | (aggregate constants). | |
3011 | Generate at least SIZE bytes, padding if necessary. */ | |
3012 | ||
3013 | void | |
3014 | output_constructor (exp, size) | |
3015 | tree exp; | |
3016 | int size; | |
3017 | { | |
3018 | register tree link, field = 0; | |
3019 | /* Number of bytes output or skipped so far. | |
3020 | In other words, current position within the constructor. */ | |
3021 | int total_bytes = 0; | |
3022 | /* Non-zero means BYTE contains part of a byte, to be output. */ | |
3023 | int byte_buffer_in_use = 0; | |
3024 | register int byte; | |
3025 | ||
37366632 | 3026 | if (HOST_BITS_PER_WIDE_INT < BITS_PER_UNIT) |
79e68feb RS |
3027 | abort (); |
3028 | ||
3029 | if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE) | |
3030 | field = TYPE_FIELDS (TREE_TYPE (exp)); | |
3031 | ||
3032 | /* As LINK goes through the elements of the constant, | |
3033 | FIELD goes through the structure fields, if the constant is a structure. | |
3034 | if the constant is a union, then we override this, | |
3035 | by getting the field from the TREE_LIST element. | |
3036 | But the constant could also be an array. Then FIELD is zero. */ | |
3037 | for (link = CONSTRUCTOR_ELTS (exp); | |
3038 | link; | |
3039 | link = TREE_CHAIN (link), | |
3040 | field = field ? TREE_CHAIN (field) : 0) | |
3041 | { | |
3042 | tree val = TREE_VALUE (link); | |
3043 | /* the element in a union constructor specifies the proper field. */ | |
3044 | if (TREE_PURPOSE (link) != 0) | |
3045 | field = TREE_PURPOSE (link); | |
3046 | ||
3047 | /* Eliminate the marker that makes a cast not be an lvalue. */ | |
d964285c CH |
3048 | if (val != 0) |
3049 | STRIP_NOPS (val); | |
79e68feb RS |
3050 | |
3051 | if (field == 0 || !DECL_BIT_FIELD (field)) | |
3052 | { | |
3053 | register int fieldsize; | |
3054 | /* Since this structure is static, | |
3055 | we know the positions are constant. */ | |
3056 | int bitpos = (field ? (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)) | |
3057 | / BITS_PER_UNIT) | |
3058 | : 0); | |
3059 | ||
3060 | /* An element that is not a bit-field. | |
3061 | Output any buffered-up bit-fields preceding it. */ | |
3062 | if (byte_buffer_in_use) | |
3063 | { | |
3064 | ASM_OUTPUT_BYTE (asm_out_file, byte); | |
3065 | total_bytes++; | |
3066 | byte_buffer_in_use = 0; | |
3067 | } | |
3068 | ||
3069 | /* Advance to offset of this element. | |
3070 | Note no alignment needed in an array, since that is guaranteed | |
3071 | if each element has the proper size. */ | |
3072 | if (field != 0 && bitpos != total_bytes) | |
3073 | { | |
3074 | assemble_zeros (bitpos - total_bytes); | |
3075 | total_bytes = bitpos; | |
3076 | } | |
3077 | ||
3078 | /* Determine size this element should occupy. */ | |
3079 | if (field) | |
3080 | { | |
3081 | if (TREE_CODE (DECL_SIZE (field)) != INTEGER_CST) | |
3082 | abort (); | |
3083 | if (TREE_INT_CST_LOW (DECL_SIZE (field)) > 100000) | |
3084 | { | |
3085 | /* This avoids overflow trouble. */ | |
3086 | tree size_tree = size_binop (CEIL_DIV_EXPR, | |
3087 | DECL_SIZE (field), | |
3088 | size_int (BITS_PER_UNIT)); | |
3089 | fieldsize = TREE_INT_CST_LOW (size_tree); | |
3090 | } | |
3091 | else | |
3092 | { | |
3093 | fieldsize = TREE_INT_CST_LOW (DECL_SIZE (field)); | |
3094 | fieldsize = (fieldsize + BITS_PER_UNIT - 1) / BITS_PER_UNIT; | |
3095 | } | |
3096 | } | |
3097 | else | |
3098 | fieldsize = int_size_in_bytes (TREE_TYPE (TREE_TYPE (exp))); | |
3099 | ||
3100 | /* Output the element's initial value. */ | |
3101 | if (val == 0) | |
3102 | assemble_zeros (fieldsize); | |
3103 | else | |
3104 | output_constant (val, fieldsize); | |
3105 | ||
3106 | /* Count its size. */ | |
3107 | total_bytes += fieldsize; | |
3108 | } | |
3109 | else if (val != 0 && TREE_CODE (val) != INTEGER_CST) | |
3110 | error ("invalid initial value for member `%s'", | |
3111 | IDENTIFIER_POINTER (DECL_NAME (field))); | |
3112 | else | |
3113 | { | |
3114 | /* Element that is a bit-field. */ | |
3115 | ||
3116 | int next_offset = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)); | |
3117 | int end_offset | |
3118 | = (next_offset + TREE_INT_CST_LOW (DECL_SIZE (field))); | |
3119 | ||
3120 | if (val == 0) | |
3121 | val = integer_zero_node; | |
3122 | ||
3123 | /* If this field does not start in this (or, next) byte, | |
3124 | skip some bytes. */ | |
3125 | if (next_offset / BITS_PER_UNIT != total_bytes) | |
3126 | { | |
3127 | /* Output remnant of any bit field in previous bytes. */ | |
3128 | if (byte_buffer_in_use) | |
3129 | { | |
3130 | ASM_OUTPUT_BYTE (asm_out_file, byte); | |
3131 | total_bytes++; | |
3132 | byte_buffer_in_use = 0; | |
3133 | } | |
3134 | ||
3135 | /* If still not at proper byte, advance to there. */ | |
3136 | if (next_offset / BITS_PER_UNIT != total_bytes) | |
3137 | { | |
3138 | assemble_zeros (next_offset / BITS_PER_UNIT - total_bytes); | |
3139 | total_bytes = next_offset / BITS_PER_UNIT; | |
3140 | } | |
3141 | } | |
3142 | ||
3143 | if (! byte_buffer_in_use) | |
3144 | byte = 0; | |
3145 | ||
3146 | /* We must split the element into pieces that fall within | |
3147 | separate bytes, and combine each byte with previous or | |
3148 | following bit-fields. */ | |
3149 | ||
b4ac57ab | 3150 | /* next_offset is the offset n fbits from the beginning of |
79e68feb RS |
3151 | the structure to the next bit of this element to be processed. |
3152 | end_offset is the offset of the first bit past the end of | |
3153 | this element. */ | |
3154 | while (next_offset < end_offset) | |
3155 | { | |
3156 | int this_time; | |
3157 | int shift, value; | |
3158 | int next_byte = next_offset / BITS_PER_UNIT; | |
3159 | int next_bit = next_offset % BITS_PER_UNIT; | |
3160 | ||
3161 | /* Advance from byte to byte | |
3162 | within this element when necessary. */ | |
3163 | while (next_byte != total_bytes) | |
3164 | { | |
3165 | ASM_OUTPUT_BYTE (asm_out_file, byte); | |
3166 | total_bytes++; | |
3167 | byte = 0; | |
3168 | } | |
3169 | ||
3170 | /* Number of bits we can process at once | |
3171 | (all part of the same byte). */ | |
3172 | this_time = MIN (end_offset - next_offset, | |
3173 | BITS_PER_UNIT - next_bit); | |
3174 | #if BYTES_BIG_ENDIAN | |
3175 | /* On big-endian machine, take the most significant bits | |
3176 | first (of the bits that are significant) | |
3177 | and put them into bytes from the most significant end. */ | |
3178 | shift = end_offset - next_offset - this_time; | |
3179 | /* Don't try to take a bunch of bits that cross | |
3180 | the word boundary in the INTEGER_CST. */ | |
37366632 RK |
3181 | if (shift < HOST_BITS_PER_WIDE_INT |
3182 | && shift + this_time > HOST_BITS_PER_WIDE_INT) | |
79e68feb | 3183 | { |
37366632 RK |
3184 | this_time -= (HOST_BITS_PER_WIDE_INT - shift); |
3185 | shift = HOST_BITS_PER_WIDE_INT; | |
79e68feb RS |
3186 | } |
3187 | ||
3188 | /* Now get the bits from the appropriate constant word. */ | |
37366632 | 3189 | if (shift < HOST_BITS_PER_WIDE_INT) |
79e68feb RS |
3190 | { |
3191 | value = TREE_INT_CST_LOW (val); | |
3192 | } | |
37366632 | 3193 | else if (shift < 2 * HOST_BITS_PER_WIDE_INT) |
79e68feb RS |
3194 | { |
3195 | value = TREE_INT_CST_HIGH (val); | |
37366632 | 3196 | shift -= HOST_BITS_PER_WIDE_INT; |
79e68feb RS |
3197 | } |
3198 | else | |
3199 | abort (); | |
37366632 RK |
3200 | byte |= (((value >> shift) |
3201 | & (((HOST_WIDE_INT) 1 << this_time) - 1)) | |
79e68feb RS |
3202 | << (BITS_PER_UNIT - this_time - next_bit)); |
3203 | #else | |
3204 | /* On little-endian machines, | |
3205 | take first the least significant bits of the value | |
3206 | and pack them starting at the least significant | |
3207 | bits of the bytes. */ | |
3208 | shift = (next_offset | |
3209 | - TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))); | |
3210 | /* Don't try to take a bunch of bits that cross | |
3211 | the word boundary in the INTEGER_CST. */ | |
37366632 RK |
3212 | if (shift < HOST_BITS_PER_WIDE_INT |
3213 | && shift + this_time > HOST_BITS_PER_WIDE_INT) | |
79e68feb | 3214 | { |
37366632 RK |
3215 | this_time -= (HOST_BITS_PER_WIDE_INT - shift); |
3216 | shift = HOST_BITS_PER_WIDE_INT; | |
79e68feb RS |
3217 | } |
3218 | ||
3219 | /* Now get the bits from the appropriate constant word. */ | |
3220 | if (shift < HOST_BITS_PER_INT) | |
3221 | value = TREE_INT_CST_LOW (val); | |
37366632 | 3222 | else if (shift < 2 * HOST_BITS_PER_WIDE_INT) |
79e68feb RS |
3223 | { |
3224 | value = TREE_INT_CST_HIGH (val); | |
37366632 | 3225 | shift -= HOST_BITS_PER_WIDE_INT; |
79e68feb RS |
3226 | } |
3227 | else | |
3228 | abort (); | |
37366632 RK |
3229 | byte |= ((value >> shift) |
3230 | & (((HOST_WIDE_INT) 1 << this_time) - 1)) << next_bit; | |
79e68feb RS |
3231 | #endif |
3232 | next_offset += this_time; | |
3233 | byte_buffer_in_use = 1; | |
3234 | } | |
3235 | } | |
3236 | } | |
3237 | if (byte_buffer_in_use) | |
3238 | { | |
3239 | ASM_OUTPUT_BYTE (asm_out_file, byte); | |
3240 | total_bytes++; | |
3241 | } | |
3242 | if (total_bytes < size) | |
3243 | assemble_zeros (size - total_bytes); | |
3244 | } |