GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "cgraph.h"
#include "pretty-print.h"
#include "fold-const.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-inline.h"
#include "langhooks.h"
#include "omp-general.h"
#include "omp-low.h"
#include "gimple-pretty-print.h"
#include "cfghooks.h"
#include "insn-config.h"
#include "recog.h"
#include "internal-fn.h"
#include "bitmap.h"
#include "tree-nested.h"
#include "stor-layout.h"
#include "tree-ssa-threadupdate.h"
#include "tree-into-ssa.h"
#include "splay-tree.h"
#include "target.h"
#include "cfgloop.h"
#include "tree-cfg.h"
#include "omp-offload.h"
#include "attribs.h"
#include "targhooks.h"
#include "diagnostic-core.h"
Data Structures | |
struct | parallel_g |
class | addr_range |
Macros | |
#define | GOMP_DIM_SEQ GOMP_DIM_MAX |
Typedefs | |
typedef hash_map< basic_block, gimple * > | bb_stmt_map_t |
typedef hash_map< tree, tree > | field_map_t |
typedef hash_map< tree, field_map_t > | record_field_map_t |
typedef hash_set< tree > | propagation_set |
typedef hash_map< basic_block, std::pair< unsigned HOST_WIDE_INT, bool > > | blk_offset_map_t |
typedef std::pair< int, tree > | idx_decl_pair_t |
typedef auto_vec< splay_tree > | used_range_vec_t |
Functions | |
static bool | local_var_based_p (tree decl) |
static bool | omp_sese_active_worker_call (gcall *call) |
static void | omp_sese_split_blocks (bb_stmt_map_t *map) |
static const char * | mask_name (unsigned mask) |
static void | omp_sese_dump_pars (parallel_g *par, unsigned depth) |
static parallel_g * | omp_sese_find_par (bb_stmt_map_t *map, parallel_g *par, basic_block block) |
static parallel_g * | omp_sese_discover_pars (bb_stmt_map_t *map) |
static void | populate_single_mode_bitmaps (parallel_g *par, bitmap worker_single, bitmap vector_single, unsigned outer_mask, int depth) |
static void | install_var_field (tree var, tree record_type, field_map_t *fields) |
static void | find_ssa_names_to_propagate (parallel_g *par, unsigned outer_mask, bitmap worker_single, bitmap vector_single, vec< propagation_set * > *prop_set) |
static tree | find_partitioned_var_uses_1 (tree *node, int *, void *data) |
static void | find_partitioned_var_uses (parallel_g *par, unsigned outer_mask, hash_set< tree > *partitioned_var_uses) |
static void | find_gang_private_vars (hash_set< tree > *gang_private_vars) |
static void | find_local_vars_to_propagate (parallel_g *par, unsigned outer_mask, hash_set< tree > *partitioned_var_uses, hash_set< tree > *gang_private_vars, bitmap writes_gang_private, vec< propagation_set * > *prop_set) |
static void | worker_single_simple (basic_block from, basic_block to, hash_set< tree > *def_escapes_block) |
static tree | build_receiver_ref (tree var, tree receiver_decl, field_map_t *fields) |
static tree | build_sender_ref (tree var, tree sender_decl, field_map_t *fields) |
static int | sort_by_ssa_version_or_uid (const void *p1, const void *p2) |
static int | sort_by_size_then_ssa_version_or_uid (const void *p1, const void *p2) |
static void | worker_single_copy (basic_block from, basic_block to, hash_set< tree > *def_escapes_block, hash_set< tree > *worker_partitioned_uses, tree record_type, record_field_map_t *record_field_map, unsigned HOST_WIDE_INT placement, bool isolate_broadcasts, bool has_gang_private_write) |
static void | neuter_worker_single (parallel_g *par, unsigned outer_mask, bitmap worker_single, bitmap vector_single, vec< propagation_set * > *prop_set, hash_set< tree > *partitioned_var_uses, record_field_map_t *record_field_map, blk_offset_map_t *blk_offset_map, bitmap writes_gang_private) |
static void | dfs_broadcast_reachable_1 (basic_block bb, sbitmap reachable) |
static int | sort_size_descending (const void *a, const void *b) |
static int | splay_tree_compare_addr_range (splay_tree_key a, splay_tree_key b) |
static void | splay_tree_free_key (splay_tree_key k) |
static addr_range | first_fit_range (splay_tree s, unsigned HOST_WIDE_INT size, unsigned HOST_WIDE_INT align, addr_range *bounds) |
static int | merge_ranges_1 (splay_tree_node n, void *ptr) |
static void | merge_ranges (splay_tree accum, splay_tree sp) |
static void | oacc_do_neutering (unsigned HOST_WIDE_INT bounds_lo, unsigned HOST_WIDE_INT bounds_hi) |
static int | execute_omp_oacc_neuter_broadcast () |
gimple_opt_pass * | make_pass_omp_oacc_neuter_broadcast (gcc::context *ctxt) |
#define GOMP_DIM_SEQ GOMP_DIM_MAX |
Referenced by omp_sese_active_worker_call().
typedef hash_map<basic_block, gimple *> bb_stmt_map_t |
Map of basic blocks to gimple stmts.
typedef hash_map<basic_block, std::pair<unsigned HOST_WIDE_INT, bool> > blk_offset_map_t |
typedef hash_map<tree, tree> field_map_t |
A map from SSA names or var decls to record fields.
typedef std::pair<int, tree> idx_decl_pair_t |
typedef hash_set<tree> propagation_set |
Sets of SSA_NAMES or VAR_DECLs to propagate.
typedef hash_map<tree, field_map_t> record_field_map_t |
For each propagation record type, this is a map from SSA names or var decls to propagate, to the field in the record type that should be used for transmission and reception.
typedef auto_vec<splay_tree> used_range_vec_t |
|
static |
References build_simple_mem_ref, fields, omp_build_component_ref(), and TREE_THIS_NOTRAP.
Referenced by worker_single_copy().
|
static |
References build_simple_mem_ref, fields, omp_build_component_ref(), POINTER_TYPE_P, and TREE_TYPE.
Referenced by worker_single_copy().
|
static |
References basic_block_def::aux, BB_VISITED, bitmap_set_bit, dfs_broadcast_reachable_1(), basic_block_def::flags, FOR_EACH_EDGE, basic_block_def::index, and basic_block_def::succs.
Referenced by dfs_broadcast_reachable_1(), and oacc_do_neutering().
|
static |
References as_a(), cfun, current_function_decl, DECL_ALIGN_UNIT, FOR_ALL_BB_FN, gcc_assert, gimple_call_arg(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_num_args(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, integer_minus_onep(), is_gimple_call(), MAX, oacc_do_neutering(), oacc_get_fn_dim_size(), offset, targetm, TREE_CODE, TREE_INT_CST_LOW, TREE_OPERAND, tree_to_uhwi(), TREE_TYPE, and TYPE_SIZE_UNIT.
Gang-private variables (typically placed in a GPU's shared memory) do not need to be processed by the worker-propagation mechanism. Populate the GANG_PRIVATE_VARS set with any such variables found in the current function.
References hash_set< KeyId, Lazy, Traits >::add(), cfun, FOR_EACH_BB_FN, gcc_assert, gimple_call_arg(), gimple_call_internal_p(), gimple_call_num_args(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, TREE_CODE, TREE_INT_CST_LOW, and TREE_OPERAND.
Referenced by oacc_do_neutering().
|
static |
References hash_set< KeyId, Lazy, Traits >::add(), AGGREGATE_TYPE_P, bitmap_set_bit, cfun, hash_set< KeyId, Lazy, Traits >::contains(), dump_file, find_local_vars_to_propagate(), FOR_EACH_LOCAL_DECL, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, basic_block_def::index, is_global_var(), mask_name(), print_generic_expr(), stmt_may_clobber_ref_p(), TDF_SLIM, TREE_TYPE, and VAR_P.
Referenced by find_local_vars_to_propagate(), and oacc_do_neutering().
|
static |
References find_partitioned_var_uses(), find_partitioned_var_uses_1(), gsi_end_p(), gsi_next(), gsi_start_bb(), NULL, and walk_gimple_stmt().
Referenced by find_partitioned_var_uses(), and oacc_do_neutering().
Callback for walk_gimple_stmt to find RHS VAR_DECLs (uses) in a statement.
References hash_set< KeyId, Lazy, Traits >::add(), NULL_TREE, and VAR_P.
Referenced by find_partitioned_var_uses().
|
static |
References hash_set< KeyId, Lazy, Traits >::add(), bitmap_bit_p, find_ssa_names_to_propagate(), FOR_EACH_PHI_ARG, FOR_EACH_SSA_USE_OPERAND, gimple_bb(), gimple_nop_p(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), basic_block_def::index, SSA_NAME_DEF_STMT, SSA_OP_USE, TREE_CODE, and USE_FROM_PTR.
Referenced by find_ssa_names_to_propagate(), and oacc_do_neutering().
|
static |
Referenced by oacc_do_neutering().
|
static |
References build_decl(), build_qualified_type(), BUILTINS_LOCATION, DECL_ALIGN, DECL_NAME, DECL_UID, DECL_USER_ALIGN, fields, gcc_assert, gcc_unreachable, get_identifier(), insert_field_into_struct(), POINTER_TYPE_P, record_type(), SET_DECL_ALIGN, SSA_NAME_IDENTIFIER, SSA_NAME_VERSION, TREE_CODE, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_ALIGN, TYPE_QUAL_RESTRICT, TYPE_QUALS, TYPE_RESTRICT, and VAR_P.
Referenced by oacc_do_neutering().
References is_global_var(), local_var_based_p(), TREE_CODE, and TREE_OPERAND.
Referenced by local_var_based_p(), and omp_sese_split_blocks().
gimple_opt_pass * make_pass_omp_oacc_neuter_broadcast | ( | gcc::context * | ctxt | ) |
|
static |
Referenced by find_local_vars_to_propagate(), and omp_sese_dump_pars().
|
static |
References merge_ranges_1().
Referenced by oacc_do_neutering().
|
static |
References addr_range::hi, addr_range::lo, MAX, MIN, and splay_tree_node< T >::value().
Referenced by merge_ranges().
|
static |
References hash_set< KeyId, Lazy, Traits >::add(), as_a(), basic_block_def::aux, hash_set< KeyId, Lazy, Traits >::begin(), bitmap_bit_p, builtin_decl_explicit(), cfun, hash_set< KeyId, Lazy, Traits >::contains(), hash_set< KeyId, Lazy, Traits >::end(), FOR_EACH_IMM_USE_STMT, FOR_EACH_SSA_NAME, gcc_assert, hash_map< KeyId, Value, Traits >::get(), gimple_bb(), gimple_build_call(), gimple_call_arg(), gimple_call_internal_p(), gimple_nop_p(), gsi_end_p(), gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, gsi_next(), GSI_SAME_STMT, gsi_start_bb(), gsi_stmt(), i, basic_block_def::index, neuter_worker_single(), offset, omp_sese_active_worker_call(), phi_nodes(), record_type(), SSA_NAME_DEF_STMT, SSA_NAME_IS_VIRTUAL_OPERAND, TREE_CODE, TREE_INT_CST_LOW, worker_single_copy(), and worker_single_simple().
Referenced by neuter_worker_single(), and oacc_do_neutering().
|
static |
References abort, basic_block_def::aux, BASIC_BLOCK_FOR_FN, hash_set< KeyId, Lazy, Traits >::begin(), bitmap_ior(), bitmap_set_bit, bitmap_vector_clear(), build_decl(), CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, conflicts, create_tmp_var_name(), current_function_decl, DECL_ARTIFICIAL, DECL_NAMELESS, dfs_broadcast_reachable_1(), dump_file, dump_flags, dump_function_to_file(), hash_set< KeyId, Lazy, Traits >::elements(), hash_map< KeyId, Value, Traits >::empty(), hash_set< KeyId, Lazy, Traits >::end(), error_at(), EXECUTE_IF_SET_IN_BITMAP, fields, find_gang_private_vars(), find_local_vars_to_propagate(), find_partitioned_var_uses(), find_ssa_names_to_propagate(), first_fit_range(), basic_block_def::flags, FOR_ALL_BB_FN, free_dominance_info(), gcc_checking_assert, hash_map< KeyId, Value, Traits >::get_or_insert(), i, basic_block_def::index, install_var_field(), integer_zerop(), addr_range::invalid(), last_basic_block_for_fn, layout_type(), LOOP_CLOSED_SSA, loops_state_clear(), lang_hooks_for_types::make_type, merge_ranges(), neuter_worker_single(), NULL, oacc_get_fn_attrib(), omp_sese_discover_pars(), omp_sese_split_blocks(), populate_single_mode_bitmaps(), hash_map< KeyId, Value, Traits >::put(), record_type(), sbitmap_vector_alloc(), sbitmap_vector_free(), sort_by_size_then_ssa_version_or_uid(), sort_size_descending(), splay_tree_compare_addr_range(), splay_tree_free_key(), TREE_CHAIN, TREE_PURPOSE, tree_to_uhwi(), TREE_VALUE, TYPE_ALIGN_UNIT, TYPE_ARTIFICIAL, TYPE_NAME, TYPE_SIZE_UNIT, lang_hooks::types, UNKNOWN_LOCATION, and vNULL.
Referenced by execute_omp_oacc_neuter_broadcast().
Calls to OpenACC routines are made by all workers/wavefronts/warps, since the routine likely contains partitioned loops (else will do its own neutering and variable propagation). Return TRUE if a function call CALL should be made in (worker) single mode instead, rather than redundant mode.
References gimple_call_fndecl(), GOMP_DIM_SEQ, oacc_fn_attrib_level(), and oacc_get_fn_attrib().
Referenced by neuter_worker_single(), and omp_sese_split_blocks().
|
static |
DFS walk the CFG looking for fork & join markers. Construct loop structures as we go. MAP is a mapping of basic blocks to head & tail markers, discovered when splitting blocks. This speeds up the discovery. We rely on the BB visited flag having been cleared when splitting blocks.
Adapted from 'gcc/config/nvptx/nvptx.cc:nvptx_discover_pars'.
References BB_VISITED, cfun, dump_file, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, map, omp_sese_dump_pars(), and omp_sese_find_par().
Referenced by oacc_do_neutering().
|
static |
Dump this parallel and all its inner parallels.
Adapted from 'gcc/config/nvptx/nvptx.cc:nvptx_dump_pars'.
References dump_file, basic_block_def::index, mask_name(), and omp_sese_dump_pars().
Referenced by omp_sese_discover_pars(), and omp_sese_dump_pars().
|
static |
If BLOCK contains a fork/join marker, process it to create or terminate a loop structure. Add this block to the current loop, and then walk successor blocks.
Adapted from 'gcc/config/nvptx/nvptx.cc:nvptx_find_par'.
References as_a(), BB_VISITED, basic_block_def::flags, FOR_EACH_EDGE, gcc_assert, gcc_unreachable, gimple_call_arg(), gimple_call_internal_p(), gimple_nop_p(), gsi_last_bb(), gsi_stmt(), is_gimple_assign(), map, omp_sese_find_par(), single_pred(), basic_block_def::succs, and TREE_INT_CST_LOW.
Referenced by omp_sese_discover_pars(), and omp_sese_find_par().
|
static |
Split basic blocks such that each forked and join unspecs are at the start of their basic blocks. Thus afterwards each block will have a single partitioning mode. We also do the same for return insns, as they are executed by every thread. Return the partitioning mode of the function as a whole. Populate MAP with head and tail blocks. We also clear the BB visited flag, which is used when finding partitions.
Adapted from 'gcc/config/nvptx/nvptx.cc:nvptx_split_blocks'.
References as_a(), boolean_false_node, boolean_type_node, cfun, basic_block_def::flags, FOR_ALL_BB_FN, gcc_assert, gimple_assign_lhs(), gimple_bb(), gimple_build_assign(), gimple_build_cond(), gimple_build_nop(), gimple_call_arg(), gimple_call_internal_p(), gimple_cond_false_label(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_true_label(), gimple_expr_code(), gsi_end_p(), gsi_for_stmt(), gsi_insert_before(), gsi_next(), gsi_one_before_end_p(), gsi_prev(), gsi_replace(), GSI_SAME_STMT, gsi_start_bb(), gsi_stmt(), is_gimple_assign(), local_var_based_p(), make_ssa_name(), map, omp_sese_active_worker_call(), single_succ(), split_block(), TREE_CODE, TREE_INT_CST_LOW, TREE_OPERAND, and worklist.
Referenced by oacc_do_neutering().
|
static |
References bitmap_set_bit, i, basic_block_def::index, and populate_single_mode_bitmaps().
Referenced by oacc_do_neutering(), and populate_single_mode_bitmaps().
|
static |
References sort_by_ssa_version_or_uid(), tree_to_uhwi(), TREE_TYPE, and TYPE_SIZE.
Referenced by oacc_do_neutering().
|
static |
References DECL_UID, SSA_NAME_VERSION, and TREE_CODE.
Referenced by sort_by_size_then_ssa_version_or_uid(), and worker_single_copy().
|
static |
References a, b, tree_to_uhwi(), and TYPE_SIZE_UNIT.
Referenced by oacc_do_neutering().
|
static |
References a, b, addr_range::hi, and addr_range::lo.
Referenced by oacc_do_neutering().
|
static |
Referenced by oacc_do_neutering().
|
static |
References add_phi_arg(), hash_set< KeyId, Lazy, Traits >::begin(), build_fold_addr_expr, build_int_cst(), build_receiver_ref(), build_sender_ref(), build_zero_cst(), builtin_decl_explicit(), char_type_node, hash_set< KeyId, Lazy, Traits >::contains(), create_new_def_for(), create_phi_node(), create_tmp_var, EDGE_COUNT, hash_set< KeyId, Lazy, Traits >::elements(), hash_set< KeyId, Lazy, Traits >::end(), fields, fold_convert, gcc_assert, gcc_unreachable, hash_map< KeyId, Value, Traits >::get(), gimple_build_assign(), gimple_build_call(), gimple_build_cond(), gimple_call_set_lhs(), gimple_nop_p(), gimple_phi_result_ptr(), gimple_seq_add_stmt(), gsi_after_labels(), GSI_CONTINUE_LINKING, gsi_insert_after(), gsi_insert_before(), gsi_insert_seq_after(), gsi_last_bb(), GSI_NEW_STMT, gsi_prev(), GSI_SAME_STMT, gsi_start_bb(), gsi_stmt(), i, last, profile_probability::likely(), make_edge(), make_ssa_name(), NULL, NULL_TREE, POINTER_TYPE_P, record_type(), single_succ_edge(), sort_by_ssa_version_or_uid(), split_block(), split_edge(), SSA_NAME_DEF_STMT, SSA_NAME_IS_VIRTUAL_OPERAND, basic_block_def::succs, targetm, TREE_CODE, TREE_TYPE, UNKNOWN_LOCATION, profile_probability::unlikely(), update_stmt(), and VAR_P.
Referenced by neuter_worker_single().
|
static |
Transform basic blocks FROM, TO (which may be the same block) into: if (GOACC_single_start ()) BLOCK; GOACC_barrier (); \ | / +----+ | | (new) predicate block +----+-- \ | / \ | / |t \ +----+ +----+ +----+ | | | | | ===> | | | f (old) from block +----+ +----+ +----+ | | t/ \f | / +----+/ (split (split before | | skip block at end) condition) +----+ t/ \f
References add_phi_arg(), boolean_true_node, build_zero_cst(), builtin_decl_explicit(), hash_set< KeyId, Lazy, Traits >::contains(), copy_ssa_name(), create_new_def_for(), create_phi_node(), create_tmp_var, EDGE_COUNT, fold_convert_loc(), FOR_EACH_SSA_TREE_OPERAND, gcc_assert, gimple_build_assign(), gimple_build_call(), gimple_build_cond(), gimple_call_set_lhs(), gimple_phi_result_ptr(), gsi_after_labels(), GSI_CONTINUE_LINKING, gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_last_bb(), GSI_NEW_STMT, gsi_next(), gsi_prev(), gsi_start_bb(), gsi_stmt(), profile_probability::likely(), make_edge(), NULL, NULL_TREE, single_succ_edge(), split_block(), split_edge(), SSA_OP_DEF, basic_block_def::succs, TREE_TYPE, UNKNOWN_LOCATION, and update_stmt().
Referenced by neuter_worker_single().