Jakub Jelinek <ja...@redhat.com> writes: > Hi! > > Right now, stmt.c on constraints not hardcoded in it, and not > define_{register,address,memory}_constraint just assumes the > constraint might allow both reg and mem. Unfortunately, on some > constraints which clearly can't allow either of those leads to errors > at -O0, because the expander doesn't try so hard to expand it as > EXPAND_INITIALIZER. > > The following patch is an attempt to handle at least the easy cases > - define_constraint like: > (define_constraint "S" > "A constraint that matches an absolute symbolic address." > (and (match_code "const,symbol_ref,label_ref") > (match_test "aarch64_symbolic_address_p (op)"))) > where the match_code clearly proves that it never can match any REG/SUBREG, > nor MEM, by teaching genpreds.c to emit an extra inline function that > stmt.c can in process_{output,input}_constraint use for the unknown > constraints. > > On x86_64/i686 this only detects constraint G as not allowing reg nor mem > (it is match_code const_double), and V (plus < and >, but those are > hardcoded in stmt.c already) that it allows mem but not reg. > On aarch64, in the first category it detects several constraints.
Thanks for doing this. How about reusing compute_predicate_codes from gensupport.c? It'd be good to have a single function that understands how to get codes from both predicate and constraint expressions rather than have slightly different logic for the two. Richard