On Mon, Jun 16, 2014 at 12:56 PM, Bernd Schmidt <ber...@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