Ignore:
Timestamp:
Jan 20, 2021, 4:49:40 PM (9 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
454f478
Parents:
92bfda0 (diff), fd54fef (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r92bfda0 rdafbde8  
    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__(); }
Note: See TracChangeset for help on using the changeset viewer.