PandA-2024.02
cdfg_edge_info.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 CDFG_EDGE_INFO_HPP
44 #define CDFG_EDGE_INFO_HPP
45 
46 #include "custom_map.hpp" // for map
47 #include "custom_set.hpp" // for set
48 #include "edge_info.hpp" // for EdgeInfo
49 #include "refcount.hpp" // for CONSTREF_FORWARD...
50 #include <limits> // for numeric_limits
51 #include <string> // for string
52 
54 
59 #define TRED_SELECTOR (1 << 0)
61 
63 #define CFG_SELECTOR (1 << 1)
64 #define FB_CFG_SELECTOR (1 << 2)
66 #define FCFG_SELECTOR (CFG_SELECTOR | FB_CFG_SELECTOR)
68 
70 #define CDG_SELECTOR (1 << 3)
71 #define FB_CDG_SELECTOR (1 << 4)
73 #define FCDG_SELECTOR (CDG_SELECTOR | FB_CDG_SELECTOR)
75 
77 #define ECFG_SELECTOR (1 << 5)
78 
80 #define T_COND (std::numeric_limits<unsigned int>::max())
81 #define F_COND (std::numeric_limits<unsigned int>::max() - 1)
83 #define NO_COND (std::numeric_limits<unsigned int>::max() - 2)
85 #define default_COND (std::numeric_limits<unsigned int>::max() - 3)
87 
91 struct CdfgEdgeInfo : public EdgeInfo
92 {
93  protected:
95  std::map<int, CustomOrderedSet<unsigned int>> labels;
96 
97  public:
99  CdfgEdgeInfo() = default;
100 
104  bool CdgEdgeT() const;
105 
109  bool CdgEdgeF() const;
110 
114  bool CfgEdgeT() const;
115 
119  bool CfgEdgeF() const;
120 
124  bool Switch() const;
125 
131  void add_nodeID(unsigned int nodeID, const int type);
132 
138  const CustomOrderedSet<unsigned int>& get_nodeID(const int selector) const;
139 
145  const std::string PrintLabels(const int selector, const BehavioralHelperConstRef BH) const;
146 };
147 
153 #define CDG_TRUE_CHECK(data, edge_index) \
154  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->CdgEdgeT()
155 
161 #define CDG_FALSE_CHECK(data, edge_index) \
162  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->CdgEdgeF()
163 
169 #define CFG_TRUE_CHECK(data, edge_index) \
170  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->CfgEdgeT()
171 
177 #define CFG_FALSE_CHECK(data, edge_index) \
178  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->CfgEdgeF()
179 
185 #define FLG_TRUE_CHECK(data, edge_index) \
186  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->FlgEdgeT()
187 
193 #define FLG_FALSE_CHECK(data, edge_index) \
194  Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data)) and Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->FlgEdgeF()
195 
202 #define EDGE_GET_NODEID(data, edge_index, type) Cget_edge_info<CdfgEdgeInfo>(edge_index, *(data))->get_nodeID(type)
203 
204 #endif
bool CdgEdgeT() const
Function returning true when the edge is a then control dependence edge.
Information associated with an operation or basic block graph.
CONSTREF_FORWARD_DECL(BehavioralHelper)
redefinition of map to manage ordered/unordered structures
bool Switch() const
Return true if it is an edge associated with a switch.
CdfgEdgeInfo()=default
Constructor.
const std::string PrintLabels(const int selector, const BehavioralHelperConstRef BH) const
Return the string of the labels associated with the edge.
redefinition of set to manage ordered/unordered structures
std::map< int, CustomOrderedSet< unsigned int > > labels
edge labels; key is the selector
const CustomOrderedSet< unsigned int > & get_nodeID(const int selector) const
Return the nodeID of type type associated with this edge information.
Base class storing user data information.
Definition: edge_info.hpp:55
Template definition of refcount.
void add_nodeID(unsigned int nodeID, const int type)
Add a nodeID of type type to this edge_info.
Base class description of data information associated with each edge of a graph.
bool CfgEdgeF() const
Function returning true when the edge is an else control flow edge.
bool CdgEdgeF() const
Function returning true when the edge is an else control dependence edge.
bool CfgEdgeT() const
Function returning true when the edge is a then control flow edge.

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