stmt.c (resolve_asm_operand_names): Rename from resolve_operand_names.
authorJason Merrill <jason@redhat.com>
Fri, 6 Jun 2003 17:03:32 +0000 (13:03 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 6 Jun 2003 17:03:32 +0000 (13:03 -0400)
        * stmt.c (resolve_asm_operand_names): Rename from
        resolve_operand_names.  No longer static.  Avoid needless copying.
        Don't build array of constraints.
        (expand_asm_operands): Build it here.
        * tree.h: Declare resolve_asm_operand_names.

        * stmt.c (expand_decl): Put artificial vars into registers even
        when not optimizing, and don't mark the regs as user vars.

From-SVN: r67556

gcc/ChangeLog
gcc/stmt.c
gcc/tree.h

index a41970b44c61723bbc004f1c53ea4d0b9a43bb2b..f6747880cf17e38f8c4949956f1911cb622e7983 100644 (file)
@@ -1,3 +1,14 @@
+2003-06-06  Jason Merrill  <jason@redhat.com>
+
+       * stmt.c (resolve_asm_operand_names): Rename from
+       resolve_operand_names.  No longer static.  Avoid needless copying.
+       Don't build array of constraints.
+       (expand_asm_operands): Build it here.
+       * tree.h: Declare resolve_asm_operand_names.
+
+       * stmt.c (expand_decl): Put artificial vars into registers even
+       when not optimizing, and don't mark the regs as user vars.
+
 2003-06-06  J"orn Rennecke <joern.rennecke@superh.com>
 
        * sh.h (FUNCTION_ARG_1): Consistently use NEW_MODE for the mode
index fa87140fe48afc9c768d65e284ddea32e3591d81..f8942adea8a886c04663244f80f6571e3c44a462 100644 (file)
@@ -404,8 +404,6 @@ static void fixup_gotos                     PARAMS ((struct nesting *, rtx, tree,
                                               rtx, int));
 static bool check_operand_nalternatives        PARAMS ((tree, tree));
 static bool check_unique_operand_names PARAMS ((tree, tree));
-static tree resolve_operand_names      PARAMS ((tree, tree, tree,
-                                                const char **));
 static char *resolve_operand_name_1    PARAMS ((char *, tree, tree));
 static void expand_null_return_1       PARAMS ((rtx));
 static enum br_predictor return_prediction PARAMS ((rtx));
@@ -1517,6 +1515,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
   HARD_REG_SET clobbered_regs;
   int clobber_conflict_found = 0;
   tree tail;
+  tree t;
   int i;
   /* Vector of RTX's of evaluated output operands.  */
   rtx *output_rtx = (rtx *) alloca (noutputs * sizeof (rtx));
@@ -1538,7 +1537,14 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
   if (! check_unique_operand_names (outputs, inputs))
     return;
 
-  string = resolve_operand_names (string, outputs, inputs, constraints);
+  string = resolve_asm_operand_names (string, outputs, inputs);
+
+  /* Collect constraints.  */
+  i = 0;
+  for (t = outputs; t ; t = TREE_CHAIN (t), i++)
+    constraints[i] = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
+  for (t = inputs; t ; t = TREE_CHAIN (t), i++)
+    constraints[i] = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
 
 #ifdef MD_ASM_CLOBBERS
   /* Sometimes we wish to automatically clobber registers across an asm.
@@ -2032,21 +2038,37 @@ check_unique_operand_names (outputs, inputs)
    in *POUTPUTS and *PINPUTS to numbers, and replace the name expansions in
    STRING and in the constraints to those numbers.  */
 
-static tree
-resolve_operand_names (string, outputs, inputs, pconstraints)
-     tree string;
-     tree outputs, inputs;
-     const char **pconstraints;
+tree
+resolve_asm_operand_names (tree string, tree outputs, tree inputs)
 {
-  char *buffer = xstrdup (TREE_STRING_POINTER (string));
+  char *buffer;
   char *p;
   tree t;
 
+  /* Substitute [<name>] in input constraint strings.  There should be no
+     named operands in output constraints.  */
+  for (t = inputs; t ; t = TREE_CHAIN (t))
+    {
+      const char *c = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
+      if (strchr (c, '[') != NULL)
+       {
+         p = buffer = xstrdup (c);
+         while ((p = strchr (p, '[')) != NULL)
+           p = resolve_operand_name_1 (p, outputs, inputs);
+         TREE_VALUE (TREE_PURPOSE (t))
+           = build_string (strlen (buffer), buffer);
+         free (buffer);
+       }
+    }
+
+  if (strchr (TREE_STRING_POINTER (string), '[') == NULL)
+    return string;
+
   /* Assume that we will not need extra space to perform the substitution.
      This because we get to remove '[' and ']', which means we cannot have
      a problem until we have more than 999 operands.  */
 
-  p = buffer;
+  p = buffer = xstrdup (TREE_STRING_POINTER (string));
   while ((p = strchr (p, '%')) != NULL)
     {
       if (p[1] == '[')
@@ -2065,29 +2087,6 @@ resolve_operand_names (string, outputs, inputs, pconstraints)
   string = build_string (strlen (buffer), buffer);
   free (buffer);
 
-  /* Collect output constraints here because it's convenient.
-     There should be no named operands here; this is verified
-     in expand_asm_operand.  */
-  for (t = outputs; t ; t = TREE_CHAIN (t), pconstraints++)
-    *pconstraints = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
-
-  /* Substitute [<name>] in input constraint strings.  */
-  for (t = inputs; t ; t = TREE_CHAIN (t), pconstraints++)
-    {
-      const char *c = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
-      if (strchr (c, '[') == NULL)
-       *pconstraints = c;
-      else
-       {
-         p = buffer = xstrdup (c);
-         while ((p = strchr (p, '[')) != NULL)
-           p = resolve_operand_name_1 (p, outputs, inputs);
-
-         *pconstraints = ggc_alloc_string (buffer, -1);
-         free (buffer);
-       }
-    }
-
   return string;
 }
 
@@ -3940,7 +3939,7 @@ expand_decl (decl)
                && TREE_CODE (type) == REAL_TYPE)
           && ! TREE_THIS_VOLATILE (decl)
           && ! DECL_NONLOCAL (decl)
-          && (DECL_REGISTER (decl) || optimize))
+          && (DECL_REGISTER (decl) || DECL_ARTIFICIAL (decl) || optimize))
     {
       /* Automatic variable that can go in a register.  */
       int unsignedp = TREE_UNSIGNED (type);
@@ -3949,7 +3948,8 @@ expand_decl (decl)
 
       SET_DECL_RTL (decl, gen_reg_rtx (reg_mode));
 
-      mark_user_reg (DECL_RTL (decl));
+      if (!DECL_ARTIFICIAL (decl))
+       mark_user_reg (DECL_RTL (decl));
 
       if (POINTER_TYPE_P (type))
        mark_reg_pointer (DECL_RTL (decl),
index 446e42fa5a834d7444ab23be437fa8ddc1a3aa89..f40ddbe9be07275f8e330559658949075c8d5ac6 100644 (file)
@@ -2920,6 +2920,7 @@ extern bool parse_output_constraint     PARAMS ((const char **,
                                                 bool *, bool *, bool *));
 extern void expand_asm_operands                PARAMS ((tree, tree, tree, tree, int,
                                                 const char *, int));
+extern tree resolve_asm_operand_names (tree, tree, tree);
 extern int any_pending_cleanups                PARAMS ((int));
 extern void init_stmt_for_function     PARAMS ((void));
 extern void expand_start_target_temps  PARAMS ((void));