OSDN Git Service

2010-07-14 Mikael Morin <mikael@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / varasm.c
index 8ef41e3..55218c4 100644 (file)
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "hard-reg-set.h"
 #include "regs.h"
 #include "output.h"
+#include "diagnostic-core.h"
 #include "toplev.h"
 #include "hashtab.h"
 #include "ggc.h"
@@ -428,7 +429,7 @@ static int
 emutls_common_1 (void **loc, void *xstmts)
 {
   struct tree_map *h = *(struct tree_map **) loc;
-  tree args, x, *pstmts = (tree *) xstmts;
+  tree x, *pstmts = (tree *) xstmts;
   tree word_type_node;
 
   if (! DECL_COMMON (h->base.from)
@@ -442,17 +443,14 @@ emutls_common_1 (void **loc, void *xstmts)
      do this and there is an initializer, -fanchor_section loses,
      because it would be too late to ensure the template is
      output.  */
-  x = null_pointer_node;
-  args = tree_cons (NULL, x, NULL);
-  x = build_int_cst (word_type_node, DECL_ALIGN_UNIT (h->base.from));
-  args = tree_cons (NULL, x, args);
-  x = fold_convert (word_type_node, DECL_SIZE_UNIT (h->base.from));
-  args = tree_cons (NULL, x, args);
-  x = build_fold_addr_expr (h->to);
-  args = tree_cons (NULL, x, args);
-
   x = built_in_decls[BUILT_IN_EMUTLS_REGISTER_COMMON];
-  x = build_function_call_expr (UNKNOWN_LOCATION, x, args);
+  x = build_call_expr (x, 4,
+                      build_fold_addr_expr (h->to),
+                      fold_convert (word_type_node,
+                                    DECL_SIZE_UNIT (h->base.from)),
+                      build_int_cst (word_type_node,
+                                     DECL_ALIGN_UNIT (h->base.from)),
+                      null_pointer_node);
 
   append_to_statement_list (x, pstmts);
   return 1;
@@ -1864,7 +1862,7 @@ assemble_start_function (tree decl, const char *fnname)
   ASM_DECLARE_FUNCTION_NAME (asm_out_file, fnname, current_function_decl);
 #else
   /* Standard thing is just output label for the function.  */
-  ASM_OUTPUT_LABEL (asm_out_file, fnname);
+  ASM_OUTPUT_FUNCTION_LABEL (asm_out_file, fnname, current_function_decl);
 #endif /* ASM_DECLARE_FUNCTION_NAME */
 }
 
@@ -2152,6 +2150,9 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
   rtx decl_rtl, symbol;
   section *sect;
 
+  /* This function is supposed to handle VARIABLES.  Ensure we have one.  */
+  gcc_assert (TREE_CODE (decl) == VAR_DECL);
+
   if (! targetm.have_tls
       && TREE_CODE (decl) == VAR_DECL
       && DECL_THREAD_LOCAL_P (decl))
@@ -2190,12 +2191,6 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
   if (DECL_EXTERNAL (decl))
     return;
 
-  /* Output no assembler code for a function declaration.
-     Only definitions of functions output anything.  */
-
-  if (TREE_CODE (decl) == FUNCTION_DECL)
-    return;
-
   /* Do nothing for global register variables.  */
   if (DECL_RTL_SET_P (decl) && REG_P (DECL_RTL (decl)))
     {
@@ -5979,7 +5974,7 @@ maybe_assemble_visibility (tree decl)
 
   if (vis != VISIBILITY_DEFAULT)
     {
-      targetm.asm_out.visibility (decl, vis);
+      targetm.asm_out.assemble_visibility (decl, vis);
       return 1;
     }
   else
@@ -6905,11 +6900,11 @@ default_asm_declare_constant_name (FILE *file, const char *name,
 void
 default_file_start (void)
 {
-  if (targetm.file_start_app_off
+  if (targetm.asm_file_start_app_off
       && !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm))
     fputs (ASM_APP_OFF, asm_out_file);
 
-  if (targetm.file_start_file_directive)
+  if (targetm.asm_file_start_file_directive)
     output_file_directive (asm_out_file, main_input_filename);
 }
 
@@ -7199,50 +7194,11 @@ output_object_blocks (void)
 int
 elf_record_gcc_switches (print_switch_type type, const char * name)
 {
-  static char buffer[1024];
-
-  /* This variable is used as part of a simplistic heuristic to detect
-     command line switches which take an argument:
-
-       "If a command line option does not start with a dash then
-        it is an argument for the previous command line option."
-
-     This fails in the case of the command line option which is the name
-     of the file to compile, but otherwise it is pretty reasonable.  */
-  static bool previous_name_held_back = FALSE;
-
   switch (type)
     {
     case SWITCH_TYPE_PASSED:
-      if (* name != '-')
-       {
-         if (previous_name_held_back)
-           {
-             unsigned int len = strlen (buffer);
-
-             snprintf (buffer + len, sizeof buffer - len, " %s", name);
-             ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
-             ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
-             previous_name_held_back = FALSE;
-           }
-         else
-           {
-             strncpy (buffer, name, sizeof buffer);
-             ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
-             ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
-           }
-       }
-      else
-       {
-         if (previous_name_held_back)
-           {
-             ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
-             ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
-           }
-
-         strncpy (buffer, name, sizeof buffer);
-         previous_name_held_back = TRUE;
-       }
+      ASM_OUTPUT_ASCII (asm_out_file, name, strlen (name));
+      ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
       break;
 
     case SWITCH_TYPE_DESCRIPTIVE:
@@ -7251,15 +7207,7 @@ elf_record_gcc_switches (print_switch_type type, const char * name)
          /* Distinguish between invocations where name is NULL.  */
          static bool started = false;
 
-         if (started)
-           {
-             if (previous_name_held_back)
-               {
-                 ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
-                 ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
-               }
-           }
-         else
+         if (!started)
            {
              section * sec;