Changeset 463cb33


Ignore:
Timestamp:
Jul 16, 2020, 2:59:56 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c82af9f
Parents:
519f11c (diff), 3f06c05 (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

Files:
3 added
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r519f11c r463cb33  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul  8 22:14:20 2020
    13 // Update Count     : 1069
     12// Last Modified On : Thu Jul 16 07:43:31 2020
     13// Update Count     : 1102
    1414//
    1515
     
    970970        } // ?|?
    971971
     972#if defined( __SIZEOF_INT128__ )
     973        istype & ?|?( istype & is, int128 & i128 ) {
     974                return (istype &)(is | (unsigned int128 &)i128);
     975        } // ?|?
     976
     977        istype & ?|?( istype & is, unsigned int128 & ui128 ) {
     978                char s[40];
     979                bool sign = false;
     980
     981                if ( fmt( is, " %[-]", s ) == 1 ) sign = true;  // skip whitespace, negative sign ?
     982                // If the input is too large, the value returned is undefined. If there is no input, no value is returned
     983                if ( fmt( is, "%39[0-9]%*[0-9]", s ) == 1 ) {   // take first 39 characters, ignore remaining
     984                        ui128 = 0;
     985                        for ( unsigned int i = 0; s[i] != '\0'; i += 1 ) {
     986                                ui128 = ui128 * 10 + s[i] - '0';
     987                        } // for
     988                        if ( sign ) ui128 = -ui128;
     989                } else if ( sign ) ungetc( is, '-' );                   // return minus when no digits
     990                return is;
     991        } // ?|?
     992#endif // __SIZEOF_INT128__
    972993
    973994        istype & ?|?( istype & is, float & f ) {
  • libcfa/src/iostream.hfa

    r519f11c r463cb33  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 13 22:11:41 2020
    13 // Update Count     : 344
     12// Last Modified On : Thu Jul 16 07:43:32 2020
     13// Update Count     : 348
    1414//
    1515
     
    315315        istype & ?|?( istype &, unsigned int & );
    316316        istype & ?|?( istype &, long int & );
     317        istype & ?|?( istype &, unsigned long int & );
    317318        istype & ?|?( istype &, long long int & );
    318         istype & ?|?( istype &, unsigned long int & );
    319319        istype & ?|?( istype &, unsigned long long int & );
     320#if defined( __SIZEOF_INT128__ )
     321        istype & ?|?( istype &, int128 & );
     322        istype & ?|?( istype &, unsigned int128 & );
     323#endif // __SIZEOF_INT128__
    320324
    321325        istype & ?|?( istype &, float & );
  • src/GenPoly/InstantiateGeneric.cc

    r519f11c r463cb33  
    99// Author           : Aaron B. Moss
    1010// Created On       : Thu Aug 04 18:33:00 2016
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Thu Aug 04 18:33:00 2016
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jul 16 10:17:00 2020
     13// Update Count     : 2
    1414//
    1515#include "InstantiateGeneric.h"
     
    297297        }
    298298
     299        template< typename AggrInst >
     300        static AggrInst * asForward( AggrInst * decl ) {
     301                if ( !decl->body ) {
     302                        return nullptr;
     303                }
     304                decl = decl->clone();
     305                decl->body = false;
     306                deleteAll( decl->members );
     307                decl->members.clear();
     308                return decl;
     309        }
     310
    299311        void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) {
    300312                substituteMembers( base->get_members(), baseParams, typeSubs );
     
    373385                                concDecl->set_body( inst->get_baseStruct()->has_body() );
    374386                                substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    375                                 insert( inst, typeSubs, concDecl ); // must insert before recursion
     387                                // Forward declare before recursion. (TODO: Only when needed, #199.)
     388                                insert( inst, typeSubs, concDecl );
     389                                if ( StructDecl *forwardDecl = asForward( concDecl ) ) {
     390                                        declsToAddBefore.push_back( forwardDecl );
     391                                }
    376392                                concDecl->acceptMutator( *visitor ); // recursively instantiate members
    377393                                declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first
     
    423439                                concDecl->set_body( inst->get_baseUnion()->has_body() );
    424440                                substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    425                                 insert( inst, typeSubs, concDecl ); // must insert before recursion
     441                                // Forward declare before recursion. (TODO: Only when needed, #199.)
     442                                insert( inst, typeSubs, concDecl );
     443                                if ( UnionDecl *forwardDecl = asForward( concDecl ) ) {
     444                                        declsToAddBefore.push_back( forwardDecl );
     445                                }
    426446                                concDecl->acceptMutator( *visitor ); // recursively instantiate members
    427447                                declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first
  • src/Parser/ExpressionNode.cc

    r519f11c r463cb33  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 13 21:12:02 2020
    13 // Update Count     : 1043
     12// Last Modified On : Wed Jul 15 08:24:08 2020
     13// Update Count     : 1046
    1414//
    1515
     
    222222                        } else {                                                                        // octal int128 constant
    223223                                unsigned int len = str.length();
    224                                 char buf[32];
    225                                 __int128 val = v;
    226                                
    227224                                if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large " + str );
    228225                                if ( len <= 1 + 21 ) {                                  // value < 21 octal digitis
     
    230227                                } else {
    231228                                        sscanf( &str[len - 21], "%llo", &v );
    232                                         val = v;                                                        // store bits
     229                                        __int128 val = v;                                       // accumulate bits
    233230                                        str[len - 21] ='\0';                            // shorten string
    234231                                        sscanf( &str[len == 43 ? 1 : 0], "%llo", &v );
     
    240237                                        } // if
    241238                                        v = val >> 64; v2 = (uint64_t)val;      // replace octal constant with 2 hex constants
     239                                        char buf[32];
    242240                                        sprintf( buf, "%#llx", v2 );
    243241                                        str2 = buf;
     
    256254                        #define P10_UINT64 10'000'000'000'000'000'000ULL // 19 zeroes
    257255                        unsigned int len = str.length();
    258                         char buf[32];
    259                         __int128 val = v;
    260 
    261256                        if ( str.length() == 39 && str > (Unsigned ? "340282366920938463463374607431768211455" : "170141183460469231731687303715884105727") )
    262257                                SemanticError( yylloc, "128-bit decimal constant to large " + str );
     
    265260                        } else {
    266261                                sscanf( &str[len - 19], "%llu", &v );
    267                                 val = v;                                                                // store bits
     262                                __int128 val = v;                                               // accumulate bits
    268263                                str[len - 19] ='\0';                                    // shorten string
    269264                                sscanf( &str[len == 39 ? 1 : 0], "%llu", &v );
     
    275270                                } // if
    276271                                v = val >> 64; v2 = (uint64_t)val;              // replace decimal constant with 2 hex constants
     272                                char buf[32];
    277273                                sprintf( buf, "%#llx", v2 );
    278274                                str2 = buf;
  • tests/.expect/functions.x64.txt

    r519f11c r463cb33  
    121121
    122122}
     123struct _conc__tuple2_0;
    123124struct _conc__tuple2_0 {
    124125    signed int field_0;
     
    157158
    158159}
     160struct _conc__tuple3_1;
    159161struct _conc__tuple3_1 {
    160162    signed int field_0;
     
    170172    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
    171173}
     174struct _conc__tuple3_2;
    172175struct _conc__tuple3_2 {
    173176    signed int field_0;
     
    260263    __attribute__ ((unused)) signed int *const _X10_retval_f3KPi_1;
    261264}
     265struct _conc__tuple2_3;
    262266struct _conc__tuple2_3 {
    263267    signed int *field_0;
  • tests/.expect/functions.x86.txt

    r519f11c r463cb33  
    121121
    122122}
     123struct _conc__tuple2_0;
    123124struct _conc__tuple2_0 {
    124125    signed int field_0;
     
    157158
    158159}
     160struct _conc__tuple3_1;
    159161struct _conc__tuple3_1 {
    160162    signed int field_0;
     
    170172    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
    171173}
     174struct _conc__tuple3_2;
    172175struct _conc__tuple3_2 {
    173176    signed int field_0;
     
    260263    __attribute__ ((unused)) signed int *const _X10_retval_f3KPi_1;
    261264}
     265struct _conc__tuple2_3;
    262266struct _conc__tuple2_3 {
    263267    signed int *field_0;
  • tests/.in/manipulatorsInput.txt

    r519f11c r463cb33  
    27273.5 3.5 3.456E+23.456E+2 -0x1.2p-3 3.5 0X1.23p3     3.5
    28283.5 3.5 3.456E+23.456E+2 -0x1.2p-3 3.5 0X1.23p3     3.5
     2925 -25 42798
     301402432282 1505850196993244515
     31394749758663249135511342
     3212935154696204706112391834394
     33
     34423859149128410414395372834994551
     35
     36
     3713889016598639747063234935497057631587
     38170141183460469231731687303715884105727
     39340282366920938463463374607431768211455
     40-340282366920938463463374607431768211455
     41340282366920938463463374607431768211455999
     421234567890123456789 -1234567890123456789
  • tests/manipulatorsInput.cfa

    r519f11c r463cb33  
    77// Created On       : Sat Jun  8 17:58:54 2019
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Thu Jun 13 17:41:43 2019
    10 // Update Count     : 37
     9// Last Modified On : Wed Jul 15 15:56:03 2020
     10// Update Count     : 47
    1111//
    1212
     
    152152                sin | ignore( wdi( 8, ldc ) );                  sout | ldc;
    153153        }
     154#if defined( __SIZEOF_INT128__ )
     155        {
     156                int128 val;
     157                for ( 15 ) {
     158                        sin | val;
     159                        sout | val;
     160                }
     161        }
     162#endif // __SIZEOF_INT128__
    154163} // main
    155164
Note: See TracChangeset for help on using the changeset viewer.