1 /* Output variables, constants and external declarations, for GNU compiler.
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 /* This file handles generation of all the assembler code
24 *except* the instructions of a function.
25 This includes declarations of variables and their initial values.
27 We also output the assembler code for constants stored in memory
28 and are responsible for combining constants with the same value. */
38 #include "hard-reg-set.h"
52 #ifdef XCOFF_DEBUGGING_INFO
56 #ifndef TRAMPOLINE_ALIGNMENT
57 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
61 #define ASM_STABS_OP "\t.stabs\t"
64 /* Define the prefix to use when check_memory_usage_flag is enable. */
65 #ifdef NO_DOLLAR_IN_LABEL
66 #ifdef NO_DOT_IN_LABEL
67 #define CHKR_PREFIX "chkr_prefix_"
68 #else /* !NO_DOT_IN_LABEL */
69 #define CHKR_PREFIX "chkr."
71 #else /* !NO_DOLLAR_IN_LABEL */
72 #define CHKR_PREFIX "chkr$"
74 #define CHKR_PREFIX_SIZE (sizeof (CHKR_PREFIX) - 1)
76 /* File in which assembler code is being written. */
78 extern FILE *asm_out_file
;
80 /* The (assembler) name of the first globally-visible object output. */
81 const char *first_global_object_name
;
82 const char *weak_global_object_name
;
84 extern struct obstack permanent_obstack
;
85 #define obstack_chunk_alloc xmalloc
88 struct constant_descriptor
;
92 #define MAX_RTX_HASH_TABLE 61
96 /* Hash facility for making memory-constants
97 from constant rtl-expressions. It is used on RISC machines
98 where immediate integer arguments and constant addresses are restricted
99 so that such constants must be stored in memory.
101 This pool of constants is reinitialized for each function
102 so each function gets its own constants-pool that comes right before
104 struct constant_descriptor
**x_const_rtx_hash_table
;
105 struct pool_constant
**x_const_rtx_sym_hash_table
;
107 /* Pointers to first and last constant in pool. */
108 struct pool_constant
*x_first_pool
, *x_last_pool
;
110 /* Current offset in constant pool (does not include any machine-specific
114 /* Chain of all CONST_DOUBLE rtx's constructed for the current function.
115 They are chained through the CONST_DOUBLE_CHAIN.
116 A CONST_DOUBLE rtx has CONST_DOUBLE_MEM != cc0_rtx iff it is on this chain.
117 In that case, CONST_DOUBLE_MEM is either a MEM,
118 or const0_rtx if no MEM has been made for this CONST_DOUBLE yet. */
119 rtx x_const_double_chain
;
122 #define const_rtx_hash_table (cfun->varasm->x_const_rtx_hash_table)
123 #define const_rtx_sym_hash_table (cfun->varasm->x_const_rtx_sym_hash_table)
124 #define first_pool (cfun->varasm->x_first_pool)
125 #define last_pool (cfun->varasm->x_last_pool)
126 #define pool_offset (cfun->varasm->x_pool_offset)
127 #define const_double_chain (cfun->varasm->x_const_double_chain)
129 /* Number for making the label on the next
130 constant that is stored in memory. */
134 /* Number for making the label on the next
135 static variable internal to a function. */
139 /* Carry information from ASM_DECLARE_OBJECT_NAME
140 to ASM_FINISH_DECLARE_OBJECT. */
142 int size_directive_output
;
144 /* The last decl for which assemble_variable was called,
145 if it did ASM_DECLARE_OBJECT_NAME.
146 If the last call to assemble_variable didn't do that,
149 tree last_assemble_variable_decl
;
151 static const char *strip_reg_name
PARAMS ((const char *));
152 static int contains_pointers_p
PARAMS ((tree
));
153 static void decode_addr_const
PARAMS ((tree
, struct addr_const
*));
154 static int const_hash
PARAMS ((tree
));
155 static int compare_constant
PARAMS ((tree
,
156 struct constant_descriptor
*));
157 static const unsigned char *compare_constant_1
PARAMS ((tree
, const unsigned char *));
158 static struct constant_descriptor
*record_constant
PARAMS ((tree
));
159 static void record_constant_1
PARAMS ((tree
));
160 static tree copy_constant
PARAMS ((tree
));
161 static void output_constant_def_contents
PARAMS ((tree
, int, int));
162 static void decode_rtx_const
PARAMS ((enum machine_mode
, rtx
,
163 struct rtx_const
*));
164 static int const_hash_rtx
PARAMS ((enum machine_mode
, rtx
));
165 static int compare_constant_rtx
PARAMS ((enum machine_mode
, rtx
,
166 struct constant_descriptor
*));
167 static struct constant_descriptor
*record_constant_rtx
PARAMS ((enum machine_mode
,
169 static struct pool_constant
*find_pool_constant
PARAMS ((struct function
*, rtx
));
170 static void mark_constant_pool
PARAMS ((void));
171 static void mark_constants
PARAMS ((rtx
));
172 static int output_addressed_constants
PARAMS ((tree
));
173 static void output_after_function_constants
PARAMS ((void));
174 static void output_constructor
PARAMS ((tree
, int));
175 #ifdef ASM_WEAKEN_LABEL
176 static void remove_from_pending_weak_list
PARAMS ((const char *));
178 #ifdef ASM_OUTPUT_BSS
179 static void asm_output_bss
PARAMS ((FILE *, tree
, const char *, int, int));
181 #ifdef BSS_SECTION_ASM_OP
182 #ifdef ASM_OUTPUT_ALIGNED_BSS
183 static void asm_output_aligned_bss
PARAMS ((FILE *, tree
, const char *,
186 #endif /* BSS_SECTION_ASM_OP */
187 static void mark_pool_constant
PARAMS ((struct pool_constant
*));
188 static void mark_const_hash_entry
PARAMS ((void *));
189 static int mark_const_str_htab_1
PARAMS ((void **, void *));
190 static void mark_const_str_htab
PARAMS ((void *));
191 static hashval_t const_str_htab_hash
PARAMS ((const void *x
));
192 static int const_str_htab_eq
PARAMS ((const void *x
, const void *y
));
193 static void const_str_htab_del
PARAMS ((void *));
194 static void asm_emit_uninitialised
PARAMS ((tree
, const char*, int, int));
196 static enum in_section
{ no_section
, in_text
, in_data
, in_named
197 #ifdef BSS_SECTION_ASM_OP
200 #ifdef EH_FRAME_SECTION_ASM_OP
203 #ifdef EXTRA_SECTIONS
206 } in_section
= no_section
;
208 /* Return a non-zero value if DECL has a section attribute. */
209 #ifndef IN_NAMED_SECTION
210 #define IN_NAMED_SECTION(DECL) \
211 ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
212 && DECL_SECTION_NAME (DECL) != NULL_TREE)
215 /* Text of section name when in_section == in_named. */
216 static const char *in_named_name
;
218 /* Define functions like text_section for any extra sections. */
219 #ifdef EXTRA_SECTION_FUNCTIONS
220 EXTRA_SECTION_FUNCTIONS
223 /* Tell assembler to switch to text section. */
228 if (in_section
!= in_text
)
230 fprintf (asm_out_file
, "%s\n", TEXT_SECTION_ASM_OP
);
231 in_section
= in_text
;
235 /* Tell assembler to switch to data section. */
240 if (in_section
!= in_data
)
242 if (flag_shared_data
)
244 #ifdef SHARED_SECTION_ASM_OP
245 fprintf (asm_out_file
, "%s\n", SHARED_SECTION_ASM_OP
);
247 fprintf (asm_out_file
, "%s\n", DATA_SECTION_ASM_OP
);
251 fprintf (asm_out_file
, "%s\n", DATA_SECTION_ASM_OP
);
253 in_section
= in_data
;
256 /* Tell assembler to ALWAYS switch to data section, in case
257 it's not sure where it it. */
260 force_data_section ()
262 in_section
= no_section
;
266 /* Tell assembler to switch to read-only data section. This is normally
270 readonly_data_section ()
272 #ifdef READONLY_DATA_SECTION
273 READONLY_DATA_SECTION (); /* Note this can call data_section. */
279 /* Determine if we're in the text section. */
284 return in_section
== in_text
;
287 /* Determine if we're in the data section. */
292 return in_section
== in_data
;
295 /* Tell assembler to change to section NAME for DECL.
296 If DECL is NULL, just switch to section NAME.
297 If NAME is NULL, get the name from DECL.
298 If RELOC is 1, the initializer for DECL contains relocs. */
301 named_section (decl
, name
, reloc
)
304 int reloc ATTRIBUTE_UNUSED
;
306 if (decl
!= NULL_TREE
&& !DECL_P (decl
))
309 name
= TREE_STRING_POINTER (DECL_SECTION_NAME (decl
));
311 if (in_section
!= in_named
|| strcmp (name
, in_named_name
))
313 #ifdef ASM_OUTPUT_SECTION_NAME
314 ASM_OUTPUT_SECTION_NAME (asm_out_file
, decl
, name
, reloc
);
316 /* Section attributes are not supported if this macro isn't provided -
317 some host formats don't support them at all. The front-end should
318 already have flagged this as an error. */
322 in_named_name
= ggc_alloc_string (name
, -1);
323 in_section
= in_named
;
327 #ifdef ASM_OUTPUT_SECTION_NAME
328 #ifndef UNIQUE_SECTION
329 #define UNIQUE_SECTION(DECL,RELOC) \
335 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
336 /* Strip off any encoding in name. */ \
337 STRIP_NAME_ENCODING (name, name); \
339 len = strlen (name) + 1; \
340 string = alloca (len + 1); \
341 sprintf (string, ".%s", name); \
343 DECL_SECTION_NAME (DECL) = build_string (len, string); \
346 #ifndef UNIQUE_SECTION_P
347 #define UNIQUE_SECTION_P(DECL) 0
351 #ifdef BSS_SECTION_ASM_OP
353 /* Tell the assembler to switch to the bss section. */
358 if (in_section
!= in_bss
)
360 #ifdef SHARED_BSS_SECTION_ASM_OP
361 if (flag_shared_data
)
362 fprintf (asm_out_file
, "%s\n", SHARED_BSS_SECTION_ASM_OP
);
365 fprintf (asm_out_file
, "%s\n", BSS_SECTION_ASM_OP
);
371 #ifdef ASM_OUTPUT_BSS
373 /* Utility function for ASM_OUTPUT_BSS for targets to use if
374 they don't support alignments in .bss.
375 ??? It is believed that this function will work in most cases so such
376 support is localized here. */
379 asm_output_bss (file
, decl
, name
, size
, rounded
)
381 tree decl ATTRIBUTE_UNUSED
;
383 int size ATTRIBUTE_UNUSED
, rounded
;
385 ASM_GLOBALIZE_LABEL (file
, name
);
387 #ifdef ASM_DECLARE_OBJECT_NAME
388 last_assemble_variable_decl
= decl
;
389 ASM_DECLARE_OBJECT_NAME (file
, name
, decl
);
391 /* Standard thing is just output label for the object. */
392 ASM_OUTPUT_LABEL (file
, name
);
393 #endif /* ASM_DECLARE_OBJECT_NAME */
394 ASM_OUTPUT_SKIP (file
, rounded
);
399 #ifdef ASM_OUTPUT_ALIGNED_BSS
401 /* Utility function for targets to use in implementing
402 ASM_OUTPUT_ALIGNED_BSS.
403 ??? It is believed that this function will work in most cases so such
404 support is localized here. */
407 asm_output_aligned_bss (file
, decl
, name
, size
, align
)
413 ASM_GLOBALIZE_LABEL (file
, name
);
415 ASM_OUTPUT_ALIGN (file
, floor_log2 (align
/ BITS_PER_UNIT
));
416 #ifdef ASM_DECLARE_OBJECT_NAME
417 last_assemble_variable_decl
= decl
;
418 ASM_DECLARE_OBJECT_NAME (file
, name
, decl
);
420 /* Standard thing is just output label for the object. */
421 ASM_OUTPUT_LABEL (file
, name
);
422 #endif /* ASM_DECLARE_OBJECT_NAME */
423 ASM_OUTPUT_SKIP (file
, size
? size
: 1);
428 #endif /* BSS_SECTION_ASM_OP */
430 #ifdef EH_FRAME_SECTION_ASM_OP
434 if (in_section
!= in_eh_frame
)
436 fprintf (asm_out_file
, "%s\n", EH_FRAME_SECTION_ASM_OP
);
437 in_section
= in_eh_frame
;
442 /* Switch to the section for function DECL.
444 If DECL is NULL_TREE, switch to the text section.
445 ??? It's not clear that we will ever be passed NULL_TREE, but it's
446 safer to handle it. */
449 function_section (decl
)
452 if (decl
!= NULL_TREE
453 && DECL_SECTION_NAME (decl
) != NULL_TREE
)
454 named_section (decl
, (char *) 0, 0);
459 /* Switch to section for variable DECL.
461 RELOC is the `reloc' argument to SELECT_SECTION. */
464 variable_section (decl
, reloc
)
468 if (IN_NAMED_SECTION (decl
))
469 named_section (decl
, NULL
, reloc
);
472 /* C++ can have const variables that get initialized from constructors,
473 and thus can not be in a readonly section. We prevent this by
474 verifying that the initial value is constant for objects put in a
477 error_mark_node is used by the C front end to indicate that the
478 initializer has not been seen yet. In this case, we assume that
479 the initializer must be constant.
481 C++ uses error_mark_node for variables that have complicated
482 initializers, but these variables go in BSS so we won't be called
485 #ifdef SELECT_SECTION
486 SELECT_SECTION (decl
, reloc
);
488 if (DECL_READONLY_SECTION (decl
, reloc
))
489 readonly_data_section ();
496 /* Tell assembler to switch to the section for the exception handling
502 #if defined (EXCEPTION_SECTION)
503 EXCEPTION_SECTION ();
505 #ifdef ASM_OUTPUT_SECTION_NAME
506 named_section (NULL_TREE
, ".gcc_except_table", 0);
511 readonly_data_section ();
516 /* Create the rtl to represent a function, for a function definition.
517 DECL is a FUNCTION_DECL node which describes which function.
518 The rtl is stored into DECL. */
521 make_function_rtl (decl
)
525 const char *new_name
;
527 if (DECL_RTL (decl
) != 0)
529 /* ??? Another way to do this would be to do what halfpic.c does
530 and maintain a hashed table of such critters. */
531 /* ??? Another way to do this would be to pass a flag bit to
532 ENCODE_SECTION_INFO saying whether this is a new decl or not. */
533 /* Let the target reassign the RTL if it wants.
534 This is necessary, for example, when one machine specific
535 decl attribute overrides another. */
536 #ifdef REDO_SECTION_INFO_P
537 if (REDO_SECTION_INFO_P (decl
))
538 ENCODE_SECTION_INFO (decl
);
543 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
546 /* Rename a nested function to avoid conflicts, unless it's a member of
547 a local class, in which case the class name is already unique. */
548 if (decl_function_context (decl
) != 0
549 && ! TYPE_P (DECL_CONTEXT (decl
))
550 && DECL_INITIAL (decl
) != 0
551 && DECL_RTL (decl
) == 0)
554 ASM_FORMAT_PRIVATE_NAME (label
, name
, var_labelno
);
558 /* When -fprefix-function-name is used, every function name is
559 prefixed. Even static functions are prefixed because they
560 could be declared latter. Note that a nested function name
562 else if (flag_prefix_function_name
)
564 size_t name_len
= IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl
));
567 pname
= alloca (name_len
+ CHKR_PREFIX_SIZE
+ 1);
568 memcpy (pname
, CHKR_PREFIX
, CHKR_PREFIX_SIZE
);
569 memcpy (pname
+ CHKR_PREFIX_SIZE
, name
, name_len
+ 1);
573 if (name
!= new_name
)
575 DECL_ASSEMBLER_NAME (decl
) = get_identifier (new_name
);
576 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
580 = gen_rtx_MEM (DECL_MODE (decl
),
581 gen_rtx_SYMBOL_REF (Pmode
, name
));
583 /* Optionally set flags or add text to the name to record
584 information such as that it is a function name. If the name
585 is changed, the macro ASM_OUTPUT_LABELREF will have to know
586 how to strip this information. */
587 #ifdef ENCODE_SECTION_INFO
588 ENCODE_SECTION_INFO (decl
);
593 /* Given NAME, a putative register name, discard any customary prefixes. */
596 strip_reg_name (name
)
599 #ifdef REGISTER_PREFIX
600 if (!strncmp (name
, REGISTER_PREFIX
, strlen (REGISTER_PREFIX
)))
601 name
+= strlen (REGISTER_PREFIX
);
603 if (name
[0] == '%' || name
[0] == '#')
608 /* Decode an `asm' spec for a declaration as a register name.
609 Return the register number, or -1 if nothing specified,
610 or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
611 or -3 if ASMSPEC is `cc' and is not recognized,
612 or -4 if ASMSPEC is `memory' and is not recognized.
613 Accept an exact spelling or a decimal number.
614 Prefixes such as % are optional. */
617 decode_reg_name (asmspec
)
624 /* Get rid of confusing prefixes. */
625 asmspec
= strip_reg_name (asmspec
);
627 /* Allow a decimal number as a "register name". */
628 for (i
= strlen (asmspec
) - 1; i
>= 0; i
--)
629 if (! (asmspec
[i
] >= '0' && asmspec
[i
] <= '9'))
631 if (asmspec
[0] != 0 && i
< 0)
634 if (i
< FIRST_PSEUDO_REGISTER
&& i
>= 0)
640 for (i
= 0; i
< FIRST_PSEUDO_REGISTER
; i
++)
642 && ! strcmp (asmspec
, strip_reg_name (reg_names
[i
])))
645 #ifdef ADDITIONAL_REGISTER_NAMES
647 static struct { const char *name
; int number
; } table
[]
648 = ADDITIONAL_REGISTER_NAMES
;
650 for (i
= 0; i
< (int) ARRAY_SIZE (table
); i
++)
651 if (! strcmp (asmspec
, table
[i
].name
))
652 return table
[i
].number
;
654 #endif /* ADDITIONAL_REGISTER_NAMES */
656 if (!strcmp (asmspec
, "memory"))
659 if (!strcmp (asmspec
, "cc"))
668 /* Create the DECL_RTL for a declaration for a static or external variable
669 or static or external function.
670 ASMSPEC, if not 0, is the string which the user specified
671 as the assembler symbol name.
672 TOP_LEVEL is nonzero if this is a file-scope variable.
674 This is never called for PARM_DECL nodes. */
677 make_decl_rtl (decl
, asmspec
, top_level
)
682 const char *name
= 0;
683 const char *new_name
= 0;
686 /* For a duplicate declaration, we can be called twice on the
687 same DECL node. Don't discard the RTL already made. */
688 if (DECL_RTL (decl
) != 0)
690 /* If the old RTL had the wrong mode, fix the mode. */
691 if (GET_MODE (DECL_RTL (decl
)) != DECL_MODE (decl
))
693 rtx rtl
= DECL_RTL (decl
);
694 PUT_MODE (rtl
, DECL_MODE (decl
));
697 /* ??? Another way to do this would be to do what halfpic.c does
698 and maintain a hashed table of such critters. */
699 /* ??? Another way to do this would be to pass a flag bit to
700 ENCODE_SECTION_INFO saying whether this is a new decl or not. */
701 /* Let the target reassign the RTL if it wants.
702 This is necessary, for example, when one machine specific
703 decl attribute overrides another. */
704 #ifdef REDO_SECTION_INFO_P
705 if (REDO_SECTION_INFO_P (decl
))
706 ENCODE_SECTION_INFO (decl
);
711 new_name
= name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
713 reg_number
= decode_reg_name (asmspec
);
714 if (reg_number
== -2)
716 /* ASMSPEC is given, and not the name of a register. Mark the
717 name with a star so assemble_name won't munge it. */
718 char *starred
= alloca (strlen (asmspec
) + 2);
720 strcpy (starred
+ 1, asmspec
);
724 if (TREE_CODE (decl
) != FUNCTION_DECL
&& DECL_REGISTER (decl
))
726 /* First detect errors in declaring global registers. */
727 if (reg_number
== -1)
728 error_with_decl (decl
, "register name not specified for `%s'");
729 else if (reg_number
< 0)
730 error_with_decl (decl
, "invalid register name for `%s'");
731 else if (TYPE_MODE (TREE_TYPE (decl
)) == BLKmode
)
732 error_with_decl (decl
,
733 "data type of `%s' isn't suitable for a register");
734 else if (! HARD_REGNO_MODE_OK (reg_number
, TYPE_MODE (TREE_TYPE (decl
))))
735 error_with_decl (decl
,
736 "register specified for `%s' isn't suitable for data type");
737 /* Now handle properly declared static register variables. */
742 if (DECL_INITIAL (decl
) != 0 && top_level
)
744 DECL_INITIAL (decl
) = 0;
745 error ("global register variable has initial value");
747 if (TREE_THIS_VOLATILE (decl
))
748 warning ("volatile register variables don't work as you might wish");
750 /* If the user specified one of the eliminables registers here,
751 e.g., FRAME_POINTER_REGNUM, we don't want to get this variable
752 confused with that register and be eliminated. Although this
753 usage is somewhat suspect, we nevertheless use the following
754 kludge to avoid setting DECL_RTL to frame_pointer_rtx. */
757 = gen_rtx_REG (DECL_MODE (decl
), FIRST_PSEUDO_REGISTER
);
758 REGNO (DECL_RTL (decl
)) = reg_number
;
759 REG_USERVAR_P (DECL_RTL (decl
)) = 1;
763 /* Make this register global, so not usable for anything
765 #ifdef ASM_DECLARE_REGISTER_GLOBAL
766 ASM_DECLARE_REGISTER_GLOBAL (asm_out_file
, decl
, reg_number
, name
);
768 nregs
= HARD_REGNO_NREGS (reg_number
, DECL_MODE (decl
));
770 globalize_reg (reg_number
+ --nregs
);
773 /* As a register variable, it has no section. */
778 /* Now handle ordinary static variables and functions (in memory).
779 Also handle vars declared register invalidly. */
781 if (reg_number
>= 0 || reg_number
== -3)
782 error_with_decl (decl
,
783 "register name given for non-register variable `%s'");
785 /* Specifying a section attribute on a variable forces it into a
786 non-.bss section, and thus it cannot be common. */
787 if (TREE_CODE (decl
) == VAR_DECL
788 && DECL_SECTION_NAME (decl
) != NULL_TREE
789 && DECL_INITIAL (decl
) == NULL_TREE
790 && DECL_COMMON (decl
))
791 DECL_COMMON (decl
) = 0;
793 /* Can't use just the variable's own name for a variable
794 whose scope is less than the whole file, unless it's a member
795 of a local class (which will already be unambiguous).
796 Concatenate a distinguishing number. */
797 if (!top_level
&& !TREE_PUBLIC (decl
)
798 && ! (DECL_CONTEXT (decl
) && TYPE_P (DECL_CONTEXT (decl
)))
802 ASM_FORMAT_PRIVATE_NAME (label
, name
, var_labelno
);
807 /* When -fprefix-function-name is used, the functions
808 names are prefixed. Only nested function names are not
810 else if (flag_prefix_function_name
&& TREE_CODE (decl
) == FUNCTION_DECL
)
812 size_t name_len
= IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl
));
815 pname
= alloca (name_len
+ CHKR_PREFIX_SIZE
+ 1);
816 memcpy (pname
, CHKR_PREFIX
, CHKR_PREFIX_SIZE
);
817 memcpy (pname
+ CHKR_PREFIX_SIZE
, name
, name_len
+ 1);
821 if (name
!= new_name
)
823 DECL_ASSEMBLER_NAME (decl
) = get_identifier (new_name
);
824 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
827 /* If this variable is to be treated as volatile, show its
828 tree node has side effects. */
829 if ((flag_volatile_global
&& TREE_CODE (decl
) == VAR_DECL
830 && TREE_PUBLIC (decl
))
831 || ((flag_volatile_static
&& TREE_CODE (decl
) == VAR_DECL
832 && (TREE_PUBLIC (decl
) || TREE_STATIC (decl
)))))
833 TREE_SIDE_EFFECTS (decl
) = 1;
835 DECL_RTL (decl
) = gen_rtx_MEM (DECL_MODE (decl
),
836 gen_rtx_SYMBOL_REF (Pmode
, name
));
837 if (TREE_CODE (decl
) != FUNCTION_DECL
)
838 set_mem_attributes (DECL_RTL (decl
), decl
, 1);
840 /* Optionally set flags or add text to the name to record information
841 such as that it is a function name.
842 If the name is changed, the macro ASM_OUTPUT_LABELREF
843 will have to know how to strip this information. */
844 #ifdef ENCODE_SECTION_INFO
845 ENCODE_SECTION_INFO (decl
);
849 /* Make the rtl for variable VAR be volatile.
850 Use this only for static variables. */
853 make_var_volatile (var
)
856 if (GET_CODE (DECL_RTL (var
)) != MEM
)
859 MEM_VOLATILE_P (DECL_RTL (var
)) = 1;
862 /* Output alignment directive to align for constant expression EXP. */
865 assemble_constant_align (exp
)
870 /* Align the location counter as required by EXP's data type. */
871 align
= TYPE_ALIGN (TREE_TYPE (exp
));
872 #ifdef CONSTANT_ALIGNMENT
873 align
= CONSTANT_ALIGNMENT (exp
, align
);
876 if (align
> BITS_PER_UNIT
)
877 ASM_OUTPUT_ALIGN (asm_out_file
, floor_log2 (align
/ BITS_PER_UNIT
));
880 /* Output a string of literal assembler code
881 for an `asm' keyword used between functions. */
884 assemble_asm (string
)
889 if (TREE_CODE (string
) == ADDR_EXPR
)
890 string
= TREE_OPERAND (string
, 0);
892 fprintf (asm_out_file
, "\t%s\n", TREE_STRING_POINTER (string
));
895 #if 0 /* This should no longer be needed, because
896 flag_gnu_linker should be 0 on these systems,
897 which should prevent any output
898 if ASM_OUTPUT_CONSTRUCTOR and ASM_OUTPUT_DESTRUCTOR are absent. */
899 #if !(defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER))
900 #ifndef ASM_OUTPUT_CONSTRUCTOR
901 #define ASM_OUTPUT_CONSTRUCTOR(file, name)
903 #ifndef ASM_OUTPUT_DESTRUCTOR
904 #define ASM_OUTPUT_DESTRUCTOR(file, name)
909 /* Record an element in the table of global destructors.
910 How this is done depends on what sort of assembler and linker
913 NAME should be the name of a global function to be called
914 at exit time. This name is output using assemble_name. */
917 assemble_destructor (name
)
920 #ifdef ASM_OUTPUT_DESTRUCTOR
921 ASM_OUTPUT_DESTRUCTOR (asm_out_file
, name
);
925 /* Now tell GNU LD that this is part of the static destructor set. */
926 /* This code works for any machine provided you use GNU as/ld. */
927 fprintf (asm_out_file
, "%s\"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP
);
928 assemble_name (asm_out_file
, name
);
929 fputc ('\n', asm_out_file
);
934 /* Likewise for global constructors. */
937 assemble_constructor (name
)
940 #ifdef ASM_OUTPUT_CONSTRUCTOR
941 ASM_OUTPUT_CONSTRUCTOR (asm_out_file
, name
);
945 /* Now tell GNU LD that this is part of the static constructor set. */
946 /* This code works for any machine provided you use GNU as/ld. */
947 fprintf (asm_out_file
, "%s\"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP
);
948 assemble_name (asm_out_file
, name
);
949 fputc ('\n', asm_out_file
);
954 /* Likewise for entries we want to record for garbage collection.
955 Garbage collection is still under development. */
958 assemble_gc_entry (name
)
961 #ifdef ASM_OUTPUT_GC_ENTRY
962 ASM_OUTPUT_GC_ENTRY (asm_out_file
, name
);
966 /* Now tell GNU LD that this is part of the static constructor set. */
967 fprintf (asm_out_file
, "%s\"___PTR_LIST__\",22,0,0,", ASM_STABS_OP
);
968 assemble_name (asm_out_file
, name
);
969 fputc ('\n', asm_out_file
);
974 /* CONSTANT_POOL_BEFORE_FUNCTION may be defined as an expression with
975 a non-zero value if the constant pool should be output before the
976 start of the function, or a zero value if the pool should output
977 after the end of the function. The default is to put it before the
980 #ifndef CONSTANT_POOL_BEFORE_FUNCTION
981 #define CONSTANT_POOL_BEFORE_FUNCTION 1
984 /* Output assembler code for the constant pool of a function and associated
985 with defining the name of the function. DECL describes the function.
986 NAME is the function's name. For the constant pool, we use the current
987 constant pool data. */
990 assemble_start_function (decl
, fnname
)
996 /* The following code does not need preprocessing in the assembler. */
1000 if (CONSTANT_POOL_BEFORE_FUNCTION
)
1001 output_constant_pool (fnname
, decl
);
1003 #ifdef ASM_OUTPUT_SECTION_NAME
1004 /* If the function is to be put in its own section and it's not in a section
1005 already, indicate so. */
1006 if ((flag_function_sections
1007 && DECL_SECTION_NAME (decl
) == NULL_TREE
)
1008 || UNIQUE_SECTION_P (decl
))
1009 UNIQUE_SECTION (decl
, 0);
1012 function_section (decl
);
1014 /* Tell assembler to move to target machine's alignment for functions. */
1015 align
= floor_log2 (FUNCTION_BOUNDARY
/ BITS_PER_UNIT
);
1017 ASM_OUTPUT_ALIGN (asm_out_file
, align
);
1019 /* Handle a user-specified function alignment.
1020 Note that we still need to align to FUNCTION_BOUNDARY, as above,
1021 because ASM_OUTPUT_MAX_SKIP_ALIGN might not do any alignment at all. */
1022 if (align_functions_log
> align
)
1024 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
1025 ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file
,
1026 align_functions_log
, align_functions
-1);
1028 ASM_OUTPUT_ALIGN (asm_out_file
, align_functions_log
);
1032 #ifdef ASM_OUTPUT_FUNCTION_PREFIX
1033 ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file
, fnname
);
1036 #ifdef SDB_DEBUGGING_INFO
1037 /* Output SDB definition of the function. */
1038 if (write_symbols
== SDB_DEBUG
)
1039 sdbout_mark_begin_function ();
1042 #ifdef DBX_DEBUGGING_INFO
1043 /* Output DBX definition of the function. */
1044 if (write_symbols
== DBX_DEBUG
)
1045 dbxout_begin_function (decl
);
1048 /* Make function name accessible from other files, if appropriate. */
1050 if (TREE_PUBLIC (decl
))
1052 if (! first_global_object_name
)
1057 STRIP_NAME_ENCODING (p
, fnname
);
1058 name
= permalloc (strlen (p
) + 1);
1061 if (! DECL_WEAK (decl
) && ! DECL_ONE_ONLY (decl
))
1062 first_global_object_name
= name
;
1064 weak_global_object_name
= name
;
1067 #ifdef ASM_WEAKEN_LABEL
1068 if (DECL_WEAK (decl
))
1070 ASM_WEAKEN_LABEL (asm_out_file
, fnname
);
1071 /* Remove this function from the pending weak list so that
1072 we do not emit multiple .weak directives for it. */
1073 remove_from_pending_weak_list
1074 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
1078 ASM_GLOBALIZE_LABEL (asm_out_file
, fnname
);
1081 /* Do any machine/system dependent processing of the function name */
1082 #ifdef ASM_DECLARE_FUNCTION_NAME
1083 ASM_DECLARE_FUNCTION_NAME (asm_out_file
, fnname
, current_function_decl
);
1085 /* Standard thing is just output label for the function. */
1086 ASM_OUTPUT_LABEL (asm_out_file
, fnname
);
1087 #endif /* ASM_DECLARE_FUNCTION_NAME */
1090 /* Output assembler code associated with defining the size of the
1091 function. DECL describes the function. NAME is the function's name. */
1094 assemble_end_function (decl
, fnname
)
1098 #ifdef ASM_DECLARE_FUNCTION_SIZE
1099 ASM_DECLARE_FUNCTION_SIZE (asm_out_file
, fnname
, decl
);
1101 if (! CONSTANT_POOL_BEFORE_FUNCTION
)
1103 output_constant_pool (fnname
, decl
);
1104 function_section (decl
); /* need to switch back */
1107 /* Output any constants which should appear after the function. */
1108 output_after_function_constants ();
1111 /* Assemble code to leave SIZE bytes of zeros. */
1114 assemble_zeros (size
)
1117 /* Do no output if -fsyntax-only. */
1118 if (flag_syntax_only
)
1121 #ifdef ASM_NO_SKIP_IN_TEXT
1122 /* The `space' pseudo in the text section outputs nop insns rather than 0s,
1123 so we must output 0s explicitly in the text section. */
1124 if (ASM_NO_SKIP_IN_TEXT
&& in_text_section ())
1128 for (i
= 0; i
< size
- 20; i
+= 20)
1131 fprintf (asm_out_file
,
1132 "%s0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n", ASM_BYTE_OP
);
1134 fprintf (asm_out_file
,
1135 "\tbyte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n");
1141 fprintf (asm_out_file
, "%s0", ASM_BYTE_OP
);
1143 fprintf (asm_out_file
, "\tbyte 0");
1146 for (; i
< size
; i
++)
1147 fprintf (asm_out_file
, ",0");
1148 fprintf (asm_out_file
, "\n");
1154 ASM_OUTPUT_SKIP (asm_out_file
, size
);
1157 /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
1160 assemble_align (align
)
1163 if (align
> BITS_PER_UNIT
)
1164 ASM_OUTPUT_ALIGN (asm_out_file
, floor_log2 (align
/ BITS_PER_UNIT
));
1167 /* Assemble a string constant with the specified C string as contents. */
1170 assemble_string (p
, size
)
1177 /* If the string is very long, split it up. */
1181 int thissize
= size
- pos
;
1182 if (thissize
> maximum
)
1185 ASM_OUTPUT_ASCII (asm_out_file
, p
, thissize
);
1193 #if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL
1194 #define ASM_EMIT_LOCAL(decl, name, size, rounded) \
1195 ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name, size, DECL_ALIGN (decl))
1197 #if defined ASM_OUTPUT_ALIGNED_LOCAL
1198 #define ASM_EMIT_LOCAL(decl, name, size, rounded) \
1199 ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, DECL_ALIGN (decl))
1201 #define ASM_EMIT_LOCAL(decl, name, size, rounded) \
1202 ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded)
1206 #if defined ASM_OUTPUT_ALIGNED_BSS
1207 #define ASM_EMIT_BSS(decl, name, size, rounded) \
1208 ASM_OUTPUT_ALIGNED_BSS (asm_out_file, decl, name, size, DECL_ALIGN (decl))
1210 #if defined ASM_OUTPUT_BSS
1211 #define ASM_EMIT_BSS(decl, name, size, rounded) \
1212 ASM_OUTPUT_BSS (asm_out_file, decl, name, size, rounded)
1218 #if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
1219 #define ASM_EMIT_COMMON(decl, name, size, rounded) \
1220 ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, decl, name, size, DECL_ALIGN (decl))
1222 #if defined ASM_OUTPUT_ALIGNED_COMMON
1223 #define ASM_EMIT_COMMON(decl, name, size, rounded) \
1224 ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, name, size, DECL_ALIGN (decl))
1226 #define ASM_EMIT_COMMON(decl, name, size, rounded) \
1227 ASM_OUTPUT_COMMON (asm_out_file, name, size, rounded)
1232 asm_emit_uninitialised (decl
, name
, size
, rounded
)
1235 int size ATTRIBUTE_UNUSED
;
1236 int rounded ATTRIBUTE_UNUSED
;
1244 destination
= asm_dest_local
;
1246 if (TREE_PUBLIC (decl
))
1248 #if defined ASM_EMIT_BSS
1249 if (! DECL_COMMON (decl
))
1250 destination
= asm_dest_bss
;
1253 destination
= asm_dest_common
;
1256 if (flag_shared_data
)
1258 switch (destination
)
1260 #ifdef ASM_OUTPUT_SHARED_BSS
1262 ASM_OUTPUT_SHARED_BSS (asm_out_file
, decl
, name
, size
, rounded
);
1265 #ifdef ASM_OUTPUT_SHARED_COMMON
1266 case asm_dest_common
:
1267 ASM_OUTPUT_SHARED_COMMON (asm_out_file
, name
, size
, rounded
);
1270 #ifdef ASM_OUTPUT_SHARED_LOCAL
1271 case asm_dest_local
:
1272 ASM_OUTPUT_SHARED_LOCAL (asm_out_file
, name
, size
, rounded
);
1280 #ifdef ASM_OUTPUT_SECTION_NAME
1281 /* We already know that DECL_SECTION_NAME() == NULL. */
1282 if (flag_data_sections
!= 0 || UNIQUE_SECTION_P (decl
))
1283 UNIQUE_SECTION (decl
, 0);
1286 switch (destination
)
1290 ASM_EMIT_BSS (decl
, name
, size
, rounded
);
1293 case asm_dest_common
:
1294 ASM_EMIT_COMMON (decl
, name
, size
, rounded
);
1296 case asm_dest_local
:
1297 ASM_EMIT_LOCAL (decl
, name
, size
, rounded
);
1306 /* Assemble everything that is needed for a variable or function declaration.
1307 Not used for automatic variables, and not used for function definitions.
1308 Should not be called for variables of incomplete structure type.
1310 TOP_LEVEL is nonzero if this variable has file scope.
1311 AT_END is nonzero if this is the special handling, at end of compilation,
1312 to define things that have had only tentative definitions.
1313 DONT_OUTPUT_DATA if nonzero means don't actually output the
1314 initial value (that will be done by the caller). */
1317 assemble_variable (decl
, top_level
, at_end
, dont_output_data
)
1319 int top_level ATTRIBUTE_UNUSED
;
1320 int at_end ATTRIBUTE_UNUSED
;
1321 int dont_output_data
;
1323 register const char *name
;
1326 enum in_section saved_in_section
;
1328 last_assemble_variable_decl
= 0;
1330 if (GET_CODE (DECL_RTL (decl
)) == REG
)
1332 /* Do output symbol info for global register variables, but do nothing
1335 if (TREE_ASM_WRITTEN (decl
))
1337 TREE_ASM_WRITTEN (decl
) = 1;
1339 /* Do no output if -fsyntax-only. */
1340 if (flag_syntax_only
)
1343 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
1344 /* File-scope global variables are output here. */
1345 if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
1347 dbxout_symbol (decl
, 0);
1349 #ifdef SDB_DEBUGGING_INFO
1350 if (write_symbols
== SDB_DEBUG
&& top_level
1351 /* Leave initialized global vars for end of compilation;
1352 see comment in compile_file. */
1353 && (TREE_PUBLIC (decl
) == 0 || DECL_INITIAL (decl
) == 0))
1354 sdbout_symbol (decl
, 0);
1357 /* Don't output any DWARF debugging information for variables here.
1358 In the case of local variables, the information for them is output
1359 when we do our recursive traversal of the tree representation for
1360 the entire containing function. In the case of file-scope variables,
1361 we output information for all of them at the very end of compilation
1362 while we are doing our final traversal of the chain of file-scope
1368 /* Normally no need to say anything here for external references,
1369 since assemble_external is called by the language-specific code
1370 when a declaration is first seen. */
1372 if (DECL_EXTERNAL (decl
))
1375 /* Output no assembler code for a function declaration.
1376 Only definitions of functions output anything. */
1378 if (TREE_CODE (decl
) == FUNCTION_DECL
)
1381 /* If type was incomplete when the variable was declared,
1382 see if it is complete now. */
1384 if (DECL_SIZE (decl
) == 0)
1385 layout_decl (decl
, 0);
1387 /* Still incomplete => don't allocate it; treat the tentative defn
1388 (which is what it must have been) as an `extern' reference. */
1390 if (!dont_output_data
&& DECL_SIZE (decl
) == 0)
1392 error_with_file_and_line (DECL_SOURCE_FILE (decl
),
1393 DECL_SOURCE_LINE (decl
),
1394 "storage size of `%s' isn't known",
1395 IDENTIFIER_POINTER (DECL_NAME (decl
)));
1396 TREE_ASM_WRITTEN (decl
) = 1;
1400 /* The first declaration of a variable that comes through this function
1401 decides whether it is global (in C, has external linkage)
1402 or local (in C, has internal linkage). So do nothing more
1403 if this function has already run. */
1405 if (TREE_ASM_WRITTEN (decl
))
1408 TREE_ASM_WRITTEN (decl
) = 1;
1410 /* Do no output if -fsyntax-only. */
1411 if (flag_syntax_only
)
1416 if (! dont_output_data
1417 && ! host_integerp (DECL_SIZE_UNIT (decl
), 1))
1419 error_with_decl (decl
, "size of variable `%s' is too large");
1423 name
= XSTR (XEXP (DECL_RTL (decl
), 0), 0);
1424 if (TREE_PUBLIC (decl
) && DECL_NAME (decl
)
1425 && ! first_global_object_name
1426 && ! (DECL_COMMON (decl
) && (DECL_INITIAL (decl
) == 0
1427 || DECL_INITIAL (decl
) == error_mark_node
))
1428 && ! DECL_WEAK (decl
)
1429 && ! DECL_ONE_ONLY (decl
))
1434 STRIP_NAME_ENCODING (p
, name
);
1435 xname
= permalloc (strlen (p
) + 1);
1437 first_global_object_name
= xname
;
1440 /* Compute the alignment of this data. */
1442 align
= DECL_ALIGN (decl
);
1444 /* In the case for initialing an array whose length isn't specified,
1445 where we have not yet been able to do the layout,
1446 figure out the proper alignment now. */
1447 if (dont_output_data
&& DECL_SIZE (decl
) == 0
1448 && TREE_CODE (TREE_TYPE (decl
)) == ARRAY_TYPE
)
1449 align
= MAX (align
, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl
))));
1451 /* Some object file formats have a maximum alignment which they support.
1452 In particular, a.out format supports a maximum alignment of 4. */
1453 #ifndef MAX_OFILE_ALIGNMENT
1454 #define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT
1456 if (align
> MAX_OFILE_ALIGNMENT
)
1458 warning_with_decl (decl
,
1459 "alignment of `%s' is greater than maximum object file alignment. Using %d.",
1460 MAX_OFILE_ALIGNMENT
/BITS_PER_UNIT
);
1461 align
= MAX_OFILE_ALIGNMENT
;
1464 /* On some machines, it is good to increase alignment sometimes. */
1465 #ifdef DATA_ALIGNMENT
1466 align
= DATA_ALIGNMENT (TREE_TYPE (decl
), align
);
1468 #ifdef CONSTANT_ALIGNMENT
1469 if (DECL_INITIAL (decl
) != 0 && DECL_INITIAL (decl
) != error_mark_node
)
1470 align
= CONSTANT_ALIGNMENT (DECL_INITIAL (decl
), align
);
1473 /* Reset the alignment in case we have made it tighter, so we can benefit
1474 from it in get_pointer_alignment. */
1475 DECL_ALIGN (decl
) = align
;
1477 /* Handle uninitialized definitions. */
1479 if ((DECL_INITIAL (decl
) == 0 || DECL_INITIAL (decl
) == error_mark_node
)
1480 /* If the target can't output uninitialized but not common global data
1481 in .bss, then we have to use .data. */
1482 #if ! defined ASM_EMIT_BSS
1483 && DECL_COMMON (decl
)
1485 && DECL_SECTION_NAME (decl
) == NULL_TREE
1486 && ! dont_output_data
)
1488 unsigned HOST_WIDE_INT size
= tree_low_cst (DECL_SIZE_UNIT (decl
), 1);
1489 unsigned HOST_WIDE_INT rounded
= size
;
1491 /* Don't allocate zero bytes of common,
1492 since that means "undefined external" in the linker. */
1496 /* Round size up to multiple of BIGGEST_ALIGNMENT bits
1497 so that each uninitialized object starts on such a boundary. */
1498 rounded
+= (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
) - 1;
1499 rounded
= (rounded
/ (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
)
1500 * (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
));
1502 /* Don't continue this line--convex cc version 4.1 would lose. */
1503 #if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_DECL_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
1504 if ((unsigned HOST_WIDE_INT
) DECL_ALIGN (decl
) / BITS_PER_UNIT
> rounded
)
1506 (decl
, "requested alignment for %s is greater than implemented alignment of %d.",rounded
);
1509 #ifdef DBX_DEBUGGING_INFO
1510 /* File-scope global variables are output here. */
1511 if (write_symbols
== DBX_DEBUG
&& top_level
)
1512 dbxout_symbol (decl
, 0);
1514 #ifdef SDB_DEBUGGING_INFO
1515 if (write_symbols
== SDB_DEBUG
&& top_level
1516 /* Leave initialized global vars for end of compilation;
1517 see comment in compile_file. */
1518 && (TREE_PUBLIC (decl
) == 0 || DECL_INITIAL (decl
) == 0))
1519 sdbout_symbol (decl
, 0);
1522 /* Don't output any DWARF debugging information for variables here.
1523 In the case of local variables, the information for them is output
1524 when we do our recursive traversal of the tree representation for
1525 the entire containing function. In the case of file-scope variables,
1526 we output information for all of them at the very end of compilation
1527 while we are doing our final traversal of the chain of file-scope
1530 #if 0 /* ??? We should either delete this or add a comment describing what
1531 it was intended to do and why we shouldn't delete it. */
1532 if (flag_shared_data
)
1535 asm_emit_uninitialised (decl
, name
, size
, rounded
);
1540 /* Handle initialized definitions.
1541 Also handle uninitialized global definitions if -fno-common and the
1542 target doesn't support ASM_OUTPUT_BSS. */
1544 /* First make the assembler name(s) global if appropriate. */
1545 if (TREE_PUBLIC (decl
) && DECL_NAME (decl
))
1547 #ifdef ASM_WEAKEN_LABEL
1548 if (DECL_WEAK (decl
))
1550 ASM_WEAKEN_LABEL (asm_out_file
, name
);
1551 /* Remove this variable from the pending weak list so that
1552 we do not emit multiple .weak directives for it. */
1553 remove_from_pending_weak_list
1554 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
1558 ASM_GLOBALIZE_LABEL (asm_out_file
, name
);
1561 for (d
= equivalents
; d
; d
= TREE_CHAIN (d
))
1563 tree e
= TREE_VALUE (d
);
1564 if (TREE_PUBLIC (e
) && DECL_NAME (e
))
1565 ASM_GLOBALIZE_LABEL (asm_out_file
,
1566 XSTR (XEXP (DECL_RTL (e
), 0), 0));
1570 /* Output any data that we will need to use the address of. */
1571 if (DECL_INITIAL (decl
) == error_mark_node
)
1572 reloc
= contains_pointers_p (TREE_TYPE (decl
));
1573 else if (DECL_INITIAL (decl
))
1574 reloc
= output_addressed_constants (DECL_INITIAL (decl
));
1576 #ifdef ASM_OUTPUT_SECTION_NAME
1577 if ((flag_data_sections
!= 0 && DECL_SECTION_NAME (decl
) == NULL_TREE
)
1578 || UNIQUE_SECTION_P (decl
))
1579 UNIQUE_SECTION (decl
, reloc
);
1582 /* Switch to the appropriate section. */
1583 variable_section (decl
, reloc
);
1585 /* dbxout.c needs to know this. */
1586 if (in_text_section ())
1587 DECL_IN_TEXT_SECTION (decl
) = 1;
1589 /* Record current section so we can restore it if dbxout.c clobbers it. */
1590 saved_in_section
= in_section
;
1592 /* Output the dbx info now that we have chosen the section. */
1594 #ifdef DBX_DEBUGGING_INFO
1595 /* File-scope global variables are output here. */
1596 if (write_symbols
== DBX_DEBUG
&& top_level
)
1597 dbxout_symbol (decl
, 0);
1599 #ifdef SDB_DEBUGGING_INFO
1600 if (write_symbols
== SDB_DEBUG
&& top_level
1601 /* Leave initialized global vars for end of compilation;
1602 see comment in compile_file. */
1603 && (TREE_PUBLIC (decl
) == 0 || DECL_INITIAL (decl
) == 0))
1604 sdbout_symbol (decl
, 0);
1607 /* Don't output any DWARF debugging information for variables here.
1608 In the case of local variables, the information for them is output
1609 when we do our recursive traversal of the tree representation for
1610 the entire containing function. In the case of file-scope variables,
1611 we output information for all of them at the very end of compilation
1612 while we are doing our final traversal of the chain of file-scope
1615 /* If the debugging output changed sections, reselect the section
1616 that's supposed to be selected. */
1617 if (in_section
!= saved_in_section
)
1618 variable_section (decl
, reloc
);
1620 /* Output the alignment of this data. */
1621 if (align
> BITS_PER_UNIT
)
1622 ASM_OUTPUT_ALIGN (asm_out_file
,
1623 floor_log2 (DECL_ALIGN (decl
) / BITS_PER_UNIT
));
1625 /* Do any machine/system dependent processing of the object. */
1626 #ifdef ASM_DECLARE_OBJECT_NAME
1627 last_assemble_variable_decl
= decl
;
1628 ASM_DECLARE_OBJECT_NAME (asm_out_file
, name
, decl
);
1630 /* Standard thing is just output label for the object. */
1631 ASM_OUTPUT_LABEL (asm_out_file
, name
);
1632 #endif /* ASM_DECLARE_OBJECT_NAME */
1634 if (!dont_output_data
)
1636 if (DECL_INITIAL (decl
))
1637 /* Output the actual data. */
1638 output_constant (DECL_INITIAL (decl
),
1639 tree_low_cst (DECL_SIZE_UNIT (decl
), 1));
1641 /* Leave space for it. */
1642 assemble_zeros (tree_low_cst (DECL_SIZE_UNIT (decl
), 1));
1646 #ifdef XCOFF_DEBUGGING_INFO
1647 /* Unfortunately, the IBM assembler cannot handle stabx before the actual
1648 declaration. When something like ".stabx "aa:S-2",aa,133,0" is emitted
1649 and `aa' hasn't been output yet, the assembler generates a stab entry with
1650 a value of zero, in addition to creating an unnecessary external entry
1651 for `aa'. Hence, we must postpone dbxout_symbol to here at the end. */
1653 /* File-scope global variables are output here. */
1654 if (write_symbols
== XCOFF_DEBUG
&& top_level
)
1656 saved_in_section
= in_section
;
1658 dbxout_symbol (decl
, 0);
1660 if (in_section
!= saved_in_section
)
1661 variable_section (decl
, reloc
);
1664 /* There must be a statement after a label. */
1669 /* Return 1 if type TYPE contains any pointers. */
1672 contains_pointers_p (type
)
1675 switch (TREE_CODE (type
))
1678 case REFERENCE_TYPE
:
1679 /* I'm not sure whether OFFSET_TYPE needs this treatment,
1680 so I'll play safe and return 1. */
1686 case QUAL_UNION_TYPE
:
1689 /* For a type that has fields, see if the fields have pointers. */
1690 for (fields
= TYPE_FIELDS (type
); fields
; fields
= TREE_CHAIN (fields
))
1691 if (TREE_CODE (fields
) == FIELD_DECL
1692 && contains_pointers_p (TREE_TYPE (fields
)))
1698 /* An array type contains pointers if its element type does. */
1699 return contains_pointers_p (TREE_TYPE (type
));
1706 /* Output something to declare an external symbol to the assembler.
1707 (Most assemblers don't need this, so we normally output nothing.)
1708 Do nothing if DECL is not external. */
1711 assemble_external (decl
)
1712 tree decl ATTRIBUTE_UNUSED
;
1714 #ifdef ASM_OUTPUT_EXTERNAL
1715 if (DECL_P (decl
) && DECL_EXTERNAL (decl
) && TREE_PUBLIC (decl
))
1717 rtx rtl
= DECL_RTL (decl
);
1719 if (GET_CODE (rtl
) == MEM
&& GET_CODE (XEXP (rtl
, 0)) == SYMBOL_REF
1720 && ! SYMBOL_REF_USED (XEXP (rtl
, 0)))
1722 /* Some systems do require some output. */
1723 SYMBOL_REF_USED (XEXP (rtl
, 0)) = 1;
1724 ASM_OUTPUT_EXTERNAL (asm_out_file
, decl
, XSTR (XEXP (rtl
, 0), 0));
1730 /* Similar, for calling a library function FUN. */
1733 assemble_external_libcall (fun
)
1734 rtx fun ATTRIBUTE_UNUSED
;
1736 #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
1737 /* Declare library function name external when first used, if nec. */
1738 if (! SYMBOL_REF_USED (fun
))
1740 SYMBOL_REF_USED (fun
) = 1;
1741 ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file
, fun
);
1746 /* Declare the label NAME global. */
1749 assemble_global (name
)
1752 ASM_GLOBALIZE_LABEL (asm_out_file
, name
);
1755 /* Assemble a label named NAME. */
1758 assemble_label (name
)
1761 ASM_OUTPUT_LABEL (asm_out_file
, name
);
1764 /* Output to FILE a reference to the assembler name of a C-level name NAME.
1765 If NAME starts with a *, the rest of NAME is output verbatim.
1766 Otherwise NAME is transformed in an implementation-defined way
1767 (usually by the addition of an underscore).
1768 Many macros in the tm file are defined to call this function. */
1771 assemble_name (file
, name
)
1775 const char *real_name
;
1778 STRIP_NAME_ENCODING (real_name
, name
);
1779 if (flag_prefix_function_name
1780 && ! memcmp (real_name
, CHKR_PREFIX
, CHKR_PREFIX_SIZE
))
1781 real_name
= real_name
+ CHKR_PREFIX_SIZE
;
1783 id
= maybe_get_identifier (real_name
);
1785 TREE_SYMBOL_REFERENCED (id
) = 1;
1788 fputs (&name
[1], file
);
1790 ASM_OUTPUT_LABELREF (file
, name
);
1793 /* Allocate SIZE bytes writable static space with a gensym name
1794 and return an RTX to refer to its address. */
1797 assemble_static_space (size
)
1801 const char *namestring
;
1805 if (flag_shared_data
)
1809 ASM_GENERATE_INTERNAL_LABEL (name
, "LF", const_labelno
);
1811 namestring
= ggc_alloc_string (name
, -1);
1813 x
= gen_rtx_SYMBOL_REF (Pmode
, namestring
);
1815 #ifdef ASM_OUTPUT_ALIGNED_DECL_LOCAL
1816 ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file
, NULL_TREE
, name
, size
,
1819 #ifdef ASM_OUTPUT_ALIGNED_LOCAL
1820 ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file
, name
, size
, BIGGEST_ALIGNMENT
);
1823 /* Round size up to multiple of BIGGEST_ALIGNMENT bits
1824 so that each uninitialized object starts on such a boundary. */
1825 /* Variable `rounded' might or might not be used in ASM_OUTPUT_LOCAL. */
1826 int rounded ATTRIBUTE_UNUSED
1827 = ((size
+ (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
) - 1)
1828 / (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
)
1829 * (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
));
1830 ASM_OUTPUT_LOCAL (asm_out_file
, name
, size
, rounded
);
1837 /* Assemble the static constant template for function entry trampolines.
1838 This is done at most once per compilation.
1839 Returns an RTX for the address of the template. */
1841 #ifdef TRAMPOLINE_TEMPLATE
1843 assemble_trampoline_template ()
1849 /* By default, put trampoline templates in read-only data section. */
1851 #ifdef TRAMPOLINE_SECTION
1852 TRAMPOLINE_SECTION ();
1854 readonly_data_section ();
1857 /* Write the assembler code to define one. */
1858 align
= floor_log2 (TRAMPOLINE_ALIGNMENT
/ BITS_PER_UNIT
);
1860 ASM_OUTPUT_ALIGN (asm_out_file
, align
);
1862 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file
, "LTRAMP", 0);
1863 TRAMPOLINE_TEMPLATE (asm_out_file
);
1865 /* Record the rtl to refer to it. */
1866 ASM_GENERATE_INTERNAL_LABEL (label
, "LTRAMP", 0);
1867 name
= ggc_alloc_string (label
, -1);
1868 return gen_rtx_SYMBOL_REF (Pmode
, name
);
1872 /* Assemble the integer constant X into an object of SIZE bytes.
1873 X must be either a CONST_INT or CONST_DOUBLE.
1875 Return 1 if we were able to output the constant, otherwise 0. If FORCE is
1876 non-zero, abort if we can't output the constant. */
1879 assemble_integer (x
, size
, force
)
1884 /* First try to use the standard 1, 2, 4, 8, and 16 byte
1885 ASM_OUTPUT... macros. */
1889 #ifdef ASM_OUTPUT_CHAR
1891 ASM_OUTPUT_CHAR (asm_out_file
, x
);
1895 #ifdef ASM_OUTPUT_SHORT
1897 ASM_OUTPUT_SHORT (asm_out_file
, x
);
1901 #ifdef ASM_OUTPUT_INT
1903 ASM_OUTPUT_INT (asm_out_file
, x
);
1907 #ifdef ASM_OUTPUT_DOUBLE_INT
1909 ASM_OUTPUT_DOUBLE_INT (asm_out_file
, x
);
1913 #ifdef ASM_OUTPUT_QUADRUPLE_INT
1915 ASM_OUTPUT_QUADRUPLE_INT (asm_out_file
, x
);
1920 /* If we couldn't do it that way, there are two other possibilities: First,
1921 if the machine can output an explicit byte and this is a 1 byte constant,
1922 we can use ASM_OUTPUT_BYTE. */
1924 #ifdef ASM_OUTPUT_BYTE
1925 if (size
== 1 && GET_CODE (x
) == CONST_INT
)
1927 ASM_OUTPUT_BYTE (asm_out_file
, INTVAL (x
));
1932 /* Finally, if SIZE is larger than a single word, try to output the constant
1933 one word at a time. */
1935 if (size
> UNITS_PER_WORD
)
1938 enum machine_mode mode
1939 = mode_for_size (size
* BITS_PER_UNIT
, MODE_INT
, 0);
1942 for (i
= 0; i
< size
/ UNITS_PER_WORD
; i
++)
1944 word
= operand_subword (x
, i
, 0, mode
);
1949 if (! assemble_integer (word
, UNITS_PER_WORD
, 0))
1953 if (i
== size
/ UNITS_PER_WORD
)
1955 /* If we output at least one word and then could not finish,
1956 there is no valid way to continue. */
1967 /* Assemble the floating-point constant D into an object of size MODE. */
1970 assemble_real (d
, mode
)
1972 enum machine_mode mode
;
1974 jmp_buf output_constant_handler
;
1976 if (setjmp (output_constant_handler
))
1978 error ("floating point trap outputting a constant");
1979 #ifdef REAL_IS_NOT_DOUBLE
1980 memset ((char *) &d
, 0, sizeof d
);
1987 set_float_handler (output_constant_handler
);
1991 #ifdef ASM_OUTPUT_BYTE_FLOAT
1993 ASM_OUTPUT_BYTE_FLOAT (asm_out_file
, d
);
1996 #ifdef ASM_OUTPUT_SHORT_FLOAT
1998 ASM_OUTPUT_SHORT_FLOAT (asm_out_file
, d
);
2001 #ifdef ASM_OUTPUT_THREE_QUARTER_FLOAT
2003 ASM_OUTPUT_THREE_QUARTER_FLOAT (asm_out_file
, d
);
2006 #ifdef ASM_OUTPUT_FLOAT
2008 ASM_OUTPUT_FLOAT (asm_out_file
, d
);
2012 #ifdef ASM_OUTPUT_DOUBLE
2014 ASM_OUTPUT_DOUBLE (asm_out_file
, d
);
2018 #ifdef ASM_OUTPUT_LONG_DOUBLE
2021 ASM_OUTPUT_LONG_DOUBLE (asm_out_file
, d
);
2029 set_float_handler (NULL_PTR
);
2032 /* Here we combine duplicate floating constants to make
2033 CONST_DOUBLE rtx's, and force those out to memory when necessary. */
2035 /* Return a CONST_DOUBLE or CONST_INT for a value specified as a pair of ints.
2036 For an integer, I0 is the low-order word and I1 is the high-order word.
2037 For a real number, I0 is the word with the low address
2038 and I1 is the word with the high address. */
2041 immed_double_const (i0
, i1
, mode
)
2042 HOST_WIDE_INT i0
, i1
;
2043 enum machine_mode mode
;
2047 if (GET_MODE_CLASS (mode
) == MODE_INT
2048 || GET_MODE_CLASS (mode
) == MODE_PARTIAL_INT
)
2050 /* We clear out all bits that don't belong in MODE, unless they and our
2051 sign bit are all one. So we get either a reasonable negative value
2052 or a reasonable unsigned value for this mode. */
2053 int width
= GET_MODE_BITSIZE (mode
);
2054 if (width
< HOST_BITS_PER_WIDE_INT
2055 && ((i0
& ((HOST_WIDE_INT
) (-1) << (width
- 1)))
2056 != ((HOST_WIDE_INT
) (-1) << (width
- 1))))
2057 i0
&= ((HOST_WIDE_INT
) 1 << width
) - 1, i1
= 0;
2058 else if (width
== HOST_BITS_PER_WIDE_INT
2059 && ! (i1
== ~0 && i0
< 0))
2061 else if (width
> 2 * HOST_BITS_PER_WIDE_INT
)
2062 /* We cannot represent this value as a constant. */
2065 /* If this would be an entire word for the target, but is not for
2066 the host, then sign-extend on the host so that the number will look
2067 the same way on the host that it would on the target.
2069 For example, when building a 64 bit alpha hosted 32 bit sparc
2070 targeted compiler, then we want the 32 bit unsigned value -1 to be
2071 represented as a 64 bit value -1, and not as 0x00000000ffffffff.
2072 The later confuses the sparc backend. */
2074 if (BITS_PER_WORD
< HOST_BITS_PER_WIDE_INT
&& BITS_PER_WORD
== width
2075 && (i0
& ((HOST_WIDE_INT
) 1 << (width
- 1))))
2076 i0
|= ((HOST_WIDE_INT
) (-1) << width
);
2078 /* If MODE fits within HOST_BITS_PER_WIDE_INT, always use a CONST_INT.
2080 ??? Strictly speaking, this is wrong if we create a CONST_INT
2081 for a large unsigned constant with the size of MODE being
2082 HOST_BITS_PER_WIDE_INT and later try to interpret that constant in a
2083 wider mode. In that case we will mis-interpret it as a negative
2086 Unfortunately, the only alternative is to make a CONST_DOUBLE
2087 for any constant in any mode if it is an unsigned constant larger
2088 than the maximum signed integer in an int on the host. However,
2089 doing this will break everyone that always expects to see a CONST_INT
2090 for SImode and smaller.
2092 We have always been making CONST_INTs in this case, so nothing new
2095 if (width
<= HOST_BITS_PER_WIDE_INT
)
2096 i1
= (i0
< 0) ? ~(HOST_WIDE_INT
) 0 : 0;
2098 /* If this integer fits in one word, return a CONST_INT. */
2099 if ((i1
== 0 && i0
>= 0)
2100 || (i1
== ~0 && i0
< 0))
2101 return GEN_INT (i0
);
2103 /* We use VOIDmode for integers. */
2107 /* Search the chain for an existing CONST_DOUBLE with the right value.
2108 If one is found, return it. */
2110 for (r
= const_double_chain
; r
; r
= CONST_DOUBLE_CHAIN (r
))
2111 if (CONST_DOUBLE_LOW (r
) == i0
&& CONST_DOUBLE_HIGH (r
) == i1
2112 && GET_MODE (r
) == mode
)
2115 /* No; make a new one and add it to the chain. */
2116 r
= gen_rtx_CONST_DOUBLE (mode
, const0_rtx
, i0
, i1
);
2118 /* Don't touch const_double_chain if not inside any function. */
2119 if (current_function_decl
!= 0)
2121 CONST_DOUBLE_CHAIN (r
) = const_double_chain
;
2122 const_double_chain
= r
;
2128 /* Return a CONST_DOUBLE for a specified `double' value
2129 and machine mode. */
2132 immed_real_const_1 (d
, mode
)
2134 enum machine_mode mode
;
2136 union real_extract u
;
2139 /* Get the desired `double' value as a sequence of ints
2140 since that is how they are stored in a CONST_DOUBLE. */
2144 /* Detect special cases. But be careful we don't use a CONST_DOUBLE
2145 that's from a parent function since it may be in its constant pool. */
2146 if (REAL_VALUES_IDENTICAL (dconst0
, d
)
2147 && (cfun
== 0 || decl_function_context (current_function_decl
) == 0))
2148 return CONST0_RTX (mode
);
2150 /* Check for NaN first, because some ports (specifically the i386) do not
2151 emit correct ieee-fp code by default, and thus will generate a core
2152 dump here if we pass a NaN to REAL_VALUES_EQUAL and if REAL_VALUES_EQUAL
2153 does a floating point comparison. */
2154 else if ((! REAL_VALUE_ISNAN (d
) && REAL_VALUES_EQUAL (dconst1
, d
))
2156 || decl_function_context (current_function_decl
) == 0))
2157 return CONST1_RTX (mode
);
2159 if (sizeof u
== sizeof (HOST_WIDE_INT
))
2160 return immed_double_const (u
.i
[0], 0, mode
);
2161 if (sizeof u
== 2 * sizeof (HOST_WIDE_INT
))
2162 return immed_double_const (u
.i
[0], u
.i
[1], mode
);
2164 /* The rest of this function handles the case where
2165 a float value requires more than 2 ints of space.
2166 It will be deleted as dead code on machines that don't need it. */
2168 /* Search the chain for an existing CONST_DOUBLE with the right value.
2169 If one is found, return it. */
2171 for (r
= const_double_chain
; r
; r
= CONST_DOUBLE_CHAIN (r
))
2172 if (! memcmp ((char *) &CONST_DOUBLE_LOW (r
), (char *) &u
, sizeof u
)
2173 && GET_MODE (r
) == mode
)
2176 /* No; make a new one and add it to the chain.
2178 We may be called by an optimizer which may be discarding any memory
2179 allocated during its processing (such as combine and loop). However,
2180 we will be leaving this constant on the chain, so we cannot tolerate
2182 r
= rtx_alloc (CONST_DOUBLE
);
2184 memcpy ((char *) &CONST_DOUBLE_LOW (r
), (char *) &u
, sizeof u
);
2186 /* If we aren't inside a function, don't put r on the
2187 const_double_chain. */
2188 if (current_function_decl
!= 0)
2190 CONST_DOUBLE_CHAIN (r
) = const_double_chain
;
2191 const_double_chain
= r
;
2194 CONST_DOUBLE_CHAIN (r
) = NULL_RTX
;
2196 /* Store const0_rtx in CONST_DOUBLE_MEM since this CONST_DOUBLE is on the
2197 chain, but has not been allocated memory. Actual use of CONST_DOUBLE_MEM
2198 is only through force_const_mem. */
2200 CONST_DOUBLE_MEM (r
) = const0_rtx
;
2205 /* Return a CONST_DOUBLE rtx for a value specified by EXP,
2206 which must be a REAL_CST tree node. */
2209 immed_real_const (exp
)
2212 return immed_real_const_1 (TREE_REAL_CST (exp
), TYPE_MODE (TREE_TYPE (exp
)));
2215 /* At the end of a function, forget the memory-constants
2216 previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain.
2217 Also clear out real_constant_chain and clear out all the chain-pointers. */
2220 clear_const_double_mem ()
2222 register rtx r
, next
;
2224 for (r
= const_double_chain
; r
; r
= next
)
2226 next
= CONST_DOUBLE_CHAIN (r
);
2227 CONST_DOUBLE_CHAIN (r
) = 0;
2228 CONST_DOUBLE_MEM (r
) = cc0_rtx
;
2230 const_double_chain
= 0;
2233 /* Given an expression EXP with a constant value,
2234 reduce it to the sum of an assembler symbol and an integer.
2235 Store them both in the structure *VALUE.
2236 Abort if EXP does not reduce. */
2241 HOST_WIDE_INT offset
;
2245 decode_addr_const (exp
, value
)
2247 struct addr_const
*value
;
2249 register tree target
= TREE_OPERAND (exp
, 0);
2250 register int offset
= 0;
2255 if (TREE_CODE (target
) == COMPONENT_REF
2256 && host_integerp (byte_position (TREE_OPERAND (target
, 1)), 0))
2259 offset
+= int_byte_position (TREE_OPERAND (target
, 1));
2260 target
= TREE_OPERAND (target
, 0);
2262 else if (TREE_CODE (target
) == ARRAY_REF
)
2264 offset
+= (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (target
)), 1)
2265 * tree_low_cst (TREE_OPERAND (target
, 1), 0));
2266 target
= TREE_OPERAND (target
, 0);
2272 switch (TREE_CODE (target
))
2276 x
= DECL_RTL (target
);
2280 x
= gen_rtx_MEM (FUNCTION_MODE
,
2281 gen_rtx_LABEL_REF (VOIDmode
,
2282 label_rtx (TREE_OPERAND (exp
, 0))));
2290 x
= TREE_CST_RTL (target
);
2297 if (GET_CODE (x
) != MEM
)
2302 value
->offset
= offset
;
2307 #ifdef ONLY_INT_FIELDS
2308 unsigned int kind
: 16;
2309 unsigned int mode
: 16;
2311 enum kind kind
: 16;
2312 enum machine_mode mode
: 16;
2315 union real_extract du
;
2316 struct addr_const addr
;
2317 struct {HOST_WIDE_INT high
, low
;} di
;
2321 /* Uniquize all constants that appear in memory.
2322 Each constant in memory thus far output is recorded
2323 in `const_hash_table' with a `struct constant_descriptor'
2324 that contains a polish representation of the value of
2327 We cannot store the trees in the hash table
2328 because the trees may be temporary. */
2330 struct constant_descriptor
2332 struct constant_descriptor
*next
;
2335 /* Make sure the data is reasonably aligned. */
2338 unsigned char contents
[1];
2339 #ifdef HAVE_LONG_DOUBLE
2348 #define MAX_HASH_TABLE 1009
2349 static struct constant_descriptor
*const_hash_table
[MAX_HASH_TABLE
];
2351 #define STRHASH(x) ((hashval_t)((long)(x) >> 3))
2353 struct deferred_string
2360 static htab_t const_str_htab
;
2362 /* Mark a const_hash_table descriptor for GC. */
2365 mark_const_hash_entry (ptr
)
2368 struct constant_descriptor
*desc
= * (struct constant_descriptor
**) ptr
;
2372 ggc_mark_string ((const char *)desc
->label
);
2373 ggc_mark_rtx (desc
->rtl
);
2378 /* Mark the hash-table element X (which is really a pointer to an
2379 struct deferred_string *). */
2382 mark_const_str_htab_1 (x
, data
)
2384 void *data ATTRIBUTE_UNUSED
;
2386 ggc_mark_tree (((struct deferred_string
*) *x
)->exp
);
2390 /* Mark a const_str_htab for GC. */
2393 mark_const_str_htab (htab
)
2396 htab_traverse (*((htab_t
*) htab
), mark_const_str_htab_1
, NULL
);
2399 /* Returns a hash code for X (which is a really a
2400 struct deferred_string *). */
2403 const_str_htab_hash (x
)
2406 return STRHASH (((struct deferred_string
*) x
)->label
);
2409 /* Returns non-zero if the value represented by X (which is really a
2410 struct deferred_string *) is the same as that given by Y
2411 (which is really a char *). */
2414 const_str_htab_eq (x
, y
)
2418 return (((struct deferred_string
*) x
)->label
== (char *) y
);
2421 /* Delete the hash table entry dfsp. */
2424 const_str_htab_del (dfsp
)
2430 /* Compute a hash code for a constant expression. */
2436 register const char *p
;
2437 register int len
, hi
, i
;
2438 register enum tree_code code
= TREE_CODE (exp
);
2440 /* Either set P and LEN to the address and len of something to hash and
2441 exit the switch or return a value. */
2446 p
= (char *) &TREE_INT_CST (exp
);
2447 len
= sizeof TREE_INT_CST (exp
);
2451 p
= (char *) &TREE_REAL_CST (exp
);
2452 len
= sizeof TREE_REAL_CST (exp
);
2456 p
= TREE_STRING_POINTER (exp
);
2457 len
= TREE_STRING_LENGTH (exp
);
2461 return (const_hash (TREE_REALPART (exp
)) * 5
2462 + const_hash (TREE_IMAGPART (exp
)));
2465 if (TREE_CODE (TREE_TYPE (exp
)) == SET_TYPE
)
2469 len
= int_size_in_bytes (TREE_TYPE (exp
));
2470 tmp
= (char *) alloca (len
);
2471 get_set_constructor_bytes (exp
, (unsigned char *) tmp
, len
);
2479 /* For record type, include the type in the hashing.
2480 We do not do so for array types
2481 because (1) the sizes of the elements are sufficient
2482 and (2) distinct array types can have the same constructor.
2483 Instead, we include the array size because the constructor could
2485 if (TREE_CODE (TREE_TYPE (exp
)) == RECORD_TYPE
)
2486 hi
= ((unsigned long) TREE_TYPE (exp
) & ((1 << HASHBITS
) - 1))
2489 hi
= ((5 + int_size_in_bytes (TREE_TYPE (exp
)))
2490 & ((1 << HASHBITS
) - 1)) % MAX_HASH_TABLE
;
2492 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
2493 if (TREE_VALUE (link
))
2495 = (hi
* 603 + const_hash (TREE_VALUE (link
))) % MAX_HASH_TABLE
;
2502 struct addr_const value
;
2504 decode_addr_const (exp
, &value
);
2505 if (GET_CODE (value
.base
) == SYMBOL_REF
)
2507 /* Don't hash the address of the SYMBOL_REF;
2508 only use the offset and the symbol name. */
2510 p
= XSTR (value
.base
, 0);
2511 for (i
= 0; p
[i
] != 0; i
++)
2512 hi
= ((hi
* 613) + (unsigned) (p
[i
]));
2514 else if (GET_CODE (value
.base
) == LABEL_REF
)
2515 hi
= value
.offset
+ CODE_LABEL_NUMBER (XEXP (value
.base
, 0)) * 13;
2519 hi
&= (1 << HASHBITS
) - 1;
2520 hi
%= MAX_HASH_TABLE
;
2526 return (const_hash (TREE_OPERAND (exp
, 0)) * 9
2527 + const_hash (TREE_OPERAND (exp
, 1)));
2531 case NON_LVALUE_EXPR
:
2532 return const_hash (TREE_OPERAND (exp
, 0)) * 7 + 2;
2535 /* A language specific constant. Just hash the code. */
2536 return code
% MAX_HASH_TABLE
;
2539 /* Compute hashing function */
2541 for (i
= 0; i
< len
; i
++)
2542 hi
= ((hi
* 613) + (unsigned) (p
[i
]));
2544 hi
&= (1 << HASHBITS
) - 1;
2545 hi
%= MAX_HASH_TABLE
;
2549 /* Compare a constant expression EXP with a constant-descriptor DESC.
2550 Return 1 if DESC describes a constant with the same value as EXP. */
2553 compare_constant (exp
, desc
)
2555 struct constant_descriptor
*desc
;
2557 return 0 != compare_constant_1 (exp
, desc
->u
.contents
);
2560 /* Compare constant expression EXP with a substring P of a constant descriptor.
2561 If they match, return a pointer to the end of the substring matched.
2562 If they do not match, return 0.
2564 Since descriptors are written in polish prefix notation,
2565 this function can be used recursively to test one operand of EXP
2566 against a subdescriptor, and if it succeeds it returns the
2567 address of the subdescriptor for the next operand. */
2569 static const unsigned char *
2570 compare_constant_1 (exp
, p
)
2572 const unsigned char *p
;
2574 register const unsigned char *strp
;
2576 register enum tree_code code
= TREE_CODE (exp
);
2578 if (code
!= (enum tree_code
) *p
++)
2581 /* Either set STRP, P and LEN to pointers and length to compare and exit the
2582 switch, or return the result of the comparison. */
2587 /* Integer constants are the same only if the same width of type. */
2588 if (*p
++ != TYPE_PRECISION (TREE_TYPE (exp
)))
2591 strp
= (unsigned char *) &TREE_INT_CST (exp
);
2592 len
= sizeof TREE_INT_CST (exp
);
2596 /* Real constants are the same only if the same width of type. */
2597 if (*p
++ != TYPE_PRECISION (TREE_TYPE (exp
)))
2600 strp
= (unsigned char *) &TREE_REAL_CST (exp
);
2601 len
= sizeof TREE_REAL_CST (exp
);
2605 if (flag_writable_strings
)
2608 if ((enum machine_mode
) *p
++ != TYPE_MODE (TREE_TYPE (exp
)))
2611 strp
= (unsigned char *)TREE_STRING_POINTER (exp
);
2612 len
= TREE_STRING_LENGTH (exp
);
2613 if (memcmp ((char *) &TREE_STRING_LENGTH (exp
), p
,
2614 sizeof TREE_STRING_LENGTH (exp
)))
2617 p
+= sizeof TREE_STRING_LENGTH (exp
);
2621 p
= compare_constant_1 (TREE_REALPART (exp
), p
);
2625 return compare_constant_1 (TREE_IMAGPART (exp
), p
);
2628 if (TREE_CODE (TREE_TYPE (exp
)) == SET_TYPE
)
2630 int xlen
= len
= int_size_in_bytes (TREE_TYPE (exp
));
2631 unsigned char *tmp
= (unsigned char *) alloca (len
);
2633 get_set_constructor_bytes (exp
, tmp
, len
);
2634 strp
= (unsigned char *) tmp
;
2635 if (memcmp ((char *) &xlen
, p
, sizeof xlen
))
2644 int length
= list_length (CONSTRUCTOR_ELTS (exp
));
2646 enum machine_mode mode
= TYPE_MODE (TREE_TYPE (exp
));
2647 int have_purpose
= 0;
2649 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
2650 if (TREE_PURPOSE (link
))
2653 if (memcmp ((char *) &length
, p
, sizeof length
))
2658 /* For record constructors, insist that the types match.
2659 For arrays, just verify both constructors are for arrays.
2660 Then insist that either both or none have any TREE_PURPOSE
2662 if (TREE_CODE (TREE_TYPE (exp
)) == RECORD_TYPE
)
2663 type
= TREE_TYPE (exp
);
2667 if (memcmp ((char *) &type
, p
, sizeof type
))
2670 if (TREE_CODE (TREE_TYPE (exp
)) == ARRAY_TYPE
)
2672 if (memcmp ((char *) &mode
, p
, sizeof mode
))
2680 if (memcmp ((char *) &have_purpose
, p
, sizeof have_purpose
))
2683 p
+= sizeof have_purpose
;
2685 /* For arrays, insist that the size in bytes match. */
2686 if (TREE_CODE (TREE_TYPE (exp
)) == ARRAY_TYPE
)
2688 HOST_WIDE_INT size
= int_size_in_bytes (TREE_TYPE (exp
));
2690 if (memcmp ((char *) &size
, p
, sizeof size
))
2696 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
2698 if (TREE_VALUE (link
))
2700 if ((p
= compare_constant_1 (TREE_VALUE (link
), p
)) == 0)
2707 if (memcmp ((char *) &zero
, p
, sizeof zero
))
2713 if (TREE_PURPOSE (link
)
2714 && TREE_CODE (TREE_PURPOSE (link
)) == FIELD_DECL
)
2716 if (memcmp ((char *) &TREE_PURPOSE (link
), p
,
2717 sizeof TREE_PURPOSE (link
)))
2720 p
+= sizeof TREE_PURPOSE (link
);
2722 else if (TREE_PURPOSE (link
))
2724 if ((p
= compare_constant_1 (TREE_PURPOSE (link
), p
)) == 0)
2727 else if (have_purpose
)
2731 if (memcmp ((char *) &zero
, p
, sizeof zero
))
2743 struct addr_const value
;
2745 decode_addr_const (exp
, &value
);
2746 strp
= (unsigned char *) &value
.offset
;
2747 len
= sizeof value
.offset
;
2748 /* Compare the offset. */
2750 if (*p
++ != *strp
++)
2753 /* Compare symbol name. */
2754 strp
= (unsigned char *) XSTR (value
.base
, 0);
2755 len
= strlen ((char *) strp
) + 1;
2762 p
= compare_constant_1 (TREE_OPERAND (exp
, 0), p
);
2766 return compare_constant_1 (TREE_OPERAND (exp
, 1), p
);
2770 case NON_LVALUE_EXPR
:
2771 return compare_constant_1 (TREE_OPERAND (exp
, 0), p
);
2774 if (lang_expand_constant
)
2776 exp
= (*lang_expand_constant
) (exp
);
2777 return compare_constant_1 (exp
, p
);
2782 /* Compare constant contents. */
2784 if (*p
++ != *strp
++)
2790 /* Construct a constant descriptor for the expression EXP.
2791 It is up to the caller to enter the descriptor in the hash table. */
2793 static struct constant_descriptor
*
2794 record_constant (exp
)
2797 struct constant_descriptor
*next
= 0;
2801 /* Make a struct constant_descriptor. The first three pointers will
2802 be filled in later. Here we just leave space for them. */
2804 obstack_grow (&permanent_obstack
, (char *) &next
, sizeof next
);
2805 obstack_grow (&permanent_obstack
, (char *) &label
, sizeof label
);
2806 obstack_grow (&permanent_obstack
, (char *) &rtl
, sizeof rtl
);
2807 record_constant_1 (exp
);
2808 return (struct constant_descriptor
*) obstack_finish (&permanent_obstack
);
2811 /* Add a description of constant expression EXP
2812 to the object growing in `permanent_obstack'.
2813 No need to return its address; the caller will get that
2814 from the obstack when the object is complete. */
2817 record_constant_1 (exp
)
2820 register unsigned char *strp
;
2822 register enum tree_code code
= TREE_CODE (exp
);
2824 obstack_1grow (&permanent_obstack
, (unsigned int) code
);
2829 obstack_1grow (&permanent_obstack
, TYPE_PRECISION (TREE_TYPE (exp
)));
2830 strp
= (unsigned char *) &TREE_INT_CST (exp
);
2831 len
= sizeof TREE_INT_CST (exp
);
2835 obstack_1grow (&permanent_obstack
, TYPE_PRECISION (TREE_TYPE (exp
)));
2836 strp
= (unsigned char *) &TREE_REAL_CST (exp
);
2837 len
= sizeof TREE_REAL_CST (exp
);
2841 if (flag_writable_strings
)
2844 obstack_1grow (&permanent_obstack
, TYPE_MODE (TREE_TYPE (exp
)));
2845 strp
= (unsigned char *) TREE_STRING_POINTER (exp
);
2846 len
= TREE_STRING_LENGTH (exp
);
2847 obstack_grow (&permanent_obstack
, (char *) &TREE_STRING_LENGTH (exp
),
2848 sizeof TREE_STRING_LENGTH (exp
));
2852 record_constant_1 (TREE_REALPART (exp
));
2853 record_constant_1 (TREE_IMAGPART (exp
));
2857 if (TREE_CODE (TREE_TYPE (exp
)) == SET_TYPE
)
2859 int nbytes
= int_size_in_bytes (TREE_TYPE (exp
));
2860 obstack_grow (&permanent_obstack
, &nbytes
, sizeof (nbytes
));
2861 obstack_blank (&permanent_obstack
, nbytes
);
2862 get_set_constructor_bytes
2863 (exp
, (unsigned char *) permanent_obstack
.next_free
-nbytes
,
2870 int length
= list_length (CONSTRUCTOR_ELTS (exp
));
2871 enum machine_mode mode
= TYPE_MODE (TREE_TYPE (exp
));
2873 int have_purpose
= 0;
2875 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
2876 if (TREE_PURPOSE (link
))
2879 obstack_grow (&permanent_obstack
, (char *) &length
, sizeof length
);
2881 /* For record constructors, insist that the types match.
2882 For arrays, just verify both constructors are for arrays
2883 of the same mode. Then insist that either both or none
2884 have any TREE_PURPOSE values. */
2885 if (TREE_CODE (TREE_TYPE (exp
)) == RECORD_TYPE
)
2886 type
= TREE_TYPE (exp
);
2890 obstack_grow (&permanent_obstack
, (char *) &type
, sizeof type
);
2891 if (TREE_CODE (TREE_TYPE (exp
)) == ARRAY_TYPE
)
2892 obstack_grow (&permanent_obstack
, &mode
, sizeof mode
);
2894 obstack_grow (&permanent_obstack
, (char *) &have_purpose
,
2895 sizeof have_purpose
);
2897 /* For arrays, insist that the size in bytes match. */
2898 if (TREE_CODE (TREE_TYPE (exp
)) == ARRAY_TYPE
)
2900 HOST_WIDE_INT size
= int_size_in_bytes (TREE_TYPE (exp
));
2901 obstack_grow (&permanent_obstack
, (char *) &size
, sizeof size
);
2904 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
2906 if (TREE_VALUE (link
))
2907 record_constant_1 (TREE_VALUE (link
));
2912 obstack_grow (&permanent_obstack
,
2913 (char *) &zero
, sizeof zero
);
2916 if (TREE_PURPOSE (link
)
2917 && TREE_CODE (TREE_PURPOSE (link
)) == FIELD_DECL
)
2918 obstack_grow (&permanent_obstack
,
2919 (char *) &TREE_PURPOSE (link
),
2920 sizeof TREE_PURPOSE (link
));
2921 else if (TREE_PURPOSE (link
))
2922 record_constant_1 (TREE_PURPOSE (link
));
2923 else if (have_purpose
)
2927 obstack_grow (&permanent_obstack
,
2928 (char *) &zero
, sizeof zero
);
2936 struct addr_const value
;
2938 decode_addr_const (exp
, &value
);
2939 /* Record the offset. */
2940 obstack_grow (&permanent_obstack
,
2941 (char *) &value
.offset
, sizeof value
.offset
);
2943 switch (GET_CODE (value
.base
))
2946 /* Record the symbol name. */
2947 obstack_grow (&permanent_obstack
, XSTR (value
.base
, 0),
2948 strlen (XSTR (value
.base
, 0)) + 1);
2951 /* Record the address of the CODE_LABEL. It may not have
2952 been emitted yet, so it's UID may be zero. But pointer
2953 identity is good enough. */
2954 obstack_grow (&permanent_obstack
, &XEXP (value
.base
, 0),
2966 record_constant_1 (TREE_OPERAND (exp
, 0));
2967 record_constant_1 (TREE_OPERAND (exp
, 1));
2972 case NON_LVALUE_EXPR
:
2973 record_constant_1 (TREE_OPERAND (exp
, 0));
2977 if (lang_expand_constant
)
2979 exp
= (*lang_expand_constant
) (exp
);
2980 record_constant_1 (exp
);
2985 /* Record constant contents. */
2986 obstack_grow (&permanent_obstack
, strp
, len
);
2989 /* Record a list of constant expressions that were passed to
2990 output_constant_def but that could not be output right away. */
2992 struct deferred_constant
2994 struct deferred_constant
*next
;
3000 static struct deferred_constant
*deferred_constants
;
3002 /* Another list of constants which should be output after the
3004 static struct deferred_constant
*after_function_constants
;
3006 /* Nonzero means defer output of addressed subconstants
3007 (i.e., those for which output_constant_def is called.) */
3008 static int defer_addressed_constants_flag
;
3010 /* Start deferring output of subconstants. */
3013 defer_addressed_constants ()
3015 defer_addressed_constants_flag
++;
3018 /* Stop deferring output of subconstants,
3019 and output now all those that have been deferred. */
3022 output_deferred_addressed_constants ()
3024 struct deferred_constant
*p
, *next
;
3026 defer_addressed_constants_flag
--;
3028 if (defer_addressed_constants_flag
> 0)
3031 for (p
= deferred_constants
; p
; p
= next
)
3033 output_constant_def_contents (p
->exp
, p
->reloc
, p
->labelno
);
3038 deferred_constants
= 0;
3041 /* Output any constants which should appear after a function. */
3044 output_after_function_constants ()
3046 struct deferred_constant
*p
, *next
;
3048 for (p
= after_function_constants
; p
; p
= next
)
3050 output_constant_def_contents (p
->exp
, p
->reloc
, p
->labelno
);
3055 after_function_constants
= 0;
3058 /* Make a copy of the whole tree structure for a constant.
3059 This handles the same types of nodes that compare_constant
3060 and record_constant handle. */
3066 switch (TREE_CODE (exp
))
3069 /* For ADDR_EXPR, we do not want to copy the decl whose address
3070 is requested. We do want to copy constants though. */
3071 if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp
, 0))) == 'c')
3072 return build1 (TREE_CODE (exp
), TREE_TYPE (exp
),
3073 copy_constant (TREE_OPERAND (exp
, 0)));
3075 return copy_node (exp
);
3080 return copy_node (exp
);
3083 return build_complex (TREE_TYPE (exp
),
3084 copy_constant (TREE_REALPART (exp
)),
3085 copy_constant (TREE_IMAGPART (exp
)));
3089 return build (TREE_CODE (exp
), TREE_TYPE (exp
),
3090 copy_constant (TREE_OPERAND (exp
, 0)),
3091 copy_constant (TREE_OPERAND (exp
, 1)));
3095 case NON_LVALUE_EXPR
:
3096 return build1 (TREE_CODE (exp
), TREE_TYPE (exp
),
3097 copy_constant (TREE_OPERAND (exp
, 0)));
3101 tree copy
= copy_node (exp
);
3102 tree list
= copy_list (CONSTRUCTOR_ELTS (exp
));
3105 CONSTRUCTOR_ELTS (copy
) = list
;
3106 for (tail
= list
; tail
; tail
= TREE_CHAIN (tail
))
3107 TREE_VALUE (tail
) = copy_constant (TREE_VALUE (tail
));
3108 if (TREE_CODE (TREE_TYPE (exp
)) == SET_TYPE
)
3109 for (tail
= list
; tail
; tail
= TREE_CHAIN (tail
))
3110 TREE_PURPOSE (tail
) = copy_constant (TREE_PURPOSE (tail
));
3120 /* Return an rtx representing a reference to constant data in memory
3121 for the constant expression EXP.
3123 If assembler code for such a constant has already been output,
3124 return an rtx to refer to it.
3125 Otherwise, output such a constant in memory (or defer it for later)
3126 and generate an rtx for it.
3128 If DEFER is non-zero, the output of string constants can be deferred
3129 and output only if referenced in the function after all optimizations.
3131 The TREE_CST_RTL of EXP is set up to point to that rtx.
3132 The const_hash_table records which constants already have label strings. */
3135 output_constant_def (exp
, defer
)
3140 register struct constant_descriptor
*desc
;
3141 struct deferred_string
**defstr
;
3145 int after_function
= 0;
3148 if (TREE_CST_RTL (exp
))
3149 return TREE_CST_RTL (exp
);
3151 /* Make sure any other constants whose addresses appear in EXP
3152 are assigned label numbers. */
3154 reloc
= output_addressed_constants (exp
);
3156 /* Compute hash code of EXP. Search the descriptors for that hash code
3157 to see if any of them describes EXP. If yes, the descriptor records
3158 the label number already assigned. */
3160 hash
= const_hash (exp
) % MAX_HASH_TABLE
;
3162 for (desc
= const_hash_table
[hash
]; desc
; desc
= desc
->next
)
3163 if (compare_constant (exp
, desc
))
3168 /* No constant equal to EXP is known to have been output.
3169 Make a constant descriptor to enter EXP in the hash table.
3170 Assign the label number and record it in the descriptor for
3171 future calls to this function to find. */
3173 /* Create a string containing the label name, in LABEL. */
3174 labelno
= const_labelno
++;
3175 ASM_GENERATE_INTERNAL_LABEL (label
, "LC", labelno
);
3177 desc
= record_constant (exp
);
3178 desc
->next
= const_hash_table
[hash
];
3179 desc
->label
= ggc_alloc_string (label
, -1);
3180 const_hash_table
[hash
] = desc
;
3182 /* We have a symbol name; construct the SYMBOL_REF and the MEM. */
3184 = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp
)),
3185 gen_rtx_SYMBOL_REF (Pmode
, desc
->label
));
3187 set_mem_attributes (desc
->rtl
, exp
, 1);
3192 TREE_CST_RTL (exp
) = desc
->rtl
;
3194 /* Optionally set flags or add text to the name to record information
3195 such as that it is a function name. If the name is changed, the macro
3196 ASM_OUTPUT_LABELREF will have to know how to strip this information. */
3197 #ifdef ENCODE_SECTION_INFO
3198 ENCODE_SECTION_INFO (exp
);
3201 #ifdef CONSTANT_AFTER_FUNCTION_P
3202 if (current_function_decl
!= 0
3203 && CONSTANT_AFTER_FUNCTION_P (exp
))
3208 && STRING_POOL_ADDRESS_P (XEXP (desc
->rtl
, 0))
3209 && (!defer
|| defer_addressed_constants_flag
|| after_function
))
3211 defstr
= (struct deferred_string
**)
3212 htab_find_slot_with_hash (const_str_htab
, desc
->label
,
3213 STRHASH (desc
->label
), NO_INSERT
);
3216 /* If the string is currently deferred but we need to output it now,
3217 remove it from deferred string hash table. */
3219 labelno
= (*defstr
)->labelno
;
3220 STRING_POOL_ADDRESS_P (XEXP (desc
->rtl
, 0)) = 0;
3221 htab_clear_slot (const_str_htab
, (void **) defstr
);
3225 /* If this is the first time we've seen this particular constant,
3226 output it (or defer its output for later). */
3229 if (defer_addressed_constants_flag
|| after_function
)
3231 struct deferred_constant
*p
;
3232 p
= (struct deferred_constant
*) xmalloc (sizeof (struct deferred_constant
));
3234 p
->exp
= copy_constant (exp
);
3236 p
->labelno
= labelno
;
3239 p
->next
= after_function_constants
;
3240 after_function_constants
= p
;
3244 p
->next
= deferred_constants
;
3245 deferred_constants
= p
;
3250 /* Do no output if -fsyntax-only. */
3251 if (! flag_syntax_only
)
3253 if (TREE_CODE (exp
) != STRING_CST
3255 || flag_writable_strings
3256 || (defstr
= (struct deferred_string
**)
3257 htab_find_slot_with_hash (const_str_htab
,
3259 STRHASH (desc
->label
),
3261 output_constant_def_contents (exp
, reloc
, labelno
);
3264 struct deferred_string
*p
;
3266 p
= (struct deferred_string
*)
3267 xmalloc (sizeof (struct deferred_string
));
3269 p
->exp
= copy_constant (exp
);
3270 p
->label
= desc
->label
;
3271 p
->labelno
= labelno
;
3273 STRING_POOL_ADDRESS_P (XEXP (desc
->rtl
, 0)) = 1;
3279 return TREE_CST_RTL (exp
);
3282 /* Now output assembler code to define the label for EXP,
3283 and follow it with the data of EXP. */
3286 output_constant_def_contents (exp
, reloc
, labelno
)
3293 if (IN_NAMED_SECTION (exp
))
3294 named_section (exp
, NULL
, reloc
);
3297 /* First switch to text section, except for writable strings. */
3298 #ifdef SELECT_SECTION
3299 SELECT_SECTION (exp
, reloc
);
3301 if (((TREE_CODE (exp
) == STRING_CST
) && flag_writable_strings
)
3302 || (flag_pic
&& reloc
))
3305 readonly_data_section ();
3309 /* Align the location counter as required by EXP's data type. */
3310 align
= TYPE_ALIGN (TREE_TYPE (exp
));
3311 #ifdef CONSTANT_ALIGNMENT
3312 align
= CONSTANT_ALIGNMENT (exp
, align
);
3315 if (align
> BITS_PER_UNIT
)
3316 ASM_OUTPUT_ALIGN (asm_out_file
, floor_log2 (align
/ BITS_PER_UNIT
));
3318 /* Output the label itself. */
3319 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file
, "LC", labelno
);
3321 /* Output the value of EXP. */
3322 output_constant (exp
,
3323 (TREE_CODE (exp
) == STRING_CST
3324 ? TREE_STRING_LENGTH (exp
)
3325 : int_size_in_bytes (TREE_TYPE (exp
))));
3329 /* Structure to represent sufficient information about a constant so that
3330 it can be output when the constant pool is output, so that function
3331 integration can be done, and to simplify handling on machines that reference
3332 constant pool as base+displacement. */
3334 struct pool_constant
3336 struct constant_descriptor
*desc
;
3337 struct pool_constant
*next
, *next_sym
;
3340 enum machine_mode mode
;
3347 /* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true.
3348 The argument is XSTR (... , 0) */
3350 #define SYMHASH(LABEL) \
3351 ((((unsigned long) (LABEL)) & ((1 << HASHBITS) - 1)) % MAX_RTX_HASH_TABLE)
3353 /* Initialize constant pool hashing for a new function. */
3356 init_varasm_status (f
)
3359 struct varasm_status
*p
;
3360 p
= (struct varasm_status
*) xmalloc (sizeof (struct varasm_status
));
3362 p
->x_const_rtx_hash_table
3363 = ((struct constant_descriptor
**)
3364 xcalloc (MAX_RTX_HASH_TABLE
, sizeof (struct constant_descriptor
*)));
3365 p
->x_const_rtx_sym_hash_table
3366 = ((struct pool_constant
**)
3367 xcalloc (MAX_RTX_HASH_TABLE
, sizeof (struct pool_constant
*)));
3369 p
->x_first_pool
= p
->x_last_pool
= 0;
3370 p
->x_pool_offset
= 0;
3371 p
->x_const_double_chain
= 0;
3374 /* Mark PC for GC. */
3377 mark_pool_constant (pc
)
3378 struct pool_constant
*pc
;
3383 ggc_mark_rtx (pc
->constant
);
3384 ggc_mark_string (pc
->label
);
3389 /* Mark P for GC. */
3392 mark_varasm_status (p
)
3393 struct varasm_status
*p
;
3398 mark_pool_constant (p
->x_first_pool
);
3399 ggc_mark_rtx (p
->x_const_double_chain
);
3402 /* Clear out all parts of the state in F that can safely be discarded
3403 after the function has been compiled, to let garbage collection
3404 reclaim the memory. */
3407 free_varasm_status (f
)
3410 struct varasm_status
*p
;
3415 /* Clear out the hash tables. */
3416 for (i
= 0; i
< MAX_RTX_HASH_TABLE
; ++i
)
3418 struct constant_descriptor
* cd
;
3420 cd
= p
->x_const_rtx_hash_table
[i
];
3422 struct constant_descriptor
* next
= cd
->next
;
3428 free (p
->x_const_rtx_hash_table
);
3429 free (p
->x_const_rtx_sym_hash_table
);
3434 enum kind
{ RTX_DOUBLE
, RTX_INT
};
3436 /* Express an rtx for a constant integer (perhaps symbolic)
3437 as the sum of a symbol or label plus an explicit integer.
3438 They are stored into VALUE. */
3441 decode_rtx_const (mode
, x
, value
)
3442 enum machine_mode mode
;
3444 struct rtx_const
*value
;
3446 /* Clear the whole structure, including any gaps. */
3447 memset (value
, 0, sizeof (struct rtx_const
));
3449 value
->kind
= RTX_INT
; /* Most usual kind. */
3452 switch (GET_CODE (x
))
3455 value
->kind
= RTX_DOUBLE
;
3456 if (GET_MODE (x
) != VOIDmode
)
3458 value
->mode
= GET_MODE (x
);
3459 memcpy ((char *) &value
->un
.du
,
3460 (char *) &CONST_DOUBLE_LOW (x
), sizeof value
->un
.du
);
3464 value
->un
.di
.low
= CONST_DOUBLE_LOW (x
);
3465 value
->un
.di
.high
= CONST_DOUBLE_HIGH (x
);
3470 value
->un
.addr
.offset
= INTVAL (x
);
3476 value
->un
.addr
.base
= x
;
3481 if (GET_CODE (x
) == PLUS
)
3483 value
->un
.addr
.base
= XEXP (x
, 0);
3484 if (GET_CODE (XEXP (x
, 1)) != CONST_INT
)
3486 value
->un
.addr
.offset
= INTVAL (XEXP (x
, 1));
3488 else if (GET_CODE (x
) == MINUS
)
3490 value
->un
.addr
.base
= XEXP (x
, 0);
3491 if (GET_CODE (XEXP (x
, 1)) != CONST_INT
)
3493 value
->un
.addr
.offset
= - INTVAL (XEXP (x
, 1));
3503 if (value
->kind
== RTX_INT
&& value
->un
.addr
.base
!= 0)
3504 switch (GET_CODE (value
->un
.addr
.base
))
3507 /* Use the string's address, not the SYMBOL_REF's address,
3508 for the sake of addresses of library routines. */
3509 value
->un
.addr
.base
= (rtx
) XSTR (value
->un
.addr
.base
, 0);
3513 /* For a LABEL_REF, compare labels. */
3514 value
->un
.addr
.base
= XEXP (value
->un
.addr
.base
, 0);
3521 /* Given a MINUS expression, simplify it if both sides
3522 include the same symbol. */
3525 simplify_subtraction (x
)
3528 struct rtx_const val0
, val1
;
3530 decode_rtx_const (GET_MODE (x
), XEXP (x
, 0), &val0
);
3531 decode_rtx_const (GET_MODE (x
), XEXP (x
, 1), &val1
);
3533 if (val0
.un
.addr
.base
== val1
.un
.addr
.base
)
3534 return GEN_INT (val0
.un
.addr
.offset
- val1
.un
.addr
.offset
);
3538 /* Compute a hash code for a constant RTL expression. */
3541 const_hash_rtx (mode
, x
)
3542 enum machine_mode mode
;
3548 struct rtx_const value
;
3549 decode_rtx_const (mode
, x
, &value
);
3551 /* Compute hashing function */
3553 for (i
= 0; i
< sizeof value
/ sizeof (int); i
++)
3554 hi
+= ((int *) &value
)[i
];
3556 hi
&= (1 << HASHBITS
) - 1;
3557 hi
%= MAX_RTX_HASH_TABLE
;
3561 /* Compare a constant rtl object X with a constant-descriptor DESC.
3562 Return 1 if DESC describes a constant with the same value as X. */
3565 compare_constant_rtx (mode
, x
, desc
)
3566 enum machine_mode mode
;
3568 struct constant_descriptor
*desc
;
3570 register int *p
= (int *) desc
->u
.contents
;
3573 struct rtx_const value
;
3575 decode_rtx_const (mode
, x
, &value
);
3576 strp
= (int *) &value
;
3577 len
= sizeof value
/ sizeof (int);
3579 /* Compare constant contents. */
3581 if (*p
++ != *strp
++)
3587 /* Construct a constant descriptor for the rtl-expression X.
3588 It is up to the caller to enter the descriptor in the hash table. */
3590 static struct constant_descriptor
*
3591 record_constant_rtx (mode
, x
)
3592 enum machine_mode mode
;
3595 struct constant_descriptor
*ptr
;
3597 ptr
= ((struct constant_descriptor
*)
3598 xcalloc (1, (offsetof (struct constant_descriptor
, u
)
3599 + sizeof (struct rtx_const
))));
3600 decode_rtx_const (mode
, x
, (struct rtx_const
*) ptr
->u
.contents
);
3605 /* Given a constant rtx X, make (or find) a memory constant for its value
3606 and return a MEM rtx to refer to it in memory. */
3609 force_const_mem (mode
, x
)
3610 enum machine_mode mode
;
3614 register struct constant_descriptor
*desc
;
3616 const char *found
= 0;
3619 /* If we want this CONST_DOUBLE in the same mode as it is in memory
3620 (this will always be true for floating CONST_DOUBLEs that have been
3621 placed in memory, but not for VOIDmode (integer) CONST_DOUBLEs),
3622 use the previous copy. Otherwise, make a new one. Note that in
3623 the unlikely event that this same CONST_DOUBLE is used in two different
3624 modes in an alternating fashion, we will allocate a lot of different
3625 memory locations, but this should be extremely rare. */
3627 if (GET_CODE (x
) == CONST_DOUBLE
3628 && GET_CODE (CONST_DOUBLE_MEM (x
)) == MEM
3629 && GET_MODE (CONST_DOUBLE_MEM (x
)) == mode
)
3630 return CONST_DOUBLE_MEM (x
);
3632 /* Compute hash code of X. Search the descriptors for that hash code
3633 to see if any of them describes X. If yes, the descriptor records
3634 the label number already assigned. */
3636 hash
= const_hash_rtx (mode
, x
);
3638 for (desc
= const_rtx_hash_table
[hash
]; desc
; desc
= desc
->next
)
3639 if (compare_constant_rtx (mode
, x
, desc
))
3641 found
= desc
->label
;
3647 register struct pool_constant
*pool
;
3650 /* No constant equal to X is known to have been output.
3651 Make a constant descriptor to enter X in the hash table.
3652 Assign the label number and record it in the descriptor for
3653 future calls to this function to find. */
3655 desc
= record_constant_rtx (mode
, x
);
3656 desc
->next
= const_rtx_hash_table
[hash
];
3657 const_rtx_hash_table
[hash
] = desc
;
3659 /* Align the location counter as required by EXP's data type. */
3660 align
= (mode
== VOIDmode
) ? UNITS_PER_WORD
: GET_MODE_SIZE (mode
);
3661 if (align
> BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
)
3662 align
= BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
;
3663 #ifdef CONSTANT_ALIGNMENT
3664 align
= CONSTANT_ALIGNMENT (make_tree (type_for_mode (mode
, 0), x
),
3665 align
* BITS_PER_UNIT
) / BITS_PER_UNIT
;
3668 pool_offset
+= align
- 1;
3669 pool_offset
&= ~ (align
- 1);
3671 /* Allocate a pool constant descriptor, fill it in, and chain it in. */
3673 pool
= (struct pool_constant
*) ggc_alloc (sizeof (struct pool_constant
));
3677 pool
->labelno
= const_labelno
;
3678 pool
->align
= align
;
3679 pool
->offset
= pool_offset
;
3686 last_pool
->next
= pool
;
3689 pool_offset
+= GET_MODE_SIZE (mode
);
3691 /* Create a string containing the label name, in LABEL. */
3692 ASM_GENERATE_INTERNAL_LABEL (label
, "LC", const_labelno
);
3696 desc
->label
= found
= ggc_alloc_string (label
, -1);
3698 /* Add label to symbol hash table. */
3699 hash
= SYMHASH (found
);
3700 pool
->label
= found
;
3701 pool
->next_sym
= const_rtx_sym_hash_table
[hash
];
3702 const_rtx_sym_hash_table
[hash
] = pool
;
3705 /* We have a symbol name; construct the SYMBOL_REF and the MEM. */
3707 def
= gen_rtx_MEM (mode
, gen_rtx_SYMBOL_REF (Pmode
, found
));
3708 set_mem_attributes (def
, type_for_mode (mode
, 0), 1);
3709 RTX_UNCHANGING_P (def
) = 1;
3711 /* Mark the symbol_ref as belonging to this constants pool. */
3712 CONSTANT_POOL_ADDRESS_P (XEXP (def
, 0)) = 1;
3713 current_function_uses_const_pool
= 1;
3715 if (GET_CODE (x
) == CONST_DOUBLE
)
3717 if (CONST_DOUBLE_MEM (x
) == cc0_rtx
)
3719 CONST_DOUBLE_CHAIN (x
) = const_double_chain
;
3720 const_double_chain
= x
;
3722 CONST_DOUBLE_MEM (x
) = def
;
3728 /* Given a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true, return a pointer to
3729 the corresponding pool_constant structure. */
3731 static struct pool_constant
*
3732 find_pool_constant (f
, addr
)
3736 struct pool_constant
*pool
;
3737 const char *label
= XSTR (addr
, 0);
3739 for (pool
= f
->varasm
->x_const_rtx_sym_hash_table
[SYMHASH (label
)]; pool
;
3740 pool
= pool
->next_sym
)
3741 if (pool
->label
== label
)
3747 /* Given a constant pool SYMBOL_REF, return the corresponding constant. */
3750 get_pool_constant (addr
)
3753 return (find_pool_constant (cfun
, addr
))->constant
;
3756 /* Likewise, but for the constant pool of a specific function. */
3759 get_pool_constant_for_function (f
, addr
)
3763 return (find_pool_constant (f
, addr
))->constant
;
3766 /* Similar, return the mode. */
3769 get_pool_mode (addr
)
3772 return (find_pool_constant (cfun
, addr
))->mode
;
3776 get_pool_mode_for_function (f
, addr
)
3780 return (find_pool_constant (f
, addr
))->mode
;
3783 /* Similar, return the offset in the constant pool. */
3786 get_pool_offset (addr
)
3789 return (find_pool_constant (cfun
, addr
))->offset
;
3792 /* Return the size of the constant pool. */
3800 /* Write all the constants in the constant pool. */
3803 output_constant_pool (fnname
, fndecl
)
3804 const char *fnname ATTRIBUTE_UNUSED
;
3805 tree fndecl ATTRIBUTE_UNUSED
;
3807 struct pool_constant
*pool
;
3809 union real_extract u
;
3811 /* It is possible for gcc to call force_const_mem and then to later
3812 discard the instructions which refer to the constant. In such a
3813 case we do not need to output the constant. */
3814 mark_constant_pool ();
3816 #ifdef ASM_OUTPUT_POOL_PROLOGUE
3817 ASM_OUTPUT_POOL_PROLOGUE (asm_out_file
, fnname
, fndecl
, pool_offset
);
3820 for (pool
= first_pool
; pool
; pool
= pool
->next
)
3829 /* See if X is a LABEL_REF (or a CONST referring to a LABEL_REF)
3830 whose CODE_LABEL has been deleted. This can occur if a jump table
3831 is eliminated by optimization. If so, write a constant of zero
3832 instead. Note that this can also happen by turning the
3833 CODE_LABEL into a NOTE. */
3834 /* ??? This seems completely and utterly wrong. Certainly it's
3835 not true for NOTE_INSN_DELETED_LABEL, but I disbelieve proper
3836 functioning even with INSN_DELETED_P and friends. */
3839 switch (GET_CODE (x
))
3842 if (GET_CODE (XEXP (x
, 0)) != PLUS
3843 || GET_CODE (XEXP (XEXP (x
, 0), 0)) != LABEL_REF
)
3845 tmp
= XEXP (XEXP (x
, 0), 0);
3850 if (INSN_DELETED_P (tmp
)
3851 || (GET_CODE (tmp
) == NOTE
3852 && NOTE_LINE_NUMBER (tmp
) == NOTE_INSN_DELETED
))
3863 /* First switch to correct section. */
3864 #ifdef SELECT_RTX_SECTION
3865 SELECT_RTX_SECTION (pool
->mode
, x
);
3867 readonly_data_section ();
3870 #ifdef ASM_OUTPUT_SPECIAL_POOL_ENTRY
3871 ASM_OUTPUT_SPECIAL_POOL_ENTRY (asm_out_file
, x
, pool
->mode
,
3872 pool
->align
, pool
->labelno
, done
);
3875 if (pool
->align
> 1)
3876 ASM_OUTPUT_ALIGN (asm_out_file
, floor_log2 (pool
->align
));
3878 /* Output the label. */
3879 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file
, "LC", pool
->labelno
);
3881 /* Output the value of the constant itself. */
3882 switch (GET_MODE_CLASS (pool
->mode
))
3885 if (GET_CODE (x
) != CONST_DOUBLE
)
3888 memcpy ((char *) &u
, (char *) &CONST_DOUBLE_LOW (x
), sizeof u
);
3889 assemble_real (u
.d
, pool
->mode
);
3893 case MODE_PARTIAL_INT
:
3894 assemble_integer (x
, GET_MODE_SIZE (pool
->mode
), 1);
3901 #ifdef ASM_OUTPUT_SPECIAL_POOL_ENTRY
3907 #ifdef ASM_OUTPUT_POOL_EPILOGUE
3908 ASM_OUTPUT_POOL_EPILOGUE (asm_out_file
, fnname
, fndecl
, pool_offset
);
3911 /* Done with this pool. */
3912 first_pool
= last_pool
= 0;
3915 /* Look through the instructions for this function, and mark all the
3916 entries in the constant pool which are actually being used. */
3919 mark_constant_pool ()
3922 struct pool_constant
*pool
;
3924 if (first_pool
== 0 && htab_elements (const_str_htab
) == 0)
3927 for (pool
= first_pool
; pool
; pool
= pool
->next
)
3930 for (insn
= get_insns (); insn
; insn
= NEXT_INSN (insn
))
3932 mark_constants (PATTERN (insn
));
3934 for (insn
= current_function_epilogue_delay_list
;
3936 insn
= XEXP (insn
, 1))
3938 mark_constants (PATTERN (insn
));
3940 /* It's possible that the only reference to a symbol is in a symbol
3941 that's in the constant pool. This happens in Fortran under some
3942 situations. (When the constant contains the address of another
3943 constant, and only the first is used directly in an insn.)
3944 This is potentially suboptimal if there's ever a possibility of
3945 backwards (in pool order) 2'd level references. However, it's
3946 not clear that 2'd level references can happen. */
3947 for (pool
= first_pool
; pool
; pool
= pool
->next
)
3949 struct pool_constant
*tem
;
3952 /* skip unmarked entries; no insn refers to them. */
3956 /* Skip everything except SYMBOL_REFs. */
3957 if (GET_CODE (pool
->constant
) != SYMBOL_REF
)
3959 label
= XSTR (pool
->constant
, 0);
3961 /* Be sure the symbol's value is marked. */
3962 for (tem
= const_rtx_sym_hash_table
[SYMHASH (label
)]; tem
;
3964 if (tem
->label
== label
)
3966 /* If we didn't find it, there's something truly wrong here, but it
3967 will be announced by the assembler. */
3976 register const char *format_ptr
;
3981 if (GET_CODE (x
) == SYMBOL_REF
)
3983 if (CONSTANT_POOL_ADDRESS_P (x
))
3984 find_pool_constant (cfun
, x
)->mark
= 1;
3985 else if (STRING_POOL_ADDRESS_P (x
))
3987 struct deferred_string
**defstr
;
3989 defstr
= (struct deferred_string
**)
3990 htab_find_slot_with_hash (const_str_htab
, XSTR (x
, 0),
3991 STRHASH (XSTR (x
, 0)), NO_INSERT
);
3994 struct deferred_string
*p
= *defstr
;
3996 STRING_POOL_ADDRESS_P (x
) = 0;
3997 output_constant_def_contents (p
->exp
, 0, p
->labelno
);
3998 htab_clear_slot (const_str_htab
, (void **) defstr
);
4003 /* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be
4004 a MEM, but does not constitute a use of that MEM. */
4005 else if (GET_CODE (x
) == CONST_DOUBLE
)
4008 /* Insns may appear inside a SEQUENCE. Only check the patterns of
4009 insns, not any notes that may be attached. We don't want to mark
4010 a constant just because it happens to appear in a REG_EQUIV note. */
4013 mark_constants (PATTERN (x
));
4017 format_ptr
= GET_RTX_FORMAT (GET_CODE (x
));
4019 for (i
= 0; i
< GET_RTX_LENGTH (GET_CODE (x
)); i
++)
4021 switch (*format_ptr
++)
4024 mark_constants (XEXP (x
, i
));
4028 if (XVEC (x
, i
) != 0)
4032 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
4033 mark_constants (XVECEXP (x
, i
, j
));
4052 /* Find all the constants whose addresses are referenced inside of EXP,
4053 and make sure assembler code with a label has been output for each one.
4054 Indicate whether an ADDR_EXPR has been encountered. */
4057 output_addressed_constants (exp
)
4062 switch (TREE_CODE (exp
))
4066 register tree constant
= TREE_OPERAND (exp
, 0);
4068 while (TREE_CODE (constant
) == COMPONENT_REF
)
4070 constant
= TREE_OPERAND (constant
, 0);
4073 if (TREE_CODE_CLASS (TREE_CODE (constant
)) == 'c'
4074 || TREE_CODE (constant
) == CONSTRUCTOR
)
4075 /* No need to do anything here
4076 for addresses of variables or functions. */
4077 output_constant_def (constant
, 0);
4084 reloc
= output_addressed_constants (TREE_OPERAND (exp
, 0));
4085 reloc
|= output_addressed_constants (TREE_OPERAND (exp
, 1));
4090 case NON_LVALUE_EXPR
:
4091 reloc
= output_addressed_constants (TREE_OPERAND (exp
, 0));
4097 for (link
= CONSTRUCTOR_ELTS (exp
); link
; link
= TREE_CHAIN (link
))
4098 if (TREE_VALUE (link
) != 0)
4099 reloc
|= output_addressed_constants (TREE_VALUE (link
));
4109 /* Return nonzero if VALUE is a valid constant-valued expression
4110 for use in initializing a static variable; one that can be an
4111 element of a "constant" initializer.
4113 Return null_pointer_node if the value is absolute;
4114 if it is relocatable, return the variable that determines the relocation.
4115 We assume that VALUE has been folded as much as possible;
4116 therefore, we do not need to check for such things as
4117 arithmetic-combinations of integers. */
4120 initializer_constant_valid_p (value
, endtype
)
4124 /* Give the front-end a chance to convert VALUE to something that
4125 looks more like a constant to the back-end. */
4126 if (lang_expand_constant
)
4127 value
= (*lang_expand_constant
) (value
);
4129 switch (TREE_CODE (value
))
4132 if ((TREE_CODE (TREE_TYPE (value
)) == UNION_TYPE
4133 || TREE_CODE (TREE_TYPE (value
)) == RECORD_TYPE
)
4134 && TREE_CONSTANT (value
)
4135 && CONSTRUCTOR_ELTS (value
))
4137 initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value
)),
4140 return TREE_STATIC (value
) ? null_pointer_node
: 0;
4146 return null_pointer_node
;
4149 return staticp (TREE_OPERAND (value
, 0)) ? TREE_OPERAND (value
, 0) : 0;
4151 case NON_LVALUE_EXPR
:
4152 return initializer_constant_valid_p (TREE_OPERAND (value
, 0), endtype
);
4156 /* Allow conversions between pointer types. */
4157 if (POINTER_TYPE_P (TREE_TYPE (value
))
4158 && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0))))
4159 return initializer_constant_valid_p (TREE_OPERAND (value
, 0), endtype
);
4161 /* Allow conversions between real types. */
4162 if (FLOAT_TYPE_P (TREE_TYPE (value
))
4163 && FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0))))
4164 return initializer_constant_valid_p (TREE_OPERAND (value
, 0), endtype
);
4166 /* Allow length-preserving conversions between integer types. */
4167 if (INTEGRAL_TYPE_P (TREE_TYPE (value
))
4168 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0)))
4169 && (TYPE_PRECISION (TREE_TYPE (value
))
4170 == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value
, 0)))))
4171 return initializer_constant_valid_p (TREE_OPERAND (value
, 0), endtype
);
4173 /* Allow conversions between other integer types only if
4175 if (INTEGRAL_TYPE_P (TREE_TYPE (value
))
4176 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0))))
4178 tree inner
= initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4180 if (inner
== null_pointer_node
)
4181 return null_pointer_node
;
4185 /* Allow (int) &foo provided int is as wide as a pointer. */
4186 if (INTEGRAL_TYPE_P (TREE_TYPE (value
))
4187 && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0)))
4188 && (TYPE_PRECISION (TREE_TYPE (value
))
4189 >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value
, 0)))))
4190 return initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4193 /* Likewise conversions from int to pointers, but also allow
4194 conversions from 0. */
4195 if (POINTER_TYPE_P (TREE_TYPE (value
))
4196 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (value
, 0))))
4198 if (integer_zerop (TREE_OPERAND (value
, 0)))
4199 return null_pointer_node
;
4200 else if (TYPE_PRECISION (TREE_TYPE (value
))
4201 <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value
, 0))))
4202 return initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4206 /* Allow conversions to union types if the value inside is okay. */
4207 if (TREE_CODE (TREE_TYPE (value
)) == UNION_TYPE
)
4208 return initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4213 if (! INTEGRAL_TYPE_P (endtype
)
4214 || TYPE_PRECISION (endtype
) >= POINTER_SIZE
)
4216 tree valid0
= initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4218 tree valid1
= initializer_constant_valid_p (TREE_OPERAND (value
, 1),
4220 /* If either term is absolute, use the other terms relocation. */
4221 if (valid0
== null_pointer_node
)
4223 if (valid1
== null_pointer_node
)
4229 if (! INTEGRAL_TYPE_P (endtype
)
4230 || TYPE_PRECISION (endtype
) >= POINTER_SIZE
)
4232 tree valid0
= initializer_constant_valid_p (TREE_OPERAND (value
, 0),
4234 tree valid1
= initializer_constant_valid_p (TREE_OPERAND (value
, 1),
4236 /* Win if second argument is absolute. */
4237 if (valid1
== null_pointer_node
)
4239 /* Win if both arguments have the same relocation.
4240 Then the value is absolute. */
4241 if (valid0
== valid1
&& valid0
!= 0)
4242 return null_pointer_node
;
4245 /* Support differences between labels. */
4246 if (INTEGRAL_TYPE_P (endtype
))
4249 op0
= TREE_OPERAND (value
, 0);
4250 op1
= TREE_OPERAND (value
, 1);
4254 if (TREE_CODE (op0
) == ADDR_EXPR
4255 && TREE_CODE (TREE_OPERAND (op0
, 0)) == LABEL_DECL
4256 && TREE_CODE (op1
) == ADDR_EXPR
4257 && TREE_CODE (TREE_OPERAND (op1
, 0)) == LABEL_DECL
)
4258 return null_pointer_node
;
4269 /* Output assembler code for constant EXP to FILE, with no label.
4270 This includes the pseudo-op such as ".int" or ".byte", and a newline.
4271 Assumes output_addressed_constants has been done on EXP already.
4273 Generate exactly SIZE bytes of assembler data, padding at the end
4274 with zeros if necessary. SIZE must always be specified.
4276 SIZE is important for structure constructors,
4277 since trailing members may have been omitted from the constructor.
4278 It is also important for initialization of arrays from string constants
4279 since the full length of the string constant might not be wanted.
4280 It is also needed for initialization of unions, where the initializer's
4281 type is just one member, and that may not be as long as the union.
4283 There a case in which we would fail to output exactly SIZE bytes:
4284 for a structure constructor that wants to produce more than SIZE bytes.
4285 But such constructors will never be generated for any possible input. */
4288 output_constant (exp
, size
)
4292 register enum tree_code code
= TREE_CODE (TREE_TYPE (exp
));
4294 /* Some front-ends use constants other than the standard
4295 language-indepdent varieties, but which may still be output
4296 directly. Give the front-end a chance to convert EXP to a
4297 language-independent representation. */
4298 if (lang_expand_constant
)
4299 exp
= (*lang_expand_constant
) (exp
);
4301 if (size
== 0 || flag_syntax_only
)
4304 /* Eliminate the NON_LVALUE_EXPR_EXPR that makes a cast not be an lvalue.
4305 That way we get the constant (we hope) inside it. Also, strip off any
4306 NOP_EXPR that converts between two record, union, array, or set types
4307 or a CONVERT_EXPR that converts to a union TYPE. */
4308 while ((TREE_CODE (exp
) == NOP_EXPR
4309 && (TREE_TYPE (exp
) == TREE_TYPE (TREE_OPERAND (exp
, 0))
4310 || AGGREGATE_TYPE_P (TREE_TYPE (exp
))))
4311 || (TREE_CODE (exp
) == CONVERT_EXPR
4312 && code
== UNION_TYPE
)
4313 || TREE_CODE (exp
) == NON_LVALUE_EXPR
)
4315 exp
= TREE_OPERAND (exp
, 0);
4316 code
= TREE_CODE (TREE_TYPE (exp
));
4319 /* Allow a constructor with no elements for any data type.
4320 This means to fill the space with zeros. */
4321 if (TREE_CODE (exp
) == CONSTRUCTOR
&& CONSTRUCTOR_ELTS (exp
) == 0)
4323 assemble_zeros (size
);
4334 case REFERENCE_TYPE
:
4335 /* ??? What about (int)((float)(int)&foo + 4) */
4336 while (TREE_CODE (exp
) == NOP_EXPR
|| TREE_CODE (exp
) == CONVERT_EXPR
4337 || TREE_CODE (exp
) == NON_LVALUE_EXPR
)
4338 exp
= TREE_OPERAND (exp
, 0);
4340 if (! assemble_integer (expand_expr (exp
, NULL_RTX
, VOIDmode
,
4341 EXPAND_INITIALIZER
),
4343 error ("initializer for integer value is too complicated");
4348 if (TREE_CODE (exp
) != REAL_CST
)
4349 error ("initializer for floating value is not a floating constant");
4351 assemble_real (TREE_REAL_CST (exp
),
4352 mode_for_size (size
* BITS_PER_UNIT
, MODE_FLOAT
, 0));
4357 output_constant (TREE_REALPART (exp
), size
/ 2);
4358 output_constant (TREE_IMAGPART (exp
), size
/ 2);
4359 size
-= (size
/ 2) * 2;
4363 if (TREE_CODE (exp
) == CONSTRUCTOR
)
4365 output_constructor (exp
, size
);
4368 else if (TREE_CODE (exp
) == STRING_CST
)
4372 if (size
> TREE_STRING_LENGTH (exp
))
4374 excess
= size
- TREE_STRING_LENGTH (exp
);
4375 size
= TREE_STRING_LENGTH (exp
);
4378 assemble_string (TREE_STRING_POINTER (exp
), size
);
4387 if (TREE_CODE (exp
) == CONSTRUCTOR
)
4388 output_constructor (exp
, size
);
4394 if (TREE_CODE (exp
) == INTEGER_CST
)
4395 assemble_integer (expand_expr (exp
, NULL_RTX
,
4396 VOIDmode
, EXPAND_INITIALIZER
),
4398 else if (TREE_CODE (exp
) == CONSTRUCTOR
)
4400 unsigned char *buffer
= (unsigned char *) alloca (size
);
4401 if (get_set_constructor_bytes (exp
, buffer
, size
))
4403 assemble_string ((char *) buffer
, size
);
4406 error ("unknown set constructor type");
4414 assemble_zeros (size
);
4418 /* Subroutine of output_constant, used for CONSTRUCTORs
4419 (aggregate constants).
4420 Generate at least SIZE bytes, padding if necessary. */
4423 output_constructor (exp
, size
)
4427 tree type
= TREE_TYPE (exp
);
4428 register tree link
, field
= 0;
4430 /* Number of bytes output or skipped so far.
4431 In other words, current position within the constructor. */
4432 HOST_WIDE_INT total_bytes
= 0;
4433 /* Non-zero means BYTE contains part of a byte, to be output. */
4434 int byte_buffer_in_use
= 0;
4435 register int byte
= 0;
4437 if (HOST_BITS_PER_WIDE_INT
< BITS_PER_UNIT
)
4440 if (TREE_CODE (type
) == RECORD_TYPE
)
4441 field
= TYPE_FIELDS (type
);
4443 if (TREE_CODE (type
) == ARRAY_TYPE
4444 && TYPE_DOMAIN (type
) != 0)
4445 min_index
= TYPE_MIN_VALUE (TYPE_DOMAIN (type
));
4447 /* As LINK goes through the elements of the constant,
4448 FIELD goes through the structure fields, if the constant is a structure.
4449 if the constant is a union, then we override this,
4450 by getting the field from the TREE_LIST element.
4451 But the constant could also be an array. Then FIELD is zero.
4453 There is always a maximum of one element in the chain LINK for unions
4454 (even if the initializer in a source program incorrectly contains
4456 for (link
= CONSTRUCTOR_ELTS (exp
);
4458 link
= TREE_CHAIN (link
),
4459 field
= field
? TREE_CHAIN (field
) : 0)
4461 tree val
= TREE_VALUE (link
);
4464 /* The element in a union constructor specifies the proper field
4466 if ((TREE_CODE (type
) == RECORD_TYPE
|| TREE_CODE (type
) == UNION_TYPE
4467 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
4468 && TREE_PURPOSE (link
) != 0)
4469 field
= TREE_PURPOSE (link
);
4471 else if (TREE_CODE (type
) == ARRAY_TYPE
)
4472 index
= TREE_PURPOSE (link
);
4474 /* Eliminate the marker that makes a cast not be an lvalue. */
4478 if (index
&& TREE_CODE (index
) == RANGE_EXPR
)
4480 register int fieldsize
4481 = int_size_in_bytes (TREE_TYPE (type
));
4482 HOST_WIDE_INT lo_index
= tree_low_cst (TREE_OPERAND (index
, 0), 0);
4483 HOST_WIDE_INT hi_index
= tree_low_cst (TREE_OPERAND (index
, 1), 0);
4484 HOST_WIDE_INT index
;
4486 for (index
= lo_index
; index
<= hi_index
; index
++)
4488 /* Output the element's initial value. */
4490 assemble_zeros (fieldsize
);
4492 output_constant (val
, fieldsize
);
4494 /* Count its size. */
4495 total_bytes
+= fieldsize
;
4498 else if (field
== 0 || !DECL_BIT_FIELD (field
))
4500 /* An element that is not a bit-field. */
4502 register int fieldsize
;
4503 /* Since this structure is static,
4504 we know the positions are constant. */
4505 HOST_WIDE_INT pos
= field
? int_byte_position (field
) : 0;
4508 pos
= (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (val
)), 1)
4509 * (tree_low_cst (index
, 0) - tree_low_cst (min_index
, 0)));
4511 /* Output any buffered-up bit-fields preceding this element. */
4512 if (byte_buffer_in_use
)
4514 ASM_OUTPUT_BYTE (asm_out_file
, byte
);
4516 byte_buffer_in_use
= 0;
4519 /* Advance to offset of this element.
4520 Note no alignment needed in an array, since that is guaranteed
4521 if each element has the proper size. */
4522 if ((field
!= 0 || index
!= 0) && pos
!= total_bytes
)
4524 assemble_zeros (pos
- total_bytes
);
4528 else if (field
!= 0 && DECL_PACKED (field
))
4529 /* Some assemblers automaticallly align a datum according to its
4530 size if no align directive is specified. The datum, however,
4531 may be declared with 'packed' attribute, so we have to disable
4533 ASM_OUTPUT_ALIGN (asm_out_file
, 0);
4535 /* Determine size this element should occupy. */
4537 fieldsize
= tree_low_cst (DECL_SIZE_UNIT (field
), 1);
4539 fieldsize
= int_size_in_bytes (TREE_TYPE (type
));
4541 /* Output the element's initial value. */
4543 assemble_zeros (fieldsize
);
4545 output_constant (val
, fieldsize
);
4547 /* Count its size. */
4548 total_bytes
+= fieldsize
;
4550 else if (val
!= 0 && TREE_CODE (val
) != INTEGER_CST
)
4551 error ("invalid initial value for member `%s'",
4552 IDENTIFIER_POINTER (DECL_NAME (field
)));
4555 /* Element that is a bit-field. */
4557 HOST_WIDE_INT next_offset
= int_bit_position (field
);
4558 HOST_WIDE_INT end_offset
4559 = (next_offset
+ tree_low_cst (DECL_SIZE (field
), 1));
4562 val
= integer_zero_node
;
4564 /* If this field does not start in this (or, next) byte,
4566 if (next_offset
/ BITS_PER_UNIT
!= total_bytes
)
4568 /* Output remnant of any bit field in previous bytes. */
4569 if (byte_buffer_in_use
)
4571 ASM_OUTPUT_BYTE (asm_out_file
, byte
);
4573 byte_buffer_in_use
= 0;
4576 /* If still not at proper byte, advance to there. */
4577 if (next_offset
/ BITS_PER_UNIT
!= total_bytes
)
4579 assemble_zeros (next_offset
/ BITS_PER_UNIT
- total_bytes
);
4580 total_bytes
= next_offset
/ BITS_PER_UNIT
;
4584 if (! byte_buffer_in_use
)
4587 /* We must split the element into pieces that fall within
4588 separate bytes, and combine each byte with previous or
4589 following bit-fields. */
4591 /* next_offset is the offset n fbits from the beginning of
4592 the structure to the next bit of this element to be processed.
4593 end_offset is the offset of the first bit past the end of
4595 while (next_offset
< end_offset
)
4599 HOST_WIDE_INT value
;
4600 HOST_WIDE_INT next_byte
= next_offset
/ BITS_PER_UNIT
;
4601 HOST_WIDE_INT next_bit
= next_offset
% BITS_PER_UNIT
;
4603 /* Advance from byte to byte
4604 within this element when necessary. */
4605 while (next_byte
!= total_bytes
)
4607 ASM_OUTPUT_BYTE (asm_out_file
, byte
);
4612 /* Number of bits we can process at once
4613 (all part of the same byte). */
4614 this_time
= MIN (end_offset
- next_offset
,
4615 BITS_PER_UNIT
- next_bit
);
4616 if (BYTES_BIG_ENDIAN
)
4618 /* On big-endian machine, take the most significant bits
4619 first (of the bits that are significant)
4620 and put them into bytes from the most significant end. */
4621 shift
= end_offset
- next_offset
- this_time
;
4623 /* Don't try to take a bunch of bits that cross
4624 the word boundary in the INTEGER_CST. We can
4625 only select bits from the LOW or HIGH part
4627 if (shift
< HOST_BITS_PER_WIDE_INT
4628 && shift
+ this_time
> HOST_BITS_PER_WIDE_INT
)
4630 this_time
= shift
+ this_time
- HOST_BITS_PER_WIDE_INT
;
4631 shift
= HOST_BITS_PER_WIDE_INT
;
4634 /* Now get the bits from the appropriate constant word. */
4635 if (shift
< HOST_BITS_PER_WIDE_INT
)
4636 value
= TREE_INT_CST_LOW (val
);
4637 else if (shift
< 2 * HOST_BITS_PER_WIDE_INT
)
4639 value
= TREE_INT_CST_HIGH (val
);
4640 shift
-= HOST_BITS_PER_WIDE_INT
;
4645 /* Get the result. This works only when:
4646 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */
4647 byte
|= (((value
>> shift
)
4648 & (((HOST_WIDE_INT
) 2 << (this_time
- 1)) - 1))
4649 << (BITS_PER_UNIT
- this_time
- next_bit
));
4653 /* On little-endian machines,
4654 take first the least significant bits of the value
4655 and pack them starting at the least significant
4656 bits of the bytes. */
4657 shift
= next_offset
- int_bit_position (field
);
4659 /* Don't try to take a bunch of bits that cross
4660 the word boundary in the INTEGER_CST. We can
4661 only select bits from the LOW or HIGH part
4663 if (shift
< HOST_BITS_PER_WIDE_INT
4664 && shift
+ this_time
> HOST_BITS_PER_WIDE_INT
)
4665 this_time
= (HOST_BITS_PER_WIDE_INT
- shift
);
4667 /* Now get the bits from the appropriate constant word. */
4668 if (shift
< HOST_BITS_PER_WIDE_INT
)
4669 value
= TREE_INT_CST_LOW (val
);
4670 else if (shift
< 2 * HOST_BITS_PER_WIDE_INT
)
4672 value
= TREE_INT_CST_HIGH (val
);
4673 shift
-= HOST_BITS_PER_WIDE_INT
;
4678 /* Get the result. This works only when:
4679 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */
4680 byte
|= (((value
>> shift
)
4681 & (((HOST_WIDE_INT
) 2 << (this_time
- 1)) - 1))
4685 next_offset
+= this_time
;
4686 byte_buffer_in_use
= 1;
4691 if (byte_buffer_in_use
)
4693 ASM_OUTPUT_BYTE (asm_out_file
, byte
);
4697 if (total_bytes
< size
)
4698 assemble_zeros (size
- total_bytes
);
4701 #ifdef HANDLE_PRAGMA_WEAK
4702 /* Add function NAME to the weak symbols list. VALUE is a weak alias
4703 associatd with NAME. */
4706 add_weak (name
, value
)
4710 struct weak_syms
*weak
;
4712 weak
= (struct weak_syms
*) permalloc (sizeof (struct weak_syms
));
4717 weak
->next
= weak_decls
;
4719 weak
->value
= value
;
4724 #endif /* HANDLE_PRAGMA_WEAK */
4726 /* Declare DECL to be a weak symbol. */
4732 if (! TREE_PUBLIC (decl
))
4733 error_with_decl (decl
, "weak declaration of `%s' must be public");
4734 else if (TREE_ASM_WRITTEN (decl
))
4735 error_with_decl (decl
, "weak declaration of `%s' must precede definition");
4736 else if (SUPPORTS_WEAK
)
4737 DECL_WEAK (decl
) = 1;
4738 #ifdef HANDLE_PRAGMA_WEAK
4739 add_weak (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)), NULL
);
4743 /* Emit any pending weak declarations. */
4745 #ifdef HANDLE_PRAGMA_WEAK
4746 struct weak_syms
* weak_decls
;
4752 #ifdef HANDLE_PRAGMA_WEAK
4753 if (HANDLE_PRAGMA_WEAK
)
4755 struct weak_syms
*t
;
4756 for (t
= weak_decls
; t
; t
= t
->next
)
4760 ASM_WEAKEN_LABEL (asm_out_file
, t
->name
);
4762 ASM_OUTPUT_DEF (asm_out_file
, t
->name
, t
->value
);
4769 /* Remove NAME from the pending list of weak symbols. This prevents
4770 the compiler from emitting multiple .weak directives which confuses
4772 #ifdef ASM_WEAKEN_LABEL
4774 remove_from_pending_weak_list (name
)
4775 const char *name ATTRIBUTE_UNUSED
;
4777 #ifdef HANDLE_PRAGMA_WEAK
4778 if (HANDLE_PRAGMA_WEAK
)
4780 struct weak_syms
*t
;
4781 for (t
= weak_decls
; t
; t
= t
->next
)
4783 if (t
->name
&& strcmp (name
, t
->name
) == 0)
4792 assemble_alias (decl
, target
)
4793 tree decl
, target ATTRIBUTE_UNUSED
;
4797 make_decl_rtl (decl
, (char *) 0, 1);
4798 name
= XSTR (XEXP (DECL_RTL (decl
), 0), 0);
4800 #ifdef ASM_OUTPUT_DEF
4801 /* Make name accessible from other files, if appropriate. */
4803 if (TREE_PUBLIC (decl
))
4805 #ifdef ASM_WEAKEN_LABEL
4806 if (DECL_WEAK (decl
))
4808 ASM_WEAKEN_LABEL (asm_out_file
, name
);
4809 /* Remove this function from the pending weak list so that
4810 we do not emit multiple .weak directives for it. */
4811 remove_from_pending_weak_list
4812 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
4816 ASM_GLOBALIZE_LABEL (asm_out_file
, name
);
4819 #ifdef ASM_OUTPUT_DEF_FROM_DECLS
4820 ASM_OUTPUT_DEF_FROM_DECLS (asm_out_file
, decl
, target
);
4822 ASM_OUTPUT_DEF (asm_out_file
, name
, IDENTIFIER_POINTER (target
));
4824 TREE_ASM_WRITTEN (decl
) = 1;
4826 #ifdef ASM_OUTPUT_WEAK_ALIAS
4827 if (! DECL_WEAK (decl
))
4828 warning ("only weak aliases are supported in this configuration");
4830 ASM_OUTPUT_WEAK_ALIAS (asm_out_file
, name
, IDENTIFIER_POINTER (target
));
4831 TREE_ASM_WRITTEN (decl
) = 1;
4833 warning ("alias definitions not supported in this configuration; ignored");
4838 /* This determines whether or not we support link-once semantics. */
4839 #ifndef SUPPORTS_ONE_ONLY
4840 #ifdef MAKE_DECL_ONE_ONLY
4841 #define SUPPORTS_ONE_ONLY 1
4843 #define SUPPORTS_ONE_ONLY 0
4847 /* Returns 1 if the target configuration supports defining public symbols
4848 so that one of them will be chosen at link time instead of generating a
4849 multiply-defined symbol error, whether through the use of weak symbols or
4850 a target-specific mechanism for having duplicates discarded. */
4853 supports_one_only ()
4855 if (SUPPORTS_ONE_ONLY
)
4857 return SUPPORTS_WEAK
;
4860 /* Set up DECL as a public symbol that can be defined in multiple
4861 translation units without generating a linker error. */
4864 make_decl_one_only (decl
)
4867 if (TREE_CODE (decl
) != VAR_DECL
&& TREE_CODE (decl
) != FUNCTION_DECL
)
4870 TREE_PUBLIC (decl
) = 1;
4872 if (TREE_CODE (decl
) == VAR_DECL
4873 && (DECL_INITIAL (decl
) == 0 || DECL_INITIAL (decl
) == error_mark_node
))
4874 DECL_COMMON (decl
) = 1;
4875 else if (SUPPORTS_ONE_ONLY
)
4877 #ifdef MAKE_DECL_ONE_ONLY
4878 MAKE_DECL_ONE_ONLY (decl
);
4880 DECL_ONE_ONLY (decl
) = 1;
4882 else if (SUPPORTS_WEAK
)
4883 DECL_WEAK (decl
) = 1;
4891 const_str_htab
= htab_create (128, const_str_htab_hash
, const_str_htab_eq
,
4892 const_str_htab_del
);
4893 ggc_add_root (const_hash_table
, MAX_HASH_TABLE
, sizeof const_hash_table
[0],
4894 mark_const_hash_entry
);
4895 ggc_add_root (&const_str_htab
, 1, sizeof const_str_htab
,
4896 mark_const_str_htab
);
4897 ggc_add_string_root (&in_named_name
, 1);
4900 /* Extra support for EH values. */
4902 assemble_eh_label (name
)
4905 #ifdef ASM_OUTPUT_EH_LABEL
4906 ASM_OUTPUT_EH_LABEL (asm_out_file
, name
);
4908 assemble_label (name
);
4912 /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
4915 assemble_eh_align (align
)
4918 #ifdef ASM_OUTPUT_EH_ALIGN
4919 if (align
> BITS_PER_UNIT
)
4920 ASM_OUTPUT_EH_ALIGN (asm_out_file
, floor_log2 (align
/ BITS_PER_UNIT
));
4922 assemble_align (align
);
4927 /* On some platforms, we may want to specify a special mechansim to
4928 output EH data when generating with a function.. */
4930 assemble_eh_integer (x
, size
, force
)
4938 #ifdef ASM_OUTPUT_EH_CHAR
4940 ASM_OUTPUT_EH_CHAR (asm_out_file
, x
);
4944 #ifdef ASM_OUTPUT_EH_SHORT
4946 ASM_OUTPUT_EH_SHORT (asm_out_file
, x
);
4950 #ifdef ASM_OUTPUT_EH_INT
4952 ASM_OUTPUT_EH_INT (asm_out_file
, x
);
4956 #ifdef ASM_OUTPUT_EH_DOUBLE_INT
4958 ASM_OUTPUT_EH_DOUBLE_INT (asm_out_file
, x
);
4965 return (assemble_integer (x
, size
, force
));