PandA-2024.02
IR_lowering.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 IR_LOWERING_HPP
44 #define IR_LOWERING_HPP
45 #include "custom_set.hpp" // for unordered_set
46 #include "design_flow_step.hpp" // for DesignFlowStep
47 #include "frontend_flow_step.hpp" // for FrontendFlowStep...
48 #include "function_frontend_flow_step.hpp" // for DesignFlowManage...
49 #include "refcount.hpp" // for REF_FORWARD_DECL
50 #include <list> // for list, list<>::co...
51 #include <string> // for string
52 #include <utility> // for pair
53 
59 class integer_cst;
60 class target_mem_ref461;
61 class array_ref;
62 enum kind : int;
67 struct gimple_assign;
69 
75 {
79 };
80 
85 {
86  private:
89 
92 
99  tree_nodeRef expand_mult_const(const tree_nodeRef& op0, unsigned long long int val, const struct algorithm& alg,
100  enum mult_variant& variant, const tree_nodeRef& stmt, const blocRef& block,
101  const tree_nodeRef& type, const std::string& srcp_default);
102 
106  tree_nodeRef expand_smod_pow2(const tree_nodeRef& op0, unsigned long long int d, const tree_nodeRef& stmt,
107  const blocRef& block, const tree_nodeRef& type, const std::string& srcp_default);
108 
113  tree_nodeRef expand_sdiv_pow2(const tree_nodeRef& op0, unsigned long long int d, const tree_nodeRef& stmt,
114  const blocRef& block, const tree_nodeRef& type, const std::string& srcp_default);
115 
116  tree_nodeRef expand_MC(const tree_nodeRef& op0, const integer_cst* ic_node, const tree_nodeRef& old_target,
117  const tree_nodeRef& stmt, const blocRef& block, const tree_nodeRef& type_expr,
118  const std::string& srcp_default);
119 
120  bool expand_target_mem_ref(target_mem_ref461* tmr, const tree_nodeRef& stmt, const blocRef& block,
121  const std::string& srcp_default, bool temp_addr);
122 
123  tree_nodeRef expand_mult_highpart(const tree_nodeRef& op0, unsigned long long int ml, const tree_nodeRef& type_expr,
124  int data_bitsize, const std::list<tree_nodeRef>::const_iterator it_los,
125  const blocRef& block, const std::string& srcp_default);
126 
132  ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override;
133 
134  tree_nodeRef array_ref_lowering(array_ref* AR, const std::string& srcp_default,
135  std::pair<unsigned int, blocRef> block,
136  std::list<tree_nodeRef>::const_iterator it_los, bool temp_addr);
137 
144 
145  void division_by_a_constant(const std::pair<unsigned int, blocRef>& block,
146  std::list<tree_nodeRef>::const_iterator& it_los, gimple_assign* ga,
147  const tree_nodeRef& op1, enum kind code1, bool& restart_analysis,
148  const std::string& srcp_default, const std::string& step_name);
149 
150  public:
158  IR_lowering(const ParameterConstRef Param, const application_managerRef AppM, unsigned int function_id,
159  const DesignFlowManagerConstRef design_flow_manager);
160 
164  ~IR_lowering() override;
165 
171 
175  void Initialize() override;
176 
182  void ComputeRelationships(DesignFlowStepSet& relationship,
183  const DesignFlowStep::RelationshipType relationship_type) override;
184 };
185 #endif
This struct specifies the integer_cst node.
Definition: tree_node.hpp:3242
bool reached_max_transformation_limit(const tree_nodeRef &stmt)
check if the max transformation limit has been reached
This struct specifies the field bloc (basic block).
void ComputeRelationships(DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
tree_nodeRef expand_mult_const(const tree_nodeRef &op0, unsigned long long int val, const struct algorithm &alg, enum mult_variant &variant, const tree_nodeRef &stmt, const blocRef &block, const tree_nodeRef &type, const std::string &srcp_default)
A subroutine of expand_mult, used for constant multiplications.
RelationshipType
The relationship type.
This class manages the tree structures extracted from the raw file.
This structure records a sequence of operations.
IR_lowering(const ParameterConstRef Param, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Definition: IR_lowering.cpp:82
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.
Definition: IR_lowering.cpp:90
This class contains the base representation for a generic frontend flow step which works on a single ...
tree_nodeRef expand_MC(const tree_nodeRef &op0, const integer_cst *ic_node, const tree_nodeRef &old_target, const tree_nodeRef &stmt, const blocRef &block, const tree_nodeRef &type_expr, const std::string &srcp_default)
Abstract pure class for the tree structure.
Definition: tree_node.hpp:139
Base class for step of design flow.
This struct specifies the gimple_assign node (GCC 4.3 tree node).
Definition: tree_node.hpp:3015
tree_managerRef TM
The tree manager.
Definition: IR_lowering.hpp:88
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
mult_variant
Indicates the type of fixup needed after a constant multiplication.
Definition: IR_lowering.hpp:74
void division_by_a_constant(const std::pair< unsigned int, blocRef > &block, std::list< tree_nodeRef >::const_iterator &it_los, gimple_assign *ga, const tree_nodeRef &op1, enum kind code1, bool &restart_analysis, const std::string &srcp_default, const std::string &step_name)
Low-level memory addressing.
Definition: tree_node.hpp:4938
kind
redefinition of set to manage ordered/unordered structures
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
This class contains the base representation for a generic frontend flow step.
tree_nodeRef expand_smod_pow2(const tree_nodeRef &op0, unsigned long long int d, const tree_nodeRef &stmt, const blocRef &block, const tree_nodeRef &type, const std::string &srcp_default)
Expand signed modulus of OP0 by a power of two D in mode MODE.
DesignFlowStep_Status
The status of a step.
Compute the control flow graph for the operations.
Definition: IR_lowering.hpp:84
bool expand_target_mem_ref(target_mem_ref461 *tmr, const tree_nodeRef &stmt, const blocRef &block, const std::string &srcp_default, bool temp_addr)
This struct specifies the block node.
Definition: tree_node.hpp:1820
tree_manipulationRef tree_man
The IR manipulation.
Definition: IR_lowering.hpp:91
Template definition of refcount.
const unsigned int function_id
The index of the function to be analyzed.
const application_managerRef AppM
The application manager.
tree_nodeRef expand_mult_highpart(const tree_nodeRef &op0, unsigned long long int ml, const tree_nodeRef &type_expr, int data_bitsize, const std::list< tree_nodeRef >::const_iterator it_los, const blocRef &block, const std::string &srcp_default)
tree_nodeRef expand_sdiv_pow2(const tree_nodeRef &op0, unsigned long long int d, const tree_nodeRef &stmt, const blocRef &block, const tree_nodeRef &type, const std::string &srcp_default)
Expand signed division of OP0 by a power of two D in mode MODE.
tree_nodeRef array_ref_lowering(array_ref *AR, const std::string &srcp_default, std::pair< unsigned int, blocRef > block, std::list< tree_nodeRef >::const_iterator it_los, bool temp_addr)
REF_FORWARD_DECL(bloc)
DesignFlowStep_Status InternalExec() override
traverse the data structure to simplify and make more homogeneous as possible.
~IR_lowering() override
Destructor.
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...

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