diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-16 14:44:19 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-16 14:44:19 +0000 |
commit | 3f5cce54ec5bedc52923c49c72d146fda06120de (patch) | |
tree | f65654b8ee4287eb5ff18168ad859bb200b62378 /gcc/genoutput.c | |
parent | 27e517ecbe0b96ff17a05524efd95a931fc79b2d (diff) | |
download | gcc-3f5cce54ec5bedc52923c49c72d146fda06120de.tar.gz |
* md.texi (Simple Constraints): Add item about whitespace.
* genoutput.c (strip_whitespace): New.
(scan_operands) [MATCH_OPERAND, MATCH_SCRATCH]: Call
strip_whitespace for constraints.
Test pointer using NULL, not 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32008 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genoutput.c')
-rw-r--r-- | gcc/genoutput.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/gcc/genoutput.c b/gcc/genoutput.c index ecac9c96fa0..022d67637e7 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -104,6 +104,7 @@ struct obstack *rtl_obstack = &obstack; #define obstack_chunk_free free static int n_occurrences PARAMS ((int, char *)); +static void strip_whitespace PARAMS ((char *)); /* insns in the machine description are assigned sequential code numbers that are used by insn-recog.c (produced by genrecog) to communicate @@ -439,9 +440,12 @@ scan_operands (d, part, this_address_p, this_strict_low) d->operand[opno].strict_low = this_strict_low; d->operand[opno].predicate = XSTR (part, 1); d->operand[opno].constraint = XSTR (part, 2); - if (XSTR (part, 2) != 0 && *XSTR (part, 2) != 0) - d->operand[opno].n_alternatives - = n_occurrences (',', XSTR (part, 2)) + 1; + if (XSTR (part, 2) != NULL && *XSTR (part, 2) != 0) + { + strip_whitespace (XSTR (part, 2)); + d->operand[opno].n_alternatives + = n_occurrences (',', XSTR (part, 2)) + 1; + } d->operand[opno].address_p = this_address_p; d->operand[opno].eliminable = 1; return; @@ -464,9 +468,12 @@ scan_operands (d, part, this_address_p, this_strict_low) d->operand[opno].strict_low = 0; d->operand[opno].predicate = "scratch_operand"; d->operand[opno].constraint = XSTR (part, 1); - if (XSTR (part, 1) != 0 && *XSTR (part, 1) != 0) - d->operand[opno].n_alternatives - = n_occurrences (',', XSTR (part, 1)) + 1; + if (XSTR (part, 1) != NULL && *XSTR (part, 1) != 0) + { + strip_whitespace (XSTR (part, 1)); + d->operand[opno].n_alternatives + = n_occurrences (',', XSTR (part, 1)) + 1; + } d->operand[opno].address_p = 0; d->operand[opno].eliminable = 0; return; @@ -969,3 +976,18 @@ n_occurrences (c, s) n += (*s++ == c); return n; } + +/* Remove whitespace in `s' by moving up characters until the end. */ +static void +strip_whitespace (s) + char *s; +{ + char *p = s; + int ch; + + while ((ch = *s++) != '\0') + if (! ISSPACE (ch)) + *p++ = ch; + + *p = '\0'; +} |