virtual void visit(const Nodecl::Symbol& node) { TL::Symbol sym = node.get_symbol(); auto it = _m.find(sym); if (it != _m.end()) { node.replace(Source(it->second).parse_expression(_scope)); } }
void visit(const Nodecl::Symbol& node) { TL::Symbol sym = node.get_symbol(); std::map<TL::Symbol, Nodecl::NodeclBase>::const_iterator it = _reduction_symbol_to_nodecl_map.find(sym); if (it == _reduction_symbol_to_nodecl_map.end()) return; node.replace(it->second.shallow_copy()); }
void visit(const Nodecl::Symbol& node) { TL::Symbol sym = node.get_symbol(); if ((_data_sharing.get_data_sharing(sym, /* check_enclosing */ false) & ~DS_IMPLICIT) == DS_UNDEFINED) { // Mark this as an implicit firstprivate _data_sharing.set_data_sharing(sym, TL::OpenMP::DataSharingAttribute( DS_FIRSTPRIVATE | DS_IMPLICIT) ); std::cerr << node.get_locus_str() << ": warning: assuming '" << sym.get_qualified_name() << "' as firstprivate" << std::endl; } }
virtual void visit(const Nodecl::Symbol& node) { TL::Symbol sym = node.get_symbol(); if (_sym == sym) exist = true; }
void VectorizerVisitorExpression::visit(const Nodecl::Symbol& n) { TL::Type sym_type = n.get_type(); //std::cerr << "scalar_type: " << n.prettyprint() << std::endl; if (!sym_type.is_vector()) { // Vectorize BASIC induction variable if (Vectorizer::_analysis_info->is_basic_induction_variable( Vectorizer::_analysis_scopes->back(), n)) { std::cerr << "Basic IV: " << n.prettyprint() << "\n"; // Computing IV offset {0, 1, 2, 3} TL::ObjectList<Nodecl::NodeclBase> literal_list; const_value_t *ind_var_increment = Vectorizer::_analysis_info->get_induction_variable_increment( Vectorizer::_analysis_scopes->back(), n); for(const_value_t *i = const_value_get_zero(4, 0); const_value_is_nonzero(const_value_lt(i, const_value_get_unsigned_int(_unroll_factor))); i = const_value_add(i, ind_var_increment)) { literal_list.prepend(const_value_to_nodecl(i)); } Nodecl::List offset = Nodecl::List::make(literal_list); // IV cannot be a reference TL::Type ind_var_type = get_qualified_vector_to(n.get_type(), _vector_length).no_ref(); TL::Type offset_type = ind_var_type; Nodecl::ParenthesizedExpression vector_induction_var = Nodecl::ParenthesizedExpression::make( Nodecl::VectorAdd::make( Nodecl::VectorPromotion::make( n.shallow_copy(), ind_var_type, n.get_locus()), Nodecl::VectorLiteral::make( offset, offset_type, n.get_locus()), get_qualified_vector_to(n.get_type(), _vector_length), n.get_locus()), get_qualified_vector_to(n.get_type(), _vector_length), n.get_locus()); n.replace(vector_induction_var); } // Vectorize symbols declared in the SIMD scope else if (is_declared_in_scope( _simd_inner_scope.get_decl_context().current_scope, n.get_symbol().get_scope().get_decl_context().current_scope)) { //std::cerr << "NS scalar_type: " << n.prettyprint() << std::endl; TL::Symbol tl_sym = n.get_symbol(); TL::Type tl_sym_type = tl_sym.get_type(); //TL::Symbol if (tl_sym_type.is_scalar_type()) { //std::cerr << "TS scalar_type: " << n.prettyprint() << std::endl; tl_sym.set_type(get_qualified_vector_to(tl_sym_type, _vector_length)); tl_sym_type = tl_sym.get_type(); } //Nodecl::Symbol Nodecl::Symbol new_sym = Nodecl::Symbol::make(tl_sym, n.get_locus()); new_sym.set_type(tl_sym_type.get_lvalue_reference_to()); n.replace(new_sym); } // Vectorize constants else if (Vectorizer::_analysis_info->is_constant( Vectorizer::_analysis_scopes->back(), n)) { const Nodecl::VectorPromotion vector_prom = Nodecl::VectorPromotion::make( n.shallow_copy(), get_qualified_vector_to(sym_type, _vector_length), n.get_locus()); n.replace(vector_prom); } else { //TODO: If you are from outside of the loop -> Vector local copy. running_error("Vectorizer: Loop is not vectorizable. '%s' is not IV or Constant or Local.", n.get_symbol().get_name().c_str()); } } }