#ifndef TDL_INCLUDE_IR_CODEGEN_TUNE_H #define TDL_INCLUDE_IR_CODEGEN_TUNE_H #include #include #include namespace tdl{ namespace ir{ class value; class module; class instruction; class function; } namespace codegen{ class tune { typedef std::pair node_t; typedef std::map > graph_t; private: void add_constraint(node_t x, node_t y); void init_c_phi(ir::instruction *i); void init_c_graph(ir::instruction *v); void connected_components(node_t x, const std::vector vals, std::set &nodes, graph_t &graph); void create_grids(std::vector &grids, std::map &references, ir::function *fn); public: std::vector get_params(ir::module& mod); std::map get_params(ir::instruction* i); unsigned *get_param(ir::value *value, const std::string &key) { return params_[value][key]; } bool check_constraints(ir::module &fn, std::map> &errors); void run(ir::module &mod); private: std::map> params_; std::vector pool_; graph_t dependencies_; std::set nodes_; std::map static_params_; }; } } #endif