This adds a virual_operand_p predicate and uses it where we currently use the bit on the decl (VAR_DECL_IS_VIRTUAL_OPERAND) directly. I suspect most of the is_gimple_reg users in SSA optimizers can be replaced by this predicate eventually making is_gimple_reg a private predicate to the gimplifier ...
Bootstrap & regtest pending on x86_64-unknown-linux-gnu. Richard. 2012-08-08 Richard Guenther <rguent...@suse.de> * tree-ssa-operands.h (virtual_operand_p): Declare. * tree-ssa-operands.c (virtual_operand_p): New predicate. * gimple.c (is_gimple_reg): Use virtual_operand_p. * tree-into-ssa.c (prepare_block_for_update): Likewise. * tree-vect-loop-manip.c (adjust_debug_stmts): Likewise. Index: gcc/gimple.c =================================================================== *** gcc/gimple.c (revision 190226) --- gcc/gimple.c (working copy) *************** is_gimple_id (tree t) *** 2782,2800 **** bool is_gimple_reg (tree t) { ! if (TREE_CODE (t) == SSA_NAME) ! { ! t = SSA_NAME_VAR (t); ! if (TREE_CODE (t) == VAR_DECL ! && VAR_DECL_IS_VIRTUAL_OPERAND (t)) ! return false; ! return true; ! } ! ! if (TREE_CODE (t) == VAR_DECL ! && VAR_DECL_IS_VIRTUAL_OPERAND (t)) return false; if (!is_gimple_variable (t)) return false; --- 2782,2793 ---- bool is_gimple_reg (tree t) { ! if (virtual_operand_p (t)) return false; + if (TREE_CODE (t) == SSA_NAME) + return true; + if (!is_gimple_variable (t)) return false; Index: gcc/tree-into-ssa.c =================================================================== *** gcc/tree-into-ssa.c (revision 190226) --- gcc/tree-into-ssa.c (working copy) *************** prepare_block_for_update (basic_block bb *** 2548,2561 **** gimple phi = gsi_stmt (si); tree lhs_sym, lhs = gimple_phi_result (phi); - lhs_sym = DECL_P (lhs) ? lhs : SSA_NAME_VAR (lhs); - if (TREE_CODE (lhs) == SSA_NAME ! && (TREE_CODE (lhs_sym) != VAR_DECL ! || !VAR_DECL_IS_VIRTUAL_OPERAND (lhs_sym) ! || !cfun->gimple_df->rename_vops)) continue; mark_for_renaming (lhs_sym); mark_def_interesting (lhs_sym, phi, bb, insert_phi_p); --- 2568,2579 ---- gimple phi = gsi_stmt (si); tree lhs_sym, lhs = gimple_phi_result (phi); if (TREE_CODE (lhs) == SSA_NAME ! && (! virtual_operand_p (lhs) ! || ! cfun->gimple_df->rename_vops)) continue; + lhs_sym = DECL_P (lhs) ? lhs : SSA_NAME_VAR (lhs); mark_for_renaming (lhs_sym); mark_def_interesting (lhs_sym, phi, bb, insert_phi_p); Index: gcc/tree-ssa-operands.c =================================================================== *** gcc/tree-ssa-operands.c (revision 190226) --- gcc/tree-ssa-operands.c (working copy) *************** debug_immediate_uses_for (tree var) *** 1432,1437 **** --- 1421,1444 ---- } + /* Return true if OP, an SSA name or a DECL is a virtual operand. */ + + bool + virtual_operand_p (tree op) + { + if (TREE_CODE (op) == SSA_NAME) + { + op = SSA_NAME_VAR (op); + if (!op) + return false; + } + + if (TREE_CODE (op) == VAR_DECL) + return VAR_DECL_IS_VIRTUAL_OPERAND (op); + + return false; + } + /* Unlink STMTs virtual definition from the IL by propagating its use. */ void Index: gcc/tree-ssa-operands.h =================================================================== *** gcc/tree-ssa-operands.h (revision 190226) --- gcc/tree-ssa-operands.h (working copy) *************** extern void debug_decl_set (bitmap); *** 116,121 **** --- 116,122 ---- extern bool ssa_operands_active (void); + extern bool virtual_operand_p (tree); extern void unlink_stmt_vdef (gimple); enum ssa_op_iter_type { Index: gcc/tree-vect-loop-manip.c =================================================================== *** gcc/tree-vect-loop-manip.c (revision 190226) --- gcc/tree-vect-loop-manip.c (working copy) *************** adjust_debug_stmts (tree from, tree to, *** 205,212 **** { adjust_info ai; ! if (MAY_HAVE_DEBUG_STMTS && TREE_CODE (from) == SSA_NAME ! && SSA_NAME_VAR (from) != gimple_vop (cfun)) { ai.from = from; ai.to = to; --- 205,213 ---- { adjust_info ai; ! if (MAY_HAVE_DEBUG_STMTS ! && TREE_CODE (from) == SSA_NAME ! && ! virtual_operand_p (from)) { ai.from = from; ai.to = to;