本文整理汇总了C++中nodecl::NodeclBase类的典型用法代码示例。如果您正苦于以下问题:C++ NodeclBase类的具体用法?C++ NodeclBase怎么用?C++ NodeclBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeclBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_ompss_opencl_deallocate_intrinsic
static void handle_ompss_opencl_deallocate_intrinsic(
Nodecl::FunctionCall function_call,
Nodecl::NodeclBase expr_stmt)
{
Nodecl::List arguments = function_call.get_arguments().as<Nodecl::List>();
ERROR_CONDITION(arguments.size() != 1, "More than one argument in ompss_opencl_deallocate call", 0);
Nodecl::NodeclBase actual_argument = arguments[0];
ERROR_CONDITION(!actual_argument.is<Nodecl::FortranActualArgument>(), "Unexpected tree", 0);
Nodecl::NodeclBase arg = actual_argument.as<Nodecl::FortranActualArgument>().get_argument();
TL::Symbol array_sym = ::fortran_data_ref_get_symbol(arg.get_internal_nodecl());
ERROR_CONDITION(
!(array_sym.get_type().is_fortran_array()
&& array_sym.is_allocatable())
&&
!(array_sym.get_type().is_pointer()
&& array_sym.get_type().points_to().is_fortran_array()),
"The argument of 'ompss_opencl_deallocate' intrinsic must be "
"an allocatable array or a pointer to an array\n", 0);
// Replace the current intrinsic call by a call to the Nanos++ API
TL::Symbol ptr_of_arr_sym = get_function_ptr_of(array_sym, expr_stmt.retrieve_context());
TL::Source new_function_call;
new_function_call
<< "CALL NANOS_OPENCL_DEALLOCATE_FORTRAN("
<< ptr_of_arr_sym.get_name() << "("<< as_expression(arg) << "))\n"
;
expr_stmt.replace(new_function_call.parse_statement(expr_stmt));
}
示例2: collapse_check_loop
void Core::collapse_check_loop(TL::PragmaCustomStatement construct)
{
TL::PragmaCustomClause collapse = construct.get_pragma_line().get_clause("collapse");
if (!collapse.is_defined())
return;
TL::ObjectList<Nodecl::NodeclBase> expr_list = collapse.get_arguments_as_expressions(construct);
if (expr_list.size() != 1)
{
error_printf("%s: error: collapse clause needs exactly one argument\n",
locus_to_str(construct.get_locus()));
return;
}
Nodecl::NodeclBase expr = expr_list[0];
if (!expr.is_constant()
|| !is_any_int_type(expr.get_type().get_internal_type()))
{
error_printf("%s: error: collapse clause requires an integer constant expression\n",
locus_to_str(construct.get_locus()));
return;
}
const_value_t* cval = expr.get_constant();
if (!const_value_is_one(cval))
{
error_printf("%s: error: only collapse(1) is supported\n",
locus_to_str(construct.get_locus()));
return;
}
}
示例3: Ret
Nodecl::NodeclVisitor<void>::Ret AVX2StrideVisitorConv::unhandled_node(const Nodecl::NodeclBase& node)
{
//printf("Unsupported %d: %s\n", _vector_num_elements, node.prettyprint().c_str());
if (node.get_type().is_vector())
{
Nodecl::NodeclBase new_node = node.shallow_copy().as<Nodecl::NodeclBase>();
new_node.set_type(TL::Type::get_int_type().get_vector_of_elements(
_vector_num_elements));
// TODO better
node.replace(new_node);
Nodecl::NodeclBase::Children children = node.children();
for(Nodecl::NodeclBase::Children::iterator it = children.begin();
it != children.end();
it ++)
{
walk(*it);
}
}
return Ret();
}
示例4: unhandled_node
bool ArrayAccessInfoVisitor::unhandled_node( const Nodecl::NodeclBase& n )
{
std::cerr << "Unhandled node while parsing Array Subscript '"
<< codegen_to_str( n.get_internal_nodecl( ),
nodecl_retrieve_context( n.get_internal_nodecl( ) ) )
<< "' of type '" << ast_print_node_type( n.get_kind( ) ) << "'" << std::endl;
return false;
}
示例5: Ret
Nodecl::NodeclVisitor<void>::Ret NeonVectorBackend::unhandled_node(const Nodecl::NodeclBase& n)
{
internal_error("NEON Backend: Unknown node %s at %s.",
ast_print_node_type(n.get_kind()),
locus_to_str(n.get_locus()));
return Ret();
}
示例6: visit
void VectorizerVisitorExpression::visit(const Nodecl::ArraySubscript& n)
{
// Computing new vector type
TL::Type vector_type = n.get_type();
if (vector_type.is_lvalue_reference())
{
vector_type = vector_type.references_to();
}
vector_type = get_qualified_vector_to(vector_type, _vector_length);
TL::Type basic_type = n.get_type();
if (basic_type.is_lvalue_reference())
{
basic_type = basic_type.references_to();
}
// Vector Load
if (Vectorizer::_analysis_info->is_adjacent_access(
Vectorizer::_analysis_scopes->back(),
n))
{
const Nodecl::VectorLoad vector_load =
Nodecl::VectorLoad::make(
Nodecl::Reference::make(
Nodecl::ParenthesizedExpression::make(
n.shallow_copy(),
basic_type,
n.get_locus()),
basic_type.get_pointer_to(),
n.get_locus()),
vector_type,
n.get_locus());
n.replace(vector_load);
}
else // Vector Gather
{
const Nodecl::NodeclBase base = n.get_subscripted();
const Nodecl::List subscripts = n.get_subscripts().as<Nodecl::List>();
ERROR_CONDITION(subscripts.size() > 1,
"Vectorizer: Gather on multidimensional array is not supported yet!", 0);
std::cerr << "Gather: " << n.prettyprint() << "\n";
Nodecl::NodeclBase strides = *subscripts.begin();
walk(strides);
const Nodecl::VectorGather vector_gather =
Nodecl::VectorGather::make(
base.shallow_copy(),
strides,
vector_type,
n.get_locus());
n.replace(vector_gather);
}
}
示例7: Ret
Nodecl::NodeclVisitor<void>::Ret VectorizerVisitorFunction::unhandled_node(const Nodecl::NodeclBase& n)
{
std::cerr << "Function Visitor: Unknown node "
<< ast_print_node_type(n.get_kind())
<< " at " << n.get_locus()
<< std::endl;
return Ret();
}
示例8: visit
void VectorizerVisitorPostprocessor::visit(const Nodecl::ObjectInit& n)
{
TL::Symbol sym = n.get_symbol();
Nodecl::NodeclBase init = sym.get_value();
if(!init.is_null())
{
walk(init);
}
}
示例9: get_array_to_with_descriptor
Type Type::get_array_to_with_descriptor(Nodecl::NodeclBase lower_bound, Nodecl::NodeclBase upper_bound, Scope sc)
{
type_t* result_type = this->_type_info;
const decl_context_t* decl_context = sc.get_decl_context();
type_t* array_to = get_array_type_bounds_with_descriptor(result_type,
lower_bound.get_internal_nodecl(),
upper_bound.get_internal_nodecl(),
decl_context);
return Type(array_to);
}
示例10: visit
void SSEVectorLegalization::visit(const Nodecl::ObjectInit& node)
{
TL::Source intrin_src;
TL::Symbol sym = node.get_symbol();
fix_mask_symbol(sym);
// Vectorizing initialization
Nodecl::NodeclBase init = sym.get_value();
if (!init.is_null())
{
walk(init);
}
}
示例11: visit
void NeonVectorBackend::visit(const Nodecl::ObjectInit& n)
{
TL::Source intrin_src;
if(n.has_symbol())
{
TL::Symbol sym = n.get_symbol();
// Vectorizing initialization
Nodecl::NodeclBase init = sym.get_value();
if(!init.is_null())
{
walk(init);
}
}
}
示例12: visit
void SimdVisitor::visit(const Nodecl::OpenMP::Simd& simd_node)
{
Nodecl::NodeclBase for_statement = simd_node.get_statement();
// Vectorize for
Nodecl::NodeclBase epilog =
_vectorizer.vectorize(for_statement.as<Nodecl::ForStatement>(),
_device_name, _vector_length, NULL);
// Add epilog
if (!epilog.is_null())
{
simd_node.append_sibling(epilog);
}
// Remove Simd node
simd_node.replace(for_statement);
}
示例13: get_array_to
Type Type::get_array_to(Nodecl::NodeclBase array_expr, Scope sc)
{
type_t* result_type = this->_type_info;
const decl_context_t* decl_context = sc.get_decl_context();
type_t* array_to = get_array_type(result_type, array_expr.get_internal_nodecl(), decl_context);
return Type(array_to);
}
示例14: as_statement
std::string as_statement(const Nodecl::NodeclBase& n)
{
std::stringstream ss;
ss << nodecl_stmt_to_source(n.get_internal_nodecl());
if (IS_FORTRAN_LANGUAGE)
ss << "\n";
return ss.str();
}
示例15: statement_placeholder
std::string statement_placeholder(Nodecl::NodeclBase& placeholder)
{
std::stringstream ss;
ss << "@STATEMENT-PH::" << placeholder.get_internal_tree_address() << "@";
if (IS_FORTRAN_LANGUAGE)
ss << "\n";
return ss.str();
}