Type Type::get_unqualified_type_but_keep_restrict() { // Might return itself if not qualified if (is_restrict_qualified_type(this->_type_info)) { return get_cv_qualified_type(this->_type_info, CV_RESTRICT); } else { return get_cv_qualified_type(this->_type_info, CV_NONE); } }
static void init_spu_types(void) { V16QI_type_node = build_vector_type (intQI_type_node, 16); V8HI_type_node = build_vector_type (intHI_type_node, 16); V4SI_type_node = build_vector_type (intSI_type_node, 16); V2DI_type_node = build_vector_type (intDI_type_node, 16); V4SF_type_node = build_vector_type (float_type_node, 16); V2DF_type_node = build_vector_type (double_type_node, 16); unsigned_V16QI_type_node = build_vector_type (unsigned_intQI_type_node, 16); unsigned_V8HI_type_node = build_vector_type (unsigned_intHI_type_node, 16); unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 16); unsigned_V2DI_type_node = build_vector_type (unsigned_intDI_type_node, 16); spu_builtin_types[SPU_BTI_QUADWORD] = V16QI_type_node; spu_builtin_types[SPU_BTI_7] = get_signed_int_type(); spu_builtin_types[SPU_BTI_S7] = get_signed_int_type(); spu_builtin_types[SPU_BTI_U7] = get_signed_int_type(); spu_builtin_types[SPU_BTI_S10] = get_signed_int_type(); spu_builtin_types[SPU_BTI_S10_4] = get_signed_int_type(); spu_builtin_types[SPU_BTI_U14] = get_signed_int_type(); spu_builtin_types[SPU_BTI_16] = get_signed_int_type(); spu_builtin_types[SPU_BTI_S16] = get_signed_int_type(); spu_builtin_types[SPU_BTI_S16_2] = get_signed_int_type(); spu_builtin_types[SPU_BTI_U16] = get_signed_int_type(); spu_builtin_types[SPU_BTI_U16_2] = get_signed_int_type(); spu_builtin_types[SPU_BTI_U18] = get_signed_int_type(); spu_builtin_types[SPU_BTI_INTQI] = get_signed_char_type(); spu_builtin_types[SPU_BTI_INTHI] = get_signed_short_int_type(); spu_builtin_types[SPU_BTI_INTSI] = get_signed_int_type(); spu_builtin_types[SPU_BTI_INTDI] = get_signed_long_long_int_type(); spu_builtin_types[SPU_BTI_UINTQI] = get_unsigned_char_type(); spu_builtin_types[SPU_BTI_UINTHI] = get_unsigned_short_int_type(); spu_builtin_types[SPU_BTI_UINTSI] = get_unsigned_int_type(); spu_builtin_types[SPU_BTI_UINTDI] = get_unsigned_long_long_int_type(); spu_builtin_types[SPU_BTI_FLOAT] = get_float_type(); spu_builtin_types[SPU_BTI_DOUBLE] = get_double_type(); spu_builtin_types[SPU_BTI_VOID] = get_void_type(); spu_builtin_types[SPU_BTI_PTR] = get_cv_qualified_type(get_pointer_type(get_void_type()), CV_CONST | CV_VOLATILE); }
Type Type::get_const_type() { // Might return itself if already const qualified return get_cv_qualified_type(this->_type_info, (cv_qualifier_t)(get_cv_qualifier(this->_type_info) | CV_CONST)); }
Type Type::get_unqualified_type() { // Might return itself if not qualified return get_cv_qualified_type(this->_type_info, CV_NONE); }
Type Type::fix_references_() { if ((IS_C_LANGUAGE && this->is_any_reference()) || (IS_CXX_LANGUAGE && this->is_rebindable_reference())) { TL::Type ref = this->references_to(); if (ref.is_array()) { // T (&a)[10] -> T * const // T (&a)[10][20] -> T (* const)[20] ref = ref.array_element(); } // T &a -> T * const a TL::Type ptr = ref.get_pointer_to(); if (!this->is_rebindable_reference()) { ptr = ptr.get_const_type(); } return ptr; } else if (IS_FORTRAN_LANGUAGE && this->is_any_reference()) { return this->references_to(); } else if (this->is_array()) { if (this->array_is_region()) { Nodecl::NodeclBase lb, reg_lb, ub, reg_ub; this->array_get_bounds(lb, ub); this->array_get_region_bounds(reg_lb, reg_ub); TL::Scope sc = array_type_get_region_size_expr_context(this->get_internal_type()); return this->array_element().fix_references_().get_array_to_with_region(lb, ub, reg_lb, reg_ub, sc); } else { Nodecl::NodeclBase size = this->array_get_size(); TL::Scope sc = array_type_get_array_size_expr_context(this->get_internal_type()); return this->array_element().fix_references_().get_array_to(size, sc); } } else if (this->is_pointer()) { TL::Type fixed = this->points_to().fix_references_().get_pointer_to(); cv_qualifier_t cv_qualif = CV_NONE; ::advance_over_typedefs_with_cv_qualif(this->get_internal_type(), &cv_qualif); fixed = ::get_cv_qualified_type(fixed.get_internal_type(), cv_qualif); return fixed; } else if (this->is_function()) { // Do not fix unprototyped functions if (this->lacks_prototype()) return (*this); cv_qualifier_t cv_qualif = CV_NONE; ::advance_over_typedefs_with_cv_qualif(this->get_internal_type(), &cv_qualif); ref_qualifier_t ref_qualifier = function_type_get_ref_qualifier(this->get_internal_type()); TL::Type fixed_result = this->returns().fix_references_(); bool has_ellipsis = 0; TL::ObjectList<TL::Type> fixed_parameters = this->parameters(has_ellipsis); for (TL::ObjectList<TL::Type>::iterator it = fixed_parameters.begin(); it != fixed_parameters.end(); it++) { *it = it->fix_references_(); } TL::ObjectList<TL::Type> nonadjusted_fixed_parameters = this->nonadjusted_parameters(); for (TL::ObjectList<TL::Type>::iterator it = nonadjusted_fixed_parameters.begin(); it != nonadjusted_fixed_parameters.end(); it++) { *it = it->fix_references_(); } TL::Type fixed_function = fixed_result.get_function_returning( fixed_parameters, nonadjusted_fixed_parameters, has_ellipsis, ref_qualifier); fixed_function = TL::Type(get_cv_qualified_type(fixed_function.get_internal_type(), cv_qualif)); return fixed_function; } // Note: we are not fixing classes else { // Anything else must be left untouched return (*this); } }
Type Type::get_added_qualification_of(TL::Type t) { cv_qualifier_t cv = get_cv_qualifier(t._type_info); return get_cv_qualified_type(this->_type_info, (cv_qualifier_t)(cv | get_cv_qualifier(this->_type_info))); }
Type Type::get_as_qualified_as(TL::Type t) { cv_qualifier_t cv = get_cv_qualifier(t._type_info); return get_cv_qualified_type(this->_type_info, cv); }
Type Type::get_restrict_type() { // Might return itself if already restrict qualified return get_cv_qualified_type(this->_type_info, (cv_qualifier_t)(get_cv_qualifier(this->_type_info) | CV_RESTRICT)); }
Type Type::get_volatile_type() { // Might return itself if already volatile qualified return get_cv_qualified_type(this->_type_info, (cv_qualifier_t)(get_cv_qualifier(this->_type_info) | CV_VOLATILE)); }