本文整理汇总了C++中nodecl::NodeclBase::get_internal_nodecl方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeclBase::get_internal_nodecl方法的具体用法?C++ NodeclBase::get_internal_nodecl怎么用?C++ NodeclBase::get_internal_nodecl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodecl::NodeclBase
的用法示例。
在下文中一共展示了NodeclBase::get_internal_nodecl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_array_to_with_region
Type Type::get_array_to_with_region(Nodecl::NodeclBase lower_bound,
Nodecl::NodeclBase upper_bound,
Nodecl::NodeclBase region_lower_bound,
Nodecl::NodeclBase region_upper_bound,
Scope sc)
{
type_t* result_type = this->_type_info;
const decl_context_t* decl_context = sc.get_decl_context();
// Make the range of the region
Nodecl::NodeclBase range = Nodecl::Range::make(
region_lower_bound,
region_upper_bound,
const_value_to_nodecl(const_value_get_one(4, 1)),
region_lower_bound.get_type(),
region_lower_bound.get_locus());
type_t* array_to = get_array_type_bounds_with_regions(
result_type,
lower_bound.get_internal_nodecl(),
upper_bound.get_internal_nodecl(),
decl_context,
range.get_internal_nodecl(),
decl_context);
return array_to;
}
示例2: 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;
}
示例3: 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);
}
示例4: 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));
}
示例5: 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();
}
示例6: 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);
}
示例7: build_empty_body_for_function
void build_empty_body_for_function(
TL::Symbol function_symbol,
Nodecl::NodeclBase &function_code,
Nodecl::NodeclBase &empty_stmt)
{
empty_stmt = Nodecl::EmptyStatement::make(make_locus("", 0, 0));
Nodecl::List stmt_list = Nodecl::List::make(empty_stmt);
if (IS_C_LANGUAGE || IS_CXX_LANGUAGE)
{
Nodecl::CompoundStatement compound_statement =
Nodecl::CompoundStatement::make(stmt_list,
/* destructors */ Nodecl::NodeclBase::null(),
make_locus("", 0, 0));
stmt_list = Nodecl::List::make(compound_statement);
}
Nodecl::NodeclBase context = Nodecl::Context::make(
stmt_list,
function_symbol.get_related_scope(), make_locus("", 0, 0));
function_symbol.get_internal_symbol()->defined = 1;
if (function_symbol.is_dependent_function())
{
function_code = Nodecl::TemplateFunctionCode::make(context,
// Initializers
Nodecl::NodeclBase::null(),
function_symbol,
make_locus("", 0, 0));
}
else
{
function_code = Nodecl::FunctionCode::make(context,
// Initializers
Nodecl::NodeclBase::null(),
function_symbol,
make_locus("", 0, 0));
}
function_symbol.get_internal_symbol()->entity_specs.function_code = function_code.get_internal_nodecl();
}
示例8: set_value
void Symbol::set_value(Nodecl::NodeclBase n)
{
_symbol->value = n.get_internal_nodecl();
}
示例9: as_expression
std::string as_expression(const Nodecl::NodeclBase& n)
{
ERROR_CONDITION (n.is_null(), "Cannot create a literal expression from a null node", 0);
return nodecl_expr_to_source(n.get_internal_nodecl());
}
示例10:
UNUSED_PARAMETER static void print_ast_dot(const Nodecl::NodeclBase &node)
{
std::cerr << std::endl << std::endl;
ast_dump_graphviz(nodecl_get_ast(node.get_internal_nodecl()), stderr);
std::cerr << std::endl << std::endl;
}
示例11: handle_ompss_opencl_allocate_intrinsic
static void handle_ompss_opencl_allocate_intrinsic(
Nodecl::FunctionCall function_call,
std::map<std::pair<TL::Type, std::pair<int, bool> > , Symbol> &declared_ocl_allocate_functions,
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_allocate' call\n", 0);
Nodecl::NodeclBase actual_argument = arguments[0];
ERROR_CONDITION(!actual_argument.is<Nodecl::FortranActualArgument>(), "Unexpected tree\n", 0);
Nodecl::NodeclBase arg = actual_argument.as<Nodecl::FortranActualArgument>().get_argument();
ERROR_CONDITION(!arg.is<Nodecl::ArraySubscript>(), "Unreachable code\n", 0);
Nodecl::NodeclBase subscripted = arg.as<Nodecl::ArraySubscript>().get_subscripted();
TL::Symbol subscripted_symbol = ::fortran_data_ref_get_symbol(subscripted.get_internal_nodecl());
ERROR_CONDITION(
!(subscripted_symbol.get_type().is_fortran_array()
&& subscripted_symbol.is_allocatable())
&&
!(subscripted_symbol.get_type().is_pointer()
&& subscripted_symbol.get_type().points_to().is_fortran_array()),
"The argument of 'ompss_opencl_allocate' intrinsic must be "
"an allocatable array or a pointer to an array with all its bounds specified\n", 0);
TL::Type array_type;
int num_dimensions;
bool is_allocatable;
if (subscripted_symbol.is_allocatable())
{
array_type = subscripted_symbol.get_type();
num_dimensions = subscripted_symbol.get_type().get_num_dimensions();
is_allocatable = true;
}
else
{
array_type = subscripted_symbol.get_type().points_to();
num_dimensions = array_type.get_num_dimensions();
is_allocatable = false;
}
TL::Type element_type = array_type;
while (element_type.is_array())
{
element_type = element_type.array_element();
}
ERROR_CONDITION(!array_type.is_array(), "This type should be an array type", 0);
std::pair<TL::Type, std::pair<int, bool> > key =
std::make_pair(element_type, std::make_pair(num_dimensions, is_allocatable));
std::map<std::pair<TL::Type, std::pair<int, bool> > , Symbol>::iterator it_new_fun =
declared_ocl_allocate_functions.find(key);
// Reuse the auxiliar function if it already exists
Symbol new_function_sym;
if (it_new_fun != declared_ocl_allocate_functions.end())
{
new_function_sym = it_new_fun->second;
}
else
{
new_function_sym = create_new_function_opencl_allocate(
expr_stmt, subscripted_symbol, element_type, num_dimensions, is_allocatable);
declared_ocl_allocate_functions[key] = new_function_sym;
}
// Replace the current intrinsic call by a call to the new function
TL::Source actual_arg_array;
Nodecl::NodeclBase subscripted_lvalue = subscripted.shallow_copy();
subscripted_lvalue.set_type(subscripted_symbol.get_type().no_ref().get_lvalue_reference_to());
actual_arg_array << as_expression(subscripted_lvalue);
TL::Source actual_arg_bounds;
Nodecl::List subscripts = arg.as<Nodecl::ArraySubscript>().get_subscripts().as<Nodecl::List>();
for (Nodecl::List::reverse_iterator it = subscripts.rbegin();
it != subscripts.rend();
it++)
{
Nodecl::NodeclBase subscript = *it, lower, upper;
if (it != subscripts.rbegin())
actual_arg_bounds << ", ";
if (subscript.is<Nodecl::Range>())
{
lower = subscript.as<Nodecl::Range>().get_lower();
upper = subscript.as<Nodecl::Range>().get_upper();
}
else
{
lower = nodecl_make_integer_literal(
fortran_get_default_integer_type(),
const_value_get_signed_int(1), make_locus("", 0, 0));
upper = subscript;
}
//.........这里部分代码省略.........