#ifndef IRTOOLS_HH #define IRTOOLS_HH #include #include #include #include "ir_code.hh" #include "dep.hh" #define DEP_DEBUG 0 // IR tree is used to initialize a loop. For a loop node, payload is // its mapped iteration space dimension. For a simple block node, // payload is its mapped statement number. Normal if-else is split // into two nodes where the one with odd payload represents then-part and // the one with even payload represents else-part. struct ir_tree_node { IR_Control *content; ir_tree_node *parent; std::vector children; int payload; ~ir_tree_node() { for (int i = 0; i < children.size(); i++) delete children[i]; delete content; } }; std::vector build_ir_tree(IR_Control *control, ir_tree_node *parent = NULL); std::vector extract_ir_stmts( const std::vector &ir_tree); bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, const DependenceVector &dv, bool before); std::pair, std::vector > test_data_dependences( IR_Code *ir, const omega::CG_outputRepr *repr1, const omega::Relation &IS1, const omega::CG_outputRepr *repr2, const omega::Relation &IS2, std::vector &freevar, std::vector index, int i, int j, std::map > &uninterpreted_symbols, std::map > &uninterpreted_symbols_stringrepr); std::vector collect_loop_inductive_and_conditionals(ir_tree_node * stmt_node); // Manu typedef std::map, std::vector > > tempResultMap; typedef std::pair, std::vector > DVPair; // Manu:: this function is required for reduction operation //omega::CG_outputRepr * from_same_statement(IR_Code *ir, IR_ArrayRef *a, IR_ArrayRef *b); bool from_same_statement(IR_Code *ir, IR_ArrayRef *a, IR_ArrayRef *b); int stmtType(IR_Code *ir, const omega::CG_outputRepr *repr); IR_OPERATION_TYPE getReductionOperator(IR_Code *ir, const omega::CG_outputRepr *repr); void mapRefstoStatements(IR_Code *ir,std::vector access, int ref2Stmt[], std::map >& rMap, std::set& tnrStmts, std::set& nrStmts); void checkReductionDependence(int i, int j, int nestLeveli, omega::coef_t lbound[], omega::coef_t ubound[], int ref2Stmt[], std::map >& rMap, DVPair& dv, tempResultMap& trMap, std::set nrStmts ); #endif