/* Prototypes of target machine for GNU compiler. MIPS version.
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Contributed by A. Lichnewsky (lich@inria.inria.fr).
Changed by Michael Meissner (meissner@osf.org).
64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and
extern const char * current_section_name PARAMS ((void));
extern unsigned int current_section_flags PARAMS ((void));
extern int mips_can_use_return_insn PARAMS ((void));
-extern void mips_declare_object PARAMS ((FILE *, const char *,
- const char *,
- const char *, int));
+extern void mips_output_aligned_decl_common
+ PARAMS ((FILE *, tree, const char *,
+ unsigned HOST_WIDE_INT,
+ unsigned int));
+extern void mips_declare_object
+ PARAMS ((FILE *, const char *, const char *,
+ const char *, ...));
extern void mips_expand_epilogue PARAMS ((void));
extern void mips_expand_prologue PARAMS ((void));
extern void mips_output_filename PARAMS ((FILE *, const char *));
/* Subroutines for insn-output.c for MIPS
Copyright (C) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
Contributed by A. Lichnewsky, lich@inria.inria.fr.
Changes by Michael Meissner, meissner@osf.org.
64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
fatal_io_error ("can't close temp file");
}
-/* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
- is used, so that we don't emit an .extern for it in mips_asm_file_end. */
+/* Implement ASM_OUTPUT_ALIGNED_DECL_COMMON. This is usually the same as
+ the elfos.h version, but we also need to handle -muninit-const-in-rodata
+ and the limitations of the SGI o32 assembler. */
void
-mips_declare_object (stream, name, init_string, final_string, size)
+mips_output_aligned_decl_common (stream, decl, name, size, align)
FILE *stream;
+ tree decl;
const char *name;
- const char *init_string;
- const char *final_string;
- int size;
+ unsigned HOST_WIDE_INT size;
+ unsigned int align;
{
- fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */
+ const char *format;
+
+ /* If the target wants uninitialized const declarations in
+ .rdata then don't put them in .comm. */
+ if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA
+ && TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl)
+ && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
+ {
+ if (TREE_PUBLIC (decl) && DECL_NAME (decl))
+ targetm.asm_out.globalize_label (stream, name);
+
+ readonly_data_section ();
+ ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
+
+ format = ACONCAT ((":\n\t.space\t", HOST_WIDE_INT_PRINT_UNSIGNED,
+ "\n", NULL));
+ mips_declare_object (stream, name, "", format, size);
+ }
+#ifdef TARGET_IRIX6
+ /* The SGI o32 assembler doesn't accept an alignment, so round up
+ the size instead. */
+ else if (mips_abi == ABI_32 && !TARGET_GAS)
+ {
+ size += (align / BITS_PER_UNIT) - 1;
+ size -= size % (align / BITS_PER_UNIT);
+ format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, "\n", NULL));
+ mips_declare_object (stream, name, "\n\t.comm\t", format, size);
+ }
+#endif
+ else
+ {
+ format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, ",%u\n", NULL));
+ mips_declare_object (stream, name, "\n\t.comm\t", format,
+ size, align / BITS_PER_UNIT);
+ }
+}
+
+/* Emit either a label, .comm, or .lcomm directive. When using assembler
+ macros, mark the symbol as written so that mips_file_end won't emit an
+ .extern for it. STREAM is the output file, NAME is the name of the
+ symbol, INIT_STRING is the string that should be written before the
+ symbol and FINAL_STRING is the string that shoulbe written after it.
+ FINAL_STRING is a printf() format that consumes the remaining arguments. */
+
+void
+mips_declare_object VPARAMS ((FILE *stream, const char *name,
+ const char *init_string,
+ const char *final_string, ...))
+{
+ VA_OPEN (ap, final_string);
+ VA_FIXEDARG (ap, FILE *, stream);
+ VA_FIXEDARG (ap, const char *, name);
+ VA_FIXEDARG (ap, const char *, init_string);
+ VA_FIXEDARG (ap, const char *, final_string);
+
+ fputs (init_string, stream);
assemble_name (stream, name);
- fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */
+ vfprintf (stream, final_string, ap);
if (TARGET_GP_OPT)
{
tree name_tree = get_identifier (name);
TREE_ASM_WRITTEN (name_tree) = 1;
}
+
+ VA_CLOSE (ap);
}
\f
/* Return the bytes needed to compute the frame pointer from the current
/* Definitions of target machine for GNU compiler. MIPS version.
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
Contributed by A. Lichnewsky (lich@inria.inria.fr).
Changed by Michael Meissner (meissner@osf.org).
64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and
/* This says how to define a global common symbol. */
-#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
- do { \
- /* If the target wants uninitialized const declarations in \
- .rdata then don't put them in .comm */ \
- if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA \
- && TREE_CODE (DECL) == VAR_DECL && TREE_READONLY (DECL) \
- && (DECL_INITIAL (DECL) == 0 \
- || DECL_INITIAL (DECL) == error_mark_node)) \
- { \
- if (TREE_PUBLIC (DECL) && DECL_NAME (DECL)) \
- (*targetm.asm_out.globalize_label) (STREAM, NAME); \
- \
- readonly_data_section (); \
- ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
- mips_declare_object (STREAM, NAME, "", ":\n\t.space\t%u\n", \
- (SIZE)); \
- } \
- else \
- mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", \
- (SIZE)); \
- } while (0)
-
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON mips_output_aligned_decl_common
/* This says how to define a local common symbol (ie, not visible to
linker). */