PandA-2024.02
lut_transformation.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  */
39 #ifndef LUT_TRANSFORMATION_HPP
40 #define LUT_TRANSFORMATION_HPP
41 
44 
46 #include "custom_map.hpp"
47 #include "custom_set.hpp"
48 #include <algorithm>
49 #include <cmath>
50 #include <list>
51 #include <string>
52 #include <vector>
54 #include "refcount.hpp"
55 
56 #include "tree_common.hpp"
57 #include "tree_node.hpp"
58 
61 // class integer_cst;
62 // class target_mem_ref461;
63 // REF_FORWARD_DECL(lut_transformation);
69 
71 {
72  private:
75 
78 
80  size_t max_lut_size;
81 
83  const std::vector<enum kind> lutBooleanExpressibleOperations = {
84  bit_and_expr_K, truth_and_expr_K, bit_ior_expr_K, truth_or_expr_K, truth_orif_expr_K,
85  bit_xor_expr_K, truth_xor_expr_K, eq_expr_K, ge_expr_K, lut_expr_K,
86  cond_expr_K, gt_expr_K, le_expr_K, lt_expr_K, ne_expr_K};
87 
88  const std::vector<enum kind> lutIntegerExpressibleOperations = {eq_expr_K, ne_expr_K, lt_expr_K,
89  le_expr_K, gt_expr_K, ge_expr_K};
90 
91  bool CHECK_BIN_EXPR_BOOL_SIZE(binary_expr* be) const;
92  bool CHECK_BIN_EXPR_INT_SIZE(binary_expr* be, unsigned int max) const;
93  bool CHECK_COND_EXPR_SIZE(cond_expr* ce) const;
94  bool CHECK_NOT_EXPR_SIZE(unary_expr* ne) const;
100  bool cannotBeLUT(tree_nodeRef op) const;
101 
108  bool CheckIfPO(gimple_assign* gimpleAssign);
109 
116  bool CheckIfPI(tree_nodeRef in, unsigned int BB_index);
117 
118  bool ProcessBasicBlock(std::pair<unsigned int, blocRef> block);
119 
120  bool CheckIfProcessable(std::pair<unsigned int, blocRef> block);
121 
123  std::vector<tree_nodeRef>& prev_stmts_to_add);
124 
130  ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override;
131 
132  public:
141  const DesignFlowManagerConstRef design_flow_manager);
142 
146  ~lut_transformation() override;
147 
153 
157  void Initialize() override;
158 
164  void ComputeRelationships(DesignFlowStepSet& relationship,
165  const DesignFlowStep::RelationshipType relationship_type) override;
166 };
167 
168 #endif
bool CheckIfProcessable(std::pair< unsigned int, blocRef > block)
Checks if the provided basic block can be further processed.
lut_transformation(const ParameterConstRef Param, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
This struct specifies the field bloc (basic block).
bool CheckIfPO(gimple_assign *gimpleAssign)
Checks if the provided gimple_assign is a primary output of lut network.
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_manipulationRef tree_man
The lut manipulation.
bool CHECK_BIN_EXPR_INT_SIZE(binary_expr *be, unsigned int max) const
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
tree_managerRef TM
The tree manager.
const std::vector< enum kind > lutIntegerExpressibleOperations
struct definition of the unary node structures.
Definition: tree_node.hpp:1177
bool CheckIfPI(tree_nodeRef in, unsigned int BB_index)
Checks if the ssa variable is a primary input of lut network.
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.
This class contains the base representation for a generic frontend flow step which works on a single ...
redefinition of map to manage ordered/unordered structures
DesignFlowStep_Status InternalExec() override
Computes the operations CFG graph data structure.
Abstract pure class for the tree structure.
Definition: tree_node.hpp:139
#define max
Definition: backprop.h:17
bool cannotBeLUT(tree_nodeRef op) const
cannotBeLUT returns true in case the op is an operation that cannot be translated in a LUT ...
This struct specifies the gimple_assign node (GCC 4.3 tree node).
Definition: tree_node.hpp:3015
This C++ header file contains common macros for the tree structure.
const std::vector< enum kind > lutBooleanExpressibleOperations
The list of all operation that can be converted to a lut.
#define index(x, y)
Definition: Keccak.c:74
redefinition of set to manage ordered/unordered structures
size_t max_lut_size
The maximum number of inputs of a lut.
bool CHECK_BIN_EXPR_BOOL_SIZE(binary_expr *be) const
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
Classes specification of the tree_node data structures.
DesignFlowStep_Status
The status of a step.
This struct specifies the block node.
Definition: tree_node.hpp:1820
Template definition of refcount.
void ComputeRelationships(DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
const unsigned int function_id
The index of the function to be analyzed.
bool CHECK_COND_EXPR_SIZE(cond_expr *ce) const
const application_managerRef AppM
The application manager.
bool CHECK_NOT_EXPR_SIZE(unary_expr *ne) const
~lut_transformation() override
Destructor.
bool ProcessBasicBlock(std::pair< unsigned int, blocRef > block)
struct definition of the binary node structures.
Definition: tree_node.hpp:1206
tree_nodeRef CreateBitSelectionNodeOrCast(const tree_nodeRef source, int index, std::vector< tree_nodeRef > &prev_stmts_to_add)
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
REF_FORWARD_DECL(bloc)
Super class include.

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