GCC Middle and Back End API Reference
tree-ssa-threadedge.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "predict.h"
#include "ssa.h"
#include "fold-const.h"
#include "cfgloop.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-threadupdate.h"
#include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h"
#include "gimple-fold.h"
#include "cfganal.h"
#include "alloc-pool.h"
#include "vr-values.h"
#include "gimple-range.h"
#include "gimple-range-path.h"
Include dependency graph for tree-ssa-threadedge.cc:

Functions

void set_ssa_name_value (tree name, tree value)
 
static bool has_phis_p (basic_block bb)
 
static bool empty_block_with_phis_p (basic_block bb)
 
static bool potentially_threadable_block (basic_block bb)
 
static tree threadedge_valueize (tree t)
 
void propagate_threaded_block_debug_into (basic_block dest, basic_block src)
 
bool edge_forwards_cmp_to_conditional_jump_through_empty_bb_p (edge e)
 
bool single_succ_to_potentially_threadable_block (basic_block bb)
 

Variables

static int stmt_count
 
vec< treessa_name_values
 

Function Documentation

◆ edge_forwards_cmp_to_conditional_jump_through_empty_bb_p()

bool edge_forwards_cmp_to_conditional_jump_through_empty_bb_p ( edge e)
There are basic blocks look like:
<P0>
p0 = a CMP b ; or p0 = (INT) (a CMP b)
goto <X>;

<P1>
p1 = c CMP d
goto <X>;

<X>
# phi = PHI <p0 (P0), p1 (P1)>
if (phi != 0) goto <Y>; else goto <Z>;

Then, edge (P0,X) or (P1,X) could be marked as EDGE_START_JUMP_THREAD
And edge (X,Y), (X,Z) is EDGE_COPY_SRC_JOINER_BLOCK

Return true if E is (P0,X) or (P1,X)   

References CONVERT_EXPR_CODE_P, ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), has_single_use(), integer_onep(), integer_zerop(), last_and_only_stmt(), NULL, PHI_ARG_DEF_FROM_EDGE, SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, and TREE_CODE_CLASS.

Referenced by jump_threader::thread_across_edge().

◆ empty_block_with_phis_p()

static bool empty_block_with_phis_p ( basic_block bb)
static
Return TRUE for a block with PHIs but no statements.   

References gsi_end_p(), gsi_start_nondebug_bb(), and has_phis_p().

Referenced by potentially_threadable_block(), and jump_threader::thread_through_normal_block().

◆ has_phis_p()

◆ potentially_threadable_block()

static bool potentially_threadable_block ( basic_block bb)
static
Return TRUE if we may be able to thread an incoming edge into
BB to an outgoing edge from BB.  Return FALSE otherwise.   

References empty_block_with_phis_p(), ggc_alloc(), gsi_end_p(), gsi_last_bb(), gsi_stmt(), single_pred_p(), and single_succ_p().

Referenced by single_succ_to_potentially_threadable_block(), and jump_threader::thread_outgoing_edges().

◆ propagate_threaded_block_debug_into()

◆ set_ssa_name_value()

◆ single_succ_to_potentially_threadable_block()

bool single_succ_to_potentially_threadable_block ( basic_block bb)
Return TRUE if BB has a single successor to a block with multiple
incoming and outgoing edges.   

References EDGE_COMPLEX, ggc_alloc(), potentially_threadable_block(), single_succ(), single_succ_edge(), and single_succ_p().

Referenced by jump_threader::thread_outgoing_edges().

◆ threadedge_valueize()

static tree threadedge_valueize ( tree t)
static
Valueize hook for gimple_fold_stmt_to_constant_1.   

References ggc_alloc(), SSA_NAME_VALUE, and TREE_CODE.

Referenced by jt_state::register_equivs_stmt().

Variable Documentation

◆ ssa_name_values

vec<tree> ssa_name_values
Array to record value-handles per SSA_NAME.   

Referenced by jump_threader::jump_threader(), set_ssa_name_value(), and jump_threader::~jump_threader().

◆ stmt_count

int stmt_count
static
SSA Jump Threading
   Copyright (C) 2005-2024 Free Software Foundation, Inc.
   Contributed by Jeff Law  <law@redhat.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
To avoid code explosion due to jump threading, we limit the
number of statements we are going to copy.  This variable
holds the number of statements currently seen that we'll have
to copy as part of the jump threading process.   

Referenced by jump_threader::record_temporary_equivalences_from_phis(), jump_threader::record_temporary_equivalences_from_stmts_at_dest(), and jump_threader::thread_across_edge().