Changeset de8a0a4 for src


Ignore:
Timestamp:
Jan 26, 2025, 6:37:05 PM (8 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
a950021
Parents:
0f070a4 (diff), 11f92fac (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r0f070a4 rde8a0a4  
    283283: Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), type( t ) {}
    284284
    285 // --- CountExpr
    286 
    287 CountExpr::CountExpr( const CodeLocation & loc, const Expr * e )
    288 : Expr( loc, new BasicType( BasicKind::LongUnsignedInt) ), expr(e), type( nullptr ) {}
    289 
    290 CountExpr::CountExpr( const CodeLocation & loc, const Type * t )
    291 : Expr( loc, new BasicType( BasicKind::LongUnsignedInt) ), expr(nullptr), type( t ) {}
    292 
    293285// --- AlignofExpr
    294286
    295287AlignofExpr::AlignofExpr( const CodeLocation & loc, const Type * t )
    296288: Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), type( t ) {}
     289
     290// --- CountofExpr
     291
     292CountofExpr::CountofExpr( const CodeLocation & loc, const Type * t )
     293: Expr( loc, new BasicType( BasicKind::LongUnsignedInt) ), type( t ) {}
    297294
    298295// --- OffsetofExpr
  • src/AST/Expr.hpp

    r0f070a4 rde8a0a4  
    490490};
    491491
    492 class CountExpr final : public Expr {
    493 public:
    494         ptr<Expr> expr;
    495         ptr<Type> type;
    496 
    497         CountExpr( const CodeLocation & loc, const Expr * t );
    498         CountExpr( const CodeLocation & loc, const Type * t );
    499 
    500         const Expr * accept( Visitor & v )const override { return v.visit( this ); }
    501 private:
    502         CountExpr * clone() const override { return new CountExpr( *this ); }
    503         MUTATE_FRIEND
    504 };
    505 
    506492/// alignof expression, e.g. `alignof(int)`, `alignof 3+4`
    507493class AlignofExpr final : public Expr {
     
    514500private:
    515501        AlignofExpr * clone() const override { return new AlignofExpr{ *this }; }
     502        MUTATE_FRIEND
     503};
     504
     505/// countof expression, e.g. `countof(AnEnum)`, `countof pred(Head)`
     506class CountofExpr final : public Expr {
     507public:
     508        ptr<Type> type;
     509
     510        CountofExpr( const CodeLocation & loc, const Type * t );
     511
     512        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
     513private:
     514        CountofExpr * clone() const override { return new CountofExpr( *this ); }
    516515        MUTATE_FRIEND
    517516};
  • src/AST/Fwd.hpp

    r0f070a4 rde8a0a4  
    8686class ConstantExpr;
    8787class SizeofExpr;
    88 class CountExpr;
    8988class AlignofExpr;
     89class CountofExpr;
    9090class UntypedOffsetofExpr;
    9191class OffsetofExpr;
  • src/AST/Pass.hpp

    r0f070a4 rde8a0a4  
    173173        const ast::Expr *             visit( const ast::ConstantExpr         * ) override final;
    174174        const ast::Expr *             visit( const ast::SizeofExpr           * ) override final;
    175         const ast::Expr *             visit( const ast::CountExpr            * ) override final;
    176175        const ast::Expr *             visit( const ast::AlignofExpr          * ) override final;
     176        const ast::Expr *             visit( const ast::CountofExpr          * ) override final;
    177177        const ast::Expr *             visit( const ast::UntypedOffsetofExpr  * ) override final;
    178178        const ast::Expr *             visit( const ast::OffsetofExpr         * ) override final;
  • src/AST/Pass.impl.hpp

    r0f070a4 rde8a0a4  
    13501350
    13511351//--------------------------------------------------------------------------
    1352 // CountExpr
    1353 template< typename core_t >
    1354 const ast::Expr * ast::Pass< core_t >::visit( const ast::CountExpr * node ) {
    1355         VISIT_START( node );
    1356         if ( __visit_children() ) {
    1357                 {
    1358                         guard_symtab guard { *this };
    1359                         maybe_accept( node, &CountExpr::result );
    1360                 }
    1361                 if ( node->type ) {
    1362                         maybe_accept( node, &CountExpr::type );
    1363                 } else {
    1364                         maybe_accept( node, &CountExpr::expr );
    1365                 }
    1366         }
    1367         VISIT_END( Expr, node );
    1368 }
    1369 
    1370 //--------------------------------------------------------------------------
    13711352// AlignofExpr
    13721353template< typename core_t >
     
    13801361                }
    13811362                maybe_accept( node, &AlignofExpr::type );
     1363        }
     1364
     1365        VISIT_END( Expr, node );
     1366}
     1367
     1368//--------------------------------------------------------------------------
     1369// CountofExpr
     1370template< typename core_t >
     1371const ast::Expr * ast::Pass< core_t >::visit( const ast::CountofExpr * node ) {
     1372        VISIT_START( node );
     1373
     1374        if ( __visit_children() ) {
     1375                {
     1376                        guard_symtab guard { *this };
     1377                        maybe_accept( node, &CountofExpr::result );
     1378                }
     1379                maybe_accept( node, &CountofExpr::type );
    13821380        }
    13831381
  • src/AST/Print.cpp

    r0f070a4 rde8a0a4  
    12071207        }
    12081208
    1209         virtual const ast::Expr * visit( const ast::CountExpr * node ) override final {
     1209        virtual const ast::Expr * visit( const ast::CountofExpr * node ) override final {
    12101210                os << "Count Expression on: ";
    12111211                ++indent;
    1212                 if ( node->type ) node->type->accept( *this );
    1213                 else safe_print( node->expr );
     1212                safe_print( node->type );
    12141213                --indent;
    12151214                postprint( node );
  • src/AST/Visitor.hpp

    r0f070a4 rde8a0a4  
    7676    virtual const ast::Expr *             visit( const ast::ConstantExpr         * ) = 0;
    7777    virtual const ast::Expr *             visit( const ast::SizeofExpr           * ) = 0;
    78     virtual const ast::Expr *             visit( const ast::CountExpr            * ) = 0;
    7978    virtual const ast::Expr *             visit( const ast::AlignofExpr          * ) = 0;
     79    virtual const ast::Expr *             visit( const ast::CountofExpr          * ) = 0;
    8080    virtual const ast::Expr *             visit( const ast::UntypedOffsetofExpr  * ) = 0;
    8181    virtual const ast::Expr *             visit( const ast::OffsetofExpr         * ) = 0;
  • src/BasicTypes-gen.cpp

    r0f070a4 rde8a0a4  
    9999
    100100        { Float16, "Float16", "_FH", "_Float16", "DF16_", Floating, Float32, Float16Complex, -1, 7 },
    101         { Float16Complex, "Float16Complex", "_FHC", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 7 },
    102 
    103         { Float32, "Float32", "_F", "_Float32", "DF32_", Floating, Float, Float32Complex, -1, 8 },
    104         { Float32Complex, "Float32Complex", "_FC", "_Float32 _Complex", "CDF32_", Floating, FloatComplex, -1, -1, 8 },
    105         { Float, "Float", "F", "float", "f", Floating, Float32x, FloatComplex, -1, 9 },
    106         { FloatComplex, "FloatComplex", "FC", "float _Complex", "Cf", Floating, Float32xComplex, -1, -1, 9 },
    107         { Float32x, "Float32x", "_FX", "_Float32x", "DF32x_", Floating, Float64, Float32xComplex, -1, 10 },
    108         { Float32xComplex, "Float32xComplex", "_FXC", "_Float32x _Complex", "CDF32x_", Floating, Float64Complex, -1, -1, 10 },
    109 
    110         { Float64, "Float64", "_FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 11 },
    111         { Float64Complex, "Float64Complex", "_FDC", "_Float64 _Complex", "CDF64_", Floating, DoubleComplex, -1, -1, 11 },
    112         { Double, "Double", "D", "double", "d", Floating, Float64x, DoubleComplex, -1, 12 },
    113         { DoubleComplex, "DoubleComplex", "DC", "double _Complex", "Cd", Floating, Float64xComplex, -1, -1, 12 },
    114         { Float64x, "Float64x", "_FDX", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 13 },
    115         { Float64xComplex, "Float64xComplex", "_FDXC", "_Float64x _Complex", "CDF64x_", Floating, LongDoubleComplex, -1, -1, 13 },
    116 
    117         { Float80, "Float80", "_F80", "__float80", "Dq", Floating, LongDouble, LongDoubleComplex, -1, 14 },
     101        { Float16Complex, "Float16Complex", "_FHC", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 8 },
     102
     103        { Float32, "Float32", "_F", "_Float32", "DF32_", Floating, Float, Float32Complex, -1, 9 },
     104        { Float32Complex, "Float32Complex", "_FC", "_Float32 _Complex", "CDF32_", Floating, FloatComplex, -1, -1, 10 },
     105        { Float, "Float", "F", "float", "f", Floating, Float32x, FloatComplex, -1, 11 },
     106        { FloatComplex, "FloatComplex", "FC", "float _Complex", "Cf", Floating, Float32xComplex, -1, -1, 12 },
     107        { Float32x, "Float32x", "_FX", "_Float32x", "DF32x_", Floating, Float64, Float32xComplex, -1, 13 },
     108        { Float32xComplex, "Float32xComplex", "_FXC", "_Float32x _Complex", "CDF32x_", Floating, Float64Complex, -1, -1, 14 },
     109
     110        { Float64, "Float64", "_FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 15 },
     111        { Float64Complex, "Float64Complex", "_FDC", "_Float64 _Complex", "CDF64_", Floating, DoubleComplex, -1, -1, 16 },
     112        { Double, "Double", "D", "double", "d", Floating, Float64x, DoubleComplex, -1, 17 },
     113        { DoubleComplex, "DoubleComplex", "DC", "double _Complex", "Cd", Floating, Float64xComplex, -1, -1, 18 },
     114        { Float64x, "Float64x", "_FDX", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 19 },
     115        { Float64xComplex, "Float64xComplex", "_FDXC", "_Float64x _Complex", "CDF64x_", Floating, LongDoubleComplex, -1, -1, 20 },
     116
     117        { Float80, "Float80", "_F80", "__float80", "Dq", Floating, LongDouble, LongDoubleComplex, -1, 21 },
    118118        // __float80 _Complex, no complex counterpart
    119119        // gcc implements long double as float80 (12 bytes)
    120         { LongDouble, "LongDouble", "LD", "long double", "e", Floating, uuFloat128, LongDoubleComplex, -1, 15 },
    121         { LongDoubleComplex, "LongDoubleComplex", "LDC", "long double _Complex", "Ce", Floating, Float128Complex, -1, -1, 15 },
    122 
    123         { uuFloat128, "uuFloat128", "__FLD", "__float128", "g", Floating, Float128, Float128Complex, -1, 16 },
     120        { LongDouble, "LongDouble", "LD", "long double", "e", Floating, uuFloat128, LongDoubleComplex, -1, 22 },
     121        { LongDoubleComplex, "LongDoubleComplex", "LDC", "long double _Complex", "Ce", Floating, Float128Complex, -1, -1, 23 },
     122
     123        { uuFloat128, "uuFloat128", "__FLD", "__float128", "g", Floating, Float128, Float128Complex, -1, 24 },
    124124        // __float128 _Complex, no complex counterpart
    125         { Float128, "Float128", "_FLD", "_Float128", "DF128_", Floating, Float128x, Float128Complex, -1, 17 },
    126         { Float128Complex, "Float128Complex", "_FLDC", "_Float128 _Complex", "CDF128_", Floating, Float128xComplex, -1, -1, 17 },
     125        { Float128, "Float128", "_FLD", "_Float128", "DF128_", Floating, Float128x, Float128Complex, -1, 25 },
     126        { Float128Complex, "Float128Complex", "_FLDC", "_Float128 _Complex", "CDF128_", Floating, Float128xComplex, -1, -1, 26 },
    127127
    128128        // may not be supported
    129         { Float128x, "Float128x", "_FLDX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 18 },
    130         { Float128xComplex, "Float128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 18 }
     129        { Float128x, "Float128x", "_FLDX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 27 },
     130        { Float128xComplex, "Float128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 28 }
    131131}; // graph
    132132
     
    135135static Kind commonTypeMatrix[NUMBER_OF_BASIC_TYPES][NUMBER_OF_BASIC_TYPES];
    136136
    137 // Fangren explain shortest cost algorithm.
     137// Compute the minimal conversion costs using Dijkstra's algorithm
    138138void generateCosts( int row ) {
    139139        bool seen[NUMBER_OF_BASIC_TYPES] = { false /*, ... */ };
     
    176176
    177177                // traverse children
    178                 // Fangren explain "max"
     178                // any conversion should have a cost of at least 1, even if between types of equal rank
    179179                int i = graph[col].left;
    180180                if ( i == -1 ) continue;                                                // leaf
     
    191191} // generateCosts
    192192
    193 // Fangren explain this routine if you can.
     193// Note: this algorithm is not general.
     194// It relies on the specific structure of the conversion graph.
     195// When the common type is not one of the two given types, we should always have a real and a complex floating point type,
     196// in which case the common type is the next complex type ranked higher than the real type.
    194197void generateCommonType( int row, int col ) {                   // row <= col
    195198        if ( costMatrix[row][col] >= 0 ) {
  • src/CodeGen/CodeGenerator.cpp

    r0f070a4 rde8a0a4  
    251251
    252252        if ( decl->init ) {
    253                 output << " = ";
     253                bool isGenericInit = options.genC || decl->init->maybeConstructed;
     254                output << ( (isGenericInit) ? " = " : " @= " );
    254255                decl->init->accept( *visitor );
    255256        }
  • src/Common/CodeLocationTools.cpp

    r0f070a4 rde8a0a4  
    154154    macro(ConstantExpr, Expr) \
    155155    macro(SizeofExpr, Expr) \
    156     macro(CountExpr, Expr ) \
    157156    macro(AlignofExpr, Expr) \
     157    macro(CountofExpr, Expr ) \
    158158    macro(UntypedOffsetofExpr, Expr) \
    159159    macro(OffsetofExpr, Expr) \
  • src/Concurrency/Keywords.cpp

    r0f070a4 rde8a0a4  
    1010// Created On       : Tue Nov 16  9:53:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 14 18:02:25 2023
    13 // Update Count     : 6
     12// Last Modified On : Sun Jan 26 15:16:16 2025
     13// Update Count     : 15
    1414//
    1515
     
    6969}
    7070
    71 // Describe that it adds the generic parameters and the uses of the generic
    72 // parameters on the function and first "this" argument.
     71// Describe that it adds the generic parameters and the uses of the generic parameters on the
     72// function and first "this" argument.
    7373ast::FunctionDecl * fixupGenerics(
    7474                const ast::FunctionDecl * func, const ast::StructDecl * decl ) {
     
    117117
    118118// --------------------------------------------------------------------------
     119
     120// This type describes the general information used to transform a generator, coroutine, monitor, or
     121// thread aggregate kind.  A pass is made over the AST in ConcurrentSueKeyword::postvisit looking
     122// for each of these kinds. When found, this data structure is filled in with the information from
     123// the specific structures below, and handleStruct is called to perform the common changes that
     124// augment the aggregate kind with fields and generate appropriate companion routines.  The location
     125// of any extra fields is specified in addField.
     126
    119127struct ConcurrentSueKeyword : public ast::WithDeclsToAdd {
    120128        ConcurrentSueKeyword(
     
    171179};
    172180
    173 // Handles thread type declarations:
     181// Handles generator type declarations:
    174182//
    175 // thread Mythread {                         struct MyThread {
    176 //  int data;                                  int data;
    177 //  a_struct_t more_data;                      a_struct_t more_data;
    178 //                                =>             thread$ __thrd_d;
     183// generator MyGenerator {                   struct MyGenerator {
     184//                                =>             int __generator_state;
     185//    int data;                                  int data;
     186//    a_struct_t more_data;                      a_struct_t more_data;
    179187// };                                        };
    180 //                                           static inline thread$ * get_thread( MyThread * this ) { return &this->__thrd_d; }
    181188//
    182 struct ThreadKeyword final : public ConcurrentSueKeyword {
    183         ThreadKeyword() : ConcurrentSueKeyword(
    184                 "thread$",
    185                 "__thrd",
    186                 "get_thread",
    187                 "thread keyword requires threads to be in scope, add #include <thread.hfa>\n",
    188                 "ThreadCancelled",
     189struct GeneratorKeyword final : public ConcurrentSueKeyword {
     190        GeneratorKeyword() : ConcurrentSueKeyword(
     191                "generator$",
     192                "__generator_state",
     193                "get_generator",
     194                "Unable to find builtin type generator$\n",
     195                "",
    189196                true,
    190                 ast::AggregateDecl::Thread )
     197                ast::AggregateDecl::Generator )
    191198        {}
    192199
    193         virtual ~ThreadKeyword() {}
     200        virtual ~GeneratorKeyword() {}
    194201};
    195202
     
    197204//
    198205// coroutine MyCoroutine {                   struct MyCoroutine {
    199 //  int data;                                  int data;
    200 //  a_struct_t more_data;                      a_struct_t more_data;
    201206//                                =>             coroutine$ __cor_d;
     207//    int data;                                  int data;
     208//    a_struct_t more_data;                      a_struct_t more_data;
    202209// };                                        };
    203210//                                           static inline coroutine$ * get_coroutine( MyCoroutine * this ) { return &this->__cor_d; }
     
    220227//
    221228// monitor MyMonitor {                       struct MyMonitor {
    222 //  int data;                                  int data;
    223 //  a_struct_t more_data;                      a_struct_t more_data;
    224229//                                =>             monitor$ __mon_d;
     230//    int data;                                  int data;
     231//    a_struct_t more_data;                      a_struct_t more_data;
    225232// };                                        };
    226233//                                           static inline monitor$ * get_coroutine( MyMonitor * this ) {
     
    248255};
    249256
    250 // Handles generator type declarations:
     257// Handles thread type declarations:
    251258//
    252 // generator MyGenerator {                   struct MyGenerator {
    253 //  int data;                                  int data;
    254 //  a_struct_t more_data;                      a_struct_t more_data;
    255 //                                =>             int __generator_state;
     259// thread Mythread {                         struct MyThread {
     260//                                =>             thread$ __thrd_d;
     261//    int data;                                  int data;
     262//    a_struct_t more_data;                      a_struct_t more_data;
    256263// };                                        };
     264//                                           static inline thread$ * get_thread( MyThread * this ) { return &this->__thrd_d; }
    257265//
    258 struct GeneratorKeyword final : public ConcurrentSueKeyword {
    259         GeneratorKeyword() : ConcurrentSueKeyword(
    260                 "generator$",
    261                 "__generator_state",
    262                 "get_generator",
    263                 "Unable to find builtin type generator$\n",
    264                 "",
     266struct ThreadKeyword final : public ConcurrentSueKeyword {
     267        ThreadKeyword() : ConcurrentSueKeyword(
     268                "thread$",
     269                "__thrd",
     270                "get_thread",
     271                "thread keyword requires threads to be in scope, add #include <thread.hfa>\n",
     272                "ThreadCancelled",
    265273                true,
    266                 ast::AggregateDecl::Generator )
     274                ast::AggregateDecl::Thread )
    267275        {}
    268276
    269         virtual ~GeneratorKeyword() {}
     277        virtual ~ThreadKeyword() {}
    270278};
    271279
     
    354362
    355363        if ( !exception_name.empty() ) {
    356                 if( !typeid_decl || !vtable_decl ) {
     364                if ( !typeid_decl || !vtable_decl ) {
    357365                        SemanticError( decl, context_error );
    358366                }
     
    419427        declsToAddBefore.push_back(
    420428                Virtual::makeTypeIdInstance( location, typeid_type ) );
    421         // If the typeid_type is going to be kept, the other reference will have
    422         // been made by now, but we also get to avoid extra mutates.
     429        // If the typeid_type is going to be kept, the other reference will have been made by now, but
     430        // we also get to avoid extra mutates.
    423431        ast::ptr<ast::StructInstType> typeid_cleanup = typeid_type;
    424432}
     
    525533
    526534        auto mutDecl = ast::mutate( decl );
     535        // Insert at start of special aggregate structures => front of vector
     536        //mutDecl->members.insert( mutDecl->members.begin(), field );
    527537        mutDecl->members.push_back( field );
    528538
     
    917927
    918928                        // If it is a monitor, then it is a monitor.
    919                         if( baseStruct->base->is_monitor() || baseStruct->base->is_thread() ) {
     929                        if ( baseStruct->base->is_monitor() || baseStruct->base->is_thread() ) {
    920930                                SemanticError( decl, "destructors for structures declared as \"monitor\" must use mutex parameters " );
    921931                        }
     
    10311041
    10321042        // Make sure that only the outer reference is mutex.
    1033         if( baseStruct->is_mutex() ) {
     1043        if ( baseStruct->is_mutex() ) {
    10341044                SemanticError( decl, "mutex keyword may only appear once per argument " );
    10351045        }
     
    11791189}
    11801190
    1181 // generates a cast to the void ptr to the appropriate lock type and dereferences it before calling lock or unlock on it
    1182 // used to undo the type erasure done by storing all the lock pointers as void
     1191// Generates a cast to the void ptr to the appropriate lock type and dereferences it before calling
     1192// lock or unlock on it used to undo the type erasure done by storing all the lock pointers as void.
    11831193ast::ExprStmt * MutexKeyword::genVirtLockUnlockExpr( const std::string & fnName, ast::ptr<ast::Expr> expr, const CodeLocation & location, ast::Expr * param ) {
    11841194        return new ast::ExprStmt( location,
  • src/InitTweak/GenInit.cpp

    r0f070a4 rde8a0a4  
    162162                                // FROM USER:  float a[ rand() ];
    163163                                // TO GCC:     const size_t __len_of_a = rand(); float a[ __len_of_a ];
    164 
    165                                 ast::ObjectDecl * arrayDimension = new ast::ObjectDecl(
    166                                         arrayType->dimension->location,
    167                                         dimensionName.newName(),
    168                                         dimType,
    169                                         new ast::SingleInit(
     164                                ast::ObjectDecl * arrayDimension = nullptr;
     165
     166                                const ast::TypeExpr * ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() );
     167                                if ( ty ) {
     168                                        auto inst = ty->type.as<ast::EnumInstType>();
     169                                        if ( inst ) {
     170                                                if ( inst->base->isCfa ) {
     171                                                        arrayDimension = new ast::ObjectDecl(
     172                                                                arrayType->dimension->location,
     173                                                                dimensionName.newName(),
     174                                                                new ast::BasicType( ast::BasicKind::UnsignedChar ),
     175                                                                new ast::SingleInit(
     176                                                                        arrayType->dimension->location,
     177                                                                        ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() )
     178                                                                )
     179                                                        );
     180                                                        // return arrayType;
     181                                                }
     182                                        }
     183                                }
     184                                if ( arrayDimension == nullptr ) {
     185                                        arrayDimension = new ast::ObjectDecl(
    170186                                                arrayType->dimension->location,
    171                                                 arrayType->dimension
    172                                         )
    173                                 );
     187                                                dimensionName.newName(),
     188                                                dimType,
     189                                                new ast::SingleInit(
     190                                                        arrayType->dimension->location,
     191                                                        arrayType->dimension
     192                                                )
     193                                        );
     194                                }
    174195
    175196                                ast::ArrayType * mutType = ast::mutate( arrayType );
  • src/Parser/parser.yy

    r0f070a4 rde8a0a4  
    946946                }
    947947        | COUNTOF unary_expression
    948                 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuild( $2 ) ) ); }
     948                { $$ = new ExpressionNode( new ast::CountofExpr( yylloc, new ast::TypeofType( maybeMoveBuild( $2 ) ) ) ); }
    949949        | COUNTOF '(' type_no_function ')'
    950                 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
     950                { $$ = new ExpressionNode( new ast::CountofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
    951951        ;
    952952
  • src/ResolvExpr/CandidateFinder.cpp

    r0f070a4 rde8a0a4  
    672672                void postvisit( const ast::SizeofExpr * sizeofExpr );
    673673                void postvisit( const ast::AlignofExpr * alignofExpr );
     674                void postvisit( const ast::CountofExpr * countExpr );
    674675                void postvisit( const ast::AddressExpr * addressExpr );
    675676                void postvisit( const ast::LabelAddressExpr * labelExpr );
     
    697698                void postvisit( const ast::UntypedInitExpr * initExpr );
    698699                void postvisit( const ast::QualifiedNameExpr * qualifiedExpr );
    699                 void postvisit( const ast::CountExpr * countExpr );
    700700
    701701                void postvisit( const ast::InitExpr * ) {
     
    941941                }
    942942        }
    943        
    944943
    945944        /// Adds aggregate member interpretations
     
    12691268                                        ? conversionCost( fromType, toType, cand->expr->get_lvalue(), symtab, cand->env )
    12701269                                        : castCost( fromType, toType, cand->expr->get_lvalue(), symtab, cand->env );
    1271                        
     1270
    12721271                        // Redefine enum cast
    12731272                        auto argAsEnum = fromType.as<ast::EnumInstType>();
     
    14931492        }
    14941493
    1495         void Finder::postvisit( const ast::CountExpr * countExpr ) {
    1496                 const ast::UntypedExpr * untyped = nullptr;
    1497                 if ( countExpr->type ) {
    1498                         auto enumInst = countExpr->type.as<ast::EnumInstType>();
    1499                         if ( enumInst ) {
    1500                                 addCandidate( ast::ConstantExpr::from_ulong(countExpr->location, enumInst->base->members.size()), tenv );
    1501                                 return;
    1502                         }
    1503                         auto untypedFirst = ast::UntypedExpr::createCall( countExpr->location, "lowerBound", {} );
    1504                         auto castFirst = new ast::CastExpr( countExpr->location, untypedFirst , countExpr->type );
    1505                         untyped = ast::UntypedExpr::createCall(
    1506                                 countExpr->location, "Countof", { castFirst }
    1507                         );
    1508                 }
    1509                 if (!untyped) untyped = ast::UntypedExpr::createCall(
    1510                                 countExpr->location, "Countof", { countExpr->expr }
     1494        void Finder::postvisit( const ast::CountofExpr * countExpr ) {
     1495                if ( auto enumInst = countExpr->type.as<ast::EnumInstType>() ) {
     1496                        addCandidate( ast::ConstantExpr::from_ulong( countExpr->location, enumInst->base->members.size()), tenv );
     1497                        return;
     1498                }
     1499                auto untypedFirst = ast::UntypedExpr::createCall( countExpr->location, "lowerBound", {} );
     1500                auto castFirst = new ast::CastExpr( countExpr->location, untypedFirst , countExpr->type );
     1501                const ast::UntypedExpr * untyped = ast::UntypedExpr::createCall(
     1502                        countExpr->location, "Countof", { castFirst }
    15111503                );
    15121504                CandidateFinder finder( context, tenv );
     
    15141506                CandidateList winners = findMinCost( finder.candidates );
    15151507                if ( winners.size() == 0 ) {
    1516                         SemanticError( countExpr->expr, "Countof is not implemented for operand: " );
    1517                 }
    1518                 if ( winners.size() !=  1 ) {
    1519                         SemanticError( countExpr->expr, "Ambiguous expression in countof operand: " );
     1508                        SemanticError( countExpr, "Countof is not implemented: " );
     1509                }
     1510                if ( winners.size() != 1 ) {
     1511                        SemanticError( countExpr, "Ambiguous expression in countof: " );
    15201512                }
    15211513                CandidateRef & choice = winners.front();
  • src/ResolvExpr/ConversionCost.cpp

    r0f070a4 rde8a0a4  
    4444                  signed long long int     unsigned long long int
    4545                  __int128                 unsigned __int128
    46                   _Float16                 _Float16 _Complex
    47                   _Float32                 _Float32 _Complex
    48                   float                    float _Complex
    49                   _Float32x                _Float32x _Complex
    50                   _Float64                 _Float64 _Complex
    51                   double                   double _Complex
    52                   _Float64x                _Float64x _Complex
     46                              _Float16
     47                     _Float16 _Complex
     48                              _Float32
     49                     _Float32 _Complex
     50                                 float
     51                        float _Complex
     52                             _Float32x
     53                    _Float32x _Complex
     54                              _Float64
     55                     _Float64 _Complex
     56                                double
     57                       double _Complex
     58                             _Float64x
     59                    _Float64x _Complex
    5360                             __float80
    54                   long double              long double _Complex
     61                           long double
     62                  long double _Complex
    5563                            __float128
    56                   _Float128                _Float128 _Complex
    57                   _Float128x               _Float128x _Complex
     64                             _Float128
     65                    _Float128 _Complex
     66                            _Float128x
     67                   _Float128x _Complex
    5868        */
    5969        // GENERATED END
     
    6373        static const int costMatrix[ast::BasicKind::NUMBER_OF_BASIC_TYPES][ast::BasicKind::NUMBER_OF_BASIC_TYPES] = { // path length from root to node
    6474                /*               B    C   SC   UC   SI  USI    I   UI   LI  ULI  LLI ULLI __ID__UID  _FH _FHC   _F  _FC    F   FC  _FX _FXC  _FD _FDC    D   DC _FDX_FDXC _F80   LD  LDC__FLD _FLD_FLDC_FLDX_FLDXC */
    65                 /*      B */ {   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  15,  16,  17,  17,  18,  18, },
    66                 /*      C */ {  -1,   0,   1,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  16,  17,  17, },
    67                 /*     SC */ {  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  16,  17,  17, },
    68                 /*     UC */ {  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  16,  17,  17, },
    69                 /*     SI */ {  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  15,  15,  16,  16, },
    70                 /*    USI */ {  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  15,  15,  16,  16, },
    71                 /*      I */ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  14,  14,  15,  15, },
    72                 /*     UI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  14,  14,  15,  15, },
    73                 /*     LI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  13,  13,  14,  14, },
    74                 /*    ULI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  13,  13,  14,  14, },
    75                 /*    LLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  12,  12,  13,  13, },
    76                 /*   ULLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  12,  12,  13,  13, },
    77                 /*   __ID */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  11,  11,  12,  12, },
    78                 /*  __UID */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  11,  11,  12,  12, },
    79                 /*    _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,  10,  10,  11,  11, },
    80                 /*   _FHC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,   5,  -1,   6,  -1,  -1,   8,  -1,  -1,  10,  -1,  11, },
    81                 /*     _F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   9,   9,  10,  10, },
    82                 /*    _FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,   5,  -1,  -1,   7,  -1,  -1,   9,  -1,  10, },
    83                 /*      F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   8,   8,   9,   9, },
    84                 /*     FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,  -1,   6,  -1,  -1,   8,  -1,   9, },
    85                 /*    _FX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   7,   8,   8, },
    86                 /*   _FXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,  -1,   5,  -1,  -1,   7,  -1,   8, },
    87                 /*    _FD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   6,   7,   7, },
    88                 /*   _FDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,  -1,   4,  -1,  -1,   6,  -1,   7, },
    89                 /*      D */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   5,   6,   6, },
    90                 /*     DC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,  -1,   3,  -1,  -1,   5,  -1,   6, },
    91                 /*   _FDX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   4,   5,   5, },
    92                 /*  _FDXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   2,  -1,  -1,   4,  -1,   5, },
    93                 /*   _F80 */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   3,   3,   4,   4, },
    94                 /*     LD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3, },
    95                 /*    LDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   2,  -1,   3, },
    96                 /*  __FLD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2, },
    97                 /*   _FLD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2, },
    98                 /*  _FLDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1, },
     75                /*      B */ {   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28, },
     76                /*      C */ {  -1,   0,   1,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27, },
     77                /*     SC */ {  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27, },
     78                /*     UC */ {  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27, },
     79                /*     SI */ {  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26, },
     80                /*    USI */ {  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26, },
     81                /*      I */ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25, },
     82                /*     UI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25, },
     83                /*     LI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24, },
     84                /*    ULI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24, },
     85                /*    LLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, },
     86                /*   ULLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, },
     87                /*   __ID */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22, },
     88                /*  __UID */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22, },
     89                /*    _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21, },
     90                /*   _FHC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,   4,  -1,   6,  -1,   8,  -1,  10,  -1,  12,  -1,  -1,  15,  -1,  -1,  18,  -1,  20, },
     91                /*     _F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19, },
     92                /*    _FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,   4,  -1,   6,  -1,   8,  -1,  10,  -1,  -1,  13,  -1,  -1,  16,  -1,  18, },
     93                /*      F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17, },
     94                /*     FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,   4,  -1,   6,  -1,   8,  -1,  -1,  11,  -1,  -1,  14,  -1,  16, },
     95                /*    _FX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15, },
     96                /*   _FXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,   4,  -1,   6,  -1,  -1,   9,  -1,  -1,  12,  -1,  14, },
     97                /*    _FD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13, },
     98                /*   _FDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,   4,  -1,  -1,   7,  -1,  -1,  10,  -1,  12, },
     99                /*      D */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, },
     100                /*     DC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2,  -1,  -1,   5,  -1,  -1,   8,  -1,  10, },
     101                /*   _FDX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9, },
     102                /*  _FDXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   3,  -1,  -1,   6,  -1,   8, },
     103                /*   _F80 */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7, },
     104                /*     LD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6, },
     105                /*    LDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   3,  -1,   5, },
     106                /*  __FLD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4, },
     107                /*   _FLD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3, },
     108                /*  _FLDC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   2, },
    99109                /*  _FLDX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1, },
    100110                /* _FLDXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0, },
    101111        }; // costMatrix
    102         static const int maxIntCost = 15;
     112        static const int maxIntCost = 25;
    103113        // GENERATED END
    104114        static_assert(
Note: See TracChangeset for help on using the changeset viewer.