On Thu, Apr 09, 2015 at 12:20:40AM +0200, Jakub Jelinek wrote: > On Wed, Apr 08, 2015 at 05:16:08PM -0500, Segher Boessenkool wrote: > > On Wed, Apr 08, 2015 at 05:12:07PM -0500, Segher Boessenkool wrote: > > > On Wed, Apr 08, 2015 at 11:00:59PM +0200, Jakub Jelinek wrote: > > > > + case MATCH_CODE: > > > > + if (*XSTR (exp, 1) == '\0') > > > > + { > > > > + const char *code, *codes = XSTR (exp, 0); > > > > + int ret = 0; > > > > + while ((code = scan_comma_elt (&codes)) != 0) > > > > + if (strncmp (code, "reg", 3) == 0 > > > > + && (code[3] == ',' || code[3] == '\0' || code[3] == ' > > > > ')) > > > > > > This doesn't allow other whitespace. Maybe it's cleaner written as e.g. > > > > > > && codes - code == 3 > > > > ... and that doesn't handle trailing whitespace. Ugh. > > Yeah. Guess I should use > && (code[3] == ',' || code[3] == '\0' || ISSPACE (code[3])) > instead then.
Or another option is just to follow what genpreds.c uses earlier: || (!strstr (XSTR (exp, 0), "const_int") && !strstr (XSTR (exp, 0), "const_double"))) if (strstr (XSTR (exp, 0), "reg")) ret |= 1; if (strstr (XSTR (exp, 0), "mem")) ret |= 2; would match besides reg/subreg or mem also define_register_constraint or define_memory_constraint, but those surely won't appear in sane constraints.md (and even if they would, all we need is conservative test). Jakub