This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Regimplification enhancements 1/3
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 16 Jun 2014 13:24:52 +0200
- Subject: Re: Regimplification enhancements 1/3
- Authentication-results: sourceware.org; auth=none
- References: <539ECD65 dot 40405 at codesourcery dot com>
On Mon, Jun 16, 2014 at 12:56 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> For the ptx port, I've needed to write a new pass which ensures all objects
> go into address spaces as required by the machine. This uses the
> regimplification code in gimplify-me.c, and that requires some fixes and
> upgrades.
Can you explain how and why you need re-gimplification here? IMHO
you should apply the necessary steps yourself, not put in GENERIC
into GIMPLE and rely on the gimplifier.
> Here's the first. When address spaces change, an ADDR_EXPR may have to be
> changed to ADDR_SPACE_CONVERT_EXPR, and these two have different
> representations in gimple. This patch stops the regimplification code from
> creating invalid gimple in such a case.
>
> Bootstrapped and tested on x86_64-linux, ok?
+ if (is_gimple_assign (stmt)
+ && num_ops == 2
+ && (get_gimple_rhs_class (gimple_expr_code (stmt))
+ == GIMPLE_SINGLE_RHS)
+ && (get_gimple_rhs_class (TREE_CODE (gimple_op (stmt, 1)))
+ != GIMPLE_SINGLE_RHS))
err ... that's a very crappy gimple condition that isn't going to reliably work.
You can't turn a x = &foo; into x = (convert)&foo; this way abusing
the re-gimplification routines.
The re-gimplification routines do _not_ accept random GENERIC
operands. They were written to handle registers becoming non-registers
and nothing more.
Richard.
>
> Bernd