On Wed, Apr 08, 2015 at 11:00:59PM +0200, Jakub Jelinek wrote:
> 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.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2015-04-08  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR target/65689
>       * genpreds.c (struct constraint_data): Add maybe_allows_reg and
>       maybe_allows_mem bitfields.
>       (maybe_allows_none_start, maybe_allows_none_end,
>       maybe_allows_reg_start, maybe_allows_reg_end, maybe_allows_mem_start,
>       maybe_allows_mem_end): New variables.
>       (compute_maybe_allows): New function.
>       (add_constraint): Use it to initialize maybe_allows_reg and
>       maybe_allows_mem fields.
>       (choose_enum_order): Sort the non-is_register/is_const_int/is_memory/
>       is_address constraints such that those that allow neither mem nor
>       reg come first, then those that only allow reg but not mem, then
>       those that only allow mem but not reg, then the rest.
>       (write_allows_reg_mem_function): New function.
>       (write_tm_preds_h): Call it.
>       * stmt.c (parse_output_constraint, parse_input_constraint): Use
>       the generated insn_extra_constraint_allows_reg_mem function
>       instead of always setting *allows_reg = true; *allows_mem = true;
>       for unknown extra constraints.

Hi Jakub,

This applies clean to gcc-5-branch. I've bootstrapped and tested it on
x86_64-none-linux-gnu, aarch64-none-linux-gnu and arm-none-linux-gnueabihf
with no problems.

Is this OK to commit to gcc-5-branch so I can close out PR 65689?

Thanks,
James

Reply via email to