Commit 88a56c2e by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

md.texi (Simple Constraints): Add item about whitespace.

	* 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.

Co-Authored-By: Michael Meissner <meissner@cygnus.com>

From-SVN: r32008
parent 1efa676d
Wed Feb 16 15:04:49 2000 Hans-Peter Nilsson <hp@bitrange.com>
Michael Meissner <meissner@cygnus.com>
* 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.
2000-02-16 Alexandre Oliva <oliva@lsd.ic.unicamp.br> 2000-02-16 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* cpplib.c (do_line): Pedwarn for #line > 32767. * cpplib.c (do_line): Pedwarn for #line > 32767.
......
...@@ -104,6 +104,7 @@ struct obstack *rtl_obstack = &obstack; ...@@ -104,6 +104,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_free free #define obstack_chunk_free free
static int n_occurrences PARAMS ((int, char *)); static int n_occurrences PARAMS ((int, char *));
static void strip_whitespace PARAMS ((char *));
/* insns in the machine description are assigned sequential code numbers /* insns in the machine description are assigned sequential code numbers
that are used by insn-recog.c (produced by genrecog) to communicate 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) ...@@ -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].strict_low = this_strict_low;
d->operand[opno].predicate = XSTR (part, 1); d->operand[opno].predicate = XSTR (part, 1);
d->operand[opno].constraint = XSTR (part, 2); d->operand[opno].constraint = XSTR (part, 2);
if (XSTR (part, 2) != 0 && *XSTR (part, 2) != 0) if (XSTR (part, 2) != NULL && *XSTR (part, 2) != 0)
d->operand[opno].n_alternatives {
= n_occurrences (',', XSTR (part, 2)) + 1; 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].address_p = this_address_p;
d->operand[opno].eliminable = 1; d->operand[opno].eliminable = 1;
return; return;
...@@ -464,9 +468,12 @@ scan_operands (d, part, this_address_p, this_strict_low) ...@@ -464,9 +468,12 @@ scan_operands (d, part, this_address_p, this_strict_low)
d->operand[opno].strict_low = 0; d->operand[opno].strict_low = 0;
d->operand[opno].predicate = "scratch_operand"; d->operand[opno].predicate = "scratch_operand";
d->operand[opno].constraint = XSTR (part, 1); d->operand[opno].constraint = XSTR (part, 1);
if (XSTR (part, 1) != 0 && *XSTR (part, 1) != 0) if (XSTR (part, 1) != NULL && *XSTR (part, 1) != 0)
d->operand[opno].n_alternatives {
= n_occurrences (',', XSTR (part, 1)) + 1; 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].address_p = 0;
d->operand[opno].eliminable = 0; d->operand[opno].eliminable = 0;
return; return;
...@@ -969,3 +976,18 @@ n_occurrences (c, s) ...@@ -969,3 +976,18 @@ n_occurrences (c, s)
n += (*s++ == c); n += (*s++ == c);
return n; 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';
}
...@@ -665,6 +665,12 @@ which describes one kind of operand that is permitted. Here are ...@@ -665,6 +665,12 @@ which describes one kind of operand that is permitted. Here are
the letters that are allowed: the letters that are allowed:
@table @asis @table @asis
@item whitespace
Whitespace characters are ignored and can be inserted at any position
except the first. This enables each alternative for different operands to
be visually aligned in the machine description even if they have different
number of constraints and modifiers.
@cindex @samp{m} in constraint @cindex @samp{m} in constraint
@cindex memory references in constraints @cindex memory references in constraints
@item @samp{m} @item @samp{m}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment