GCC Middle and Back End API Reference
tree-switch-conversion.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "insn-codes.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "optabs-tree.h"
#include "cgraph.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "varasm.h"
#include "stor-layout.h"
#include "cfganal.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-fold.h"
#include "tree-cfg.h"
#include "cfgloop.h"
#include "alloc-pool.h"
#include "target.h"
#include "tree-into-ssa.h"
#include "omp-general.h"
#include "gimple-range.h"
#include "tree-cfgcleanup.h"
#include "hwint.h"
#include "internal-fn.h"
#include "diagnostic-core.h"
#include "langhooks.h"
#include "tree-switch-conversion.h"
Include dependency graph for tree-switch-conversion.cc:

Functions

static tree can_log2 (tree type, optimization_type opt_type)
 
static gimple_seq gen_log2 (tree op, location_t loc, tree *result, tree type)
 
static gimple_seq gen_pow2p (tree op, location_t loc, tree *result)
 
gimple_opt_passmake_pass_convert_switch (gcc::context *ctxt)
 
gimple_opt_passmake_pass_lower_switch_O0 (gcc::context *ctxt)
 
gimple_opt_passmake_pass_lower_switch (gcc::context *ctxt)
 

Function Documentation

◆ can_log2()

static tree can_log2 ( tree type,
optimization_type opt_type )
static
Does the target have optabs needed to efficiently compute exact base two
logarithm of a variable with type TYPE?

If yes, returns TYPE.  If no, returns NULL_TREE.  May also return another
type.  This indicates that logarithm of the variable can be computed but
only after it is converted to this type.

Also see gen_log2.   

References direct_internal_fn_supported_p(), integer_type_node, long_integer_type_node, long_long_integer_type_node, NULL_TREE, type(), and TYPE_PRECISION.

Referenced by tree_switch_conversion::switch_conversion::is_exp_index_transform_viable().

◆ gen_log2()

static gimple_seq gen_log2 ( tree op,
location_t loc,
tree * result,
tree type )
static
Assume that OP is a power of two.  Build a sequence of gimple statements
efficiently computing the base two logarithm of OP using special optabs.
Return the ssa name represeting the result of the logarithm through RESULT.

Before computing the logarithm, OP may have to be converted to another type.
This should be specified in TYPE.  Use can_log2 to decide what this type
should be.

Should only be used if can_log2 doesn't reject the type of OP.   

References build_one_cst(), gimple_build(), gimple_convert(), gsi_last(), GSI_NEW_STMT, NULL, and TREE_TYPE.

Referenced by tree_switch_conversion::switch_conversion::exp_index_transform().

◆ gen_pow2p()

static gimple_seq gen_pow2p ( tree op,
location_t loc,
tree * result )
static
Build a sequence of gimple statements checking that OP is a power of 2.
Return the result as a boolean_type_node ssa name through RESULT.  Assumes
that OP's value will be non-negative.  The generated check may give
arbitrary answer for negative values.   

References boolean_type_node, build_one_cst(), gimple_build(), gimple_convert(), gsi_last(), GSI_NEW_STMT, NULL, TREE_TYPE, types_compatible_p(), and unsigned_type_for().

Referenced by tree_switch_conversion::switch_conversion::exp_index_transform().

◆ make_pass_convert_switch()

gimple_opt_pass * make_pass_convert_switch ( gcc::context * ctxt)

◆ make_pass_lower_switch()

gimple_opt_pass * make_pass_lower_switch ( gcc::context * ctxt)

◆ make_pass_lower_switch_O0()

gimple_opt_pass * make_pass_lower_switch_O0 ( gcc::context * ctxt)