This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Macros taking a function as argument - and evaluating it at least twice

On Wed, Nov 13, 2013 at 12:30 AM, Steven Bosscher <> wrote:
> Hello,
> Here is a non-comprehensive list of macros that are used with a
> function passed to the macro's argument, and the macro evaluates that
> argument at least twice:
> gimple.c:          && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (gs))
> gimple-ssa-strength-reduction.c:      || !CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (gs)))
> ipa-prop.c:      && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def)))
> tree-inline.c:            || CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (stmt)));
> tree-ssa-dom.c:           && CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (defstmt)))
> tree-ssa-forwprop.c:  if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code
> (def_stmt)))
> tree-ssa-forwprop.c:      || !CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (def_stmt)))
> tree-ssa-ifcombine.c:     && CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (def_stmt)))
> tree-ssa-ifcombine.c:        && ((CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (stmt))
> tree-ssa-loop-im.c:  if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt1)))
> tree-stdarg.c:                || CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (stmt))
> tree-vect-patterns.c:  if (!CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (*def_stmt)))
> tree-vect-patterns.c:  if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code
> (use_stmt)))
> tree-vect-patterns.c:      && CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (use_stmt))
> tree-vrp.c:       if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))
> tree-vrp.c:               if (!CONVERT_EXPR_CODE_P
> (gimple_assign_rhs_code (def_stmt2))
> tree-vrp.c:  else if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (op_def)))
> tree-vrp.c:       || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt2))
> tree-vrp.c:       || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
> tree-vrp.c:      || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
> tree-outof-ssa.c:      && FLOAT_TYPE_P (gimple_expr_type (stmt)))
> tree-ssa-ccp.c:           && (INTEGRAL_TYPE_P (gimple_expr_type (stmt))
> tree-chrec.c:  if (POINTER_TYPE_P (chrec_type (poly0)))
> tree-chrec.c:  if (POINTER_TYPE_P (chrec_type (chrec)))
> tree-ssa-ccp.c:               || POINTER_TYPE_P (gimple_expr_type (stmt))))
> tree-ssa-structalias.c:             && !(POINTER_TYPE_P (gimple_expr_type (t))
> Not sure what to do about them (if anything) but I don't think this is
> intended...

I'd say refactor the code ... either at the uses or by turning the
macros into inline functions (I know that's what other people think
should happen to all macros in GCC).  Refactoring the uses may
end up in uglier code like

    || (tem = gimple_assign_rhs_code (def_stmt),
        !CONVERT_EXPR_CODE_P (tem))

(there was even a way to have tem declared at that point in C++...)


> Ciao!
> Steven

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]