|
replace_lambda_call returns the fully-substituted lambda expression from LAMBDA_CALL expression e.
... patterns for LAMBDA_CALL replacement
... Retrieve parameters from argument
... Reinvoke recursive search on the parameter expression
... Set up list to collect data
... Collect lambda formals from lambda expression, grabbing lambda ... expression out of its containing list
... Define the argument map
... Define the list of precalculated ID node prototypes
... Set the initial argument reference number
... Iterate over the LAMBDA_CALL's parameter expression (which may ... have been changed by earlier LAMBDA_CALLs)
... Grab corresponding arguments from collect_pair to ... formal_list
... Find correct actual parameter
... Handle actual parameter cases
... Handle constant and ID actual parameters. Insert ... reference to actual parameter into argument map
... If there is more than one formal reference to ... parameter, or there is only one non-strict ... reference which is not side-effect free, ... precalculate parameter.
... Precalculate parameter, getting an ID node in ... return
... Put ID node on owning list (for later cleanup)
... Insert reference to ID node prototype into ... argument map.
... Insert reference to actual parameter into ... argument map.
... Increment argument number
... Substitute all arguments in lambda expression. Use preorder search, ... a wildcard which matches on ArgNumberExprs and LambdaCallExprs, and ... non-recursion.
... Simplification is too dangerous here when inlining (where not ... all variables with the same name are the same!) ... If this is a statement function call, simplify fully-substituted ... lambda expression before return and put parentheses around the ... expression to prevent inadvertant call-by-reference access
Definition at line 349 of file lambda_util.cc.
References AND_OP, Expression::arg_list(), BinaryExpr::arg_list(), ARG_OP, List< T >::assign(), Expression::clone(), collect_lambda_formals(), COMPLEX_OP, Expression::data(), e, List< T >::entries(), Expression::expr_guarded(), get_precalc(), ID_OP, RefDatabase< S, T >::ins(), List< T >::ins_last(), INTEGER_CONSTANT_OP, Expression::is_side_effect_free(), LAMBDA_CALL_OP, LambdaInfo::lc_type, CollectPair::list, MULT_OP, NON_RECURSIVE_REPLACE, NON_STRICT, Expression::op(), OR_OP, LambdaCallExpr::parameters_guarded(), LambdaCallExpr::parameters_valid(), PAREN_OP, CollectPair::pattern, PREORDER_REPLACE, StmtInfo::program_ref, List< T >::pull(), REAL_CONSTANT_OP, RECURSIVE_REPLACE, replace(), replace_lambda_call(), replace_lambda_call_expr(), simplify(), STMT_FUNCTION_CALL, StmtInfo::stmt_ref, traverse(), Expression::type(), and List< T >::valid().
Referenced by remove_lambda_calls(), and replace_lambda_call(). |