aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-07-31 20:37:40 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-07-31 20:37:40 -0400
commit40209195282377a7254ebbd80d5f55595d92d458 (patch)
tree79a4e2f422d448416597a92bb623f91759bfe6b8 /gcc/stmt.c
parent2598550fa6d3583ce066a9aaf5abfa4acd186077 (diff)
downloadgcc-40209195282377a7254ebbd80d5f55595d92d458.zip
gcc-40209195282377a7254ebbd80d5f55595d92d458.tar.gz
gcc-40209195282377a7254ebbd80d5f55595d92d458.tar.bz2
Makefile.in (bubblestrap): Don't require a previous full bootstrap.
* Makefile.in (bubblestrap): Don't require a previous full bootstrap. * expr.c (mostly_zeros_p): No longer static. * tree.h: Declare it. * stmt.c (resolve_asm_operand_names): Don't copy the pattern unless we need to do substitutions. From-SVN: r70031
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index a4900ec..8166187 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1992,13 +1992,14 @@ resolve_asm_operand_names (tree string, tree outputs, tree inputs)
{
char *buffer;
char *p;
+ const char *c;
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)));
+ c = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
if (strchr (c, '[') != NULL)
{
p = buffer = xstrdup (c);
@@ -2010,31 +2011,48 @@ resolve_asm_operand_names (tree string, tree outputs, tree inputs)
}
}
- 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 = xstrdup (TREE_STRING_POINTER (string));
- while ((p = strchr (p, '%')) != NULL)
+ /* Now check for any needed substitutions in the template. */
+ c = TREE_STRING_POINTER (string);
+ while ((c = strchr (c, '%')) != NULL)
{
- if (p[1] == '[')
- p += 1;
- else if (ISALPHA (p[1]) && p[2] == '[')
- p += 2;
+ if (c[1] == '[')
+ break;
+ else if (ISALPHA (c[1]) && c[2] == '[')
+ break;
else
{
- p += 1;
+ c += 1;
continue;
}
-
- p = resolve_operand_name_1 (p, outputs, inputs);
}
- string = build_string (strlen (buffer), buffer);
- free (buffer);
+ if (c)
+ {
+ /* OK, we need to make a copy so we can perform the substitutions.
+ Assume that we will not need extra space--we get to remove '['
+ and ']', which means we cannot have a problem until we have more
+ than 999 operands. */
+ buffer = xstrdup (TREE_STRING_POINTER (string));
+ p = buffer + (c - TREE_STRING_POINTER (string));
+
+ while ((p = strchr (p, '%')) != NULL)
+ {
+ if (p[1] == '[')
+ p += 1;
+ else if (ISALPHA (p[1]) && p[2] == '[')
+ p += 2;
+ else
+ {
+ p += 1;
+ continue;
+ }
+
+ p = resolve_operand_name_1 (p, outputs, inputs);
+ }
+
+ string = build_string (strlen (buffer), buffer);
+ free (buffer);
+ }
return string;
}