Changeset 3e91c6f9 for src


Ignore:
Timestamp:
Mar 13, 2025, 9:26:17 AM (2 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
8b639f9
Parents:
3bd9508 (diff), 594671a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

fix pull conflicit

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/BasicTypes-gen.cpp

    r3bd9508 r3e91c6f9  
    5353        Float128xComplex,
    5454        NUMBER_OF_BASIC_TYPES,
    55 
    56         Float32x4,                                                                                      // ARM, gcc-14
    57         Float64x2,
    58         Svfloat32,
    59         Svfloat64,
    60         Svbool,
    6155};
    6256
  • TabularUnified src/Common/Iterate.hpp

    r3bd9508 r3e91c6f9  
    208208        return group_iterate_t<Args...>( std::forward<Args>( args )... );
    209209}
    210 
    211 // -----------------------------------------------------------------------------
    212 // Helper struct and function to support
    213 // for ( val : lazy_map( container1, f ) ) {}
    214 // syntax to have a for each that iterates a container,
    215 // mapping each element by applying f.
    216 
    217 template< typename T, typename Func >
    218 struct lambda_iterate_t {
    219         const T & ref;
    220         std::function<Func> f;
    221 
    222         struct iterator {
    223                 typedef decltype(begin(ref)) Iter;
    224                 Iter it;
    225                 std::function<Func> f;
    226                 iterator( Iter it, std::function<Func> f ) : it(it), f(f) {}
    227                 iterator & operator++() {
    228                         ++it; return *this;
    229                 }
    230                 bool operator!=( const iterator &other ) const { return it != other.it; }
    231                 auto operator*() const -> decltype(f(*it)) { return f(*it); }
    232         };
    233 
    234         lambda_iterate_t( const T & ref, std::function<Func> f ) : ref(ref), f(f) {}
    235 
    236         auto begin() const -> decltype(iterator(std::begin(ref), f)) { return iterator(std::begin(ref), f); }
    237         auto end() const   -> decltype(iterator(std::end(ref), f)) { return iterator(std::end(ref), f); }
    238 };
    239 
    240 template< typename... Args >
    241 lambda_iterate_t<Args...> lazy_map( const Args &... args ) {
    242         return lambda_iterate_t<Args...>( args...);
    243 }
    244 
    245 // Local Variables: //
    246 // tab-width: 4 //
    247 // mode: c++ //
    248 // compile-command: "make install" //
    249 // End: //
  • TabularUnified src/GenPoly/InstantiateGeneric.cpp

    r3bd9508 r3e91c6f9  
    1010// Created On       : Tue Aug 16 10:51:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Oct 31 16:48:00 2022
    13 // Update Count     : 1
     12// Last Modified On : Wed Mar 12 15:18:00 2025
     13// Update Count     : 2
    1414//
    1515
     
    159159}
    160160
     161/// Get the scrubbed type of a declaration (see scrubTypeVars functions).
     162ast::TypeExpr const * scrubTypeDecl(
     163                CodeLocation const & location, ast::TypeDecl const * typeDecl ) {
     164        switch ( typeDecl->kind ) {
     165        // Erase any incomplete dtype to `void` (`T *` -> `void *`).
     166        case ast::TypeDecl::Dtype:
     167                return new ast::TypeExpr( location, new ast::VoidType() );
     168        // Erase any ftype to `void (*)(void)`.
     169        case ast::TypeDecl::Ftype:
     170                return new ast::TypeExpr( location, new ast::FunctionType() );
     171        // Remaining cases are not supported.
     172        case ast::TypeDecl::Ttype:
     173                assertf( false, "Ttype parameters are not currently allowed as parameters to generic types." );
     174                break;
     175        default:
     176                assertf( false, "Unhandled type parameter kind" );
     177                break;
     178        }
     179}
     180
    161181/// Makes substitutions of params into baseParams; returns dtypeStatic if
    162182/// there is a concrete instantiation based only on {d,f}type-to-void
     
    190210                                gt |= GenericType::concrete;
    191211                        }
    192                 } else switch ( (*baseParam)->kind ) {
    193                 case ast::TypeDecl::Dtype:
    194                         // Here, pretend that any incomplete dtype is `void`.
    195                         out.emplace_back( new ast::TypeExpr( paramExpr->location,
    196                                 new ast::VoidType() ) );
    197                         break;
    198                 case ast::TypeDecl::Ftype:
    199                         // Here, pretend that any ftype is `void (*)(void)`.
    200                         out.emplace_back( new ast::TypeExpr( paramExpr->location,
    201                                 new ast::FunctionType() ) );
    202                         break;
    203                 case ast::TypeDecl::Ttype:
    204                         assertf( false, "Ttype parameters are not currently allowed as parameters to generic types." );
    205                         break;
    206                 default:
    207                         assertf( false, "Unhandled type parameter kind" );
    208                         break;
     212                } else {
     213                        out.emplace_back( scrubTypeDecl( paramExpr->location, *baseParam ) );
    209214                }
    210215        }
     
    443448                instantiations(), dtypeStatics(), typeNamer("_conc_") {}
    444449
     450        ast::StructDecl const * previsit( ast::StructDecl const * );
     451        ast::UnionDecl const * previsit( ast::UnionDecl const * );
     452
    445453        ast::Type const * postvisit( ast::StructInstType const * inst );
    446454        ast::Type const * postvisit( ast::UnionInstType const * inst );
     
    481489
    482490        template<typename AggrDecl>
     491        AggrDecl const * fixAggrDecl( AggrDecl const * decl );
     492
     493        template<typename AggrDecl>
    483494        ast::Type const * fixInstType( ast::SueInstType<AggrDecl> const * inst );
    484495
     
    489500                ast::vector<ast::TypeExpr> const & typeSubs );
    490501};
     502
     503ast::StructDecl const * GenericInstantiator::previsit( ast::StructDecl const * decl ) {
     504        return fixAggrDecl( decl );
     505}
     506
     507ast::UnionDecl const * GenericInstantiator::previsit( ast::UnionDecl const * decl ) {
     508        return fixAggrDecl( decl );
     509}
     510
     511template<typename AggrDecl>
     512AggrDecl const * GenericInstantiator::fixAggrDecl( AggrDecl const * decl ) {
     513        // This function and stripDtypeParams handle declarations before their
     514        // first use (required to be in the previsit for types with a self use).
     515        if ( decl->params.empty() || !isDtypeStatic( decl->params ) ) {
     516                return decl;
     517        }
     518
     519        ast::vector<ast::TypeExpr> typeSubs;
     520        for ( auto const & param : decl->params ) {
     521                assert( !param->isComplete() );
     522                typeSubs.emplace_back( scrubTypeDecl( param->location, param ) );
     523        }
     524
     525        assert( decl->unique() );
     526        auto mutDecl = ast::mutate( decl );
     527        stripDtypeParams( mutDecl, mutDecl->params, typeSubs );
     528
     529        return mutDecl;
     530}
    491531
    492532ast::Type const * GenericInstantiator::postvisit(
     
    531571        case GenericType::dtypeStatic:
    532572        {
     573                // This call to stripDtypeParams is used when a forward declaration
     574                // has allowed an instance to appear before the full declaration.
    533575                auto mutInst = ast::mutate( inst );
    534576                assert( mutInst->base->unique() );
  • TabularUnified src/Parser/lex.ll

    r3bd9508 r3e91c6f9  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Fri Jan 17 14:36:16 2025
    13  * Update Count     : 878
     12 * Last Modified On : Mon Mar  3 09:21:33 2025
     13 * Update Count     : 880
    1414 */
    1515
     
    240240basetypeof              { KEYWORD_RETURN(BASETYPEOF); }                 // CFA
    241241_Bool                   { KEYWORD_RETURN(BOOL); }                               // C99
    242 __SVBool_t              { KEYWORD_RETURN(SVBOOL); }                             // gcc (ARM)
     242__SVBool_t              { KEYWORD_RETURN(BOOL); }                               // gcc (ARM)
    243243break                   { KEYWORD_RETURN(BREAK); }
    244244case                    { KEYWORD_RETURN(CASE); }
     
    287287_Float128               { FLOATXX(FLOAT128); }                                  // GCC
    288288_Float128x              { FLOATXX(FLOAT128X); }                                 // GCC
    289 __Float32x4_t   { FLOATXX(FLOAT32X4); }                                 // GCC (ARM)
    290 __Float64x2_t   { FLOATXX(FLOAT64X2); }                                 // GCC (ARM)
    291 __SVFloat32_t   { FLOATXX(SVFLOAT32); }                                 // GCC (ARM)
    292 __SVFloat64_t   { FLOATXX(SVFLOAT64); }                                 // GCC (ARM)
     289__Float32x4_t   { FLOATXX(FLOAT128); }                                  // GCC (ARM)
     290__Float64x2_t   { FLOATXX(FLOAT128); }                                  // GCC (ARM)
     291__SVFloat32_t   { FLOATXX(FLOAT128); }                                  // GCC (ARM)
     292__SVFloat64_t   { FLOATXX(FLOAT128); }                                  // GCC (ARM)
    293293for                             { KEYWORD_RETURN(FOR); }
    294294forall                  { KEYWORD_RETURN(FORALL); }                             // CFA
  • TabularUnified src/Parser/parser.yy

    r3bd9508 r3e91c6f9  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  3 20:47:00 2025
    13 // Update Count     : 7254
     12// Last Modified On : Thu Mar 13 09:23:21 2025
     13// Update Count     : 7255
    1414//
    1515
     
    22442244        basic_type_specifier
    22452245        | sue_type_specifier
    2246         | type_type_specifier
     2246        | type_type_specifier attribute_list_opt
    22472247        ;
    22482248
Note: See TracChangeset for help on using the changeset viewer.