GCC Middle and Back End API Reference
tree-nrv.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "tree-pretty-print.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "internal-fn.h"
Include dependency graph for tree-nrv.cc:

Data Structures

struct  nrv_data_t
 

Functions

static tree finalize_nrv_r (tree *, int *, void *)
 
gimple_opt_passmake_pass_nrv (gcc::context *ctxt)
 
static bool dest_safe_for_nrv_p (gcall *call)
 
gimple_opt_passmake_pass_return_slot (gcc::context *ctxt)
 

Function Documentation

◆ dest_safe_for_nrv_p()

static bool dest_safe_for_nrv_p ( gcall * call)
static
Determine (pessimistically) whether DEST is available for NRV
optimization, where DEST is expected to be the LHS of a modify
expression where the RHS is a function returning an aggregate.

DEST is available if it is not clobbered or used by the call.   

References call_may_clobber_ref_p(), get_base_address(), gimple_call_lhs(), ref_maybe_used_by_stmt_p(), and TREE_CODE.

◆ finalize_nrv_r()

static tree finalize_nrv_r ( tree * tp,
int * walk_subtrees,
void * data )
static
Callback for the tree walker.

If TP refers to a RETURN_EXPR, then set the expression being returned
to nrv_data->result.

If TP refers to nrv_data->var, then replace nrv_data->var with
nrv_data->result.

If we reach a node where we know all the subtrees are uninteresting,
then set *WALK_SUBTREES to zero.   

References ggc_alloc(), NULL_TREE, and TYPE_P.

◆ make_pass_nrv()

gimple_opt_pass * make_pass_nrv ( gcc::context * ctxt)

References ggc_alloc().

◆ make_pass_return_slot()

gimple_opt_pass * make_pass_return_slot ( gcc::context * ctxt)

References ggc_alloc().