PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
PhiOpt Class Reference

Restructure the tree control flow graph. More...

#include <phi_opt.hpp>

Inheritance diagram for PhiOpt:
Inheritance graph
[legend]
Collaboration diagram for PhiOpt:
Collaboration graph
[legend]

Public Member Functions

 PhiOpt (const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
 ~PhiOpt () override
 Destructor. More...
 
DesignFlowStep_Status InternalExec () override
 Updates the tree to have a more compliant CFG. More...
 
void Initialize () override
 Initialize the step (i.e., like a constructor, but executed just before exec. More...
 
- Public Member Functions inherited from FunctionFrontendFlowStep
 FunctionFrontendFlowStep (const application_managerRef AppM, const unsigned int function_id, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
 ~FunctionFrontendFlowStep () override
 Destructor. More...
 
void ComputeRelationships (DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
 Compute the relationships of a step with other steps. More...
 
std::string GetSignature () const override
 Return the signature of this step. More...
 
std::string GetName () const override
 Return the name of this design step. More...
 
DesignFlowStep_Status Exec () final
 Execute the step. More...
 
bool HasToBeExecuted () const override
 Check if this step has actually to be executed. More...
 
unsigned int CGetBBVersion () const
 
unsigned int GetBitValueVersion () const
 
void PrintInitialIR () const override
 Dump the initial intermediate representation. More...
 
void PrintFinalIR () const override
 Dump the final intermediate representation. More...
 
- Public Member Functions inherited from FrontendFlowStep
 FrontendFlowStep (const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
 ~FrontendFlowStep () override
 Destructor. More...
 
virtual std::string GetKindText () const
 Return the name of the type of this frontend flow step. More...
 
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory () const override
 Return the factory to create this type of steps. More...
 
void PrintTreeManager (const bool before) const
 Dump the tree manager. More...
 
- Public Member Functions inherited from DesignFlowStep
 DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
virtual ~DesignFlowStep ()
 Destructor. More...
 
DesignFlowStep_Status GetStatus () const
 Return the status of this design step. More...
 
virtual void WriteDot (std::ostream &out) const
 Write the label for a dot graph. More...
 
bool IsComposed () const
 Returns if this step is composed. More...
 
int CGetDebugLevel () const
 Return the debug level of the step. More...
 

Private Member Functions

PhiOpt_PatternType IdentifyPattern (const unsigned int bb_index) const
 Identify to which pattern an empty basic block belongs. More...
 
void ApplyDiffNothing (const unsigned int bb_index)
 Remove an empty basic block with multiple input edges. More...
 
void ApplyGimpleNothing (const unsigned int bb_index)
 Remove an empty basic block dominated by gimple assign. More...
 
void ApplyIfMerge (const unsigned int bb_index)
 Transform the control flow graph by merging a gimple_phi dominated by a gimple_cond. More...
 
void ApplyIfNothing (const unsigned int bb_index)
 Transform the control flow graph by eliminating an empty basic block dominated by gimple_cond without modifying phi. More...
 
void ApplyIfRemove (const unsigned int bb_index)
 Transform the control flow graph by removing a gimple_phi dominated by a gimple_cond. More...
 
void ApplyMultiMerge (const unsigned int bb_index)
 Transform the control flow graph by merging a gimple_phi dominated by a gimple_multi_way_if. More...
 
void ApplyMultiNothing (const unsigned int bb_index)
 Transform the control flow graph by eliminating an empty basic block dominated by gimple_multi_way_if without modifying phi. More...
 
void ApplyMultiRemove (const unsigned int bb_index)
 Transform the control flow graph by removing a gimple_phi dominated by a gimple_multi_way_if. More...
 
void SinglePhiOptimization (const unsigned int bb_index)
 Transform single input phi in assignment. More...
 
void ChainOptimization (const unsigned int bb_index)
 Remove chains of basic blocks. More...
 
void MergePhi (const unsigned int bb_index)
 Remove a basic block composed only of phis my merging with the successor. More...
 
void RemoveCondExpr (const tree_nodeRef statement)
 Remove a redundant cond expr. More...
 
void ReplaceVirtualUses (const tree_nodeRef &old_vssa, const TreeNodeSet &new_ssa) const
 
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships (const DesignFlowStep::RelationshipType relationship_type) const override
 Return the set of analyses in relationship with this design step. More...
 

Private Attributes

tree_managerRef TM
 The tree manager. More...
 
tree_manipulationConstRef tree_man
 The tree manipulation. More...
 
statement_listsl {nullptr}
 The basic block graph of the function. More...
 
bool bb_modified
 flag used to restart code motion step More...
 
ScheduleRef schedule
 The scheduling solution. More...
 

Static Private Attributes

static bool tree_dumped
 flag to check if initial tree has been dumped More...
 

Friends

class short_circuit_taf
 

Additional Inherited Members

- Public Types inherited from FrontendFlowStep
using FunctionRelationship = enum { ALL_FUNCTIONS, CALLED_FUNCTIONS, CALLING_FUNCTIONS, SAME_FUNCTION, WHOLE_APPLICATION }
 The different relationship type between function analysis. More...
 
- Public Types inherited from DesignFlowStep
enum  RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP }
 The relationship type. More...
 
- Static Public Member Functions inherited from FunctionFrontendFlowStep
static const std::string ComputeSignature (const FrontendFlowStepType frontend_flow_step_type, const unsigned int function_id)
 Compute the signature of a function frontend flow step. More...
 
- Static Public Member Functions inherited from FrontendFlowStep
static void CreateSteps (const DesignFlowManagerConstRef design_flow_manager, const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship >> &frontend_relationships, const application_managerConstRef application_manager, DesignFlowStepSet &relationships)
 Create the relationship steps of a step with other steps starting from already specified dependencies between frontend flow steps. More...
 
static const std::string EnumToKindText (const FrontendFlowStepType frontend_flow_step_type)
 Given a frontend flow step type, return the name of the type. More...
 
- Protected Member Functions inherited from FunctionFrontendFlowStep
void WriteBBGraphDot (const std::string &filename) const
 Write the current version of statement list in dot format. More...
 
- Protected Attributes inherited from FunctionFrontendFlowStep
const FunctionBehaviorRef function_behavior
 The function behavior of the function to be analyzed. More...
 
const unsigned int function_id
 The index of the function to be analyzed. More...
 
unsigned int bb_version
 The version of the basic block intermediate representation on which this step has been applied. More...
 
unsigned int bitvalue_version
 The version of the bitvalue information on which this step has been applied. More...
 
- Protected Attributes inherited from FrontendFlowStep
const application_managerRef AppM
 The application manager. More...
 
const FrontendFlowStepType frontend_flow_step_type
 The type of this step. More...
 
unsigned int print_counter
 Print counter. More...
 
- Protected Attributes inherited from DesignFlowStep
bool composed
 True if this step represents a composition of design flow steps (e.g., a flow); must be set by specialized constructors. More...
 
const Wrefcount< const DesignFlowManagerdesign_flow_manager
 The design flow manager. More...
 
const ParameterConstRef parameters
 Set of input parameters. More...
 
int debug_level
 The debug level. More...
 
const int output_level
 The output level. More...
 

Detailed Description

Restructure the tree control flow graph.

Definition at line 87 of file phi_opt.hpp.

Constructor & Destructor Documentation

◆ PhiOpt()

PhiOpt::PhiOpt ( const application_managerRef  AppM,
unsigned int  function_id,
const DesignFlowManagerConstRef  design_flow_manager,
const ParameterConstRef  parameters 
)

Constructor.

Parameters
AppMis the application manager
function_idis the identifier of the function
design_flow_manageris the design flow manager
parametersis the set of input parameters

Definition at line 73 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_NONE, GET_CLASS, and ~PhiOpt().

Here is the call graph for this function:

◆ ~PhiOpt()

PhiOpt::~PhiOpt ( )
overridedefault

Destructor.

Referenced by PhiOpt().

Here is the caller graph for this function:

Member Function Documentation

◆ ApplyDiffNothing()

void PhiOpt::ApplyDiffNothing ( const unsigned int  bb_index)
private

Remove an empty basic block with multiple input edges.

Create empty basic block

Add predecessor as pred basic block

Add successor as succ basic block

Fix successor of predecessor

Fix predecessor of successor

Fix gimple_multi_way_if

Fix phis

Definition at line 611 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, THROW_ASSERT, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ApplyGimpleNothing()

void PhiOpt::ApplyGimpleNothing ( const unsigned int  bb_index)
private

Remove an empty basic block dominated by gimple assign.

Parameters
bb_indexis the index of the empty basic block

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 892 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ApplyIfMerge()

void PhiOpt::ApplyIfMerge ( const unsigned int  bb_index)
private

Transform the control flow graph by merging a gimple_phi dominated by a gimple_cond.

Parameters
bb_indexis the index of the empty basic block

True if bb_index is on the true edge

The condition

Remove gimple_cond from list of statement

Update all the phis

The value coming from true edge

The value coming from false edge

The type of the expression

Create the ssa with the new input of the phi

Create a nop with virtual operands

Create the cond expr

Create the assign

Updating the phi

Do nothing - this edge will be removed

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 710 of file phi_opt.cpp.

References FrontendFlowStep::AppM, BUILTIN_SRCP, tree_helper::CGetType(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_ssa_name(), tree_manipulation::create_ternary_operation(), tree_manager::create_tree_node(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, tree_manipulation::ExtractCondition(), FunctionFrontendFlowStep::function_id, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_NODE, tree_manager::GetTreeReindex(), INDENT_DBG_MEX, tree_helper::is_a_vector(), statement_list::list_of_bloc, tree_manager::new_tree_node_id(), phi, sl, STR, THROW_ASSERT, TM, TOK, TOK_SCPE, TOK_SRCP, ToString(), and tree_man.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ApplyIfNothing()

void PhiOpt::ApplyIfNothing ( const unsigned int  bb_index)
private

Transform the control flow graph by eliminating an empty basic block dominated by gimple_cond without modifying phi.

Parameters
bb_indexis the index of the empty basic block

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 846 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, THROW_UNREACHABLE, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ApplyIfRemove()

void PhiOpt::ApplyIfRemove ( const unsigned int  bb_index)
private

Transform the control flow graph by removing a gimple_phi dominated by a gimple_cond.

Parameters
bb_indexis the index of the empty basic block

True if bb_index is on the true edge

Remove gimple_cond from list of statement. New statements can be pushed at the end

The condition

Remove all the phis

The value coming from true edge

The value coming from false edge

The type of the expression

Create a nop with virtual operands

Create the cond expr

Create the assign

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 926 of file phi_opt.cpp.

References FrontendFlowStep::AppM, BUILTIN_SRCP, tree_helper::CGetType(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_ternary_operation(), tree_manager::create_tree_node(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, tree_manipulation::ExtractCondition(), FunctionFrontendFlowStep::function_id, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_NODE, tree_manager::GetTreeNode(), tree_manager::GetTreeReindex(), INDENT_DBG_MEX, tree_helper::is_a_vector(), statement_list::list_of_bloc, tree_manager::new_tree_node_id(), phi, ReplaceVirtualUses(), sl, STR, THROW_ASSERT, THROW_UNREACHABLE, TM, TOK, TOK_SCPE, TOK_SRCP, ToString(), and tree_man.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ApplyMultiMerge()

void PhiOpt::ApplyMultiMerge ( const unsigned int  bb_index)
private

Transform the control flow graph by merging a gimple_phi dominated by a gimple_multi_way_if.

Parameters
bb_indexis the index of the empty basic block

True if bb_index is on the first edge

The gimple multi way if

Temporary remove gimple multi way if

The first condition

The second condition

Update all the phis

The value coming from the first edge

The value coming from the second edge

The type of the expression

Create the ssa with the new input of the phi

Create a nop with virtual operands

Create the cond expr

Create the assign

Updating the phi

Do nothing - this edge will be removed

Readding gimple multi way if it has more than two exits

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 1064 of file phi_opt.cpp.

References FrontendFlowStep::AppM, BUILTIN_SRCP, tree_helper::CGetType(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_ssa_name(), tree_manipulation::create_ternary_operation(), tree_manager::create_tree_node(), tree_manipulation::CreateOrExpr(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_NODE, tree_manager::GetTreeReindex(), INDENT_DBG_MEX, tree_node::index, tree_helper::is_a_vector(), statement_list::list_of_bloc, tree_manager::new_tree_node_id(), phi, sl, STR, THROW_ASSERT, TM, TOK, TOK_SCPE, TOK_SRCP, and tree_man.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ApplyMultiNothing()

void PhiOpt::ApplyMultiNothing ( const unsigned int  bb_index)
private

Transform the control flow graph by eliminating an empty basic block dominated by gimple_multi_way_if without modifying phi.

Parameters
bb_indexis the index of the empty basic block

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 1273 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, THROW_ASSERT, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ApplyMultiRemove()

void PhiOpt::ApplyMultiRemove ( const unsigned int  bb_index)
private

Transform the control flow graph by removing a gimple_phi dominated by a gimple_multi_way_if.

Parameters
bb_indexis the index of the empty basic block

True if bb_index is on the first edge

The gimple multi way if

Temporary remove gimple multi way if

The first condition

The second condition

Remove all the phis

The value coming from the first edge

The value coming from the second edge

The type of the expression

Create a nop with virtual operands

Create the cond expr

Create the assign

Readd multi way if

Refactoring of the cfg - updating the predecessor

Refactoring of the cfg - updating the successor

Remove the current basic block

Definition at line 1319 of file phi_opt.cpp.

References FrontendFlowStep::AppM, BUILTIN_SRCP, tree_helper::CGetType(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_ternary_operation(), tree_manager::create_tree_node(), tree_manipulation::CreateOrExpr(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_NODE, tree_manager::GetTreeReindex(), INDENT_DBG_MEX, tree_helper::is_a_vector(), statement_list::list_of_bloc, tree_manager::new_tree_node_id(), phi, ReplaceVirtualUses(), sl, STR, THROW_ASSERT, THROW_UNREACHABLE, TM, TOK, TOK_SCPE, TOK_SRCP, ToString(), and tree_man.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChainOptimization()

void PhiOpt::ChainOptimization ( const unsigned int  bb_index)
private

Remove chains of basic blocks.

Parameters
bb_indexis the starting basic block index

The phis are taken from the first block

Move statement of second block in first one

Update successor of curr_bb

Fix successor of succ

Remove bb

Definition at line 1832 of file phi_opt.cpp.

References FrontendFlowStep::AppM, DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, bloc::EXIT_BLOCK_ID, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, THROW_ASSERT, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ComputeFrontendRelationships()

const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionFrontendFlowStep::FunctionRelationship > > PhiOpt::ComputeFrontendRelationships ( const DesignFlowStep::RelationshipType  relationship_type) const
overrideprivatevirtual

Return the set of analyses in relationship with this design step.

Parameters
relationship_typeis the type of relationship to be considered

Implements FrontendFlowStep.

Definition at line 83 of file phi_opt.cpp.

References DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::PRECEDENCE_RELATIONSHIP, SAME_FUNCTION, and THROW_UNREACHABLE.

◆ IdentifyPattern()

PhiOpt_PatternType PhiOpt::IdentifyPattern ( const unsigned int  bb_index) const
private

Identify to which pattern an empty basic block belongs.

Parameters
bb_indexis the index of the empty basic block
Returns
the identified pattern

The gimple multi way if

The conditions

Successor is ending if of the function

Simulate to add the cond expr and check if there are problems with timing

The gimple multi way if

The first condition

The value coming from the first edge

The value coming from the second edge

True if bb_index is on the first edge

The type of the expression

Create the cond expr

Create the assign Workaround: we need to consider the overhead due to multiplexers associated with the phi; for this reason definition is one of the operands; this is not fully consistent, but it is a temporary assignment

Created statement is not added to the predecessor

Definition at line 1521 of file phi_opt.cpp.

References BUILTIN_SRCP, Schedule::CanBeMoved(), tree_helper::CGetType(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_ternary_operation(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, DIFF_NOTHING, bloc::ENTRY_BLOCK_ID, Schedule::EvaluateCondsMerging(), bloc::EXIT_BLOCK_ID, FunctionFrontendFlowStep::function_behavior, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, GET_INDEX_CONST_NODE, GIMPLE_NOTHING, IF_MERGE, IF_NOTHING, IF_REMOVE, INDENT_DBG_MEX, INDENT_OUT_MEX, tree_helper::is_a_vector(), statement_list::list_of_bloc, MOVABLE, MULTI_MERGE, MULTI_NOTHING, MULTI_REMOVE, DesignFlowStep::output_level, OUTPUT_LEVEL_MINIMUM, phi, schedule, sl, STR, THROW_ASSERT, TM, tree_man, UNCHANGED, and UNKNOWN.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

void PhiOpt::Initialize ( )
overridevirtual

Initialize the step (i.e., like a constructor, but executed just before exec.

Reimplemented from DesignFlowStep.

Definition at line 113 of file phi_opt.cpp.

References FrontendFlowStep::AppM, bb_modified, tree_manager::CGetTreeNode(), FunctionFrontendFlowStep::function_id, GET_NODE, DesignFlowStep::parameters, schedule, sl, TM, and tree_man.

Here is the call graph for this function:

◆ InternalExec()

DesignFlowStep_Status PhiOpt::InternalExec ( )
overridevirtual

Updates the tree to have a more compliant CFG.

remove dead PHIs

Removed blocks composed only of phi

Check that two basic block do not have any common predecessor

Check that ssa defined by phi are used only once

Transform single input phi

Transform chain of basic blocks

Workaround to avoid invalidation of pointer

Remove empty basic block

Remove nop

Transform chain of basic blocks

If there is only a single vuse replace vdef with vuse in all the uses of vdef

Check that all the uses are not in phi or not defining a self loop

Implements FunctionFrontendFlowStep.

Definition at line 130 of file phi_opt.cpp.

References ApplyDiffNothing(), ApplyGimpleNothing(), ApplyIfMerge(), ApplyIfNothing(), ApplyIfRemove(), ApplyMultiMerge(), ApplyMultiNothing(), ApplyMultiRemove(), FrontendFlowStep::AppM, bb_modified, ChainOptimization(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, DIFF_NOTHING, bloc::ENTRY_BLOCK_ID, bloc::EXIT_BLOCK_ID, FunctionFrontendFlowStep::function_behavior, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_NODE, FunctionFrontendFlowStep::GetName(), GIMPLE_NOTHING, IdentifyPattern(), IF_MERGE, IF_NOTHING, IF_REMOVE, INDENT_DBG_MEX, statement_list::list_of_bloc, MergePhi(), MULTI_MERGE, MULTI_NOTHING, MULTI_REMOVE, DesignFlowStep::parameters, phi, RemoveCondExpr(), tree_manager::ReplaceTreeNode(), ReplaceVirtualUses(), test_panda::restart, SinglePhiOptimization(), sl, STR, SUCCESS, THROW_ASSERT, THROW_UNREACHABLE, TM, UNCHANGED, UNKNOWN, and FunctionFrontendFlowStep::WriteBBGraphDot().

Here is the call graph for this function:

◆ MergePhi()

void PhiOpt::MergePhi ( const unsigned int  bb_index)
private

Remove a basic block composed only of phis my merging with the successor.

Parameters
blockis the index of the basic block

Fixing phis

Removing phi only if number of uses is 1

These are phis which were present only in the predecessor

Fixing predecessor

Fixing gimple phi of predecessor

Fixing successor

Erasing basic block

Definition at line 1886 of file phi_opt.cpp.

References bb_modified, DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, GET_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, sl, STR, THROW_ASSERT, and TM.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ RemoveCondExpr()

void PhiOpt::RemoveCondExpr ( const tree_nodeRef  statement)
private

Remove a redundant cond expr.

Parameters
statementis the statement containing

Definition at line 2042 of file phi_opt.cpp.

References FrontendFlowStep::AppM, DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, tree_manager::ReplaceTreeNode(), sl, THROW_ASSERT, TM, and tree_node::ToString().

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReplaceVirtualUses()

void PhiOpt::ReplaceVirtualUses ( const tree_nodeRef old_vssa,
const TreeNodeSet new_ssa 
) const
private

Definition at line 2061 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, GET_NODE, INDENT_DBG_MEX, THROW_ASSERT, ToString(), and tree_node::ToString().

Referenced by ApplyIfRemove(), ApplyMultiRemove(), and InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SinglePhiOptimization()

void PhiOpt::SinglePhiOptimization ( const unsigned int  bb_index)
private

Transform single input phi in assignment.

Building temp set of use stmts (to avoid invalidation during loop execution and to skip phi)

Definition at line 1788 of file phi_opt.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, INDENT_DBG_MEX, statement_list::list_of_bloc, phi, tree_manager::ReplaceTreeNode(), sl, STR, THROW_ASSERT, and TM.

Referenced by InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ short_circuit_taf

friend class short_circuit_taf
friend

Definition at line 89 of file phi_opt.hpp.

Field Documentation

◆ bb_modified

bool PhiOpt::bb_modified
private

flag used to restart code motion step

Definition at line 105 of file phi_opt.hpp.

Referenced by Initialize(), InternalExec(), and MergePhi().

◆ schedule

ScheduleRef PhiOpt::schedule
private

The scheduling solution.

Definition at line 108 of file phi_opt.hpp.

Referenced by IdentifyPattern(), and Initialize().

◆ sl

statement_list* PhiOpt::sl {nullptr}
private

◆ TM

tree_managerRef PhiOpt::TM
private

◆ tree_dumped

bool PhiOpt::tree_dumped
staticprivate

flag to check if initial tree has been dumped

Definition at line 102 of file phi_opt.hpp.

◆ tree_man

tree_manipulationConstRef PhiOpt::tree_man
private

The tree manipulation.

Definition at line 96 of file phi_opt.hpp.

Referenced by ApplyIfMerge(), ApplyIfRemove(), ApplyMultiMerge(), ApplyMultiRemove(), IdentifyPattern(), and Initialize().


The documentation for this class was generated from the following files:

Generated on Mon Feb 12 2024 13:04:00 for PandA-2024.02 by doxygen 1.8.13