Changeset fd54fef for libcfa/prelude


Ignore:
Timestamp:
Jan 19, 2021, 8:44:29 PM (5 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dafbde8
Parents:
2f47ea4
Message:

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

Location:
libcfa/prelude
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r2f47ea4 rfd54fef  
    1818// type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions
    1919// Note: needs to occur early, because it is used to generate destructor calls during code generation
    20 forall(dtype T)
     20forall(T &)
    2121struct __Destructor {
    2222        T * object;
     
    2525
    2626// defined destructor in the case that non-generated code wants to use __Destructor
    27 forall(dtype T)
     27forall(T &)
    2828static inline void ^?{}(__Destructor(T) & x) {
    2929        if (x.object && x.dtor) {
     
    3434// easy interface into __Destructor's destructor for easy codegen purposes
    3535extern "C" {
    36         forall(dtype T)
     36        forall(T &)
    3737        static inline void __destroy_Destructor(__Destructor(T) * dtor) {
    3838                ^(*dtor){};
     
    5151void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    5252
    53 forall(dtype T)
     53forall(T &)
    5454static inline T & identity(T & i) {
    5555        return i;
     
    6464static inline void ^?{}($generator &) {}
    6565
    66 trait is_generator(dtype T) {
     66trait is_generator(T &) {
    6767      void main(T & this);
    6868      $generator * get_generator(T & this);
    6969};
    7070
    71 forall(dtype T | is_generator(T))
     71forall(T & | is_generator(T))
    7272static inline T & resume(T & gen) {
    7373        main(gen);
     
    7878
    7979static inline {
    80         forall( dtype DT | { DT & ?+=?( DT &, one_t ); } )
     80        forall( DT & | { DT & ?+=?( DT &, one_t ); } )
    8181        DT & ++?( DT & x ) { return x += 1; }
    8282
    83         forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?+=?( DT &, one_t ); } )
     83        forall( DT & | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?+=?( DT &, one_t ); } )
    8484        DT & ?++( DT & x ) { DT tmp = x; x += 1; return tmp; }
    8585
    86         forall( dtype DT | { DT & ?-=?( DT &, one_t ); } )
     86        forall( DT & | { DT & ?-=?( DT &, one_t ); } )
    8787        DT & --?( DT & x ) { return x -= 1; }
    8888
    89         forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } )
     89        forall( DT & | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } )
    9090        DT & ?--( DT & x ) { DT tmp = x; x -= 1; return tmp; }
    9191
    92         forall( dtype DT | { int ?!=?( const DT &, zero_t ); } )
     92        forall( DT & | { int ?!=?( const DT &, zero_t ); } )
    9393        int !?( const DT & x ) { return !( x != 0 ); }
    9494} // distribution
    9595
    9696// universal typed pointer constant
    97 static inline forall( dtype DT ) DT * intptr( uintptr_t addr ) { return (DT *)addr; }
     97static inline forall( DT & ) DT * intptr( uintptr_t addr ) { return (DT *)addr; }
    9898static inline forall( ftype FT ) FT * intptr( uintptr_t addr ) { return (FT *)addr; }
    9999
     
    156156#define __CFA_EXP_OVERFLOW__()
    157157
    158 static inline forall( otype OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } ) {
     158static inline forall( OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } ) {
    159159        OT ?\?( OT ep, unsigned int y ) { __CFA_EXP__(); }
    160160        OT ?\?( OT ep, unsigned long int y ) { __CFA_EXP__(); }
  • libcfa/prelude/prelude-gen.cc

    r2f47ea4 rfd54fef  
    159159int main() {
    160160        cout << "# 2 \"prelude.cfa\"  // needed for error messages from this file" << endl;
    161         cout << "trait sized(dtype T) {};" << endl;
     161        cout << "trait sized(T &) {};" << endl;
    162162
    163163        cout << "//////////////////////////" << endl;
     
    264264                for (auto cvq : qualifiersPair) {
    265265                        for (auto is_vol : { "        ", "volatile" }) {
    266                                 cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     266                                cout << "forall(DT &) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    267267                        }
    268268                }
     
    279279        for (auto cvq : qualifiersSingle) {
    280280                for (auto is_vol : { "        ", "volatile" }) {
    281                         cout << "forall(dtype DT) void  ?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
     281                        cout << "forall(DT &) void  ?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
    282282                }
    283283                for (auto is_vol : { "        ", "volatile" }) {
    284                         cout << "forall(dtype DT) void ^?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
     284                        cout << "forall(DT &) void ^?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
    285285                }
    286286        }
     
    290290                for (auto is_vol : { "        ", "volatile" }) {
    291291                        for (auto cvq : qualifiersSingle) {
    292                                 cout << "forall(dtype DT) void ?{}( " << cvq << type << " * " << is_vol << " &, zero_t);" << endl;
     292                                cout << "forall(DT &) void ?{}( " << cvq << type << " * " << is_vol << " &, zero_t);" << endl;
    293293                        }
    294294                }
     
    317317        for (auto op : pointerOperators) {
    318318                auto forall = [&op]() {
    319                         cout << "forall(dtype DT" << op.sized << ") ";
     319                        cout << "forall(DT &" << op.sized << ") ";
    320320                };
    321321                for (auto type : { "DT"/*, "void"*/ } ) {
     
    408408        for (auto is_vol : { "        ", "volatile" }) {
    409409                for (auto cvq : qualifiersPair) {
    410                                 cout << "forall(dtype DT) " << cvq.first << "void * ?=?( " << cvq.first << "void * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     410                                cout << "forall(DT &) " << cvq.first << "void * ?=?( " << cvq.first << "void * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    411411                }
    412412                for (auto cvq : qualifiersSingle) {
    413                         cout << "forall(dtype DT) " << cvq <<   "  DT * ?=?( " << cvq << "  DT * " << is_vol << " &, zero_t);" << endl;
     413                        cout << "forall(DT &) " << cvq <<   "  DT * ?=?( " << cvq << "  DT * " << is_vol << " &, zero_t);" << endl;
    414414                }
    415415        }
  • libcfa/prelude/prelude.old.cf

    r2f47ea4 rfd54fef  
    2323// ------------------------------------------------------------
    2424
    25 trait sized(dtype T) {};
     25trait sized(T &) {};
    2626
    2727// ------------------------------------------------------------
     
    6868long double _Complex    ?--( long double _Complex & ),          ?--( volatile long double _Complex & );
    6969
    70 forall( dtype T | sized(T) ) T *                         ?++(                T *& );
    71 forall( dtype T | sized(T) ) const T *           ?++( const          T *& );
    72 forall( dtype T | sized(T) ) volatile T *                ?++(       volatile T *& );
    73 forall( dtype T | sized(T) ) const volatile T *  ?++( const volatile T *& );
    74 forall( dtype T | sized(T) ) T *                         ?--(                T *& );
    75 forall( dtype T | sized(T) ) const T *           ?--( const          T *& );
    76 forall( dtype T | sized(T) ) volatile T *                ?--(       volatile T *& );
    77 forall( dtype T | sized(T) ) const volatile T *  ?--( const volatile T *& );
    78 
    79 forall( dtype T | sized(T) ) T &                 ?[?](                T *,          ptrdiff_t );
    80 forall( dtype T | sized(T) ) const T &   ?[?]( const          T *,          ptrdiff_t );
    81 forall( dtype T | sized(T) ) volatile T &        ?[?](       volatile T *,          ptrdiff_t );
    82 forall( dtype T | sized(T) ) const volatile T & ?[?]( const volatile T *,           ptrdiff_t );
    83 forall( dtype T | sized(T) ) T &                 ?[?](          ptrdiff_t,                T * );
    84 forall( dtype T | sized(T) ) const T &   ?[?](          ptrdiff_t, const          T * );
    85 forall( dtype T | sized(T) ) volatile T &        ?[?](          ptrdiff_t,       volatile T * );
    86 forall( dtype T | sized(T) ) const volatile T & ?[?](           ptrdiff_t, const volatile T * );
     70forall( T & | sized(T) ) T *                     ?++(                T *& );
     71forall( T & | sized(T) ) const T *               ?++( const          T *& );
     72forall( T & | sized(T) ) volatile T *            ?++(       volatile T *& );
     73forall( T & | sized(T) ) const volatile T *      ?++( const volatile T *& );
     74forall( T & | sized(T) ) T *                     ?--(                T *& );
     75forall( T & | sized(T) ) const T *               ?--( const          T *& );
     76forall( T & | sized(T) ) volatile T *            ?--(       volatile T *& );
     77forall( T & | sized(T) ) const volatile T *      ?--( const volatile T *& );
     78
     79forall( T & | sized(T) ) T &             ?[?](                T *,          ptrdiff_t );
     80forall( T & | sized(T) ) const T &       ?[?]( const          T *,          ptrdiff_t );
     81forall( T & | sized(T) ) volatile T &    ?[?](       volatile T *,          ptrdiff_t );
     82forall( T & | sized(T) ) const volatile T & ?[?]( const volatile T *,       ptrdiff_t );
     83forall( T & | sized(T) ) T &             ?[?](          ptrdiff_t,                T * );
     84forall( T & | sized(T) ) const T &       ?[?](          ptrdiff_t, const          T * );
     85forall( T & | sized(T) ) volatile T &    ?[?](          ptrdiff_t,       volatile T * );
     86forall( T & | sized(T) ) const volatile T & ?[?](               ptrdiff_t, const volatile T * );
    8787
    8888// ------------------------------------------------------------
     
    107107long double _Complex    ++?( long double _Complex & ),          --?( long double _Complex & );
    108108
    109 forall( dtype T | sized(T) ) T *                         ++?(                T *& );
    110 forall( dtype T | sized(T) ) const T *           ++?( const          T *& );
    111 forall( dtype T | sized(T) ) volatile T *                ++?(       volatile T *& );
    112 forall( dtype T | sized(T) ) const volatile T *  ++?( const volatile T *& );
    113 forall( dtype T | sized(T) ) T *                         --?(                T *& );
    114 forall( dtype T | sized(T) ) const T *           --?( const          T *& );
    115 forall( dtype T | sized(T) ) volatile T *                --?(       volatile T *& );
    116 forall( dtype T | sized(T) ) const volatile T *  --?( const volatile T *& );
    117 
    118 forall( dtype T | sized(T) ) T &                 *?(                 T * );
    119 forall( dtype T | sized(T) ) const T &           *?( const           T * );
    120 forall( dtype T | sized(T) ) volatile T &        *?(       volatile  T * );
    121 forall( dtype T | sized(T) ) const volatile T & *?( const volatile  T * );
     109forall( T & | sized(T) ) T *                     ++?(                T *& );
     110forall( T & | sized(T) ) const T *               ++?( const          T *& );
     111forall( T & | sized(T) ) volatile T *            ++?(       volatile T *& );
     112forall( T & | sized(T) ) const volatile T *      ++?( const volatile T *& );
     113forall( T & | sized(T) ) T *                     --?(                T *& );
     114forall( T & | sized(T) ) const T *               --?( const          T *& );
     115forall( T & | sized(T) ) volatile T *            --?(       volatile T *& );
     116forall( T & | sized(T) ) const volatile T *      --?( const volatile T *& );
     117
     118forall( T & | sized(T) ) T &             *?(                 T * );
     119forall( T & | sized(T) ) const T &               *?( const           T * );
     120forall( T & | sized(T) ) volatile T &    *?(       volatile  T * );
     121forall( T & | sized(T) ) const volatile T & *?( const volatile  T * );
    122122forall( ftype FT ) FT &          *?( FT * );
    123123
     
    142142                !?( float _Complex ),           !?( double _Complex ),          !?( long double _Complex );
    143143
    144 forall( dtype DT ) int !?(                DT * );
    145 forall( dtype DT ) int !?( const          DT * );
    146 forall( dtype DT ) int !?(       volatile DT * );
    147 forall( dtype DT ) int !?( const volatile DT * );
     144forall( DT & ) int !?(                DT * );
     145forall( DT & ) int !?( const          DT * );
     146forall( DT & ) int !?(       volatile DT * );
     147forall( DT & ) int !?( const volatile DT * );
    148148forall( ftype FT ) int !?( FT * );
    149149
     
    191191long double _Complex    ?+?( long double _Complex, long double _Complex ),      ?-?( long double _Complex, long double _Complex );
    192192
    193 forall( dtype T | sized(T) ) T *                ?+?(                T *,          ptrdiff_t );
    194 forall( dtype T | sized(T) ) T *                ?+?(          ptrdiff_t,                T * );
    195 forall( dtype T | sized(T) ) const T *          ?+?( const          T *,          ptrdiff_t );
    196 forall( dtype T | sized(T) ) const T *          ?+?(          ptrdiff_t, const          T * );
    197 forall( dtype T | sized(T) ) volatile T *       ?+?(       volatile T *,          ptrdiff_t );
    198 forall( dtype T | sized(T) ) volatile T *       ?+?(          ptrdiff_t,       volatile T * );
    199 forall( dtype T | sized(T) ) const volatile T * ?+?( const volatile T *,          ptrdiff_t );
    200 forall( dtype T | sized(T) ) const volatile T * ?+?(          ptrdiff_t, const volatile T * );
    201 forall( dtype T | sized(T) ) T *                ?-?(                T *,          ptrdiff_t );
    202 forall( dtype T | sized(T) ) const T *          ?-?( const          T *,          ptrdiff_t );
    203 forall( dtype T | sized(T) ) volatile T *       ?-?(       volatile T *,          ptrdiff_t );
    204 forall( dtype T | sized(T) ) const volatile T * ?-?( const volatile T *,          ptrdiff_t );
    205 forall( dtype T | sized(T) ) ptrdiff_t          ?-?( const volatile T *, const volatile T * );
     193forall( T & | sized(T) ) T *            ?+?(                T *,          ptrdiff_t );
     194forall( T & | sized(T) ) T *            ?+?(          ptrdiff_t,                T * );
     195forall( T & | sized(T) ) const T *              ?+?( const          T *,          ptrdiff_t );
     196forall( T & | sized(T) ) const T *              ?+?(          ptrdiff_t, const          T * );
     197forall( T & | sized(T) ) volatile T *   ?+?(       volatile T *,          ptrdiff_t );
     198forall( T & | sized(T) ) volatile T *   ?+?(          ptrdiff_t,       volatile T * );
     199forall( T & | sized(T) ) const volatile T *     ?+?( const volatile T *,          ptrdiff_t );
     200forall( T & | sized(T) ) const volatile T *     ?+?(          ptrdiff_t, const volatile T * );
     201forall( T & | sized(T) ) T *            ?-?(                T *,          ptrdiff_t );
     202forall( T & | sized(T) ) const T *              ?-?( const          T *,          ptrdiff_t );
     203forall( T & | sized(T) ) volatile T *   ?-?(       volatile T *,          ptrdiff_t );
     204forall( T & | sized(T) ) const volatile T *     ?-?( const volatile T *,          ptrdiff_t );
     205forall( T & | sized(T) ) ptrdiff_t              ?-?( const volatile T *, const volatile T * );
    206206
    207207// ------------------------------------------------------------
     
    255255           ?>?( long double, long double ),                             ?>=?( long double, long double );
    256256
    257 forall( dtype DT ) signed int ?<?(                 DT *,                DT * );
    258 forall( dtype DT ) signed int ?<?(  const          DT *, const          DT * );
    259 forall( dtype DT ) signed int ?<?(        volatile DT *,       volatile DT * );
    260 forall( dtype DT ) signed int ?<?(  const volatile DT *, const volatile DT * );
    261 
    262 forall( dtype DT ) signed int ?>?(                 DT *,                DT * );
    263 forall( dtype DT ) signed int ?>?(  const          DT *, const          DT * );
    264 forall( dtype DT ) signed int ?>?(        volatile DT *,       volatile DT * );
    265 forall( dtype DT ) signed int ?>?(  const volatile DT *, const volatile DT * );
    266 
    267 forall( dtype DT ) signed int ?<=?(                 DT *,                DT * );
    268 forall( dtype DT ) signed int ?<=?(  const          DT *, const          DT * );
    269 forall( dtype DT ) signed int ?<=?(        volatile DT *,       volatile DT * );
    270 forall( dtype DT ) signed int ?<=?( const volatile DT *, const volatile DT * );
    271 
    272 forall( dtype DT ) signed int ?>=?(                 DT *,                DT * );
    273 forall( dtype DT ) signed int ?>=?(  const          DT *, const          DT * );
    274 forall( dtype DT ) signed int ?>=?(        volatile DT *,       volatile DT * );
    275 forall( dtype DT ) signed int ?>=?( const volatile DT *, const volatile DT * );
     257forall( DT & ) signed int ?<?(                 DT *,                DT * );
     258forall( DT & ) signed int ?<?(  const          DT *, const          DT * );
     259forall( DT & ) signed int ?<?(        volatile DT *,       volatile DT * );
     260forall( DT & ) signed int ?<?(  const volatile DT *, const volatile DT * );
     261
     262forall( DT & ) signed int ?>?(                 DT *,                DT * );
     263forall( DT & ) signed int ?>?(  const          DT *, const          DT * );
     264forall( DT & ) signed int ?>?(        volatile DT *,       volatile DT * );
     265forall( DT & ) signed int ?>?(  const volatile DT *, const volatile DT * );
     266
     267forall( DT & ) signed int ?<=?(                 DT *,                DT * );
     268forall( DT & ) signed int ?<=?(  const          DT *, const          DT * );
     269forall( DT & ) signed int ?<=?(        volatile DT *,       volatile DT * );
     270forall( DT & ) signed int ?<=?( const volatile DT *, const volatile DT * );
     271
     272forall( DT & ) signed int ?>=?(                 DT *,                DT * );
     273forall( DT & ) signed int ?>=?(  const          DT *, const          DT * );
     274forall( DT & ) signed int ?>=?(        volatile DT *,       volatile DT * );
     275forall( DT & ) signed int ?>=?( const volatile DT *, const volatile DT * );
    276276
    277277// ------------------------------------------------------------
     
    302302signed int ?==?( one_t, one_t ),                                                        ?!=?( one_t, one_t );
    303303
    304 forall( dtype DT ) signed int ?==?(                DT *,                DT * );
    305 forall( dtype DT ) signed int ?==?( const          DT *, const          DT * );
    306 forall( dtype DT ) signed int ?==?(       volatile DT *,       volatile DT * );
    307 forall( dtype DT ) signed int ?==?( const volatile DT *, const volatile DT * );
     304forall( DT & ) signed int ?==?(            DT *,                DT * );
     305forall( DT & ) signed int ?==?( const      DT *, const          DT * );
     306forall( DT & ) signed int ?==?(       volatile DT *,       volatile DT * );
     307forall( DT & ) signed int ?==?( const volatile DT *, const volatile DT * );
    308308forall( ftype FT ) signed int ?==?( FT *, FT * );
    309 forall( dtype DT ) signed int ?!=?(                DT *,                DT * );
    310 forall( dtype DT ) signed int ?!=?( const          DT *, const          DT * );
    311 forall( dtype DT ) signed int ?!=?(       volatile DT *,       volatile DT * );
    312 forall( dtype DT ) signed int ?!=?( const volatile DT *, const volatile DT * );
     309forall( DT & ) signed int ?!=?(            DT *,                DT * );
     310forall( DT & ) signed int ?!=?( const      DT *, const          DT * );
     311forall( DT & ) signed int ?!=?(       volatile DT *,       volatile DT * );
     312forall( DT & ) signed int ?!=?( const volatile DT *, const volatile DT * );
    313313forall( ftype FT ) signed int ?!=?( FT *, FT * );
    314314
     
    376376
    377377forall( ftype FT ) FT *                 ?=?( FT *&, FT * );
    378 forall( ftype FT ) FT *                 ?=?( FT * volatile &, FT * );
    379 
    380 forall( dtype DT ) DT *                 ?=?(                 DT *          &,                   DT * );
    381 forall( dtype DT ) DT *                 ?=?(                 DT * volatile &,                   DT * );
    382 forall( dtype DT ) const DT *           ?=?( const           DT *          &,                   DT * );
    383 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &,                   DT * );
    384 forall( dtype DT ) const DT *           ?=?( const           DT *          &, const             DT * );
    385 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &, const             DT * );
    386 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,                   DT * );
    387 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,                   DT * );
    388 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,       volatile    DT * );
    389 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,       volatile    DT * );
    390 
    391 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,                   DT * );
    392 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,                   DT * );
    393 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const             DT * );
    394 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const             DT * );
    395 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,       volatile    DT * );
    396 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,       volatile    DT * );
    397 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const volatile    DT * );
    398 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const volatile    DT * );
    399 
    400 forall( dtype DT ) void *                ?=?(                void *          &,                 DT * );
    401 forall( dtype DT ) void *                ?=?(                void * volatile &,                 DT * );
    402 forall( dtype DT ) const void *          ?=?( const          void *          &,                 DT * );
    403 forall( dtype DT ) const void *          ?=?( const          void * volatile &,                 DT * );
    404 forall( dtype DT ) const void *          ?=?( const          void *          &, const           DT * );
    405 forall( dtype DT ) const void *          ?=?( const          void * volatile &, const           DT * );
    406 forall( dtype DT ) volatile void *       ?=?(       volatile void *          &,                 DT * );
    407 forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile &,                 DT * );
    408 forall( dtype DT ) volatile void *       ?=?(       volatile void *          &,       volatile  DT * );
    409 forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile &,       volatile  DT * );
    410 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &,                 DT * );
    411 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,                 DT * );
    412 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &, const           DT * );
    413 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const           DT * );
    414 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &,       volatile  DT * );
    415 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,       volatile  DT * );
    416 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &, const volatile  DT * );
    417 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const volatile  DT * );
     378forall( ftyep FT ) FT *                 ?=?( FT * volatile &, FT * );
     379
     380forall( DT & ) DT *                     ?=?(                 DT *          &,                   DT * );
     381forall( DT & ) DT *                     ?=?(                 DT * volatile &,                   DT * );
     382forall( DT & ) const DT *               ?=?( const           DT *          &,                   DT * );
     383forall( DT & ) const DT *               ?=?( const           DT * volatile &,                   DT * );
     384forall( DT & ) const DT *               ?=?( const           DT *          &, const             DT * );
     385forall( DT & ) const DT *               ?=?( const           DT * volatile &, const             DT * );
     386forall( DT & ) volatile DT *    ?=?(       volatile  DT *          &,                   DT * );
     387forall( DT & ) volatile DT *    ?=?(       volatile  DT * volatile &,                   DT * );
     388forall( DT & ) volatile DT *    ?=?(       volatile  DT *          &,       volatile    DT * );
     389forall( DT & ) volatile DT *    ?=?(       volatile  DT * volatile &,       volatile    DT * );
     390
     391forall( DT & ) const volatile DT *      ?=?( const volatile  DT *          &,                   DT * );
     392forall( DT & ) const volatile DT *  ?=?( const volatile  DT * volatile &,                       DT * );
     393forall( DT & ) const volatile DT *  ?=?( const volatile  DT *      &, const             DT * );
     394forall( DT & ) const volatile DT *  ?=?( const volatile  DT * volatile &, const         DT * );
     395forall( DT & ) const volatile DT *  ?=?( const volatile  DT *      &,       volatile    DT * );
     396forall( DT & ) const volatile DT *  ?=?( const volatile  DT * volatile &,           volatile    DT * );
     397forall( DT & ) const volatile DT *  ?=?( const volatile  DT *      &, const volatile    DT * );
     398forall( DT & ) const volatile DT *  ?=?( const volatile  DT * volatile &, const volatile        DT * );
     399
     400forall( DT & ) void *            ?=?(                void *          &,                 DT * );
     401forall( DT & ) void *            ?=?(                void * volatile &,                 DT * );
     402forall( DT & ) const void *              ?=?( const          void *          &,                 DT * );
     403forall( DT & ) const void *              ?=?( const          void * volatile &,                 DT * );
     404forall( DT & ) const void *              ?=?( const          void *          &, const           DT * );
     405forall( DT & ) const void *              ?=?( const          void * volatile &, const           DT * );
     406forall( DT & ) volatile void *   ?=?(       volatile void *          &,                 DT * );
     407forall( DT & ) volatile void *   ?=?(       volatile void * volatile &,                 DT * );
     408forall( DT & ) volatile void *   ?=?(       volatile void *          &,       volatile  DT * );
     409forall( DT & ) volatile void *   ?=?(       volatile void * volatile &,       volatile  DT * );
     410forall( DT & ) const volatile void * ?=?( const volatile void *      &,                 DT * );
     411forall( DT & ) const volatile void * ?=?( const volatile void * volatile &,                     DT * );
     412forall( DT & ) const volatile void * ?=?( const volatile void *      &, const           DT * );
     413forall( DT & ) const volatile void * ?=?( const volatile void * volatile &, const               DT * );
     414forall( DT & ) const volatile void * ?=?( const volatile void *      &,       volatile  DT * );
     415forall( DT & ) const volatile void * ?=?( const volatile void * volatile &,           volatile  DT * );
     416forall( DT & ) const volatile void * ?=?( const volatile void *      &, const volatile  DT * );
     417forall( DT & ) const volatile void * ?=?( const volatile void * volatile &, const volatile      DT * );
    418418
    419419//forall( dtype DT ) DT *                       ?=?(                DT *          &, zero_t );
    420420//forall( dtype DT ) DT *                       ?=?(                DT * volatile &, zero_t );
    421 forall( dtype DT ) const DT *           ?=?( const          DT *          &, zero_t );
    422 forall( dtype DT ) const DT *           ?=?( const          DT * volatile &, zero_t );
     421forall( DT & ) const DT *               ?=?( const          DT *          &, zero_t );
     422forall( DT & ) const DT *               ?=?( const          DT * volatile &, zero_t );
    423423//forall( dtype DT ) volatile DT *      ?=?( volatile       DT *          &, zero_t );
    424424//forall( dtype DT ) volatile DT *      ?=?( volatile       DT * volatile &, zero_t );
    425 forall( dtype DT ) const volatile DT *  ?=?( const volatile DT *          &, zero_t );
    426 forall( dtype DT ) const volatile DT *  ?=?( const volatile DT * volatile &, zero_t );
     425forall( DT & ) const volatile DT *      ?=?( const volatile DT *          &, zero_t );
     426forall( DT & ) const volatile DT *      ?=?( const volatile DT * volatile &, zero_t );
    427427
    428428forall( ftype FT ) FT *                 ?=?( FT *          &, zero_t );
    429429forall( ftype FT ) FT *                 ?=?( FT * volatile &, zero_t );
    430430
    431 forall( dtype T | sized(T) ) T *                ?+=?(                T *          &, ptrdiff_t );
    432 forall( dtype T | sized(T) ) T *                ?+=?(                T * volatile &, ptrdiff_t );
    433 forall( dtype T | sized(T) ) const T *          ?+=?( const          T *          &, ptrdiff_t );
    434 forall( dtype T | sized(T) ) const T *          ?+=?( const          T * volatile &, ptrdiff_t );
    435 forall( dtype T | sized(T) ) volatile T *       ?+=?(       volatile T *          &, ptrdiff_t );
    436 forall( dtype T | sized(T) ) volatile T *       ?+=?(       volatile T * volatile &, ptrdiff_t );
    437 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T *          &, ptrdiff_t );
    438 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile &, ptrdiff_t );
    439 forall( dtype T | sized(T) ) T *                ?-=?(                T *          &, ptrdiff_t );
    440 forall( dtype T | sized(T) ) T *                ?-=?(                T * volatile &, ptrdiff_t );
    441 forall( dtype T | sized(T) ) const T *          ?-=?( const          T *          &, ptrdiff_t );
    442 forall( dtype T | sized(T) ) const T *          ?-=?( const          T * volatile &, ptrdiff_t );
    443 forall( dtype T | sized(T) ) volatile T *       ?-=?(       volatile T *          &, ptrdiff_t );
    444 forall( dtype T | sized(T) ) volatile T *       ?-=?(       volatile T * volatile &, ptrdiff_t );
    445 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T *          &, ptrdiff_t );
    446 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile &, ptrdiff_t );
     431forall( T & | sized(T) ) T *            ?+=?(                T *          &, ptrdiff_t );
     432forall( T & | sized(T) ) T *            ?+=?(                T * volatile &, ptrdiff_t );
     433forall( T & | sized(T) ) const T *              ?+=?( const          T *          &, ptrdiff_t );
     434forall( T & | sized(T) ) const T *              ?+=?( const          T * volatile &, ptrdiff_t );
     435forall( T & | sized(T) ) volatile T *   ?+=?(       volatile T *          &, ptrdiff_t );
     436forall( T & | sized(T) ) volatile T *   ?+=?(       volatile T * volatile &, ptrdiff_t );
     437forall( T & | sized(T) ) const volatile T *     ?+=?( const volatile T *          &, ptrdiff_t );
     438forall( T & | sized(T) ) const volatile T *     ?+=?( const volatile T * volatile &, ptrdiff_t );
     439forall( T & | sized(T) ) T *            ?-=?(                T *          &, ptrdiff_t );
     440forall( T & | sized(T) ) T *            ?-=?(                T * volatile &, ptrdiff_t );
     441forall( T & | sized(T) ) const T *              ?-=?( const          T *          &, ptrdiff_t );
     442forall( T & | sized(T) ) const T *              ?-=?( const          T * volatile &, ptrdiff_t );
     443forall( T & | sized(T) ) volatile T *   ?-=?(       volatile T *          &, ptrdiff_t );
     444forall( T & | sized(T) ) volatile T *   ?-=?(       volatile T * volatile &, ptrdiff_t );
     445forall( T & | sized(T) ) const volatile T *     ?-=?( const volatile T *          &, ptrdiff_t );
     446forall( T & | sized(T) ) const volatile T *     ?-=?( const volatile T * volatile &, ptrdiff_t );
    447447
    448448_Bool                   ?=?( _Bool &, _Bool ),                                  ?=?( volatile _Bool &, _Bool );
     
    723723forall( ftype FT ) void ?{}( FT * volatile &, FT * );
    724724
    725 forall( dtype DT ) void ?{}(                 DT *          &,                   DT * );
    726 forall( dtype DT ) void ?{}( const           DT *          &,                   DT * );
    727 forall( dtype DT ) void ?{}( const           DT *          &, const             DT * );
    728 forall( dtype DT ) void ?{}(       volatile  DT *          &,                   DT * );
    729 forall( dtype DT ) void ?{}(       volatile  DT *          &,       volatile    DT * );
    730 forall( dtype DT ) void ?{}( const volatile  DT *          &,                   DT * );
    731 forall( dtype DT ) void ?{}( const volatile  DT *          &, const             DT * );
    732 forall( dtype DT ) void ?{}( const volatile  DT *          &,       volatile    DT * );
    733 forall( dtype DT ) void ?{}( const volatile  DT *          &, const volatile    DT * );
    734 
    735 forall( dtype DT ) void ?{}(                 void *          &,                 DT * );
    736 forall( dtype DT ) void ?{}( const           void *          &,                 DT * );
    737 forall( dtype DT ) void ?{}( const           void *          &, const           DT * );
    738 forall( dtype DT ) void ?{}(        volatile void *          &,                 DT * );
    739 forall( dtype DT ) void ?{}(        volatile void *          &,       volatile  DT * );
    740 forall( dtype DT ) void ?{}( const volatile void *           &,                 DT * );
    741 forall( dtype DT ) void ?{}( const volatile void *           &, const           DT * );
    742 forall( dtype DT ) void ?{}( const volatile void *           &,       volatile  DT * );
    743 forall( dtype DT ) void ?{}( const volatile void *           &, const volatile  DT * );
     725forall( DT & ) void ?{}(                     DT *          &,                   DT * );
     726forall( DT & ) void ?{}( const       DT *          &,                   DT * );
     727forall( DT & ) void ?{}( const       DT *          &, const             DT * );
     728forall( DT & ) void ?{}(           volatile  DT *          &,                   DT * );
     729forall( DT & ) void ?{}(           volatile  DT *          &,       volatile    DT * );
     730forall( DT & ) void ?{}( const volatile  DT *      &,                   DT * );
     731forall( DT & ) void ?{}( const volatile  DT *      &, const             DT * );
     732forall( DT & ) void ?{}( const volatile  DT *      &,       volatile    DT * );
     733forall( DT & ) void ?{}( const volatile  DT *      &, const volatile    DT * );
     734
     735forall( DT & ) void ?{}(                     void *          &,                 DT * );
     736forall( DT & ) void ?{}( const       void *          &,                 DT * );
     737forall( DT & ) void ?{}( const       void *          &, const           DT * );
     738forall( DT & ) void ?{}(            volatile void *          &,                 DT * );
     739forall( DT & ) void ?{}(            volatile void *          &,       volatile  DT * );
     740forall( DT & ) void ?{}( const volatile void *       &,                 DT * );
     741forall( DT & ) void ?{}( const volatile void *       &, const           DT * );
     742forall( DT & ) void ?{}( const volatile void *       &,       volatile  DT * );
     743forall( DT & ) void ?{}( const volatile void *       &, const volatile  DT * );
    744744
    745745//forall( dtype DT ) void ?{}(              DT *          &, zero_t );
    746746//forall( dtype DT ) void ?{}(              DT * volatile &, zero_t );
    747 forall( dtype DT ) void ?{}( const          DT *          &, zero_t );
     747forall( DT & ) void ?{}( const      DT *          &, zero_t );
    748748//forall( dtype DT ) void ?{}( volatile     DT *          &, zero_t );
    749749//forall( dtype DT ) void ?{}( volatile     DT * volatile &, zero_t );
    750 forall( dtype DT ) void ?{}( const volatile DT *          &, zero_t );
     750forall( DT & ) void ?{}( const volatile DT *      &, zero_t );
    751751
    752752forall( ftype FT ) void ?{}( FT *          &, zero_t );
     
    755755forall( ftype FT ) void ?{}( FT *          & );
    756756
    757 forall( dtype DT ) void ?{}(                 DT *          &);
    758 forall( dtype DT ) void ?{}( const           DT *          &);
    759 forall( dtype DT ) void ?{}(       volatile  DT *          &);
    760 forall( dtype DT ) void ?{}( const volatile  DT *          &);
     757forall( DT & ) void     ?{}(                 DT *          &);
     758forall( DT & ) void     ?{}( const           DT *          &);
     759forall( DT & ) void     ?{}(       volatile  DT *          &);
     760forall( DT & ) void ?{}( const volatile  DT *      &);
    761761
    762762void    ?{}(                void *          &);
     
    768768forall( ftype FT ) void ^?{}( FT *         & );
    769769
    770 forall( dtype DT ) void ^?{}(                DT *          &);
    771 forall( dtype DT ) void ^?{}( const          DT *          &);
    772 forall( dtype DT ) void ^?{}(      volatile  DT *          &);
    773 forall( dtype DT ) void ^?{}( const volatile  DT *         &);
     770forall( DT & ) void     ^?{}(                DT *          &);
     771forall( DT & ) void     ^?{}( const          DT *          &);
     772forall( DT & ) void     ^?{}(      volatile  DT *          &);
     773forall( DT & ) void ^?{}( const volatile  DT *     &);
    774774
    775775void ^?{}(                  void *          &);
  • libcfa/prelude/sync-builtins.cf

    r2f47ea4 rfd54fef  
    206206_Bool __sync_bool_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    207207#endif
    208 forall(dtype T) _Bool __sync_bool_compare_and_swap(T * volatile *, T *, T*, ...);
     208forall(T &) _Bool __sync_bool_compare_and_swap(T * volatile *, T *, T*, ...);
    209209
    210210char __sync_val_compare_and_swap(volatile char *, char, char,...);
     
    223223unsigned __int128 __sync_val_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    224224#endif
    225 forall(dtype T) T * __sync_val_compare_and_swap(T * volatile *, T *, T*,...);
     225forall(T &) T * __sync_val_compare_and_swap(T * volatile *, T *, T*,...);
    226226
    227227char __sync_lock_test_and_set(volatile char *, char,...);
     
    326326void __atomic_exchange(volatile unsigned __int128 *, volatile unsigned __int128 *, volatile unsigned __int128 *, int);
    327327#endif
    328 forall(dtype T) T * __atomic_exchange_n(T * volatile *, T *, int);
    329 forall(dtype T) void __atomic_exchange(T * volatile *, T * volatile *, T * volatile *, int);
     328forall(T &) T * __atomic_exchange_n(T * volatile *, T *, int);
     329forall(T &) void __atomic_exchange(T * volatile *, T * volatile *, T * volatile *, int);
    330330
    331331_Bool __atomic_load_n(const volatile _Bool *, int);
     
    359359void __atomic_load(const volatile unsigned __int128 *, volatile unsigned __int128 *, int);
    360360#endif
    361 forall(dtype T) T * __atomic_load_n(T * const volatile *, int);
    362 forall(dtype T) void __atomic_load(T * const volatile *, T **, int);
     361forall(T &) T * __atomic_load_n(T * const volatile *, int);
     362forall(T &) void __atomic_load(T * const volatile *, T **, int);
    363363
    364364_Bool __atomic_compare_exchange_n(volatile char *, char *, char, _Bool, int, int);
     
    390390_Bool __atomic_compare_exchange   (volatile unsigned __int128 *, unsigned __int128 *, unsigned __int128 *, _Bool, int, int);
    391391#endif
    392 forall(dtype T) _Bool __atomic_compare_exchange_n (T * volatile *, T **, T*, _Bool, int, int);
    393 forall(dtype T) _Bool __atomic_compare_exchange   (T * volatile *, T **, T**, _Bool, int, int);
     392forall(T &) _Bool __atomic_compare_exchange_n (T * volatile *, T **, T*, _Bool, int, int);
     393forall(T &) _Bool __atomic_compare_exchange   (T * volatile *, T **, T**, _Bool, int, int);
    394394
    395395void __atomic_store_n(volatile _Bool *, _Bool, int);
     
    423423void __atomic_store(volatile unsigned __int128 *, unsigned __int128 *, int);
    424424#endif
    425 forall(dtype T) void __atomic_store_n(T * volatile *, T *, int);
    426 forall(dtype T) void __atomic_store(T * volatile *, T **, int);
     425forall(T &) void __atomic_store_n(T * volatile *, T *, int);
     426forall(T &) void __atomic_store(T * volatile *, T **, int);
    427427
    428428char __atomic_add_fetch  (volatile char *, char, int);
Note: See TracChangeset for help on using the changeset viewer.