PandA-2024.02
phi_opt.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
43 #ifndef PHI_OPT_HPP
44 #define PHI_OPT_HPP
45 
48 
50 #include "refcount.hpp"
51 
52 #include "tree_node.hpp"
53 
62 class statement_list;
63 class gimple_cond;
64 class gimple_phi;
66 
71 {
72  UNKNOWN,
73  DIFF_NOTHING,
75  IF_MERGE,
76  IF_NOTHING,
77  IF_REMOVE,
78  MULTI_MERGE,
80  MULTI_REMOVE,
81  UNCHANGED
82 };
83 
88 {
89  friend class short_circuit_taf;
90 
91  private:
94 
97 
99  statement_list* sl{nullptr};
100 
102  static bool tree_dumped;
103 
106 
109 
115  PhiOpt_PatternType IdentifyPattern(const unsigned int bb_index) const;
116 
120  void ApplyDiffNothing(const unsigned int bb_index);
121 
126  void ApplyGimpleNothing(const unsigned int bb_index);
127 
132  void ApplyIfMerge(const unsigned int bb_index);
133 
139  void ApplyIfNothing(const unsigned int bb_index);
140 
145  void ApplyIfRemove(const unsigned int bb_index);
146 
151  void ApplyMultiMerge(const unsigned int bb_index);
152 
158  void ApplyMultiNothing(const unsigned int bb_index);
159 
164  void ApplyMultiRemove(const unsigned int bb_index);
165 
169  void SinglePhiOptimization(const unsigned int bb_index);
170 
175  void ChainOptimization(const unsigned int bb_index);
176 
181  void MergePhi(const unsigned int bb_index);
182 
187  void RemoveCondExpr(const tree_nodeRef statement);
188 
189  void ReplaceVirtualUses(const tree_nodeRef& old_vssa, const TreeNodeSet& new_ssa) const;
190 
196  ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override;
197 
198  public:
206  PhiOpt(const application_managerRef AppM, unsigned int function_id,
207  const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters);
208 
212  ~PhiOpt() override;
213 
218 
222  void Initialize() override;
223 };
224 #endif
This struct specifies the field bloc (basic block).
Step successfully executed.
tree_managerRef TM
The tree manager.
Definition: phi_opt.hpp:93
This struct specifies the statement_list node.
Definition: tree_node.hpp:4662
Class managing the schedule of the operations.
Definition: schedule.hpp:118
RelationshipType
The relationship type.
This class manages the tree structures extracted from the raw file.
tree_manipulationConstRef tree_man
The tree manipulation.
Definition: phi_opt.hpp:96
bool bb_modified
flag used to restart code motion step
Definition: phi_opt.hpp:105
This struct specifies the gimple_cond node.
Definition: tree_node.hpp:2345
This class contains the base representation for a generic frontend flow step which works on a single ...
Phi dominated by gimple_multi_way_if to be merged.
This struct specifies the gimple_phi node.
Definition: tree_node.hpp:3742
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.
Phi dominated by gimple_cond to be removed.
CONSTREF_FORWARD_DECL(tree_manipulation)
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
Classes specification of the tree_node data structures.
Empty basic block with multiple input.
DesignFlowStep_Status
The status of a step.
static bool tree_dumped
flag to check if initial tree has been dumped
Definition: phi_opt.hpp:102
Template definition of refcount.
Basic block dominated by multi way if can be removed without further changes.
DesignFlowStep_Status InternalExec() override
Restructures the unstructured code.
PhiOpt_PatternType
Identifier of patterns to be transformed by phi_opt.
Definition: phi_opt.hpp:70
const unsigned int function_id
The index of the function to be analyzed.
Basic block dominated by if can be removed without further changes.
const application_managerRef AppM
The application manager.
Empty basic block dominated by assign can be removed without further changes.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Restructure the tree control flow graph.
Definition: phi_opt.hpp:87
Phi dominated by gimple_multi_way_if to be removed.
REF_FORWARD_DECL(bloc)
ScheduleRef schedule
The scheduling solution.
Definition: phi_opt.hpp:108
Edges coming from if to be merged.
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
int sl
Definition: adpcm.c:105

Generated on Mon Feb 12 2024 13:02:52 for PandA-2024.02 by doxygen 1.8.13