64 const DesignFlowManagerConstRef _design_flow_manager,
94 std::vector<vertex>& rev_pos, std::vector<bool>& vis,
100 auto statement = rev_pos.at(u);
101 for(boost::tie(ei, ei_end) = boost::out_edges(statement, *avg); ei != ei_end; ei++)
104 if(pos.find(vi) != pos.end())
106 to.insert(pos.find(vi)->second);
113 keep.insert(std::make_pair(u, dest));
123 if(
parameters->getOption<
bool>(OPT_print_dot))
125 std::string file_name;
126 file_name =
"AGG_VIRTUALG.dot";
131 for(boost::tie(basic_block, basic_block_end) = boost::vertices(*bb_fcfg); basic_block != basic_block_end;
136 std::vector<vertex> rev_pos;
137 unsigned posIndex = 0;
139 for(
const auto statement : bb_node_info->statements_list)
142 pos[statement] = posIndex;
144 rev_pos.push_back(statement);
146 std::vector<bool> vis(posIndex,
false);
147 const auto n_stmts = bb_node_info->statements_list.size();
149 for(posIndex = 0; posIndex < n_stmts; ++posIndex)
151 if(!vis.at(posIndex))
153 ordered_dfs(posIndex, avg, pos, rev_pos, vis, keep);
154 for(
unsigned posIndex0 = posIndex + 1; posIndex0 < n_stmts; ++posIndex0)
156 if(vis.at(posIndex0))
158 vis[posIndex0] =
false;
163 for(
const auto statement : bb_node_info->statements_list)
167 std::list<EdgeDescriptor> to_be_removed;
168 for(boost::tie(ei, ei_end) = boost::out_edges(statement, *avg); ei != ei_end; ei++)
171 if(pos.find(vi) != pos.end())
173 auto key = std::make_pair(pos.at(statement), pos.at(vi));
174 if(keep.find(
key) == keep.end())
176 to_be_removed.push_back(*ei);
180 for(
auto e0 : to_be_removed)
189 if(
parameters->getOption<
bool>(OPT_print_dot))
191 std::string file_name;
192 file_name =
"AGG_VIRTUALG-post.dot";
194 file_name =
"OP_FFLSAODG2.dot";
199 template <
typename type>
201 const int adg_selector,
const int fb_adg_selector)
203 const auto TM =
AppM->get_tree_manager();
210 std::map<type, CustomOrderedSet<vertex>> defs, overs;
213 for(boost::tie(vi, vi_end) = boost::vertices(*cfg); vi != vi_end; vi++)
217 for(
auto local_def : local_defs)
220 defs[local_def].insert(*vi);
226 for(boost::tie(vi, vi_end) = boost::vertices(*cfg); vi != vi_end; vi++)
230 for(
auto local_over : local_overs)
233 "---" + TM->get_tree_node_const(local_over)->ToString());
234 overs[local_over].insert(*vi);
240 for(boost::tie(vi, vi_end) = boost::vertices(*cfg); vi != vi_end; vi++)
243 "-->Computing anti and data dependencies of vertex " +
GET_NAME(cfg, *vi));
247 "-->Considering use of " + TM->get_tree_node_const(local_use)->ToString());
248 if(defs.find(local_use) != defs.end())
250 for(
const auto this_def : defs.find(local_use)->second)
252 const bool forward_dependence =
function_behavior->CheckReachability(this_def, *vi);
253 const bool feedback_dependence =
function_behavior->CheckReachability(*vi, this_def);
254 THROW_ASSERT(!(forward_dependence and feedback_dependence),
255 "Dependence between operation " +
GET_NAME(cfg, this_def) +
" and " +
GET_NAME(cfg, *vi) +
256 " is in both the direction");
257 if(forward_dependence)
260 "---Adding data dependence " +
GET_NAME(cfg, this_def) +
"-->" +
GET_NAME(cfg, *vi));
271 if(feedback_dependence)
274 "---Checking for feedback data dependence " +
GET_NAME(cfg, this_def) +
"-->" +
296 if(overs.find(local_use) != overs.end())
298 for(
const auto this_over : overs.find(local_use)->second)
304 "---Adding anti dependence " +
GET_NAME(cfg, *vi) +
"-->" +
GET_NAME(cfg, this_over));
313 "<--Computed anti and data dependencies of vertex " +
GET_NAME(cfg, *vi));
315 "-->Computing output dependencies of vertex " +
GET_NAME(cfg, *vi));
318 if(defs.find(local_def) != defs.end())
320 for(
const auto this_def : defs.find(local_def)->second)
322 const bool forward_dependence =
function_behavior->CheckReachability(this_def, *vi);
323 if(forward_dependence)
338 "<--Computed output dependencies of vertex " +
GET_NAME(cfg, *vi));
341 if(
parameters->getOption<
bool>(OPT_print_dot))
343 std::string file_name;
344 file_name =
"OP_DFG.dot";
346 file_name =
"OP_FDFG.dot";
348 file_name =
"OP_ADG.dot";
350 file_name =
"OP_FADG.dot";
352 file_name =
"OP_ODG.dot";
354 file_name =
"OP_FODG.dot";
356 file_name =
"OP_SAODG1.dot";
363 std::deque<vertex> vertices;
364 boost::topological_sort(*dfg, std::front_inserter(vertices));
366 catch(
const char* msg)
370 catch(
const std::string& msg)
374 catch(
const std::exception& ex)
405 ->CGetOpNodeInfo(statement)
406 ->GetVariables(variable_type, variable_access_type);
Anti + Data flow graph dependence between aggregates.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
boost::graph_traits< graph >::out_edge_iterator OutEdgeIterator
out_edge_iterator definition.
Basic block control flow graph.
File containing functions and utilities to support the printing of debug messagges.
DataDependenceComputation(const application_managerRef _AppM, unsigned int function_id, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
#define FB_DFG_SCA_SELECTOR
Data flow graph edge selector between computed on scalars.
std::string get_function_name() const
Return the name of the function.
Definition of the class representing a generic C application.
Base class for different data dependence computation.
Anti-dependence graph with feedback.
#define FB_ADG_SCA_SELECTOR
Feedback Anti-dependence graph edge selector computed on scalar.
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
FunctionBehavior_VariableType
The possible type of a variable.
const FrontendFlowStepType frontend_flow_step_type
The type of this step.
redefinition of map to manage ordered/unordered structures
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
void do_dependence_reduction()
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
#define FB_DFG_AGG_SELECTOR
Data flow graph edge selector between computed on aggregates.
DesignFlowStep_Status Computedependencies(const int dfg_selector, const int fb_dfg_selector, const int adg_selector, const int fb_adg_selector)
Compute the dependencies.
DesignFlowStep_Status InternalExec() final
Cleans the fake data dependencies.
#define FB_ODG_AGG_SELECTOR
Feedback Output-dependence graph edge selector computed on aggregates.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
#define ODG_SELECTOR
Output-dependence graph edge selector.
redefinition of set to manage ordered/unordered structures
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
FunctionBehavior_VariableAccessType
The access type to a variable.
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
~DataDependenceComputation() override
Destructor.
#define DFG_SELECTOR
Data flow graph edge selector.
#define ADG_SELECTOR
Anti-dependence graph edge selector.
enum FrontendFlowStepType { CREATE_TREE_MANAGER, FIND_MAX_TRANSFORMATIONS, FUNCTION_ANALYSIS, SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP, ADD_BB_ECFG_EDGES, ADD_ARTIFICIAL_CALL_FLOW_EDGES, ADD_OP_EXIT_FLOW_EDGES, ADD_OP_LOOP_FLOW_EDGES, ADD_OP_PHI_FLOW_EDGES, BAMBU_FRONTEND_FLOW, BASIC_BLOCKS_CFG_COMPUTATION, BB_CONTROL_DEPENDENCE_COMPUTATION, BB_FEEDBACK_EDGES_IDENTIFICATION, BB_ORDER_COMPUTATION, BB_REACHABILITY_COMPUTATION, BIT_VALUE, BIT_VALUE_OPT, BITVALUE_RANGE, BIT_VALUE_IPA, BLOCK_FIX, BUILD_VIRTUAL_PHI, CALL_EXPR_FIX, CALL_GRAPH_BUILTIN_CALL, CHECK_SYSTEM_TYPE, COMPLETE_BB_GRAPH, COMPLETE_CALL_GRAPH, COMPUTE_IMPLICIT_CALLS, COMMUTATIVE_EXPR_RESTRUCTURING, COND_EXPR_RESTRUCTURING, CSE_STEP, DATAFLOW_CG_EXT, DEAD_CODE_ELIMINATION, DEAD_CODE_ELIMINATION_IPA, DETERMINE_MEMORY_ACCESSES, DOM_POST_DOM_COMPUTATION, EXTRACT_GIMPLE_COND_OP, EXTRACT_PATTERNS, FIX_STRUCTS_PASSED_BY_VALUE, FUNCTION_CALL_TYPE_CLEANUP, FUNCTION_CALL_OPT, FANOUT_OPT, FIX_VDEF, HDL_FUNCTION_DECL_FIX, HDL_VAR_DECL_FIX, HLS_DIV_CG_EXT, HWCALL_INJECTION, INTERFACE_INFER, IR_LOWERING, LOOP_COMPUTATION, LOOPS_ANALYSIS_BAMBU, LOOPS_COMPUTATION, LUT_TRANSFORMATION, MULTI_WAY_IF, MULTIPLE_ENTRY_IF_REDUCTION, NI_SSA_LIVENESS, OP_CONTROL_DEPENDENCE_COMPUTATION, OP_FEEDBACK_EDGES_IDENTIFICATION, OP_ORDER_COMPUTATION, OP_REACHABILITY_COMPUTATION, OPERATIONS_CFG_COMPUTATION, PARM2SSA, PARM_DECL_TAKEN_ADDRESS, PHI_OPT, PREDICATE_STATEMENTS, ESSA, RANGE_ANALYSIS, REBUILD_INITIALIZATION, REBUILD_INITIALIZATION2, REMOVE_CLOBBER_GA, REMOVE_ENDING_IF, SCALAR_SSA_DATA_FLOW_ANALYSIS, SERIALIZE_MUTUAL_EXCLUSIONS, SPLIT_RETURN, SHORT_CIRCUIT_TAF, SIMPLE_CODE_MOTION, SOFT_FLOAT_CG_EXT, STRING_CST_FIX, SWITCH_FIX, UN_COMPARISON_LOWERING, UNROLLING_DEGREE, USE_COUNTING, VAR_ANALYSIS, VAR_DECL_FIX, VECTORIZE, VERIFICATION_OPERATION, VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, VIRTUAL_PHI_NODES_SPLIT } FrontendFlowStepType
Output dependence graph with feedback.
static void ordered_dfs(unsigned u, const OpGraphConstRef avg, CustomUnorderedMap< vertex, unsigned > &pos, std::vector< vertex > &rev_pos, std::vector< bool > &vis, CustomUnorderedSet< std::pair< unsigned, unsigned >> &keep)
#define DFG_SCA_SELECTOR
Selectors used only in operation graphs; numbers continue from cdfg_edge_info.hpp.
const application_managerRef AppM
The application manager.
Data flow graph with feedback.
Class specification of the basic_block structure.
#define FB_ADG_AGG_SELECTOR
Feedback Anti-dependence graph edge selector computed on aggregates.
const BBNodeInfoConstRef CGetBBNodeInfo(const vertex node) const
Return the info associated with a basic block.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
this class is used to manage the command-line or XML options.
#define ODG_AGG_SELECTOR
Output-dependence graph edge selector computed on aggregates.
#define DFG_AGG_SELECTOR
Data flow graph edge selector between computed on aggregates.
int debug_level
The debug level.
This class provides methods to build an operations graph.
#define ADG_AGG_SELECTOR
Anti-dependence graph edge selector computed on aggregates.
System dependence + anti-dependence graph + output dependence graph.
System dependence + anti-dependence + output dependence graph + flow graph with feedback.
#define ADG_SCA_SELECTOR
Anti-dependence graph edge selector computed on scalar.
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
CustomSet< type > GetVariables(const vertex statement, const FunctionBehavior_VariableAccessType variable_access_type) const
Return the variables accessed in a node It is specialized in the different subclasses of this...
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...