104 unsigned int _function_id,
const DesignFlowManagerConstRef _design_flow_manager)
116 switch(relationship_type)
120 relationships.insert(std::make_pair(COMPLETE_BB_GRAPH,
SAME_FUNCTION));
121 relationships.insert(std::make_pair(EXTRACT_PATTERNS,
SAME_FUNCTION));
122 relationships.insert(std::make_pair(HDL_VAR_DECL_FIX,
SAME_FUNCTION));
123 relationships.insert(std::make_pair(USE_COUNTING,
SAME_FUNCTION));
132 relationships.insert(std::make_pair(COND_EXPR_RESTRUCTURING,
SAME_FUNCTION));
133 relationships.insert(std::make_pair(CSE_STEP,
SAME_FUNCTION));
134 relationships.insert(std::make_pair(FANOUT_OPT,
SAME_FUNCTION));
135 relationships.insert(std::make_pair(FUNCTION_CALL_OPT,
SAME_FUNCTION));
136 relationships.insert(std::make_pair(VECTORIZE,
SAME_FUNCTION));
144 return relationships;
150 auto* v_ssa_name = GetPointer<ssa_name>(
GET_NODE(v));
155 if(v_ssa_name->volatile_flag)
160 "SSA " + v_ssa_name->ToString() +
" (" +
STR(v_ssa_name->index) +
") is not in SSA form");
161 unsigned int def_stmt =
GET_INDEX_NODE(v_ssa_name->CGetDefStmt());
162 if(((
GET_NODE(v_ssa_name->CGetDefStmt()))->get_kind() == gimple_nop_K &&
163 GET_NODE(v_ssa_name->var)->get_kind() == parm_decl_K))
168 for(
const auto& stmt : B->CGetStmtList())
177 if(B->live_in.find(v_index) != B->live_in.end())
182 B->live_in.insert(v_index);
184 for(
const auto&
phi : B->CGetPhiList())
193 auto lp_it_end = B->list_of_pred.end();
194 for(
auto lp_it = B->list_of_pred.begin(); lp_it != lp_it_end; ++lp_it)
197 P->live_out.insert(v_index);
206 auto* fd = GetPointer<function_decl>(tn);
207 THROW_ASSERT(fd && fd->body,
"Node is not a function or it hasn't a body");
208 auto*
sl = GetPointer<statement_list>(
GET_NODE(fd->body));
210 auto B_it_end =
sl->list_of_bloc.end();
212 for(
auto B_it =
sl->list_of_bloc.begin(); B_it != B_it_end; ++B_it)
214 blocRef
B = B_it->second;
215 unsigned int B_id = B->number;
217 auto ls_it_end = B->list_of_succ.end();
218 for(
auto ls_it = B->list_of_succ.begin(); ls_it != ls_it_end; ++ls_it)
220 const blocRef B_succ =
sl->list_of_bloc[*ls_it];
221 for(
auto const&
phi : B_succ->CGetPhiList())
224 bool is_virtual = pn->virtual_flag;
227 for(
const auto& def_edge : pn->CGetDefEdgesList())
229 if(def_edge.second == B_id)
242 for(
const auto& stmt : B->CGetStmtList())
245 for(
const auto& stmt_use : stmt_uses)
249 bb_ssa_uses.insert(stmt_use.first);
254 for(
const auto& ssa_use : bb_ssa_uses)
267 for(
auto B_it =
sl->list_of_bloc.begin(); B_it != B_it_end; ++B_it)
269 blocRef
B = B_it->second;
270 auto li_it_end = B->live_in.end();
272 for(
auto li_it = B->live_in.begin(); li_it != li_it_end; ++li_it)
277 auto lo_it_end = B->live_out.end();
279 for(
auto lo_it = B->live_out.begin(); lo_it != lo_it_end; ++lo_it)
294 const auto TM =
AppM->get_tree_manager();
296 auto fd = GetPointer<function_decl>(tn);
297 THROW_ASSERT(fd && fd->body,
"Node is not a function or it hasn't a body");
298 auto sl = GetPointer<statement_list>(
GET_NODE(fd->body));
299 for(
const auto&
block :
sl->list_of_bloc)
301 block.second->live_in.clear();
302 block.second->live_out.clear();
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
File containing functions and utilities to support the printing of debug messagges.
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.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
std::string get_function_name() const
Return the name of the function.
This struct specifies the statement_list node.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
void Up_and_Mark(blocRef B, tree_nodeRef v, statement_list *sl)
Algorithm 5: Explore all paths from a variable’s use to its definition.
std::map< unsigned int, blocRef > list_of_bloc
list_of_bloc field is the list of basic block. If this field is null then the list_of_stmt field is n...
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define PRINT_DBG_STRING(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed; no newline is added;...
Non-Iterative liveness analysis for SSA based gimple descriptions.
Data structure describing a basic block at tree level.
unsigned int bb_version
The version of the basic block intermediate representation on which this step has been applied...
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
DesignFlowStep_Status InternalExec() override
Performes the liveness analysis.
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
static bool is_virtual(const tree_managerConstRef &TM, const unsigned int index)
return true in case the ssa_name is virtual
~NI_SSA_liveness() override
Destructor.
Target must be reexecuted.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
std::string PrintVariable(unsigned int var) const
Print the name of the variable associated to the index.
NI_SSA_liveness(const ParameterConstRef _Param, const application_managerRef _AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
This struct specifies the block node.
This file collects some utility functions.
const unsigned int function_id
The index of the function to be analyzed.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
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.
int debug_level
The debug level.
static void ComputeSsaUses(const tree_nodeRef &, TreeNodeMap< size_t > &uses)
recursively compute the references to the ssa_name variables used in a statement
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
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 ...