Changes in / [330d933:f9bf142]


Ignore:
Files:
2 deleted
49 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/FullBuild

    r330d933 rf9bf142  
    132132
    133133<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" >
    134 <img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=1" >
    135134
    136135<p>- Logs ----------------------------------------------------------------</p>
  • Jenkinsfile

    r330d933 rf9bf142  
    197197                if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
    198198
    199                 def groupCompile = new PlotGroup('Compilation', 'duration (s) - lower is better', true)
    200                 def groupConcurrency = new PlotGroup('Concurrency', 'duration (n) - lower is better', false)
     199                def groupCompile = new PlotGroup('Compilation', 'seconds', true)
     200                def groupConcurrency = new PlotGroup('Concurrency', 'nanoseconds', false)
    201201
    202202                //Then publish the results
    203                 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile'       , groupCompile    , false, 'Compilation')
    204                 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff'  , groupCompile    , true , 'Compilation (relative)')
    205                 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch'     , groupConcurrency, false, 'Context Switching')
    206                 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff', groupConcurrency, true , 'Context Switching (relative)')
    207                 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex'         , groupConcurrency, false, 'Mutual Exclusion')
    208                 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff'    , groupConcurrency, true , 'Mutual Exclusion (relative)')
    209                 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal'        , groupConcurrency, false, 'Internal and External Scheduling')
    210                 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal.diff'   , groupConcurrency, true , 'Internal and External Scheduling (relative)')
     203                do_plot(Settings.RunBenchmark && Settings.Publish, 'compile'       , groupCompile    , 'Compilation')
     204                do_plot(Settings.RunBenchmark && Settings.Publish, 'compile-diff'  , groupCompile    , 'Compilation Speed-Up')
     205                do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch'     , groupConcurrency, 'Context Switching')
     206                do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch-diff', groupConcurrency, 'Context Switching Speed-Up')
     207                do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex'         , groupConcurrency, 'Mutual Exclusion')
     208                do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex-diff'    , groupConcurrency, 'Mutual Exclusion Speed-Up')
     209                do_plot(Settings.RunBenchmark && Settings.Publish, 'signal'        , groupConcurrency, 'Internal and External Scheduling')
     210                do_plot(Settings.RunBenchmark && Settings.Publish, 'signal-diff'   , groupConcurrency, 'Internal and External Scheduling Speed-Up')
    211211        }
    212212}
     
    466466}
    467467
    468 def do_plot(boolean new_data, String file, PlotGroup group, boolean relative, String title) {
     468def do_plot(boolean new_data, String file, PlotGroup group, String title) {
    469469
    470470        if(new_data) {
     
    489489                        exclZero: false,
    490490                        keepRecords: false,
    491                         logarithmic: !relative && group.log,
     491                        logarithmic: group.log,
    492492                        numBuilds: '120',
    493493                        useDescr: true,
  • Makefile.in

    r330d933 rf9bf142  
    281281CYGPATH_W = @CYGPATH_W@
    282282DEFS = @DEFS@
    283 DEMANGLER = @DEMANGLER@
    284283DEPDIR = @DEPDIR@
    285284DLLTOOL = @DLLTOOL@
     
    307306LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    308307LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    309 LIBDEMANGLE = @LIBDEMANGLE@
    310308LIBOBJS = @LIBOBJS@
    311309LIBS = @LIBS@
  • automake/cfa.m4

    r330d933 rf9bf142  
    6666                "x86-64"     ) cannon_arch_name="x64";;
    6767                "x86_64"     ) cannon_arch_name="x64";;
    68                 "aarch64"    ) cannon_arch_name="arm";;
     68                "aarch64"    ) cannon_arch_name="x64";;
    6969                "x86"        ) cannon_arch_name="x86";;
    7070                "i386"       ) cannon_arch_name="x86";;
  • benchmark/Makefile.in

    r330d933 rf9bf142  
    231231CYGPATH_W = @CYGPATH_W@
    232232DEFS = @DEFS@
    233 DEMANGLER = @DEMANGLER@
    234233DEPDIR = @DEPDIR@
    235234DLLTOOL = @DLLTOOL@
     
    257256LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    258257LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    259 LIBDEMANGLE = @LIBDEMANGLE@
    260258LIBOBJS = @LIBOBJS@
    261259LIBS = @LIBS@
  • configure

    r330d933 rf9bf142  
    637637LIBOBJS
    638638CFA_BACKEND_CC
    639 DEMANGLER
    640 LIBDEMANGLE
    641639WITH_LIBTCMALLOC_FALSE
    642640WITH_LIBTCMALLOC_TRUE
     
    799797with_target_hosts
    800798enable_gprofiler
    801 enable_demangler
    802799enable_dependency_tracking
    803800enable_shared
     
    14601457  --disable-silent-rules  verbose build output (undo: "make V=0")
    14611458  --enable-gprofiler     whether or not to enable gprofiler tools (if available)
    1462   --enable-demangler     whether or not to build the demangler (executable and library)
    14631459  --enable-dependency-tracking
    14641460                          do not reject slow dependency extractors
     
    34053401
    34063402
    3407 # Check whether --enable-demangler was given.
    3408 if test "${enable_demangler+set}" = set; then :
    3409   enableval=$enable_demangler; enable_demangler=$enableval
    3410 else
    3411   enable_demangler=yes
    3412 fi
    3413 
    3414 
    34153403TARGET_HOSTS=${target_hosts}
    34163404
     
    34453433                "x86-64"     ) cannon_arch_name="x64";;
    34463434                "x86_64"     ) cannon_arch_name="x64";;
    3447                 "aarch64"    ) cannon_arch_name="arm";;
     3435                "aarch64"    ) cannon_arch_name="x64";;
    34483436                "x86"        ) cannon_arch_name="x86";;
    34493437                "i386"       ) cannon_arch_name="x86";;
     
    34873475                "x86-64"     ) cannon_arch_name="x64";;
    34883476                "x86_64"     ) cannon_arch_name="x64";;
    3489                 "aarch64"    ) cannon_arch_name="arm";;
     3477                "aarch64"    ) cannon_arch_name="x64";;
    34903478                "x86"        ) cannon_arch_name="x86";;
    34913479                "i386"       ) cannon_arch_name="x86";;
     
    1679216780
    1679316781
    16794 # conditionnally build the demangler
    16795 if test "x$enable_demangler" == xyes; then
    16796         LIBDEMANGLE="libdemangle.a"
    16797         DEMANGLER="demangler"
    16798 else
    16799         LIBDEMANGLE=""
    16800         DEMANGLER=""
    16801 fi
    16802 
    16803 
    16804 
    1680516782# Checks for header files.
    1680616783for ac_header in libintl.h malloc.h unistd.h
  • configure.ac

    r330d933 rf9bf142  
    133133        enable_gprofiler=$enableval, enable_gprofiler=yes)
    134134
    135 AC_ARG_ENABLE(demangler,
    136         [  --enable-demangler     whether or not to build the demangler (executable and library)],
    137         enable_demangler=$enableval, enable_demangler=yes)
    138 
    139135AC_SUBST(TARGET_HOSTS, ${target_hosts})
    140136
     
    209205AM_CONDITIONAL([WITH_LIBTCMALLOC], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBTCMALLOC" -eq 1])
    210206
    211 # conditionnally build the demangler
    212 if test "x$enable_demangler" == xyes; then
    213         LIBDEMANGLE="libdemangle.a"
    214         DEMANGLER="demangler"
    215 else
    216         LIBDEMANGLE=""
    217         DEMANGLER=""
    218 fi
    219 AC_SUBST([LIBDEMANGLE])
    220 AC_SUBST([DEMANGLER])
    221 
    222207# Checks for header files.
    223208AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
  • driver/Makefile.in

    r330d933 rf9bf142  
    218218CYGPATH_W = @CYGPATH_W@
    219219DEFS = @DEFS@
    220 DEMANGLER = @DEMANGLER@
    221220DEPDIR = @DEPDIR@
    222221DLLTOOL = @DLLTOOL@
     
    244243LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    245244LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    246 LIBDEMANGLE = @LIBDEMANGLE@
    247245LIBOBJS = @LIBOBJS@
    248246LIBS = @LIBS@
  • driver/cc1.cc

    r330d933 rf9bf142  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 23 15:06:27 2019
    13 // Update Count     : 371
     12// Last Modified On : Mon Sep  3 16:57:05 2018
     13// Update Count     : 125
    1414//
    1515
     
    1919#include <string>
    2020using std::string;
    21 #include <algorithm>                                                                    // find
    2221#include <cstdio>                                                                               // stderr, stdout, perror, fprintf
    2322#include <cstdlib>                                                                              // getenv, exit, mkstemp
    2423#include <unistd.h>                                                                             // execvp, fork, unlink
    2524#include <sys/wait.h>                                                                   // wait
    26 #include <fcntl.h>
    27 
    2825
    2926#include "config.h"                                                                             // configure info
     
    3330
    3431
    35 static string installlibdir( CFA_LIBDIR );                              // fixed location of cc1 and cfa-cpp commands when installed
    36 static string compiler_path( CFA_BACKEND_CC );                  // path/name of C compiler
    37 static bool CFA_flag = false;                                                   // -CFA flag
    38 static bool save_temps = false;                                                 // -save-temps flag
    39 static string o_file;
    40 
    41 
    42 static bool prefix( const string & arg, const string & pre ) {
     32string compiler_name( CFA_BACKEND_CC );                                 // path/name of C compiler
     33
     34string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" );
     35string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" );
     36
     37char tmpname[] = P_tmpdir "/CFAXXXXXX";
     38int tmpfilefd = -1;
     39
     40
     41bool prefix( string arg, string pre ) {
    4342        return arg.substr( 0, pre.size() ) == pre;
    4443} // prefix
    4544
    46 static void suffix( const string & arg, const char * args[], int & nargs ) {
    47         enum { NumSuffixes = 3 };
    48         static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
    49 
     45enum { NumSuffixes = 2 };
     46const string suffixes[NumSuffixes] = { "cfa", "hfa", };
     47
     48void suffix( string arg, const char * args[], int & nargs ) {
     49        //std::cerr << arg << std::endl;
    5050        size_t dot = arg.find_last_of( "." );
     51        //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
    5152        if ( dot == string::npos ) return;
    52         const string * end = suffixes + NumSuffixes;
    53         if ( std::find( suffixes, end, arg.substr( dot + 1 ) ) != end ) {
    54                 args[nargs++] = "-x";
    55                 args[nargs++] = "c";
    56         } // if
     53        string sx = arg.substr( dot + 1 );
     54        for ( int i = 0; i < NumSuffixes; i += 1 ) {
     55                if ( sx == suffixes[i] ) {
     56                        args[nargs] = "-x";
     57                        nargs += 1;
     58                        args[nargs] = "c";
     59                        nargs += 1;
     60                        return;
     61                } // if
     62        } // for
    5763} // suffix
    5864
    5965
    60 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );
    61 
    62 static void checkEnv1( const char * args[], int & nargs ) { // stage 1
    63         extern char ** environ;
    64 
    65         for ( int i = 0; environ[i]; i += 1 ) {
    66                 string arg( environ[i] );
     66void checkEnv( const char * args[], int & nargs ) {
     67        char *value;
     68
     69        value = getenv( "__CFA_COMPILER__" );
     70        if ( value != NULL ) {
     71                compiler_name = value;
    6772                #ifdef __DEBUG_H__
    68                 cerr << "env arg:\"" << arg << "\"" << endl;
     73                cerr << "env arg:\"" << compiler_name << "\"" << endl;
    6974                #endif // __DEBUG_H__
    70 
    71                 if ( prefix( arg, __CFA_FLAGPREFIX__ ) ) {
    72                         string val( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) );
    73                         if ( prefix( val, "-compiler=" ) ) {
    74                                 compiler_path = val.substr( 10 );
    75                         } // if
    76                 } // if
    77         } // for
    78 } // checkEnv1
    79 
    80 
    81 static void checkEnv2( const char * args[], int & nargs ) { // stage 2
    82         extern char ** environ;
    83 
    84         for ( int i = 0; environ[i]; i += 1 ) {
    85                 string arg( environ[i] );
     75        } // if
     76
     77        value = getenv( "__GCC_MACHINE__" );
     78        if ( value != NULL ) {
     79                args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
    8680                #ifdef __DEBUG_H__
    87                 cerr << "env arg:\"" << arg << "\"" << endl;
     81                cerr << "env arg:\"" << args[nargs] << "\"" << endl;
    8882                #endif // __DEBUG_H__
    89 
    90                 if ( prefix( arg, __CFA_FLAGPREFIX__ ) ) {
    91                         string val( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) );
    92                         if ( prefix( val, "-compiler=" ) ) {
    93                                 compiler_path = val.substr( 10 );
    94                         } else if ( val == "-CFA" ) {
    95                                 CFA_flag = true;
    96                         } else if ( val == "-save-temps" ) {
    97                                 save_temps = true;
    98                         } else if ( prefix( val, "-o=" ) ) {            // output file for -CFA
    99                                 o_file = val.substr( 3 );
    100                         } else {
    101                                 args[nargs++] = ( *new string( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) ) ).c_str();
    102                         } // if
    103                 } // if
    104         } // for
    105 } // checkEnv2
    106 
    107 
    108 static char tmpname[] = P_tmpdir "/CFAXXXXXX.i";
    109 static int tmpfilefd = -1;
    110 static bool startrm = false;
    111 
    112 static void rmtmpfile() {
    113         if ( tmpfilefd == -1 ) return;                                          // RACE, file created ?
    114 
    115         startrm = true;                                                                         // RACE with C-c C-c
     83                nargs += 1;
     84        } // if
     85
     86        value = getenv( "__GCC_VERSION__" );
     87        if ( value != NULL ) {
     88                args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
     89                #ifdef __DEBUG_H__
     90                cerr << "env arg:\"" << args[nargs] << "\"" << endl;
     91                #endif // __DEBUG_H__
     92                nargs += 1;
     93        } // if
     94} // checkEnv
     95
     96
     97void rmtmpfile() {
    11698        if ( unlink( tmpname ) == -1 ) {                                        // remove tmpname
    117                 perror ( "CC1 Translator error: failed, unlink" );
    118                 exit( EXIT_FAILURE );
    119         } // if
    120         tmpfilefd = -1;                                                                         // mark removed
     99                perror ( "CFA Translator error: cpp failed" );
     100                exit( EXIT_FAILURE );
     101        } // if
     102        tmpfilefd = -1;                                                                         // mark closed
    121103} // rmtmpfile
    122104
    123105
    124 static void sigTermHandler( int ) {                                             // C-c C-c
    125         if ( startrm ) return;                                                          // return and let rmtmpfile finish, and then program finishes
    126 
     106void sigTermHandler( __attribute__((unused)) int signal ) {
    127107        if ( tmpfilefd != -1 ) {                                                        // RACE, file created ?
    128                 rmtmpfile();                                                                    // remove tmpname
    129         } // if
    130         exit( EXIT_FAILURE );                                                           // terminate
     108                rmtmpfile();                                                                    // remove
     109                exit( EXIT_FAILURE );                                                   // terminate
     110        } // if
    131111} // sigTermHandler
    132112
    133113
    134 static void Stage1( const int argc, const char * const argv[] ) {
     114void Stage1( const int argc, const char * const argv[] ) {
    135115        int code;
     116
    136117        string arg;
    137 
    138         const char * cpp_in = nullptr;
    139         const char * cpp_out = nullptr;
    140 
     118        string bprefix;
     119
     120        const char *cpp_in = NULL;
     121        const char *cpp_out = NULL;
     122
     123        bool CFA_flag = false;
    141124        bool cpp_flag = false;
    142         bool o_flag = false;
    143 
    144         const char * args[argc + 100];                                          // leave space for 100 additional cpp command line values
     125        const char *o_name = NULL;
     126
     127        const char *args[argc + 100];                                           // leave space for 100 additional cpp command line values
    145128        int nargs = 1;                                                                          // number of arguments in args list; 0 => command name
     129        const char *cargs[20];                                                          // leave space for 20 additional cfa-cpp command line values
     130        int ncargs = 1;                                                                         // 0 => command name
     131
     132        signal( SIGINT,  sigTermHandler );
     133        signal( SIGTERM, sigTermHandler );
    146134
    147135        #ifdef __DEBUG_H__
    148136        cerr << "Stage1" << endl;
    149137        #endif // __DEBUG_H__
    150         checkEnv1( args, nargs );                                                       // arguments passed via environment variables
     138        checkEnv( args, nargs );                                                        // arguments passed via environment variables
    151139        #ifdef __DEBUG_H__
    152140        for ( int i = 1; i < argc; i += 1 ) {
     
    180168                                i += 1;                                                                 // and the argument
    181169                                cpp_flag = true;
    182 
    183                                 // all other flags
     170                        } else if ( arg == "-D__CFA_PREPROCESS__" ) {
     171                                CFA_flag = true;
     172                        } else if ( arg == "-D" && string( argv[i + 1] ) == "__CFA_PREPROCESS__" ) {
     173                                i += 1;                                                                 // and the argument
     174                                CFA_flag = true;
     175                        } else if ( prefix( arg, D__CFA_FLAGPREFIX__ ) ) {
     176                                cargs[ncargs] = ( *new string( arg.substr( D__CFA_FLAGPREFIX__.size() ) ) ).c_str();
     177                                ncargs += 1;
     178                        } else if ( arg == "-D" && prefix( argv[i + 1], D__CFA_FLAGPREFIX__.substr(2) ) ) {
     179                                cargs[ncargs] = ( *new string( string( argv[i + 1] ).substr( D__CFA_FLAGPREFIX__.size() - 2 ) ) ).c_str();
     180                                ncargs += 1;
     181                                i += 1;                                                                 // and the argument
     182                        } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
     183                                bprefix = arg.substr( D__GCC_BPREFIX__.size() );
     184                        } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_BPREFIX__.substr(2) ) ) {
     185                                bprefix = string( argv[i + 1] ).substr( D__GCC_BPREFIX__.size() - 2 );
     186                                i += 1;                                                                 // and the argument
     187
     188                        // all other flags
    184189
    185190                        } else if ( arg == "-o" ) {
    186191                                i += 1;
    187                                 o_flag = true;
    188                                 cpp_out = argv[i];
     192                                o_name = argv[i];
    189193                        } else {
    190                                 args[nargs++] = argv[i];                                // pass the flag along
     194                                args[nargs] = argv[i];                                  // pass the flag along
     195                                nargs += 1;
    191196                                // CPP flags with an argument
    192197                                if ( arg == "-D" || arg == "-U" || arg == "-I" || arg == "-MF" || arg == "-MT" || arg == "-MQ" ||
     
    194199                                         arg == "-iwithprefix" || arg == "-iwithprefixbefore" || arg == "-isystem" || arg == "-isysroot" ) {
    195200                                        i += 1;
    196                                         args[nargs++] = argv[i];                        // pass the argument along
     201                                        args[nargs] = argv[i];                          // pass the argument along
     202                                        nargs += 1;
    197203                                        #ifdef __DEBUG_H__
    198204                                        cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    199205                                        #endif // __DEBUG_H__
    200206                                } else if ( arg == "-MD" || arg == "-MMD" ) {
    201                                         args[nargs++] = "-MF";                          // insert before file
     207                                        args[nargs] = "-MF";                            // insert before file
     208                                        nargs += 1;
    202209                                        i += 1;
    203                                         args[nargs++] = argv[i];                        // pass the argument along
     210                                        args[nargs] = argv[i];                          // pass the argument along
     211                                        nargs += 1;
    204212                                        #ifdef __DEBUG_H__
    205213                                        cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     
    208216                        } // if
    209217                } else {                                                                                // obtain input and possibly output files
    210                         if ( cpp_in == nullptr ) {
     218                        if ( cpp_in == NULL ) {
    211219                                cpp_in = argv[i];
    212220                                #ifdef __DEBUG_H__
    213221                                cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
    214222                                #endif // __DEBUG_H__
    215                         } else if ( cpp_out == nullptr ) {
     223                        } else if ( cpp_out == NULL ) {
    216224                                cpp_out = argv[i];
    217225                                #ifdef __DEBUG_H__
     
    230238                cerr << " " << args[i];
    231239        } // for
    232         if ( cpp_in != nullptr ) cerr << " " << cpp_in;
    233         if ( cpp_out != nullptr ) cerr << " " << cpp_out;
     240        if ( cpp_in != NULL ) cerr << " " << cpp_in;
     241        if ( cpp_out != NULL ) cerr << " " << cpp_out;
    234242        cerr << endl;
    235243        #endif // __DEBUG_H__
    236244
    237         if ( cpp_in == nullptr ) {
     245        if ( cpp_in == NULL ) {
    238246                cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
    239247                exit( EXIT_FAILURE );
     
    244252                // output or -o. The call to cfa has a -E so it does not have to be added to the argument list.
    245253
    246                 args[0] = compiler_path.c_str();
     254                args[0] = compiler_name.c_str();
    247255                suffix( cpp_in, args, nargs );                                  // check suffix
    248                 args[nargs++] = cpp_in;
    249                 if ( o_flag ) {                                                                 // location for output
    250                         args[nargs++] = "-o";
     256                args[nargs] = cpp_in;
     257                nargs += 1;
     258                if ( o_name != NULL ) {                                                 // location for output
     259                        args[nargs] = "-o";
     260                        nargs += 1;
     261                        args[nargs] = o_name;
     262                        nargs += 1;
    251263                } // if
    252                 args[nargs++] = cpp_out;
    253                 args[nargs] = nullptr;                                                  // terminate argument list
     264                args[nargs] = NULL;                                                             // terminate argument list
    254265
    255266                #ifdef __DEBUG_H__
    256267                cerr << "nargs: " << nargs << endl;
    257                 for ( int i = 0; args[i] != nullptr; i += 1 ) {
     268                for ( int i = 0; args[i] != NULL; i += 1 ) {
    258269                        cerr << args[i] << " ";
    259270                } // for
     
    261272                #endif // __DEBUG_H__
    262273
    263                 execvp( args[0], (char * const *)args );                // should not return
    264                 perror( "CC1 Translator error: stage 1, execvp" );
    265                 exit( EXIT_FAILURE );
    266         } // if
    267 
    268         // Run the C preprocessor and save the output in the given file.
     274                execvp( args[0], (char *const *)args );                 // should not return
     275                perror( "CFA Translator error: cpp level, execvp" );
     276                exit( EXIT_FAILURE );
     277        } // if
     278
     279        // Create a temporary file to store output of the C preprocessor.
     280
     281        tmpfilefd = mkstemp( tmpname );
     282        if ( tmpfilefd == -1 ) {
     283                perror( "CFA Translator error: cpp level, mkstemp" );
     284                exit( EXIT_FAILURE );
     285        } // if
     286
     287        #ifdef __DEBUG_H__
     288        cerr << "tmpname:" << tmpname << " tmpfilefd:" << tmpfilefd << endl;
     289        #endif // __DEBUG_H__
     290
     291        // Run the C preprocessor and save the output in tmpfile.
    269292
    270293        if ( fork() == 0 ) {                                                             // child process ?
     
    272295                // an error (e.g., cannot find include file). Whereas, output is always generated, even when there is an error,
    273296                // when cpp writes to stdout. Hence, stdout is redirected into the temporary file.
    274                 if ( freopen( cpp_out, "w", stdout ) == nullptr ) { // redirect stdout to output file
    275                         perror( "CC1 Translator error: stage 1, freopen" );
     297                if ( freopen( tmpname, "w", stdout ) == NULL ) { // redirect stdout to tmpname
     298                        perror( "CFA Translator error: cpp level, freopen" );
    276299                        exit( EXIT_FAILURE );
    277300                } // if
    278301
    279                 args[0] = compiler_path.c_str();
     302                args[0] = compiler_name.c_str();
    280303                suffix( cpp_in, args, nargs );                                  // check suffix
    281                 args[nargs++] = cpp_in;                                                 // input to cpp
    282                 args[nargs] = nullptr;                                                  // terminate argument list
     304                args[nargs] = cpp_in;                                                   // input to cpp
     305                nargs += 1;
     306                args[nargs] = NULL;                                                             // terminate argument list
    283307
    284308                #ifdef __DEBUG_H__
    285309                cerr << "cpp nargs: " << nargs << endl;
    286                 for ( int i = 0; args[i] != nullptr; i += 1 ) {
     310                for ( int i = 0; args[i] != NULL; i += 1 ) {
    287311                        cerr << args[i] << " ";
    288312                } // for
     
    290314                #endif // __DEBUG_H__
    291315
    292                 execvp( args[0], (char * const *)args );                // should not return
    293                 perror( "CC1 Translator error: stage 1, execvp" );
     316                execvp( args[0], (char *const *)args );                 // should not return
     317                perror( "CFA Translator error: cpp level, execvp" );
    294318                exit( EXIT_FAILURE );
    295319        } // if
     
    301325        #endif // __DEBUG_H__
    302326
     327        if ( WIFSIGNALED(code) != 0 ) {                                         // child failed ?
     328                rmtmpfile();                                                                    // remove tmpname
     329                cerr << "CFA Translator error: cpp failed with signal " << WTERMSIG(code) << endl;
     330                exit( EXIT_FAILURE );
     331        } // if
     332
     333        if ( WEXITSTATUS(code) != 0 ) {                                         // child error ?
     334                rmtmpfile();                                                                    // remove tmpname
     335                exit( WEXITSTATUS( code ) );                                    // do not continue
     336        } // if
     337
     338        // If -CFA flag specified, run the cfa-cpp preprocessor on the temporary file, and output is written to standard
     339        // output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
     340
     341        if ( fork() == 0 ) {                                                            // child runs CFA
     342                cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
     343
     344                // Source file-name used to generate routine names containing global initializations for TU.
     345                cargs[ncargs] = ( *new string( "-F" ) ).c_str();
     346                ncargs += 1;
     347                cargs[ncargs] = ( *new string( string( cpp_in ) ) ).c_str();
     348                ncargs += 1;
     349
     350                cargs[ncargs] = tmpname;
     351                ncargs += 1;
     352                if ( o_name != NULL ) {
     353                        cargs[ncargs] = o_name;
     354                        ncargs += 1;
     355                } else if ( ! CFA_flag ) {                                              // run cfa-cpp ?
     356                        cargs[ncargs] = cpp_out;
     357                        ncargs += 1;
     358                } // if
     359                cargs[ncargs] = NULL;                                                   // terminate argument list
     360
     361                #ifdef __DEBUG_H__
     362                cerr << "cfa-cpp ncargs: " << (o_name ? o_name : "No -o") << " " << CFA_flag << " " << ncargs << endl;
     363                for ( int i = 0; cargs[i] != NULL; i += 1 ) {
     364                        cerr << cargs[i] << " ";
     365                } // for
     366                cerr << endl;
     367                #endif // __DEBUG_H__
     368
     369                execvp( cargs[0], (char * const *)cargs );              // should not return
     370                perror( "CFA Translator error: cpp level, execvp" );
     371                exit( EXIT_FAILURE );
     372        } // if
     373
     374        wait( &code );                                                                          // wait for child to finish
     375
     376        #ifdef __DEBUG_H__
     377        cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
     378        #endif // __DEBUG_H__
     379
     380        // Must unlink here because file must exist across execvp.
     381        rmtmpfile();                                                                            // remove tmpname
     382
    303383        if ( WIFSIGNALED(code) ) {                                                      // child failed ?
    304                 cerr << "CC1 Translator error: stage 1, child failed " << WTERMSIG(code) << endl;
    305                 exit( EXIT_FAILURE );
    306         } // if
    307 
    308         exit( WEXITSTATUS(code) );                                                      // bad cpp result stops top-level gcc
     384                cerr << "CFA Translator error: cfa-cpp failed with signal " << WTERMSIG(code) << endl;
     385                exit( EXIT_FAILURE );
     386        } // if
     387
     388        exit( WEXITSTATUS(code) );
    309389} // Stage1
    310390
    311391
    312 static void Stage2( const int argc, const char * const * argv ) {
    313         int code;
     392void Stage2( const int argc, const char * const * argv ) {
    314393        string arg;
    315394
    316         const char * cpp_in = nullptr;
    317         const char * cpp_out = nullptr;
    318 
    319         const char * args[argc + 100];                                          // leave space for 100 additional cfa command line values
     395        const char *cpp_in = NULL;
     396
     397        const char *args[argc + 100];                                           // leave space for 100 additional cfa command line values
    320398        int nargs = 1;                                                                          // number of arguments in args list; 0 => command name
    321         const char * cargs[20];                                                         // leave space for 20 additional cfa-cpp command line values
    322         int ncargs = 1;                                                                         // 0 => command name
    323399
    324400        #ifdef __DEBUG_H__
    325401        cerr << "Stage2" << endl;
    326402        #endif // __DEBUG_H__
    327         checkEnv2( cargs, ncargs );                                                     // arguments passed via environment variables
     403        checkEnv( args, nargs );                                                        // arguments passed via environment variables
    328404        #ifdef __DEBUG_H__
    329405        for ( int i = 1; i < argc; i += 1 ) {
     
    354430
    355431                        } else {
    356                                 args[nargs++] = argv[i];                                // pass the flag along
     432                                args[nargs] = argv[i];                                  // pass the flag along
     433                                nargs += 1;
    357434                                if ( arg == "-o" ) {
    358435                                        i += 1;
    359                                         cpp_out = argv[i];
    360                                         args[nargs++] = argv[i];                        // pass the argument along
     436                                        args[nargs] = argv[i];                          // pass the argument along
     437                                        nargs += 1;
    361438                                        #ifdef __DEBUG_H__
    362439                                        cerr << "arg:\"" << argv[i] << "\"" << endl;
     
    365442                        } // if
    366443                } else {                                                                                // obtain input and possibly output files
    367                         if ( cpp_in == nullptr ) {
     444                        if ( cpp_in == NULL ) {
    368445                                cpp_in = argv[i];
    369446                                #ifdef __DEBUG_H__
    370447                                cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
    371448                                #endif // __DEBUG_H__
    372                         } else if ( cpp_out == nullptr ) {
    373                                 cpp_out = argv[i];
    374                                 #ifdef __DEBUG_H__
    375                                 cerr << "cpp_out:\"" << cpp_out << "\""<< endl;
    376                                 #endif // __DEBUG_H__
    377449                        } else {
    378                                 cerr << "Usage: " << argv[0] << " more than two files specified" << endl;
     450                                cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
    379451                                exit( EXIT_FAILURE );
    380452                        } // if
     
    382454        } // for
    383455
    384         if ( cpp_in == nullptr ) {
    385                 cerr << "Usage: " << argv[0] << " missing input file" << endl;
    386                 exit( EXIT_FAILURE );
    387         } // if
    388         if ( cpp_out == nullptr ) {
    389                 cerr << "Usage: " << argv[0] << " missing output file" << endl;
    390                 exit( EXIT_FAILURE );
    391         } // if
    392 
    393         // Create a temporary file, if needed, to store output of the cfa-cpp preprocessor. Cannot be created in forked
    394         // process because variables tmpname and tmpfilefd are cloned.
    395 
    396         string cfa_cpp_out;
    397 
    398         if ( ! CFA_flag ) {                                                                     // run compiler ?
    399                 if ( save_temps ) {
    400                         cfa_cpp_out = cpp_in;
    401                         size_t dot = cfa_cpp_out.find_last_of( "." );
    402                         if ( dot == string::npos ) {
    403                                 cerr << "CC1 Translator error: stage 2, bad file name " << endl;
    404                                 exit( EXIT_FAILURE );
    405                         } // if
    406 
    407                         cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + ".ifa";
    408                         if ( creat( cfa_cpp_out.c_str(), 0666 ) == -1 ) {
    409                                 perror( "CC1 Translator error: stage 2, creat" );
    410                                 exit( EXIT_FAILURE );
    411                         } // if
    412                 } else {
    413                         tmpfilefd = mkstemps( tmpname, 2 );
    414                         if ( tmpfilefd == -1 ) {
    415                                 perror( "CC1 Translator error: stage 2, mkstemp" );
    416                                 exit( EXIT_FAILURE );
    417                         } // if
    418                         cfa_cpp_out = tmpname;
    419                 } // if
    420                 #ifdef __DEBUG_H__
    421                 cerr << "cfa_cpp_out: " << cfa_cpp_out << endl;
    422                 #endif // __DEBUG_H__
    423         } // if
    424 
    425         // If -CFA flag specified, run the cfa-cpp preprocessor on the temporary file, and output is written to standard
    426         // output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
    427 
    428         if ( fork() == 0 ) {                                                            // child runs CFA
    429                 cargs[0] = ( *new string( installlibdir + "cfa-cpp" ) ).c_str();
    430 
    431                 cargs[ncargs++] = cpp_in;
    432 
    433                 if ( CFA_flag ) {                                                               // run cfa-cpp ?
    434                         if ( o_file.size() != 0 ) {                                     // location for output
    435                                 cargs[ncargs++] = ( *new string( o_file.c_str() ) ).c_str();
    436                         } // if
    437                 } else {
    438                         cargs[ncargs++] = cfa_cpp_out.c_str();
    439                 } // if
    440                 cargs[ncargs] = nullptr;                                                        // terminate argument list
    441 
    442                 #ifdef __DEBUG_H__
    443                 for ( int i = 0; cargs[i] != nullptr; i += 1 ) {
    444                         cerr << cargs[i] << " ";
    445                 } // for
    446                 cerr << endl;
    447                 #endif // __DEBUG_H__
    448 
    449                 execvp( cargs[0], (char * const *)cargs );              // should not return
    450                 perror( "CC1 Translator error: stage 2, execvp" );
    451                 exit( EXIT_FAILURE );
    452         } // if
    453 
    454         wait( &code );                                                                          // wait for child to finish
    455 
    456         if ( WIFSIGNALED(code) ) {                                                      // child failed ?
    457                 rmtmpfile();                                                                    // remove tmpname
    458                 cerr << "CC1 Translator error: stage 2, child failed " << WTERMSIG(code) << endl;
    459                 exit( EXIT_FAILURE );
    460         } // if
    461 
    462         if ( CFA_flag ) {                                                                       // no tmpfile created
    463                 exit( WEXITSTATUS( code ) );                                    // stop regardless of success or failure
    464         } // if
    465 
    466         #ifdef __DEBUG_H__
    467         cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
    468         #endif // __DEBUG_H__
    469 
    470         if ( WEXITSTATUS(code) ) {                                                      // child error ?
    471                 rmtmpfile();                                                                    // remove tmpname
    472                 exit( WEXITSTATUS( code ) );                                    // do not continue
    473         } // if
    474 
    475456        #ifdef __DEBUG_H__
    476457        cerr << "args:";
     
    478459                cerr << " " << args[i];
    479460        } // for
    480         cerr << " " << cpp_in << endl;
    481         #endif // __DEBUG_H__
    482 
    483         if ( fork() == 0 ) {                                                            // child runs CFA
    484                 args[0] = compiler_path.c_str();
    485                 args[nargs++] = "-S";                                                   // only compile and put assembler output in specified file
    486                 if ( save_temps ) {                                                             // make gcc accept .ifa suffix
    487                         args[nargs++] = "-x";
    488                         args[nargs++] = "cpp-output";
    489                 } // if
    490                 args[nargs++] = cfa_cpp_out.c_str();
    491                 args[nargs] = nullptr;                                                  // terminate argument list
    492 
    493                 #ifdef __DEBUG_H__
    494                 cerr << "stage2 nargs: " << nargs << endl;
    495                 for ( int i = 0; args[i] != nullptr; i += 1 ) {
    496                         cerr << args[i] << " ";
    497                 } // for
    498                 cerr << endl;
    499                 #endif // __DEBUG_H__
    500 
    501                 execvp( args[0], (char * const *)args );                // should not return
    502                 perror( "CC1 Translator error: stage 2, execvp" );
    503                 exit( EXIT_FAILURE );                                                   // tell gcc not to go any further
    504         } // if
    505 
    506         wait( &code );                                                                          // wait for child to finish
    507 
    508         if ( WIFSIGNALED(code) ) {                                                      // child failed ?
    509                 rmtmpfile();                                                                    // remove tmpname
    510                 cerr << "CC1 Translator error: stage 2, child failed " << WTERMSIG(code) << endl;
    511                 exit( EXIT_FAILURE );
    512         } // if
    513 
    514         #ifdef __DEBUG_H__
    515         cerr << "return code from gcc cc1:" << WEXITSTATUS(code) << endl;
    516         #endif // __DEBUG_H__
    517 
    518         rmtmpfile();                                                                            // remove tmpname
    519         exit( WEXITSTATUS( code ) );                                            // stop regardless of success or failure
     461        cerr << endl;
     462        if ( cpp_in != NULL ) cerr << " " << cpp_in;
     463        #endif // __DEBUG_H__
     464
     465        args[0] = compiler_name.c_str();
     466        args[nargs] = "-S";                                                                     // only compile and put assembler output in specified file
     467        nargs += 1;
     468        args[nargs] = cpp_in;
     469        nargs += 1;
     470        args[nargs] = NULL;                                                                     // terminate argument list
     471
     472        #ifdef __DEBUG_H__
     473        cerr << "stage2 nargs: " << nargs << endl;
     474        for ( int i = 0; args[i] != NULL; i += 1 ) {
     475                cerr << args[i] << " ";
     476        } // for
     477        cerr << endl;
     478        #endif // __DEBUG_H__
     479
     480        execvp( args[0], (char * const *)args );                        // should not return
     481        perror( "CFA Translator error: cpp level, execvp" );
     482        exit( EXIT_FAILURE );                                                           // tell gcc not to go any further
    520483} // Stage2
    521484
    522485
    523 // This program is called twice because of the -no-integrated-cpp. The calls are differentiated by the first
    524 // command-line argument. The first call replaces the traditional cpp pass to preprocess the C program. The second call
    525 // is to the compiler, which is broken into two steps: preprocess again with cfa-cpp and then call gcc to compile the
    526 // doubly preprocessed program.
    527 
    528486int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    529487        #ifdef __DEBUG_H__
    530         for ( int i = 0; env[i] != nullptr; i += 1 ) {
     488        for ( int i = 0; env[i] != NULL; i += 1 ) {
    531489                cerr << env[i] << endl;
    532490        } // for
    533491        #endif // __DEBUG_H__
    534492
    535         signal( SIGINT,  sigTermHandler );
    536         signal( SIGTERM, sigTermHandler );
    537 
    538         string arg( argv[1] );
     493        string arg = argv[1];
    539494
    540495        // Currently, stage 1 starts with flag -E and stage 2 with flag -fpreprocessed.
  • driver/cfa.cc

    r330d933 rf9bf142  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 23 16:27:07 2019
    13 // Update Count     : 411
     12// Last Modified On : Sun Feb 10 08:28:09 2019
     13// Update Count     : 281
    1414//
    1515
     
    2020#include <string>                                                                               // STL version
    2121#include <string.h>                                                                             // strcmp
    22 #include <algorithm>                                                                    // find
    2322
    2423#include <sys/types.h>
     
    3332using std::to_string;
    3433
     34
    3535//#define __DEBUG_H__
    3636
    3737
    38 void Putenv( char * argv[], string arg ) {
    39         static int flags = 0;                                                           // environment variables must have unique names
    40 
    41         if ( putenv( (char *)( *new string( string( "__CFA_FLAG" + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
    42                 cerr << argv[0] << " error, cannot set environment variable." << endl;
    43                 exit( EXIT_FAILURE );
    44         } // if
    45 } // Putenv
    46 
    47 
    48 bool prefix( const string & arg, const string & pre ) { // check if string has prefix
     38bool prefix( string arg, string pre ) {
    4939        return arg.substr( 0, pre.size() ) == pre;
    5040} // prefix
    5141
    52 bool suffix( const string & arg ) {                                             // check if string has suffix
    53         enum { NumSuffixes = 3 };
    54         static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
    55 
     42enum { NumSuffixes = 2 };
     43const string suffixes[NumSuffixes] = { "cfa", "hfa", };
     44
     45bool suffix( string arg, const char * args[], int & nargs ) {
     46        //std::cerr << arg << std::endl;
    5647        size_t dot = arg.find_last_of( "." );
     48        //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
    5749        if ( dot == string::npos ) return false;
    58         const string * end = suffixes + NumSuffixes;
    59         return std::find( suffixes, end, arg.substr( dot + 1 ) ) != end;
     50        string sx = arg.substr( dot + 1 );
     51        for ( int i = 0; i < NumSuffixes; i += 1 ) {
     52                if ( sx == suffixes[i] ) {
     53                        args[nargs] = "-x";
     54                        nargs += 1;
     55                        args[nargs] = "c";
     56                        nargs += 1;
     57                        return true;
     58                } // if
     59        } // for
     60        return false;
    6061} // suffix
    6162
    6263
    63 static inline bool dirExists( const string & path ) {   // check if directory exists
     64void shuffle( const char *args[], int S, int E, int N ) {
     65        // S & E index 1 passed the end so adjust with -1
     66        #ifdef __DEBUG_H__
     67        cerr << "shuffle:" << S << " " << E << " " << N << endl;
     68        #endif // __DEBUG_H__
     69        for ( int j = E-1 + N; j > S-1 + N; j -=1 ) {
     70                #ifdef __DEBUG_H__
     71                cerr << "\t" << j << " " << j-N << endl;
     72                #endif // __DEBUG_H__
     73                args[j] = args[j-N];
     74        } // for
     75} // shuffle
     76
     77static inline bool dirExists(const string & path) {
    6478    struct stat info;
    65     if ( stat( path.c_str(), &info ) != 0 ) return false;
    66     if ( info.st_mode & S_IFDIR ) return true;
    67         return false;
    68 } // dirExists
    69 
    70 
    71 #define xstr(s) str(s)
     79    if(stat( path.c_str(), &info ) != 0)
     80        return false;
     81    else if(info.st_mode & S_IFDIR)
     82        return true;
     83    else
     84        return false;
     85} //dirExists
     86
     87
    7288#define str(s) #s
    7389
    74 int main( int argc, char * argv[] ) {
     90int main( int argc, char *argv[] ) {
    7591        string Version( CFA_VERSION_LONG );                                     // current version number from CONFIG
    76         string Major( xstr( CFA_VERSION_MAJOR ) ), Minor( xstr( CFA_VERSION_MINOR ) ), Patch( xstr( CFA_VERSION_PATCH ) );
     92        string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
    7793
    7894        string installincdir( CFA_INCDIR );                                     // fixed location of include files
     
    88104        string compiler_name;                                                           // name of C compiler
    89105
    90         bool x_flag = false;                                                            // -x flag
    91         bool nonoptarg = false;                                                         // no non-option arguments specified, i.e., no file names
    92         bool link = true;                                                                       // link stage occurring
     106        bool nonoptarg = false;                                                         // indicates non-option argument specified
     107        bool link = true;                                                                       // linking as well as compiling
    93108        bool verbose = false;                                                           // -v flag
    94         bool quiet = false;                                                                     // -quiet flag
    95         bool debug = true;                                                                      // -debug flag
    96         bool nolib = false;                                                                     // -nolib flag
    97         bool help = false;                                                                      // -help flag
     109        bool quiet = false;                                                             // -quiet flag
     110        bool debug = true;                                                              // -debug flag
     111        bool nolib = false;                                                             // -nolib flag
     112        bool help = false;                                                              // -help flag
    98113        bool CFA_flag = false;                                                          // -CFA flag
    99114        bool cpp_flag = false;                                                          // -E or -M flag, preprocessor only
     
    101116        bool noincstd_flag = false;                                                     // -no-include-stdhdr= flag
    102117        bool debugging __attribute(( unused )) = false;         // -g flag
    103         bool m32 = false;                                                                       // -m32 flag
    104         bool m64 = false;                                                                       // -m64 flag
    105         bool intree = false;                                                            // build in tree
    106         int o_file = 0;                                                                         // -o filename position
     118        bool m32 = false;                                    // -m32 flag
     119        bool m64 = false;                                    // -m64 flag
     120        bool intree = false;
    107121
    108122        const char *args[argc + 100];                                           // cfa command line values, plus some space for additional flags
     
    128142
    129143                        if ( arg == "-Xlinker" || arg == "-o" ) {
    130                                 args[nargs++] = argv[i];                                // pass argument along
     144                                args[nargs] = argv[i];                                  // pass the argument along
     145                                nargs += 1;
    131146                                i += 1;
    132147                                if ( i == argc ) continue;                              // next argument available ?
    133                                 args[nargs++] = argv[i];                                // pass argument along
    134                                 if ( arg == "-o" ) o_file = i;                  // remember file
     148                                args[nargs] = argv[i];                                  // pass the argument along
     149                                nargs += 1;
    135150                        } else if ( arg == "-XCFA" ) {                          // CFA pass through
    136151                                i += 1;
    137                                 Putenv( argv, argv[i] );
     152                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + argv[i] ) ).c_str();
     153                                nargs += 1;
    138154
    139155                                // CFA specific arguments
     
    142158                                CFA_flag = true;                                                // strip the -CFA flag
    143159                                link = false;
    144                                 args[nargs++] = "-fsyntax-only";                // stop after stage 2
     160                                args[nargs] = "-E";                                             // replace the argument with -E
     161                                nargs += 1;
    145162                        } else if ( arg == "-debug" ) {
    146163                                debug = true;                                                   // strip the debug flag
    147164                        } else if ( arg == "-nodebug" ) {
    148                                 debug = false;                                                  // strip the nodebug flag
     165                                debug = false;                                                  // strip the debug flag
    149166                        } else if ( arg == "-nolib" ) {
    150167                                nolib = true;                                                   // strip the nodebug flag
     
    166183                                if ( i == argc ) continue;                              // next argument available ?
    167184                                compiler_path = argv[i];
    168                                 Putenv( argv, arg + "=" + argv[i] );
     185                                if ( putenv( (char *)( *new string( string( "__CFA_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) {
     186                                        cerr << argv[0] << " error, cannot set environment variable." << endl;
     187                                        exit( EXIT_FAILURE );
     188                                } // if
    169189
    170190                                // C specific arguments
     
    172192                        } else if ( arg == "-v" ) {
    173193                                verbose = true;                                                 // verbosity required
    174                                 args[nargs++] = argv[i];                                // pass argument along
     194                                args[nargs] = argv[i];                                  // pass the argument along
     195                                nargs += 1;
    175196                        } else if ( arg == "-g" ) {
    176197                                debugging = true;                                               // symbolic debugging required
    177                                 args[nargs++] = argv[i];                                // pass argument along
    178                         } else if ( arg == "-save-temps" ) {
    179                                 args[nargs++] = argv[i];                                // pass argument along
    180                                 Putenv( argv, arg );                                    // save cfa-cpp output
    181                         } else if ( prefix( arg, "-x" ) ) {                     // file suffix ?
    182                                 string lang;
    183                                 args[nargs++] = argv[i];                                // pass argument along
     198                                args[nargs] = argv[i];                                  // pass the argument along
     199                                nargs += 1;
     200                        } else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
     201                                std_flag = true;                                                // -std=XX provided
     202                                args[nargs] = argv[i];                                  // pass the argument along
     203                                nargs += 1;
     204                        } else if ( arg == "-w" ) {
     205                                args[nargs] = argv[i];                                  // pass the argument along
     206                                nargs += 1;
     207                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     208                                nargs += 1;
     209                        } else if ( prefix( arg, "-W" ) ) {                     // check before next tests
     210                                if ( arg == "-Werror" || arg == "-Wall" ) {
     211                                        args[nargs] = argv[i];                          // pass the argument along
     212                                        nargs += 1;
     213                                        args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     214                                        nargs += 1;
     215                                } else {
     216                                        unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
     217                                        args[nargs] = argv[i];                          // conditionally pass the argument along
     218                                        const char * warning = argv[i] + adv;     // extract warning
     219                                        if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
     220                                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
     221                                        } // if
     222                                        nargs += 1;
     223                                } // if
     224                        } else if ( prefix( arg, "-B" ) ) {
     225                                Bprefix = arg.substr(2);                                // strip the -B flag
     226                                args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
     227                                nargs += 1;
     228                        } else if ( prefix( arg, "-b" ) ) {
    184229                                if ( arg.length() == 2 ) {                              // separate argument ?
    185230                                        i += 1;
    186231                                        if ( i == argc ) continue;                      // next argument available ?
    187                                         lang = argv[i];
    188                                         args[nargs++] = argv[i];                        // pass argument along
    189                                 } else {
    190                                         lang = arg.substr( 2 );
    191                                 } // if
    192                                 x_flag = lang != "none";
    193                         } else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
    194                                 std_flag = true;                                                // -std=XX provided
    195                                 args[nargs++] = argv[i];                                // pass argument along
    196                         } else if ( arg == "-w" ) {
    197                                 args[nargs++] = argv[i];                                // pass argument along
    198                                 Putenv( argv, arg );
    199                         } else if ( prefix( arg, "-W" ) ) {                     // check before next tests
    200                                 if ( arg == "-Werror" || arg == "-Wall" ) {
    201                                         args[nargs++] = argv[i];                        // pass argument along
    202                                         Putenv( argv, argv[i] );
    203                                 } else {
    204                                         unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
    205                                         args[nargs] = argv[i];                          // conditionally pass argument along
    206                                         const char * warning = argv[i] + adv; // extract warning
    207                                         if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
    208                                                 Putenv( argv, arg );
    209                                         } // if
    210                                         nargs += 1;
    211                                 } // if
    212                         } else if ( prefix( arg, "-B" ) ) {
    213                                 Bprefix = arg.substr(2);                                // strip the -B flag
    214                                 args[nargs++] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
     232                                        arg += argv[i];                                         // concatenate argument
     233                                } // if
     234                                // later versions of gcc require the -b option to appear at the start of the command line
     235                                shuffle( args, sargs, nargs, 1 );               // make room at front of argument list
     236                                args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
     237                                if ( putenv( (char *)( *new string( string( "__GCC_MACHINE__=" ) + arg ) ).c_str() ) != 0 ) {
     238                                        cerr << argv[0] << " error, cannot set environment variable." << endl;
     239                                        exit( EXIT_FAILURE );
     240                                } // if
     241                                sargs += 1;
     242                                nargs += 1;
     243                        } else if ( prefix( arg, "-V" ) ) {
     244                                if ( arg.length() == 2 ) {                              // separate argument ?
     245                                        i += 1;
     246                                        if ( i == argc ) continue;                      // next argument available ?
     247                                        arg += argv[i];                                         // concatenate argument
     248                                } // if
     249                                // later versions of gcc require the -V option to appear at the start of the command line
     250                                shuffle( args, sargs, nargs, 1 );               // make room at front of argument list
     251                                args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
     252                                if ( putenv( (char *)( *new string( string( "__GCC_VERSION__=" ) + arg ) ).c_str() ) != 0 ) {
     253                                        cerr << argv[0] << " error, cannot set environment variable." << endl;
     254                                        exit( EXIT_FAILURE );
     255                                } // if
     256                                sargs += 1;
     257                                nargs += 1;
    215258                        } else if ( arg == "-c" || arg == "-S" || arg == "-E" || arg == "-M" || arg == "-MM" ) {
    216                                 args[nargs++] = argv[i];                                // pass argument along
     259                                args[nargs] = argv[i];                                  // pass the argument along
     260                                nargs += 1;
    217261                                if ( arg == "-E" || arg == "-M" || arg == "-MM" ) {
    218262                                        cpp_flag = true;                                        // cpp only
     
    221265                        } else if ( arg[1] == 'l' ) {
    222266                                // if the user specifies a library, load it after user code
    223                                 libs[nlibs++] = argv[i];
     267                                libs[nlibs] = argv[i];
     268                                nlibs += 1;
    224269                        } else if ( arg == "-m32" ) {
    225270                                m32 = true;
    226271                                m64 = false;
    227                                 args[nargs++] = argv[i];
     272                                args[nargs] = argv[i];
     273                                nargs += 1;
    228274                        } else if ( arg == "-m64" ) {
    229275                                m64 = true;
    230276                                m32 = false;
    231                                 args[nargs++] = argv[i];
     277                                args[nargs] = argv[i];
     278                                nargs += 1;
    232279                        } else {
    233280                                // concatenate any other arguments
    234                                 args[nargs++] = argv[i];
     281                                args[nargs] = argv[i];
     282                                nargs += 1;
    235283                        } // if
    236284                } else {
    237                         bool cfa = suffix( arg );                                       // check suffix
    238                         if ( ! x_flag && cfa ) {                                        // no explicit suffix and cfa suffix ?
    239                                 args[nargs++] = "-x";
    240                                 args[nargs++] = "c";
    241                         } // if
    242                         args[nargs++] = argv[i];                                        // concatenate files
    243                         if ( ! x_flag && cfa ) {                                        // no explicit suffix and cfa suffix ?
    244                                 args[nargs++] = "-x";
    245                                 args[nargs++] = "none";
     285                        bool cfa = suffix( arg, args, nargs );          // check suffix
     286                        args[nargs] = argv[i];                                          // concatenate file
     287                        nargs += 1;
     288                        if ( cfa ) {
     289                                args[nargs] = "-x";
     290                                nargs += 1;
     291                                args[nargs] = "none";
     292                                nargs += 1;
    246293                        } // if
    247294                        nonoptarg = true;
     
    249296        } // for
    250297
     298    args[nargs] = "-x";                                                                 // turn off language
     299    nargs += 1;
     300    args[nargs] = "none";
     301    nargs += 1;
     302
    251303        #ifdef __x86_64__
    252         args[nargs++] = "-mcx16";                                                       // allow double-wide CAA
     304        args[nargs] = "-mcx16";                                                         // allow double-wide CAA
     305        nargs += 1;
    253306        #endif // __x86_64__
    254307
     
    261314        #endif // __DEBUG_H__
    262315
    263         // -E flag stops at cc1 stage 1, so cfa-cpp in cc1 stage 2 is never executed.
    264316        if ( cpp_flag && CFA_flag ) {
    265317                cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl;
     
    268320
    269321        // add the CFA include-library paths, which allow direct access to header files without directory qualification
    270         if ( ! intree ) {
    271                 args[nargs++] = "-I" CFA_INCDIR;
     322        if( !intree ) {
     323                args[nargs] = "-I" CFA_INCDIR;
     324                nargs += 1;
    272325                if ( ! noincstd_flag ) {                                                // do not use during build
    273                         args[nargs++] = "-I" CFA_INCDIR "stdhdr";
     326                        args[nargs] = "-I" CFA_INCDIR "stdhdr";
     327                        nargs += 1;
    274328                } // if
    275                 args[nargs++] = "-I" CFA_INCDIR "concurrency";
    276                 args[nargs++] = "-I" CFA_INCDIR "containers";
     329                args[nargs] = "-I" CFA_INCDIR "concurrency";
     330                nargs += 1;
     331                args[nargs] = "-I" CFA_INCDIR "containers";
     332                nargs += 1;
    277333        } else {
    278                 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src";
     334                args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
     335                nargs += 1;
    279336                if ( ! noincstd_flag ) {                                                // do not use during build
    280                         args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
     337                        args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
     338                        nargs += 1;
    281339                } // if
    282                 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
    283                 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
    284         } // if
     340                args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
     341                nargs += 1;
     342                args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
     343                nargs += 1;
     344        }
    285345
    286346        // add stdbool to get defines for bool/true/false
    287         args[nargs++] = "-imacros";
    288         args[nargs++] = "stdbool.h";
     347        args[nargs] = "-imacros";
     348        nargs += 1;
     349        args[nargs] = "stdbool.h";
     350        nargs += 1;
    289351
    290352        string libbase;
    291         if ( ! intree ) {
     353        if( !intree ) {
    292354                libbase = CFA_LIBDIR;
    293355        } else {
    294356                libbase = TOP_BUILDDIR "libcfa/";
    295                 Putenv( argv, "-t" );
    296         } // if
    297 
    298         string arch( m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU) );
     357                args[nargs] = "-D__CFA_FLAG__=-t";
     358                nargs += 1;
     359        }
     360
     361        string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
    299362        if ( ! m32 && ! m64 ) {
    300363                if ( arch == "x86" ) {
    301                         args[nargs++] = "-m32";
     364                        args[nargs] = "-m32";
     365                        nargs += 1;
    302366                } else if ( arch == "x64" ) {
    303                         args[nargs++] = "-m64";
     367                        args[nargs] = "-m64";
     368                        nargs += 1;
    304369                }  // if
    305370        } // if
    306 
    307         string libdir( libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug")) );
     371        const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
     372        string libdir = libbase + arch + "-" + config;
     373
     374        if ( ! nolib && ! dirExists( libdir ) ) {
     375                cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
     376                cerr << "Was looking for " << libdir << endl;
     377                libdir = libbase + arch + "-" + "nolib";
     378        } // if
     379
    308380        if ( ! dirExists( libdir ) ) {
    309                 cerr << argv[0] << " internal error, cannot find prelude directory " << libdir << endl;
     381                cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
     382                cerr << "Was looking for " << libdir << endl;
    310383                exit( EXIT_FAILURE );
    311384        } // if
    312385
     386        args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
     387        nargs += 1;
     388
    313389        for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
    314                 args[nargs++] = libs[i];
     390                args[nargs] = libs[i];
     391                nargs += 1;
    315392        } // for
    316393
    317394        if ( link ) {
    318                 args[nargs++] = "-Xlinker";
    319                 args[nargs++] = "--undefined=__cfaabi_dbg_bits_write";
    320                 args[nargs++] = "-Xlinker";
    321                 args[nargs++] = "--undefined=__cfaabi_interpose_startup";
    322                 args[nargs++] = "-Xlinker";
    323                 args[nargs++] = "--undefined=__cfaabi_appready_startup";
     395                args[nargs] = "-Xlinker";
     396                nargs += 1;
     397                args[nargs] = "--undefined=__cfaabi_dbg_bits_write";
     398                nargs += 1;
     399                args[nargs] = "-Xlinker";
     400                nargs += 1;
     401                args[nargs] = "--undefined=__cfaabi_interpose_startup";
     402                nargs += 1;
     403                args[nargs] = "-Xlinker";
     404                nargs += 1;
     405                args[nargs] = "--undefined=__cfaabi_appready_startup";
     406                nargs += 1;
    324407
    325408                // include the cfa library in case it's needed
    326                 args[nargs++] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
    327                 args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
    328                 args[nargs++] = "-Wl,--push-state,--as-needed";
    329                 args[nargs++] = "-lcfathread";
    330                 args[nargs++] = "-Wl,--pop-state";
    331                 args[nargs++] = "-lcfa";
    332                 args[nargs++] = "-lpthread";
    333                 args[nargs++] = "-ldl";
    334                 args[nargs++] = "-lrt";
    335                 args[nargs++] = "-lm";
    336         } // if
    337 
    338         args[nargs++] = "-fexceptions";                                         // add exception flags (unconditionally)
    339 
    340         // add flags based on the type of compile
    341 
    342         args[nargs++] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
    343         args[nargs++] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
    344         args[nargs++] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
    345         args[nargs++] = "-D__CFA__";
    346         args[nargs++] = "-D__CFORALL__";
    347         args[nargs++] = "-D__cforall";
     409                args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
     410                nargs += 1;
     411                args[nargs] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
     412                nargs += 1;
     413                args[nargs] = "-Wl,--push-state,--as-needed";
     414                nargs += 1;
     415                args[nargs] = "-lcfathread";
     416                nargs += 1;
     417                args[nargs] = "-Wl,--pop-state";
     418                nargs += 1;
     419                args[nargs] = "-lcfa";
     420                nargs += 1;
     421                args[nargs] = "-lpthread";
     422                nargs += 1;
     423                args[nargs] = "-ldl";
     424                nargs += 1;
     425                args[nargs] = "-lrt";
     426                nargs += 1;
     427                args[nargs] = "-lm";
     428                nargs += 1;
     429        } // if
     430
     431        // Add exception flags (unconditionally)
     432        args[nargs] = "-fexceptions";
     433        nargs += 1;
     434
     435        // add the correct set of flags based on the type of compile this is
     436
     437        args[nargs] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
     438        nargs += 1;
     439        args[nargs] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
     440        nargs += 1;
     441        args[nargs] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
     442        nargs += 1;
     443        args[nargs] = "-D__CFA__";
     444        nargs += 1;
     445        args[nargs] = "-D__CFORALL__";
     446        nargs += 1;
     447        args[nargs] = "-D__cforall";
     448        nargs += 1;
    348449
    349450        if ( cpp_flag ) {
    350                 args[nargs++] = "-D__CPP__";
    351         } // if
    352 
     451                args[nargs] = "-D__CPP__";
     452                nargs += 1;
     453        } // if
     454
     455        shuffle( args, sargs, nargs, 1 );                                       // make room at front of argument list
     456        nargs += 1;
    353457        if ( CFA_flag ) {
    354                 Putenv( argv, "-N" );
    355                 Putenv( argv, "-CFA" );
    356                 // -CFA implies cc1 stage 2, but gcc does not pass the -o file to this stage because it believe the file is for
    357                 // the linker. Hence, the -o file is explicit passed to cc1 stage 2 and used as cfa-cpp's output file.
    358                 if ( o_file ) Putenv( argv, string( "-o=" ) + argv[o_file] );
     458                args[sargs] = "-D__CFA_FLAG__=-N";
     459                args[nargs] = "-D__CFA_PREPROCESS_";
     460                nargs += 1;
    359461        } else {
    360                 Putenv( argv, "-L" );
    361         } // if
    362 
    363         Putenv( argv, "--prelude-dir=" + libdir + (intree ? "/prelude" : "") );
     462                args[sargs] = "-D__CFA_FLAG__=-L";
     463        } // if
     464        sargs += 1;
    364465
    365466        if ( debug ) {
    366467                heading += " (debug)";
    367                 args[nargs++] = "-D__CFA_DEBUG__";
     468                args[nargs] = "-D__CFA_DEBUG__";
     469                nargs += 1;
    368470        } else {
    369471                heading += " (no debug)";
     
    373475                Bprefix = ! intree ? installlibdir : srcdriverdir;
    374476                if ( Bprefix[Bprefix.length() - 1] != '/' ) Bprefix += '/';
    375                 args[nargs++] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
    376         } // if
    377 
    378         args[nargs++] = "-Xlinker";                                                     // used by backtrace
    379         args[nargs++] = "-export-dynamic";
     477                args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
     478                nargs += 1;
     479        } // if
     480
     481        args[nargs] = "-Xlinker";                                                       // used by backtrace
     482        nargs += 1;
     483        args[nargs] = "-export-dynamic";
     484        nargs += 1;
    380485
    381486        // execute the compilation command
     
    391496
    392497        if ( prefix( compiler_name, "gcc" ) ) {                         // allow suffix on gcc name
    393                 args[nargs++] = "-no-integrated-cpp";
    394                 args[nargs++] = "-Wno-deprecated";
    395                 #ifdef HAVE_CAST_FUNCTION_TYPE
    396                 args[nargs++] = "-Wno-cast-function-type";
    397                 #endif // HAVE_CAST_FUNCTION_TYPE
     498                args[nargs] = "-no-integrated-cpp";
     499                nargs += 1;
     500                args[nargs] = "-Wno-deprecated";
     501                nargs += 1;
     502#ifdef HAVE_CAST_FUNCTION_TYPE
     503                args[nargs] = "-Wno-cast-function-type";
     504                nargs += 1;
     505#endif // HAVE_CAST_FUNCTION_TYPE
    398506                if ( ! std_flag ) {                                                             // default c11, if none specified
    399                         args[nargs++] = "-std=gnu11";
     507                        args[nargs] = "-std=gnu11";
     508                        nargs += 1;
    400509                } // if
    401                 args[nargs++] = "-fgnu89-inline";
    402                 args[nargs++] = "-D__int8_t_defined";                   // prevent gcc type-size attributes
    403                 args[nargs++] = ( *new string( string("-B") + Bprefix ) ).c_str();
     510                args[nargs] = "-fgnu89-inline";
     511                nargs += 1;
     512                args[nargs] = "-D__int8_t_defined";                             // prevent gcc type-size attributes
     513                nargs += 1;
     514                args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
     515                nargs += 1;
    404516        } else {
    405517                cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl;
     
    407519        } // if
    408520
    409         args[nargs] = nullptr;                                                          // terminate
     521        args[nargs] = NULL;                                                                     // terminate with NULL
    410522
    411523        #ifdef __DEBUG_H__
    412524        cerr << "nargs: " << nargs << endl;
    413525        cerr << "args:" << endl;
    414         for ( int i = 0; args[i] != nullptr; i += 1 ) {
     526        for ( int i = 0; args[i] != NULL; i += 1 ) {
    415527                cerr << " \"" << args[i] << "\"" << endl;
    416528        } // for
     
    434546                if ( argc == 2 ) exit( EXIT_SUCCESS );                  // if only the -v flag is specified, do not invoke gcc
    435547
    436                 for ( int i = 0; args[i] != nullptr; i += 1 ) {
     548                for ( int i = 0; args[i] != NULL; i += 1 ) {
    437549                        cerr << args[i] << " ";
    438550                } // for
     
    448560
    449561        execvp( args[0], (char *const *)args );                         // should not return
    450         perror( "CFA Translator error: execvp" );
     562        perror( "CFA Translator error: cfa level, execvp" );
    451563        exit( EXIT_FAILURE );
    452564} // main
  • libcfa/src/Makefile.am

    r330d933 rf9bf142  
    2626VPATH += :../prelude
    2727
    28 gdbwaittarget=""
    29 
    3028# AM_CFLAGS for all cfa source
    3129# AM_CFAFLAGS for only cfa source
    3230# use -no-include-stdhdr to prevent rebuild cycles
    3331# The built sources must not depend on the installed headers
    34 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb)  @CONFIG_CFAFLAGS@
     32AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    3533AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3634AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
  • libcfa/src/Makefile.in

    r330d933 rf9bf142  
    435435am__v_UPP_1 =
    436436lib_LTLIBRARIES = libcfa.la libcfathread.la
    437 gdbwaittarget = ""
    438437
    439438# AM_CFLAGS for all cfa source
     
    441440# use -no-include-stdhdr to prevent rebuild cycles
    442441# The built sources must not depend on the installed headers
    443 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb)  @CONFIG_CFAFLAGS@
     442AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    444443AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    445444AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
  • longrun_tests/Makefile.in

    r330d933 rf9bf142  
    365365CYGPATH_W = @CYGPATH_W@
    366366DEFS = @DEFS@
    367 DEMANGLER = @DEMANGLER@
    368367DEPDIR = @DEPDIR@
    369368DLLTOOL = @DLLTOOL@
     
    391390LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    392391LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    393 LIBDEMANGLE = @LIBDEMANGLE@
    394392LIBOBJS = @LIBOBJS@
    395393LIBS = @LIBS@
  • src/BasicTypes-gen.cc

    r330d933 rf9bf142  
    295295        // cout << code.str();
    296296
    297 
    298         // TEMPORARY DURING CHANGE OVER
    299         #define TypeAST TOP_SRCDIR "src/AST/Type.hpp"
    300         resetInput( file, TypeAST, buffer, code, str );
    301 
    302         if ( (start = str.find( STARTMK )) == string::npos ) Abort( "start", TypeAST );
    303         start += sizeof( STARTMK );                                                     // includes newline
    304         code << str.substr( 0, start );
    305 
    306         code << "\t" << BYMK << endl;
    307         code << "\tenum Kind {" << endl;
    308         for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) {
    309                 code << "\t\t" << graph[r].name << "," << endl;
    310         } // for       
    311         code << "\t\tNUMBER_OF_BASIC_TYPES" << endl;
    312         code << "\t} kind;" << endl;
    313         code << "\t";                                                                           // indentation for end marker
    314 
    315         if ( (start = str.find( ENDMK, start + 1 )) == string::npos ) Abort( "end", TypeAST );
    316         code << str.substr( start );
    317 
    318         output( file, TypeAST, code );
    319         // cout << code.str();
    320 
    321 
     297       
    322298        #define ConversionCost TOP_SRCDIR "src/ResolvExpr/ConversionCost.cc"
    323299        resetInput( file, ConversionCost, buffer, code, str );
     
    334310                        code << right << setw(30) << graph[c].type << left;
    335311                } else if ( graph[c].rank != graph[c + 2].rank ) {
    336                         code << string( 10, ' ' ) << setw(25) << graph[c].type << graph[c + 1].type;
     312                        code << string( 10, ' ' ) << setw(25) << graph[c].type << setw(25) << graph[c + 1].type;
    337313                        c += 1;
    338314                } else {
    339                         code << setw(20) << graph[c].type << setw(20) << graph[c + 1].type << graph[c + 2].type;
     315                        code << setw(20) << graph[c].type << setw(20) << graph[c + 1].type << setw(20) << graph[c + 2].type;
    340316                        c += 2;
    341317                } // if
     
    352328        code << "\t" << BYMK << endl;
    353329        code << "\tstatic const int costMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node" << endl
    354                  << "\t\t/*           ";
     330                 << "\t\t/*         ";
    355331        for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles
    356332                code << setw(5) << graph[r].abbrev;
     
    358334        code << " */" << endl;
    359335        for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // costs
    360                 code << "\t\t/* " << setw(6) << graph[r].abbrev << " */ {";
     336                code << "\t\t/*" << setw(6) << graph[r].abbrev << "*/ {";
    361337                for ( int c = 0; c < NUMBER_OF_BASIC_TYPES; c += 1 ) {
    362338                        code << setw(4) << costMatrix[r][c] << ",";
     
    377353        code << "\t" << BYMK << endl;
    378354        code << "\tstatic const int signMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion" << endl
    379                  << "\t\t/*           ";
     355                 << "\t\t/*         ";
    380356        for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles
    381357                code << setw(5) << graph[r].abbrev;
     
    383359        code << " */" << endl;
    384360        for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // costs
    385                 code << "\t\t/* " << setw(6) << graph[r].abbrev << " */ {";
     361                code << "\t\t/*" << setw(6) << graph[r].abbrev << "*/ {";
    386362                for ( int c = 0; c < NUMBER_OF_BASIC_TYPES; c += 1 ) {
    387363                        code << setw(4) << signMatrix[r][c] << ",";
     
    419395        code << "*/" << endl;
    420396        for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // costs
    421                 code << "\t\t\t\t  {\n\t\t/* " << setw(6) << graph[r].abbrev << " */";
     397                code << "\t\t\t\t  {\n\t\t/*" << setw(6) << graph[r].abbrev << "*/";
    422398                for ( int c = 0; c < NUMBER_OF_BASIC_TYPES; c += 1 ) {
    423399                        string s = string{"BT "} + graph[commonTypeMatrix[r][c]].name;
  • src/GenPoly/Box.cc

    r330d933 rf9bf142  
    725725                        if ( ! needsBoxing( param, arg->result, exprTyVars, env ) ) return;
    726726
    727                         if ( arg->get_lvalue() ) {
     727                        if ( arg->result->get_lvalue() ) {
    728728                                // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
    729729                                // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
  • src/GenPoly/Lvalue.cc

    r330d933 rf9bf142  
    363363                        int diff = depth1 - depth2;
    364364
    365                         if ( diff > 0 && ! castExpr->arg->get_lvalue() ) {
     365                        if ( diff > 0 && ! srcType->get_lvalue() ) {
    366366                                // rvalue to reference conversion -- introduce temporary
    367367                                // know that reference depth of cast argument is 0, need to introduce n temporaries for reference depth of n, e.g.
     
    407407                                        ret = new AddressExpr( ret );
    408408                                }
    409                                 if ( castExpr->arg->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
     409                                if ( srcType->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
    410410                                        // must keep cast if cast-to type is different from the actual type
    411411                                        castExpr->arg = ret;
  • src/Makefile.am

    r330d933 rf9bf142  
    1111## Created On       : Sun May 31 08:51:46 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Aug  5 12:57:46 2019
    14 ## Update Count     : 98
     13## Last Modified On : Fri Feb 15 09:44:09 2019
     14## Update Count     : 97
    1515###############################################################################
    1616
     
    5555$(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
    5656
    57 $(srcdir)/AST/Type.hpp : BasicTypes-gen.cc
     57$(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
    5858        ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
    5959        @./BasicTypes-gen
     
    6262# put into lib for now
    6363cfa_cpplibdir = $(CFA_LIBDIR)
    64 cfa_cpplib_PROGRAMS = ../driver/cfa-cpp $(DEMANGLER)
    65 EXTRA_PROGRAMS = demangler
     64cfa_cpplib_PROGRAMS = ../driver/cfa-cpp demangler
    6665___driver_cfa_cpp_SOURCES = $(SRC)
    6766___driver_cfa_cpp_LDADD = -ldl $(LIBPROFILER) $(LIBTCMALLOC)
     
    7574demangler_LDADD = libdemangle.a -ldl                    # yywrap
    7675
    77 noinst_LIBRARIES = $(LIBDEMANGLE)
    78 EXTRA_LIBRARIES = libdemangle.a
     76noinst_LIBRARIES = libdemangle.a
    7977libdemangle_a_SOURCES = $(SRCDEMANGLE)
    8078
  • src/Makefile.in

    r330d933 rf9bf142  
    141141build_triplet = @build@
    142142host_triplet = @host@
    143 cfa_cpplib_PROGRAMS = ../driver/cfa-cpp$(EXEEXT) $(DEMANGLER)
    144 EXTRA_PROGRAMS = demangler$(EXEEXT)
     143cfa_cpplib_PROGRAMS = ../driver/cfa-cpp$(EXEEXT) demangler$(EXEEXT)
    145144subdir = src
    146145ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    231230        SynTree/Initializer.$(OBJEXT) \
    232231        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    233         SynTree/DeclReplacer.$(OBJEXT) SynTree/TopLvalue.$(OBJEXT)
     232        SynTree/DeclReplacer.$(OBJEXT)
    234233am__objects_8 = CompilationState.$(OBJEXT) $(am__objects_1) \
    235234        $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \
     
    428427CYGPATH_W = @CYGPATH_W@
    429428DEFS = @DEFS@
    430 DEMANGLER = @DEMANGLER@
    431429DEPDIR = @DEPDIR@
    432430DLLTOOL = @DLLTOOL@
     
    454452LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    455453LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    456 LIBDEMANGLE = @LIBDEMANGLE@
    457454LIBOBJS = @LIBOBJS@
    458455LIBS = @LIBS@
     
    694691      SynTree/TypeSubstitution.cc \
    695692      SynTree/Attribute.cc \
    696       SynTree/DeclReplacer.cc \
    697       SynTree/TopLvalue.cc
     693      SynTree/DeclReplacer.cc
    698694
    699695
     
    707703demangler_SOURCES = SymTab/demangler.cc # test driver for the demangler, also useful as a sanity check that libdemangle.a is complete
    708704demangler_LDADD = libdemangle.a -ldl                    # yywrap
    709 noinst_LIBRARIES = $(LIBDEMANGLE)
    710 EXTRA_LIBRARIES = libdemangle.a
     705noinst_LIBRARIES = libdemangle.a
    711706libdemangle_a_SOURCES = $(SRCDEMANGLE)
    712707all: $(BUILT_SOURCES)
     
    10241019SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    10251020        SynTree/$(DEPDIR)/$(am__dirstamp)
    1026 SynTree/TopLvalue.$(OBJEXT): SynTree/$(am__dirstamp) \
    1027         SynTree/$(DEPDIR)/$(am__dirstamp)
    10281021Tuples/$(am__dirstamp):
    10291022        @$(MKDIR_P) Tuples
     
    13361329@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@
    13371330@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@
    1338 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TopLvalue.Po@am__quote@
    13391331@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@
    13401332@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@
     
    16701662$(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
    16711663
    1672 $(srcdir)/AST/Type.hpp : BasicTypes-gen.cc
     1664$(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
    16731665        ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
    16741666        @./BasicTypes-gen
  • src/Parser/ExpressionNode.cc

    r330d933 rf9bf142  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  4 20:57:55 2019
    13 // Update Count     : 978
     12// Last Modified On : Sun Mar 10 16:10:32 2019
     13// Update Count     : 976
    1414//
    1515
     
    109109
    110110Expression * build_constantInteger( string & str ) {
    111         static const BasicType::Kind kind[2][6] = {
     111        static const BasicType::Kind kind[2][7] = {
    112112                // short (h) must be before char (hh) because shorter type has the longer suffix
    113113                { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt128, },
  • src/Parser/lex.ll

    r330d933 rf9bf142  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Aug  4 20:53:47 2019
    13  * Update Count     : 719
     12 * Last Modified On : Thu Jul 25 22:08:32 2019
     13 * Update Count     : 716
    1414 */
    1515
     
    273273__inline__              { KEYWORD_RETURN(INLINE); }                             // GCC
    274274int                             { KEYWORD_RETURN(INT); }
    275 int128                  { KEYWORD_RETURN(INT128); }                             // CFA
    276275__int128                { KEYWORD_RETURN(INT128); }                             // GCC
    277 __int128_t              { KEYWORD_RETURN(INT128); }                             // GCC
     276int128                  { KEYWORD_RETURN(INT128); }                             // GCC
    278277__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    279278long                    { KEYWORD_RETURN(LONG); }
     
    314313__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
    315314union                   { KEYWORD_RETURN(UNION); }
    316 __uint128_t             { KEYWORD_RETURN(UINT128); }                    // GCC
    317315unsigned                { KEYWORD_RETURN(UNSIGNED); }
    318316__builtin_va_list { KEYWORD_RETURN(VALIST); }                   // GCC
  • src/Parser/parser.yy

    r330d933 rf9bf142  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  4 21:48:23 2019
    13 // Update Count     : 4364
     12// Last Modified On : Thu Jul 25 22:31:38 2019
     13// Update Count     : 4359
    1414//
    1515
     
    268268%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    269269%token BOOL COMPLEX IMAGINARY                                                   // C99
    270 %token INT128 UINT128 uuFLOAT80 uuFLOAT128                              // GCC
     270%token INT128 uuFLOAT80 uuFLOAT128                                              // GCC
    271271%token uFLOAT16 uFLOAT32 uFLOAT32X uFLOAT64 uFLOAT64X uFLOAT128 // GCC
    272272%token ZERO_T ONE_T                                                                             // CFA
     
    18261826        | INT128
    18271827                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 ); }
    1828         | UINT128
    1829                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 )->addType( DeclarationNode::newSignedNess( DeclarationNode::Unsigned ) ); }
    18301828        | FLOAT
    18311829                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
  • src/ResolvExpr/AlternativeFinder.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug  8 16:35:00 2019
    13 // Update Count     : 38
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 25 22:37:46 2019
     13// Update Count     : 37
    1414//
    1515
     
    377377        }
    378378
    379         Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue,
    380                         const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
     379        Cost computeConversionCost( Type * actualType, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
    381380                PRINT(
    382381                        std::cerr << std::endl << "converting ";
     
    388387                        std::cerr << std::endl;
    389388                )
    390                 Cost convCost = conversionCost( actualType, formalType, actualIsLvalue, indexer, env );
     389                Cost convCost = conversionCost( actualType, formalType, indexer, env );
    391390                PRINT(
    392391                        std::cerr << std::endl << "cost is " << convCost << std::endl;
     
    403402
    404403        Cost computeExpressionConversionCost( Expression *& actualExpr, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
    405                 Cost convCost = computeConversionCost(
    406                         actualExpr->result, formalType, actualExpr->get_lvalue(), indexer, env );
     404                Cost convCost = computeConversionCost( actualExpr->result, formalType, indexer, env );
    407405
    408406                // if there is a non-zero conversion cost, ignoring poly cost, then the expression requires conversion.
     
    11371135        bool isLvalue( Expression *expr ) {
    11381136                // xxx - recurse into tuples?
    1139                 return expr->result && ( expr->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
     1137                return expr->result && ( expr->result->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
    11401138        }
    11411139
     
    11881186                assert( toType );
    11891187                toType = resolveTypeof( toType, indexer );
    1190                 assert(!dynamic_cast<TypeofType *>(toType));
    11911188                SymTab::validateType( toType, &indexer );
    11921189                adjustExprType( toType, env, indexer );
     
    12151212                        unify( castExpr->result, alt.expr->result, alt.env, needAssertions,
    12161213                                haveAssertions, openVars, indexer );
    1217                         Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(),
    1218                                 indexer, alt.env );
     1214                        Cost thisCost = castCost( alt.expr->result, castExpr->result, indexer,
     1215                                alt.env );
    12191216                        PRINT(
    12201217                                std::cerr << "working on cast with result: " << castExpr->result << std::endl;
     
    16431640                                // xxx - do some inspecting on this line... why isn't result bound to initAlt.type?
    16441641
    1645                                 Cost thisCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(),
    1646                                         indexer, newEnv );
     1642                                Cost thisCost = castCost( alt.expr->result, toType, indexer, newEnv );
    16471643                                if ( thisCost != Cost::infinity ) {
    16481644                                        // count one safe conversion for each value that is thrown away
  • src/ResolvExpr/CastCost.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 06:57:43 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug  8 16:12:00 2019
    13 // Update Count     : 8
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb  2 15:34:36 2016
     13// Update Count     : 7
    1414//
    1515
     
    3737        struct CastCost_old : public ConversionCost {
    3838          public:
    39                 CastCost_old( const Type * dest, bool srcIsLvalue,
    40                         const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc );
     39                CastCost_old( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc );
    4140
    4241                using ConversionCost::previsit;
     
    4645        };
    4746
    48         Cost castCost( const Type * src, const Type * dest, bool srcIsLvalue,
    49                         const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
     47        Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    5048                if ( const TypeInstType * destAsTypeInst = dynamic_cast< const TypeInstType * >( dest ) ) {
    5149                        if ( const EqvClass * eqvClass = env.lookup( destAsTypeInst->name ) ) {
    5250                                if ( eqvClass->type ) {
    53                                         return castCost( src, eqvClass->type, srcIsLvalue, indexer, env );
     51                                        return castCost( src, eqvClass->type, indexer, env );
    5452                                } else {
    5553                                        return Cost::infinity;
     
    5957                                const TypeDecl * type = strict_dynamic_cast< const TypeDecl * >( namedType );
    6058                                if ( type->base ) {
    61                                         return castCost( src, type->base, srcIsLvalue, indexer, env ) + Cost::safe;
     59                                        return castCost( src, type->base, indexer, env ) + Cost::safe;
    6260                                } // if
    6361                        } // if
     
    8078                } else if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * > ( dest ) ) {
    8179                        PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    82                         return convertToReferenceCost( src, refType, srcIsLvalue, indexer, env, [](const Type * t1, const Type * t2, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {
     80                        return convertToReferenceCost( src, refType, indexer, env, [](const Type * t1, const Type * t2, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {
    8381                                return ptrsCastable( t1, t2, env, indexer );
    8482                        });
    8583                } else {
    8684                        PassVisitor<CastCost_old> converter(
    87                                 dest, srcIsLvalue, indexer, env,
    88                                 (Cost (*)( const Type *, const Type *, bool, const SymTab::Indexer &, const TypeEnvironment & ))
     85                                dest, indexer, env,
     86                                (Cost (*)( const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment & ))
    8987                                        castCost );
    9088                        src->accept( converter );
     
    9896        }
    9997
    100         CastCost_old::CastCost_old( const Type * dest, bool srcIsLvalue,
    101                         const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
    102                 : ConversionCost( dest, srcIsLvalue, indexer, env, costFunc ) {
     98        CastCost_old::CastCost_old( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
     99                : ConversionCost( dest, indexer, env, costFunc ) {
    103100        }
    104101
     
    109106                        cost = Cost::unsafe;
    110107                } else {
    111                         cost = conversionCost( basicType, dest, srcIsLvalue, indexer, env );
     108                        cost = conversionCost( basicType, dest, indexer, env );
    112109                } // if
    113110        }
  • src/ResolvExpr/CommonType.cc

    r330d933 rf9bf142  
    190190                                 */
    191191                                  {
    192                 /*      B */                BT Bool,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     192                /*     B */                BT Bool,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    193193                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    194194                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    198198                                  },
    199199                                  {
    200                 /*      C */                BT Char,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     200                /*     C */                BT Char,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    201201                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    202202                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    206206                                  },
    207207                                  {
    208                 /*     SC */          BT SignedChar,          BT SignedChar,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     208                /*    SC */          BT SignedChar,          BT SignedChar,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    209209                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    210210                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    214214                                  },
    215215                                  {
    216                 /*     UC */        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     216                /*    UC */        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    217217                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    218218                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    222222                                  },
    223223                                  {
    224                 /*     SI */      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,    BT ShortUnsignedInt,
     224                /*    SI */      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,    BT ShortUnsignedInt,
    225225                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    226226                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    230230                                  },
    231231                                  {
    232                 /*    SUI */    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,
     232                /*   SUI */    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,
    233233                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    234234                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    238238                                  },
    239239                                  {
    240                 /*      I */           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,
     240                /*     I */           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,
    241241                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    242242                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    246246                                  },
    247247                                  {
    248                 /*     UI */         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,
     248                /*    UI */         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,
    249249                                           BT UnsignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    250250                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    254254                                  },
    255255                                  {
    256                 /*     LI */       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,
     256                /*    LI */       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,
    257257                                         BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    258258                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    262262                                  },
    263263                                  {
    264                 /*    LUI */     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,
     264                /*   LUI */     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,
    265265                                       BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    266266                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    270270                                  },
    271271                                  {
    272                 /*    LLI */   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,
     272                /*   LLI */   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,
    273273                                     BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    274274                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    278278                                  },
    279279                                  {
    280                 /*   LLUI */ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
     280                /*  LLUI */ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
    281281                                   BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
    282282                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    286286                                  },
    287287                                  {
    288                 /*     IB */        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
     288                /*    IB */        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
    289289                                          BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
    290290                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    294294                                  },
    295295                                  {
    296                 /*    UIB */      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
     296                /*   UIB */      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
    297297                                        BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
    298298                                        BT UnsignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    302302                                  },
    303303                                  {
    304                 /*    _FH */            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
     304                /*   _FH */            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
    305305                                              BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
    306306                                              BT uFloat16,            BT uFloat16,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     
    310310                                  },
    311311                                  {
    312                 /*    _FH */     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
     312                /*   _FH */     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
    313313                                       BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
    314314                                       BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     
    318318                                  },
    319319                                  {
    320                 /*     _F */            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
     320                /*    _F */            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
    321321                                              BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
    322322                                              BT uFloat32,            BT uFloat32,            BT uFloat32,     BT uFloat32Complex,            BT uFloat32,     BT uFloat32Complex,
     
    326326                                  },
    327327                                  {
    328                 /*    _FC */     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     328                /*   _FC */     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    329329                                       BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    330330                                       BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     
    334334                                  },
    335335                                  {
    336                 /*      F */               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
     336                /*     F */               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
    337337                                                 BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
    338338                                                 BT Float,               BT Float,               BT Float,        BT FloatComplex,               BT Float,        BT FloatComplex,
     
    342342                                  },
    343343                                  {
    344                 /*     FC */        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
     344                /*    FC */        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
    345345                                          BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
    346346                                          BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
     
    350350                                  },
    351351                                  {
    352                 /*    _FX */           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
     352                /*   _FX */           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
    353353                                             BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
    354354                                             BT uFloat32x,           BT uFloat32x,           BT uFloat32x,    BT uFloat32xComplex,           BT uFloat32x,    BT uFloat32xComplex,
     
    358358                                  },
    359359                                  {
    360                 /*   _FXC */    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
     360                /*  _FXC */    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
    361361                                      BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
    362362                                      BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
     
    366366                                  },
    367367                                  {
    368                 /*     FD */            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
     368                /*    FD */            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
    369369                                              BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
    370370                                              BT uFloat64,            BT uFloat64,            BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,
     
    374374                                  },
    375375                                  {
    376                 /*   _FDC */     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     376                /*  _FDC */     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    377377                                       BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    378378                                       BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     
    382382                                  },
    383383                                  {
    384                 /*      D */              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
     384                /*     D */              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
    385385                                                BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
    386386                                                BT Double,              BT Double,              BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,
     
    390390                                  },
    391391                                  {
    392                 /*     DC */       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     392                /*    DC */       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    393393                                         BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    394394                                         BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     
    398398                                  },
    399399                                  {
    400                 /*   F80X */           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
     400                /*  F80X */           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
    401401                                             BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
    402402                                             BT uFloat64x,           BT uFloat64x,           BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,
     
    406406                                  },
    407407                                  {
    408                 /*  _FDXC */    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     408                /* _FDXC */    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    409409                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    410410                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     
    414414                                  },
    415415                                  {
    416                 /*    F80 */           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
     416                /*   F80*/           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
    417417                                             BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
    418418                                             BT uuFloat80,           BT uuFloat80,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,
     
    422422                                  },
    423423                                  {
    424                 /*    _FB */           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
     424                /*   _FB */           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
    425425                                             BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
    426426                                             BT uFloat128,           BT uFloat128,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,
     
    430430                                  },
    431431                                  {
    432                 /*  _FLDC */    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     432                /* _FLDC */    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    433433                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    434434                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     
    438438                                  },
    439439                                  {
    440                 /*     FB */          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
     440                /*    FB */          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
    441441                                            BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
    442442                                            BT uuFloat128,          BT uuFloat128,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,
     
    446446                                  },
    447447                                  {
    448                 /*     LD */          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
     448                /*    LD */          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
    449449                                            BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
    450450                                            BT LongDouble,          BT LongDouble,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,
     
    454454                                  },
    455455                                  {
    456                 /*    LDC */   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     456                /*   LDC */   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    457457                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    458458                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     
    462462                                  },
    463463                                  {
    464                 /*   _FBX */          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
     464                /*  _FBX */          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
    465465                                            BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
    466466                                            BT uFloat128x,          BT uFloat128x,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
  • src/ResolvExpr/ConversionCost.cc

    r330d933 rf9bf142  
    1010// Created On       : Sun May 17 07:06:19 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Aug 12 10:21:00 2019
    13 // Update Count     : 27
     12// Last Modified On : Mon Jun 24 13:33:00 2019
     13// Update Count     : 26
    1414//
    1515
     
    4646#endif
    4747
    48         Cost conversionCost( const Type * src, const Type * dest, bool srcIsLvalue,
    49                         const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
     48        Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    5049                if ( const TypeInstType * destAsTypeInst = dynamic_cast< const TypeInstType * >( dest ) ) {
    5150                        PRINT( std::cerr << "type inst " << destAsTypeInst->name; )
    5251                        if ( const EqvClass * eqvClass = env.lookup( destAsTypeInst->name ) ) {
    5352                                if ( eqvClass->type ) {
    54                                         return conversionCost( src, eqvClass->type, srcIsLvalue, indexer, env );
     53                                        return conversionCost( src, eqvClass->type, indexer, env );
    5554                                } else {
    5655                                        return Cost::infinity;
     
    6261                                assert( type );
    6362                                if ( type->base ) {
    64                                         return conversionCost( src, type->base, srcIsLvalue, indexer, env )
    65                                                 + Cost::safe;
     63                                        return conversionCost( src, type->base, indexer, env ) + Cost::safe;
    6664                                } // if
    6765                        } // if
     
    8381                } else if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * > ( dest ) ) {
    8482                        PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    85                         return convertToReferenceCost( src, refType, srcIsLvalue, indexer, env, [](const Type * const t1, const Type * t2, const SymTab::Indexer &, const TypeEnvironment & env ){
     83                        return convertToReferenceCost( src, refType, indexer, env, [](const Type * const t1, const Type * t2, const SymTab::Indexer &, const TypeEnvironment & env ){
    8684                                return ptrsAssignable( t1, t2, env );
    8785                        });
    8886                } else {
    8987                        PassVisitor<ConversionCost> converter(
    90                                 dest, srcIsLvalue, indexer, env,
    91                                 (Cost (*)(const Type *, const Type *, bool, const SymTab::Indexer&, const TypeEnvironment&))
     88                                dest, indexer, env,
     89                                (Cost (*)(const Type *, const Type *, const SymTab::Indexer&, const TypeEnvironment&))
    9290                                        conversionCost );
    9391                        src->accept( converter );
     
    10098        }
    10199
    102         static Cost convertToReferenceCost( const Type * src, const Type * dest, bool srcIsLvalue,
    103                         int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
     100        Cost convertToReferenceCost( const Type * src, const Type * dest, int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
    104101                PRINT( std::cerr << "convert to reference cost... diff " << diff << " " << src << " / " << dest << std::endl; )
    105102                if ( diff > 0 ) {
    106103                        // TODO: document this
    107                         Cost cost = convertToReferenceCost(
    108                                 strict_dynamic_cast< const ReferenceType * >( src )->base, dest, srcIsLvalue,
    109                                 diff-1, indexer, env, func );
     104                        Cost cost = convertToReferenceCost( strict_dynamic_cast< const ReferenceType * >( src )->base, dest, diff-1, indexer, env, func );
    110105                        cost.incReference();
    111106                        return cost;
    112107                } else if ( diff < -1 ) {
    113108                        // TODO: document this
    114                         Cost cost = convertToReferenceCost(
    115                                 src, strict_dynamic_cast< const ReferenceType * >( dest )->base, srcIsLvalue,
    116                                 diff+1, indexer, env, func );
     109                        Cost cost = convertToReferenceCost( src, strict_dynamic_cast< const ReferenceType * >( dest )->base, diff+1, indexer, env, func );
    117110                        cost.incReference();
    118111                        return cost;
     
    145138                                PRINT( std::cerr << "reference to rvalue conversion" << std::endl; )
    146139                                PassVisitor<ConversionCost> converter(
    147                                         dest, srcIsLvalue, indexer, env,
    148                                         (Cost (*)(const Type *, const Type *, bool, const SymTab::Indexer&, const TypeEnvironment&))
     140                                        dest, indexer, env,
     141                                        (Cost (*)(const Type *, const Type *, const SymTab::Indexer&, const TypeEnvironment&))
    149142                                                conversionCost );
    150143                                src->accept( converter );
     
    157150                        if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) {
    158151                                PRINT( std::cerr << "converting compatible base type" << std::endl; )
    159                                 assert( src->get_lvalue() == srcIsLvalue );
    160                                 if ( srcIsLvalue ) {
     152                                if ( src->get_lvalue() ) {
    161153                                        PRINT(
    162154                                                std::cerr << "lvalue to reference conversion" << std::endl;
     
    186178        }
    187179
    188         Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, bool srcIsLvalue,
    189                         const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
     180        Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
    190181                int sdepth = src->referenceDepth(), ddepth = dest->referenceDepth();
    191                 Cost cost = convertToReferenceCost( src, dest, srcIsLvalue, sdepth-ddepth, indexer, env, func );
     182                Cost cost = convertToReferenceCost( src, dest, sdepth-ddepth, indexer, env, func );
    192183                PRINT( std::cerr << "convertToReferenceCost result: " << cost << std::endl; )
    193184                return cost;
    194185        }
    195186
    196         ConversionCost::ConversionCost( const Type * dest, bool srcIsLvalue, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
    197                 : dest( dest ), srcIsLvalue( srcIsLvalue ), indexer( indexer ), cost( Cost::infinity ), env( env ), costFunc( costFunc ) {
     187        ConversionCost::ConversionCost( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
     188                : dest( dest ), indexer( indexer ), cost( Cost::infinity ), env( env ), costFunc( costFunc ) {
    198189        }
    199190
     
    226217        // GENERATED BY BasicTypes-gen.cc
    227218        static const int costMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node
    228                 /*               B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
    229                 /*      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,  16,  18,  17, },
    230                 /*      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,  15,  17,  16, },
    231                 /*     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,  15,  17,  16, },
    232                 /*     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,  15,  17,  16, },
    233                 /*     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,  14,  16,  15, },
    234                 /*    SUI */ {  -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,  14,  16,  15, },
    235                 /*      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,  13,  15,  14, },
    236                 /*     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,  13,  15,  14, },
    237                 /*     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,  12,  14,  13, },
    238                 /*    LUI */ {  -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,  12,  14,  13, },
    239                 /*    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,  11,  13,  12, },
    240                 /*   LLUI */ {  -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,  11,  13,  12, },
    241                 /*     IB */ {  -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,  10,  12,  11, },
    242                 /*    UIB */ {  -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,  10,  12,  11, },
    243                 /*    _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,   9,  11,  10, },
    244                 /*    _FH */ {  -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,   7,  -1,  -1,   8,  -1,   9, },
    245                 /*     _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,   8,  10,   9, },
    246                 /*    _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,   6,  -1,  -1,   7,  -1,   8, },
    247                 /*      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,   7,   9,   8, },
    248                 /*     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,   5,  -1,  -1,   6,  -1,   7, },
    249                 /*    _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,   6,   8,   7, },
    250                 /*   _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,   4,  -1,  -1,   5,  -1,   6, },
    251                 /*     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,   5,   7,   6, },
    252                 /*   _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,   3,  -1,  -1,   4,  -1,   5, },
    253                 /*      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,   4,   6,   5, },
    254                 /*     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,   2,  -1,  -1,   3,  -1,   4, },
    255                 /*   F80X */ {  -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,   3,   5,   4, },
    256                 /*  _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,   1,  -1,  -1,   2,  -1,   3, },
    257                 /*    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,   2,   3,   3,   4,   4, },
    258                 /*    _FB */ {  -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, },
    259                 /*  _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,   0,  -1,  -1,   1,  -1,   2, },
    260                 /*     FB */ {  -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,   2,   3, },
    261                 /*     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,  -1,  -1,  -1,   0,   1,   1,   2, },
    262                 /*    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,  -1,  -1,  -1,   0,  -1,   1, },
    263                 /*   _FBX */ {  -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, },
     219                /*             B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
     220                /*     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,  16,  18,  17, },
     221                /*     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,  15,  17,  16, },
     222                /*    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,  15,  17,  16, },
     223                /*    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,  15,  17,  16, },
     224                /*    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,  14,  16,  15, },
     225                /*   SUI */ {  -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,  14,  16,  15, },
     226                /*     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,  13,  15,  14, },
     227                /*    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,  13,  15,  14, },
     228                /*    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,  12,  14,  13, },
     229                /*   LUI */ {  -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,  12,  14,  13, },
     230                /*   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,  11,  13,  12, },
     231                /*  LLUI */ {  -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,  11,  13,  12, },
     232                /*    IB */ {  -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,  10,  12,  11, },
     233                /*   UIB */ {  -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,  10,  12,  11, },
     234                /*   _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,   9,  11,  10, },
     235                /*   _FH */ {  -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,   7,  -1,  -1,   8,  -1,   9, },
     236                /*    _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,   8,  10,   9, },
     237                /*   _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,   6,  -1,  -1,   7,  -1,   8, },
     238                /*     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,   7,   9,   8, },
     239                /*    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,   5,  -1,  -1,   6,  -1,   7, },
     240                /*   _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,   6,   8,   7, },
     241                /*  _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,   4,  -1,  -1,   5,  -1,   6, },
     242                /*    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,   5,   7,   6, },
     243                /*  _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,   3,  -1,  -1,   4,  -1,   5, },
     244                /*     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,   4,   6,   5, },
     245                /*    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,   2,  -1,  -1,   3,  -1,   4, },
     246                /*  F80X */ {  -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,   3,   5,   4, },
     247                /* _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,   1,  -1,  -1,   2,  -1,   3, },
     248                /*   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,   2,   3,   3,   4,   4, },
     249                /*   _FB */ {  -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, },
     250                /* _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,   0,  -1,  -1,   1,  -1,   2, },
     251                /*    FB */ {  -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,   2,   3, },
     252                /*    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,  -1,  -1,  -1,   0,   1,   1,   2, },
     253                /*   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,  -1,  -1,  -1,   0,  -1,   1, },
     254                /*  _FBX */ {  -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, },
    264255                /* _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, },
    265256        }; // costMatrix
     
    274265        // GENERATED BY BasicTypes-gen.cc
    275266        static const int signMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion
    276                 /*               B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
    277                 /*      B */ {   0,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    278                 /*      C */ {  -1,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    279                 /*     SC */ {  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    280                 /*     UC */ {  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    281                 /*     SI */ {  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    282                 /*    SUI */ {  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    283                 /*      I */ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    284                 /*     UI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    285                 /*     LI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    286                 /*    LUI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    287                 /*    LLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    288                 /*   LLUI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    289                 /*     IB */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    290                 /*    UIB */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    291                 /*    _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    292                 /*    _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    293                 /*     _F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    294                 /*    _FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    295                 /*      F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    296                 /*     FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    297                 /*    _FX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    298                 /*   _FXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    299                 /*     FD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    300                 /*   _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,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    301                 /*      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,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    302                 /*     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,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    303                 /*   F80X */ {  -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,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    304                 /*  _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,   0,  -1,  -1,   0,  -1,   0, },
    305                 /*    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,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    306                 /*    _FB */ {  -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,   0,   0,   0,   0,   0,   0, },
    307                 /*  _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,   0,  -1,  -1,   0,  -1,   0, },
    308                 /*     FB */ {  -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,   0,   0,   0,   0,   0, },
    309                 /*     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,  -1,  -1,  -1,   0,   0,   0,   0, },
    310                 /*    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,  -1,  -1,  -1,   0,  -1,   0, },
    311                 /*   _FBX */ {  -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,   0, },
     267                /*             B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
     268                /*     B */ {   0,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     269                /*     C */ {  -1,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     270                /*    SC */ {  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     271                /*    UC */ {  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     272                /*    SI */ {  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     273                /*   SUI */ {  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     274                /*     I */ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     275                /*    UI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     276                /*    LI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     277                /*   LUI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     278                /*   LLI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     279                /*  LLUI */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     280                /*    IB */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     281                /*   UIB */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     282                /*   _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     283                /*   _FH */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     284                /*    _F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     285                /*   _FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     286                /*     F */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     287                /*    FC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     288                /*   _FX */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     289                /*  _FXC */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     290                /*    FD */ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     291                /*  _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,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     292                /*     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,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     293                /*    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,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
     294                /*  F80X */ {  -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,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     295                /* _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,   0,  -1,  -1,   0,  -1,   0, },
     296                /*   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,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
     297                /*   _FB */ {  -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,   0,   0,   0,   0,   0,   0, },
     298                /* _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,   0,  -1,  -1,   0,  -1,   0, },
     299                /*    FB */ {  -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,   0,   0,   0,   0,   0, },
     300                /*    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,  -1,  -1,  -1,   0,   0,   0,   0, },
     301                /*   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,  -1,  -1,  -1,   0,  -1,   0, },
     302                /*  _FBX */ {  -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,   0, },
    312303                /* _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, },
    313304        }; // signMatrix
     
    380371                // recursively compute conversion cost from T1 to T2.
    381372                // cv can be safely dropped because of 'implicit dereference' behavior.
    382                 cost = costFunc( refType->base, dest, srcIsLvalue, indexer, env );
     373                cost = costFunc( refType->base, dest, indexer, env );
    383374                if ( refType->base->tq == dest->tq ) {
    384375                        cost.incReference();  // prefer exact qualifiers
     
    412403                static Type::Qualifiers q;
    413404                static BasicType integer( q, BasicType::SignedInt );
    414                 cost = costFunc( &integer, dest, srcIsLvalue, indexer, env );  // safe if dest >= int
     405                cost = costFunc( &integer, dest, indexer, env );  // safe if dest >= int
    415406                if ( cost < Cost::unsafe ) {
    416407                        cost.incSafe();
     
    422413        void ConversionCost::postvisit( const TypeInstType * inst ) {
    423414                if ( const EqvClass * eqvClass = env.lookup( inst->name ) ) {
    424                         cost = costFunc( eqvClass->type, dest, srcIsLvalue, indexer, env );
     415                        cost = costFunc( eqvClass->type, dest, indexer, env );
    425416                } else if ( const TypeInstType * destAsInst = dynamic_cast< const TypeInstType * >( dest ) ) {
    426417                        if ( inst->name == destAsInst->name ) {
     
    432423                        assert( type );
    433424                        if ( type->base ) {
    434                                 cost = costFunc( type->base, dest, srcIsLvalue, indexer, env ) + Cost::safe;
     425                                cost = costFunc( type->base, dest, indexer, env ) + Cost::safe;
    435426                        } // if
    436427                } // if
     
    443434                        std::list< Type * >::const_iterator destIt = destAsTuple->types.begin();
    444435                        while ( srcIt != tupleType->types.end() && destIt != destAsTuple->types.end() ) {
    445                                 Cost newCost = costFunc( * srcIt++, * destIt++, srcIsLvalue, indexer, env );
     436                                Cost newCost = costFunc( * srcIt++, * destIt++, indexer, env );
    446437                                if ( newCost == Cost::infinity ) {
    447438                                        return;
     
    543534}
    544535
    545 static Cost convertToReferenceCost( const ast::Type * src, const ast::Type * dst,
    546                 int diff, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env,
     536Cost convertToReferenceCost( const ast::Type * src, const ast::Type * dst, int diff,
     537                const ast::SymbolTable & symtab, const ast::TypeEnvironment & env,
    547538                NumCostCalculation func ) {
    548539        if ( 0 < diff ) {
  • src/ResolvExpr/ConversionCost.h

    r330d933 rf9bf142  
    1010// Created On       : Sun May 17 09:37:28 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug  8 16:13:00 2019
    13 // Update Count     : 6
     12// Last Modified On : Mon Jun 24 10:00:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    3333        class TypeEnvironment;
    3434
    35         typedef std::function<Cost(const Type *, const Type *, bool,
    36                 const SymTab::Indexer &, const TypeEnvironment &)> CostFunction;
    37 
     35        typedef std::function<Cost(const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment &)> CostFunction;
    3836        struct ConversionCost : public WithShortCircuiting {
    3937          public:
    40                 ConversionCost( const Type * dest, bool srcIsLvalue,
    41                         const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction );
     38                ConversionCost( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction );
    4239
    4340                Cost get_cost() const { return cost; }
     
    6259          protected:
    6360                const Type * dest;
    64                 bool srcIsLvalue;
    6561                const SymTab::Indexer &indexer;
    6662                Cost cost;
     
    7066
    7167        typedef std::function<int(const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment &)> PtrsFunction;
    72         Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, bool srcIsLvalue,
    73                 const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
     68        Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
    7469
    7570// Some function pointer types, differ in return type.
  • src/ResolvExpr/ResolveAssertions.cc

    r330d933 rf9bf142  
    99// Author           : Aaron B. Moss
    1010// Created On       : Fri Oct 05 13:46:00 2018
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug  8 16:47:00 2019
    13 // Update Count     : 3
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Jul 10 16:10:37 2019
     13// Update Count     : 2
    1414//
    1515
     
    156156                        for ( const auto& assn : x.assns ) {
    157157                                // compute conversion cost from satisfying decl to assertion
    158                                 assert( !assn.match.adjType->get_lvalue() );
    159158                                k += computeConversionCost(
    160                                         assn.match.adjType, assn.decl->get_type(), false, indexer, x.env );
     159                                        assn.match.adjType, assn.decl->get_type(), indexer, x.env );
    161160
    162161                                // mark vars+specialization cost on function-type assertions
  • src/ResolvExpr/typeops.h

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 07:28:22 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug  8 16:36:00 2019
    13 // Update Count     : 5
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Feb  8 09:30:34 2019
     13// Update Count     : 4
    1414//
    1515
     
    8080
    8181        // in CastCost.cc
    82         Cost castCost( const Type * src, const Type * dest, bool srcIsLvalue,
    83                 const SymTab::Indexer & indexer, const TypeEnvironment & env );
     82        Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    8483        Cost castCost(
    8584                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
     
    8786
    8887        // in ConversionCost.cc
    89         Cost conversionCost( const Type * src, const Type * dest, bool srcIsLvalue,
    90                 const SymTab::Indexer & indexer, const TypeEnvironment & env );
     88        Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    9189        Cost conversionCost(
    9290                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
     
    9492
    9593        // in AlternativeFinder.cc
    96         Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue,
     94        Cost computeConversionCost( Type * actualType, Type * formalType,
    9795                const SymTab::Indexer & indexer, const TypeEnvironment & env );
    9896
  • src/SymTab/Validate.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:50:04 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  7 6:42:00 2019
    13 // Update Count     : 360
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Aug 28 13:47:23 2017
     13// Update Count     : 359
    1414//
    1515
     
    8181#include "SynTree/Label.h"             // for operator==, Label
    8282#include "SynTree/Mutator.h"           // for Mutator
    83 #include "SynTree/TopLvalue.h"         // for assertTopLvalue, clearInnerLvalue
    8483#include "SynTree/Type.h"              // for Type, TypeInstType, EnumInstType
    8584#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     
    309308                PassVisitor<FixQualifiedTypes> fixQual;
    310309
    311                 assertTopLvalue( translationUnit );
    312310                {
    313311                        Stats::Heap::newPass("validate-A");
     
    318316                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling
    319317                }
    320                 assertTopLvalue( translationUnit );
    321318                {
    322319                        Stats::Heap::newPass("validate-B");
    323320                        Stats::Time::BlockGuard guard("validate-B");
    324                         assertTopLvalue( translationUnit );
    325321                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
    326322                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    327323                        });
    328                         clearInnerLvalue( translationUnit );
    329                         assertTopLvalue( translationUnit );
    330324                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
    331325                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed
    332326                        });
    333                         assertTopLvalue( translationUnit );
    334327                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
    335328                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    336329                        });
    337                         assertTopLvalue( translationUnit );
    338330                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
    339331                                EliminateTypedef::eliminateTypedef( translationUnit ); //
    340332                        });
    341333                }
    342                 assertTopLvalue( translationUnit );
    343334                {
    344335                        Stats::Heap::newPass("validate-C");
     
    349340                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    350341                }
    351                 assertTopLvalue( translationUnit );
    352342                {
    353343                        Stats::Heap::newPass("validate-D");
    354344                        Stats::Time::BlockGuard guard("validate-D");
    355                         assertTopLvalue( translationUnit );
    356345                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
    357346                                Concurrency::applyKeywords( translationUnit );
    358347                        });
    359                         clearInnerLvalue( translationUnit );
    360                         assertTopLvalue( translationUnit );
    361348                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
    362349                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    363350                        });
    364                         assertTopLvalue( translationUnit );
    365351                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
    366352                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    367353                        });
    368                         assertTopLvalue( translationUnit );
    369354                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
    370355                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay_old
    371356                        });
    372                         clearInnerLvalue( translationUnit );
    373                 }
    374                 assertTopLvalue( translationUnit );
     357                }
    375358                {
    376359                        Stats::Heap::newPass("validate-E");
    377360                        Stats::Time::BlockGuard guard("validate-E");
    378                         assertTopLvalue( translationUnit );
    379361                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
    380362                                Concurrency::implementMutexFuncs( translationUnit );
    381363                        });
    382                         clearInnerLvalue( translationUnit );
    383                         assertTopLvalue( translationUnit );
    384364                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
    385365                                Concurrency::implementThreadStarter( translationUnit );
    386366                        });
    387                         assertTopLvalue( translationUnit );
    388367                        Stats::Time::TimeBlock("Compound Literal", [&]() {
    389368                                mutateAll( translationUnit, compoundliteral );
    390369                        });
    391                         assertTopLvalue( translationUnit );
    392370                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
    393371                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    394372                        });
    395                         clearInnerLvalue( translationUnit );
    396                 }
    397                 assertTopLvalue( translationUnit );
     373                }
    398374                {
    399375                        Stats::Heap::newPass("validate-F");
    400376                        Stats::Time::BlockGuard guard("validate-F");
    401                         assertTopLvalue( translationUnit );
    402377                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
    403378                                FixObjectType::fix( translationUnit );
    404379                        });
    405                         assertTopLvalue( translationUnit );
    406380                        Stats::Time::TimeBlock("Array Length", [&]() {
    407381                                ArrayLength::computeLength( translationUnit );
    408382                        });
    409                         clearInnerLvalue( translationUnit );
    410                         assertTopLvalue( translationUnit );
    411383                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
    412384                                Validate::findSpecialDecls( translationUnit );
    413385                        });
    414                         assertTopLvalue( translationUnit );
    415386                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
    416387                                mutateAll( translationUnit, labelAddrFixer );
    417388                        });
    418                         assertTopLvalue( translationUnit );
    419389                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
    420390                                Validate::handleAttributes( translationUnit );
    421391                        });
    422392                }
    423                 assertTopLvalue( translationUnit );
    424393        }
    425394
  • src/SynTree/AddressExpr.cc

    r330d933 rf9bf142  
    4242AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) {
    4343        if ( arg->result ) {
    44                 if ( arg->get_lvalue() ) {
     44                if ( arg->result->get_lvalue() ) {
    4545                        // lvalue, retains all layers of reference and gains a pointer inside the references
    4646                        set_result( addrType( arg->result ) );
  • src/SynTree/ApplicationExpr.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Aug 12 14:28:00 2019
    13 // Update Count     : 5
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:41:06 2016
     13// Update Count     : 4
    1414//
    1515
     
    7676}
    7777
    78 bool ApplicationExpr::get_lvalue() const {
    79         return result->get_lvalue();
    80 }
    81 
    8278void ApplicationExpr::print( std::ostream &os, Indenter indent ) const {
    8379        os << "Application of" << std::endl << indent+1;
  • src/SynTree/BasicType.cc

    r330d933 rf9bf142  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  4 21:07:44 2019
    13 // Update Count     : 13
     12// Last Modified On : Thu Jan 31 21:37:36 2019
     13// Update Count     : 12
    1414//
    1515
     
    3131bool BasicType::isInteger() const {
    3232        return kind <= UnsignedInt128;
     33#if 0
     34        switch ( kind ) {
     35          case Bool:
     36          case Char:
     37          case SignedChar:
     38          case UnsignedChar:
     39          case ShortSignedInt:
     40          case ShortUnsignedInt:
     41          case SignedInt:
     42          case UnsignedInt:
     43          case LongSignedInt:
     44          case LongUnsignedInt:
     45          case LongLongSignedInt:
     46          case LongLongUnsignedInt:
     47          case SignedInt128:
     48          case UnsignedInt128:
     49                return true;
     50          case Float:
     51          case Double:
     52          case LongDouble:
     53          case FloatComplex:
     54          case DoubleComplex:
     55          case LongDoubleComplex:
     56          case FloatImaginary:
     57          case DoubleImaginary:
     58          case LongDoubleImaginary:
     59          case Float80:
     60          case Float128:
     61                return false;
     62          case NUMBER_OF_BASIC_TYPES:
     63                assert( false );
     64        } // switch
     65        assert( false );
     66        return false;
     67#endif
    3368}
    3469
  • src/SynTree/CommaExpr.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Arg 12 16:11:00 2016
    13 // Update Count     : 2
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Mon May 02 15:19:44 2016
     13// Update Count     : 1
    1414//
    1515
     
    3939}
    4040
    41 bool CommaExpr::get_lvalue() const {
    42         // xxx - as above, shouldn't be an lvalue but that information is used anyways.
    43         return result->get_lvalue();
    44 }
    45 
    4641void CommaExpr::print( std::ostream &os, Indenter indent ) const {
    4742        os << "Comma Expression:" << std::endl;
  • src/SynTree/Expression.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 15 13:43:00 2019
    13 // Update Count     : 64
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 25 22:21:48 2019
     13// Update Count     : 61
    1414//
    1515
     
    6363}
    6464
    65 bool Expression::get_lvalue() const {
    66         assert( !result->get_lvalue() );
    67         return false;
    68 }
    69 
    7065void Expression::print( std::ostream & os, Indenter indent ) const {
    7166        printInferParams( inferParams, os, indent+1, 0 );
     
    139134}
    140135
    141 bool VariableExpr::get_lvalue() const {
    142         return result->get_lvalue();
    143 }
    144 
    145136VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) {
    146137        VariableExpr * funcExpr = new VariableExpr( func );
     
    274265CastExpr::~CastExpr() {
    275266        delete arg;
    276 }
    277 
    278 bool CastExpr::get_lvalue() const {
    279         return result->get_lvalue();
    280267}
    281268
     
    389376        // don't delete the member declaration, since it points somewhere else in the tree
    390377        delete aggregate;
    391 }
    392 
    393 bool MemberExpr::get_lvalue() const {
    394         assert( result->get_lvalue() );
    395         return true;
    396378}
    397379
     
    446428}
    447429
    448 bool UntypedExpr::get_lvalue() const {
    449         return result->get_lvalue();
    450 }
    451430
    452431void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
     
    507486        delete arg2;
    508487        delete arg3;
    509 }
    510 
    511 bool ConditionalExpr::get_lvalue() const {
    512         return result->get_lvalue();
    513488}
    514489
     
    569544}
    570545
    571 bool ConstructorExpr::get_lvalue() const {
    572         return result->get_lvalue();
    573 }
    574 
    575546void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
    576547        os <<  "Constructor Expression: " << std::endl << indent+1;
     
    590561CompoundLiteralExpr::~CompoundLiteralExpr() {
    591562        delete initializer;
    592 }
    593 
    594 bool CompoundLiteralExpr::get_lvalue() const {
    595         assert( result->get_lvalue() );
    596         return true;
    597563}
    598564
     
    646612                result = new VoidType( Type::Qualifiers() );
    647613        }
    648 }
    649 bool StmtExpr::get_lvalue() const {
    650         return result->get_lvalue();
    651614}
    652615void StmtExpr::print( std::ostream & os, Indenter indent ) const {
  • src/SynTree/Expression.h

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 15 13:46:00 2019
    13 // Update Count     : 54
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 25 22:21:44 2019
     13// Update Count     : 50
    1414//
    1515
     
    7171        const Type * get_result() const { return result; }
    7272        void set_result( Type * newValue ) { result = newValue; }
    73         virtual bool get_lvalue() const;
    7473
    7574        TypeSubstitution * get_env() const { return env; }
     
    9998        virtual ~ApplicationExpr();
    10099
    101         bool get_lvalue() const final;
    102 
    103100        Expression * get_function() const { return function; }
    104101        void set_function( Expression * newValue ) { function = newValue; }
     
    123120        UntypedExpr( const UntypedExpr & other );
    124121        virtual ~UntypedExpr();
    125 
    126         bool get_lvalue() const final;
    127122
    128123        Expression * get_function() const { return function; }
     
    213208        virtual ~CastExpr();
    214209
    215         bool get_lvalue() const final;
    216 
    217210        Expression * get_arg() const { return arg; }
    218211        void set_arg( Expression * newValue ) { arg = newValue; }
     
    298291        virtual ~MemberExpr();
    299292
    300         bool get_lvalue() const final;
    301 
    302293        DeclarationWithType * get_member() const { return member; }
    303294        void set_member( DeclarationWithType * newValue ) { member = newValue; }
     
    322313        VariableExpr( const VariableExpr & other );
    323314        virtual ~VariableExpr();
    324 
    325         bool get_lvalue() const final;
    326315
    327316        DeclarationWithType * get_var() const { return var; }
     
    511500        virtual ~ConditionalExpr();
    512501
    513         bool get_lvalue() const final;
    514 
    515502        Expression * get_arg1() const { return arg1; }
    516503        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    537524        virtual ~CommaExpr();
    538525
    539         bool get_lvalue() const final;
    540 
    541526        Expression * get_arg1() const { return arg1; }
    542527        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    625610        ~ConstructorExpr();
    626611
    627         bool get_lvalue() const final;
    628 
    629612        Expression * get_callExpr() const { return callExpr; }
    630613        void set_callExpr( Expression * newValue ) { callExpr = newValue; }
     
    645628        CompoundLiteralExpr( const CompoundLiteralExpr & other );
    646629        virtual ~CompoundLiteralExpr();
    647 
    648         bool get_lvalue() const final;
    649630
    650631        Initializer * get_initializer() const { return initializer; }
     
    705686        virtual ~TupleExpr();
    706687
    707         bool get_lvalue() const final;
    708 
    709688        std::list<Expression*>& get_exprs() { return exprs; }
    710689
     
    725704        TupleIndexExpr( const TupleIndexExpr & other );
    726705        virtual ~TupleIndexExpr();
    727 
    728         bool get_lvalue() const final;
    729706
    730707        Expression * get_tuple() const { return tuple; }
     
    776753        StmtExpr( const StmtExpr & other );
    777754        virtual ~StmtExpr();
    778 
    779         bool get_lvalue() const final;
    780755
    781756        CompoundStmt * get_statements() const { return statements; }
  • src/SynTree/TupleExpr.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug 14 14:34:00 2019
    13 // Update Count     : 5
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 09:42:29 2017
     13// Update Count     : 3
    1414//
    1515
     
    5757}
    5858
    59 bool TupleExpr::get_lvalue() const {
    60         return result->get_lvalue();
    61 }
    62 
    6359void TupleExpr::print( std::ostream &os, Indenter indent ) const {
    6460        os << "Tuple:" << std::endl;
     
    8076TupleIndexExpr::~TupleIndexExpr() {
    8177        delete tuple;
    82 }
    83 
    84 bool TupleIndexExpr::get_lvalue() const {
    85         assert( result->get_lvalue() );
    86         return true;
    8778}
    8879
  • src/SynTree/Type.cc

    r330d933 rf9bf142  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  4 21:05:07 2019
    13 // Update Count     : 45
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 12 15:48:00 2019
     13// Update Count     : 44
    1414//
    1515#include "Type.h"
     
    2424using namespace std;
    2525
    26 const char * BasicType::typeNames[] = {
     26const char *BasicType::typeNames[] = {
     27#if 0
     28        "_Bool",
     29        "char",
     30        "signed char",
     31        "unsigned char",
     32        "signed short int",
     33        "unsigned short int",
     34        "signed int",
     35        "unsigned int",
     36        "signed long int",
     37        "unsigned long int",
     38        "signed long long int",
     39        "unsigned long long int",
     40        "float",
     41        "double",
     42        "long double",
     43        "float _Complex",
     44        "double _Complex",
     45        "long double _Complex",
     46        "float _Imaginary",
     47        "double _Imaginary",
     48        "long double _Imaginary",
     49        "__int128",
     50        "unsigned __int128",
     51        "__float80",
     52        "__float128",
     53        "_Float16",
     54        "_Float32",
     55        "_Float32x",
     56        "_Float64",
     57        "_Float64x",
     58        "_Float128",
     59        "_Float128x",
     60        "_Float16 _Complex",
     61        "_Float32 _Complex",
     62        "_Float32x _Complex",
     63        "_Float64 _Complex",
     64        "_Float64x _Complex",
     65        "_Float128 _Complex",
     66        "_Float128x _Complex",
     67#endif
    2768        "_Bool",
    2869        "char",
     
    66107};
    67108static_assert(
    68         sizeof(BasicType::typeNames) / sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
     109        sizeof(BasicType::typeNames)/sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
    69110        "Each basic type name should have a corresponding kind enum value"
    70111);
     
    111152TypeSubstitution Type::genericSubstitution() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }
    112153
    113 void Type::print( std::ostream & os, Indenter indent ) const {
     154void Type::print( std::ostream &os, Indenter indent ) const {
    114155        if ( ! forall.empty() ) {
    115156                os << "forall" << std::endl;
  • src/SynTree/module.mk

    r330d933 rf9bf142  
    4949      SynTree/TypeSubstitution.cc \
    5050      SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc \
    52       SynTree/TopLvalue.cc
     51      SynTree/DeclReplacer.cc
    5352
    5453SRC += $(SRC_SYNTREE)
  • src/main.cc

    r330d933 rf9bf142  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 23 06:50:08 2019
    13 // Update Count     : 607
     12// Last Modified On : Wed Jun  5 20:35:13 2019
     13// Update Count     : 601
    1414//
    1515
     
    1717#include <execinfo.h>                       // for backtrace, backtrace_symbols
    1818#include <getopt.h>                         // for no_argument, optind, geto...
     19#include <signal.h>                         // for signal, SIGABRT, SIGSEGV
    1920#include <cassert>                          // for assertf
    2021#include <cstdio>                           // for fopen, FILE, fclose, stdin
    2122#include <cstdlib>                          // for exit, free, abort, EXIT_F...
    22 #include <csignal>                         // for signal, SIGABRT, SIGSEGV
    2323#include <cstring>                          // for index
    2424#include <fstream>                          // for ofstream
     
    5959#include "ResolvExpr/Resolver.h"            // for resolve
    6060#include "SymTab/Validate.h"                // for validate
    61 #include "SynTree/TopLvalue.h"              // for assertTopLvalue, clearInn...
    6261#include "SynTree/Declaration.h"            // for Declaration
    6362#include "SynTree/Visitor.h"                // for acceptAll
    6463#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
    6564#include "Virtual/ExpandCasts.h"            // for expandCasts
    66 
    6765
    6866using namespace std;
     
    9694DeclarationNode * parseTree = nullptr;                                  // program parse tree
    9795
    98 static bool waiting_for_gdb = false;                                    // flag to set cfa-cpp to wait for gdb on start
    99 
    10096static std::string PreludeDirector = "";
    10197
    102 static void parse_cmdline( int argc, char *argv[] );
     98static void parse_cmdline( int argc, char *argv[], const char *& filename );
    10399static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false );
    104100static void dump( list< Declaration * > & translationUnit, ostream & out = cout );
     
    169165} // sigAbortHandler
    170166
     167
    171168int main( int argc, char * argv[] ) {
    172169        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
    173170        ostream * output = & cout;
     171        const char * filename = nullptr;
    174172        list< Declaration * > translationUnit;
    175173
     
    183181        // } // for
    184182
    185         parse_cmdline( argc, argv );                                            // process command-line arguments
     183        parse_cmdline( argc, argv, filename );                          // process command-line arguments
    186184        CodeGen::FixMain::setReplaceMain( !nomainp );
    187 
    188         if ( waiting_for_gdb ) {
    189                 std::cerr << "Waiting for gdb" << std::endl;
    190                 std::cerr << "run :" << std::endl;
    191                 std::cerr << "  gdb attach " << getpid() << std::endl;
    192                 raise(SIGSTOP);
    193         } // if
    194185
    195186        try {
     
    197188                if ( optind < argc ) {                                                  // any commands after the flags ? => input file name
    198189                        input = fopen( argv[ optind ], "r" );
    199                         assertf( input, "cannot open %s because %s\n", argv[ optind ], strerror( errno ) );
     190                        assertf( input, "cannot open %s\n", argv[ optind ] );
     191                        // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to)
     192                        if ( filename == nullptr ) filename = argv[ optind ];
     193                        // prelude filename comes in differently
     194                        if ( libcfap ) filename = "prelude.cfa";
    200195                        optind += 1;
    201196                } else {                                                                                // no input file name
    202197                        input = stdin;
     198                        // if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass
     199                        // a fake name along
     200                        if ( filename == nullptr ) filename = "stdin";
    203201                } // if
    204202
     
    259257                Stats::Time::StopBlock();
    260258
    261                 //std::cerr << "Post-Parse Check" << std::endl;
    262                 clearInnerLvalue( translationUnit );
    263                 assertTopLvalue( translationUnit );
    264 
    265259                // add the assignment statement after the initialization of a type parameter
    266260                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
     
    281275                } // if
    282276
    283                 assertTopLvalue( translationUnit );
    284277                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
    285                 assertTopLvalue( translationUnit );
    286278                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
    287                 assertTopLvalue( translationUnit );
    288279                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
    289                 assertTopLvalue( translationUnit );
    290280                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
    291                 assertTopLvalue( translationUnit );
    292281                if ( libcfap ) {
    293282                        // generate the bodies of cfa library functions
     
    313302                } // if
    314303
    315                 assertTopLvalue( translationUnit );
    316 
    317304                PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
    318305                if ( exprp ) {
     
    321308                } // if
    322309
    323                 clearInnerLvalue( translationUnit );
    324                 assertTopLvalue( translationUnit );
    325 
    326310                // fix ObjectDecl - replaces ConstructorInit nodes
    327311                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
    328                 clearInnerLvalue( translationUnit );
    329                 assertTopLvalue( translationUnit );
    330312                if ( ctorinitp ) {
    331313                        dump ( translationUnit );
     
    334316
    335317                PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    336                 assertTopLvalue( translationUnit );
    337318
    338319                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
    339                 assertTopLvalue( translationUnit );
    340320
    341321                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
    342                 clearInnerLvalue( translationUnit );
    343                 assertTopLvalue( translationUnit );
    344322
    345323                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
    346                 clearInnerLvalue( translationUnit );
    347                 assertTopLvalue( translationUnit );
    348324
    349325                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
    350                 assertTopLvalue( translationUnit );
    351326
    352327                if ( tuplep ) {
     
    356331
    357332                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
    358                 assertTopLvalue( translationUnit );
    359333
    360334                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
     
    363337                        return EXIT_SUCCESS;
    364338                } // if
    365                 clearInnerLvalue( translationUnit );
    366                 assertTopLvalue( translationUnit );
    367339                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
    368                 clearInnerLvalue( translationUnit );
    369                 assertTopLvalue( translationUnit );
     340
    370341
    371342                if ( bboxp ) {
     
    374345                } // if
    375346                PASS( "Box", GenPoly::box( translationUnit ) );
    376                 clearInnerLvalue( translationUnit );
    377                 assertTopLvalue( translationUnit );
    378347
    379348                if ( bcodegenp ) {
     
    387356
    388357                CodeTools::fillLocations( translationUnit );
    389                 assertTopLvalue( translationUnit );
    390358                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
    391359
     
    438406
    439407
    440 static const char optstring[] = ":hlLmNnpP:S:twW:D:";
     408static const char optstring[] = ":hlLmNnpP:S:twW:D:F:";
    441409
    442410enum { PreludeDir = 128 };
     
    453421        { "statistics", required_argument, nullptr, 'S' },
    454422        { "tree", no_argument, nullptr, 't' },
    455         { "gdb", no_argument, nullptr, 'g' },
    456423        { "", no_argument, nullptr, 0 },                                        // -w
    457424        { "", no_argument, nullptr, 0 },                                        // -W
    458425        { "", no_argument, nullptr, 0 },                                        // -D
     426        { "", no_argument, nullptr, 0 },                                        // -F
    459427        { nullptr, 0, nullptr, 0 }
    460428}; // long_opts
     
    471439        "<directory> prelude directory for debug/nodebug",      // no flag
    472440        "<option-list> enable profiling information:\n          counters,heap,time,all,none", // -S
    473         "building cfa standard lib",                                                                    // -t
    474         "wait for gdb to attach",                                                                       // -g
     441        "build in tree",                                                                        // -t
    475442        "",                                                                                                     // -w
    476443        "",                                                                                                     // -W
    477444        "",                                                                                                     // -D
     445        "",                                                                                                     // -F
    478446}; // description
    479447
     
    510478
    511479static void usage( char *argv[] ) {
    512     cout << "Usage: " << argv[0] << " [options] [input-file (default stdin)] [output-file (default stdout)], where options are:" << endl;
     480    cout << "Usage: " << argv[0] << " options are:" << endl;
    513481        int i = 0, j = 1;                                                                       // j skips starting colon
    514482        for ( ; long_opts[i].name != 0 && optstring[j] != '\0'; i += 1, j += 1 ) {
     
    536504} // usage
    537505
    538 static void parse_cmdline( int argc, char * argv[] ) {
     506static void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    539507        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    540508
     
    582550                        Stats::parse_params( optarg );
    583551                        break;
    584                   case 't':                                                                             // building cfa stdlib
     552                  case 't':                                                                             // build in tree
    585553                        treep = true;
    586                         break;
    587                   case 'g':                                                                             // wait for gdb
    588                         waiting_for_gdb = true;
    589554                        break;
    590555                  case 'w':                                                                             // suppress all warnings, hidden
     
    610575                  case 'D':                                                                             // ignore -Dxxx, forwarded by cpp, hidden
    611576                        break;
     577                  case 'F':                                                                             // source file-name without suffix, hidden
     578                        filename = optarg;
     579                        break;
    612580                  case '?':                                                                             // unknown option
    613581                        if ( optopt ) {                                                         // short option ?
  • tests/.expect/gccExtensions.x64.txt

    r330d933 rf9bf142  
    291291    signed int _X2m2A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    292292    signed int _X2m3A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    293     void _X4f128Fv_n__2(__int128 _X1in_2);
    294     void _X4f128Fv_o__2(unsigned __int128 __anonymous_object0);
    295     __int128 _X6i128_0n_2;
    296     {
    297         ((void)_X4f128Fv_n__2(_X6i128_0n_2));
    298     }
    299 
    300     unsigned __int128 _X6i128_1o_2;
    301     {
    302         ((void)_X4f128Fv_o__2(_X6i128_1o_2));
    303     }
    304 
    305     __int128 _X6i128_2n_2;
    306     {
    307         ((void)_X4f128Fv_n__2(_X6i128_2n_2));
    308     }
    309 
    310     unsigned __int128 _X6i128_3o_2;
    311     {
    312         ((void)_X4f128Fv_o__2(_X6i128_3o_2));
    313     }
    314 
     293    {
     294        ((void)(_X12_retval_maini_1=0) /* ?{} */);
     295    }
     296
     297    return _X12_retval_maini_1;
    315298    {
    316299        ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x86.txt

    r330d933 rf9bf142  
    296296
    297297    return _X12_retval_maini_1;
     298    {
     299        ((void)(_X12_retval_maini_1=0) /* ?{} */);
     300    }
     301
     302    return _X12_retval_maini_1;
    298303}
    299304static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return _X4mainFi_iPPKc__1((signed int )argc, (const char **)argv); }
  • tests/Makefile.am

    r330d933 rf9bf142  
    2222debug=yes
    2323installed=no
    24 archiveerrors=
    2524
    2625INSTALL_FLAGS=-in-tree
     
    5756#----------------------------------------------------------------------------------------------------------------
    5857all-local :
    59         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     58        @+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} ${quick_test}
    6059
    6160all-tests :
    62         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     61        @+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    6362
    6463clean-local :
  • tests/Makefile.in

    r330d933 rf9bf142  
    235235CYGPATH_W = @CYGPATH_W@
    236236DEFS = @DEFS@
    237 DEMANGLER = @DEMANGLER@
    238237DEPDIR = @DEPDIR@
    239238DLLTOOL = @DLLTOOL@
     
    261260LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    262261LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    263 LIBDEMANGLE = @LIBDEMANGLE@
    264262LIBOBJS = @LIBOBJS@
    265263LIBS = @LIBS@
     
    377375debug = yes
    378376installed = no
    379 archiveerrors =
    380377INSTALL_FLAGS = -in-tree
    381378DEBUG_FLAGS = -debug -O0
     
    771768#----------------------------------------------------------------------------------------------------------------
    772769all-local :
    773         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     770        @+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} ${quick_test}
    774771
    775772all-tests :
    776         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     773        @+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    777774
    778775clean-local :
  • tests/gccExtensions.cfa

    r330d933 rf9bf142  
    1010// Created On       : Sun Aug 14 17:28:17 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug  5 18:04:37 2019
    13 // Update Count     : 28
     12// Last Modified On : Tue Nov  6 17:54:20 2018
     13// Update Count     : 11
    1414//
    1515
     
    5050
    5151  L1: L2:
    52         asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5"
    53                            : /* No outputs. */
    54                            : "r"(src), "r"(&dst)
    55                            : "r5", "memory"
    56                            : L1, L2 );
     52        asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5"
     53                           : /* No outputs. */
     54                           : "r"(src), "r"(&dst)
     55                           : "r5", "memory"
     56                           : L1, L2 );
    5757
    5858        // alternative type/qualifer names
     
    110110        struct __attribute(()) s4 { int i; } x2, y2 __attribute(());
    111111
    112         int m1[10] __attribute(());
    113         int m2[10][10] __attribute(());
     112        int m1 [10] __attribute(());
     113        int m2 [10][10] __attribute(());
    114114        int __attribute(()) m3 [10][10];
    115115//      int ( __attribute(()) m4 [10] )[10];
    116116
    117         // int128
    118 
    119 #if defined( __SIZEOF_INT128__ )
    120         void f128( __int128 i );
    121         void f128( __uint128_t );
    122 
    123         __int128 i128_0;
    124         f128( i128_0 );
    125         unsigned __int128 i128_1;
    126         f128( i128_1 );
    127         __int128_t i128_2;
    128         f128( i128_2 );
    129         __uint128_t i128_3;
    130         f128( i128_3 );
    131 #endif
     117        return 0;
    132118}
    133119
  • tests/pybin/settings.py

    r330d933 rf9bf142  
    44from . import tools
    55
    6 global original_path
    7 
    86try :
    9         original_path = os.getcwd()
    107        testpath = os.path.dirname(os.path.abspath(os.path.join(os.getcwd(), sys.argv[0])))
    118        sys.path.append(testpath)
     
    2219class Architecture:
    2320        KnownArchitectures = {
    24                 'x64'           : 'x64',
    25                 'x86-64'        : 'x64',
    26                 'x86_64'        : 'x64',
    27                 'x86'           : 'x86',
    28                 'aarch64'       : 'arm',
     21                'x64'                   : 'x64',
     22                'x86-64'                : 'x64',
     23                'x86_64'                : 'x64',
     24                'aarch64'               : 'x64',
     25                'x86'                   : 'x86',
    2926                'i386'          : 'x86',
    3027                'i486'          : 'x86',
    3128                'i686'          : 'x86',
    3229                'Intel 80386'   : 'x86',
    33                 'arm'           : 'arm',
    34                 'ARM'           : 'arm',
     30                'arm'                   : 'arm',
     31                'ARM'                   : 'arm',
    3532        }
    3633
     
    116113        global timeout
    117114        global output_width
    118         global archive
    119115
    120116        dry_run      = options.dry_run
     
    126122        timeout      = Timeouts(options.timeout, options.global_timeout)
    127123        output_width = 24
    128         archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
    129124
    130125
  • tests/pybin/tools.py

    r330d933 rf9bf142  
    22import argparse
    33import contextlib
    4 import datetime
    54import fileinput
    65import multiprocessing
     
    274273################################################################################
    275274
    276 def pretty_now():
    277         ts = time.time()
    278         print(ts, file=sys.stderr)
    279         return datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S')
    280 
    281275# check if arguments is yes or no
    282276def yes_no(string):
     
    310304        return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
    311305
    312 def core_archive(dst, name, exe):
    313         # Get the files to copy
    314         core = os.path.join(os.getcwd(), "core" )
    315 
    316         # Uncomment if we want timestamps on coredumps
    317         # dst  = os.path.join(dst, "%s_%s" % (name, pretty_now()))
    318 
    319         # make a directory for this test
    320         mkdir(os.path.join(dst, "dir"))
    321 
    322         # moves the files
    323         mv( core, os.path.join(dst, "core" ) )
    324         mv( exe , os.path.join(dst, name   ) )
    325 
    326         # return explanatory test
    327         return "Archiving %s (executable and core) to %s" % (os.path.relpath(exe, settings.BUILDDIR), os.path.relpath(dst, settings.original_path))
    328 
    329306class Timed:
    330307    def __enter__(self):
  • tests/test.py

    r330d933 rf9bf142  
    9191        parser.add_argument('--all', help='Run all test available', action='store_true')
    9292        parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
    93         parser.add_argument('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='')
    9493        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
    9594        parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
     
    180179                        error = error + info if error else info
    181180
    182                         if settings.archive:
    183                                 error = error + '\n' + core_archive(settings.archive, test.target(), exe_file)
    184 
    185181
    186182
     
    299295        # users may want to simply list the tests
    300296        if options.list_comp :
    301                 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='')
     297                print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='')
    302298                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    303299
  • tools/Makefile.in

    r330d933 rf9bf142  
    225225CYGPATH_W = @CYGPATH_W@
    226226DEFS = @DEFS@
    227 DEMANGLER = @DEMANGLER@
    228227DEPDIR = @DEPDIR@
    229228DLLTOOL = @DLLTOOL@
     
    251250LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    252251LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    253 LIBDEMANGLE = @LIBDEMANGLE@
    254252LIBOBJS = @LIBOBJS@
    255253LIBS = @LIBS@
  • tools/prettyprinter/Makefile.in

    r330d933 rf9bf142  
    254254CYGPATH_W = @CYGPATH_W@
    255255DEFS = @DEFS@
    256 DEMANGLER = @DEMANGLER@
    257256DEPDIR = @DEPDIR@
    258257DLLTOOL = @DLLTOOL@
     
    280279LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    281280LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    282 LIBDEMANGLE = @LIBDEMANGLE@
    283281LIBOBJS = @LIBOBJS@
    284282LIBS = @LIBS@
Note: See TracChangeset for help on using the changeset viewer.